Command history line editing

Hello lldb devs,

Hello lldb devs,

If you want to see the exact configuration of LLDB’s command interpreter see the Editline::ConfigureEditor() function in Editline.cpp. You can edit your ~/.editrc and override anything you want, so it is highly configurable.

Mine contains:

$ cat ~/Dropbox/.editrc
lldb:bind ‘^[[5C’ vi-next-word
lldb:bind ‘^[[5D’ vi-prev-word
lldb:bind ‘^D’ ed-delete-next-char
lldb:bind ‘^B’ ed-command
lldb:bind ‘^P’ ed-search-prev-history
lldb:bind ‘^N’ ed-search-next-history

.editrc is for all apps, but you can bind “lldb” specific bindings as shown above.


It is because lldb uses libedit while bash (and gdb) use readline.

I guess it has licensing reasons as readline is GPL (not LGPL) and Apple seems
to avoid GPL the family of licenses. IANAL but I think an alternative linking
with readline while keeping the libedit compatibility still in place would not
taint LLDB by the GPL license. And then OSes (such as Linux or for OSX is it
Homebrew?) already using GPL software could link LLDB with readline.


It's not just Apple that avoids GPL. Many LLVM users cannot use GPL. Adding GPL code to LLDB is a non-starter.

License questions need to be cleared with the LLVM Foundation.
But my non-lawyer understanding is no GPL.

readline has been around for donkeys’ years. I was hacking it in MKSToolkit back in the nineties. That implementation had a bug that hosed the debugger’s command line and a shell work-around to resolve it. Presumably, there must be a clean-room version of readline somewhere that does not use GPL? bash owns the command line so applications should mimic its behavior, or at least offer a user-selectable option. Say, either emacs or vi editing modes, as bash itself does.

There is - editline.