[ltrace-commits] 02/02: Fix lookup of prototypes from non-leader threads

Petr Machata pmachata-guest at moszumanska.debian.org
Tue May 6 10:54:56 UTC 2014


This is an automated email from the git hooks/post-receive script.

pmachata-guest pushed a commit to branch master
in repository ltrace.

commit 9b9a9b641311d66d180c1f2b8a1f4c8df8df1d73
Author: Petr Machata <pmachata at redhat.com>
Date:   Tue May 6 12:53:03 2014 +0200

    Fix lookup of prototypes from non-leader threads
---
 output.c                              |  2 +-
 testsuite/ltrace.main/parameters3.exp | 35 ++++++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/output.c b/output.c
index 0cec653..671a5d7 100644
--- a/output.c
+++ b/output.c
@@ -531,7 +531,7 @@ output_left(enum tof type, struct process *proc,
 
 	account_output(&current_column, fprintf(options.output, "("));
 
-	struct prototype *func = lookup_symbol_prototype(proc, libsym);
+	struct prototype *func = lookup_symbol_prototype(proc->leader, libsym);
 	if (func == NULL) {
 	fail:
 		account_output(&current_column, fprintf(options.output, "???"));
diff --git a/testsuite/ltrace.main/parameters3.exp b/testsuite/ltrace.main/parameters3.exp
index d49ecb2..693c219 100644
--- a/testsuite/ltrace.main/parameters3.exp
+++ b/testsuite/ltrace.main/parameters3.exp
@@ -1,5 +1,5 @@
 # This file is part of ltrace.
-# Copyright (C) 2012 Petr Machata, Red Hat Inc.
+# Copyright (C) 2012, 2014 Petr Machata, Red Hat Inc.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License as
@@ -37,4 +37,37 @@ set bin [ltraceCompile {} $liba [ltraceSource c {
 ltraceMatch1 [ltraceRun -F $dir -L -x fun -- $bin] {fun at liba.so\(\)} == 1
 ltraceMatch1 [ltraceRun -F $dir -e fun -- $bin] {fun\(\)} == 1
 
+# This tests lookup of prototypes from non-leader threads.
+
+set bin [ltraceCompile {} $liba -lpthread [ltraceSource c {
+    #include <pthread.h>
+    #include <assert.h>
+
+    void fun();
+
+    void *
+    start(void *arg)
+    {
+	fun();
+	return NULL;
+    }
+
+    int
+    main(int argc, char *argv[])
+    {
+	pthread_t thr;
+	int rc = pthread_create(&thr, NULL, &start, NULL);
+	assert(rc == 0);
+
+	void *retval;
+	rc = pthread_join(thr, &retval);
+	assert(rc == 0);
+
+	return 0;
+    }
+}]]
+
+ltraceMatch1 [ltraceRun -F $dir -f -L -x fun -- $bin] {fun at liba.so\(\)} == 1
+ltraceMatch1 [ltraceRun -F $dir -f -e fun -- $bin] {fun\(\)} == 1
+
 ltraceDone

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/ltrace.git



More information about the ltrace-commits mailing list