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

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