| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Windows debuggers expect PDB symbol names to be fully qualified.
I.e., if a class Foo has a constructor, its name should be emitted as
`Foo::Foo`, not simply `Foo` as is the case today. Linux debuggers like
GDB dynamically reconstruct the symbol tree at runtime each time a
program is debugged. Windows debuggers on the other hand do not, and
expect the name to be fully qualified from the outset. Failing this, the
constructor function `Foo` would have the same name as the class `Foo`
in the PDB, and WinDbg will get confused about what to dump (e.g. using
`dt Foo`) and arbitrarily pick the largest item, which might be the
constructor. Therefore you end up dumping the wrong thing and being
completely unable to inspect the contents of a `Foo` object.
This commit aims to fix that by introducing a DWARF tree during the
conversion process which allows us to efficiently reconstruct such fully
qualified names during the conversion.
A note about DWARF: the DWARF format does not explicitly record the
parent of any given DIE record. It is instead implicit in how the
records are layed out. Any record may have a "has children" flag, and if
it does, then the records following it are its children, terminated by a
special NULL record, popping back up one level of the tree.
The DIECursor already recognized this structure but did not capture it
in memory for later use.
In order to construct fully-qualified names for functions, enums,
classes, etc. (i.e. taking into account namespaces, nesting, etc), we
need a way to efficienctly lookup a node's parent. Thus the DWARF tree
was born.
At a high level, we take advantage of the fact that the DWARF sections
were already scanned in two passes. We hook into the first pass (where
the typeIDs were being reserved) and build the DWARF tree.
Then, in the second pass (where the CV symbols get emitted), we look up
the tree to figure out the correct fully-qualified symbol names.
NOTE: The first phase of this work focuses on subroutines only. Later
work will enable support for structs/classes/enums.
On the subroutine front, I also added a flag to capture whether a DIE is
a "declaration" or definition (based on the DW_AT_declaration
attribute). This is needed to consolidate function decl+defn into one
PDB symbol, as otherwise WinDbg will get confused. This also matches
what the MSVC toolset produces.
A few other related additions:
- Added helper to format a fully qualified function name by looking up
the tree added in this commit.
- Added helper to print the DWARF tree for debugging purposes and a flag
to control it.
|
|
|
|
|
| |
This is just a preparatory change to improve the documentation in the
code. No functional changes.
|
|
|
|
|
| |
Add support for the new opcode-based format for location lists and range
lists.
|
|
|
|
|
| |
Fill in Dwarf_InfoData for all DWARF5 forms excluding the new rnglists
and loclists representations.
|
|
|
|
|
| |
Handle the new DWARF5 compilation unit header and add new constants to
dwarf.h. We still don't decode the new forms though.
|
|
|
|
|
|
|
|
|
|
|
| |
Read the compilation unit header byte-by-byte rather than by casting the
data to a structure. Add the currentBaseAddress contextual info to the
compilation unit data.
Move the LOCCursor into readDwarf.cpp. Implement a RangeCursor similar
to the LOCCursor.
Add more debug printing.
|
|
|
|
|
|
|
|
|
|
| |
DWARF5 has more contextual information that is associated with the
compilation unit. As a preparation for using such information, carry it
with the DIECursor and eliminate places where we're passing in the
parent compilation unit.
Also add the RDAddr helper to read a target-address according to the
specification in the compilation unit.
|
|
|
|
|
|
|
|
|
|
|
| |
Encapsulate dwarf-related PE sections into the PESection class. Remove some
unused sections. Add helpers for common section operations.
Move the context set via DIECursor::setContext to be static members of
the class and add a debug context there.
Add a standard method of enabling debug logging across the dwarf and PDB
code.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
do not assert for "Block" in DW_AT_upper_bound (but not supported)
|
|
|
|
|
|
| |
- fix code only executed in debug builds
- fix evaluation of DW_OP_const1u/DW_OP_const1s not advancing pointer
- add support for local variables with location list via DW_FORM_sec_offset
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
virtual size of sections
avoid assertions for DW_AT_ranges with constant data
|
|
|
|
|
|
| |
DW_AT_lower_bound
* DWARF: translate __int128 to CV code 0x14, just a wild guesss
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
My decodeLocation.
|
|
DIE tree navigation without requiring DW_AT_sibling attributes, moved navigation logic into DIECursor class.
|