Merge pull request #306 from da-x/probestack-frame-pointer
probestack: add frame pointers for easier traceback
This commit is contained in:
commit
c8b08eb470
|
@ -53,6 +53,9 @@ pub unsafe extern "C" fn __rust_probestack() {
|
||||||
// The ABI here is that the stack frame size is located in `%eax`. Upon
|
// The ABI here is that the stack frame size is located in `%eax`. Upon
|
||||||
// return we're not supposed to modify `%esp` or `%eax`.
|
// return we're not supposed to modify `%esp` or `%eax`.
|
||||||
asm!("
|
asm!("
|
||||||
|
pushq %rbp
|
||||||
|
movq %rsp, %rbp
|
||||||
|
|
||||||
mov %rax,%r11 // duplicate %rax as we're clobbering %r11
|
mov %rax,%r11 // duplicate %rax as we're clobbering %r11
|
||||||
|
|
||||||
// Main loop, taken in one page increments. We're decrementing rsp by
|
// Main loop, taken in one page increments. We're decrementing rsp by
|
||||||
|
@ -89,6 +92,7 @@ pub unsafe extern "C" fn __rust_probestack() {
|
||||||
// return.
|
// return.
|
||||||
add %rax,%rsp
|
add %rax,%rsp
|
||||||
|
|
||||||
|
leave
|
||||||
ret
|
ret
|
||||||
" ::: "memory" : "volatile");
|
" ::: "memory" : "volatile");
|
||||||
::core::intrinsics::unreachable();
|
::core::intrinsics::unreachable();
|
||||||
|
@ -104,6 +108,8 @@ pub unsafe extern "C" fn __rust_probestack() {
|
||||||
//
|
//
|
||||||
// The ABI here is the same as x86_64, except everything is 32-bits large.
|
// The ABI here is the same as x86_64, except everything is 32-bits large.
|
||||||
asm!("
|
asm!("
|
||||||
|
push %ebp
|
||||||
|
mov %esp, %ebp
|
||||||
push %ecx
|
push %ecx
|
||||||
mov %eax,%ecx
|
mov %eax,%ecx
|
||||||
|
|
||||||
|
@ -122,6 +128,7 @@ pub unsafe extern "C" fn __rust_probestack() {
|
||||||
|
|
||||||
add %eax,%esp
|
add %eax,%esp
|
||||||
pop %ecx
|
pop %ecx
|
||||||
|
leave
|
||||||
ret
|
ret
|
||||||
" ::: "memory" : "volatile");
|
" ::: "memory" : "volatile");
|
||||||
::core::intrinsics::unreachable();
|
::core::intrinsics::unreachable();
|
||||||
|
|
Loading…
Reference in New Issue