This is an archive of the discontinued LLVM Phabricator instance.

[NativePDB] Fix setting breakpoint by file and line
AcceptedPublic

Authored by zturner on Dec 21 2018, 9:16 AM.

Details

Summary
There were several problems preventing this from working.  The
first is that when the PDB had an absolute path to the main
source file, we would construct an invalid path by prepending the
compilation directory to it anyway.  So we needed to check if the
path is already absolute first.

Second, LLDB assumes that the zero'th item in the support file list
is the main compilation unit.  We were respecting this requirement,
but LLDB *also* requires that file to appear somewhere in the list
starting from index 1 as well.  So the main compilation file should
appear in the support file list twice.  And when parsing a line
table, it expects the LineEntry records to be constructed using
the 1-based index.  With these two fixes we can now set breakpoints
by file and line using the native PDB reader.

Diff Detail

Event Timeline

zturner created this revision.Dec 21 2018, 9:16 AM
This revision is now accepted and ready to land.Dec 24 2018, 4:10 AM
labath accepted this revision.Dec 27 2018, 12:10 AM
labath added inline comments.
lldb/lit/SymbolFile/NativePDB/break-by-line.cpp
9–10

You could consider using break-by-source-regex (-p) to avoid this. The regex should be transformed into a line number long before it reaches the pdb plugin.

labath resigned from this revision.Aug 9 2019, 2:01 AM

It looks like the code changes landed (probably as part of another patch) but not the tests. I'll look and see if the tests should to be revived.

jingham added a subscriber: jingham.Aug 9 2019, 3:19 PM

It looks like the code changes landed (probably as part of another patch) but not the tests. I'll look and see if the tests should to be revived.

I can't see that any of these tests test breakpoint setting features that aren't tested in a bunch of places in the Python testsuite, and except for the building part, none of them look PDB specific. Do we not know how to build & run PDB executables in the dotest testsuite?

It turns out these tests all seem to exist, so I guess Zachary submitted them as part of other CLs.

amccarth resigned from this revision.Aug 14 2019, 4:02 PM