Re: hbreak.exp: Test hardware breakpoints

Maciej W. Rozycki
2007-10-23T16:46:34Z

On Sat, 29 Sep 2007, Daniel Jacobowitz wrote:

> Maciej posted a patch to test hardware breakpoints. It passes on
> i386-linux, using current HEAD GDB. I wanted to see what would happen
> when the test was run against gdbserver, which does not support
> hardware breakpoints on i386 (yet). We encountered the long-standing
> bug that nm-i386.h overrides target.h using #define; this means that
> a native i386 GDB incorrectly tries to use ptrace even when connected
> to a remote target.
>
> I saw two ways to test: build a cross debugger or fix the bug. I
> fixed the bug. Unfortunately that broke the test:
>
> (gdb) hbreak main
> No hardware breakpoint support in the target.
> UNSUPPORTED: gdb.base/hbreak.exp: hardware breakpoints
>
> This is "target exec", since we have not yet started the program.
> While we were using #define to override GDB's defaults, this worked;
> every target, even exec, claimed to support watchpoints. Now that
> only "target child" supports hardware watchpoints, you can't insert
> hardware breakpoints before the program is running.
>
> This is the status quo on other targets too.
>
> How do you all feel about leaving the hbreak-before-run problem for
> another day, and adjusting the test to start the program running
> before trying hbreak?

Have we reached any conclusion on this matter? I cannot seem to find
any...

I am certainly fine to adjust the test script, at least for now -- no
problem. The question is how problematic, if at all, the change is to
people in actual debugging. For example, how often is a hardware
breakpoint used locally before a program is started:

(gdb) hbreak foo
(gdb) run

How about:

(gdb) break main
(gdb) run
[main() hit]
(gdb) hbreak foo
(gdb) continue
[foo() hit]
(gdb) run

And similarly for remote targets -- presumably having to define a
breakpoint before a connection is opened to the target is a non-issue, but
how about:

(gdb) target bar
(gdb) load
(gdb) hbreak foo
(gdb) run
[foo() hit]
(gdb) target bar

Not that these cases bother me terribly much, but they should be noted and
dismissed if not important enough.

Maciej