I'm having trouble getting lldb to read generated DWARF source line metadata

Hey folks,

I'm writing a Common Lisp compiler that uses LLVM as the back-end.

I'm generating DWARF source line metadata and I think I'm doing everything correctly but when I load it into the latest version of lldb the line number table is messed up and I can't set breakpoints.

I've prepared a test case and put it here: https://dl.dropboxusercontent.com/u/6229900/dwarf1_new.txt

The test case above is a flat text file with six sections separated by they "SECTION" keyword (all-caps).

I'm using llvm/clang and lldb builds that are Top-of-Tree and less than 48 hours old.

I know it looks like there is a lot of llvm-IR being generated and its partly because I have a lot of my own debugging code in there and partly because Common Lisp has closures and I'm not yet using escape analysis to optimize away environment passing.

I'm compiling the Common Lisp code to IR and then compiling that to an object file and linking it into an OS X bundle (like a shared library).

I'm loading that bundle into my executable using "dlopen" and I'm hoping that the DWARF debugging information makes it into lldb.

However once I do all that and type: image dump line-table dwarf1.lsp All I get is:

Any help would be appreciated.



Christian Schafmeister
Associate Professor
Chemistry Department
Temple University

In order for DWARF to be linked into the final output, your executable must contain a debug map. The debug map consists of STAB entries in the mach-o symbol table of the main executable. A quick example:

% cat main.c
    return 0;

int main (int argc, char const *argv, char const *envp)
    return a_function_to_call();
% clang -g -O0 -c main.c
% clang -g -O0 main.o

Now we can use dsymutil to dump the raw mach-o symbol table by using the "-s" option:

% dsymutil -s a.out