Re: help string for "break" command

Bob Rossi
2007-01-12T14:27:06Z

On Fri, Jan 12, 2007 at 03:19:31PM +0100, Mathieu Lacage wrote:
> On Fri, 2007-01-12 at 08:49 -0500, Daniel Jacobowitz wrote:
> > On Fri, Jan 12, 2007 at 02:45:16PM +0100, Mathieu Lacage wrote:
> > > Am I right in assuming that the gdb command "break" places exclusively
> > > so-called software-breakpoints while the command "hbreak" places a
> > > hardware-breakpoint (I am not sure I have figured out the details of the
> > > logic in gdb/breakpoint.c) ?
> >
> > Not 100%. CVS versions of GDB will use hardware breakpoints
> > automatically if you try to set them in truly read-only memory.
>
> I see the following comment in the CVS version:
> /* If the explicitly specified breakpoint type
> is not hardware breakpoint, check the memory map to see
> if the breakpoint address is in read only memory or not.
> Two important cases are:
> - location type is not hardware breakpoint, memory
> is readonly. We change the type of the location to
> hardware breakpoint.
> - location type is hardware breakpoint, memory is read-write.
> This means we've previously made the location hardware one, but
> then the memory map changed, so we undo.
>
> When breakpoints are removed, remove_breakpoints will
> use location types we've just set here, the only possible
> problem is that memory map has changed during running program,
> but it's not going to work anyway with current gdb. */
>
> and it seems to match the decision logic I see below.
>
> Would there be opposition to an 'sbreak' command which would ensure that
> a software breakpoint is used _all the time_ ?

Is the 'set breakpoint auto-hw off' helpful here?

http://sourceware.org/gdb/current/onlinedocs/gdb_6.html#SEC32

Bob Rossi