Fix typo in gdb.python/py-objfile.exp
[deliverable/binutils-gdb.git] / gdb / tracefile-tfile.c
index 37dc69191c2056253e8ff21dd832bc4c4929ca5a..9747036b871421bc7d722337a1e13651e6f47dca 100644 (file)
@@ -1,6 +1,6 @@
 /* Trace file TFILE format support in GDB.
 
-   Copyright (C) 1997-2014 Free Software Foundation, Inc.
+   Copyright (C) 1997-2015 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -376,9 +376,8 @@ tfile_read (gdb_byte *readbuf, int size)
 }
 
 static void
-tfile_open (char *filename, int from_tty)
+tfile_open (const char *arg, int from_tty)
 {
-  volatile struct gdb_exception ex;
   char *temp;
   struct cleanup *old_chain;
   int flags;
@@ -390,12 +389,13 @@ tfile_open (char *filename, int from_tty)
   struct trace_status *ts;
   struct uploaded_tp *uploaded_tps = NULL;
   struct uploaded_tsv *uploaded_tsvs = NULL;
+  char *filename;
 
   target_preopen (from_tty);
-  if (!filename)
+  if (!arg)
     error (_("No trace file specified."));
 
-  filename = tilde_expand (filename);
+  filename = tilde_expand (arg);
   if (!IS_ABSOLUTE_PATH(filename))
     {
       temp = concat (current_directory, "/", filename, (char *) NULL);
@@ -425,7 +425,7 @@ tfile_open (char *filename, int from_tty)
 
   bytes += TRACE_HEADER_SIZE;
   if (!(header[0] == 0x7f
-       && (strncmp (header + 1, "TRACE0\n", 7) == 0)))
+       && (startswith (header + 1, "TRACE0\n"))))
     error (_("File is not a valid trace file."));
 
   push_target (&tfile_ops);
@@ -442,7 +442,7 @@ tfile_open (char *filename, int from_tty)
   ts->disconnected_tracing = 0;
   ts->circular_buffer = 0;
 
-  TRY_CATCH (ex, RETURN_MASK_ALL)
+  TRY
     {
       /* Read through a section of newline-terminated lines that
         define things like tracepoints.  */
@@ -475,12 +475,13 @@ tfile_open (char *filename, int from_tty)
       if (trace_regblock_size == 0)
        error (_("No register block size recorded in trace file"));
     }
-  if (ex.reason < 0)
+  CATCH (ex, RETURN_MASK_ALL)
     {
       /* Remove the partially set up target.  */
       unpush_target (&tfile_ops);
       throw_exception (ex);
     }
+  END_CATCH
 
   inferior_appeared (current_inferior (), TFILE_PID);
   inferior_ptid = pid_to_ptid (TFILE_PID);
@@ -509,22 +510,22 @@ tfile_interp_line (char *line, struct uploaded_tp **utpp,
 {
   char *p = line;
 
-  if (strncmp (p, "R ", strlen ("R ")) == 0)
+  if (startswith (p, "R "))
     {
       p += strlen ("R ");
       trace_regblock_size = strtol (p, &p, 16);
     }
-  else if (strncmp (p, "status ", strlen ("status ")) == 0)
+  else if (startswith (p, "status "))
     {
       p += strlen ("status ");
       parse_trace_status (p, current_trace_status ());
     }
-  else if (strncmp (p, "tp ", strlen ("tp ")) == 0)
+  else if (startswith (p, "tp "))
     {
       p += strlen ("tp ");
       parse_tracepoint_definition (p, utpp);
     }
-  else if (strncmp (p, "tsv ", strlen ("tsv ")) == 0)
+  else if (startswith (p, "tsv "))
     {
       p += strlen ("tsv ");
       parse_tsv_definition (p, utsvp);
This page took 0.026842 seconds and 4 git commands to generate.