summaryrefslogtreecommitdiff
path: root/libdwfl/libdwfl.h
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2013-12-30 22:00:57 +0100
committerMark Wielaard <mjw@redhat.com>2013-12-31 13:59:51 +0100
commit19108019192ab273c53ae324be448d29dac806ca (patch)
tree6605f8c9e3e15ea50c77ccd9fe1d2b69f68959b5 /libdwfl/libdwfl.h
parentac65261cc5f4b313d4f852e0a7f2b1b91918550b (diff)
downloadelfutils-19108019192ab273c53ae324be448d29dac806ca.tar.gz
libdwfl: Add dwfl_core_file_attach and dwfl_linux_proc_attach.
Rewrite __libdwfl_attach_state_for_pid and __libdwfl_attach_state_for_core as public functions and don't call them from dwfl_linux_proc_report and dwfl_core_file_report anymore. This lets the user attach state explicitly independ from how the dwfl modules have been reported. Since attaching state is an explicit action now the error can be returned directly and we don't need to keep track of process_attach_error. dwfl_linux_proc_attach lets the user can tell libdwfl whether caller takes care of ptrace attaching and stopping the threads under inspection, or whether the callback needs to take care of that and detaching again. Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'libdwfl/libdwfl.h')
-rw-r--r--libdwfl/libdwfl.h26
1 files changed, 20 insertions, 6 deletions
diff --git a/libdwfl/libdwfl.h b/libdwfl/libdwfl.h
index 67785ea3..2bb4f455 100644
--- a/libdwfl/libdwfl.h
+++ b/libdwfl/libdwfl.h
@@ -361,16 +361,13 @@ extern int dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release,
supply non-NULL EXECUTABLE, otherwise dynamic libraries will not be loaded
into the DWFL map. This might call dwfl_report_elf on file names found in
the dump if reading some link_map files is the only way to ascertain those
- modules' addresses. dwfl_attach_state is also called for DWFL,
- dwfl_core_file_report does not fail if the dwfl_attach_state call has failed.
- Returns the number of modules reported, or -1 for errors. */
+ modules' addresses. Returns the number of modules reported, or -1 for
+ errors. */
extern int dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const char *executable);
/* Call dwfl_report_module for each file mapped into the address space of PID.
- dwfl_attach_state is also called for DWFL, dwfl_linux_proc_report does
- not fail if the dwfl_attach_state call has failed.
Returns zero on success, -1 if dwfl_report_module failed,
- or an errno code if opening the kernel binary failed. */
+ or an errno code if opening the proc files failed. */
extern int dwfl_linux_proc_report (Dwfl *dwfl, pid_t pid);
/* Similar, but reads an input stream in the format of Linux /proc/PID/maps
@@ -717,6 +714,23 @@ bool dwfl_attach_state (Dwfl *dwfl, Elf *elf, pid_t pid,
void *dwfl_arg)
__nonnull_attribute__ (1, 4);
+/* Calls dwfl_attach_state with Dwfl_Thread_Callbacks setup for extracting
+ thread state from the ELF core file. Returns the pid number extracted
+ from the core file, or -1 for errors. */
+extern int dwfl_core_file_attach (Dwfl *dwfl, Elf *elf);
+
+/* Calls dwfl_attach_state with Dwfl_Thread_Callbacks setup for extracting
+ thread state from the proc file system. Uses ptrace to attach and stop
+ the thread under inspection and detaches when thread_detach is called
+ and unwinding for the thread is done, unless ASSUME_PTRACE_STOPPED is
+ true. If ASSUME_PTRACE_STOPPED is true the caller should make sure that
+ the thread is ptrace attached and stopped before unwinding by calling
+ either dwfl_thread_getframes or dwfl_getthread_frames. Returns zero on
+ success, -1 if dwfl_attach_state failed, or an errno code if opening the
+ proc files failed. */
+extern int dwfl_linux_proc_attach (Dwfl *dwfl, pid_t pid,
+ bool assume_ptrace_stopped);
+
/* Return PID for the process associated with DWFL. Function returns -1 if
dwfl_attach_state was not called for DWFL. */
pid_t dwfl_pid (Dwfl *dwfl)