frame: add frame_id_build_unavailable_stack_special
[deliverable/binutils-gdb.git] / gdb / probe.c
index 3086f4df35df52adad86d967e5e30091c816a4e0..3b0bd2839c482ee3f495ee77eb47f072cda5870b 100644 (file)
@@ -1,6 +1,6 @@
 /* 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.
 
@@ -41,7 +41,7 @@ struct symtabs_and_lines
 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;
@@ -92,7 +92,7 @@ parse_probes (char **argptr, struct linespec_result *canonical)
        {
          /* This is `-p objfile:provider:name'.  */
          *p = '\0';
-         objfile_name = arg;
+         objfile_namestr = arg;
          provider = hold;
          name = p + 1;
        }
@@ -102,7 +102,7 @@ parse_probes (char **argptr, struct linespec_result *canonical)
     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)
@@ -115,9 +115,10 @@ parse_probes (char **argptr, struct linespec_result *canonical)
        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);
@@ -155,7 +156,7 @@ parse_probes (char **argptr, struct linespec_result *canonical)
     {
       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);
     }
@@ -263,7 +264,7 @@ collect_probes (char *objname, char *provider, char *probe_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;
        }
 
@@ -313,7 +314,7 @@ compare_probes (const void *a, const void *b)
   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
@@ -538,7 +539,7 @@ info_probes_for_ops (char *arg, int from_tty, const struct probe_ops *pops)
     {
       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",
@@ -588,7 +589,8 @@ info_probes_for_ops (char *arg, int from_tty, const struct probe_ops *pops)
       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);
@@ -611,28 +613,46 @@ info_probes_command (char *arg, int from_tty)
 
 /* See comments in probe.h.  */
 
+unsigned
+get_probe_argument_count (struct probe *probe, struct frame_info *frame)
+{
+  return probe->pops->get_probe_argument_count (probe, frame);
+}
+
+/* See comments in probe.h.  */
+
+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,
+                        struct frame_info *frame)
+{
+  return probe->pops->evaluate_probe_argument (probe, n, frame);
+}
+
+/* See comments in probe.h.  */
+
 struct value *
 probe_safe_evaluate_at_pc (struct frame_info *frame, unsigned n)
 {
   struct probe *probe;
-  const struct sym_probe_fns *probe_fns;
   unsigned n_args;
 
   probe = find_probe_by_pc (get_frame_pc (frame));
   if (!probe)
     return NULL;
 
-  gdb_assert (probe->objfile != NULL);
-  gdb_assert (probe->objfile->sf != NULL);
-  gdb_assert (probe->objfile->sf->sym_probe_fns != NULL);
-
-  probe_fns = probe->objfile->sf->sym_probe_fns;
-  n_args = probe_fns->sym_get_probe_argument_count (probe);
-
+  n_args = get_probe_argument_count (probe, frame);
   if (n >= n_args)
     return NULL;
 
-  return probe_fns->sym_evaluate_probe_argument (probe, n);
+  return evaluate_probe_argument (probe, n, frame);
 }
 
 /* See comment in probe.h.  */
This page took 0.028719 seconds and 4 git commands to generate.