| 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.
|
|
|
|
|
| |
We had a lot of magic numbers throughout the code. Introducing two
constants to make it clearer what they refer to. No functional changes.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
| |
always convert S_BPREL_V1 to S_BPREL_V3 (no longer supported by mspdb 14.16.27012/VS 15.9)
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
c:file.exe), AV occured.
2. Aligning the debug section offset to the closest 16-byte boundary.
|
| |
|
|
|
|
|
| |
This prevents the generation of corrupt TPI streams, as padding is
required at the end of leaves.
|
| |
|
|
|
|
|
| |
This turns a linear lookup into a logarithmic binary search, which
improves a lot DWARF to PDB conversion for big programs.
|
|
|
|
| |
* improve reallocation strategy
|
|
|
|
|
|
|
| |
* when using mspdb140.dll (VS2015) or later, use symbols to emit line numbers
* translate S_UDT_V1 to V3 version
* translate S_BLOCK_V1 to V3 version
* remove "this" from delegate parameter list if inconsistent with procedure type
|
|
|
|
| |
* remove method declarations from struct or class records (they confuse mspdb*.dll if having forward references?)
|
|
|
|
|
|
| |
prefer struct over class for internal structs
handle class/struct property "uniquename"
mark source language as 'D' for dmd >= 2.072
|
| |
|
|
|
|
| |
* copy symbol unmodified if uncompression fails
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
* added searching mspdb120.dll for VS 2013
* changed search order for mspdb*.dll: trying to load through PATH first
newest VS versions preferred, then trying through installation paths for VS 2013-2005
* dviewhelper.dll now avoids being reloaded for every expression
|
|
|
|
| |
* new option -p allows to specify the embedded PDB reference in the binary
* added support for VS2012
|
|
|
|
| |
* supports unicode characters in file names
* improve interpretation of DWARF location expression
|
| |
|
|
|
|
|
|
|
| |
displaying arrays
* added command line switch -e to enable using named enumerator for D basic types
* added DWARF support
* added x64 support
|
|
|
|
|
| |
* added command line switch
* fixed crash with more than 32767 types
|
|
|
|
| |
void
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* thanks to patches by Z3N, the resulting pdb is now usable by more debuggers
* now uses shared file access to executable
* incomplete structs/classes are now added as user defined types to avoid confusing
debugger for following symbols
* fixed name demangling of very long names
* added name demangling support for @safe/@trusted/@property/pure/nothrow/ref
* base classes are added to D/cpp-interfaces to allow viewing the virtual function
table pointer
* structs, classes and interfaces now have an internal qualifier attached that allows
the preview in autoexp.dat to show better info for structs and interfaces
|
|
|
|
|
| |
* now adding properties "has nested type" and "is nested type" to class/struct/union/enum types
* better support for enumerators: now added as user defined types (DMD patch needed)
|
|
|
|
| |
(command option -C is used), it is converted to int64 (fixing DMC bug)
|
|
|
|
|
|
| |
* adapted to mspdb100.dll which comes with VS2010
* tweaked autoexp.dat modifications to be more stable with uninitialized data
* autoexp.snippet now split into two files
|
| |
|
|
|
| |
* added managed C++ project to integrate cv2pdb with CLR
|
| |
|
|
|
|
|
|
|
| |
* basic types now show with their D names, not as C types
* "enum" prefix removed from type names of enumerator types
* added type information for complex data types
* dmd-patch needed for long/ulong support
* experimental hack to add lexical scope to local variables
|
|
|
|
| |
struct_v2.derived now always set to 0
|
|
|
|
| |
by DMC are now removed
|
| |
|
|
|
|
|
| |
* fixed line number info at the end of a segment or when switching to another file because of inline expansion
* fixed line numbers > 32767 and sections with 0 line number entries
|
|
|
|
|
| |
- tweaked visualizer macros to detect uninitialized associative arrays and to limit expansion
to arrays with less than 1024 entries
- renamed "data" pointer member of dynamic arrays to "ptr"
|