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

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