Unwinding through multiple stacks
Doug Evans
dje@google.com
Wed Mar 25 00:00:00 GMT 2015
Hi.
A topic came up on #gdb that the current patches don't cover.
What if the frame we're trying to unwind through has a different stack?
If the different stack is below the "normal" stack gdb will complain:
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
The code to catch this is in frame.c:
/* Check that this frame's ID isn't inner to (younger, below, next)
the next frame. This happens when a frame unwind goes backwards.
This check is valid only if this frame and the next frame are
NORMAL.
See the comment at frame_id_inner for details. */
if (get_frame_type (this_frame) == NORMAL_FRAME
&& this_frame->next->unwind->type == NORMAL_FRAME
&& frame_id_inner (get_frame_arch (this_frame->next),
get_frame_id (this_frame),
get_frame_id (this_frame->next)))
{
CORE_ADDR this_pc_in_block;
struct minimal_symbol *morestack_msym;
const char *morestack_name = NULL;
/* gcc -fsplit-stack __morestack can continue the stack anywhere. */
this_pc_in_block = get_frame_address_in_block (this_frame);
morestack_msym = lookup_minimal_symbol_by_pc (this_pc_in_block).minsym;
if (morestack_msym)
morestack_name = MSYMBOL_LINKAGE_NAME (morestack_msym);
if (!morestack_name || strcmp (morestack_name, "__morestack") != 0)
{
if (frame_debug)
{
fprintf_unfiltered (gdb_stdlog, "-> ");
fprint_frame (gdb_stdlog, NULL);
fprintf_unfiltered (gdb_stdlog,
" // this frame ID is inner }\n");
}
this_frame->stop_reason = UNWIND_INNER_ID;
return NULL;
}
}
We need to generalize the __morestack solution
and provide it through the unwinders.
More information about the Gdb-patches
mailing list