Plumb enum remove_bp_reason all the way to target_remove_breakpoint

So the target knows whether we're detaching breakpoints.
Nothing uses the parameter in this patch yet.

gdb/ChangeLog:
2016-08-10  Pedro Alves  <palves@redhat.com>

	PR gdb/19187
	* break-catch-sig.c (signal_catchpoint_remove_location): Adjust
	interface.
	* break-catch-syscall.c (remove_catch_syscall):
	* breakpoint.c (enum remove_bp_reason): Moved to breakpoint.h.
	(remove_breakpoint_1): Pass 'reason' down.
	(remove_catch_fork, remove_catch_vfork, remove_catch_solib)
	(remove_catch_exec, remove_watchpoint, remove_masked_watchpoint)
	(base_breakpoint_remove_location, bkpt_remove_location)
	(bkpt_probe_remove_location, bkpt_probe_remove_location): Adjust
	interface.
	* breakpoint.h (enum remove_bp_reason): Moved here from
	breakpoint.c.
	(struct breakpoint_ops) <remove_location>: Add 'reason' parameter.
	* corelow.c (core_remove_breakpoint): New function.
	(init_core_ops): Install it as to_remove_breakpoint method.
	* exec.c (exec_remove_breakpoint): New function.
	(init_exec_ops): Install it as to_remove_breakpoint method.
	* mem-break.c (memory_remove_breakpoint): Adjust interface.
	* record-btrace.c (record_btrace_remove_breakpoint): Adjust
	interface.
	* record-full.c (record_full_remove_breakpoint)
	(record_full_core_remove_breakpoint): Adjust interface.
	* remote.c (remote_remove_breakpoint): Adjust interface.
	* target-debug.h (target_debug_print_enum_remove_bp_reason): New
	macro.
	* target-delegates.c: Regenerate.
	* target.c (target_remove_breakpoint): Add 'reason' parameter.
	* target.h (struct target_ops) <to_remove_breakpoint>: Add
	'reason' parameter.
	(target_remove_breakpoint, memory_remove_breakpoint): Add 'reason'
	parameter.
This commit is contained in:
Pedro Alves
2016-08-10 23:03:29 +01:00
parent b2b6a7dab9
commit 7397181903
16 changed files with 125 additions and 51 deletions

View File

