perf probe: Fix to search local variables in appropriate scope
[firefly-linux-kernel-4.4.55.git] / tools / perf / util / probe-finder.h
index 0f1ed3d25a20bfd0a5b4d7b0ed0a3fc0127c5d54..1132c8f0ce890b09bab27520a59a4bf1ad7fe765 100644 (file)
@@ -16,29 +16,48 @@ static inline int is_c_varname(const char *name)
 }
 
 #ifdef DWARF_SUPPORT
+
+#include "dwarf-aux.h"
+
+/* TODO: export debuginfo data structure even if no dwarf support */
+
+/* debug information structure */
+struct debuginfo {
+       Dwarf           *dbg;
+       Dwfl            *dwfl;
+       Dwarf_Addr      bias;
+};
+
+extern struct debuginfo *debuginfo__new(const char *path);
+extern struct debuginfo *debuginfo__new_online_kernel(unsigned long addr);
+extern void debuginfo__delete(struct debuginfo *self);
+
 /* Find probe_trace_events specified by perf_probe_event from debuginfo */
-extern int find_probe_trace_events(int fd, struct perf_probe_event *pev,
-                                   struct probe_trace_event **tevs,
-                                   int max_tevs);
+extern int debuginfo__find_trace_events(struct debuginfo *self,
+                                       struct perf_probe_event *pev,
+                                       struct probe_trace_event **tevs,
+                                       int max_tevs);
 
 /* Find a perf_probe_point from debuginfo */
-extern int find_perf_probe_point(unsigned long addr,
-                                struct perf_probe_point *ppt);
+extern int debuginfo__find_probe_point(struct debuginfo *self,
+                                      unsigned long addr,
+                                      struct perf_probe_point *ppt);
 
 /* Find a line range */
-extern int find_line_range(int fd, struct line_range *lr);
+extern int debuginfo__find_line_range(struct debuginfo *self,
+                                     struct line_range *lr);
 
 /* Find available variables */
-extern int find_available_vars_at(int fd, struct perf_probe_event *pev,
-                                 struct variable_list **vls, int max_points,
-                                 bool externs);
-#include "dwarf-aux.h"
+extern int debuginfo__find_available_vars_at(struct debuginfo *self,
+                                            struct perf_probe_event *pev,
+                                            struct variable_list **vls,
+                                            int max_points, bool externs);
 
 struct probe_finder {
        struct perf_probe_event *pev;           /* Target probe event */
 
        /* Callback when a probe point is found */
-       int (*callback)(Dwarf_Die *sp_die, struct probe_finder *pf);
+       int (*callback)(Dwarf_Die *sc_die, struct probe_finder *pf);
 
        /* For function searching */
        int                     lno;            /* Line number */