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.
This commit is contained in:
Pedro Alves
2014-06-02 22:27:33 +01:00
parent cd1608cc4e
commit 41fac0cf49
5 changed files with 121 additions and 5 deletions

View File

@ -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)
return;
if (!target_can_run_breakpoint_commands ())
return;
/* 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