Blame SOURCES/ltrace-0.7.91-multithread-no-f-2.patch

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