X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Ftracepoint.c;h=075bd4c977b75a1463530bcccc47e3e15487c34b;hb=381befeedf9316991d47f4213850545a96593d23;hp=6d964c154bf069fb5dcceb20e3f74fbd757985a9;hpb=8588b356927dabd582d1d67f87a161027cb2aed1;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 6d964c154b..075bd4c977 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -1,6 +1,6 @@ /* 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. @@ -52,8 +52,8 @@ #include "cli/cli-utils.h" #include "probe.h" #include "ctf.h" -#include "filestuff.h" -#include "rsp-low.h" +#include "gdbsupport/filestuff.h" +#include "gdbsupport/rsp-low.h" #include "tracefile.h" #include "location.h" #include @@ -2000,8 +2000,8 @@ trace_status_mi (int on_stop) { uiout->field_string ("stop-reason", stop_reason); if (stopping_tracepoint != -1) - uiout->field_int ("stopping-tracepoint", - stopping_tracepoint); + uiout->field_signed ("stopping-tracepoint", + stopping_tracepoint); if (ts->stop_reason == tracepoint_error) uiout->field_string ("error-description", ts->stop_desc); @@ -2010,16 +2010,16 @@ trace_status_mi (int on_stop) } if (ts->traceframe_count != -1) - uiout->field_int ("frames", ts->traceframe_count); + uiout->field_signed ("frames", ts->traceframe_count); if (ts->traceframes_created != -1) - uiout->field_int ("frames-created", ts->traceframes_created); + uiout->field_signed ("frames-created", ts->traceframes_created); if (ts->buffer_size != -1) - uiout->field_int ("buffer-size", ts->buffer_size); + uiout->field_signed ("buffer-size", ts->buffer_size); if (ts->buffer_free != -1) - uiout->field_int ("buffer-free", ts->buffer_free); + uiout->field_signed ("buffer-free", ts->buffer_free); - uiout->field_int ("disconnected", ts->disconnected_tracing); - uiout->field_int ("circular", ts->circular_buffer); + uiout->field_signed ("disconnected", ts->disconnected_tracing); + uiout->field_signed ("circular", ts->circular_buffer); uiout->field_string ("user-name", ts->user_name); uiout->field_string ("notes", ts->notes); @@ -2183,8 +2183,8 @@ tfind_1 (enum trace_find_type type, int num, if (uiout->is_mi_like_p ()) { uiout->field_string ("found", "1"); - uiout->field_int ("tracepoint", tracepoint_number); - uiout->field_int ("traceframe", traceframe_number); + uiout->field_signed ("tracepoint", tracepoint_number); + uiout->field_signed ("traceframe", traceframe_number); } else { @@ -2636,8 +2636,11 @@ info_scope_command (const char *args_in, int from_tty) } } if (SYMBOL_TYPE (sym)) - printf_filtered (", length %d.\n", - TYPE_LENGTH (check_typedef (SYMBOL_TYPE (sym)))); + { + struct type *t = check_typedef (SYMBOL_TYPE (sym)); + + printf_filtered (", length %s.\n", pulongest (TYPE_LENGTH (t))); + } } if (BLOCK_FUNCTION (block)) break; @@ -3083,7 +3086,8 @@ find_matching_tracepoint_location (struct uploaded_tp *utp) 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. */ ) { @@ -3224,7 +3228,6 @@ void 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 @@ -3234,7 +3237,7 @@ merge_uploaded_trace_state_variables (struct uploaded_tsv **uploaded_tsvs) 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) @@ -3463,7 +3466,7 @@ parse_tracepoint_definition (const char *line, struct uploaded_tp **utpp) int enabled, end; enum bptype type; const char *srctype; - char *cond, *buf; + char *buf; struct uploaded_tp *utp = NULL; p = line; @@ -3476,13 +3479,14 @@ parse_tracepoint_definition (const char *line, struct uploaded_tp **utpp) p++; /* skip a colon */ if (piece == 'T') { + gdb::unique_xmalloc_ptr 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 == ':') { @@ -3503,8 +3507,8 @@ parse_tracepoint_definition (const char *line, struct uploaded_tp **utpp) 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; } @@ -3517,17 +3521,17 @@ parse_tracepoint_definition (const char *line, struct uploaded_tp **utpp) 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') { @@ -3547,11 +3551,11 @@ parse_tracepoint_definition (const char *line, struct uploaded_tp **utpp) 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') { @@ -3661,7 +3665,7 @@ print_one_static_tracepoint_marker (int count, /* A counter field to help readability. This is not a stable identifier! */ - uiout->field_int ("count", count); + uiout->field_signed ("count", count); uiout->field_string ("marker-id", marker.str_id.c_str ()); @@ -3685,8 +3689,8 @@ print_one_static_tracepoint_marker (int count, 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 "); } @@ -3696,7 +3700,8 @@ print_one_static_tracepoint_marker (int count, 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 ()) @@ -3708,7 +3713,7 @@ print_one_static_tracepoint_marker (int count, else uiout->field_skip ("fullname"); - uiout->field_int ("line", sal.line); + uiout->field_signed ("line", sal.line); } else { @@ -3727,7 +3732,7 @@ print_one_static_tracepoint_marker (int count, 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: ")); @@ -3736,12 +3741,12 @@ print_one_static_tracepoint_marker (int count, if (ix > 0) uiout->text (", "); uiout->text ("#"); - uiout->field_int ("tracepoint-id", tracepoints[ix]->number); + uiout->field_signed ("tracepoint-id", tracepoints[ix]->number); } } if (uiout->is_mi_like_p ()) - uiout->field_int ("number-of-tracepoints", tracepoints.size ()); + uiout->field_signed ("number-of-tracepoints", tracepoints.size ()); else uiout->text ("\n"); } @@ -4019,13 +4024,11 @@ If no arguments are supplied, delete all variables."), &deletelist); /* FIXME add a trace variable completer. */ add_info ("tvariables", info_tvariables_command, _("\ -Status of trace state variables and their values.\n\ -")); +Status of trace state variables and their values.")); add_info ("static-tracepoint-markers", info_static_tracepoint_markers_command, _("\ -List target static tracepoints markers.\n\ -")); +List target static tracepoints markers.")); add_prefix_cmd ("tfind", class_trace, tfind_command, _("\ Select a trace frame;\n\