aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-08-10 23:06:01 +0100
committerPedro Alves <palves@redhat.com>2016-08-10 23:06:01 +0100
commitbbbbef233724142bd4ff5c288863a62c98b01ff1 (patch)
treeac18a322d434d3a150fce4d38a2c348225a74ed6 /gdb
parent7c50accb20e77971c775fdb7f5f1bfa605397e80 (diff)
downloadgdb-bbbbef233724142bd4ff5c288863a62c98b01ff1.zip
gdb-bbbbef233724142bd4ff5c288863a62c98b01ff1.tar.gz
gdb-bbbbef233724142bd4ff5c288863a62c98b01ff1.tar.bz2
Introduce 'enum remove_bp_reason'
Makes the code more obvious. gdb/ChangeLog: 2016-08-10 Pedro Alves <palves@redhat.com> PR gdb/19187 * breakpoint.c (insertion_state_t): Delete. (enum remove_bp_reason): New. (detach_breakpoints, remove_breakpoint_1, remove_breakpoint): Adjust to use enum remove_bp_reason instead of insertion_state_t.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/breakpoint.c33
2 files changed, 27 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9dc3f4a..1252c94 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,6 +1,14 @@
2016-08-10 Pedro Alves <palves@redhat.com>
PR gdb/19187
+ * breakpoint.c (insertion_state_t): Delete.
+ (enum remove_bp_reason): New.
+ (detach_breakpoints, remove_breakpoint_1, remove_breakpoint):
+ Adjust to use enum remove_bp_reason instead of insertion_state_t.
+
+2016-08-10 Pedro Alves <palves@redhat.com>
+
+ PR gdb/19187
* breakpoint.c (remove_breakpoint): Remove 'is' parameter and
always pass mark_uninserted to remove_breakpoint_1.
(insert_breakpoint_locations, remove_breakpoints)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index a24eee1..6c36d1a 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -194,15 +194,20 @@ static void commands_command (char *, int);
static void condition_command (char *, int);
-typedef enum
- {
- mark_inserted,
- mark_uninserted
- }
-insertion_state_t;
+/* 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 *, insertion_state_t);
+static int remove_breakpoint_1 (struct bp_location *, enum remove_bp_reason);
static enum print_stop_action print_bp_stop_message (bpstat bs);
@@ -3929,7 +3934,7 @@ detach_breakpoints (ptid_t ptid)
continue;
if (bl->inserted)
- val |= remove_breakpoint_1 (bl, mark_inserted);
+ val |= remove_breakpoint_1 (bl, DETACH_BREAKPOINT);
}
do_cleanups (old_chain);
@@ -3943,7 +3948,7 @@ detach_breakpoints (ptid_t ptid)
*not* look at bl->pspace->aspace here. */
static int
-remove_breakpoint_1 (struct bp_location *bl, insertion_state_t is)
+remove_breakpoint_1 (struct bp_location *bl, enum remove_bp_reason reason)
{
int val;
@@ -4055,18 +4060,18 @@ remove_breakpoint_1 (struct bp_location *bl, insertion_state_t is)
if (val)
return val;
- bl->inserted = (is == mark_inserted);
+ bl->inserted = (reason == DETACH_BREAKPOINT);
}
else if (bl->loc_type == bp_loc_hardware_watchpoint)
{
gdb_assert (bl->owner->ops != NULL
&& bl->owner->ops->remove_location != NULL);
- bl->inserted = (is == mark_inserted);
+ bl->inserted = (reason == DETACH_BREAKPOINT);
bl->owner->ops->remove_location (bl);
/* Failure to remove any of the hardware watchpoints comes here. */
- if ((is == mark_uninserted) && (bl->inserted))
+ if (reason == REMOVE_BREAKPOINT && bl->inserted)
warning (_("Could not remove hardware watchpoint %d."),
bl->owner->number);
}
@@ -4081,7 +4086,7 @@ remove_breakpoint_1 (struct bp_location *bl, insertion_state_t is)
if (val)
return val;
- bl->inserted = (is == mark_inserted);
+ bl->inserted = (reason == DETACH_BREAKPOINT);
}
return 0;
@@ -4104,7 +4109,7 @@ remove_breakpoint (struct bp_location *bl)
switch_to_program_space_and_thread (bl->pspace);
- ret = remove_breakpoint_1 (bl, mark_uninserted);
+ ret = remove_breakpoint_1 (bl, REMOVE_BREAKPOINT);
do_cleanups (old_chain);
return ret;