pushl %ebp
#if defined(__linux__) || defined(__APPLE__)
- .cfi_def_cfa_offset 8
- .cfi_offset %ebp, -8
+ .cfi_def_cfa_offset 20
+ .cfi_offset %ebp, -20
#endif
movl %esp, %ebp
#if defined(__linux__) || defined(__APPLE__)
testl %eax,%eax
jz .L$bail
- // During unwinding we want to skip our caller.
-#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
- // The next frame's esp is stored at our CFA - 12
- // (by the code below)
- .cfi_offset %esp, -12
-#endif
-
// Save the the correct %esp value for our grandparent frame,
// for the unwinder
leal 20(%ebp), %eax
popl %ebp
#if defined(__linux__) || defined(__APPLE__)
.cfi_restore %ebp
- .cfi_def_cfa %esp, 4
+ .cfi_def_cfa %esp, 16
#endif
retl $8
// Set up a normal backtrace
pushq %rbp
- .cfi_def_cfa_offset 16
- .cfi_offset %rbp, -16
+ .cfi_def_cfa_offset 24
+ .cfi_offset %rbp, -24
movq %rsp, %rbp
.cfi_def_cfa_register %rbp
- // During unwinding we want to skip our caller since it's not
- // a complete frame and will make the unwinder sad
- // 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
-
// Save the grandparent stack pointer for the unwinder
leaq 24(%rbp), %rax
pushq %rax
addq $8, %rsp
popq %rbp
.cfi_restore %rbp
- .cfi_def_cfa %rsp, 8
+ .cfi_def_cfa %rsp, 16
ret
.cfi_endproc
--- /dev/null
+// xfail-test
+// error-pattern:explicit failure
+// compile-flags:--stack-growth
+
+// Just testing unwinding
+
+use std;
+
+native mod rustrt {
+ fn set_min_stack(size: uint);
+}
+
+fn getbig_and_fail(&&i: int) {
+ let r = and_then_get_big_again(@0);
+ if i != 0 {
+ getbig_and_fail(i - 1);
+ } else {
+ fail;
+ }
+}
+
+resource and_then_get_big_again(_i: @int) {
+}
+
+fn main() {
+ rustrt::set_min_stack(256u);
+ task::spawn(1, getbig_and_fail);
+}
\ No newline at end of file