https://bugs.llvm.org/show_bug.cgi?id=49060

            Bug ID: 49060
           Summary: Caller Frame Information in x86_64 XRay trampolines is
                    invalid
           Product: XRay
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Runtime
          Assignee: dber...@google.com
          Reporter: elia.f.gere...@gmail.com
                CC: llvm-bugs@lists.llvm.org

When attempting to unwind the stack from inside an XRay handler, both using
`libunwind` and `gdb`, the stack trace is corrupted.

As an example, this happens when using `backtrace` in GDB:
#0  xray_handler (function_id=<optimized out>, entry_type=ENTRY) at main.c:140
#1  0x000000000041ad5d in __xray_FunctionEntry ()
#2  0x000000000041d250 in .annobin__ZN6__xray18fdrLoggingFinalizeEv.end ()
#3  0x000000000041d1b0 in
.annobin__ZZN6__xrayL19fdrCommonHeaderInfoEvENUlvE_4_FUNEv.end ()
#4  0x000000000041ff60 in ?? ()
#5  0x0000000000000246 in ?? ()
#6  0x000000000041ff2b in print_message () at main.c:159
#7  0x000000000041ff51 in main (argc=0x1, argv=0x0) at main.c:162

The stack trace is correct up to frame 1, but then it gets corrupted. I
verified that this is due to the following ASM macro in which `rsp` is
manipulated without adding the appropriate CFI directives:
https://github.com/llvm/llvm-project/blob/af48d2bfc23fd188e5ae162b9f5b27de306ab38f/compiler-rt/lib/xray/xray_trampoline_x86_64.S#L83-L87

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to