[PATCH] D53002: Create a new symbol file plugin for cross-platform PDB symbolization

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 8 15:51:53 PDT 2018


zturner created this revision.
zturner added reviewers: aleksandr.urakov, asmith, stella.stamenova, labath, lemo.
Herald added subscribers: arphaman, mgorny.

The existing `SymbolFilePDB` only works on Windows, as it is written against a closed-source Microsoft SDK that ships with their debugging tools.

There are several reasons we want to bypass this and go straight to the bits of the PDB, but just to list a few:

1. More room for optimization.  We can't see inside the implementation of the Microsoft SDK, so we don't always know if we're doing things in the most efficient way possible.  For example, setting a breakpoint on main of a big program currently takes several seconds.  With the implementation here, the time is unnoticeable.

2. We want to be able to symbolize Windows minidumps even if not on Windows.   Someone should be able to debug Windows minidumps as if they were on Windows, given that no running process is necessary.

This patch is a very crude first attempt at filling out some of the basic pieces.

I've implemented `FindFunctions`, `ParseCompileUnitLineTable`, and `ResolveSymbolContext` for a limited subset of possible parameter values.  Basically, enough to get it to display me something nice for the breakpoint location.

The test I've added, incidentally, is able to load a .exe into LLDB and set a breakpoint by name even on non-Windows.  This is really cool because it allows us to run the test on every platform thusly increasing our test coverage, and also serving as proof that this actually does work anywhere.  Of course it doesn't make sense to actually run this program on non Windows and you'll get an error if you try to do so, but all we try to do with this test is set the breakpoint and verify that symbols are resolved correctly.

I'll add many more tests of this nature later.

For now, this plugin is enabled always on non-Windows, and by setting the environment variable `LLDB_USE_NATIVE_PDB_READER=1` on Windows.  Eventually, once it's at parity with the Windows implementation, we'll delete the Windows DIA-based implementation.


https://reviews.llvm.org/D53002

Files:
  lldb/lit/SymbolFile/NativePDB/Inputs/simple-breakpoints.lldbinit
  lldb/lit/SymbolFile/NativePDB/simple-breakpoints.cpp
  lldb/lit/lit.cfg
  lldb/source/Plugins/SymbolFile/CMakeLists.txt
  lldb/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
  lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.h
  lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.h
  lldb/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h
  lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  lldb/source/Plugins/SymbolFile/PDB/CMakeLists.txt
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53002.168718.patch
Type: text/x-patch
Size: 76004 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181008/39adf4b0/attachment-0001.bin>


More information about the llvm-commits mailing list