Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] infrun.c: Fix infinite loop caused by breakpoint adjustment
@ 2003-12-18 19:54 Kevin Buettner
  2004-01-11 21:03 ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Buettner @ 2003-12-18 19:54 UTC (permalink / raw)
  To: gdb-patches

Any comments on the patch below?

It fixes an infinite loop caused by attempting to run to a location
to which it's architecturally impossible to set a breakpoint at.  (It's
quite easy to reproduce this problem on FR-V.  Just step into some
library code which has been compiled with optimization.)

Since it touches infrun.c, and since a lot of developers are on
holiday at this time of year, I'll wait until January 15 to commit it.
Hopefully, that'll give everyone who'd like to comment on this patch
a chance to look at it.

Kevin

	* infrun.c (step_into_function): Account for possible breakpoint
	adjustment when computing ``stop_func_start''.

Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.122
diff -u -p -r1.122 infrun.c
--- infrun.c	25 Nov 2003 16:01:36 -0000	1.122
+++ infrun.c	18 Dec 2003 19:34:53 -0000
@@ -2762,6 +2762,18 @@ step_into_function (struct execution_con
       && ecs->sal.end < ecs->stop_func_end)
     ecs->stop_func_start = ecs->sal.end;
 
+  /* Architectures which require breakpoint adjustment might not be able
+     to place a breakpoint at the computed address.  If so, the test
+     ``ecs->stop_func_start == stop_pc'' will never succeed.  Adjust
+     ecs->stop_func_start to an address at which a breakpoint may be
+     legitimately placed.  */
+  if (gdbarch_adjust_breakpoint_address_p (current_gdbarch))
+    {
+      ecs->stop_func_start
+	= gdbarch_adjust_breakpoint_address (current_gdbarch,
+	                                     ecs->stop_func_start);
+    }
+
   if (ecs->stop_func_start == stop_pc)
     {
       /* We are already there: stop now.  */


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-01-19 17:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-18 19:54 [RFC] infrun.c: Fix infinite loop caused by breakpoint adjustment Kevin Buettner
2004-01-11 21:03 ` Andrew Cagney
2004-01-19 17:35   ` Kevin Buettner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox