Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: tromey@redhat.com
Cc: gdb-patches@sourceware.org, jkratoch@redhat.com (Jan Kratochvil)
Subject: Re: [rfc] Infrastructure to disable breakpoints during inferior startup
Date: Thu, 23 Jul 2009 15:49:00 -0000	[thread overview]
Message-ID: <200907231224.n6NCOlAH001392@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <m3prbscz9w.fsf@fleche.redhat.com> from "Tom Tromey" at Jul 22, 2009 01:07:23 PM

Tom Tromey wrote:

> FWIW, I took a look at the PIE patch from the Fedora SRPM.  It has
> almost identical functions disable_breakpoints_before_startup and
> re_enable_breakpoints_at_startup.

Yes, it's the same concept, but those functions in the PIE patch have
some code that seems PIE specific (e.g. the entry point checks) that
should be moved to the caller (presumably solib-svr4.c in the PIE case)
to make the same infrastructure usable for both scenarios.
 
> There are some differences, but I don't know whether they are relevant
> or not.
> 
> The Fedora disable_breakpoints_before_startup has a check like this:
> 
> +	  if (((b->type == bp_breakpoint) ||
> +	       (b->type == bp_hardware_breakpoint)) &&
> +	      b->enable_state == bp_enabled &&
> +	      !b->loc->duplicate)
> 
> This differs from yours because it checks `loc->duplicate'.

I don't see why a breakpoint shouldn't be disabled just because its
first location has a duplicate ...  If the breakpoint has another
location, or if the duplicate gets removed later on, GDB would attempt
to insert this breakpoint and fail ...

See also the comments in disable_breakpoints_in_shlibs that explain
why the shlib_disabled flag is explicitly set also for duplicates.

> The Fedora re_enable_breakpoints_at_startup does this:
> 
> +	    /* Do not reenable the breakpoint if the shared library
> +	       is still not mapped in.  */
> +	    if (target_read_memory (b->loc->address, buf, 1) == 0)
> +	      {
> +		/*printf ("enabling breakpoint at 0x%s\n", paddr_nz(b->loc->address));*/
> +		b->enable_state = bp_enabled;
> +	      }
> 
> I have no idea about this either.  Perhaps it is something specific to
> PIE on Linux.

This seems odd to me; breakpoint disabled at startup cannot really be
within a shared library.  (Even if they were, a unmapped shared library
ought to be handled via the shlib_disabled mechanism ...)

> Ulrich> +/* Are we executing startup code?  */
> Ulrich> +static int executing_startup;
> 
> This seems like it should be a field in struct inferior.

Agreed.

> I seem to say that a lot :-).  I don't actually know .. should we be
> doing this sort of thing now, or are we waiting for Pedro's
> multi-inferior patches to land first?

I don't know; what's the timeline for Pedro's patches?

(In any case, moving this variable over to a struct inferior field
can be trivially done after Pedro's patches are merged; I'm not sure
we have to wait because of that ...)

> Ulrich> +    bp_startup_disabled,/* The eventpoint has been disabled during inferior
> 
> I think a new bp_ constant probably needs an entry in the array in
> print_one_breakpoint_location.  Otherwise if something funny happens,
> and we try to print one, gdb will get an internal error.

Unless I'm missing someting, the array in print_one_breakpoint_location
is about enum bptype member; I've added a enum enable_state member here ...

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


  reply	other threads:[~2009-07-23 12:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-22 17:14 Ulrich Weigand
2009-07-22 20:32 ` Tom Tromey
2009-07-23 15:49   ` Ulrich Weigand [this message]
2009-07-23 16:51     ` Tom Tromey
2009-07-23 18:06       ` Ulrich Weigand
2009-07-23 18:57         ` Pedro Alves
2009-07-24 22:49           ` Tom Tromey
2009-07-24 23:32             ` Multi-exec patches (Was: [rfc] Infrastructure to disable breakpoints during inferior startup) Tom Tromey
2009-07-25 16:05               ` Pedro Alves
2009-07-25 19:31                 ` Pedro Alves
2009-07-27 17:39                 ` Multi-exec patches Tom Tromey
2009-07-27 18:45                   ` Tom Tromey
2009-07-28 14:28                   ` Pedro Alves
2009-07-29 22:03                     ` Tom Tromey
2009-07-31 15:45           ` [rfc] Infrastructure to disable breakpoints during inferior startup Ulrich Weigand
2009-08-03  3:07             ` Thiago Jung Bauermann
2009-08-03 18:13               ` Eli Zaretskii
2009-08-05 18:14                 ` Ulrich Weigand
2009-08-05 18:58                   ` Eli Zaretskii
2009-08-06 17:46                   ` Tom Tromey
2009-08-06 18:42                     ` Eli Zaretskii
2009-08-06 19:12                       ` Michael Snyder

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=200907231224.n6NCOlAH001392@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jkratoch@redhat.com \
    --cc=tromey@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