<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Fri, Oct 26, 2018 at 8:28 AM via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div class="m_-3735251925307439450WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi Muhui,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I believe the names in the callgraph are the "mangled" name, which DWARF refers to as the linkage name.  This would be recorded in the DW_AT_MIPS_linkage_name
 or DW_AT_linkage_name attribute, depending on the version of DWARF.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">DW_AT_specification is a way to associate two DWARF entries for the same entity.  You will see this most commonly for inlined functions, where the DWARF entry
 for the inlined instance has a DW_AT_specification pointing to the "abstract" instance for the same function.</span></p></div></div></blockquote><div><br>Minor thing: DW_AT_specification is used for decl/def separations rather than inline/concrete/abstract (that uses abstract_origin). But similar stuff, for sure.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div class="m_-3735251925307439450WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">  This is intended as a space-saving tactic, as many of the attributes for a function (including its linkage name) are the same across all inlined
 instances.  The abstract instance has the common attributes, while the concrete instances have the attributes specific to each inlined instance (e.g., code ranges).<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">As for the PLT segment, I suspect that DWARF does not describe these because they are artifacts of the ABI and do not reflect anything in the source.  The callgraph
 describes them because they are explicit in the IR.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">--paulr<u></u><u></u></span></p>
<p class="MsoNormal"><a name="m_-3735251925307439450__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></a></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> llvm-dev [mailto:<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>]
<b>On Behalf Of </b>Muhui Jiang via llvm-dev<br>
<b>Sent:</b> Thursday, October 25, 2018 4:16 PM<br>
<b>To:</b> llvm-dev<br>
<b>Subject:</b> [llvm-dev] Function name<u></u><u></u></span></p>
</div>
</div></div></div></div><div lang="EN-US" link="blue" vlink="purple"><div class="m_-3735251925307439450WordSection1"><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hi<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I refer to the binary generated by C++ code.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I am curious about the name inside the callgraph, which is generated by the tool <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">opt -dot-callgraph target.bc<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I found the names inside the callgraph follow the C++ function name rule. Then I would like to check the name inside the debugging information, which is generated by the command<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">llvm-dwarfdump -debug-info target.o<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I manually checked it, I found sometimes the name(label in the callgraph) is the attribute of `DW_AT_specification`, sometimes is `DW_AT_MIPS_linkage_name`. Can anyone explain these? What should be the right function name inside the dwarf
 debugging information?</p></div></div></div></div></div></blockquote><div><br>Yeah, llvm-dwarfdump prints the mangled/linkage name next to DW_AT_specification for ease of reading, but in reality the specification doesn't have the linkage name (it's pulling it from the DIE the specification refers to) - use '-v' with llvm-dwarfdump to see the details of how that's all wired up.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div class="m_-3735251925307439450WordSection1"><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"><div><div><p class="MsoNormal"><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Another question is about the PLT segment. I found that the callgraph will contain the functions inside the ELF PLT segment while the dwarf debugging information does not contain them. Could anyone explain these? Many Thanks<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Regards<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Muhui<u></u><u></u></p>
</div>
</div>
</div></div></div>

_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>