Preserving gdb backtraces
Posted: Mon Jan 09, 2017 4:11 pm
I'm currently trying to use gdb to debug my interrupt handlers. I'm trying to copy %rip from the interrupt stack push and push on %rbp, doing the standard mov %rsp, %rbp
So the assembly looks like this:
At the end of this, I have the following stack:
And the registers are
So why is it that my backtrace doesn't catch these values on the stack and correctly follow the backtrace out to the function that triggered the divide by zero exception?
So the assembly looks like this:
Code: Select all
push %rsp
push %rax
mov 0x10(%rsp), %rax
push %rax
push %rbp
Code: Select all
0x676d528: 0x000000000676d580 0x0000008000008c59
0x676d538: 0x0000008000066828 0x000000000676d548
0x676d548: 0x0000008000008c59 0x0000000000000028
Code: Select all
rax 0x8000008c59 549755849817
rbx 0x7f21f18 133308184
rcx 0x0 0
rdx 0x8000000000 549755813888
rsi 0xfffffffffffffffd -3
rdi 0x676e7f8 108455928
rbp 0x676d528 0x676d528
rsp 0x676d528 0x676d528
r8 0x800005fc78 549756206200
r9 0x676d508 108451080
r10 0x800005fc78 549756206200
r11 0x0 0
r12 0x0 0
r13 0x0 0
r14 0x0 0
r15 0x0 0
rip 0x800000969c 0x800000969c <kernel::divide_by_zero_handler+12>
eflags 0x2 [ ]
cs 0x28 40
ss 0x8 8
ds 0x8 8
es 0x8 8
fs 0x8 8
gs 0x8 8
Code: Select all
#0 0x000000800000969c in kernel::divide_by_zero_handler ()
at /media/sf_CS_81/rusty_pintos/uefi_booter/kernel/src/lib.rs:322
#1 0x000000000676d580 in ?? ()
#2 0x0000008000008c59 in kernel::divide_by_zero ()
at /media/sf_CS_81/rusty_pintos/uefi_booter/kernel/src/lib.rs:199
Backtrace stopped: frame did not save the PC