How to get parameters using symbolic breakpoints in Objective-C

If you debug your code on the device the parameters when you hit your breakpoint will consistently be in registers r0, r1, and r2. If you use po $r0 you’ll see the object receiving setSelected. If you use po $r1 you’ll get “no Objective-C description available” because that’s the selector. Inspect $r2 to see if … Read more

po in LLDB with swift

That error sounds like it might be because DWARF is not telling LLDB where to find your self object. Given the nature of Swift, LLDB needs to know the type of self in order to be able to inject an expression inside your local scope. One way to find out if that is your problem … Read more

Permanently configuring LLDB (in Xcode 4.3.2) not to stop on signals

In case anyone else ever has this question, I finally solved it by adding a breakpoint in NSApplicationMain() (for plain C programs, main() would of course work as well). I set the breakpoint action to process handle SIGUSR2 -n true -p true -s false, and enabled the “Automatically continue after evaluating” option. If anyone has … Read more

lldb fails to print variable values with “error: reference to ‘id’ is ambiguous”

I found one workaround: Use ‘Edit scheme’ under the ‘Product’ menu, select ‘Run’ in the left bar, the ‘Info’ tab, and change the Debugger to gdb (this does not apply to xcode 5, which no longer has gdb). Apparently Apple thought they’d fixed this bug in xcode 4.3.1, but it still happens. I submitted some … Read more

Does LLDB have convenience variables ($var)?

I finally figured it out myself. Run help expr in LLDB and you will see: User defined variables: You can define your own variables for convenience or to be used in subsequent expressions. You define them the same way you would define variables in C. If the first character of your user defined variable is … Read more

Is it possible to debug a gcc-compiled program using lldb, or debug a clang-compiled program using gdb?

In theory you should be able to debug a GCC-built program with lldb and an LLVM-built program with gdb. In both cases you should compile with -g. This is because both compilers generate object files in the same format (e.g., on Linux, both will generate ELF files with DWARF debug info) and both debuggers know … Read more

Is there a “TUI” mode for standalone lldb?

In top of tree svn source lldb there’s a very new command line GUI mode that’s been added by Greg Clayton. It’s pretty neat with separate windows for the source, local variables, stack, threads, registers, etc. No console window yet. It’s pretty cool. See http://lldb.llvm.org/build.html for how to build lldb from source if you’d like … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)