X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Ftracepoint.c;h=af553a325ca61eb82f3aa36f2c20724900ba5701;hb=17d8546e6067d0133f19275d1ccc25cf93cfc7bc;hp=38a3491911883d0f883d95e959346dde09fd8c6f;hpb=08be3fe322244a3684d007d9282e225fc215f5d8;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 38a3491911..af553a325c 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-2014 Free Software Foundation, Inc. + Copyright (C) 1997-2015 Free Software Foundation, Inc. This file is part of GDB. @@ -55,6 +55,7 @@ #include "filestuff.h" #include "rsp-low.h" #include "tracefile.h" +#include "location.h" /* readline include files */ #include "readline/readline.h" @@ -2712,14 +2713,22 @@ scope_info (char *args, int from_tty) int j, count = 0; struct gdbarch *gdbarch; int regno; + struct event_location *location; + struct cleanup *back_to; if (args == 0 || *args == 0) error (_("requires an argument (function, " "line or *addr) to define a scope")); - sals = decode_line_1 (&args, DECODE_LINE_FUNFIRSTLINE, NULL, 0); + location = string_to_event_location (&args, current_language); + back_to = make_cleanup_delete_event_location (location); + sals = decode_line_1 (location, DECODE_LINE_FUNFIRSTLINE, NULL, 0); if (sals.nelts == 0) - return; /* Presumably decode_line_1 has already warned. */ + { + /* Presumably decode_line_1 has already warned. */ + do_cleanups (back_to); + return; + } /* Resolve line numbers to PC. */ resolve_sal_pc (&sals.sals[0]); @@ -2856,6 +2865,7 @@ scope_info (char *args, int from_tty) if (count <= 0) printf_filtered ("Scope for %s contains no locals or arguments.\n", save_args); + do_cleanups (back_to); } /* Helper for trace_dump_command. Dump the action list starting at @@ -3078,7 +3088,7 @@ trace_dump_command (char *args, int from_tty) extern int encode_source_string (int tpnum, ULONGEST addr, - char *srctype, char *src, char *buf, int buf_size) + char *srctype, const char *src, char *buf, int buf_size) { if (80 + strlen (srctype) > buf_size) error (_("Buffer too small for source encoding")); @@ -3830,11 +3840,11 @@ parse_tracepoint_definition (char *line, struct uploaded_tp **utpp) end = hex2bin (p, (gdb_byte *) buf, strlen (p) / 2); buf[end] = '\0'; - if (strncmp (srctype, "at:", strlen ("at:")) == 0) + if (startswith (srctype, "at:")) utp->at_string = xstrdup (buf); - else if (strncmp (srctype, "cond:", strlen ("cond:")) == 0) + else if (startswith (srctype, "cond:")) utp->cond_string = xstrdup (buf); - else if (strncmp (srctype, "cmd:", strlen ("cmd:")) == 0) + else if (startswith (srctype, "cmd:")) VEC_safe_push (char_ptr, utp->cmd_strings, xstrdup (buf)); } else if (piece == 'V')