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

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