<div dir="ltr">Thank you for explanations!<div><br></div><div>I'll create the converter to DWARF expressions.</div><div><br></div><div>Regards,</div><div>Aleksandr</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jun 27, 2018 at 5:38 PM Greg Clayton <<a href="mailto:clayborg@gmail.com">clayborg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><br><div><br><blockquote type="cite"><div>On Jun 27, 2018, at 5:25 AM, Aleksandr Urakov via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>> wrote:</div><br class="m_-7488580330187730777Apple-interchange-newline"><div><div dir="ltr">

<span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Hello!</span><div style="text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="text-decoration-style:initial;text-decoration-color:initial">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"><br></div><div style="text-decoration-style:initial;text-decoration-color:initial">Now SymbolFilePDB::ParseVariableForPDBData function uses an empty location for variables, s<font face="arial, helvetica, sans-serif">o e.g. `fr v` prints values as '<empty constant data></font><span style="font-family:arial,helvetica,sans-serif">'. 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></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></div><div>Some examples:</div><div>variable is at SP + 4 = DW_OP_bregXXX(4)</div><div><br></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></div><div>variable is in register 12 = DW_OP_reg12</div><div><br></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></div><div>variable is in register 46 = DW_OP_regx(46)</div><div><br></div><div>Global variables:</div><div><br></div><div>variable is at file address 0x12340000 = DW_OP_addr(0x12340000)</div><div><br></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></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></div><div>Greg</div><div><br></div><div><blockquote type="cite"><div><div dir="ltr"><div style="text-decoration-style:initial;text-decoration-color:initial"><div><br></div><div>Regards,</div><div>Aleksandr</div></div>

<div><br></div><div>-- <br></div><div dir="ltr" class="m_-7488580330187730777gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Aleksandr Urakov</div><div><span>Software Developer</span></div><div><span>JetBrains</span></div><div><span><a href="http://www.jetbrains.com/" target="_blank">http://www.jetbrains.com</a></span></div><div><span>The Drive to Develop</span></div></div></div></div>
_______________________________________________<br>lldb-dev mailing list<br><a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br></div></blockquote></div><br></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Aleksandr Urakov</div><div><span>Software Developer</span></div><div><span>JetBrains</span></div><div><span><a href="http://www.jetbrains.com" target="_blank">http://www.jetbrains.com</a></span></div><div><span>The Drive to Develop</span></div></div></div>