/* Tracing functionality for remote targets in custom GDB protocol
- Copyright (C) 1997-2018 Free Software Foundation, Inc.
+ Copyright (C) 1997-2019 Free Software Foundation, Inc.
This file is part of GDB.
#include "cli/cli-utils.h"
#include "probe.h"
#include "ctf.h"
-#include "filestuff.h"
-#include "rsp-low.h"
+#include "common/filestuff.h"
+#include "common/rsp-low.h"
#include "tracefile.h"
#include "location.h"
#include <algorithm>
if (args == 0 || *args == 0)
{ /* XXX FIXME: what should default behavior be? */
- printf_filtered ("Usage: tfind range <startaddr>,<endaddr>\n");
+ printf_filtered ("Usage: tfind range STARTADDR, ENDADDR\n");
return;
}
if (args == 0 || *args == 0)
{ /* XXX FIXME: what should default behavior be? */
- printf_filtered ("Usage: tfind outside <startaddr>,<endaddr>\n");
+ printf_filtered ("Usage: tfind outside STARTADDR, ENDADDR\n");
return;
}
if (b->type == utp->type
&& t->step_count == utp->step
&& t->pass_count == utp->pass
- && cond_string_is_same (t->cond_string, utp->cond_string)
+ && cond_string_is_same (t->cond_string,
+ utp->cond_string.get ())
/* FIXME also test actions. */
)
{
merge_uploaded_trace_state_variables (struct uploaded_tsv **uploaded_tsvs)
{
struct uploaded_tsv *utsv;
- struct trace_state_variable *tsv;
int highest;
/* Most likely some numbers will have to be reassigned as part of
for (utsv = *uploaded_tsvs; utsv; utsv = utsv->next)
{
- tsv = find_matching_tsv (utsv);
+ struct trace_state_variable *tsv = find_matching_tsv (utsv);
if (tsv)
{
if (info_verbose)
int enabled, end;
enum bptype type;
const char *srctype;
- char *cond, *buf;
+ char *buf;
struct uploaded_tp *utp = NULL;
p = line;
p++; /* skip a colon */
if (piece == 'T')
{
+ gdb::unique_xmalloc_ptr<char[]> cond;
+
enabled = (*p++ == 'E');
p++; /* skip a colon */
p = unpack_varlen_hex (p, &step);
p++; /* skip a colon */
p = unpack_varlen_hex (p, &pass);
type = bp_tracepoint;
- cond = NULL;
/* Thumb through optional fields. */
while (*p == ':')
{
p++;
p = unpack_varlen_hex (p, &xlen);
p++; /* skip a comma */
- cond = (char *) xmalloc (2 * xlen + 1);
- strncpy (cond, p, 2 * xlen);
+ cond.reset ((char *) xmalloc (2 * xlen + 1));
+ strncpy (&cond[0], p, 2 * xlen);
cond[2 * xlen] = '\0';
p += 2 * xlen;
}
utp->enabled = enabled;
utp->step = step;
utp->pass = pass;
- utp->cond = cond;
+ utp->cond = std::move (cond);
}
else if (piece == 'A')
{
utp = get_uploaded_tp (num, addr, utpp);
- utp->actions.push_back (xstrdup (p));
+ utp->actions.emplace_back (xstrdup (p));
}
else if (piece == 'S')
{
utp = get_uploaded_tp (num, addr, utpp);
- utp->step_actions.push_back (xstrdup (p));
+ utp->step_actions.emplace_back (xstrdup (p));
}
else if (piece == 'Z')
{
buf[end] = '\0';
if (startswith (srctype, "at:"))
- utp->at_string = xstrdup (buf);
+ utp->at_string.reset (xstrdup (buf));
else if (startswith (srctype, "cond:"))
- utp->cond_string = xstrdup (buf);
+ utp->cond_string.reset (xstrdup (buf));
else if (startswith (srctype, "cmd:"))
- utp->cmd_strings.push_back (xstrdup (buf));
+ utp->cmd_strings.emplace_back (xstrdup (buf));
}
else if (piece == 'V')
{
if (sym)
{
uiout->text ("in ");
- uiout->field_string ("func",
- SYMBOL_PRINT_NAME (sym));
+ uiout->field_string ("func", SYMBOL_PRINT_NAME (sym),
+ ui_out_style_kind::FUNCTION);
uiout->wrap_hint (wrap_indent);
uiout->text (" at ");
}
if (sal.symtab != NULL)
{
uiout->field_string ("file",
- symtab_to_filename_for_display (sal.symtab));
+ symtab_to_filename_for_display (sal.symtab),
+ ui_out_style_kind::FILE);
uiout->text (":");
if (uiout->is_mi_like_p ())
int ix;
{
- ui_out_emit_tuple tuple_emitter (uiout, "tracepoints-at");
+ ui_out_emit_tuple inner_tuple_emitter (uiout, "tracepoints-at");
uiout->text (extra_field_indent);
uiout->text (_("Probed by static tracepoints: "));
NULL
};
+/* See tracepoint.h. */
+cmd_list_element *while_stepping_cmd_element = nullptr;
+
/* module initialization */
void
_initialize_tracepoint (void)
add_cmd ("outside", class_trace, tfind_outside_command, _("\
Select a trace frame whose PC is outside the given range (exclusive).\n\
-Usage: tfind outside addr1, addr2"),
+Usage: tfind outside ADDR1, ADDR2"),
&tfindlist);
add_cmd ("range", class_trace, tfind_range_command, _("\
Select a trace frame whose PC is in the given range (inclusive).\n\
-Usage: tfind range addr1,addr2"),
+Usage: tfind range ADDR1, ADDR2"),
&tfindlist);
add_cmd ("line", class_trace, tfind_line_command, _("\
such a list.\n\n\
Note: the \"end\" command cannot be used at the gdb prompt."));
- add_com ("while-stepping", class_trace, while_stepping_pseudocommand, _("\
+ while_stepping_cmd_element = add_com ("while-stepping", class_trace,
+ while_stepping_pseudocommand, _("\
Specify single-stepping behavior at a tracepoint.\n\
Argument is number of instructions to trace in single-step mode\n\
following the tracepoint. This command is normally followed by\n\