assert in symbolfiledwarf.cpp

In SymbolFileDWARF.cpp:959 there's code like:
     DWARFCompileUnit* dwarf_cu = GetDWARFCompileUnit(sc.comp_unit);
     assert(dwarf_cu);

However in some circumstances it can be that dwarf_cu returns null (if the MACH file can't find the compile unit for this source file).

A simple:

     if (!dwarf_cu)
             return false;

Will at least not make it crash(it won't find the symbol, but that's a different issue, it shouldn't assert on something like this).

Fixed with:

% svn commit
Sending source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Transmitting file data .
Committed revision 167236.

It won't crash anymore, butyou will want to find out why this assert was firing off. A DWARF DW_TAG_compile_unit should have been what caused us to create the lldb_private::CompileUnit item in the first place, so for it not be able to be found a little bit later means something is very wrong.

Greg

Op 1-11-2012 18:31, Greg Clayton schreef:

Fixed with:

% svn commit
Sending source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Transmitting file data .
Committed revision 167236.

It won't crash anymore, butyou will want to find out why this assert was

firing off. A DWARF DW_TAG_compile_unit should have been what caused us
to create the lldb_private::CompileUnit item in the first place, so for
it not be able to be found a little bit later means something is very wrong.

Indeed. It was due to having multiple CU's in 1 file.

Eric Christopher told me this wasn't supported properly atm, and not at all on OSX. I now have my project file (doesnt' have code in it but just a list of files) as Compile Unit, and the source as "Files", which LLDB/LLVM treats as include files.

So now it works a lot better than it did, I CAN trigger multiple bps at once. (Though I still have the weird callstack issue mentioned earier, where can I find the code that resolves a callstack?) and it doesn't like it if the files in a single unit are in different dirs, something I'll try to resolve too.