How to preserve command history?

Hello,

I've just tried using lldb on Ubuntu* and I couldn't get the command
history to work. More specifically, the command history was not
preserved between the sessions. IIUC, one has to create the lldb-history
file for this to work:

mkdir -p ~/.lldb/
touch ~/.lldb/lldb-history

This is rather non-obvious and AFAIK undocumented solution (and very
different to what's required with GDB).

Is there a better way to achieve this? Would it make sense to update the
docs with this information (e.g.
lldb – The Debugger — The LLDB Debugger)? I'm happy to
submit a patch.

Thanks,
-Andrzej

* lldb-8 on Ubuntu 16.04
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

LLDB is explicitly creating the .lldb directory for the user (see Editline.cpp -> GetHistoryFilePath). Is this also happening in a more recent LLDB version? It’s working for me on the latest release on Arch.

Cheers for your quick reply! You're probably referring to this:

That's a fairly recent change so that explains why it didn't work for me
with lldb-8. I've also checked lldb-10 on Arch and that indeed works
out-of-the-box. Guess I need to make sure I always use the latest and
greatest.

-Andrzej