[llvm] [llvm-gsymutil] Add option to load callsites from DWARF (PR #119913)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 16:43:53 PST 2024


================
@@ -553,6 +558,57 @@ void DwarfTransformer::handleDie(OutputAggregator &Out, CUInfo &CUI,
     handleDie(Out, CUI, ChildDie);
 }
 
+void DwarfTransformer::parseCallSiteInfoFromDwarf(CUInfo &CUI, DWARFDie Die,
+                                                  FunctionInfo &FI) {
+  // Parse all DW_TAG_call_site DIEs that are children of this subprogram DIE.
+  // DWARF specification:
+  // - DW_TAG_call_site can have DW_AT_call_return_pc for return address offset.
+  // - DW_AT_call_origin might point to a DIE of the function being called.
+  // For simplicity, we will just extract return_offset and possibly target name
+  // if available.
+
+  CallSiteInfoCollection CSIC;
+
+  for (DWARFDie Child : Die.children()) {
+    if (Child.getTag() == dwarf::DW_TAG_call_site) {
----------------
ellishg wrote:

Just to reduce indentation
```suggestion
    if (Child.getTag() != dwarf::DW_TAG_call_site)
      continue;
```

https://github.com/llvm/llvm-project/pull/119913


More information about the llvm-commits mailing list