This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Fix for PR 1971 .
- From: Ramana Radhakrishnan <ramana dot radhakrishnan at codito dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 03 Jan 2006 23:44:29 +0530
- Subject: Fix for PR 1971 .
- Reply-to: ramana dot radhakrishnan at codito dot com
Hi ,
Attached is a fix for PR 1971. This inserts a breakpoint at the return
address for a function that does not have a previous frame which is what
you have in the case of main. This would however not stop after the
return from main because the semantics of the next command would not
stop the execution in any place where there is no debug information.
Tested on native x86 with today's head as well as 6.4 branch with no
extra regressions .
Ok to commit with an additional testcase ?
cheers
Ramana
2006-01-03 Ramana Radhakrishnan <ramana.radhakrishnan@codito.com>
PR 1971
* infrun.c (handle_inferior_event): Handle case where previous
frame can be NULL. Use insert_step_resume_breakpoint_at_sal instead.
--
Ramana Radhakrishnan
GNU Tools
codito ergo sum (www.codito.com)
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.208
diff -u -a -u -r1.208 infrun.c
--- infrun.c 17 Dec 2005 22:34:01 -0000 1.208
+++ infrun.c 3 Jan 2006 17:48:16 -0000
@@ -2390,8 +2390,22 @@
/* We're doing a "next", set a breakpoint at callee's return
address (the address at which the caller will
resume). */
- insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ()));
- keep_going (ecs);
+ /* We're doing a "next", set a breakpoint at callee's return
+ address (the address at which the caller will
+ resume). */
+ if (get_prev_frame ( get_current_frame ()))
+ {
+ insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ()));
+ }
+ else
+ {
+ struct symtab_and_line sr_sal;
+ init_sal (&sr_sal); /* initialize to zeros */
+ sr_sal.pc = ADDR_BITS_REMOVE (gdbarch_unwind_pc (current_gdbarch,get_current_frame()));
+ sr_sal.section = find_pc_overlay (sr_sal.pc);
+ insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+ }
+ keep_going (ecs);
return;
}