[lldb-dev] Support of a lookup of variables values with PDB
Greg Clayton via lldb-dev
lldb-dev at lists.llvm.org
Wed Jun 27 07:38:42 PDT 2018
> On Jun 27, 2018, at 5:25 AM, Aleksandr Urakov via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> We want to add to LLDB a support of a lookup of variables values with PDB.
> Now SymbolFilePDB::ParseVariableForPDBData function uses an empty location for variables, so e.g. `fr v` prints values as '<empty constant data>'. Symbol location information is available in a PDB (through PDBSymbolData::getLocationType and so on), but not in the format of DWARF expression. Do I understand correctly, that it is necessary to write some converter of a PDB symbol location to a DWARF expression bytecode? Is this the preferable way of solving the issue? What are pitfalls there? Please, share your thoughts on this.
DWARF expressions are pretty powerful and provide all the opcode need to describe variable locations. You will need to covert the PDB location to the DWARF expression opcodes.
variable is at SP + 4 = DW_OP_bregXXX(4)
DW_OP_bregXXX where XXX is the register number for your stack pointer. This opcode takes a single operand that is the offset from the register in question. The variable value is expected to be at the load address in memory.
variable is in register 12 = DW_OP_reg12
There are 32 DW_OP_regXXX opcodes DW_OP_reg0 - DW_OP_reg31. If your register value is higher than 32, then use DW_OP_regx which takes a ULEB128 parameter which is the register number:
variable is in register 46 = DW_OP_regx(46)
variable is at file address 0x12340000 = DW_OP_addr(0x12340000)
The address here is a file address, or the file VM address of the global as it is known in the object file. This address will be slid and covered to a load address if needed at runtime.
IF you have any other questions on converting your locations, let me know. But the above examples should give you a good start.
> Aleksandr Urakov
> Software Developer
> http://www.jetbrains.com <http://www.jetbrains.com/>
> The Drive to Develop
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lldb-dev