41 # define SHT_SUNW_dof 0x6ffffff4 52 expr (std::move (expr_))
81 bool is_linespec (
const char **linespecp)
const override;
84 void get_probes (std::vector<probe *> *probesp,
113 std::vector<struct dtrace_probe_arg> &&args_,
114 std::vector<struct dtrace_probe_enabler> &&enablers_)
115 :
probe (std::move (name_), std::move (provider_), address_, arch_),
116 m_args (std::move (args_)),
137 unsigned n)
override;
166 std::vector<struct dtrace_probe_arg>
m_args;
352 #define DOF_UINT(dof, field) \ 353 extract_unsigned_integer ((gdb_byte *) &(field), \ 355 (((dof)->dofh_ident[DTRACE_DOF_ID_ENCODING] \ 356 == DTRACE_DOF_ENCODE_MSB) \ 357 ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE)) 363 #define DTRACE_DOF_PTR(dof, offset) (&((char *) (dof))[(offset)]) 369 #define DTRACE_DOF_SECT(dof, idx) \ 370 ((struct dtrace_dof_sect *) \ 371 DTRACE_DOF_PTR ((dof), \ 372 DOF_UINT ((dof), (dof)->dofh_secoff) \ 373 + ((idx) * DOF_UINT ((dof), (dof)->dofh_secsize)))) 383 std::vector<probe *> *probesp,
387 char *strtab,
char *offtab,
char *eofftab,
388 char *argtab, uint64_t strtab_size)
390 int i, j, num_probes, num_enablers;
435 std::vector<struct dtrace_probe_enabler> enablers;
437 for (i = 0; i < num_enablers; i++)
440 uint32_t enabler_offset
441 = ((uint32_t *) eofftab)[
DOF_UINT (dof,
probe->dofpr_enoffidx) + i];
445 enablers.push_back (enabler);
448 for (i = 0; i < num_probes; i++)
450 uint32_t probe_offset
451 = ((uint32_t *) offtab)[
DOF_UINT (dof,
probe->dofpr_offidx) + i];
454 const char *probe_provider
468 std::vector<struct dtrace_probe_arg> args;
470 for (j = 0; j < probe_argc; j++)
479 while (*p++ !=
'\0' && p - strtab < strtab_size)
497 if (expr != NULL && expr.get ()->elts[0].opcode == OP_TYPE)
498 type = expr.get ()->elts[1].type;
500 args.emplace_back (
type, std::move (type_str), std::move (expr));
503 std::vector<struct dtrace_probe_enabler> enablers_copy = enablers;
508 std::move (enablers_copy));
511 probesp->push_back (ret);
535 goto invalid_dof_data;
541 goto invalid_dof_data;
583 goto invalid_dof_data;
589 goto invalid_dof_data;
593 for (i = 0; i < num_probes; i++)
602 provider, strtab, offtab, eofftab, argtab,
611 _(
"skipping section '%s' which does not contain valid DOF data."),
640 if (arg.type != NULL)
663 _(
"Probe '%s' has %d arguments, but GDB is requesting\n" 664 "argument %u. This should not happen. Please\n" 739 pc = arg->
expr->elts;
756 std::vector<const char *>
759 const char *val = NULL;
770 return std::vector<const char *> { val };
783 error (
_(
"No inferior running"));
807 error (
_(
"No inferior running"));
816 error (
_(
"Probe %s:%s cannot be disabled: no enablers."),
831 static const char *
const keywords[] = {
"-pdtrace",
"-probe-dtrace", NULL };
843 asection *sect = NULL;
852 for (sect = abfd->sections; sect != NULL; sect = sect->next)
854 if (elf_section_data (sect)->this_hdr.sh_type ==
SHT_SUNW_dof)
860 if (!bfd_malloc_and_get_section (abfd, sect, &dof))
862 _(
"could not obtain the contents of" 863 "section '%s' in objfile `%s'."),
864 sect->name, abfd->filename);
883 std::vector<struct info_probe_column>
891 return std::vector<struct info_probe_column> { dtrace_probe_column };
909 Show information about DTrace static probes.\n\ 910 Usage: info probes dtrace [PROVIDER [NAME [OBJECT]]]\n\ 911 Each argument is a regular expression, used to select probes.\n\ 912 PROVIDER matches probe provider names.\n\ 913 NAME matches the probe names.\n\ 914 OBJECT matches the executable or shared library name."),
int gdbarch_dtrace_probe_is_enabled_p(struct gdbarch *gdbarch)
dtrace_probe_arg(struct type *type_, std::string &&type_str_, expression_up &&expr_)
#define DTRACE_DOF_PTR(dof, offset)
int gdbarch_dtrace_parse_probe_argument_p(struct gdbarch *gdbarch)
gdb::unique_xmalloc_ptr< expression > expression_up
struct objfile * separate_debug_objfile_backlink
int gdbarch_dtrace_probe_is_enabled(struct gdbarch *gdbarch, CORE_ADDR addr)
#define DTRACE_DOF_SECT(dof, idx)
static void dtrace_process_dof(asection *sect, struct objfile *objfile, std::vector< probe *> *probesp, struct dtrace_dof_hdr *dof)
void gdbarch_dtrace_enable_probe(struct gdbarch *gdbarch, CORE_ADDR addr)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
dtrace_probe(std::string &&name_, std::string &&provider_, CORE_ADDR address_, struct gdbarch *arch_, std::vector< struct dtrace_probe_arg > &&args_, std::vector< struct dtrace_probe_enabler > &&enablers_)
void internal_error(const char *file, int line, const char *fmt,...)
static void info_probes_dtrace_command(const char *arg, int from_tty)
struct cmd_list_element ** info_probes_cmdlist_get(void)
const dtrace_static_probe_ops dtrace_static_probe_ops
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
CORE_ADDR get_address() const
const char * type_name() const override
void info_probes_for_spops(const char *arg, int from_tty, const static_probe_ops *spops)
CORE_ADDR get_relocated_address(struct objfile *objfile) override
const std::string & get_provider() const
int gdbarch_dtrace_disable_probe_p(struct gdbarch *gdbarch)
std::vector< const char * > gen_info_probes_table_values() const override
void build_arg_exprs(struct gdbarch *gdbarch)
int probe_is_linespec_by_keyword(const char **linespecp, const char *const *keywords)
#define CATCH(EXCEPTION, MASK)
unsigned get_argument_count(struct frame_info *frame) override
static struct parser_state * pstate
int prefixify_expression(struct expression *expr)
const std::string & get_name() const
void get_probes(std::vector< probe *> *probesp, struct objfile *objfile) const override
void gdbarch_dtrace_disable_probe(struct gdbarch *gdbarch, CORE_ADDR addr)
#define SECT_OFF_DATA(objfile)
#define ANOFFSET(secoff, whichone)
struct gdbarch * get_objfile_arch(const struct objfile *objfile)
#define complaint(COMPLAINTS, FMT,...)
struct type * builtin_long
std::vector< struct info_probe_column > gen_info_probes_table_header() const override
void _initialize_dtrace_probe(void)
void gen_expr(struct expression *exp, union exp_element **pc, struct agent_expr *ax, struct axs_value *value)
int gdbarch_dtrace_enable_probe_p(struct gdbarch *gdbarch)
struct value * evaluate_argument(unsigned n, struct frame_info *frame) override
std::vector< const static_probe_ops * > all_static_probe_ops
void write_exp_elt_opcode(struct parser_state *ps, enum exp_opcode expelt)
const struct language_defn * current_language
static void dtrace_process_dof_probe(struct objfile *objfile, struct gdbarch *gdbarch, std::vector< probe *> *probesp, struct dtrace_dof_hdr *dof, struct dtrace_dof_probe *probe, struct dtrace_dof_provider *provider, char *strtab, char *offtab, char *eofftab, char *argtab, uint64_t strtab_size)
struct complaints * symfile_complaints
bool is_linespec(const char **linespecp) const override
bool can_evaluate_arguments() const override
std::vector< struct dtrace_probe_enabler > m_enablers
bool can_enable() const override
void require_rvalue(struct agent_expr *ax, struct axs_value *value)
struct value * evaluate_subexp_standard(struct type *expect_type, struct expression *exp, int *pos, enum noside noside)
int ptid_equal(const ptid_t &ptid1, const ptid_t &ptid2)
const static_probe_ops * get_static_ops() const override
std::vector< struct dtrace_probe_arg > m_args
#define DOF_UINT(dof, field)
void gdbarch_dtrace_parse_probe_argument(struct gdbarch *gdbarch, struct parser_state *pstate, int narg)
struct section_offsets * section_offsets
expression_up parse_expression_with_language(const char *string, enum language lang)
void compile_to_ax(struct agent_expr *aexpr, struct axs_value *axs_value, unsigned n) override
struct dtrace_probe_arg * get_arg_by_number(unsigned n, struct gdbarch *gdbarch)
void write_exp_elt_type(struct parser_state *ps, struct type *expelt)
void error(const char *fmt,...)
struct gdbarch * get_gdbarch() const