This is convenient for commands whose arguments might be some complex expression that would be clumsy to protect with backslashes. For instance, the expression command is a raw command. When you look up a command with help, the output for a command tells you whether the command is raw or not so that you know what to expect. Raw commands can still have options, if your command string has dashes in it, you indicate that these are not option markers by putting an option termination -- after the command name but before the command string.
|Published (Last):||20 October 2011|
|PDF File Size:||12.15 Mb|
|ePub File Size:||11.92 Mb|
|Price:||Free* [*Free Regsitration Required]|
The command syntax for basic commands is very simple, arguments, options and option values are all white-space separated, and double-quotes are used to protect white-spaces in an argument. If you need to put a backslash or double-quote character in an argument you back-slash it in the argument. In gdb, to set a breakpoint, you might enter gdb break foo. As time went on, the parser that tells foo. The lldb commands are more verbose but also more precise and allow for intelligent auto completion.
To set the same file and line breakpoint in LLDB you can enter either of: lldb breakpoint set --file foo. This is convenient since it allows you to set common conditions or commands without having to specify them multiple times: lldb breakpoint set --name foo --name bar Setting breakpoints by name is even more specialized in LLDB as you can specify that you want to set a breakpoint at a function by method name.
Suggestions on more interesting primitives of this sort are also very welcome. Just like gdb, the lldb command interpreter does a shortest unique string match on command names, so the following two commands will both execute the same command: lldb breakpoint set -n "-[SKTGraphicView alignLeftEdges:]" lldb br s -n "-[SKTGraphicView alignLeftEdges:]" lldb also supports command completion for source file names, symbol names, file names, etc.
Completion is initiated by a hitting a TAB. The individual commands are pretty extensively documented. You can use the help command to get an overview of which commands are available or to obtain details about specific commands. There is also an apropos command that will search the help text for all commands for a particular word and dump a summary help string for each matching command. Finally, there is a mechanism to construct aliases for commonly used commands.
So for instance if you get annoyed typing: lldb breakpoint set --file foo. But it mostly works, and makes the transition easier. Also by popular demand, it is aliased to b. If you actually want to learn the lldb command set natively, that means it will get in the way of the rest of the breakpoint commands. This is convenient for commands whose arguments might be some complex expression that would be painful to backslash protect.
First we need to set the program to debug. You can use help breakpoint set to see all the options for breakpoint setting. For instance, break by selector would set a breakpoint on all the methods that implement that selector in the classes in your program. Similarly, a file and line breakpoint might result in multiple locations if that file and line were inlined in different places in your code.
The other piece of information in the breakpoint listing is whether the breakpoint location was resolved or not. A location gets resolved when the file address it corresponds to gets loaded into the program you are debugging. For instance if you set a breakpoint in a shared library that then gets unloaded, that breakpoint location will remain, but it will no longer be resolved.
You can delete, disable, set conditions and ignore counts either on all the locations generated by your logical breakpoint, or on any one of the particular locations your specification resolved to. For instance if we wanted to add a command to print a backtrace when we hit this breakpoint we could do: lldb breakpoint command add 1.
This is an convenient point to bring up another feature of the lldb command help. Do: lldb help break command add Add a set of commands to a breakpoint, to be executed whenever the breakpoint is hit. The latter set of information e. It is fairly common to want to apply one set of options to a number of breakpoints.
Breakpoint names provide a convenient solution to this problem. The simple solution would be to use the name to gather the breakpoints you want to affect this way into a group.
The connection from name to breakpoints remains live, so when you change the options configured on the name, all the breakpoints pick up those changes. This makes it easy to use configured names to experiment with your options. You can make breakpoint names in your. You can also make a breakpoint name from the options set on a breakpoint: lldb breakpoint name configure -B 1 SelfNil which makes it easy to copy behavior from one breakpoint to a set of others.
Process stopped and was programmatically restarted. In a multi-threaded environment it is very common for more than one thread to hit your breakpoint s before the kernel actually returns control to the debugger. In that case, you will see all the threads that stopped for some interesting reason listed in the stop message. After launching, we can continue until we hit our breakpoint.
When we eventually support keeping some threads running while others are stopped this will be particularly important. For convenience, however, all the stepping commands have easy aliases. The other program stepping commands are pretty much the same as in gdb.
A process, by default, will share the lldb terminal with the inferior process. When in this mode, much like when debugging with gdb, when the process is running anything you type will go to the STDIN of the inferior process. This might be a little disconcerting to gdb users when always have an lldb prompt. This way of operation will set us up for a future debugging mode called thread centric debugging.
This mode will allow us to run all threads and only stop the threads that are at breakpoints or have exceptions or signals. The question of disabling stdio when running brings up a good opportunity to show how to set debugger properties in general. For instance, in this case you would say: lldb settings set target. We tried to organize the settings hierarchically using the structure of the basic entities in the debugger.
For the most part anywhere you can specify a setting on a generic entity threads, for example you can also apply the option to a particular instance, which can also be convenient at times. For instance: lldb frame variable self.
LLDB to GDB Command Map
LLDB Quick Start Guide