Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LLDB tab completion for symbol names

Tags:

lldb

I'm using lldb from the command line to debug a simple C program.

On my machine at work, I was able to use tab completion for symbol names. For example, if I type "b ma" then Tab, it'll tab-complete to "b main". The same goes for other functions.

However, I cannot get this feature to work on my laptop, where an actual tab (ASCII value 9) is inserted after the cursor. Both machines are running 10.8.4 and have the latest Xcode.

Any ideas?

like image 962
zliuva Avatar asked Aug 14 '13 14:08

zliuva


1 Answers

I think you're running gdb on one of your two systems.

lldb can do tab completion -- it can do more sophisticated tab completion than gdb -- but you have to use the canonical form of the lldb commands for it to work. The b command you're using is an alias (a regular expression alias - a list of regular expressions that try to parse your breakpoint command and do the right thing) which doesn't give the lldb tab completion engine enough information about context to do anything.

Instead, if you were to do

(lldb) br s -n ma<TAB>

it would autocomplete. This is the short form of breakpoint set --name, of course.

The cleverness of lldb comes in to effect when you realize that lldb can tab complete lots of different arguments -- breakpoint set --filefileTab will complete "file" as a filename. breakpoint set --selector will autocomplete selector names. breakpoint set --shlib (which limits the breakpoint to only set in a specific dylib/framework/binary) will autocomplete with the list of dylibs/frameworks/binaries.

At some point in the future we want to get tab completion working with alias commands like b but no one has had time to tackle that one yet.

like image 163
Jason Molenda Avatar answered Jun 01 '23 08:06

Jason Molenda