Remove cleanups from link_callbacks_einfo
[deliverable/binutils-gdb.git] / gdb / stap-probe.c
index 8f8cea67fd339a6e8d7431833d52788c0af5f168..6fa0d202807b65a468dc564ddb80d64f55183689 100644 (file)
@@ -1,6 +1,6 @@
 /* SystemTap probe support for GDB.
 
-   Copyright (C) 2012-2015 Free Software Foundation, Inc.
+   Copyright (C) 2012-2017 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -653,7 +653,7 @@ stap_parse_register_operand (struct stap_parse_info *p)
 
   len = p->arg - start;
 
-  regname = alloca (len + gdb_reg_prefix_len + gdb_reg_suffix_len + 1);
+  regname = (char *) alloca (len + gdb_reg_prefix_len + gdb_reg_suffix_len + 1);
   regname[0] = '\0';
 
   /* We only add the GDB's register prefix/suffix if we are dealing with
@@ -769,7 +769,7 @@ stap_parse_single_operand (struct stap_parse_info *p)
         We handle the register displacement here, and the other cases
         recursively.  */
       if (p->inside_paren_p)
-       tmp = skip_spaces_const (tmp);
+       tmp = skip_spaces (tmp);
 
       while (isdigit (*tmp))
        {
@@ -818,7 +818,7 @@ stap_parse_single_operand (struct stap_parse_info *p)
       tmp = endp;
 
       if (p->inside_paren_p)
-       tmp = skip_spaces_const (tmp);
+       tmp = skip_spaces (tmp);
 
       /* If "stap_is_integer_prefix" returns true, it means we can
         accept integers without a prefix here.  But we also need to
@@ -901,7 +901,7 @@ stap_parse_argument_conditionally (struct stap_parse_info *p)
         have to parse it as it was a separate expression, without
         left-side or precedence.  */
       ++p->arg;
-      p->arg = skip_spaces_const (p->arg);
+      p->arg = skip_spaces (p->arg);
       ++p->inside_paren_p;
 
       stap_parse_argument_1 (p, 0, STAP_OPERAND_PREC_NONE);
@@ -913,7 +913,7 @@ stap_parse_argument_conditionally (struct stap_parse_info *p)
 
       ++p->arg;
       if (p->inside_paren_p)
-       p->arg = skip_spaces_const (p->arg);
+       p->arg = skip_spaces (p->arg);
     }
   else
     error (_("Cannot parse expression `%s'."), p->saved_arg);
