This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc] Infrastructure to disable breakpoints during inferior startup


>>>>> "Ulrich" == Ulrich Weigand <uweigand@de.ibm.com> writes:

Ulrich> The following patch attempts to address this by temporarily
Ulrich> disabling all user-installed breakpoints during the inferior
Ulrich> startup phase, using a mechanism similar to
Ulrich> disable_watchpoints_before_interactive_call_start.

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.

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'.


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.

Maybe Jan can follow up when he gets back.

Ulrich> +/* Are we executing startup code?  */
Ulrich> +static int executing_startup;

This seems like it should be a field in struct inferior.

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?

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.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]