/* Generic static probe support for GDB.
- Copyright (C) 2012-2013 Free Software Foundation, Inc.
+ Copyright (C) 2012-2014 Free Software Foundation, Inc.
This file is part of GDB.
parse_probes (char **argptr, struct linespec_result *canonical)
{
char *arg_start, *arg_end, *arg;
- char *objfile_name = NULL, *provider = NULL, *name, *p;
+ char *objfile_namestr = NULL, *provider = NULL, *name, *p;
struct cleanup *cleanup;
struct symtabs_and_lines result;
struct objfile *objfile;
{
/* This is `-p objfile:provider:name'. */
*p = '\0';
- objfile_name = arg;
+ objfile_namestr = arg;
provider = hold;
name = p + 1;
}
error (_("no probe name specified"));
if (provider && *provider == '\0')
error (_("invalid provider name"));
- if (objfile_name && *objfile_name == '\0')
+ if (objfile_namestr && *objfile_namestr == '\0')
error (_("invalid objfile name"));
ALL_PSPACES (pspace)
if (!objfile->sf || !objfile->sf->sym_probe_fns)
continue;
- if (objfile_name
- && FILENAME_CMP (objfile->name, objfile_name) != 0
- && FILENAME_CMP (lbasename (objfile->name), objfile_name) != 0)
+ if (objfile_namestr
+ && FILENAME_CMP (objfile_name (objfile), objfile_namestr) != 0
+ && FILENAME_CMP (lbasename (objfile_name (objfile)),
+ objfile_namestr) != 0)
continue;
probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
{
throw_error (NOT_FOUND_ERROR,
_("No probe matching objfile=`%s', provider=`%s', name=`%s'"),
- objfile_name ? objfile_name : _("<any>"),
+ objfile_namestr ? objfile_namestr : _("<any>"),
provider ? provider : _("<any>"),
name);
}
if (objname)
{
- if (regexec (&obj_pat, objfile->name, 0, NULL, 0) != 0)
+ if (regexec (&obj_pat, objfile_name (objfile), 0, NULL, 0) != 0)
continue;
}
if (pa->address > pb->address)
return 1;
- return strcmp (pa->objfile->name, pb->objfile->name);
+ return strcmp (objfile_name (pa->objfile), objfile_name (pb->objfile));
}
/* Helper function that generate entries in the ui_out table being
{
size_name = max (strlen (probe->name), size_name);
size_provider = max (strlen (probe->provider), size_provider);
- size_objname = max (strlen (probe->objfile->name), size_objname);
+ size_objname = max (strlen (objfile_name (probe->objfile)), size_objname);
}
ui_out_table_header (current_uiout, size_provider, ui_left, "provider",
else
print_ui_out_info (probe);
- ui_out_field_string (current_uiout, "object", probe->objfile->name);
+ ui_out_field_string (current_uiout, "object",
+ objfile_name (probe->objfile));
ui_out_text (current_uiout, "\n");
do_cleanups (inner);
/* See comments in probe.h. */
unsigned
-get_probe_argument_count (struct probe *probe)
+get_probe_argument_count (struct probe *probe, struct frame_info *frame)
{
- const struct sym_probe_fns *probe_fns;
-
- gdb_assert (probe->objfile != NULL);
- gdb_assert (probe->objfile->sf != NULL);
-
- probe_fns = probe->objfile->sf->sym_probe_fns;
+ return probe->pops->get_probe_argument_count (probe, frame);
+}
- gdb_assert (probe_fns != NULL);
+/* See comments in probe.h. */
- return probe_fns->sym_get_probe_argument_count (probe);
+int
+can_evaluate_probe_arguments (struct probe *probe)
+{
+ return probe->pops->can_evaluate_probe_arguments (probe);
}
/* See comments in probe.h. */
struct value *
-evaluate_probe_argument (struct probe *probe, unsigned n)
+evaluate_probe_argument (struct probe *probe, unsigned n,
+ struct frame_info *frame)
{
- const struct sym_probe_fns *probe_fns;
-
- gdb_assert (probe->objfile != NULL);
- gdb_assert (probe->objfile->sf != NULL);
-
- probe_fns = probe->objfile->sf->sym_probe_fns;
-
- gdb_assert (probe_fns != NULL);
-
- return probe_fns->sym_evaluate_probe_argument (probe, n);
+ return probe->pops->evaluate_probe_argument (probe, n, frame);
}
/* See comments in probe.h. */
if (!probe)
return NULL;
- n_args = get_probe_argument_count (probe);
+ n_args = get_probe_argument_count (probe, frame);
if (n >= n_args)
return NULL;
- return evaluate_probe_argument (probe, n);
+ return evaluate_probe_argument (probe, n, frame);
}
/* See comment in probe.h. */