summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2013-12-30 22:00:57 +0100
committerMark Wielaard <[email protected]>2013-12-31 13:59:51 +0100
commit19108019192ab273c53ae324be448d29dac806ca (patch)
tree6605f8c9e3e15ea50c77ccd9fe1d2b69f68959b5 /tests
parentac65261cc5f4b313d4f852e0a7f2b1b91918550b (diff)
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 <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog6
-rw-r--r--tests/backtrace-dwarf.c6
-rw-r--r--tests/backtrace.c6
3 files changed, 18 insertions, 0 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 23c5051d..5c80e9bf 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+2013-12-30 Mark Wielaard <[email protected]>
+
+ * backtrace-dwarf.c (report_pid): Explicitly call
+ dwfl_linux_proc_attach and check for errors.
+ * backtrace.c (report_pid): Likewise.
+
2013-12-21 Mark Wielaard <[email protected]>
* backtrace.c (callback_verify): Only assert that case 5 is the last
diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c
index aa12315a..3a3e7632 100644
--- a/tests/backtrace-dwarf.c
+++ b/tests/backtrace-dwarf.c
@@ -41,6 +41,12 @@ report_pid (Dwfl *dwfl, pid_t pid)
if (dwfl_report_end (dwfl, NULL, NULL) != 0)
error (2, 0, "dwfl_report_end: %s", dwfl_errmsg (-1));
+
+ result = dwfl_linux_proc_attach (dwfl, pid, false);
+ if (result < 0)
+ error (2, 0, "dwfl_linux_proc_attach: %s", dwfl_errmsg (-1));
+ else if (result > 0)
+ error (2, result, "dwfl_linux_proc_attach");
}
static Dwfl *
diff --git a/tests/backtrace.c b/tests/backtrace.c
index 8a7d6dfc..64f90c43 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -279,6 +279,12 @@ report_pid (Dwfl *dwfl, pid_t pid)
if (dwfl_report_end (dwfl, NULL, NULL) != 0)
error (2, 0, "dwfl_report_end: %s", dwfl_errmsg (-1));
+
+ result = dwfl_linux_proc_attach (dwfl, pid, false);
+ if (result < 0)
+ error (2, 0, "dwfl_linux_proc_attach: %s", dwfl_errmsg (-1));
+ else if (result > 0)
+ error (2, result, "dwfl_linux_proc_attach");
}
static Dwfl *