Remove unnecessary null_cleanup
[deliverable/binutils-gdb.git] / gdb / location.c
index e43ebf19feb0c3882098db0d16c16b76dce69e27..8dce21ada12b3f8cb4145d1af96e29efe378bda2 100644 (file)
@@ -498,9 +498,8 @@ explicit_location_lex_one (const char **inp,
        {
          /* Special case: C++ operator,.  */
          if (language->la_language == language_cplus
-             && strncmp (*inp, "operator", 8)
-             && (*inp)[9] == ',')
-           (*inp) += 9;
+             && strncmp (*inp, "operator", 8) == 0)
+           (*inp) += 8;
          ++(*inp);
        }
     }
@@ -522,11 +521,13 @@ string_to_explicit_location (const char **argp,
   struct event_location *location;
 
   /* It is assumed that input beginning with '-' and a non-digit
-     character is an explicit location.  */
+     character is an explicit location.  "-p" is reserved, though,
+     for probe locations.  */
   if (argp == NULL
-      || *argp == '\0'
+      || *argp == NULL
       || *argp[0] != '-'
-      || !isalpha ((*argp)[1]))
+      || !isalpha ((*argp)[1])
+      || ((*argp)[0] == '-' && (*argp)[1] == 'p'))
     return NULL;
 
   location = new_explicit_location (NULL);
@@ -634,51 +635,36 @@ string_to_explicit_location (const char **argp,
 /* See description in location.h.  */
 
 struct event_location *
-string_to_event_location (char **stringp,
-                         const struct language_defn *language)
+string_to_event_location_basic (char **stringp,
+                               const struct language_defn *language)
 {
   struct event_location *location;
+  const char *cs;
 
-  /* First, check if the string is an address location.  */
-  if (*stringp != NULL && **stringp == '*')
+  /* Try the input as a probe spec.  */
+  cs = *stringp;
+  if (cs != NULL && probe_linespec_to_ops (&cs) != NULL)
     {
-      const char *arg, *orig;
-      CORE_ADDR addr;
-
-      orig = arg = *stringp;
-      addr = linespec_expression_to_pc (&arg);
-      location = new_address_location (addr, orig, arg - orig);
-      *stringp += arg - orig;
+      location = new_probe_location (*stringp);
+      *stringp += strlen (*stringp);
     }
   else
     {
-      const char *cs;
-
-      /* Next, try the input as a probe spec.  */
-      cs = *stringp;
-      if (cs != NULL && probe_linespec_to_ops (&cs) != NULL)
-       {
-         location = new_probe_location (*stringp);
-         *stringp += strlen (*stringp);
-       }
-      else
+      /* Try an address location.  */
+      if (*stringp != NULL && **stringp == '*')
        {
          const char *arg, *orig;
+         CORE_ADDR addr;
 
-         /* Next, try an explicit location.  */
          orig = arg = *stringp;
-         location = string_to_explicit_location (&arg, language, 0);
-         if (location != NULL)
-           {
-             /* It was a valid explicit location.  Advance STRINGP to
-                the end of input.  */
-             *stringp += arg - orig;
-           }
-         else
-           {
-             /* Everything else is a linespec.  */
-             location = new_linespec_location (stringp);
-           }
+         addr = linespec_expression_to_pc (&arg);
+         location = new_address_location (addr, orig, arg - orig);
+         *stringp += arg - orig;
+       }
+      else
+       {
+         /* Everything else is a linespec.  */
+         location = new_linespec_location (stringp);
        }
     }
 
@@ -687,6 +673,34 @@ string_to_event_location (char **stringp,
 
 /* See description in location.h.  */
 
+struct event_location *
+string_to_event_location (char **stringp,
+                         const struct language_defn *language)
+{
+  struct event_location *location;
+  const char *arg, *orig;
+
+  /* Try an explicit location.  */
+  orig = arg = *stringp;
+  location = string_to_explicit_location (&arg, language, 0);
+  if (location != NULL)
+    {
+      /* It was a valid explicit location.  Advance STRINGP to
+        the end of input.  */
+      *stringp += arg - orig;
+    }
+  else
+    {
+      /* Everything else is a "basic" linespec, address, or probe
+        location.  */
+      location = string_to_event_location_basic (stringp, language);
+    }
+
+  return location;
+}
+
+/* See description in location.h.  */
+
 int
 event_location_empty_p (const struct event_location *location)
 {
This page took 0.03017 seconds and 4 git commands to generate.