diff options
Diffstat (limited to 'gdb/tracepoint.c')
-rw-r--r-- | gdb/tracepoint.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 06cf9ca..3997d21 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -130,7 +130,7 @@ static traceframe_info_up current_traceframe_info; static struct cmd_list_element *tfindlist; /* List of expressions to collect by default at each tracepoint hit. */ -char *default_collect; +std::string default_collect; static bool disconnected_tracing; @@ -146,15 +146,15 @@ static int trace_buffer_size = -1; /* Textual notes applying to the current and/or future trace runs. */ -static char *trace_user = NULL; +static std::string trace_user; /* Textual notes applying to the current and/or future trace runs. */ -static char *trace_notes = NULL; +static std::string trace_notes; /* Textual notes applying to the stopping of a trace. */ -static char *trace_stop_notes = NULL; +static std::string trace_stop_notes; /* support routines */ @@ -1688,10 +1688,11 @@ start_tracing (const char *notes) target_set_trace_buffer_size (trace_buffer_size); if (!notes) - notes = trace_notes; - ret = target_set_trace_notes (trace_user, notes, NULL); + notes = trace_notes.c_str (); - if (!ret && (trace_user || notes)) + ret = target_set_trace_notes (trace_user.c_str (), notes, NULL); + + if (!ret && (!trace_user.empty () || notes)) warning (_("Target does not support trace user/notes, info ignored")); /* Now insert traps and begin collecting data. */ @@ -1764,7 +1765,8 @@ stop_tracing (const char *note) } if (!note) - note = trace_stop_notes; + note = trace_stop_notes.c_str (); + ret = target_set_trace_notes (NULL, NULL, note); if (!ret && note) @@ -2804,10 +2806,10 @@ all_tracepoint_actions (struct breakpoint *t) validation is per-tracepoint (local var "xyz" might be valid for one tracepoint and not another, etc), we make up the action on the fly, and don't cache it. */ - if (*default_collect) + if (!default_collect.empty ()) { gdb::unique_xmalloc_ptr<char> default_collect_line - (xstrprintf ("collect %s", default_collect)); + (xstrprintf ("collect %s", default_collect.c_str ())); validate_actionline (default_collect_line.get (), t); actions.reset (new struct command_line (simple_control, @@ -2896,7 +2898,7 @@ set_trace_user (const char *args, int from_tty, { int ret; - ret = target_set_trace_notes (trace_user, NULL, NULL); + ret = target_set_trace_notes (trace_user.c_str (), NULL, NULL); if (!ret) warning (_("Target does not support trace notes, user ignored")); @@ -2908,7 +2910,7 @@ set_trace_notes (const char *args, int from_tty, { int ret; - ret = target_set_trace_notes (NULL, trace_notes, NULL); + ret = target_set_trace_notes (NULL, trace_notes.c_str (), NULL); if (!ret) warning (_("Target does not support trace notes, note ignored")); @@ -2920,7 +2922,7 @@ set_trace_stop_notes (const char *args, int from_tty, { int ret; - ret = target_set_trace_notes (NULL, NULL, trace_stop_notes); + ret = target_set_trace_notes (NULL, NULL, trace_stop_notes.c_str ()); if (!ret) warning (_("Target does not support trace notes, stop note ignored")); @@ -4137,7 +4139,6 @@ Tracepoint actions may include collecting of specified data,\n\ single-stepping, or enabling/disabling other tracepoints,\n\ depending on target's capabilities.")); - default_collect = xstrdup (""); add_setshow_string_cmd ("default-collect", class_trace, &default_collect, _("\ Set the list of expressions to collect by default."), _("\ |