Get rid of -Wodr warning (PR build/23399)
[deliverable/binutils-gdb.git] / gdb / stap-probe.c
index 63100c9fb3c752b654286646bf7dfe9fe7f4dab0..ed7e1a0d3fb89ac4300106ecf735080107e3c1bb 100644 (file)
@@ -1,6 +1,6 @@
 /* SystemTap probe support for GDB.
 
-   Copyright (C) 2012-2017 Free Software Foundation, Inc.
+   Copyright (C) 2012-2018 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -1146,25 +1146,14 @@ static expression_up
 stap_parse_argument (const char **arg, struct type *atype,
                     struct gdbarch *gdbarch)
 {
-  struct stap_parse_info p;
-  struct cleanup *back_to;
-
   /* We need to initialize the expression buffer, in order to begin
      our parsing efforts.  We use language_c here because we may need
      to do pointer arithmetics.  */
-  initialize_expout (&p.pstate, 10, language_def (language_c), gdbarch);
-  back_to = make_cleanup (free_current_contents, &p.pstate.expout);
-
-  p.saved_arg = *arg;
-  p.arg = *arg;
-  p.arg_type = atype;
-  p.gdbarch = gdbarch;
-  p.inside_paren_p = 0;
+  struct stap_parse_info p (*arg, atype, 10, language_def (language_c),
+                           gdbarch);
 
   stap_parse_argument_1 (&p, 0, STAP_OPERAND_PREC_NONE);
 
-  discard_cleanups (back_to);
-
   gdb_assert (p.inside_paren_p == 0);
 
   /* Casting the final expression to the appropriate type.  */
@@ -1172,13 +1161,10 @@ stap_parse_argument (const char **arg, struct type *atype,
   write_exp_elt_type (&p.pstate, atype);
   write_exp_elt_opcode (&p.pstate, UNOP_CAST);
 
-  reallocate_expout (&p.pstate);
-
   p.arg = skip_spaces (p.arg);
   *arg = p.arg;
 
-  /* We can safely return EXPOUT here.  */
-  return expression_up (p.pstate.expout);
+  return p.pstate.release ();
 }
 
 /* Implementation of 'parse_arguments' method.  */
@@ -1278,13 +1264,21 @@ stap_probe::parse_arguments (struct gdbarch *gdbarch)
     }
 }
 
+/* Helper function to relocate an address.  */
+
+static CORE_ADDR
+relocate_address (CORE_ADDR address, struct objfile *objfile)
+{
+  return address + ANOFFSET (objfile->section_offsets,
+                            SECT_OFF_DATA (objfile));
+}
+
 /* Implementation of the get_relocated_address method.  */
 
 CORE_ADDR
 stap_probe::get_relocated_address (struct objfile *objfile)
 {
-  return this->get_address () + ANOFFSET (objfile->section_offsets,
-                                         SECT_OFF_DATA (objfile));
+  return relocate_address (this->get_address (), objfile);
 }
 
 /* Given PROBE, returns the number of arguments present in that probe's
@@ -1455,7 +1449,7 @@ stap_modify_semaphore (CORE_ADDR address, int set, struct gdbarch *gdbarch)
 void
 stap_probe::set_semaphore (struct objfile *objfile, struct gdbarch *gdbarch)
 {
-  stap_modify_semaphore (this->get_relocated_address (objfile), 1, gdbarch);
+  stap_modify_semaphore (relocate_address (m_sem_addr, objfile), 1, gdbarch);
 }
 
 /* Implementation of the 'clear_semaphore' method.  */
@@ -1463,7 +1457,7 @@ stap_probe::set_semaphore (struct objfile *objfile, struct gdbarch *gdbarch)
 void
 stap_probe::clear_semaphore (struct objfile *objfile, struct gdbarch *gdbarch)
 {
-  stap_modify_semaphore (this->get_relocated_address (objfile), 0, gdbarch);
+  stap_modify_semaphore (relocate_address (m_sem_addr, objfile), 0, gdbarch);
 }
 
 /* Implementation of the 'get_static_ops' method.  */
@@ -1518,7 +1512,7 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el,
   /* Making sure there is a name.  */
   if (name == NULL)
     {
-      complaint (&symfile_complaints, _("corrupt probe name when "
+      complaint (_("corrupt probe name when "
                                        "reading `%s'"),
                 objfile_name (objfile));
 
@@ -1555,7 +1549,7 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el,
       || (memchr (probe_args, '\0', (char *) el->data + el->size - name)
          != el->data + el->size - 1))
     {
-      complaint (&symfile_complaints, _("corrupt probe argument when "
+      complaint (_("corrupt probe argument when "
                                        "reading `%s'"),
                 objfile_name (objfile));
       /* If the argument string is NULL, it means some problem happened with
@@ -1596,7 +1590,7 @@ get_stap_base_address (bfd *obfd, bfd_vma *base)
 
   if (ret == NULL)
     {
-      complaint (&symfile_complaints, _("could not obtain base address for "
+      complaint (_("could not obtain base address for "
                                        "SystemTap section on objfile `%s'."),
                 obfd->filename);
       return 0;
@@ -1666,7 +1660,7 @@ stap_static_probe_ops::get_probes (std::vector<probe *> *probesp,
     {
       /* If we are here, it means we have failed to parse every known
         probe.  */
-      complaint (&symfile_complaints, _("could not parse SystemTap probe(s) "
+      complaint (_("could not parse SystemTap probe(s) "
                                        "from inferior"));
       return;
     }
This page took 0.025489 seconds and 4 git commands to generate.