summaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-08-10 23:03:29 +0100
committerPedro Alves <palves@redhat.com>2016-08-10 23:03:29 +0100
commit73971819031d74eb846805a9fbfad04ba1dff500 (patch)
tree84afc3ce706b1c3654b49fa4c7966ce40c3585f3 /gdb/breakpoint.c
parentb2b6a7dab91de9a616e1d76c869d127c5752b9e6 (diff)
downloadbinutils-gdb-73971819031d74eb846805a9fbfad04ba1dff500.tar.gz
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.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c47
1 files changed, 19 insertions, 28 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 6c36d1a6c87..6bb6bbfbef9 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -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