Replace readdir_r with readdir
[platform/upstream/ltrace.git] / proc.h
diff --git a/proc.h b/proc.h
index e8032fa..a611456 100644 (file)
--- a/proc.h
+++ b/proc.h
@@ -1,6 +1,6 @@
 /*
  * This file is part of ltrace.
- * Copyright (C) 2010,2011,2012,2013 Petr Machata, Red Hat Inc.
+ * Copyright (C) 2010,2011,2012,2013,2014 Petr Machata, Red Hat Inc.
  * Copyright (C) 2010 Joe Damato
  * Copyright (C) 1998,2001,2008,2009 Juan Cespedes
  *
  * 02110-1301 USA
  */
 
-#ifndef _PROC_H_
-#define _PROC_H_
+#ifndef PROC_H
+#define PROC_H
 
 #include "config.h"
 
 #include <sys/time.h>
 #include <stdint.h>
 
+#if defined(HAVE_LIBDW)
+# include <elfutils/libdwfl.h>
+#endif
+
 #if defined(HAVE_LIBUNWIND)
 # include <libunwind.h>
+# include <libunwind-ptrace.h>
 #endif /* defined(HAVE_LIBUNWIND) */
 
 #include "ltrace.h"
@@ -66,7 +71,7 @@ struct callstack_element {
        } c_un;
        int is_syscall;
        arch_addr_t return_addr;
-       struct timeval time_spent;
+       struct timeval enter_time;
        struct fetch_context *fetch_context;
        struct value_dict *arguments;
        struct output_state out;
@@ -113,6 +118,17 @@ struct process {
        short e_machine;
        char e_class;
 
+#if defined(HAVE_LIBDW)
+       /* Unwind info for leader, NULL for non-leader procs. */
+       Dwfl *dwfl;
+
+       /* Whether we still need to attach the DWARF library to this process. We
+        * try only once, and never again, regardless of whether we succeeded or
+        * not. 0 = shouldn't attach */
+       int should_attach_dwfl;
+
+#endif /* defined(HAVE_LIBDW) */
+
 #if defined(HAVE_LIBUNWIND)
        /* libunwind address space */
        unw_addr_space_t unwind_as;
@@ -225,11 +241,12 @@ void proc_remove_breakpoint(struct process *proc, struct breakpoint *bp);
 
 /* Iterate through the breakpoints of PROC.  See callback.h for notes
  * on iteration interfaces.  */
-void *proc_each_breakpoint(struct process *proc, void *start,
-                          enum callback_status (*cb)(struct process *proc,
-                                                     struct breakpoint *bp,
-                                                     void *data),
-                          void *data);
+arch_addr_t *proc_each_breakpoint(struct process *proc, arch_addr_t *start,
+                                 enum callback_status (*cb)
+                                       (struct process *proc,
+                                        struct breakpoint *bp,
+                                        void *data),
+                                 void *data);
 
 /* Iterate through the dynamic section at src_addr looking for D_TAG.
  * If tag is found, fill it's value in RET and return 0.
@@ -260,4 +277,4 @@ int proc_read_16(struct process *proc, arch_addr_t addr, uint16_t *lp);
 int proc_read_32(struct process *proc, arch_addr_t addr, uint32_t *lp);
 int proc_read_64(struct process *proc, arch_addr_t addr, uint64_t *lp);
 
-#endif /* _PROC_H_ */
+#endif /* PROC_H */