rt: Make unwinding through __morestack work on mac

Had to bump the min stack size in some of the tests from 256 bytes
to 1024 bytes. Not sure why yet.
This commit is contained in:
Brian Anderson 2011-12-11 17:50:12 -08:00
parent 7bc34f63d8
commit 7a8e73662d
4 changed files with 9 additions and 21 deletions

View File

@ -47,17 +47,17 @@
#endif
MORESTACK:
#ifdef __linux__
#if defined(__linux__) || defined(__APPLE__)
.cfi_startproc
#endif
pushl %ebp
#ifdef __linux__
#if defined(__linux__) || defined(__APPLE__)
.cfi_def_cfa_offset 8
.cfi_offset %ebp, -8
#endif
movl %esp, %ebp
#ifdef __linux__
#if defined(__linux__) || defined(__APPLE__)
.cfi_def_cfa_register %ebp
#endif
@ -69,7 +69,7 @@ MORESTACK:
jz .L$bail
// During unwinding we want to skip our caller.
#ifdef __linux__
#if defined(__linux__) || defined(__APPLE__)
// Don't understand this line. I think it means that
// the next frame's pc is the return address of our caller.
.cfi_offset 8, 8
@ -134,7 +134,7 @@ MORESTACK:
addl $16,%esp
popl %ebp
#ifdef __linux__
#if defined(__linux__) || defined(__APPLE__)
.cfi_restore %ebp
.cfi_def_cfa %esp, 4
#endif
@ -150,7 +150,7 @@ MORESTACK:
jmpl *%edx
#ifdef __linux__
#if defined(__linux__) || defined(__APPLE__)
.cfi_endproc
#endif

View File

@ -50,30 +50,22 @@
#if defined(__linux__) || defined(__APPLE__)
MORESTACK:
#if defined(__ELF__)
.cfi_startproc
#endif
// Set up a normal backtrace
pushq %rbp
#if defined(__ELF__)
.cfi_def_cfa_offset 16
.cfi_offset %rbp, -16
#endif
movq %rsp, %rbp
#if defined(__ELF__)
.cfi_def_cfa_register %rbp
#endif
// During unwinding we want to skip our caller since it's not
// a complete frame and will make the unwinder sad
#if defined(__linux__)
// Don't understand this line
.cfi_offset 16, 0
// Tell the unwinding where to get the stack pointer for
// our grandparent frame
.cfi_offset %rsp, -24
#endif
// Save the grandparent stack pointer for the unwinder
leaq 16(%rbp), %rax
@ -147,15 +139,11 @@ MORESTACK:
addq $8, %rsp
popq %rbp
#ifdef __linux__
.cfi_restore %rbp
.cfi_def_cfa %rsp, 8
#endif
ret
#if defined(__ELF__)
.cfi_endproc
#endif
#else
MORESTACK:

View File

@ -33,7 +33,7 @@ resource and_then_get_big_again(_i: ()) {
}
fn main() {
rustrt::set_min_stack(256u);
rustrt::set_min_stack(1024u);
std::task::spawn((), fn (&&_i: ()) {
let r = and_then_get_big_again(());
getbig_call_c_and_fail(10000);

View File

@ -29,6 +29,6 @@ resource and_then_get_big_again(_i: @int) {
}
fn main() {
rustrt::set_min_stack(256u);
std::task::spawn(100, getbig_and_fail);
rustrt::set_min_stack(1024u);
std::task::spawn(400, getbig_and_fail);
}