+2011-07-25 Pedro Alves <pedro@codesourcery.com>
+
+ * breakpoint.h (print_recreate_thread): Declare.
+ (struct breakpoint): Move step_count, pass_count,
+ number_on_target, static_trace_marker_id,
+ static_trace_marker_id_idx ...
+ (struct tracepoint): ... to this new struct.
+ (get_tracepoint, get_tracepoint_by_number_on_target)
+ (get_tracepoint_by_number): Change return type to struct
+ tracepoint pointer.
+ * breakpoint.c (is_tracepoint_type): New, factored out from
+ is_tracepoint.
+ (is_tracepoint): Adjust.
+ (print_one_breakpoint_location): Cast to struct tracepoint as
+ necessary, and adjust.
+ (print_recreate_catch_fork, print_recreate_catch_vfork)
+ (print_recreate_catch_syscall, print_recreate_catch_exec): Call
+ print_recreate_thread.
+ (init_breakpoint_sal): New, factored out from
+ create_breakpoint_sal.
+ (create_breakpoint_sal): Reimplement.
+ (create_breakpoint): Allocate a struct tracecepoint if the caller
+ wanted a tracepoint. Use init_breakpoint_sal and
+ install_breakpoint.
+ (print_recreate_ranged_breakpoint, print_recreate_watchpoint)
+ (print_recreate_masked_watchpoint)
+ (print_recreate_exception_catchpoint): Call print_recreate_thread.
+ (tracepoint_print_one_detail): Adjust.
+ (tracepoint_print_recreate): Adjust. Call print_recreate_thread.
+ Dump the pass count here.
+ (update_static_tracepoint): Adjust.
+ (addr_string_to_sals): Adjust.
+ (create_tracepoint_from_upload): Adjust. Change return type to
+ struct tracepoint pointer.
+ (trace_pass_set_count): Change parameter type to struct tracepoint
+ pointer, and adjust.
+ (trace_pass_command): Adjust.
+ (get_tracepoint, get_tracepoint_by_number_on_target)
+ (get_tracepoint_by_number): Change return type to struct
+ tracepoint pointer, and adjust.
+ (print_recreate_thread): New, factored out from save_breakpoints.
+ (save_breakpoints): Don't print thread and task and passcount
+ recreation here.
+ * remote.c (remote_download_tracepoint): Adjust.
+ * tracepoint.c (trace_actions_command, validate_actionline)
+ (start_tracing, tfind_1, trace_find_tracepoint_command)
+ (trace_dump_command): Adjust.
+ (find_matching_tracepoint): Change return type to struct
+ tracepoint pointer, and adjust.
+ (merge_uploaded_tracepoints, tfile_get_traceframe_address)
+ (tfile_trace_find, tfile_fetch_registers): Adjust.
+ * tracepoint.h (create_tracepoint_from_upload): Change return type
+ to struct tracepoint pointer.
+ * ada-lang.c (print_recreate_exception): Call
+ print_recreate_thread.
+ * mi/mi-cmd-break.c (mi_cmd_break_passcount): Adjust.
+
2011-07-25 Pedro Alves <pedro@codesourcery.com>
* breakpoint.h (struct breakpoint): Move ops as first field. Move
default:
internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
}
+ print_recreate_thread (b, fp);
}
/* Virtual table for "catch exception" breakpoints. */
/* Encapsulate tests for different types of tracepoints. */
+static int
+is_tracepoint_type (enum bptype type)
+{
+ return (type == bp_tracepoint
+ || type == bp_fast_tracepoint
+ || type == bp_static_tracepoint);
+}
+
int
is_tracepoint (const struct breakpoint *b)
{
- return (b->type == bp_tracepoint
- || b->type == bp_fast_tracepoint
- || b->type == bp_static_tracepoint);
+ return is_tracepoint_type (b->type);
}
-
+
/* A helper function that validates that COMMANDS are valid for a
breakpoint. This function will throw an exception if a problem is
found. */
do_cleanups (script_chain);
}
- if (!part_of_multiple && b->pass_count)
+ if (is_tracepoint (b))
{
- annotate_field (10);
- ui_out_text (uiout, "\tpass count ");
- ui_out_field_int (uiout, "pass", b->pass_count);
- ui_out_text (uiout, " \n");
+ struct tracepoint *t = (struct tracepoint *) b;
+
+ if (!part_of_multiple && t->pass_count)
+ {
+ annotate_field (10);
+ ui_out_text (uiout, "\tpass count ");
+ ui_out_field_int (uiout, "pass", t->pass_count);
+ ui_out_text (uiout, " \n");
+ }
}
if (ui_out_is_mi_like_p (uiout) && !part_of_multiple)
print_recreate_catch_fork (struct breakpoint *b, struct ui_file *fp)
{
fprintf_unfiltered (fp, "catch fork");
+ print_recreate_thread (b, fp);
}
/* The breakpoint_ops structure to be used in fork catchpoints. */
print_recreate_catch_vfork (struct breakpoint *b, struct ui_file *fp)
{
fprintf_unfiltered (fp, "catch vfork");
+ print_recreate_thread (b, fp);
}
/* The breakpoint_ops structure to be used in vfork catchpoints. */
fprintf_unfiltered (fp, " %d", s.number);
}
}
+ print_recreate_thread (b, fp);
}
/* The breakpoint_ops structure to be used in syscall catchpoints. */
print_recreate_catch_exec (struct breakpoint *b, struct ui_file *fp)
{
fprintf_unfiltered (fp, "catch exec");
+ print_recreate_thread (b, fp);
}
static struct breakpoint_ops catch_exec_breakpoint_ops;
as condition expression. */
static void
-create_breakpoint_sal (struct gdbarch *gdbarch,
- struct symtabs_and_lines sals, char *addr_string,
- char *cond_string,
- enum bptype type, enum bpdisp disposition,
- int thread, int task, int ignore_count,
- struct breakpoint_ops *ops, int from_tty,
- int enabled, int internal, int display_canonical)
+init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
+ struct symtabs_and_lines sals, char *addr_string,
+ char *cond_string,
+ enum bptype type, enum bpdisp disposition,
+ int thread, int task, int ignore_count,
+ struct breakpoint_ops *ops, int from_tty,
+ int enabled, int internal, int display_canonical)
{
- struct breakpoint *b = NULL;
int i;
if (type == bp_hardware_breakpoint)
if (i == 0)
{
- b = set_raw_breakpoint (gdbarch, sal, type, ops);
- set_breakpoint_number (internal, b);
+ init_raw_breakpoint (b, gdbarch, sal, type, ops);
b->thread = thread;
b->task = task;
if (type == bp_static_tracepoint)
{
+ struct tracepoint *t = (struct tracepoint *) b;
struct static_tracepoint_marker marker;
if (is_marker_spec (addr_string))
endp = skip_to_space (p);
marker_str = savestring (p, endp - p);
- b->static_trace_marker_id = marker_str;
+ t->static_trace_marker_id = marker_str;
printf_filtered (_("Probed static tracepoint "
"marker \"%s\"\n"),
- b->static_trace_marker_id);
+ t->static_trace_marker_id);
}
else if (target_static_tracepoint_marker_at (sal.pc, &marker))
{
- b->static_trace_marker_id = xstrdup (marker.str_id);
+ t->static_trace_marker_id = xstrdup (marker.str_id);
release_static_tracepoint_marker (&marker);
printf_filtered (_("Probed static tracepoint "
"marker \"%s\"\n"),
- b->static_trace_marker_id);
+ t->static_trace_marker_id);
}
else
warning (_("Couldn't determine the static "
me. */
b->addr_string
= xstrprintf ("*%s", paddress (b->loc->gdbarch, b->loc->address));
+}
- /* Do not mention breakpoints with a negative number, but do
- notify observers. */
- if (!internal)
- mention (b);
- observer_notify_breakpoint_created (b);
+static void
+create_breakpoint_sal (struct gdbarch *gdbarch,
+ struct symtabs_and_lines sals, char *addr_string,
+ char *cond_string,
+ enum bptype type, enum bpdisp disposition,
+ int thread, int task, int ignore_count,
+ struct breakpoint_ops *ops, int from_tty,
+ int enabled, int internal, int display_canonical)
+{
+ struct breakpoint *b;
+ struct cleanup *old_chain;
+
+ if (is_tracepoint_type (type))
+ {
+ struct tracepoint *t;
+
+ t = XCNEW (struct tracepoint);
+ b = &t->base;
+ }
+ else
+ b = XNEW (struct breakpoint);
+
+ old_chain = make_cleanup (xfree, b);
+
+ init_breakpoint_sal (b, gdbarch,
+ sals, addr_string,
+ cond_string,
+ type, disposition,
+ thread, task, ignore_count,
+ ops, from_tty,
+ enabled, internal, display_canonical);
+ discard_cleanups (old_chain);
+
+ install_breakpoint (internal, b);
}
/* Remove element at INDEX_TO_REMOVE from SAL, shifting other
for (i = 0; i < sals.nelts; ++i)
{
struct symtabs_and_lines expanded;
- struct breakpoint *tp;
+ struct tracepoint *tp;
struct cleanup *old_chain;
expanded.nelts = 1;
expanded.sals[0] = sals.sals[i];
old_chain = make_cleanup (xfree, expanded.sals);
- create_breakpoint_sal (gdbarch, expanded, canonical.canonical[i],
- cond_string, type_wanted,
- tempflag ? disp_del : disp_donttouch,
- thread, task, ignore_count, ops,
- from_tty, enabled, internal,
- canonical.special_display);
-
- do_cleanups (old_chain);
-
- /* Get the tracepoint we just created. */
- if (internal)
- tp = get_breakpoint (internal_breakpoint_number);
- else
- tp = get_breakpoint (breakpoint_count);
- gdb_assert (tp != NULL);
-
+ tp = XCNEW (struct tracepoint);
+ init_breakpoint_sal (&tp->base, gdbarch, expanded,
+ canonical.canonical[i],
+ cond_string, type_wanted,
+ tempflag ? disp_del : disp_donttouch,
+ thread, task, ignore_count, ops,
+ from_tty, enabled, internal,
+ canonical.special_display);
/* Given that its possible to have multiple markers with
the same string id, if the user is creating a static
tracepoint by marker id ("strace -m MARKER_ID"), then
try to match up which of the newly found markers
corresponds to this one */
tp->static_trace_marker_id_idx = i;
+
+ install_breakpoint (internal, &tp->base);
+
+ do_cleanups (old_chain);
}
}
else
{
fprintf_unfiltered (fp, "break-range %s, %s", b->addr_string,
b->addr_string_range_end);
+ print_recreate_thread (b, fp);
}
/* The breakpoint_ops structure to be used in ranged breakpoints. */
}
fprintf_unfiltered (fp, " %s", w->exp_string);
+ print_recreate_thread (b, fp);
}
/* The breakpoint_ops structure to be used in hardware watchpoints. */
sprintf_vma (tmp, w->hw_wp_mask);
fprintf_unfiltered (fp, " %s mask 0x%s", w->exp_string, tmp);
+ print_recreate_thread (b, fp);
}
/* The breakpoint_ops structure to be used in masked hardware watchpoints. */
bp_throw = strstr (b->addr_string, "throw") != NULL;
fprintf_unfiltered (fp, bp_temp ? "tcatch " : "catch ");
fprintf_unfiltered (fp, bp_throw ? "throw" : "catch");
+ print_recreate_thread (b, fp);
}
static struct breakpoint_ops gnu_v3_exception_catchpoint_ops;
tracepoint_print_one_detail (const struct breakpoint *self,
struct ui_out *uiout)
{
- if (self->static_trace_marker_id)
+ struct tracepoint *tp = (struct tracepoint *) self;
+ if (tp->static_trace_marker_id)
{
gdb_assert (self->type == bp_static_tracepoint);
ui_out_text (uiout, "\tmarker id is ");
ui_out_field_string (uiout, "static-tracepoint-marker-string-id",
- self->static_trace_marker_id);
+ tp->static_trace_marker_id);
ui_out_text (uiout, "\n");
}
}
}
static void
-tracepoint_print_recreate (struct breakpoint *tp, struct ui_file *fp)
+tracepoint_print_recreate (struct breakpoint *self, struct ui_file *fp)
{
- if (tp->type == bp_fast_tracepoint)
+ struct tracepoint *tp = (struct tracepoint *) self;
+
+ if (self->type == bp_fast_tracepoint)
fprintf_unfiltered (fp, "ftrace");
- if (tp->type == bp_static_tracepoint)
+ if (self->type == bp_static_tracepoint)
fprintf_unfiltered (fp, "strace");
- else if (tp->type == bp_tracepoint)
+ else if (self->type == bp_tracepoint)
fprintf_unfiltered (fp, "trace");
else
internal_error (__FILE__, __LINE__,
- _("unhandled tracepoint type %d"), (int) tp->type);
+ _("unhandled tracepoint type %d"), (int) self->type);
- fprintf_unfiltered (fp, " %s", tp->addr_string);
+ fprintf_unfiltered (fp, " %s", self->addr_string);
+ print_recreate_thread (self, fp);
+
+ if (tp->pass_count)
+ fprintf_unfiltered (fp, " passcount %d\n", tp->pass_count);
}
struct breakpoint_ops tracepoint_breakpoint_ops;
static struct symtab_and_line
update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
{
+ struct tracepoint *tp = (struct tracepoint *) b;
struct static_tracepoint_marker marker;
CORE_ADDR pc;
int i;
if (target_static_tracepoint_marker_at (pc, &marker))
{
- if (strcmp (b->static_trace_marker_id, marker.str_id) != 0)
+ if (strcmp (tp->static_trace_marker_id, marker.str_id) != 0)
warning (_("static tracepoint %d changed probed marker from %s to %s"),
b->number,
- b->static_trace_marker_id, marker.str_id);
+ tp->static_trace_marker_id, marker.str_id);
- xfree (b->static_trace_marker_id);
- b->static_trace_marker_id = xstrdup (marker.str_id);
+ xfree (tp->static_trace_marker_id);
+ tp->static_trace_marker_id = xstrdup (marker.str_id);
release_static_tracepoint_marker (&marker);
return sal;
if (!sal.explicit_pc
&& sal.line != 0
&& sal.symtab != NULL
- && b->static_trace_marker_id != NULL)
+ && tp->static_trace_marker_id != NULL)
{
VEC(static_tracepoint_marker_p) *markers;
markers
- = target_static_tracepoint_markers_by_strid (b->static_trace_marker_id);
+ = target_static_tracepoint_markers_by_strid (tp->static_trace_marker_id);
if (!VEC_empty(static_tracepoint_marker_p, markers))
{
marker = VEC_index (static_tracepoint_marker_p, markers, 0);
- xfree (b->static_trace_marker_id);
- b->static_trace_marker_id = xstrdup (marker->str_id);
+ xfree (tp->static_trace_marker_id);
+ tp->static_trace_marker_id = xstrdup (marker->str_id);
warning (_("marker for static tracepoint %d (%s) not "
"found at previous line number"),
- b->number, b->static_trace_marker_id);
+ b->number, tp->static_trace_marker_id);
init_sal (&sal);
{
if (marker_spec)
{
+ struct tracepoint *tp = (struct tracepoint *) b;
+
sals = decode_static_tracepoint_spec (&s);
- if (sals.nelts > b->static_trace_marker_id_idx)
+ if (sals.nelts > tp->static_trace_marker_id_idx)
{
- sals.sals[0] = sals.sals[b->static_trace_marker_id_idx];
+ sals.sals[0] = sals.sals[tp->static_trace_marker_id_idx];
sals.nelts = 1;
}
else
- error (_("marker %s not found"), b->static_trace_marker_id);
+ error (_("marker %s not found"), tp->static_trace_marker_id);
}
else
sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, NULL);
the target does not necessarily have all the information used when
the tracepoint was originally defined. */
-struct breakpoint *
+struct tracepoint *
create_tracepoint_from_upload (struct uploaded_tp *utp)
{
char *addr_str, small_buf[100];
- struct breakpoint *tp;
+ struct tracepoint *tp;
if (utp->at_string)
addr_str = utp->at_string;
if (utp->pass > 0)
{
- sprintf (small_buf, "%d %d", utp->pass, tp->number);
+ sprintf (small_buf, "%d %d", utp->pass, tp->base.number);
trace_pass_command (small_buf, 0);
}
cmd_list = read_command_lines_1 (read_uploaded_action, 1, NULL, NULL);
- breakpoint_set_commands (tp, cmd_list);
+ breakpoint_set_commands (&tp->base, cmd_list);
}
else if (!VEC_empty (char_ptr, utp->actions)
|| !VEC_empty (char_ptr, utp->step_actions))
utp->number);
return tp;
- }
+}
/* Print information on tracepoint number TPNUM_EXP, or all if
omitted. */
/* Helper function for trace_pass_command. */
static void
-trace_pass_set_count (struct breakpoint *bp, int count, int from_tty)
+trace_pass_set_count (struct tracepoint *tp, int count, int from_tty)
{
- bp->pass_count = count;
- observer_notify_tracepoint_modified (bp->number);
+ tp->pass_count = count;
+ observer_notify_tracepoint_modified (tp->base.number);
if (from_tty)
printf_filtered (_("Setting tracepoint %d's passcount to %d\n"),
- bp->number, count);
+ tp->base.number, count);
}
/* Set passcount for tracepoint.
static void
trace_pass_command (char *args, int from_tty)
{
- struct breakpoint *t1;
+ struct tracepoint *t1;
unsigned int count;
if (args == 0 || *args == 0)
if (*args && strncasecmp (args, "all", 3) == 0)
{
+ struct breakpoint *b;
+
args += 3; /* Skip special argument "all". */
if (*args)
error (_("Junk at end of arguments."));
- ALL_TRACEPOINTS (t1)
+ ALL_TRACEPOINTS (b)
{
+ t1 = (struct tracepoint *) b;
trace_pass_set_count (t1, count, from_tty);
}
}
}
}
-struct breakpoint *
+struct tracepoint *
get_tracepoint (int num)
{
struct breakpoint *t;
ALL_TRACEPOINTS (t)
if (t->number == num)
- return t;
+ return (struct tracepoint *) t;
return NULL;
}
different from the tracepoint number after disconnecting and
reconnecting). */
-struct breakpoint *
+struct tracepoint *
get_tracepoint_by_number_on_target (int num)
{
- struct breakpoint *t;
+ struct breakpoint *b;
- ALL_TRACEPOINTS (t)
- if (t->number_on_target == num)
- return t;
+ ALL_TRACEPOINTS (b)
+ {
+ struct tracepoint *t = (struct tracepoint *) b;
+
+ if (t->number_on_target == num)
+ return t;
+ }
return NULL;
}
If STATE is not NULL, use, get_number_or_range_state and ignore ARG.
If OPTIONAL_P is true, then if the argument is missing, the most
recent tracepoint (tracepoint_count) is returned. */
-struct breakpoint *
+struct tracepoint *
get_tracepoint_by_number (char **arg,
struct get_number_or_range_state *state,
int optional_p)
ALL_TRACEPOINTS (t)
if (t->number == tpnum)
{
- return t;
+ return (struct tracepoint *) t;
}
printf_unfiltered ("No tracepoint number %d.\n", tpnum);
return NULL;
}
+void
+print_recreate_thread (struct breakpoint *b, struct ui_file *fp)
+{
+ if (b->thread != -1)
+ fprintf_unfiltered (fp, " thread %d", b->thread);
+
+ if (b->task != 0)
+ fprintf_unfiltered (fp, " task %d", b->task);
+
+ fprintf_unfiltered (fp, "\n");
+}
+
/* Save information on user settable breakpoints (watchpoints, etc) to
a new script file named FILENAME. If FILTER is non-NULL, call it
on each breakpoint and only include the ones for which it returns
tp->ops->print_recreate (tp, fp);
- if (tp->thread != -1)
- fprintf_unfiltered (fp, " thread %d", tp->thread);
-
- if (tp->task != 0)
- fprintf_unfiltered (fp, " task %d", tp->task);
-
- fprintf_unfiltered (fp, "\n");
-
/* Note, we can't rely on tp->number for anything, as we can't
assume the recreated breakpoint numbers will match. Use $bpnum
instead. */
if (tp->ignore_count)
fprintf_unfiltered (fp, " ignore $bpnum %d\n", tp->ignore_count);
- if (tp->pass_count)
- fprintf_unfiltered (fp, " passcount %d\n", tp->pass_count);
-
if (tp->commands)
{
volatile struct gdb_exception ex;
void (*print_recreate) (struct breakpoint *, struct ui_file *fp);
};
+/* Helper for breakpoint_ops->print_recreate implementations. Prints
+ the "thread" or "task" condition of B, and then a newline.
+
+ Necessary because most breakpoint implementations accept
+ thread/task conditions at the end of the spec line, like "break foo
+ thread 1", which needs outputting before any breakpoint-type
+ specific extra command necessary for B's recreation. */
+extern void print_recreate_thread (struct breakpoint *b, struct ui_file *fp);
+
enum watchpoint_triggered
{
/* This watchpoint definitely did not trigger. */
the condition in. */
int condition_not_parsed;
- /* Number of times this tracepoint should single-step
- and collect additional data. */
- long step_count;
-
- /* Number of times this tracepoint should be hit before
- disabling/ending. */
- int pass_count;
-
- /* The number of the tracepoint on the target. */
- int number_on_target;
-
- /* The static tracepoint marker id, if known. */
- char *static_trace_marker_id;
-
- /* LTTng/UST allow more than one marker with the same ID string,
- although it unadvised because it confuses tools. When setting
- static tracepoints by marker ID, this will record the index in
- the array of markers we found for the given marker ID for which
- this static tracepoint corresponds. When resetting
- breakpoints, we will use this index to try to find the same
- marker again. */
- int static_trace_marker_id_idx;
-
/* With a Python scripting enabled GDB, store a reference to the
Python object that has been associated with this breakpoint.
This is always NULL for a GDB that is not script enabled. It
extern int is_watchpoint (const struct breakpoint *bpt);
+/* An instance of this type is used to represent all kinds of
+ tracepoints. It includes a "struct breakpoint" as a kind of base
+ class; users downcast to "struct breakpoint *" when needed. */
+
+struct tracepoint
+{
+ /* The base class. */
+ struct breakpoint base;
+
+ /* Number of times this tracepoint should single-step and collect
+ additional data. */
+ long step_count;
+
+ /* Number of times this tracepoint should be hit before
+ disabling/ending. */
+ int pass_count;
+
+ /* The number of the tracepoint on the target. */
+ int number_on_target;
+
+ /* The static tracepoint marker id, if known. */
+ char *static_trace_marker_id;
+
+ /* LTTng/UST allow more than one marker with the same ID string,
+ although it unadvised because it confuses tools. When setting
+ static tracepoints by marker ID, this will record the index in
+ the array of markers we found for the given marker ID for which
+ this static tracepoint corresponds. When resetting breakpoints,
+ we will use this index to try to find the same marker again. */
+ int static_trace_marker_id_idx;
+};
+
typedef struct breakpoint *breakpoint_p;
DEF_VEC_P(breakpoint_p);
\f
extern int catching_syscall_number (int syscall_number);
/* Return a tracepoint with the given number if found. */
-extern struct breakpoint *get_tracepoint (int num);
+extern struct tracepoint *get_tracepoint (int num);
-extern struct breakpoint *get_tracepoint_by_number_on_target (int num);
+extern struct tracepoint *get_tracepoint_by_number_on_target (int num);
/* Find a tracepoint by parsing a number in the supplied string. */
-extern struct breakpoint *
+extern struct tracepoint *
get_tracepoint_by_number (char **arg,
struct get_number_or_range_state *state,
int optional_p);
{
int n;
int p;
- struct breakpoint *t;
+ struct tracepoint *t;
if (argc != 2)
error (_("Usage: tracepoint-number passcount"));
}
static void
-remote_download_tracepoint (struct breakpoint *t)
+remote_download_tracepoint (struct breakpoint *b)
{
struct bp_location *loc;
CORE_ADDR tpaddr;
struct agent_expr *aexpr;
struct cleanup *aexpr_chain = NULL;
char *pkt;
+ struct tracepoint *t = (struct tracepoint *) b;
/* Iterate over all the tracepoint locations. It's up to the target to
notice multiple tracepoint packets with the same number but different
addresses, and treat them as multiple locations. */
- for (loc = t->loc; loc; loc = loc->next)
+ for (loc = b->loc; loc; loc = loc->next)
{
- encode_actions (t, loc, &tdp_actions, &stepping_actions);
+ encode_actions (b, loc, &tdp_actions, &stepping_actions);
old_chain = make_cleanup (free_actions_list_cleanup_wrapper,
tdp_actions);
(void) make_cleanup (free_actions_list_cleanup_wrapper,
tpaddr = loc->address;
sprintf_vma (addrbuf, tpaddr);
- sprintf (buf, "QTDP:%x:%s:%c:%lx:%x", t->number,
+ sprintf (buf, "QTDP:%x:%s:%c:%lx:%x", b->number,
addrbuf, /* address */
- (t->enable_state == bp_enabled ? 'E' : 'D'),
+ (b->enable_state == bp_enabled ? 'E' : 'D'),
t->step_count, t->pass_count);
/* Fast tracepoints are mostly handled by the target, but we can
tell the target how big of an instruction block should be moved
around. */
- if (t->type == bp_fast_tracepoint)
+ if (b->type == bp_fast_tracepoint)
{
/* Only test for support at download time; we may not know
target capabilities at definition time. */
tracepoints, so don't take lack of support as a reason to
give up on the trace run. */
warning (_("Target does not support fast tracepoints, "
- "downloading %d as regular tracepoint"), t->number);
+ "downloading %d as regular tracepoint"), b->number);
}
- else if (t->type == bp_static_tracepoint)
+ else if (b->type == bp_static_tracepoint)
{
/* Only test for support at download time; we may not know
target capabilities at definition time. */
}
else
warning (_("Target does not support conditional tracepoints, "
- "ignoring tp %d cond"), t->number);
+ "ignoring tp %d cond"), b->number);
}
- if (t->commands || *default_collect)
+ if (b->commands || *default_collect)
strcat (buf, "-");
putpkt (buf);
remote_get_noisy_reply (&target_buf, &target_buf_size);
{
QUIT; /* Allow user to bail out with ^C. */
sprintf (buf, "QTDP:-%x:%s:%s%c",
- t->number, addrbuf, /* address */
+ b->number, addrbuf, /* address */
tdp_actions[ndx],
((tdp_actions[ndx + 1] || stepping_actions)
? '-' : 0));
{
QUIT; /* Allow user to bail out with ^C. */
sprintf (buf, "QTDP:-%x:%s:%s%s%s",
- t->number, addrbuf, /* address */
+ b->number, addrbuf, /* address */
((ndx == 0) ? "S" : ""),
stepping_actions[ndx],
(stepping_actions[ndx + 1] ? "-" : ""));
if (remote_protocol_packets[PACKET_TracepointSource].support
== PACKET_ENABLE)
{
- if (t->addr_string)
+ if (b->addr_string)
{
strcpy (buf, "QTDPsrc:");
- encode_source_string (t->number, loc->address,
- "at", t->addr_string, buf + strlen (buf),
+ encode_source_string (b->number, loc->address,
+ "at", b->addr_string, buf + strlen (buf),
2048 - strlen (buf));
putpkt (buf);
if (strcmp (target_buf, "OK"))
warning (_("Target does not support source download."));
}
- if (t->cond_string)
+ if (b->cond_string)
{
strcpy (buf, "QTDPsrc:");
- encode_source_string (t->number, loc->address,
- "cond", t->cond_string, buf + strlen (buf),
+ encode_source_string (b->number, loc->address,
+ "cond", b->cond_string, buf + strlen (buf),
2048 - strlen (buf));
putpkt (buf);
remote_get_noisy_reply (&target_buf, &target_buf_size);
if (strcmp (target_buf, "OK"))
warning (_("Target does not support source download."));
}
- remote_download_command_source (t->number, loc->address,
- breakpoint_commands (t));
+ remote_download_command_source (b->number, loc->address,
+ breakpoint_commands (b));
}
do_cleanups (old_chain);
static void
trace_actions_command (char *args, int from_tty)
{
- struct breakpoint *t;
+ struct tracepoint *t;
struct command_line *l;
t = get_tracepoint_by_number (&args, NULL, 1);
{
char *tmpbuf =
xstrprintf ("Enter actions for tracepoint %d, one per line.",
- t->number);
+ t->base.number);
struct cleanup *cleanups = make_cleanup (xfree, tmpbuf);
l = read_command_lines (tmpbuf, from_tty, 1,
check_tracepoint_command, t);
do_cleanups (cleanups);
- breakpoint_set_commands (t, l);
+ breakpoint_set_commands (&t->base, l);
}
/* else just return */
}
/* worker function */
void
-validate_actionline (char **line, struct breakpoint *t)
+validate_actionline (char **line, struct breakpoint *b)
{
struct cmd_list_element *c;
struct expression *exp = NULL;
char *p, *tmp_p;
struct bp_location *loc;
struct agent_expr *aexpr;
+ struct tracepoint *t = (struct tracepoint *) b;
/* If EOF is typed, *line is NULL. */
if (*line == NULL)
/* else fall thru, treat p as an expression and parse it! */
}
tmp_p = p;
- for (loc = t->loc; loc; loc = loc->next)
+ for (loc = t->base.loc; loc; loc = loc->next)
{
p = tmp_p;
exp = parse_exp_1 (&p, block_for_pc (loc->address), 1);
p++;
tmp_p = p;
- for (loc = t->loc; loc; loc = loc->next)
+ for (loc = t->base.loc; loc; loc = loc->next)
{
p = tmp_p;
/* Only expressions are allowed for this action. */
{
VEC(breakpoint_p) *tp_vec = NULL;
int ix;
- struct breakpoint *t;
+ struct breakpoint *b;
struct trace_state_variable *tsv;
int any_enabled = 0, num_to_download = 0;
error (_("No tracepoints defined, not starting trace"));
}
- for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, t); ix++)
+ for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++)
{
- if (t->enable_state == bp_enabled)
+ struct tracepoint *t = (struct tracepoint *) b;
+
+ if (b->enable_state == bp_enabled)
any_enabled = 1;
- if ((t->type == bp_fast_tracepoint
+ if ((b->type == bp_fast_tracepoint
? may_insert_fast_tracepoints
: may_insert_tracepoints))
++num_to_download;
else
warning (_("May not insert %stracepoints, skipping tracepoint %d"),
- (t->type == bp_fast_tracepoint ? "fast " : ""), t->number);
+ (b->type == bp_fast_tracepoint ? "fast " : ""), b->number);
}
if (!any_enabled)
target_trace_init ();
- for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, t); ix++)
+ for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++)
{
- if ((t->type == bp_fast_tracepoint
+ struct tracepoint *t = (struct tracepoint *) b;
+
+ if ((b->type == bp_fast_tracepoint
? !may_insert_fast_tracepoints
: !may_insert_tracepoints))
continue;
t->number_on_target = 0;
- target_download_tracepoint (t);
- t->number_on_target = t->number;
+ target_download_tracepoint (b);
+ t->number_on_target = b->number;
}
VEC_free (breakpoint_p, tp_vec);
{
int target_frameno = -1, target_tracept = -1;
struct frame_id old_frame_id = null_frame_id;
- struct breakpoint *tp;
+ struct tracepoint *tp;
/* Only try to get the current stack frame if we have a chance of
succeeding. In particular, if we're trying to get a first trace
target_dcache_invalidate ();
set_traceframe_num (target_frameno);
clear_traceframe_info ();
- set_tracepoint_num (tp ? tp->number : target_tracept);
+ set_tracepoint_num (tp ? tp->base.number : target_tracept);
if (target_frameno == -1)
set_traceframe_context (NULL);
else
trace_find_tracepoint_command (char *args, int from_tty)
{
int tdp;
- struct breakpoint *tp;
+ struct tracepoint *tp;
if (current_trace_status ()->running && !current_trace_status ()->from_file)
error (_("May not look at trace frames while trace is running."));
trace_dump_command (char *args, int from_tty)
{
struct regcache *regcache;
- struct breakpoint *t;
+ struct tracepoint *t;
int stepping_frame = 0;
struct bp_location *loc;
char *line, *default_collect_line = NULL;
frame. (FIXME this is not reliable, should record each frame's
type.) */
stepping_frame = 1;
- for (loc = t->loc; loc; loc = loc->next)
+ for (loc = t->base.loc; loc; loc = loc->next)
if (loc->address == regcache_read_pc (regcache))
stepping_frame = 0;
- actions = breakpoint_commands (t);
+ actions = breakpoint_commands (&t->base);
/* If there is a default-collect list, make up a collect command,
prepend to the tracepoint's commands, and pass the whole mess to
default_collect_line = xstrprintf ("collect %s", default_collect);
old_chain = make_cleanup (xfree, default_collect_line);
line = default_collect_line;
- validate_actionline (&line, t);
+ validate_actionline (&line, &t->base);
default_collect_action = xmalloc (sizeof (struct command_line));
make_cleanup (xfree, default_collect_action);
default_collect_action->next = actions;
toggle that freely, and may have done so in anticipation of the
next trace run. */
-struct breakpoint *
+struct tracepoint *
find_matching_tracepoint (struct uploaded_tp *utp)
{
VEC(breakpoint_p) *tp_vec = all_tracepoints ();
int ix;
- struct breakpoint *t;
+ struct breakpoint *b;
struct bp_location *loc;
- for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, t); ix++)
+ for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++)
{
- if (t->type == utp->type
+ struct tracepoint *t = (struct tracepoint *) b;
+
+ if (b->type == utp->type
&& t->step_count == utp->step
&& t->pass_count == utp->pass
/* FIXME also test conditionals and actions. */
)
{
/* Scan the locations for an address match. */
- for (loc = t->loc; loc; loc = loc->next)
+ for (loc = b->loc; loc; loc = loc->next)
{
if (loc->address == utp->addr)
return t;
merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
{
struct uploaded_tp *utp;
- struct breakpoint *t;
+ struct tracepoint *t;
/* Look for GDB tracepoints that match up with our uploaded versions. */
for (utp = *uploaded_tps; utp; utp = utp->next)
if (t)
printf_filtered (_("Assuming tracepoint %d is same "
"as target's tracepoint %d at %s.\n"),
- t->number, utp->number,
+ t->base.number, utp->number,
paddress (get_current_arch (), utp->addr));
else
{
if (t)
printf_filtered (_("Created tracepoint %d for "
"target's tracepoint %d at %s.\n"),
- t->number, utp->number,
+ t->base.number, utp->number,
paddress (get_current_arch (), utp->addr));
else
printf_filtered (_("Failed to create tracepoint for target's "
{
ULONGEST addr = 0;
short tpnum;
- struct breakpoint *tp;
+ struct tracepoint *tp;
off_t saved_offset = cur_offset;
/* FIXME dig pc out of collected registers. */
tp = get_tracepoint_by_number_on_target (tpnum);
/* FIXME this is a poor heuristic if multiple locations. */
- if (tp && tp->loc)
- addr = tp->loc->address;
+ if (tp && tp->base.loc)
+ addr = tp->base.loc->address;
/* Restore our seek position. */
cur_offset = saved_offset;
short tpnum;
int tfnum = 0, found = 0;
unsigned int data_size;
- struct breakpoint *tp;
+ struct tracepoint *tp;
off_t offset, tframe_offset;
ULONGEST tfaddr;
pc_regno = gdbarch_pc_regnum (gdbarch);
if (pc_regno >= 0 && (regno == -1 || regno == pc_regno))
{
- struct breakpoint *tp = get_tracepoint (tracepoint_number);
+ struct tracepoint *tp = get_tracepoint (tracepoint_number);
- if (tp && tp->loc)
+ if (tp && tp->base.loc)
{
/* But don't try to guess if tracepoint is multi-location... */
- if (tp->loc->next)
+ if (tp->base.loc->next)
{
warning (_("Tracepoint %d has multiple "
"locations, cannot infer $pc"),
- tp->number);
+ tp->base.number);
return;
}
/* ... or does while-stepping. */
{
warning (_("Tracepoint %d does while-stepping, "
"cannot infer $pc"),
- tp->number);
+ tp->base.number);
return;
}
store_unsigned_integer (regs, register_size (gdbarch, pc_regno),
gdbarch_byte_order (gdbarch),
- tp->loc->address);
+ tp->base.loc->address);
regcache_raw_supply (regcache, pc_regno, regs);
}
}
extern struct uploaded_tp *get_uploaded_tp (int num, ULONGEST addr,
struct uploaded_tp **utpp);
-extern struct breakpoint *create_tracepoint_from_upload (struct uploaded_tp *utp);
+extern struct tracepoint *create_tracepoint_from_upload (struct uploaded_tp *utp);
extern void merge_uploaded_tracepoints (struct uploaded_tp **utpp);
extern void merge_uploaded_trace_state_variables (struct uploaded_tsv **utsvp);