gdb/
[deliverable/binutils-gdb.git] / gdb / tracepoint.c
index 4389f12048dc71686f59786680552a4c293aafd5..119ab221d50c6ec796b01fa7e596f2dcc4e1a235 100644 (file)
@@ -70,8 +70,6 @@
 extern int hex2bin (const char *hex, gdb_byte *bin, int count);
 extern int bin2hex (const gdb_byte *bin, char *hex, int count);
 
-extern void stop_tracing ();
-
 /* Maximum length of an agent aexpression.
    This accounts for the fact that packets are limited to 400 bytes
    (which includes everything -- including the checksum), and assumes
@@ -218,7 +216,7 @@ char *stop_reason_names[] = {
 };
 
 struct trace_status *
-current_trace_status ()
+current_trace_status (void)
 {
   return &trace_status;
 }
@@ -236,7 +234,7 @@ free_traceframe_info (struct traceframe_info *info)
     }
 }
 
-/* Free and and clear the traceframe info cache of the current
+/* Free and clear the traceframe info cache of the current
    traceframe.  */
 
 static void
@@ -270,27 +268,25 @@ set_traceframe_context (struct frame_info *trace_frame)
 {
   CORE_ADDR trace_pc;
 
-  if (trace_frame == NULL)     /* Cease debugging any trace buffers.  */
+  /* Save as globals for internal use.  */
+  if (trace_frame != NULL
+      && get_frame_pc_if_available (trace_frame, &trace_pc))
+    {
+      traceframe_sal = find_pc_line (trace_pc, 0);
+      traceframe_fun = find_pc_function (trace_pc);
+
+      /* Save linenumber as "$trace_line", a debugger variable visible to
+        users.  */
+      set_internalvar_integer (lookup_internalvar ("trace_line"),
+                              traceframe_sal.line);
+    }
+  else
     {
-      traceframe_fun = 0;
-      traceframe_sal.pc = traceframe_sal.line = 0;
-      traceframe_sal.symtab = NULL;
-      clear_internalvar (lookup_internalvar ("trace_func"));
-      clear_internalvar (lookup_internalvar ("trace_file"));
+      init_sal (&traceframe_sal);
+      traceframe_fun = NULL;
       set_internalvar_integer (lookup_internalvar ("trace_line"), -1);
-      return;
     }
 
-  /* Save as globals for internal use.  */
-  trace_pc = get_frame_pc (trace_frame);
-  traceframe_sal = find_pc_line (trace_pc, 0);
-  traceframe_fun = find_pc_function (trace_pc);
-
-  /* Save linenumber as "$trace_line", a debugger variable visible to
-     users.  */
-  set_internalvar_integer (lookup_internalvar ("trace_line"),
-                          traceframe_sal.line);
-
   /* Save func name as "$trace_func", a debugger variable visible to
      users.  */
   if (traceframe_fun == NULL
@@ -581,7 +577,7 @@ trace_actions_command (char *args, int from_tty)
   struct breakpoint *t;
   struct command_line *l;
 
-  t = get_tracepoint_by_number (&args, 0, 1);
+  t = get_tracepoint_by_number (&args, NULL, 1);
   if (t)
     {
       char *tmpbuf =
@@ -846,7 +842,8 @@ memrange_sortmerge (struct collection_list *memranges)
          if (memranges->list[a].type == memranges->list[b].type
              && memranges->list[b].start <= memranges->list[a].end)
            {
-             memranges->list[a].end = memranges->list[b].end;
+             if (memranges->list[b].end > memranges->list[a].end)
+               memranges->list[a].end = memranges->list[b].end;
              continue;         /* next b, same a */
            }
          a++;                  /* next a */
@@ -1123,7 +1120,7 @@ add_local_symbols (struct collection_list *collect,
       block = block_for_pc (pc);
       if (block == NULL)
        {
-         warning (_("Can't collect args; no symbol table info available.\n"));
+         warning (_("Can't collect args; no symbol table info available."));
          return;
        }
 
@@ -2326,7 +2323,7 @@ scope_info (char *args, int from_tty)
   struct symbol *sym;
   struct minimal_symbol *msym;
   struct block *block;
-  char **canonical, *symname, *save_args = args;
+  char *symname, *save_args = args;
   struct dict_iterator iter;
   int j, count = 0;
   struct gdbarch *gdbarch;
@@ -2336,7 +2333,7 @@ scope_info (char *args, int from_tty)
     error (_("requires an argument (function, "
             "line or *addr) to define a scope"));
 
-  sals = decode_line_1 (&args, 1, NULL, 0, &canonical, NULL);
+  sals = decode_line_1 (&args, 1, NULL, 0, NULL);
   if (sals.nelts == 0)
     return;            /* Presumably decode_line_1 has already warned.  */
 
@@ -3189,7 +3186,7 @@ create_tsv_from_upload (struct uploaded_tsv *utsv)
     sprintf (buf, "%s_%d", namebase, try_num++);
 
   /* We have an available name, create the variable.  */
-  tsv = create_trace_state_variable (xstrdup (buf));
+  tsv = create_trace_state_variable (buf);
   tsv->initial_value = utsv->initial_value;
   tsv->builtin = utsv->builtin;
 
This page took 0.031927 seconds and 4 git commands to generate.