================
@@ -946,6 +978,14 @@ SampleContextFrameVector ProfiledBinary::symbolize(const 
InstructionPointer &IP,
   return CallStack;
 }
 
+StringRef ProfiledBinary::symbolizeDataAddress(uint64_t Address) {
+  DIGlobal DataDIGlobal = unwrapOrError(
+      Symbolizer->symbolizeData(SymbolizerPath.str(), {Address, 0}),
----------------
mingmingl-llvm wrote:

LLVMSymbolizer's symbolize* interfaces [1]  require a struct of 
`object::SectionedAddress` [2] to symbolize an address, like, they don't take 
an integer of address alone. Chasing down the calls  [3], `sectionIndex` field 
isn't used so its value doesn't matter [4].

Upon this question, it's better to use `UndefSection`  [5] here. Added a static 
helper function `getSectionedAddress` for this purpose, and use it for both 
code and data inside `ProfiledBinary` class.


[1] for 
[data](https://github.com/llvm/llvm-project/blob/13f7786f72d13a84dfc3d49d87a70e6a05f21fd4/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h#L98-L104)
 and 
[code](https://github.com/llvm/llvm-project/blob/13f7786f72d13a84dfc3d49d87a70e6a05f21fd4/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h#L80-L87)

[2] 

https://github.com/llvm/llvm-project/blob/13f7786f72d13a84dfc3d49d87a70e6a05f21fd4/llvm/include/llvm/Object/ObjectFile.h#L146-L151

[3] 
https://github.com/llvm/llvm-project/blob/13f7786f72d13a84dfc3d49d87a70e6a05f21fd4/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp#L155-L178
 

[4] 
https://github.com/llvm/llvm-project/blob/13f7786f72d13a84dfc3d49d87a70e6a05f21fd4/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp#L1753-L1766

[5] 
https://github.com/llvm/llvm-project/blob/13f7786f72d13a84dfc3d49d87a70e6a05f21fd4/llvm/include/llvm/Object/ObjectFile.h#L146-L147


https://github.com/llvm/llvm-project/pull/148013
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to