This is an archive of the discontinued LLVM Phabricator instance.

[LLDB][NativePDB] Fix missing symbol info when backtrace minidump
AbandonedPublic

Authored by zequanwu on Nov 11 2021, 5:49 PM.

Details

Summary

I don't know how to add tests for this. I tested locally with a minidump, a pdb
and the executable.
Before this change, the following comand fail to give symbol information for
backtrace because the m_comp_units in m_index->compilands() was always
empty, changed to use GetCompileUnitAtIndex to create CU when failed to find
one at given index.

lldb -O 'target create GoogleDriveFS.exe --core GoogleDriveFS.dmp' -o 'target symbols add GoogleDriveFS.pdb' -o 'bt'

Diff Detail

Event Timeline

zequanwu requested review of this revision.Nov 11 2021, 5:49 PM
zequanwu created this revision.
Herald added a project: Restricted Project. · View Herald Transcript

IIUC, these are two separate fixes:
a) fix clang ast creation for methods
b) fix symbol context lookup
It would be better to split them into two patches, as each will require a different kind of a test. The ast thing could be tested by running "image dump ast" on an appropriate piece of debug info. I'm hoping that the second one could be tested through "image lookup -a", but I don't know if it'll be as simple as running just that command. I guess you might need to play around with it a bit to find a way to invoke it without first instantiating the compile unit. It's possible you will need more than one compile unit in the test executable.

I don't think either of the fixes is really tied to minidumps, so I hope it will be possible to reproduce the issues by just compiling some c++ (without even running the program).

The ast thing could be tested by running "image dump ast" on an appropriate piece of debug info.

I didn't observe any difference before and after this patch with image dump ast tested on https://github.com/llvm/llvm-project/blob/main/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp.
I found that code path could get executed by FindFunctions when using image lookup -n ... and break ... on class methods, but there is a bug blocking me from adding tests for it. If the name has namespace like this A::foo, it fails to find it because lldb passes "foo" to plugins' FindFunctions and PdbIndex can only find the symbol if full name is provided. So, I need to either fix that bug first or find other ways to trigger this issue.

I'm hoping that the second one could be tested through "image lookup -a"

Yeah, sent out D113821.

The ast thing could be tested by running "image dump ast" on an appropriate piece of debug info.

I didn't observe any difference before and after this patch with image dump ast tested on https://github.com/llvm/llvm-project/blob/main/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp.
I found that code path could get executed by FindFunctions when using image lookup -n ... and break ... on class methods, but there is a bug blocking me from adding tests for it. If the name has namespace like this A::foo, it fails to find it because lldb passes "foo" to plugins' FindFunctions and PdbIndex can only find the symbol if full name is provided. So, I need to either fix that bug first or find other ways to trigger this issue.

Maybe you can try lldb-test? It's find functionality was meant to be a more-or-less direct interface to the Find*** methods (lldb-test symbols --find=function --name=full::name --function-flags=???)

lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
1039

Could this be moved into the above if block?

zequanwu abandoned this revision.Nov 15 2021, 12:26 PM

Splitted into D113821 and D113930.