<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 27, 2018, at 5:25 AM, Aleksandr Urakov via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">
<span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline" class="">Hello!</span><div style="text-decoration-style:initial;text-decoration-color:initial" class=""><br class=""></div><div style="text-decoration-style:initial;text-decoration-color:initial" class="">We want to add to LLDB a support of a lookup of variables values with PDB.</div><div style="text-decoration-style:initial;text-decoration-color:initial" class=""><br class=""></div><div style="text-decoration-style:initial;text-decoration-color:initial" class="">Now SymbolFilePDB::ParseVariableForPDBData function uses an empty location for variables, s<font face="arial, helvetica, sans-serif" class="">o e.g. `fr v` prints values as '<empty constant data></font><span style="font-family:arial,helvetica,sans-serif" class="">'. S</span>ymbol 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.</div></div></div></blockquote><div><br class=""></div>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.</div><div><br class=""></div><div>Some examples:</div><div>variable is at SP + 4 = DW_OP_bregXXX(4)</div><div><br class=""></div><div>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.</div><div><br class=""></div><div>variable is in register 12 = DW_OP_reg12</div><div><br class=""></div><div>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:</div><div><br class=""></div><div>variable is in register 46 = DW_OP_regx(46)</div><div><br class=""></div><div>Global variables:</div><div><br class=""></div><div>variable is at file address 0x12340000 = DW_OP_addr(0x12340000)</div><div><br class=""></div><div>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.</div><div><br class=""></div><div>IF you have any other questions on converting your locations, let me know. But the above examples should give you a good start.</div><div><br class=""></div><div>Greg</div><div><br class=""></div><div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div style="text-decoration-style:initial;text-decoration-color:initial" class=""><div class=""><br class=""></div><div class="">Regards,</div><div class="">Aleksandr</div></div>
<div class=""><br class=""></div><div class="">-- <br class=""></div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class="">Aleksandr Urakov</div><div class=""><span class="">Software Developer</span></div><div class=""><span class="">JetBrains</span></div><div class=""><span class=""><a href="http://www.jetbrains.com/" target="_blank" class="">http://www.jetbrains.com</a></span></div><div class=""><span class="">The Drive to Develop</span></div></div></div></div>
_______________________________________________<br class="">lldb-dev mailing list<br class=""><a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev<br class=""></div></blockquote></div><br class=""></body></html>