C stacks are starting to make their way into rustc. This is a
prerequisite for stack growth -- C code can't in general be expected to
perform stack growth checks, so we need to reserve a large stack for it
(one per thread, in the current implementation). Right now C stack usage
is implemented as a native ABI, so it's opt-in per function.
One major challenge with the implementation of C stacks in rustboot was
getting gdb to understand backtraces across C functions. With the
current assembler trampoline stub (src/rt/arch/i386/ccall.S), I tried
hard to make the stack frame look as normal as possible from gdb's
perspective. Backtraces do seem to work on the Mac GDB, once it's
appropriately patched to avoid the "(corrupt stack?)" warning (see [1]
if you don't mind applying a binary patch, for Snow Leopard).
I'm planning to start moving our native calls over to using the C stack,
and I definitely don't want to break backtraces for everyone else.
They're really important for productivity :)
So, please don't hesitate to speak up if you're finding broken
backtraces due to C stacks over the next few days. I'll do my best to
sort out any issues that people have. We all have slightly different
build environments and slightly different GDBs. GDB tends to be
notoriously fussy about the stack layout, and I want to make sure people
aren't left out in the cold.
Thanks!
Patrick
[1]: https://mail.mozilla.org/pipermail/rust-dev/2010-December/000139.html
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev