+2011-05-26 Pedro Alves <pedro@codesourcery.com>
+
+ * breakpoint.c (iterate_over_related_breakpoints): New.
+ (do_map_delete_breakpoint): New.
+ (delete_command): Pass do_map_delete_breakpoint to
+ map_breakpoint_numbers.
+ (do_disable_breakpoint): New.
+ (do_map_disable_breakpoint): Iterate over the breakpoint's related
+ breakpoints.
+ (do_enable_breakpoint): Rename to ...
+ (enable_breakpoint_disp): ... this.
+ (enable_breakpoint): Adjust.
+ (do_enable_breakpoint): New.
+ (enable_once_breakpoint): Delete.
+ (do_map_enable_breakpoint): New.
+ (do_map_enable_once_breakpoint): New.
+ (enable_once_command, enable_delete_command)
+ (delete_trace_command): Iterate over the breakpoint's related
+ breakpoints.
+
2011-05-26 Pedro Alves <pedro@codesourcery.com>
* alpha-tdep.c (alpha_cannot_fetch_register): Don't return true
static void thbreak_command (char *, int);
-static void do_enable_breakpoint (struct breakpoint *, enum bpdisp);
+static void enable_breakpoint_disp (struct breakpoint *, enum bpdisp);
static void stop_command (char *arg, int from_tty);
return make_cleanup (do_delete_breakpoint_cleanup, b);
}
-/* A callback for map_breakpoint_numbers that calls
- delete_breakpoint. */
+/* Iterator function to call a user-provided callback function once
+ for each of B and its related breakpoints. */
+
+static void
+iterate_over_related_breakpoints (struct breakpoint *b,
+ void (*function) (struct breakpoint *,
+ void *),
+ void *data)
+{
+ struct breakpoint *related;
+
+ related = b;
+ do
+ {
+ struct breakpoint *next;
+
+ /* FUNCTION may delete RELATED. */
+ next = related->related_breakpoint;
+
+ if (next == related)
+ {
+ /* RELATED is the last ring entry. */
+ function (related, data);
+
+ /* FUNCTION may have deleted it, so we'd never reach back to
+ B. There's nothing left to do anyway, so just break
+ out. */
+ break;
+ }
+ else
+ function (related, data);
+
+ related = next;
+ }
+ while (related != b);
+}
static void
do_delete_breakpoint (struct breakpoint *b, void *ignore)
delete_breakpoint (b);
}
+/* A callback for map_breakpoint_numbers that calls
+ delete_breakpoint. */
+
+static void
+do_map_delete_breakpoint (struct breakpoint *b, void *ignore)
+{
+ iterate_over_related_breakpoints (b, do_delete_breakpoint, NULL);
+}
+
void
delete_command (char *arg, int from_tty)
{
}
}
else
- map_breakpoint_numbers (arg, do_delete_breakpoint, NULL);
+ map_breakpoint_numbers (arg, do_map_delete_breakpoint, NULL);
}
static int
observer_notify_breakpoint_modified (bpt);
}
+/* A callback for iterate_over_related_breakpoints. */
+
+static void
+do_disable_breakpoint (struct breakpoint *b, void *ignore)
+{
+ disable_breakpoint (b);
+}
+
/* A callback for map_breakpoint_numbers that calls
disable_breakpoint. */
static void
do_map_disable_breakpoint (struct breakpoint *b, void *ignore)
{
- disable_breakpoint (b);
+ iterate_over_related_breakpoints (b, do_disable_breakpoint, NULL);
}
static void
}
static void
-do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition)
+enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition)
{
int target_resources_ok;
void
enable_breakpoint (struct breakpoint *bpt)
{
- do_enable_breakpoint (bpt, bpt->disposition);
+ enable_breakpoint_disp (bpt, bpt->disposition);
+}
+
+static void
+do_enable_breakpoint (struct breakpoint *bpt, void *arg)
+{
+ enable_breakpoint (bpt);
}
/* A callback for map_breakpoint_numbers that calls
static void
do_map_enable_breakpoint (struct breakpoint *b, void *ignore)
{
- enable_breakpoint (b);
+ iterate_over_related_breakpoints (b, do_enable_breakpoint, NULL);
}
/* The enable command enables the specified breakpoints (or all defined
}
static void
-enable_once_breakpoint (struct breakpoint *bpt, void *ignore)
+do_enable_breakpoint_disp (struct breakpoint *bpt, void *arg)
+{
+ enum bpdisp disp = *(enum bpdisp *) arg;
+
+ enable_breakpoint_disp (bpt, disp);
+}
+
+static void
+do_map_enable_once_breakpoint (struct breakpoint *bpt, void *ignore)
{
- do_enable_breakpoint (bpt, disp_disable);
+ enum bpdisp disp = disp_disable;
+
+ iterate_over_related_breakpoints (bpt, do_enable_breakpoint_disp, &disp);
}
static void
enable_once_command (char *args, int from_tty)
{
- map_breakpoint_numbers (args, enable_once_breakpoint, NULL);
+ map_breakpoint_numbers (args, do_map_enable_once_breakpoint, NULL);
}
static void
-enable_delete_breakpoint (struct breakpoint *bpt, void *ignore)
+do_map_enable_delete_breakpoint (struct breakpoint *bpt, void *ignore)
{
- do_enable_breakpoint (bpt, disp_del);
+ enum bpdisp disp = disp_del;
+
+ iterate_over_related_breakpoints (bpt, do_enable_breakpoint_disp, &disp);
}
static void
enable_delete_command (char *args, int from_tty)
{
- map_breakpoint_numbers (args, enable_delete_breakpoint, NULL);
+ map_breakpoint_numbers (args, do_map_enable_delete_breakpoint, NULL);
}
\f
static void
}
}
else
- map_breakpoint_numbers (arg, do_delete_breakpoint, NULL);
+ map_breakpoint_numbers (arg, do_map_delete_breakpoint, NULL);
}
/* Helper function for trace_pass_command. */