[PATCH] D131115: [Symbolizer] Implement pc element in symbolizing filter.
    Daniel Thornburgh via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Aug  4 11:08:28 PDT 2022
    
    
  
mysterymath marked an inline comment as done.
mysterymath added inline comments.
================
Comment at: llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp:255
+  // instruction.
+  if (Type && *Type == MarkupFilter::PCType::RETURN_ADDRESS)
+    --*Addr;
----------------
peter.smith wrote:
> Just wanted to check my understanding of whether it is important when subtracting from `Addr` to land on the start of an instruction? My guess is not, as it would be difficult on a variable length instruction set.
> 
> Reading the documentation for `ra` in the backtrace section:
> `the symbolizing filter will subtract one byte or one instruction length from the actual return address for the call site`
> It looks like from the test case
> ```
>        4: e8 00 00 00 00         callq   0x9 <first+0x9> // Line 4
>        9: 5d                            popq    %rbp                 // Line 5
> ```
> That address 9 - 1 is within the callq instruction and not the start yet it still displays line 4 so it all looks OK.
> 
> On AArch64 it would be possible to subtract 4 as all instructions are 4-bytes, but no need if subtracting 1 will work.
> 
> 
Yep, that's the standard hack, since the Symbolizer will return the same source location for any byte within the call. It's decidedly gross, but piping through per-target instruction length information is probably gross-er.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131115/new/
https://reviews.llvm.org/D131115
    
    
More information about the llvm-commits
mailing list