#include "defs.h"
#include "probe.h"
-#include "common/vec.h"
#include "elf-bfd.h"
#include "gdbtypes.h"
#include "obstack.h"
bool is_linespec (const char **linespecp) const override;
/* See probe.h. */
- void get_probes (std::vector<probe *> *probesp,
+ void get_probes (std::vector<std::unique_ptr<probe>> *probesp,
struct objfile *objfile) const override;
/* See probe.h. */
CORE_ADDR get_relocated_address (struct objfile *objfile) override;
/* See probe.h. */
- unsigned get_argument_count (struct frame_info *frame) override;
+ unsigned get_argument_count (struct gdbarch *gdbarch) override;
/* See probe.h. */
bool can_evaluate_arguments () const override;
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);
static void
dtrace_process_dof_probe (struct objfile *objfile,
struct gdbarch *gdbarch,
- std::vector<probe *> *probesp,
+ std::vector<std::unique_ptr<probe>> *probesp,
struct dtrace_dof_hdr *dof,
struct dtrace_dof_probe *probe,
struct dtrace_dof_provider *provider,
expr = parse_expression_with_language (type_str.c_str (),
language_c);
}
- catch (const gdb_exception_RETURN_MASK_ERROR &ex)
+ catch (const gdb_exception_error &ex)
{
}
std::move (enablers_copy));
/* Successfully created probe. */
- probesp->push_back (ret);
+ probesp->emplace_back (ret);
}
}
static void
dtrace_process_dof (asection *sect, struct objfile *objfile,
- std::vector<probe *> *probesp, struct dtrace_dof_hdr *dof)
+ std::vector<std::unique_ptr<probe>> *probesp,
+ struct dtrace_dof_hdr *dof)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct dtrace_dof_sect *section;
/* Implementation of the get_argument_count method. */
unsigned
-dtrace_probe::get_argument_count (struct frame_info *frame)
+dtrace_probe::get_argument_count (struct gdbarch *gdbarch)
{
return m_args.size ();
}
/* Implementation of the get_probes method. */
void
-dtrace_static_probe_ops::get_probes (std::vector<probe *> *probesp,
- struct objfile *objfile) const
+dtrace_static_probe_ops::get_probes
+ (std::vector<std::unique_ptr<probe>> *probesp,
+ struct objfile *objfile) const
{
bfd *abfd = objfile->obfd;
asection *sect = NULL;
/* Read the contents of the DOF section and then process it to
extract the information of any probe defined into it. */
- if (!bfd_malloc_and_get_section (abfd, sect, &dof))
+ if (bfd_malloc_and_get_section (abfd, sect, &dof) && dof != NULL)
+ dtrace_process_dof (sect, objfile, probesp,
+ (struct dtrace_dof_hdr *) dof);
+ else
complaint (_("could not obtain the contents of"
"section '%s' in objfile `%s'."),
sect->name, abfd->filename);
-
- dtrace_process_dof (sect, objfile, probesp,
- (struct dtrace_dof_hdr *) dof);
+
xfree (dof);
}
}