This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Fix for PR 1971 .
Hi --- thanks for revising the patch.
+/* Insert a step resume breakpoint at the return address of the
+ caller. This is to ensure that on doing a next from before main completes
+ execution of the program without GDB dumping core. Look at PR 1971
+ for more details. */
I don't think this is quite what you mean to say. The comment for a
function should describe its behavior in terms of its arguments;
"caller" is vague. Second, this isn't always used for "next"; it can
get used when you "step" into a function with no debug info (if I'm
reading right). Third, a more self-contained explanation of why the
get_prev_frame-based approach isn't sufficient would be better.
How about:
/* Insert a step-resume breakpoint at the address to which
RETURN_FRAME will return.
Unlike insert_step_resume_breakpoint_at_frame (get_prev_frame (F)),
this works even when F is the oldest frame. (Consider next-ing out
of main when 'show backtrace past-main' is off.) */
Finally --- could insert_step_resume_breakpoint_at_caller simply
*always* use the frame_pc_unwind approach, and drop the check for
get_prev_frame altogether? I understand that trying get_prev_frame
first is guaranteed to give the least disturbance to the existing
behavior, but I don't like leaving stuff like that in there unless we
can explain why it's actually needed.