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

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