Below is the sample source used for debugging test
#include <stdio.h>
int k() {
puts("test");
// above line repeats to certain amounts
return 0;
}
int main() {
puts("test");
// above line repeats to certain amounts
return 0;
}
I compiled above with :
clang -g -o test test.c
When I run list main
in the LLDB prompt, LLDB shows the lines that are part of the int k() {...}
. Even the first line of int main() {...}
is not shown.
Even more weird, LLDB sets correct breakpoint for the symbol main
.
What's going on with LLDB???
Given your example, I see:
(lldb) list main
File: /tmp/test.c
3 puts("test");
4 // above line repeats to certain amounts
5 return 0;
6 }
7
8 int main() {
9 puts("test");
10 // above line repeats to certain amounts
11 return 0;
12 }
When lldb lists a function by name, it shows a window around the symbol name, because often times people put the return type on a separate line from the function name, but the function name's line number is always where the debug information tells lldb the function is. This way you can see the whole function definition. But the actual name should be roughly in the middle of the listing.
Note also that the list command auto-repeat will continue the listing, so you can just keep hitting Return (which auto-repeats the last command) to see more of your source.
If that's not what you see, first try running lldb -x
to make sure that you don't have something in your .lldbinit that is affecting this.
If that still doesn't help, please file a bug with http://bugs.llvm.org.