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

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