Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFC] infrun.c: Fix infinite loop caused by breakpoint adjustment
Date: Mon, 19 Jan 2004 17:35:00 -0000	[thread overview]
Message-ID: <20040119103506.70cd15fa@saguaro> (raw)
In-Reply-To: <4001BA24.6090005@gnu.org>

On Sun, 11 Jan 2004 16:03:32 -0500
Andrew Cagney <cagney@gnu.org> wrote:

> > Any comments on the patch below?
> 
> Can this paragraph (or something like it) should be included in the code 
> change?  That way the reader will better understand exactly what goes 
> wrong and for which architecture.
> 
> > 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.)

Okay, here's what I committed:

	* 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.129
diff -u -p -r1.129 infrun.c
--- infrun.c	19 Jan 2004 01:20:11 -0000	1.129
+++ infrun.c	19 Jan 2004 17:25:48 -0000
@@ -2757,6 +2757,29 @@ 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.
+     
+     Note:  kevinb/2004-01-19:  On FR-V, if this adjustment is not
+     made, GDB will enter an infinite loop when stepping through
+     optimized code consisting of VLIW instructions which contain
+     subinstructions corresponding to different source lines.  On
+     FR-V, it's not permitted to place a breakpoint on any but the
+     first subinstruction of a VLIW instruction.  When a breakpoint is
+     set, GDB will adjust the breakpoint address to the beginning of
+     the VLIW instruction.  Thus, we need to make the corresponding
+     adjustment here when computing the stop address.  */
+     
+  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.  */


      reply	other threads:[~2004-01-19 17:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-18 19:54 Kevin Buettner
2004-01-11 21:03 ` Andrew Cagney
2004-01-19 17:35   ` Kevin Buettner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040119103506.70cd15fa@saguaro \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox