/* Tracing functionality for remote targets in custom GDB protocol
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of GDB.
return NULL;
}
-void
+static void
delete_trace_state_variable (const char *name)
{
struct trace_state_variable *tsv;
/* The 'tvariable' command collects a name and optional expression to
evaluate into an initial value. */
-void
+static void
trace_variable_command (char *args, int from_tty)
{
struct expression *expr;
do_cleanups (old_chain);
}
-void
+static void
delete_trace_variable_command (char *args, int from_tty)
{
int ix;
}
/* Render all actions into gdb protocol. */
-/*static*/ void
+
+void
encode_actions (struct breakpoint *t, struct bp_location *tloc,
char ***tdp_actions, char ***stepping_actions)
{
struct tracepoint *t = (struct tracepoint *) b;
struct bp_location *loc;
+ /* Clear `inserted' flag. */
+ for (loc = b->loc; loc; loc = loc->next)
+ loc->inserted = 0;
+
if ((b->type == bp_fast_tracepoint
? !may_insert_fast_tracepoints
: !may_insert_tracepoints))
/* Reporting a run time is more readable than two long numbers. */
printf_filtered (_("Trace started at %ld.%06ld secs, stopped %ld.%06ld secs later.\n"),
- ts->start_time / 1000000, ts->start_time % 1000000,
- run_time / 1000000, run_time % 1000000);
+ (long int) ts->start_time / 1000000,
+ (long int) ts->start_time % 1000000,
+ (long int) run_time / 1000000,
+ (long int) run_time % 1000000);
}
else
printf_filtered (_("Trace started at %ld.%06ld secs.\n"),
- ts->start_time / 1000000, ts->start_time % 1000000);
+ (long int) ts->start_time / 1000000,
+ (long int) ts->start_time % 1000000);
}
else if (ts->stop_time)
printf_filtered (_("Trace stopped at %ld.%06ld secs.\n"),
- ts->stop_time / 1000000, ts->stop_time % 1000000);
+ (long int) ts->stop_time / 1000000,
+ (long int) ts->stop_time % 1000000);
/* Now report any per-tracepoint status available. */
tp_vec = all_tracepoints ();
char buf[100];
xsnprintf (buf, sizeof buf, "%ld.%06ld",
- ts->start_time / 1000000, ts->start_time % 1000000);
+ (long int) ts->start_time / 1000000,
+ (long int) ts->start_time % 1000000);
ui_out_field_string (uiout, "start-time", buf);
xsnprintf (buf, sizeof buf, "%ld.%06ld",
- ts->stop_time / 1000000, ts->stop_time % 1000000);
+ (long int) ts->stop_time / 1000000,
+ (long int) ts->stop_time % 1000000);
ui_out_field_string (uiout, "stop-time", buf);
}
}
}
else
{
- sals = decode_line_spec (args, 1);
+ sals = decode_line_spec (args, DECODE_LINE_FUNFIRSTLINE);
sal = sals.sals[0];
}
struct symbol *sym;
struct minimal_symbol *msym;
struct block *block;
- char *symname, *save_args = args;
+ const char *symname;
+ char *save_args = args;
struct dict_iterator iter;
int j, count = 0;
struct gdbarch *gdbarch;
error (_("requires an argument (function, "
"line or *addr) to define a scope"));
- sals = decode_line_1 (&args, 1, NULL, 0, NULL);
+ sals = decode_line_1 (&args, DECODE_LINE_FUNFIRSTLINE, NULL, 0);
if (sals.nelts == 0)
return; /* Presumably decode_line_1 has already warned. */
/* Given a number and address, return an uploaded tracepoint with that
number, creating if necessary. */
-struct uploaded_tsv *
+static struct uploaded_tsv *
get_uploaded_tsv (int num, struct uploaded_tsv **utsvp)
{
struct uploaded_tsv *utsv;
toggle that freely, and may have done so in anticipation of the
next trace run. Return the location of matched tracepoint. */
-struct bp_location *
+static struct bp_location *
find_matching_tracepoint_location (struct uploaded_tp *utp)
{
VEC(breakpoint_p) *tp_vec = all_tracepoints ();
/* Trace state variables don't have much to identify them beyond their
name, so just use that to detect matches. */
-struct trace_state_variable *
+static struct trace_state_variable *
find_matching_tsv (struct uploaded_tsv *utsv)
{
if (!utsv->name)
return find_trace_state_variable (utsv->name);
}
-struct trace_state_variable *
+static struct trace_state_variable *
create_tsv_from_upload (struct uploaded_tsv *utsv)
{
const char *namebase;
- char buf[20];
+ char *buf;
int try_num = 0;
struct trace_state_variable *tsv;
+ struct cleanup *old_chain;
if (utsv->name)
{
namebase = utsv->name;
- sprintf (buf, "%s", namebase);
+ buf = xstrprintf ("%s", namebase);
}
else
{
namebase = "__tsv";
- sprintf (buf, "%s_%d", namebase, try_num++);
+ buf = xstrprintf ("%s_%d", namebase, try_num++);
}
/* Fish for a name that is not in use. */
/* (should check against all internal vars?) */
while (find_trace_state_variable (buf))
- sprintf (buf, "%s_%d", namebase, try_num++);
+ {
+ xfree (buf);
+ buf = xstrprintf ("%s_%d", namebase, try_num++);
+ }
+
+ old_chain = make_cleanup (xfree, buf);
/* We have an available name, create the variable. */
tsv = create_trace_state_variable (buf);
tsv->initial_value = utsv->initial_value;
tsv->builtin = utsv->builtin;
+ do_cleanups (old_chain);
+
return tsv;
}
tfile_ops.to_magic = OPS_MAGIC;
}
+void
+free_current_marker (void *arg)
+{
+ struct static_tracepoint_marker **marker_p = arg;
+
+ if (*marker_p != NULL)
+ {
+ release_static_tracepoint_marker (*marker_p);
+ xfree (*marker_p);
+ }
+ else
+ *marker_p = NULL;
+}
+
/* Given a line of text defining a static tracepoint marker, parse it
into a "static tracepoint marker" object. Throws an error is
parsing fails. If PP is non-null, it points to one past the end of
struct ui_out *uiout = current_uiout;
int i;
+ /* We don't have to check target_can_use_agent and agent's capability on
+ static tracepoint here, in order to be compatible with older GDBserver.
+ We don't check USE_AGENT is true or not, because static tracepoints
+ don't work without in-process agent, so we don't bother users to type
+ `set agent on' when to use static tracepoint. */
+
old_chain
= make_cleanup_ui_out_table_begin_end (uiout, 5, -1,
"StaticTracepointMarkersTable");
This is where we avoid re-fetching the object from the target if we
already have it cached. */
-struct traceframe_info *
+static struct traceframe_info *
get_traceframe_info (void)
{
if (traceframe_info == NULL)