mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-30 23:40:24 +00:00
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:
parent
3a5c3e2258
commit
d9b3f62eb2
@ -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>
|
||||
|
||||
* breakpoint.h (struct breakpoint): Move ops as first field. Move
|
||||
|
@ -11262,6 +11262,7 @@ print_recreate_exception (enum exception_catchpoint_kind ex,
|
||||
default:
|
||||
internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
|
||||
}
|
||||
print_recreate_thread (b, fp);
|
||||
}
|
||||
|
||||
/* Virtual table for "catch exception" breakpoints. */
|
||||
|
254
gdb/breakpoint.c
254
gdb/breakpoint.c
@ -734,14 +734,20 @@ check_no_tracepoint_commands (struct command_line *commands)
|
||||
|
||||
/* 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. */
|
||||
@ -4849,12 +4855,17 @@ print_one_breakpoint_location (struct breakpoint *b,
|
||||
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)
|
||||
@ -6170,6 +6181,7 @@ static void
|
||||
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. */
|
||||
@ -6263,6 +6275,7 @@ static void
|
||||
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. */
|
||||
@ -6579,6 +6592,7 @@ print_recreate_catch_syscall (struct breakpoint *b, struct ui_file *fp)
|
||||
fprintf_unfiltered (fp, " %d", s.number);
|
||||
}
|
||||
}
|
||||
print_recreate_thread (b, fp);
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
fprintf_unfiltered (fp, "catch exec");
|
||||
print_recreate_thread (b, fp);
|
||||
}
|
||||
|
||||
static struct breakpoint_ops catch_exec_breakpoint_ops;
|
||||
@ -7073,15 +7088,14 @@ bp_loc_is_permanent (struct bp_location *loc)
|
||||
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)
|
||||
@ -7115,8 +7129,7 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
|
||||
|
||||
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;
|
||||
|
||||
@ -7128,6 +7141,7 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
|
||||
|
||||
if (type == bp_static_tracepoint)
|
||||
{
|
||||
struct tracepoint *t = (struct tracepoint *) b;
|
||||
struct static_tracepoint_marker marker;
|
||||
|
||||
if (is_marker_spec (addr_string))
|
||||
@ -7144,20 +7158,20 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
|
||||
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 "
|
||||
@ -7196,12 +7210,42 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
|
||||
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
|
||||
@ -7802,7 +7846,7 @@ create_breakpoint (struct gdbarch *gdbarch,
|
||||
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;
|
||||
@ -7810,22 +7854,14 @@ create_breakpoint (struct gdbarch *gdbarch,
|
||||
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
|
||||
@ -7833,6 +7869,10 @@ create_breakpoint (struct gdbarch *gdbarch,
|
||||
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
|
||||
@ -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,
|
||||
b->addr_string_range_end);
|
||||
print_recreate_thread (b, fp);
|
||||
}
|
||||
|
||||
/* 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);
|
||||
print_recreate_thread (b, fp);
|
||||
}
|
||||
|
||||
/* 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);
|
||||
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. */
|
||||
@ -9740,6 +9783,7 @@ print_recreate_exception_catchpoint (struct breakpoint *b,
|
||||
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;
|
||||
@ -11034,13 +11078,14 @@ static void
|
||||
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");
|
||||
}
|
||||
}
|
||||
@ -11074,19 +11119,25 @@ tracepoint_print_mention (struct breakpoint *b)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -11368,6 +11419,7 @@ ambiguous_names_p (struct bp_location *loc)
|
||||
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;
|
||||
@ -11378,13 +11430,13 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
|
||||
|
||||
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;
|
||||
@ -11395,12 +11447,12 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line 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))
|
||||
{
|
||||
@ -11410,12 +11462,12 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
|
||||
|
||||
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);
|
||||
|
||||
@ -11630,14 +11682,16 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
|
||||
{
|
||||
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);
|
||||
@ -12587,11 +12641,11 @@ read_uploaded_action (void)
|
||||
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;
|
||||
@ -12635,7 +12689,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
|
||||
|
||||
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);
|
||||
}
|
||||
@ -12653,7 +12707,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
|
||||
|
||||
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))
|
||||
@ -12662,7 +12716,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
|
||||
utp->number);
|
||||
|
||||
return tp;
|
||||
}
|
||||
}
|
||||
|
||||
/* Print information on tracepoint number TPNUM_EXP, or all if
|
||||
omitted. */
|
||||
@ -12740,13 +12794,13 @@ delete_trace_command (char *arg, int from_tty)
|
||||
/* 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.
|
||||
@ -12758,7 +12812,7 @@ trace_pass_set_count (struct breakpoint *bp, int count, int from_tty)
|
||||
static void
|
||||
trace_pass_command (char *args, int from_tty)
|
||||
{
|
||||
struct breakpoint *t1;
|
||||
struct tracepoint *t1;
|
||||
unsigned int count;
|
||||
|
||||
if (args == 0 || *args == 0)
|
||||
@ -12772,12 +12826,15 @@ trace_pass_command (char *args, int from_tty)
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -12801,14 +12858,14 @@ trace_pass_command (char *args, int 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;
|
||||
}
|
||||
@ -12817,14 +12874,18 @@ get_tracepoint (int num)
|
||||
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;
|
||||
}
|
||||
@ -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 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)
|
||||
@ -12872,13 +12933,25 @@ get_tracepoint_by_number (char **arg,
|
||||
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
|
||||
@ -12949,14 +13022,6 @@ save_breakpoints (char *filename, int from_tty,
|
||||
|
||||
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. */
|
||||
@ -12967,9 +13032,6 @@ save_breakpoints (char *filename, int from_tty,
|
||||
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;
|
||||
|
@ -482,6 +482,15 @@ struct breakpoint_ops
|
||||
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. */
|
||||
@ -610,29 +619,6 @@ struct breakpoint
|
||||
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
|
||||
@ -700,6 +686,38 @@ struct watchpoint
|
||||
|
||||
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);
|
||||
|
||||
@ -1301,12 +1319,12 @@ extern int catch_syscall_enabled (void);
|
||||
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);
|
||||
|
@ -186,7 +186,7 @@ mi_cmd_break_passcount (char *command, char **argv, int argc)
|
||||
{
|
||||
int n;
|
||||
int p;
|
||||
struct breakpoint *t;
|
||||
struct tracepoint *t;
|
||||
|
||||
if (argc != 2)
|
||||
error (_("Usage: tracepoint-number passcount"));
|
||||
|
41
gdb/remote.c
41
gdb/remote.c
@ -9751,7 +9751,7 @@ remote_download_command_source (int num, ULONGEST addr,
|
||||
}
|
||||
|
||||
static void
|
||||
remote_download_tracepoint (struct breakpoint *t)
|
||||
remote_download_tracepoint (struct breakpoint *b)
|
||||
{
|
||||
struct bp_location *loc;
|
||||
CORE_ADDR tpaddr;
|
||||
@ -9764,13 +9764,14 @@ remote_download_tracepoint (struct breakpoint *t)
|
||||
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,
|
||||
@ -9778,14 +9779,14 @@ remote_download_tracepoint (struct breakpoint *t)
|
||||
|
||||
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. */
|
||||
@ -9808,9 +9809,9 @@ remote_download_tracepoint (struct breakpoint *t)
|
||||
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. */
|
||||
@ -9848,10 +9849,10 @@ remote_download_tracepoint (struct breakpoint *t)
|
||||
}
|
||||
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);
|
||||
@ -9865,7 +9866,7 @@ remote_download_tracepoint (struct breakpoint *t)
|
||||
{
|
||||
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));
|
||||
@ -9882,7 +9883,7 @@ remote_download_tracepoint (struct breakpoint *t)
|
||||
{
|
||||
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] ? "-" : ""));
|
||||
@ -9897,11 +9898,11 @@ remote_download_tracepoint (struct breakpoint *t)
|
||||
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);
|
||||
@ -9909,19 +9910,19 @@ remote_download_tracepoint (struct breakpoint *t)
|
||||
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);
|
||||
|
@ -577,7 +577,7 @@ teval_pseudocommand (char *args, int from_tty)
|
||||
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);
|
||||
@ -585,13 +585,13 @@ trace_actions_command (char *args, int from_tty)
|
||||
{
|
||||
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 */
|
||||
}
|
||||
@ -625,7 +625,7 @@ report_agent_reqs_errors (struct agent_expr *aexpr)
|
||||
|
||||
/* 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;
|
||||
@ -633,6 +633,7 @@ validate_actionline (char **line, struct breakpoint *t)
|
||||
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)
|
||||
@ -673,7 +674,7 @@ validate_actionline (char **line, struct breakpoint *t)
|
||||
/* 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);
|
||||
@ -725,7 +726,7 @@ validate_actionline (char **line, struct breakpoint *t)
|
||||
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. */
|
||||
@ -1559,7 +1560,7 @@ start_tracing (void)
|
||||
{
|
||||
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;
|
||||
|
||||
@ -1572,18 +1573,20 @@ start_tracing (void)
|
||||
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)
|
||||
@ -1607,16 +1610,18 @@ start_tracing (void)
|
||||
|
||||
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);
|
||||
|
||||
@ -1944,7 +1949,7 @@ tfind_1 (enum trace_find_type type, int num,
|
||||
{
|
||||
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
|
||||
@ -2009,7 +2014,7 @@ tfind_1 (enum trace_find_type type, int num,
|
||||
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
|
||||
@ -2160,7 +2165,7 @@ static void
|
||||
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."));
|
||||
@ -2578,7 +2583,7 @@ static void
|
||||
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;
|
||||
@ -2611,11 +2616,11 @@ trace_dump_command (char *args, int from_tty)
|
||||
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
|
||||
@ -2626,7 +2631,7 @@ trace_dump_command (char *args, int from_tty)
|
||||
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;
|
||||
@ -3088,24 +3093,26 @@ free_uploaded_tsvs (struct uploaded_tsv **utsvp)
|
||||
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;
|
||||
@ -3123,7 +3130,7 @@ void
|
||||
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)
|
||||
@ -3132,7 +3139,7 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
|
||||
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
|
||||
{
|
||||
@ -3140,7 +3147,7 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
|
||||
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 "
|
||||
@ -3754,7 +3761,7 @@ tfile_get_traceframe_address (off_t tframe_offset)
|
||||
{
|
||||
ULONGEST addr = 0;
|
||||
short tpnum;
|
||||
struct breakpoint *tp;
|
||||
struct tracepoint *tp;
|
||||
off_t saved_offset = cur_offset;
|
||||
|
||||
/* 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);
|
||||
/* 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;
|
||||
@ -3811,7 +3818,7 @@ tfile_trace_find (enum trace_find_type type, int num,
|
||||
short tpnum;
|
||||
int tfnum = 0, found = 0;
|
||||
unsigned int data_size;
|
||||
struct breakpoint *tp;
|
||||
struct tracepoint *tp;
|
||||
off_t offset, tframe_offset;
|
||||
ULONGEST tfaddr;
|
||||
|
||||
@ -4040,16 +4047,16 @@ tfile_fetch_registers (struct target_ops *ops,
|
||||
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. */
|
||||
@ -4057,13 +4064,13 @@ tfile_fetch_registers (struct target_ops *ops,
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user