@@ -194,18 +194,6 @@ static void commands_command (char *, int);
static void condition_command (char *, int);
/* Why are we removing the breakpoint from the target? */
enum remove_bp_reason
{
/* A regular remove. Remove the breakpoint and forget everything
about it. */
REMOVE_BREAKPOINT,
/* Detach the breakpoints from a fork child. */
DETACH_BREAKPOINT,
};
static int remove_breakpoint (struct bp_location *);
static int remove_breakpoint_1 (struct bp_location *, enum remove_bp_reason);
@@ -3996,7 +3984,7 @@ remove_breakpoint_1 (struct bp_location *bl, enum remove_bp_reason reason)
&& !memory_validate_breakpoint (bl->gdbarch, &bl->target_info))
val = 0;
else
val = bl->owner->ops->remove_location (bl);
val = bl->owner->ops->remove_location (bl, reason);
}
else
{
@@ -4014,7 +4002,8 @@ remove_breakpoint_1 (struct bp_location *bl, enum remove_bp_reason reason)
&bl->overlay_target_info);
else
target_remove_breakpoint (bl->gdbarch,
&bl->overlay_target_info);
&bl->overlay_target_info,
reason);
}
/* Did we set a breakpoint at the VMA?
If so, we will have marked the breakpoint 'inserted'. */
@@ -4030,7 +4019,7 @@ remove_breakpoint_1 (struct bp_location *bl, enum remove_bp_reason reason)
wrong code with the saved shadow contents. */
if (bl->loc_type == bp_loc_hardware_breakpoint
|| section_is_mapped (bl->section))
val = bl->owner->ops->remove_location (bl);
val = bl->owner->ops->remove_location (bl, reason);
else
val = 0;
}
@@ -4068,7 +4057,7 @@ remove_breakpoint_1 (struct bp_location *bl, enum remove_bp_reason reason)
&& bl->owner->ops->remove_location != NULL);
bl->inserted = (reason == DETACH_BREAKPOINT);
bl->owner->ops->remove_location (bl);
bl->owner->ops->remove_location (bl, reason);
/* Failure to remove any of the hardware watchpoints comes here. */
if (reason == REMOVE_BREAKPOINT && bl->inserted)
@@ -4082,7 +4071,7 @@ remove_breakpoint_1 (struct bp_location *bl, enum remove_bp_reason reason)
gdb_assert (bl->owner->ops != NULL
&& bl->owner->ops->remove_location != NULL);
val = bl->owner->ops->remove_location (bl);
val = bl->owner->ops->remove_location (bl, reason);
if (val)
return val;
@@ -8120,7 +8109,7 @@ insert_catch_fork (struct bp_location *bl)
catchpoints. */
static int
remove_catch_fork (struct bp_location *bl)
remove_catch_fork (struct bp_location *bl, enum remove_bp_reason reason)
{
return target_remove_fork_catchpoint (ptid_get_pid (inferior_ptid));
}
@@ -8238,7 +8227,7 @@ insert_catch_vfork (struct bp_location *bl)
catchpoints. */
static int
remove_catch_vfork (struct bp_location *bl)
remove_catch_vfork (struct bp_location *bl, enum remove_bp_reason reason)
{
return target_remove_vfork_catchpoint (ptid_get_pid (inferior_ptid));
}
@@ -8381,7 +8370,7 @@ insert_catch_solib (struct bp_location *ignore)
}
static int
remove_catch_solib (struct bp_location *ignore)
remove_catch_solib (struct bp_location *ignore, enum remove_bp_reason reason)
{
return 0;
}
@@ -8711,7 +8700,7 @@ insert_catch_exec (struct bp_location *bl)
}
static int
remove_catch_exec (struct bp_location *bl)
remove_catch_exec (struct bp_location *bl, enum remove_bp_reason reason)
{
return target_remove_exec_catchpoint (ptid_get_pid (inferior_ptid));
}
@@ -10720,7 +10709,7 @@ insert_watchpoint (struct bp_location *bl)
/* Implement the "remove" breakpoint_ops method for hardware watchpoints. */
static int
remove_watchpoint (struct bp_location *bl)
remove_watchpoint (struct bp_location *bl, enum remove_bp_reason reason)
{
struct watchpoint *w = (struct watchpoint *) bl->owner;
int length = w->exact ? 1 : bl->length;
@@ -10975,7 +10964,7 @@ insert_masked_watchpoint (struct bp_location *bl)
masked hardware watchpoints. */
static int
remove_masked_watchpoint (struct bp_location *bl)
remove_masked_watchpoint (struct bp_location *bl, enum remove_bp_reason reason)
{
struct watchpoint *w = (struct watchpoint *) bl->owner;
@@ -12971,7 +12960,8 @@ base_breakpoint_insert_location (struct bp_location *bl)
}
static int
base_breakpoint_remove_location (struct bp_location *bl)
base_breakpoint_remove_location (struct bp_location *bl,
enum remove_bp_reason reason)
{
internal_error_pure_virtual_called ();
}
@@ -13133,12 +13123,12 @@ bkpt_insert_location (struct bp_location *bl)
}
static int
bkpt_remove_location (struct bp_location *bl)
bkpt_remove_location (struct bp_location *bl, enum remove_bp_reason reason)
{
if (bl->loc_type == bp_loc_hardware_breakpoint)
return target_remove_hw_breakpoint (bl->gdbarch, &bl->target_info);
else
return target_remove_breakpoint (bl->gdbarch, &bl->target_info);
return target_remove_breakpoint (bl->gdbarch, &bl->target_info, reason);
}
static int
@@ -13481,7 +13471,8 @@ bkpt_probe_insert_location (struct bp_location *bl)
}
static int
bkpt_probe_remove_location (struct bp_location *bl)
bkpt_probe_remove_location (struct bp_location *bl,
enum remove_bp_reason reason)
{
/* Let's clear the semaphore before removing the location. */
if (bl->probe.probe->pops->clear_semaphore != NULL)
@@ -13489,7 +13480,7 @@ bkpt_probe_remove_location (struct bp_location *bl)
bl->probe.objfile,
bl->gdbarch);
return bkpt_remove_location (bl);
return bkpt_remove_location (bl, reason);
}
static void