1
votes

I'm using LLDB for the first time. I'm running MacOSX Mavericks. For some reason, I cannot get LLDB to print any lines of source code. Rather, the output appears to be assembly instruction set. How do I "fix" this so it shows the code instead?

[c_src]> lldb a.out

Current executable set to 'a.out' (x86_64).
(lldb) breakpoint set -n main
Breakpoint 1: where = a.out main, address = 0x0000000100000d60
(lldb) run
Process 54010 launched: a.out (x86_64)
Process 54010 stopped
* thread #1: tid = 0x202742, 0x0000000100000d60 a.outmain, queue = com.apple.main-thread, stop reason = breakpoint 1.1 frame #0: 0x0000000100000d60 a.outmain
a.out`main: -> 0x100000d60: pushq %rbp 0x100000d61: movq %rsp, %rbp 0x100000d64: subq $2032, %rsp 0x100000d6b: movq 4766(%rip), %rax ; (void *)0x00007fff72d37420: __stack_chk_guard

(lldb) s

Process 54010 stopped * thread #1: tid = 0x202742, 0x0000000100000d61 a.outmain + 1, queue = 'com.apple.main-thread, stop reason = instruction step into
frame #0: 0x0000000100000d61 a.out
main + 1 a.out`main + 1:
-> 0x100000d61: movq %rsp, %rbp
0x100000d64: subq $2032, %rsp
0x100000d6b: movq 4766(%rip), %rax ; (void *)0x00007fff72d37420: __stack_chk_guard 0x100000d72: movq (%rax), %rax

I'm trying to get the "s" command to show where it has stepped to in the code.

1

1 Answers

2
votes

Looks like you haven't built your a.out with debug information. For instance, if lldb had debug info for a.out, it would have printed the source line in reporting the breakpoint at main.

If you are building your a.out by hand, remember the -g flag. If you are using Xcode, be sure to set the Debug Format to DWARF.