diff options
author | Pedro Alves <palves@redhat.com> | 2014-06-02 22:27:33 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2014-06-02 23:29:13 +0100 |
commit | 41fac0cf495b84994046901e3293d54e8eef3534 (patch) | |
tree | 4820fee91254e97a26464c16961e7ec42467e9f0 /gdb/breakpoint.c | |
parent | cd1608cc4ed6e657deb405283011a6c2a795fb80 (diff) | |
download | gdb-41fac0cf495b84994046901e3293d54e8eef3534.zip gdb-41fac0cf495b84994046901e3293d54e8eef3534.tar.gz gdb-41fac0cf495b84994046901e3293d54e8eef3534.tar.bz2 |
Installing a breakpoint on top of a dprintf makes GDB lose control.
While the full fix for PR 15180 isn't in, it's best if we at least
make sure that GDB doesn't lose control when a breakpoint is set at
the same address as a dprintf.
gdb/
2014-06-02 Pedro Alves <palves@redhat.com>
* breakpoint.c (build_target_command_list): Don't build a command
list if we have any duplicate location that isn't a dprintf.
gdb/testsuite/
2014-06-02 Pedro Alves <palves@redhat.com>
* gdb.base/dprintf-bp-same-addr.c: New file.
* gdb.base/dprintf-bp-same-addr.exp: New file.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r-- | gdb/breakpoint.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index a966ba2..4e6c627 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -2351,14 +2351,26 @@ build_target_command_list (struct bp_location *bl) /* Release commands left over from a previous insert. */ VEC_free (agent_expr_p, bl->target_info.tcommands); - /* For now, limit to agent-style dprintf breakpoints. */ - if (bl->owner->type != bp_dprintf - || strcmp (dprintf_style, dprintf_style_agent) != 0) + if (!target_can_run_breakpoint_commands ()) return; - if (!target_can_run_breakpoint_commands ()) + /* For now, limit to agent-style dprintf breakpoints. */ + if (dprintf_style != dprintf_style_agent) return; + /* For now, if we have any duplicate location that isn't a dprintf, + don't install the target-side commands, as that would make the + breakpoint not be reported to the core, and we'd lose + control. */ + ALL_BP_LOCATIONS_AT_ADDR (loc2p, locp, bl->address) + { + loc = (*loc2p); + if (is_breakpoint (loc->owner) + && loc->pspace->num == bl->pspace->num + && loc->owner->type != bp_dprintf) + return; + } + /* Do a first pass to check for locations with no assigned conditions or conditions that fail to parse to a valid agent expression bytecode. If any of these happen, then it's no use to send conditions |