28 #include "filenames.h"
48 char *arg_start, *arg_end, *arg;
49 char *objfile_namestr = NULL, *
provider = NULL, *
name, *p;
64 if (probe_ops == NULL)
65 error (
_(
"'%s' is not a probe linespec"), arg_start);
70 error (
_(
"argument to `%s' missing"), arg_start);
79 p = strchr (arg,
':');
90 p = strchr (hold,
':');
101 objfile_namestr = arg;
108 error (
_(
"no probe name specified"));
109 if (provider && *provider ==
'\0')
110 error (
_(
"invalid provider name"));
111 if (objfile_namestr && *objfile_namestr ==
'\0')
112 error (
_(
"invalid objfile name"));
125 && FILENAME_CMP (
objfile_name (objfile), objfile_namestr) != 0
127 objfile_namestr) != 0)
136 if (probe_ops != &probe_ops_any && probe->
pops != probe_ops)
139 if (provider && strcmp (probe->
provider, provider) != 0)
142 if (strcmp (probe->
name, name) != 0)
162 if (result.
nelts == 0)
165 _(
"No probe matching objfile=`%s', provider=`%s', name=`%s'"),
166 objfile_namestr ? objfile_namestr :
_(
"<any>"),
167 provider ? provider :
_(
"<any>"),
173 canonical->special_display = 1;
174 canonical->pre_expanded = 1;
175 canonical->addr_string =
savestring (*argptr, arg_end - *argptr);
200 if (strcmp (probe->
provider, provider) != 0)
203 if (strcmp (probe->
name, name) != 0)
254 collect_probes (
char *objname,
char *
provider,
char *probe_name,
260 regex_t obj_pat, prov_pat, probe_pat;
265 if (provider != NULL)
267 if (probe_name != NULL)
283 if (regexec (&obj_pat,
objfile_name (objfile), 0, NULL, 0) != 0)
293 if (pops != NULL && probe->
pops != pops)
297 && regexec (&prov_pat, probe->
provider, 0, NULL, 0) != 0)
301 && regexec (&probe_pat, probe->
name, 0, NULL, 0) != 0)
352 size_t headings_size;
375 size_t size_max = strlen (column->
print_name);
404 size_max =
max (strlen (val), size_max);
535 char **probe_name,
char **objname)
537 *probe_name = *objname = NULL;
540 if (*provider != NULL)
543 if (*probe_name != NULL)
554 char *
provider, *probe_name = NULL, *objname = NULL;
558 int ui_out_extra_fields = 0;
560 size_t size_name = strlen (
"Name");
561 size_t size_objname = strlen (
"Object");
562 size_t size_provider = strlen (
"Provider");
563 size_t size_type = strlen (
"Type");
572 probes = collect_probes (objname, provider, probe_name, pops);
598 5 + ui_out_extra_fields,
616 size_type =
max (strlen (probe_type), size_type);
617 size_name =
max (strlen (probe->
probe->
name), size_name);
649 struct cleanup *inner;
703 char *
provider, *probe_name = NULL, *objname = NULL;
714 probes = collect_probes (objname, provider, probe_name, NULL);
732 _(
"Probe %s:%s enabled.\n"),
737 _(
"Probe %s:%s cannot be enabled.\n"),
749 char *
provider, *probe_name = NULL, *objname = NULL;
760 probes = collect_probes (objname, provider, probe_name, NULL );
778 _(
"Probe %s:%s disabled.\n"),
783 _(
"Probe %s:%s cannot be disabled.\n"),
862 const char *s = *linespecp;
863 const char *
const *csp;
865 for (csp = keywords; *csp; csp++)
868 size_t len = strlen (keyword);
870 if (strncmp (s, keyword, len) == 0 && isspace (s[len]))
872 *linespecp += len + 1;
885 static const char *
const keywords[] = {
"-p",
"-probe", NULL };
913 if (info_probes_cmdlist == NULL)
916 Show available static probes.\n\
917 Usage: info probes [all|TYPE [ARGS]]\n\
918 TYPE specifies the type of the probe, and can be one of the following:\n\
920 If you specify TYPE, there may be additional arguments needed by the\n\
922 If you do not specify any argument, or specify `all', then the command\n\
923 will show information about all types of probes."),
924 &info_probes_cmdlist,
"info probes ",
927 return &info_probes_cmdlist;
935 static struct value *
941 int sel = (
int) (uintptr_t) data;
950 if (pc_probe.
probe == NULL)
958 error (
_(
"Invalid probe argument %d -- probe has %u arguments available"),
972 int sel = (
int) (uintptr_t) data;
982 if (pc_probe.
probe == NULL)
997 error (
_(
"Invalid probe argument %d -- probe has %d arguments available"),
1021 (
void *) (uintptr_t) -1);
1023 (
void *) (uintptr_t) 0);
1025 (
void *) (uintptr_t) 1);
1027 (
void *) (uintptr_t) 2);
1029 (
void *) (uintptr_t) 3);
1031 (
void *) (uintptr_t) 4);
1033 (
void *) (uintptr_t) 5);
1035 (
void *) (uintptr_t) 6);
1037 (
void *) (uintptr_t) 7);
1039 (
void *) (uintptr_t) 8);
1041 (
void *) (uintptr_t) 9);
1043 (
void *) (uintptr_t) 10);
1045 (
void *) (uintptr_t) 11);
1049 Show information about all type of probes."),
1054 Usage: enable probes [PROVIDER [NAME [OBJECT]]]\n\
1055 Each argument is a regular expression, used to select probes.\n\
1056 PROVIDER matches probe provider names.\n\
1057 NAME matches the probe names.\n\
1058 OBJECT matches the executable or shared library name.\n\
1059 If you do not specify any argument then the command will enable\n\
1060 all defined probes."),
1065 Usage: disable probes [PROVIDER [NAME [OBJECT]]]\n\
1066 Each argument is a regular expression, used to select probes.\n\
1067 PROVIDER matches probe provider names.\n\
1068 NAME matches the probe names.\n\
1069 OBJECT matches the executable or shared library name.\n\
1070 If you do not specify any argument then the command will disable\n\
1071 all defined probes."),
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
int(* can_evaluate_probe_arguments)(struct probe *probe)
void(* enable_probe)(struct probe *probe)
int(* is_linespec)(const char **linespecp)
struct frame_info * get_selected_frame(const char *message)
CORE_ADDR get_frame_pc(struct frame_info *frame)
struct value *(* evaluate_probe_argument)(struct probe *probe, unsigned n, struct frame_info *frame)
static void print_ui_out_info(struct probe *probe)
struct cmd_list_element * enablelist
const char *(* type_name)(struct probe *probe)
void(* disable_probe)(struct probe *probe)
struct cleanup * make_cleanup_ui_out_table_begin_end(struct ui_out *ui_out, int nr_cols, int nr_rows, const char *tblid)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
void init_sal(struct symtab_and_line *sal)
struct symtabs_and_lines parse_probes(char **argptr, struct linespec_result *canonical)
struct cmd_list_element ** info_probes_cmdlist_get(void)
static void print_ui_out_not_applicables(const struct probe_ops *pops)
void(* gen_info_probes_table_values)(struct probe *probe, VEC(const_char_ptr)**values)
int can_evaluate_probe_arguments(struct probe *probe)
#define VEC_safe_push(T, V, O)
struct obj_section * section
char * skip_spaces(char *chp)
struct value * probe_safe_evaluate_at_pc(struct frame_info *frame, unsigned n)
void(* compile_to_ax)(struct probe *probe, struct agent_expr *aexpr, struct axs_value *axs_value, unsigned n)
void ui_out_text(struct ui_out *uiout, const char *string)
static void compile_probe_arg(struct internalvar *ivar, struct agent_expr *expr, struct axs_value *value, void *data)
const struct sym_probe_fns * sym_probe_fns
struct obj_section * find_pc_overlay(CORE_ADDR pc)
unsigned(* get_probe_argument_count)(struct probe *probe, struct frame_info *frame)
void null_cleanup(void *arg)
int probe_is_linespec_by_keyword(const char **linespecp, const char *const *keywords)
struct cmd_list_element * infolist
static void info_probes_command(char *arg, int from_tty)
#define ALL_OBJFILES(obj)
#define VEC_iterate(T, V, I, P)
void ui_out_field_skip(struct ui_out *uiout, const char *fldname)
struct cleanup * make_cleanup_ui_out_tuple_begin_end(struct ui_out *uiout, const char *id)
const char * const_char_ptr
struct cleanup * compile_rx_or_error(regex_t *pattern, const char *rx, const char *message)
unsigned get_probe_argument_count(struct probe *probe, struct frame_info *frame)
void ui_out_message(struct ui_out *uiout, int verbosity, const char *format,...)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **list)
const struct sym_fns * sf
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
initialize_file_ftype _initialize_probe
#define VEC_index(T, V, I)
struct gdbarch * get_current_arch(void)
struct value * value_from_longest(struct type *type, LONGEST num)
static int compare_probes(const void *a, const void *b)
static void probe_any_get_probes(VEC(probe_p)**probesp, struct objfile *objfile)
int gdbarch_addr_bit(struct gdbarch *gdbarch)
static int get_number_extra_fields(const struct probe_ops *pops)
void(* gen_info_probes_table_header)(VEC(info_probe_column_s)**heads)
const char * objfile_name(const struct objfile *objfile)
struct cmd_list_element * disablelist
PTR xrealloc(PTR ptr, size_t size)
CORE_ADDR(* get_probe_address)(struct probe *probe, struct objfile *objfile)
CORE_ADDR get_probe_address(struct probe *probe, struct objfile *objfile)
const char const char int
void discard_cleanups(struct cleanup *old_chain)
#define ALL_PSPACES(pspace)
struct program_space * pspace
static int exists_probe_with_pops(VEC(bound_probe_s)*probes, const struct probe_ops *pops)
void info_probes_for_ops(const char *arg, int from_tty, const struct probe_ops *pops)
void ui_out_table_header(struct ui_out *uiout, int width, enum ui_align alignment, const char *col_name, const char *colhdr)
#define VEC_address(T, V)
char * extract_arg_const(const char **arg)
struct bound_probe find_probe_by_pc(CORE_ADDR pc)
void ax_const_l(struct agent_expr *x, LONGEST l)
const struct probe_ops * pops
void ui_out_field_core_addr(struct ui_out *uiout, const char *fldname, struct gdbarch *gdbarch, CORE_ADDR address)
static int probe_any_is_linespec(const char **linespecp)
char * savestring(const char *ptr, size_t len)
const char * core_addr_to_string(const CORE_ADDR addr)
static void disable_probes_command(char *arg, int from_tty)
static void enable_probes_command(char *arg, int from_tty)
void ui_out_field_string(struct ui_out *uiout, const char *fldname, const char *string)
struct symtab_and_line * sals
struct value * evaluate_probe_argument(struct probe *probe, unsigned n, struct frame_info *frame)
void ui_out_table_body(struct ui_out *uiout)
struct ui_out * current_uiout
static void gen_ui_out_table_header_info(VEC(bound_probe_s)*probes, const struct probe_ops *p)
static struct value * compute_probe_arg(struct gdbarch *arch, struct internalvar *ivar, void *data)
enum axs_lvalue_kind kind
#define ALL_PSPACE_OBJFILES(ss, obj)
struct internalvar * create_internalvar_type_lazy(const char *name, const struct internalvar_funcs *funcs, void *data)
void error(const char *fmt,...)
#define skip_to_space(INP)
void throw_error(enum errors error, const char *fmt,...)
static void parse_probe_linespec(const char *str, char **provider, char **probe_name, char **objname)
void do_cleanups(struct cleanup *old_chain)
const struct probe_ops * probe_linespec_to_ops(const char **linespecp)
struct type * builtin_int
const ULONGEST const LONGEST len