2011-07-25 Pedro Alves <pedro@codesourcery.com>

gdb/
	* 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.
This commit is contained in:
Pedro Alves 2011-07-25 11:24:44 +00:00
parent 3a5c3e2258
commit d9b3f62eb2
8 changed files with 330 additions and 184 deletions

View file

@ -1,3 +1,60 @@
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> 2011-07-25 Pedro Alves <pedro@codesourcery.com>
* breakpoint.h (struct breakpoint): Move ops as first field. Move * breakpoint.h (struct breakpoint): Move ops as first field. Move

View file

@ -11262,6 +11262,7 @@ print_recreate_exception (enum exception_catchpoint_kind ex,
default: default:
internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
} }
print_recreate_thread (b, fp);
} }
/* Virtual table for "catch exception" breakpoints. */ /* Virtual table for "catch exception" breakpoints. */

View file

@ -734,12 +734,18 @@ check_no_tracepoint_commands (struct command_line *commands)
/* Encapsulate tests for different types of tracepoints. */ /* 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 int
is_tracepoint (const struct breakpoint *b) is_tracepoint (const struct breakpoint *b)
{ {
return (b->type == bp_tracepoint return is_tracepoint_type (b->type);
|| b->type == bp_fast_tracepoint
|| b->type == bp_static_tracepoint);
} }
/* A helper function that validates that COMMANDS are valid for a /* A helper function that validates that COMMANDS are valid for a
@ -4849,12 +4855,17 @@ print_one_breakpoint_location (struct breakpoint *b,
do_cleanups (script_chain); do_cleanups (script_chain);
} }
if (!part_of_multiple && b->pass_count) if (is_tracepoint (b))
{ {
annotate_field (10); struct tracepoint *t = (struct tracepoint *) b;
ui_out_text (uiout, "\tpass count ");
ui_out_field_int (uiout, "pass", b->pass_count); if (!part_of_multiple && t->pass_count)
ui_out_text (uiout, " \n"); {
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) if (ui_out_is_mi_like_p (uiout) && !part_of_multiple)
@ -6170,6 +6181,7 @@ static void
print_recreate_catch_fork (struct breakpoint *b, struct ui_file *fp) print_recreate_catch_fork (struct breakpoint *b, struct ui_file *fp)
{ {
fprintf_unfiltered (fp, "catch fork"); fprintf_unfiltered (fp, "catch fork");
print_recreate_thread (b, fp);
} }
/* The breakpoint_ops structure to be used in fork catchpoints. */ /* The breakpoint_ops structure to be used in fork catchpoints. */
@ -6263,6 +6275,7 @@ static void
print_recreate_catch_vfork (struct breakpoint *b, struct ui_file *fp) print_recreate_catch_vfork (struct breakpoint *b, struct ui_file *fp)
{ {
fprintf_unfiltered (fp, "catch vfork"); fprintf_unfiltered (fp, "catch vfork");
print_recreate_thread (b, fp);
} }
/* The breakpoint_ops structure to be used in vfork catchpoints. */ /* The breakpoint_ops structure to be used in vfork catchpoints. */
@ -6579,6 +6592,7 @@ print_recreate_catch_syscall (struct breakpoint *b, struct ui_file *fp)
fprintf_unfiltered (fp, " %d", s.number); fprintf_unfiltered (fp, " %d", s.number);
} }
} }
print_recreate_thread (b, fp);
} }
/* The breakpoint_ops structure to be used in syscall catchpoints. */ /* The breakpoint_ops structure to be used in syscall catchpoints. */
@ -6741,6 +6755,7 @@ static void
print_recreate_catch_exec (struct breakpoint *b, struct ui_file *fp) print_recreate_catch_exec (struct breakpoint *b, struct ui_file *fp)
{ {
fprintf_unfiltered (fp, "catch exec"); fprintf_unfiltered (fp, "catch exec");
print_recreate_thread (b, fp);
} }
static struct breakpoint_ops catch_exec_breakpoint_ops; static struct breakpoint_ops catch_exec_breakpoint_ops;
@ -7073,15 +7088,14 @@ bp_loc_is_permanent (struct bp_location *loc)
as condition expression. */ as condition expression. */
static void static void
create_breakpoint_sal (struct gdbarch *gdbarch, init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
struct symtabs_and_lines sals, char *addr_string, struct symtabs_and_lines sals, char *addr_string,
char *cond_string, char *cond_string,
enum bptype type, enum bpdisp disposition, enum bptype type, enum bpdisp disposition,
int thread, int task, int ignore_count, int thread, int task, int ignore_count,
struct breakpoint_ops *ops, int from_tty, struct breakpoint_ops *ops, int from_tty,
int enabled, int internal, int display_canonical) int enabled, int internal, int display_canonical)
{ {
struct breakpoint *b = NULL;
int i; int i;
if (type == bp_hardware_breakpoint) if (type == bp_hardware_breakpoint)
@ -7115,8 +7129,7 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
if (i == 0) if (i == 0)
{ {
b = set_raw_breakpoint (gdbarch, sal, type, ops); init_raw_breakpoint (b, gdbarch, sal, type, ops);
set_breakpoint_number (internal, b);
b->thread = thread; b->thread = thread;
b->task = task; b->task = task;
@ -7128,6 +7141,7 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
if (type == bp_static_tracepoint) if (type == bp_static_tracepoint)
{ {
struct tracepoint *t = (struct tracepoint *) b;
struct static_tracepoint_marker marker; struct static_tracepoint_marker marker;
if (is_marker_spec (addr_string)) if (is_marker_spec (addr_string))
@ -7144,20 +7158,20 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
endp = skip_to_space (p); endp = skip_to_space (p);
marker_str = savestring (p, endp - 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 " printf_filtered (_("Probed static tracepoint "
"marker \"%s\"\n"), "marker \"%s\"\n"),
b->static_trace_marker_id); t->static_trace_marker_id);
} }
else if (target_static_tracepoint_marker_at (sal.pc, &marker)) 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); release_static_tracepoint_marker (&marker);
printf_filtered (_("Probed static tracepoint " printf_filtered (_("Probed static tracepoint "
"marker \"%s\"\n"), "marker \"%s\"\n"),
b->static_trace_marker_id); t->static_trace_marker_id);
} }
else else
warning (_("Couldn't determine the static " warning (_("Couldn't determine the static "
@ -7196,12 +7210,42 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
me. */ me. */
b->addr_string b->addr_string
= xstrprintf ("*%s", paddress (b->loc->gdbarch, b->loc->address)); = xstrprintf ("*%s", paddress (b->loc->gdbarch, b->loc->address));
}
/* Do not mention breakpoints with a negative number, but do static void
notify observers. */ create_breakpoint_sal (struct gdbarch *gdbarch,
if (!internal) struct symtabs_and_lines sals, char *addr_string,
mention (b); char *cond_string,
observer_notify_breakpoint_created (b); 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 /* Remove element at INDEX_TO_REMOVE from SAL, shifting other
@ -7802,7 +7846,7 @@ create_breakpoint (struct gdbarch *gdbarch,
for (i = 0; i < sals.nelts; ++i) for (i = 0; i < sals.nelts; ++i)
{ {
struct symtabs_and_lines expanded; struct symtabs_and_lines expanded;
struct breakpoint *tp; struct tracepoint *tp;
struct cleanup *old_chain; struct cleanup *old_chain;
expanded.nelts = 1; expanded.nelts = 1;
@ -7810,22 +7854,14 @@ create_breakpoint (struct gdbarch *gdbarch,
expanded.sals[0] = sals.sals[i]; expanded.sals[0] = sals.sals[i];
old_chain = make_cleanup (xfree, expanded.sals); old_chain = make_cleanup (xfree, expanded.sals);
create_breakpoint_sal (gdbarch, expanded, canonical.canonical[i], tp = XCNEW (struct tracepoint);
cond_string, type_wanted, init_breakpoint_sal (&tp->base, gdbarch, expanded,
tempflag ? disp_del : disp_donttouch, canonical.canonical[i],
thread, task, ignore_count, ops, cond_string, type_wanted,
from_tty, enabled, internal, tempflag ? disp_del : disp_donttouch,
canonical.special_display); thread, task, ignore_count, ops,
from_tty, enabled, internal,
do_cleanups (old_chain); canonical.special_display);
/* Get the tracepoint we just created. */
if (internal)
tp = get_breakpoint (internal_breakpoint_number);
else
tp = get_breakpoint (breakpoint_count);
gdb_assert (tp != NULL);
/* Given that its possible to have multiple markers with /* Given that its possible to have multiple markers with
the same string id, if the user is creating a static the same string id, if the user is creating a static
tracepoint by marker id ("strace -m MARKER_ID"), then tracepoint by marker id ("strace -m MARKER_ID"), then
@ -7833,6 +7869,10 @@ create_breakpoint (struct gdbarch *gdbarch,
try to match up which of the newly found markers try to match up which of the newly found markers
corresponds to this one */ corresponds to this one */
tp->static_trace_marker_id_idx = i; tp->static_trace_marker_id_idx = i;
install_breakpoint (internal, &tp->base);
do_cleanups (old_chain);
} }
} }
else else
@ -8202,6 +8242,7 @@ print_recreate_ranged_breakpoint (struct breakpoint *b, struct ui_file *fp)
{ {
fprintf_unfiltered (fp, "break-range %s, %s", b->addr_string, fprintf_unfiltered (fp, "break-range %s, %s", b->addr_string,
b->addr_string_range_end); b->addr_string_range_end);
print_recreate_thread (b, fp);
} }
/* The breakpoint_ops structure to be used in ranged breakpoints. */ /* The breakpoint_ops structure to be used in ranged breakpoints. */
@ -8755,6 +8796,7 @@ print_recreate_watchpoint (struct breakpoint *b, struct ui_file *fp)
} }
fprintf_unfiltered (fp, " %s", w->exp_string); fprintf_unfiltered (fp, " %s", w->exp_string);
print_recreate_thread (b, fp);
} }
/* The breakpoint_ops structure to be used in hardware watchpoints. */ /* The breakpoint_ops structure to be used in hardware watchpoints. */
@ -8932,6 +8974,7 @@ print_recreate_masked_watchpoint (struct breakpoint *b, struct ui_file *fp)
sprintf_vma (tmp, w->hw_wp_mask); sprintf_vma (tmp, w->hw_wp_mask);
fprintf_unfiltered (fp, " %s mask 0x%s", w->exp_string, tmp); 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. */ /* The breakpoint_ops structure to be used in masked hardware watchpoints. */
@ -9740,6 +9783,7 @@ print_recreate_exception_catchpoint (struct breakpoint *b,
bp_throw = strstr (b->addr_string, "throw") != NULL; bp_throw = strstr (b->addr_string, "throw") != NULL;
fprintf_unfiltered (fp, bp_temp ? "tcatch " : "catch "); fprintf_unfiltered (fp, bp_temp ? "tcatch " : "catch ");
fprintf_unfiltered (fp, bp_throw ? "throw" : "catch"); fprintf_unfiltered (fp, bp_throw ? "throw" : "catch");
print_recreate_thread (b, fp);
} }
static struct breakpoint_ops gnu_v3_exception_catchpoint_ops; static struct breakpoint_ops gnu_v3_exception_catchpoint_ops;
@ -11034,13 +11078,14 @@ static void
tracepoint_print_one_detail (const struct breakpoint *self, tracepoint_print_one_detail (const struct breakpoint *self,
struct ui_out *uiout) 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); gdb_assert (self->type == bp_static_tracepoint);
ui_out_text (uiout, "\tmarker id is "); ui_out_text (uiout, "\tmarker id is ");
ui_out_field_string (uiout, "static-tracepoint-marker-string-id", 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"); ui_out_text (uiout, "\n");
} }
} }
@ -11074,19 +11119,25 @@ tracepoint_print_mention (struct breakpoint *b)
} }
static void 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"); fprintf_unfiltered (fp, "ftrace");
if (tp->type == bp_static_tracepoint) if (self->type == bp_static_tracepoint)
fprintf_unfiltered (fp, "strace"); fprintf_unfiltered (fp, "strace");
else if (tp->type == bp_tracepoint) else if (self->type == bp_tracepoint)
fprintf_unfiltered (fp, "trace"); fprintf_unfiltered (fp, "trace");
else else
internal_error (__FILE__, __LINE__, 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; struct breakpoint_ops tracepoint_breakpoint_ops;
@ -11368,6 +11419,7 @@ ambiguous_names_p (struct bp_location *loc)
static struct symtab_and_line static struct symtab_and_line
update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal) update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
{ {
struct tracepoint *tp = (struct tracepoint *) b;
struct static_tracepoint_marker marker; struct static_tracepoint_marker marker;
CORE_ADDR pc; CORE_ADDR pc;
int i; int i;
@ -11378,13 +11430,13 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
if (target_static_tracepoint_marker_at (pc, &marker)) 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"), warning (_("static tracepoint %d changed probed marker from %s to %s"),
b->number, b->number,
b->static_trace_marker_id, marker.str_id); tp->static_trace_marker_id, marker.str_id);
xfree (b->static_trace_marker_id); xfree (tp->static_trace_marker_id);
b->static_trace_marker_id = xstrdup (marker.str_id); tp->static_trace_marker_id = xstrdup (marker.str_id);
release_static_tracepoint_marker (&marker); release_static_tracepoint_marker (&marker);
return sal; return sal;
@ -11395,12 +11447,12 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
if (!sal.explicit_pc if (!sal.explicit_pc
&& sal.line != 0 && sal.line != 0
&& sal.symtab != NULL && sal.symtab != NULL
&& b->static_trace_marker_id != NULL) && tp->static_trace_marker_id != NULL)
{ {
VEC(static_tracepoint_marker_p) *markers; VEC(static_tracepoint_marker_p) *markers;
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)) if (!VEC_empty(static_tracepoint_marker_p, markers))
{ {
@ -11410,12 +11462,12 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
marker = VEC_index (static_tracepoint_marker_p, markers, 0); marker = VEC_index (static_tracepoint_marker_p, markers, 0);
xfree (b->static_trace_marker_id); xfree (tp->static_trace_marker_id);
b->static_trace_marker_id = xstrdup (marker->str_id); tp->static_trace_marker_id = xstrdup (marker->str_id);
warning (_("marker for static tracepoint %d (%s) not " warning (_("marker for static tracepoint %d (%s) not "
"found at previous line number"), "found at previous line number"),
b->number, b->static_trace_marker_id); b->number, tp->static_trace_marker_id);
init_sal (&sal); init_sal (&sal);
@ -11630,14 +11682,16 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
{ {
if (marker_spec) if (marker_spec)
{ {
struct tracepoint *tp = (struct tracepoint *) b;
sals = decode_static_tracepoint_spec (&s); 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; sals.nelts = 1;
} }
else else
error (_("marker %s not found"), b->static_trace_marker_id); error (_("marker %s not found"), tp->static_trace_marker_id);
} }
else else
sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, NULL); sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, NULL);
@ -12587,11 +12641,11 @@ read_uploaded_action (void)
the target does not necessarily have all the information used when the target does not necessarily have all the information used when
the tracepoint was originally defined. */ the tracepoint was originally defined. */
struct breakpoint * struct tracepoint *
create_tracepoint_from_upload (struct uploaded_tp *utp) create_tracepoint_from_upload (struct uploaded_tp *utp)
{ {
char *addr_str, small_buf[100]; char *addr_str, small_buf[100];
struct breakpoint *tp; struct tracepoint *tp;
if (utp->at_string) if (utp->at_string)
addr_str = utp->at_string; addr_str = utp->at_string;
@ -12635,7 +12689,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
if (utp->pass > 0) 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); trace_pass_command (small_buf, 0);
} }
@ -12653,7 +12707,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
cmd_list = read_command_lines_1 (read_uploaded_action, 1, NULL, NULL); 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) else if (!VEC_empty (char_ptr, utp->actions)
|| !VEC_empty (char_ptr, utp->step_actions)) || !VEC_empty (char_ptr, utp->step_actions))
@ -12662,7 +12716,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
utp->number); utp->number);
return tp; return tp;
} }
/* Print information on tracepoint number TPNUM_EXP, or all if /* Print information on tracepoint number TPNUM_EXP, or all if
omitted. */ omitted. */
@ -12740,13 +12794,13 @@ delete_trace_command (char *arg, int from_tty)
/* Helper function for trace_pass_command. */ /* Helper function for trace_pass_command. */
static void 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; tp->pass_count = count;
observer_notify_tracepoint_modified (bp->number); observer_notify_tracepoint_modified (tp->base.number);
if (from_tty) if (from_tty)
printf_filtered (_("Setting tracepoint %d's passcount to %d\n"), printf_filtered (_("Setting tracepoint %d's passcount to %d\n"),
bp->number, count); tp->base.number, count);
} }
/* Set passcount for tracepoint. /* Set passcount for tracepoint.
@ -12758,7 +12812,7 @@ trace_pass_set_count (struct breakpoint *bp, int count, int from_tty)
static void static void
trace_pass_command (char *args, int from_tty) trace_pass_command (char *args, int from_tty)
{ {
struct breakpoint *t1; struct tracepoint *t1;
unsigned int count; unsigned int count;
if (args == 0 || *args == 0) if (args == 0 || *args == 0)
@ -12772,12 +12826,15 @@ trace_pass_command (char *args, int from_tty)
if (*args && strncasecmp (args, "all", 3) == 0) if (*args && strncasecmp (args, "all", 3) == 0)
{ {
struct breakpoint *b;
args += 3; /* Skip special argument "all". */ args += 3; /* Skip special argument "all". */
if (*args) if (*args)
error (_("Junk at end of arguments.")); error (_("Junk at end of arguments."));
ALL_TRACEPOINTS (t1) ALL_TRACEPOINTS (b)
{ {
t1 = (struct tracepoint *) b;
trace_pass_set_count (t1, count, from_tty); trace_pass_set_count (t1, count, from_tty);
} }
} }
@ -12801,14 +12858,14 @@ trace_pass_command (char *args, int from_tty)
} }
} }
struct breakpoint * struct tracepoint *
get_tracepoint (int num) get_tracepoint (int num)
{ {
struct breakpoint *t; struct breakpoint *t;
ALL_TRACEPOINTS (t) ALL_TRACEPOINTS (t)
if (t->number == num) if (t->number == num)
return t; return (struct tracepoint *) t;
return NULL; return NULL;
} }
@ -12817,14 +12874,18 @@ get_tracepoint (int num)
different from the tracepoint number after disconnecting and different from the tracepoint number after disconnecting and
reconnecting). */ reconnecting). */
struct breakpoint * struct tracepoint *
get_tracepoint_by_number_on_target (int num) get_tracepoint_by_number_on_target (int num)
{ {
struct breakpoint *t; struct breakpoint *b;
ALL_TRACEPOINTS (t) ALL_TRACEPOINTS (b)
if (t->number_on_target == num) {
return t; struct tracepoint *t = (struct tracepoint *) b;
if (t->number_on_target == num)
return t;
}
return NULL; return NULL;
} }
@ -12833,7 +12894,7 @@ get_tracepoint_by_number_on_target (int num)
If STATE is not NULL, use, get_number_or_range_state and ignore ARG. 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 If OPTIONAL_P is true, then if the argument is missing, the most
recent tracepoint (tracepoint_count) is returned. */ recent tracepoint (tracepoint_count) is returned. */
struct breakpoint * struct tracepoint *
get_tracepoint_by_number (char **arg, get_tracepoint_by_number (char **arg,
struct get_number_or_range_state *state, struct get_number_or_range_state *state,
int optional_p) int optional_p)
@ -12872,13 +12933,25 @@ get_tracepoint_by_number (char **arg,
ALL_TRACEPOINTS (t) ALL_TRACEPOINTS (t)
if (t->number == tpnum) if (t->number == tpnum)
{ {
return t; return (struct tracepoint *) t;
} }
printf_unfiltered ("No tracepoint number %d.\n", tpnum); printf_unfiltered ("No tracepoint number %d.\n", tpnum);
return NULL; 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 /* Save information on user settable breakpoints (watchpoints, etc) to
a new script file named FILENAME. If FILTER is non-NULL, call it 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 on each breakpoint and only include the ones for which it returns
@ -12949,14 +13022,6 @@ save_breakpoints (char *filename, int from_tty,
tp->ops->print_recreate (tp, fp); 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 /* Note, we can't rely on tp->number for anything, as we can't
assume the recreated breakpoint numbers will match. Use $bpnum assume the recreated breakpoint numbers will match. Use $bpnum
instead. */ instead. */
@ -12967,9 +13032,6 @@ save_breakpoints (char *filename, int from_tty,
if (tp->ignore_count) if (tp->ignore_count)
fprintf_unfiltered (fp, " ignore $bpnum %d\n", 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) if (tp->commands)
{ {
volatile struct gdb_exception ex; volatile struct gdb_exception ex;

View file

@ -482,6 +482,15 @@ struct breakpoint_ops
void (*print_recreate) (struct breakpoint *, struct ui_file *fp); 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 enum watchpoint_triggered
{ {
/* This watchpoint definitely did not trigger. */ /* This watchpoint definitely did not trigger. */
@ -610,29 +619,6 @@ struct breakpoint
the condition in. */ the condition in. */
int condition_not_parsed; 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 /* With a Python scripting enabled GDB, store a reference to the
Python object that has been associated with this breakpoint. Python object that has been associated with this breakpoint.
This is always NULL for a GDB that is not script enabled. It This is always NULL for a GDB that is not script enabled. It
@ -700,6 +686,38 @@ struct watchpoint
extern int is_watchpoint (const struct breakpoint *bpt); 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; typedef struct breakpoint *breakpoint_p;
DEF_VEC_P(breakpoint_p); DEF_VEC_P(breakpoint_p);
@ -1301,12 +1319,12 @@ extern int catch_syscall_enabled (void);
extern int catching_syscall_number (int syscall_number); extern int catching_syscall_number (int syscall_number);
/* Return a tracepoint with the given number if found. */ /* 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. */ /* Find a tracepoint by parsing a number in the supplied string. */
extern struct breakpoint * extern struct tracepoint *
get_tracepoint_by_number (char **arg, get_tracepoint_by_number (char **arg,
struct get_number_or_range_state *state, struct get_number_or_range_state *state,
int optional_p); int optional_p);

View file

@ -186,7 +186,7 @@ mi_cmd_break_passcount (char *command, char **argv, int argc)
{ {
int n; int n;
int p; int p;
struct breakpoint *t; struct tracepoint *t;
if (argc != 2) if (argc != 2)
error (_("Usage: tracepoint-number passcount")); error (_("Usage: tracepoint-number passcount"));

View file

@ -9751,7 +9751,7 @@ remote_download_command_source (int num, ULONGEST addr,
} }
static void static void
remote_download_tracepoint (struct breakpoint *t) remote_download_tracepoint (struct breakpoint *b)
{ {
struct bp_location *loc; struct bp_location *loc;
CORE_ADDR tpaddr; CORE_ADDR tpaddr;
@ -9764,13 +9764,14 @@ remote_download_tracepoint (struct breakpoint *t)
struct agent_expr *aexpr; struct agent_expr *aexpr;
struct cleanup *aexpr_chain = NULL; struct cleanup *aexpr_chain = NULL;
char *pkt; char *pkt;
struct tracepoint *t = (struct tracepoint *) b;
/* Iterate over all the tracepoint locations. It's up to the target to /* Iterate over all the tracepoint locations. It's up to the target to
notice multiple tracepoint packets with the same number but different notice multiple tracepoint packets with the same number but different
addresses, and treat them as multiple locations. */ 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, old_chain = make_cleanup (free_actions_list_cleanup_wrapper,
tdp_actions); tdp_actions);
(void) make_cleanup (free_actions_list_cleanup_wrapper, (void) make_cleanup (free_actions_list_cleanup_wrapper,
@ -9778,14 +9779,14 @@ remote_download_tracepoint (struct breakpoint *t)
tpaddr = loc->address; tpaddr = loc->address;
sprintf_vma (addrbuf, tpaddr); 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 */ addrbuf, /* address */
(t->enable_state == bp_enabled ? 'E' : 'D'), (b->enable_state == bp_enabled ? 'E' : 'D'),
t->step_count, t->pass_count); t->step_count, t->pass_count);
/* Fast tracepoints are mostly handled by the target, but we can /* Fast tracepoints are mostly handled by the target, but we can
tell the target how big of an instruction block should be moved tell the target how big of an instruction block should be moved
around. */ around. */
if (t->type == bp_fast_tracepoint) if (b->type == bp_fast_tracepoint)
{ {
/* Only test for support at download time; we may not know /* Only test for support at download time; we may not know
target capabilities at definition time. */ target capabilities at definition time. */
@ -9808,9 +9809,9 @@ remote_download_tracepoint (struct breakpoint *t)
tracepoints, so don't take lack of support as a reason to tracepoints, so don't take lack of support as a reason to
give up on the trace run. */ give up on the trace run. */
warning (_("Target does not support fast tracepoints, " 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 /* Only test for support at download time; we may not know
target capabilities at definition time. */ target capabilities at definition time. */
@ -9848,10 +9849,10 @@ remote_download_tracepoint (struct breakpoint *t)
} }
else else
warning (_("Target does not support conditional tracepoints, " 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, "-"); strcat (buf, "-");
putpkt (buf); putpkt (buf);
remote_get_noisy_reply (&target_buf, &target_buf_size); remote_get_noisy_reply (&target_buf, &target_buf_size);
@ -9865,7 +9866,7 @@ remote_download_tracepoint (struct breakpoint *t)
{ {
QUIT; /* Allow user to bail out with ^C. */ QUIT; /* Allow user to bail out with ^C. */
sprintf (buf, "QTDP:-%x:%s:%s%c", sprintf (buf, "QTDP:-%x:%s:%s%c",
t->number, addrbuf, /* address */ b->number, addrbuf, /* address */
tdp_actions[ndx], tdp_actions[ndx],
((tdp_actions[ndx + 1] || stepping_actions) ((tdp_actions[ndx + 1] || stepping_actions)
? '-' : 0)); ? '-' : 0));
@ -9882,7 +9883,7 @@ remote_download_tracepoint (struct breakpoint *t)
{ {
QUIT; /* Allow user to bail out with ^C. */ QUIT; /* Allow user to bail out with ^C. */
sprintf (buf, "QTDP:-%x:%s:%s%s%s", sprintf (buf, "QTDP:-%x:%s:%s%s%s",
t->number, addrbuf, /* address */ b->number, addrbuf, /* address */
((ndx == 0) ? "S" : ""), ((ndx == 0) ? "S" : ""),
stepping_actions[ndx], stepping_actions[ndx],
(stepping_actions[ndx + 1] ? "-" : "")); (stepping_actions[ndx + 1] ? "-" : ""));
@ -9897,11 +9898,11 @@ remote_download_tracepoint (struct breakpoint *t)
if (remote_protocol_packets[PACKET_TracepointSource].support if (remote_protocol_packets[PACKET_TracepointSource].support
== PACKET_ENABLE) == PACKET_ENABLE)
{ {
if (t->addr_string) if (b->addr_string)
{ {
strcpy (buf, "QTDPsrc:"); strcpy (buf, "QTDPsrc:");
encode_source_string (t->number, loc->address, encode_source_string (b->number, loc->address,
"at", t->addr_string, buf + strlen (buf), "at", b->addr_string, buf + strlen (buf),
2048 - strlen (buf)); 2048 - strlen (buf));
putpkt (buf); putpkt (buf);
@ -9909,19 +9910,19 @@ remote_download_tracepoint (struct breakpoint *t)
if (strcmp (target_buf, "OK")) if (strcmp (target_buf, "OK"))
warning (_("Target does not support source download.")); warning (_("Target does not support source download."));
} }
if (t->cond_string) if (b->cond_string)
{ {
strcpy (buf, "QTDPsrc:"); strcpy (buf, "QTDPsrc:");
encode_source_string (t->number, loc->address, encode_source_string (b->number, loc->address,
"cond", t->cond_string, buf + strlen (buf), "cond", b->cond_string, buf + strlen (buf),
2048 - strlen (buf)); 2048 - strlen (buf));
putpkt (buf); putpkt (buf);
remote_get_noisy_reply (&target_buf, &target_buf_size); remote_get_noisy_reply (&target_buf, &target_buf_size);
if (strcmp (target_buf, "OK")) if (strcmp (target_buf, "OK"))
warning (_("Target does not support source download.")); warning (_("Target does not support source download."));
} }
remote_download_command_source (t->number, loc->address, remote_download_command_source (b->number, loc->address,
breakpoint_commands (t)); breakpoint_commands (b));
} }
do_cleanups (old_chain); do_cleanups (old_chain);

View file

@ -577,7 +577,7 @@ teval_pseudocommand (char *args, int from_tty)
static void static void
trace_actions_command (char *args, int from_tty) trace_actions_command (char *args, int from_tty)
{ {
struct breakpoint *t; struct tracepoint *t;
struct command_line *l; struct command_line *l;
t = get_tracepoint_by_number (&args, NULL, 1); t = get_tracepoint_by_number (&args, NULL, 1);
@ -585,13 +585,13 @@ trace_actions_command (char *args, int from_tty)
{ {
char *tmpbuf = char *tmpbuf =
xstrprintf ("Enter actions for tracepoint %d, one per line.", xstrprintf ("Enter actions for tracepoint %d, one per line.",
t->number); t->base.number);
struct cleanup *cleanups = make_cleanup (xfree, tmpbuf); struct cleanup *cleanups = make_cleanup (xfree, tmpbuf);
l = read_command_lines (tmpbuf, from_tty, 1, l = read_command_lines (tmpbuf, from_tty, 1,
check_tracepoint_command, t); check_tracepoint_command, t);
do_cleanups (cleanups); do_cleanups (cleanups);
breakpoint_set_commands (t, l); breakpoint_set_commands (&t->base, l);
} }
/* else just return */ /* else just return */
} }
@ -625,7 +625,7 @@ report_agent_reqs_errors (struct agent_expr *aexpr)
/* worker function */ /* worker function */
void void
validate_actionline (char **line, struct breakpoint *t) validate_actionline (char **line, struct breakpoint *b)
{ {
struct cmd_list_element *c; struct cmd_list_element *c;
struct expression *exp = NULL; struct expression *exp = NULL;
@ -633,6 +633,7 @@ validate_actionline (char **line, struct breakpoint *t)
char *p, *tmp_p; char *p, *tmp_p;
struct bp_location *loc; struct bp_location *loc;
struct agent_expr *aexpr; struct agent_expr *aexpr;
struct tracepoint *t = (struct tracepoint *) b;
/* If EOF is typed, *line is NULL. */ /* If EOF is typed, *line is NULL. */
if (*line == NULL) if (*line == NULL)
@ -673,7 +674,7 @@ validate_actionline (char **line, struct breakpoint *t)
/* else fall thru, treat p as an expression and parse it! */ /* else fall thru, treat p as an expression and parse it! */
} }
tmp_p = p; tmp_p = p;
for (loc = t->loc; loc; loc = loc->next) for (loc = t->base.loc; loc; loc = loc->next)
{ {
p = tmp_p; p = tmp_p;
exp = parse_exp_1 (&p, block_for_pc (loc->address), 1); exp = parse_exp_1 (&p, block_for_pc (loc->address), 1);
@ -725,7 +726,7 @@ validate_actionline (char **line, struct breakpoint *t)
p++; p++;
tmp_p = p; tmp_p = p;
for (loc = t->loc; loc; loc = loc->next) for (loc = t->base.loc; loc; loc = loc->next)
{ {
p = tmp_p; p = tmp_p;
/* Only expressions are allowed for this action. */ /* Only expressions are allowed for this action. */
@ -1559,7 +1560,7 @@ start_tracing (void)
{ {
VEC(breakpoint_p) *tp_vec = NULL; VEC(breakpoint_p) *tp_vec = NULL;
int ix; int ix;
struct breakpoint *t; struct breakpoint *b;
struct trace_state_variable *tsv; struct trace_state_variable *tsv;
int any_enabled = 0, num_to_download = 0; int any_enabled = 0, num_to_download = 0;
@ -1572,18 +1573,20 @@ start_tracing (void)
error (_("No tracepoints defined, not starting trace")); 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; any_enabled = 1;
if ((t->type == bp_fast_tracepoint if ((b->type == bp_fast_tracepoint
? may_insert_fast_tracepoints ? may_insert_fast_tracepoints
: may_insert_tracepoints)) : may_insert_tracepoints))
++num_to_download; ++num_to_download;
else else
warning (_("May not insert %stracepoints, skipping tracepoint %d"), 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) if (!any_enabled)
@ -1607,16 +1610,18 @@ start_tracing (void)
target_trace_init (); 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_fast_tracepoints
: !may_insert_tracepoints)) : !may_insert_tracepoints))
continue; continue;
t->number_on_target = 0; t->number_on_target = 0;
target_download_tracepoint (t); target_download_tracepoint (b);
t->number_on_target = t->number; t->number_on_target = b->number;
} }
VEC_free (breakpoint_p, tp_vec); VEC_free (breakpoint_p, tp_vec);
@ -1944,7 +1949,7 @@ tfind_1 (enum trace_find_type type, int num,
{ {
int target_frameno = -1, target_tracept = -1; int target_frameno = -1, target_tracept = -1;
struct frame_id old_frame_id = null_frame_id; 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 /* 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 succeeding. In particular, if we're trying to get a first trace
@ -2009,7 +2014,7 @@ tfind_1 (enum trace_find_type type, int num,
target_dcache_invalidate (); target_dcache_invalidate ();
set_traceframe_num (target_frameno); set_traceframe_num (target_frameno);
clear_traceframe_info (); clear_traceframe_info ();
set_tracepoint_num (tp ? tp->number : target_tracept); set_tracepoint_num (tp ? tp->base.number : target_tracept);
if (target_frameno == -1) if (target_frameno == -1)
set_traceframe_context (NULL); set_traceframe_context (NULL);
else else
@ -2160,7 +2165,7 @@ static void
trace_find_tracepoint_command (char *args, int from_tty) trace_find_tracepoint_command (char *args, int from_tty)
{ {
int tdp; int tdp;
struct breakpoint *tp; struct tracepoint *tp;
if (current_trace_status ()->running && !current_trace_status ()->from_file) if (current_trace_status ()->running && !current_trace_status ()->from_file)
error (_("May not look at trace frames while trace is running.")); error (_("May not look at trace frames while trace is running."));
@ -2578,7 +2583,7 @@ static void
trace_dump_command (char *args, int from_tty) trace_dump_command (char *args, int from_tty)
{ {
struct regcache *regcache; struct regcache *regcache;
struct breakpoint *t; struct tracepoint *t;
int stepping_frame = 0; int stepping_frame = 0;
struct bp_location *loc; struct bp_location *loc;
char *line, *default_collect_line = NULL; char *line, *default_collect_line = NULL;
@ -2611,11 +2616,11 @@ trace_dump_command (char *args, int from_tty)
frame. (FIXME this is not reliable, should record each frame's frame. (FIXME this is not reliable, should record each frame's
type.) */ type.) */
stepping_frame = 1; 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)) if (loc->address == regcache_read_pc (regcache))
stepping_frame = 0; stepping_frame = 0;
actions = breakpoint_commands (t); actions = breakpoint_commands (&t->base);
/* If there is a default-collect list, make up a collect command, /* If there is a default-collect list, make up a collect command,
prepend to the tracepoint's commands, and pass the whole mess to prepend to the tracepoint's commands, and pass the whole mess to
@ -2626,7 +2631,7 @@ trace_dump_command (char *args, int from_tty)
default_collect_line = xstrprintf ("collect %s", default_collect); default_collect_line = xstrprintf ("collect %s", default_collect);
old_chain = make_cleanup (xfree, default_collect_line); old_chain = make_cleanup (xfree, default_collect_line);
line = default_collect_line; line = default_collect_line;
validate_actionline (&line, t); validate_actionline (&line, &t->base);
default_collect_action = xmalloc (sizeof (struct command_line)); default_collect_action = xmalloc (sizeof (struct command_line));
make_cleanup (xfree, default_collect_action); make_cleanup (xfree, default_collect_action);
default_collect_action->next = actions; default_collect_action->next = actions;
@ -3088,24 +3093,26 @@ free_uploaded_tsvs (struct uploaded_tsv **utsvp)
toggle that freely, and may have done so in anticipation of the toggle that freely, and may have done so in anticipation of the
next trace run. */ next trace run. */
struct breakpoint * struct tracepoint *
find_matching_tracepoint (struct uploaded_tp *utp) find_matching_tracepoint (struct uploaded_tp *utp)
{ {
VEC(breakpoint_p) *tp_vec = all_tracepoints (); VEC(breakpoint_p) *tp_vec = all_tracepoints ();
int ix; int ix;
struct breakpoint *t; struct breakpoint *b;
struct bp_location *loc; 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->step_count == utp->step
&& t->pass_count == utp->pass && t->pass_count == utp->pass
/* FIXME also test conditionals and actions. */ /* FIXME also test conditionals and actions. */
) )
{ {
/* Scan the locations for an address match. */ /* 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) if (loc->address == utp->addr)
return t; return t;
@ -3123,7 +3130,7 @@ void
merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps) merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
{ {
struct uploaded_tp *utp; struct uploaded_tp *utp;
struct breakpoint *t; struct tracepoint *t;
/* Look for GDB tracepoints that match up with our uploaded versions. */ /* Look for GDB tracepoints that match up with our uploaded versions. */
for (utp = *uploaded_tps; utp; utp = utp->next) for (utp = *uploaded_tps; utp; utp = utp->next)
@ -3132,7 +3139,7 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
if (t) if (t)
printf_filtered (_("Assuming tracepoint %d is same " printf_filtered (_("Assuming tracepoint %d is same "
"as target's tracepoint %d at %s.\n"), "as target's tracepoint %d at %s.\n"),
t->number, utp->number, t->base.number, utp->number,
paddress (get_current_arch (), utp->addr)); paddress (get_current_arch (), utp->addr));
else else
{ {
@ -3140,7 +3147,7 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
if (t) if (t)
printf_filtered (_("Created tracepoint %d for " printf_filtered (_("Created tracepoint %d for "
"target's tracepoint %d at %s.\n"), "target's tracepoint %d at %s.\n"),
t->number, utp->number, t->base.number, utp->number,
paddress (get_current_arch (), utp->addr)); paddress (get_current_arch (), utp->addr));
else else
printf_filtered (_("Failed to create tracepoint for target's " printf_filtered (_("Failed to create tracepoint for target's "
@ -3754,7 +3761,7 @@ tfile_get_traceframe_address (off_t tframe_offset)
{ {
ULONGEST addr = 0; ULONGEST addr = 0;
short tpnum; short tpnum;
struct breakpoint *tp; struct tracepoint *tp;
off_t saved_offset = cur_offset; off_t saved_offset = cur_offset;
/* FIXME dig pc out of collected registers. */ /* FIXME dig pc out of collected registers. */
@ -3768,8 +3775,8 @@ tfile_get_traceframe_address (off_t tframe_offset)
tp = get_tracepoint_by_number_on_target (tpnum); tp = get_tracepoint_by_number_on_target (tpnum);
/* FIXME this is a poor heuristic if multiple locations. */ /* FIXME this is a poor heuristic if multiple locations. */
if (tp && tp->loc) if (tp && tp->base.loc)
addr = tp->loc->address; addr = tp->base.loc->address;
/* Restore our seek position. */ /* Restore our seek position. */
cur_offset = saved_offset; cur_offset = saved_offset;
@ -3811,7 +3818,7 @@ tfile_trace_find (enum trace_find_type type, int num,
short tpnum; short tpnum;
int tfnum = 0, found = 0; int tfnum = 0, found = 0;
unsigned int data_size; unsigned int data_size;
struct breakpoint *tp; struct tracepoint *tp;
off_t offset, tframe_offset; off_t offset, tframe_offset;
ULONGEST tfaddr; ULONGEST tfaddr;
@ -4040,16 +4047,16 @@ tfile_fetch_registers (struct target_ops *ops,
pc_regno = gdbarch_pc_regnum (gdbarch); pc_regno = gdbarch_pc_regnum (gdbarch);
if (pc_regno >= 0 && (regno == -1 || regno == pc_regno)) 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... */ /* 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 " warning (_("Tracepoint %d has multiple "
"locations, cannot infer $pc"), "locations, cannot infer $pc"),
tp->number); tp->base.number);
return; return;
} }
/* ... or does while-stepping. */ /* ... or does while-stepping. */
@ -4057,13 +4064,13 @@ tfile_fetch_registers (struct target_ops *ops,
{ {
warning (_("Tracepoint %d does while-stepping, " warning (_("Tracepoint %d does while-stepping, "
"cannot infer $pc"), "cannot infer $pc"),
tp->number); tp->base.number);
return; return;
} }
store_unsigned_integer (regs, register_size (gdbarch, pc_regno), store_unsigned_integer (regs, register_size (gdbarch, pc_regno),
gdbarch_byte_order (gdbarch), gdbarch_byte_order (gdbarch),
tp->loc->address); tp->base.loc->address);
regcache_raw_supply (regcache, pc_regno, regs); regcache_raw_supply (regcache, pc_regno, regs);
} }
} }

View file

@ -232,7 +232,7 @@ extern void parse_tsv_definition (char *line, struct uploaded_tsv **utsvp);
extern struct uploaded_tp *get_uploaded_tp (int num, ULONGEST addr, extern struct uploaded_tp *get_uploaded_tp (int num, ULONGEST addr,
struct uploaded_tp **utpp); 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_tracepoints (struct uploaded_tp **utpp);
extern void merge_uploaded_trace_state_variables (struct uploaded_tsv **utsvp); extern void merge_uploaded_trace_state_variables (struct uploaded_tsv **utsvp);