Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <dan@codesourcery.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org, Joel Brobecker <brobecker@adacore.com>
Subject: Re: [RFC/7.1] Reset breakpoints after load
Date: Wed, 17 Mar 2010 00:04:00 -0000	[thread overview]
Message-ID: <20100317000422.GD9310@caradoc.them.org> (raw)
In-Reply-To: <201003151927.06019.pedro@codesourcery.com>

On Mon, Mar 15, 2010 at 07:27:05PM +0000, Pedro Alves wrote:
> > * Don't read from the target during prologue analyzers; only read from
> > the executable file.  I like this solution best, and it has other
> > merits (it's faster!).  But it's the most work.
> 
> "only" would be too strong.  You'd want "prefer", like
> trust-readonly-sections.  We may have debug info available but
> no pure memory contents to read from.

Right.

> Given that I proposed exactly this at least a couple of times
> already,

I'd forgotten this, if I ever knew it :-)

> I'm not sure I agree in calling this a workaround though.

Your explanation is convincing.  I've rewritten the comment, and
checked it in.

> Wouldn't be such a stretch, although just
> 
>   - remove_breakpoints ();
> 
>    <do actual load>
> 
>   - breakpoint_re_set ();
> 
> would work too, and be simpler.

That seems like a good thing too... I'd support it, but I didn't
implement it today.

-- 
Daniel Jacobowitz
CodeSourcery

2010-03-16  Daniel Jacobowitz  <dan@codesourcery.com>

	* symfile.c (generic_load): Reset breakpoints after loading.

Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.278
diff -u -p -r1.278 symfile.c
--- symfile.c	15 Mar 2010 09:31:34 -0000	1.278
+++ symfile.c	17 Mar 2010 00:03:09 -0000
@@ -1893,6 +1893,16 @@ generic_load (char *args, int from_tty)
      for other targets too.  */
   regcache_write_pc (get_current_regcache (), entry);
 
+  /* Reset breakpoints, now that we have changed the load image.  For
+     instance, breakpoints may have been set (or reset, by
+     post_create_inferior) while connected to the target but before we
+     loaded the program.  In that case, the prologue analyzer could
+     have read instructions from the target to find the right
+     breakpoint locations.  Loading has changed the contents of that
+     memory.  */
+
+  breakpoint_re_set ();
+
   /* FIXME: are we supposed to call symbol_file_add or not?  According
      to a comment from remote-mips.c (where a call to symbol_file_add
      was commented out), making the call confuses GDB if more than one


  reply	other threads:[~2010-03-17  0:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-14 16:21 Daniel Jacobowitz
2010-03-15  1:08 ` Joel Brobecker
2010-03-15 19:27 ` Pedro Alves
2010-03-17  0:04   ` Daniel Jacobowitz [this message]
2010-03-17 16:13     ` Pedro Alves

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=20100317000422.GD9310@caradoc.them.org \
    --to=dan@codesourcery.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.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