diff options
author | Pedro Alves <palves@redhat.com> | 2014-06-02 22:27:32 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2014-06-02 23:28:54 +0100 |
commit | cd1608cc4ed6e657deb405283011a6c2a795fb80 (patch) | |
tree | a220160fc95ee7f70d84c1947d2b3f1c12c565b0 /gdb/breakpoint.c | |
parent | 0a261ed82e9b5f6fbc3725258a742515df8f4b42 (diff) | |
download | gdb-cd1608cc4ed6e657deb405283011a6c2a795fb80.zip gdb-cd1608cc4ed6e657deb405283011a6c2a795fb80.tar.gz gdb-cd1608cc4ed6e657deb405283011a6c2a795fb80.tar.bz2 |
dprintf-style agent can't explain a trap.
If some event happens to trigger at the same address as a dprintf-style
agent dprintf is installed, GDB will complain, like:
(gdb) continue
Continuing.
May only run agent-printf on the target
(gdb)
Such dprintfs are completely handled on the target side, so they can't
explain a stop, but GDB is currently putting then on the bpstat chain
anyway, because they currently unconditionally use bkpt_breakpoint_hit
as breakpoint_hit method.
gdb/
2014-06-02 Pedro Alves <palves@redhat.com>
* breakpoint.c (dprintf_breakpoint_hit): New function.
(initialize_breakpoint_ops): Install it as dprintf's
breakpoint_hit method.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r-- | gdb/breakpoint.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 676c7b8..a966ba2 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -13142,6 +13142,23 @@ bkpt_breakpoint_hit (const struct bp_location *bl, } static int +dprintf_breakpoint_hit (const struct bp_location *bl, + struct address_space *aspace, CORE_ADDR bp_addr, + const struct target_waitstatus *ws) +{ + if (dprintf_style == dprintf_style_agent + && target_can_run_breakpoint_commands ()) + { + /* An agent-style dprintf never causes a stop. If we see a trap + for this address it must be for a breakpoint that happens to + be set at the same address. */ + return 0; + } + + return bkpt_breakpoint_hit (bl, aspace, bp_addr, ws); +} + +static int bkpt_resources_needed (const struct bp_location *bl) { gdb_assert (bl->owner->type == bp_hardware_breakpoint); @@ -16220,6 +16237,7 @@ initialize_breakpoint_ops (void) ops->print_mention = bkpt_print_mention; ops->print_recreate = dprintf_print_recreate; ops->after_condition_true = dprintf_after_condition_true; + ops->breakpoint_hit = dprintf_breakpoint_hit; } /* Chain containing all defined "enable breakpoint" subcommands. */ |