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

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