33b4777ca1
In skip_artificial_frames we repeatedly call get_prev_frame_always until we get a non-inline and non-tailcall frame assuming that there must be such a frame eventually. For record targets, however, we may have a frame chain that consists only of artificial frames. This leads to a crash in get_frame_type when dereferencing a NULL frame pointer. Change skip_artificial_frames and skip_tailcall_frames to return NULL in such a case and modify each caller to cope with a NULL return. In frame_unwind_caller_pc and frame_unwind_caller_arch, we simply assert that the returned value is not NULL. Their caller was supposed to check frame_unwind_caller_id before calling those functions. In other cases, we thrown an error. In infcmd further move the skip_tailcall_frames call to the forward-stepping case since we don't need a frame for reverse execution and we don't want to fail because of that. Reverse-finish does make sense for a tailcall frame. gdb/ * frame.h (skip_tailcall_frames): Update comment. * frame.c (skip_artificial_frames, skip_tailcall_frames): Return NULL if only artificial frames are found. Update comment. (frame_unwind_caller_id): Handle NULL return. (frame_unwind_caller_pc, frame_unwind_caller_arch): Assert that skip_artificial_frames does not return NULL. (frame_pop): Add an error if only tailcall frames are found. * infcmd.c (finish_command): Move skip_tailcall_frames call into forward- execution case. Add an error if only tailcall frames are found. testsuite/ * gdb.btrace/tailcall-only.exp: New. * gdb.btrace/tailcall-only.c: New. * gdb.btrace/x86_64-tailcall-only.S: New. * gdb.btrace/i686-tailcall-only.S: New. |
||
---|---|---|
.. | ||
buffer-size.exp | ||
data.c | ||
data.exp | ||
delta.exp | ||
dlopen-dso.c | ||
dlopen.c | ||
dlopen.exp | ||
enable.c | ||
enable.exp | ||
exception.cc | ||
exception.exp | ||
function_call_history.c | ||
function_call_history.exp | ||
gcore.exp | ||
i686-record_goto.S | ||
i686-tailcall-only.S | ||
i686-tailcall.S | ||
instruction_history.c | ||
instruction_history.exp | ||
instruction_history.S | ||
multi-thread-step.c | ||
multi-thread-step.exp | ||
nohist.exp | ||
non-stop.c | ||
non-stop.exp | ||
record_goto-step.exp | ||
record_goto.c | ||
record_goto.exp | ||
rn-dl-bind.c | ||
rn-dl-bind.exp | ||
segv.c | ||
segv.exp | ||
step.exp | ||
stepi.exp | ||
tailcall-only.c | ||
tailcall-only.exp | ||
tailcall.c | ||
tailcall.exp | ||
tsx.c | ||
tsx.exp | ||
unknown_functions.c | ||
unknown_functions.exp | ||
vdso.c | ||
vdso.exp | ||
x86-tsx.S | ||
x86_64-record_goto.S | ||
x86_64-tailcall-only.S | ||
x86_64-tailcall.S |