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:
- 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.
- 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.