Gate the displaying of non-debug sections in separate debuginfo files.
[deliverable/binutils-gdb.git] / gdb / dtrace-probe.c
index e9e71fd4c9e82036dbf9464ed9393ea5580ca37c..6c01f87de646461b48fa5e83f787ab720e9f418f 100644 (file)
@@ -1,6 +1,6 @@
 /* DTrace probe support for GDB.
 
-   Copyright (C) 2014-2019 Free Software Foundation, Inc.
+   Copyright (C) 2014-2021 Free Software Foundation, Inc.
 
    Contributed by Oracle, Inc.
 
@@ -21,7 +21,6 @@
 
 #include "defs.h"
 #include "probe.h"
-#include "gdbsupport/vec.h"
 #include "elf-bfd.h"
 #include "gdbtypes.h"
 #include "obstack.h"
@@ -152,7 +151,7 @@ public:
   struct dtrace_probe_arg *get_arg_by_number (unsigned n,
                                              struct gdbarch *gdbarch);
 
-  /* Build the GDB internal expressiosn that, once evaluated, will
+  /* Build the GDB internal expression that, once evaluated, will
      calculate the values of the arguments of the probe.  */
   void build_arg_exprs (struct gdbarch *gdbarch);
 
@@ -463,8 +462,8 @@ dtrace_process_dof_probe (struct objfile *objfile,
       int probe_argc = DOF_UINT (dof, probe->dofpr_nargc);
 
       /* Store argument type descriptions.  A description of the type
-         of the argument is in the (J+1)th null-terminated string
-         starting at 'strtab' + 'probe->dofpr_nargv'.  */
+        of the argument is in the (J+1)th null-terminated string
+        starting at 'strtab' + 'probe->dofpr_nargv'.  */
       std::vector<struct dtrace_probe_arg> args;
       p = strtab + DOF_UINT (dof, probe->dofpr_nargv);
       for (j = 0; j < probe_argc; j++)
@@ -482,7 +481,7 @@ dtrace_process_dof_probe (struct objfile *objfile,
          /* Try to parse a type expression from the type string.  If
             this does not work then we set the type to `long
             int'.  */
-          struct type *type = builtin_type (gdbarch)->builtin_long;
+         struct type *type = builtin_type (gdbarch)->builtin_long;
 
          try
            {
@@ -493,8 +492,8 @@ dtrace_process_dof_probe (struct objfile *objfile,
            {
            }
 
-         if (expr != NULL && expr.get ()->elts[0].opcode == OP_TYPE)
-           type = expr.get ()->elts[1].type;
+         if (expr != NULL && expr->first_opcode () == OP_TYPE)
+           type = value_type (evaluate_type (expr.get ()));
 
          args.emplace_back (type, std::move (type_str), std::move (expr));
        }
@@ -521,7 +520,7 @@ dtrace_process_dof (asection *sect, struct objfile *objfile,
                    std::vector<std::unique_ptr<probe>> *probesp,
                    struct dtrace_dof_hdr *dof)
 {
-  struct gdbarch *gdbarch = get_objfile_arch (objfile);
+  struct gdbarch *gdbarch = objfile->arch ();
   struct dtrace_dof_sect *section;
   int i;
 
@@ -686,8 +685,7 @@ dtrace_probe::is_enabled () const
 CORE_ADDR
 dtrace_probe::get_relocated_address (struct objfile *objfile)
 {
-  return this->get_address () + ANOFFSET (objfile->section_offsets,
-                                         SECT_OFF_DATA (objfile));
+  return this->get_address () + objfile->data_section_offset ();
 }
 
 /* Implementation of the get_argument_count method.  */
@@ -716,11 +714,9 @@ dtrace_probe::evaluate_argument (unsigned n,
 {
   struct gdbarch *gdbarch = this->get_gdbarch ();
   struct dtrace_probe_arg *arg;
-  int pos = 0;
 
   arg = this->get_arg_by_number (n, gdbarch);
-  return evaluate_subexp_standard (arg->type, arg->expr.get (), &pos,
-                                  EVAL_NORMAL);
+  return evaluate_expression (arg->expr.get (), arg->type);
 }
 
 /* Implementation of the compile_to_ax method.  */
@@ -858,11 +854,11 @@ dtrace_static_probe_ops::get_probes
             extract the information of any probe defined into it.  */
          if (bfd_malloc_and_get_section (abfd, sect, &dof) && dof != NULL)
            dtrace_process_dof (sect, objfile, probesp,
-                               (struct dtrace_dof_hdr *) dof);
-         else
+                               (struct dtrace_dof_hdr *) dof);
+        else
            complaint (_("could not obtain the contents of"
                         "section '%s' in objfile `%s'."),
-                      sect->name, abfd->filename);
+                      bfd_section_name (sect), bfd_get_filename (abfd));
 
          xfree (dof);
        }
@@ -898,8 +894,9 @@ info_probes_dtrace_command (const char *arg, int from_tty)
   info_probes_for_spops (arg, from_tty, &dtrace_static_probe_ops);
 }
 
+void _initialize_dtrace_probe ();
 void
-_initialize_dtrace_probe (void)
+_initialize_dtrace_probe ()
 {
   all_static_probe_ops.push_back (&dtrace_static_probe_ops);
 
This page took 0.033062 seconds and 4 git commands to generate.