@@ -935,7 +935,7 @@ stap_parse_argument_1 (struct stap_parse_info *p, int has_lhs,
   gdb_assert (p->arg != NULL);
 
   if (p->inside_paren_p)
-    p->arg = skip_spaces_const (p->arg);
+    p->arg = skip_spaces (p->arg);
 
   if (!has_lhs)
     {
@@ -981,7 +981,7 @@ stap_parse_argument_1 (struct stap_parse_info *p, int has_lhs,
 
       p->arg = tmp_exp_buf;
       if (p->inside_paren_p)
-       p->arg = skip_spaces_const (p->arg);
+       p->arg = skip_spaces (p->arg);
 
       /* Parse the right-side of the expression.  */
       stap_parse_argument_conditionally (p);
@@ -1074,7 +1074,7 @@ stap_parse_argument (const char **arg, struct type *atype,
 
   reallocate_expout (&p.pstate);
 
-  p.arg = skip_spaces_const (p.arg);
+  p.arg = skip_spaces (p.arg);
   *arg = p.arg;
 
   /* We can safely return EXPOUT here.  */
@@ -1189,7 +1189,7 @@ stap_parse_probe_arguments (struct stap_probe *probe, struct gdbarch *gdbarch)
       arg.aexpr = expr;
 
       /* Start it over again.  */
-      cur = skip_spaces_const (cur);
+      cur = skip_spaces (cur);
 
       VEC_safe_push (stap_probe_arg_s, probe->args_u.vec, &arg);
     }
@@ -1472,7 +1472,7 @@ stap_clear_semaphore (struct probe *probe_generic, struct objfile *objfile,
 
 static void
 handle_stap_probe (struct objfile *objfile, struct sdt_note *el,
-                  VEC (probe_p) **probesp, CORE_ADDR base)
+                  std::vector<probe *> *probesp, CORE_ADDR base)
 {
   bfd *abfd = objfile->obfd;
   int size = bfd_get_arch_size (abfd) / 8;
@@ -1488,8 +1488,9 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el,
 
   /* Provider and the name of the probe.  */
   ret->p.provider = (char *) &el->data[3 * size];
-  ret->p.name = memchr (ret->p.provider, '\0',
-                       (char *) el->data + el->size - ret->p.provider);
+  ret->p.name = ((const char *)
+                memchr (ret->p.provider, '\0',
+                        (char *) el->data + el->size - ret->p.provider));
   /* Making sure there is a name.  */
   if (ret->p.name == NULL)
     {
@@ -1519,8 +1520,9 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el,
 
   /* Arguments.  We can only extract the argument format if there is a valid
      name for this probe.  */
-  probe_args = memchr (ret->p.name, '\0',
-                      (char *) el->data + el->size - ret->p.name);
+  probe_args = ((const char*)
+               memchr (ret->p.name, '\0',
+                       (char *) el->data + el->size - ret->p.name));
 
   if (probe_args != NULL)
     ++probe_args;
@@ -1541,7 +1543,7 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el,
   ret->args_u.text = probe_args;
 
   /* Successfully created probe.  */
-  VEC_safe_push (probe_p, *probesp, (struct probe *) ret);
+  probesp->push_back ((struct probe *) ret);
 }
 
 /* Helper function which tries to find the base address of the SystemTap
@@ -1550,7 +1552,7 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el,
 static void
 get_stap_base_address_1 (bfd *abfd, asection *sect, void *obj)
 {
-  asection **ret = obj;
+  asection **ret = (asection **) obj;
 
   if ((sect->flags & (SEC_DATA | SEC_ALLOC | SEC_HAS_CONTENTS))
       && sect->name && !strcmp (sect->name, STAP_BASE_SECTION_NAME))
@@ -1586,7 +1588,7 @@ get_stap_base_address (bfd *obfd, bfd_vma *base)
    SystemTap probes from OBJFILE.  */
 
 static void
-stap_get_probes (VEC (probe_p) **probesp, struct objfile *objfile)
+stap_get_probes (std::vector<probe *> *probesp, struct objfile *objfile)
 {
   /* If we are here, then this is the first time we are parsing the
      SystemTap probe's information.  We basically have to count how many
@@ -1595,7 +1597,7 @@ stap_get_probes (VEC (probe_p) **probesp, struct objfile *objfile)
   bfd *obfd = objfile->obfd;
   bfd_vma base;
   struct sdt_note *iter;
-  unsigned save_probesp_len = VEC_length (probe_p, *probesp);
+  unsigned save_probesp_len = probesp->size ();
 
   if (objfile->separate_debug_objfile_backlink != NULL)
     {
@@ -1626,7 +1628,7 @@ stap_get_probes (VEC (probe_p) **probesp, struct objfile *objfile)
       handle_stap_probe (objfile, iter, probesp, base);
     }
 
-  if (save_probesp_len == VEC_length (probe_p, *probesp))
+  if (save_probesp_len == probesp->size ())
     {
       /* If we are here, it means we have failed to parse every known
         probe.  */
@@ -1706,17 +1708,15 @@ const struct probe_ops stap_probe_ops =
 /* Implementation of the `info probes stap' command.  */
 
 static void
-info_probes_stap_command (char *arg, int from_tty)
+info_probes_stap_command (const char *arg, int from_tty)
 {
   info_probes_for_ops (arg, from_tty, &stap_probe_ops);
 }
 
-void _initialize_stap_probe (void);
-
 void
 _initialize_stap_probe (void)
 {
-  VEC_safe_push (probe_ops_cp, all_probe_ops, &stap_probe_ops);
+  all_probe_ops.push_back (&stap_probe_ops);
 
   add_setshow_zuinteger_cmd ("stap-expression", class_maintenance,
                             &stap_expression_debug,
This page took 0.026132 seconds and 4 git commands to generate.