|
|
920d6f |
From 72ee29639c55b5942bc07c8ed0013005f8fc5a97 Mon Sep 17 00:00:00 2001
|
|
|
920d6f |
From: Petr Machata <pmachata@redhat.com>
|
|
|
920d6f |
Date: Wed, 8 Apr 2015 07:14:10 -0400
|
|
|
920d6f |
Subject: [PATCH 2/2] Fix tracing multi-threaded processes without -f
|
|
|
920d6f |
|
|
|
920d6f |
- In handle_syscall, we avoid touching stack of ignored processes.
|
|
|
920d6f |
But in handle_sysret, we require a sysret-like stack entry even
|
|
|
920d6f |
for ignored processes, even though we then go ahead to not act
|
|
|
920d6f |
on that stack entry. Instead, for ignored processes, avoid looking
|
|
|
920d6f |
at stack trace at all.
|
|
|
920d6f |
---
|
|
|
920d6f |
handle_event.c | 10 +++++-----
|
|
|
920d6f |
testsuite/ltrace.main/main-threaded.exp | 1 +
|
|
|
920d6f |
2 files changed, 6 insertions(+), 5 deletions(-)
|
|
|
920d6f |
|
|
|
920d6f |
diff --git a/handle_event.c b/handle_event.c
|
|
|
920d6f |
index 6fa7e98..c2550ad 100644
|
|
|
920d6f |
--- a/handle_event.c
|
|
|
920d6f |
+++ b/handle_event.c
|
|
|
920d6f |
@@ -619,12 +619,12 @@ handle_x_sysret(Event *event, char *(*name_cb)(struct process *, int))
|
|
|
920d6f |
debug(DEBUG_FUNCTION, "handle_x_sysret(pid=%d, sysnum=%d)",
|
|
|
920d6f |
event->proc->pid, event->e_un.sysnum);
|
|
|
920d6f |
|
|
|
920d6f |
- unsigned d = event->proc->callstack_depth;
|
|
|
920d6f |
- assert(d > 0);
|
|
|
920d6f |
- struct callstack_element *elem = &event->proc->callstack[d - 1];
|
|
|
920d6f |
- assert(elem->is_syscall);
|
|
|
920d6f |
-
|
|
|
920d6f |
if (event->proc->state != STATE_IGNORED) {
|
|
|
920d6f |
+ unsigned d = event->proc->callstack_depth;
|
|
|
920d6f |
+ assert(d > 0);
|
|
|
920d6f |
+ struct callstack_element *elem = &event->proc->callstack[d - 1];
|
|
|
920d6f |
+ assert(elem->is_syscall);
|
|
|
920d6f |
+
|
|
|
920d6f |
struct timedelta spent = calc_time_spent(elem->enter_time);
|
|
|
920d6f |
if (options.syscalls)
|
|
|
920d6f |
output_syscall_right(event->proc,
|
|
|
920d6f |
diff --git a/testsuite/ltrace.main/main-threaded.exp b/testsuite/ltrace.main/main-threaded.exp
|
|
|
920d6f |
index cead82d..aca7afd 100644
|
|
|
920d6f |
--- a/testsuite/ltrace.main/main-threaded.exp
|
|
|
920d6f |
+++ b/testsuite/ltrace.main/main-threaded.exp
|
|
|
920d6f |
@@ -60,5 +60,6 @@ set bin [ltraceCompile {} $libprint -lpthread [ltraceSource c {
|
|
|
920d6f |
}]]
|
|
|
920d6f |
|
|
|
920d6f |
ltraceMatch1 [ltraceRun -f -l libprint.so -- $bin] {print\(} == 30
|
|
|
920d6f |
+ltraceMatch1 [ltraceRun -L -- $bin] exited == 1
|
|
|
920d6f |
|
|
|
920d6f |
ltraceDone
|
|
|
920d6f |
--
|
|
|
920d6f |
2.1.0
|