#include "location.h"
#include <ctype.h>
#include <algorithm>
-#include "common/gdb_optional.h"
+#include "gdbsupport/gdb_optional.h"
/* Class that implements the static probe methods for "any" probe. */
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. */
objfile_namestr) != 0)
continue;
- const std::vector<probe *> &probes
+ const std::vector<std::unique_ptr<probe>> &probes
= objfile->sf->sym_probe_fns->sym_get_probes (objfile);
- for (probe *p : probes)
+ for (auto &p : probes)
{
if (spops != &any_static_probe_ops && p->get_static_ops () != spops)
continue;
sal.explicit_pc = 1;
sal.section = find_pc_overlay (sal.pc);
sal.pspace = search_pspace;
- sal.prob = p;
+ sal.prob = p.get ();
sal.objfile = objfile;
result->push_back (std::move (sal));
if (!objfile->sf || !objfile->sf->sym_probe_fns)
return result;
- const std::vector<probe *> &probes
+ const std::vector<std::unique_ptr<probe>> &probes
= objfile->sf->sym_probe_fns->sym_get_probes (objfile);
- for (probe *p : probes)
+ for (auto &p : probes)
{
if (p->get_provider () != provider)
continue;
if (p->get_name () != name)
continue;
- result.push_back (p);
+ result.push_back (p.get ());
}
return result;
continue;
/* If this proves too inefficient, we can replace with a hash. */
- const std::vector<probe *> &probes
+ const std::vector<std::unique_ptr<probe>> &probes
= objfile->sf->sym_probe_fns->sym_get_probes (objfile);
- for (probe *p : probes)
+ for (auto &p : probes)
if (p->get_relocated_address (objfile) == pc)
{
result.objfile = objfile;
- result.prob = p;
+ result.prob = p.get ();
return result;
}
}
continue;
}
- const std::vector<probe *> &probes
+ const std::vector<std::unique_ptr<probe>> &probes
= objfile->sf->sym_probe_fns->sym_get_probes (objfile);
- for (probe *p : probes)
+ for (auto &p : probes)
{
if (spops != &any_static_probe_ops && p->get_static_ops () != spops)
continue;
&& probe_pat->exec (p->get_name ().c_str (), 0, NULL, 0) != 0)
continue;
- result.emplace_back (p, objfile);
+ result.emplace_back (p.get (), objfile);
}
}
if (!probe.prob)
return NULL;
- n_args = probe.prob->get_argument_count (frame);
+ n_args = probe.prob->get_argument_count (get_frame_arch (frame));
if (n >= n_args)
return NULL;
/* Implementation of 'get_probes' method. */
void
-any_static_probe_ops::get_probes (std::vector<probe *> *probesp,
+any_static_probe_ops::get_probes (std::vector<std::unique_ptr<probe>> *probesp,
struct objfile *objfile) const
{
/* No probes can be provided by this dummy backend. */
if (pc_probe.prob == NULL)
error (_("No probe at PC %s"), core_addr_to_string (pc));
- n_args = pc_probe.prob->get_argument_count (frame);
+ n_args = pc_probe.prob->get_argument_count (arch);
if (sel == -1)
return value_from_longest (builtin_type (arch)->builtin_int, n_args);
int sel = (int) (uintptr_t) data;
struct bound_probe pc_probe;
int n_args;
- struct frame_info *frame = get_selected_frame (NULL);
/* SEL == -1 means "_probe_argc". */
gdb_assert (sel >= -1);
if (pc_probe.prob == NULL)
error (_("No probe at PC %s"), core_addr_to_string (pc));
- n_args = pc_probe.prob->get_argument_count (frame);
+ n_args = pc_probe.prob->get_argument_count (expr->gdbarch);
if (sel == -1)
{