[lldb-dev] SymbolFile::FindGlobalVariables

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Fri Mar 11 11:41:53 PST 2016

> Also why does the lldb_private::Variable() class take a DWARFExpression to its constructor?  Seems like this is wrong in the face of non-DWARF debug information.

They are powerful enough to handle any variable location. More powerful than any other format I have seen. You have two choices:

- make a new lldb_private::Location class and have DWARFExpression implement the pure virtuals you need
- convert PDB locations into DWARF

Personally the second sounds easier as the DWARF expressions are well documented and they are easy to construct. If you have the spec for the PDB locations and can point me at this, I can take a look to see how well things would map.

Variables that are in registers use a DWARF location expression like:


that means the value is register number 12.

DW_OP_addr(0x10000) means the value is a global variable whose value lives at "file address 0x10000 inside of the module from which is originates". We translate the file address into a load address if we are running and if that resolves to a load address, we can read the variable value.

DW_OP_fbreg32(32) means the value is 32 bytes off of register 32.

So the locations expression are often this simple: in a register, in .data at a file address, or on the stack. So depending on how complex locations are in PDB, it might be easier to just create a simple DWARF expression and be done with it.

Greg Clayton

More information about the lldb-dev mailing list