Skip to content

os: print registers for signals in libunwind-based backtrace code

Aaron Plattner requested to merge aplattner/xserver:backtrace into master

If the stack walker finds a signal frame, record the cursor at that point and then use unw_get_reg() to query the values of the architecture-specific registers at the frame that triggered the signal.

Example output:

(EE) Backtrace:
(EE) 0: hw/xfree86/Xorg (OsSigHandler+0x25) [0x561458bb8195]
(EE) 1: <signal handler called>
(EE) 2: hw/xfree86/Xorg (dix_main+0x9c) [0x561458aead6c]
(EE) 3: /usr/lib/libc.so.6 (__libc_start_main+0xd5) [0x7f2d23170b25]
(EE) 4: hw/xfree86/Xorg (_start+0x2e) [0x561458aad8be]
(EE)
(EE) Registers at frame #2:
(EE)   rax: 0x0
(EE)   rbx: 0x561458c3ae60
(EE)   rcx: 0x7f2d23328943
(EE)   rdx: 0x0
(EE)   rsi: 0x7ffcb6025030
(EE)   rdi: 0xe
(EE)   rbp: 0x0
(EE)   rsp: 0x7ffcb6026430
(EE)    r8: 0x0
(EE)    r9: 0x0
(EE)   r10: 0x8
(EE)   r11: 0x246
(EE)   r12: 0x561458aad890
(EE)   r13: 0x0
(EE)   r14: 0x0
(EE)   r15: 0x0
(EE)
(EE) Segmentation fault at address 0x0
Edited by Aaron Plattner

Merge request reports