diff options
author | Petr Machata <pmachata@redhat.com> | 2014-05-06 12:53:03 +0200 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-08-22 20:38:25 +0900 |
commit | 796fb77897be01fd85a7a21aa31b68d4f3909308 (patch) | |
tree | 26edf160f753b17f155909a0e99e028870b924da | |
parent | 70c93e2e194b81dcafbeecb537f6915253791690 (diff) | |
download | ltrace-796fb77897be01fd85a7a21aa31b68d4f3909308.tar.gz ltrace-796fb77897be01fd85a7a21aa31b68d4f3909308.tar.bz2 ltrace-796fb77897be01fd85a7a21aa31b68d4f3909308.zip |
Fix lookup of prototypes from non-leader threads
-rw-r--r-- | output.c | 2 | ||||
-rw-r--r-- | testsuite/ltrace.main/parameters3.exp | 35 |
2 files changed, 35 insertions, 2 deletions
@@ -531,7 +531,7 @@ output_left(enum tof type, struct process *proc, account_output(¤t_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(¤t_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@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@liba.so\(\)} == 1 +ltraceMatch1 [ltraceRun -F $dir -f -e fun -- $bin] {fun\(\)} == 1 + ltraceDone |