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: delete_breakpoint: don't try to insert other breakpoints


Nick Roberts wrote:

>  > > Eli, how is code which will never be reached a feature?
>  > 
>  > The code is never reached only as long as breakpoints are deleted
>  > synchronously (because we remove the breakpoint instruction as soon as
>  > the inferior stops).
> 
> I've run the testsuite using my asynchronous version of GDB, with and
> without Vladimir's change and, in fact, there was one less failure and
> seven more passes with it. Notably, the extra passes with
> print-threads.exp involved breakpoints.
> 
> Of course, this doesn't prove anything, and there may be a test that
> shows the contrary, but it might provide some context.

In fact, I've run across this code today while doing something different,
and I now believe it's even not theoretically unused -- it's wrong.
There are two possible cases for having breakpoints inserted when
doing delete_breakpoint:

1. Just not removing breakpoints from inferior when we stop.
2. Ability to delete breakpoints from inferior while inferior is
actually running.

(1) does not seem useful for anything. For (2), delete_breakpoint will:

  - Remove the breakpoint from inferior
  - See if there's another breakpoint at the same address
  - Try to insert it

As the result, there's a window when a breakpoint that should be inserted
is actually not. 

- Volodya



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