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

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