[Ltrace-devel] Tracing dependent libraries
Rodrigo Dominguez
roddomi at hotmail.com
Tue Mar 30 20:13:13 UTC 2010
Joe,
Option 2 below compiles on my system. However, I am not sure I am
getting the libdl features you added. I wrote a small test program that
uses dlopen to load a library file I created (libB.so):
#include <dlfcn.h>
int main(void)
{
void *handle;
int (*myFunctionB)(void);
handle = dlopen("./libB.so", RTLD_LAZY);
myFunctionB = dlsym(handle, "functionB");
(*myFunctionB)();
return 0;
}
Neither the system ltrace nor your ltrace show the call to functionB. This is the output:
$ ltrace -c ./a.out
Inside libB::functionB
% time seconds usecs/call calls function
------ ----------- ----------- --------- --------------------
99.36 0.003254 3254 1 dlopen
0.64 0.000021 21 1 dlsym
------ ----------- ----------- --------- --------------------
100.00 0.003275 2 total
Am I missing something? Or am I misunderstanding the libdl support you added?
Thank you.
Date: Tue, 30 Mar 2010 11:53:02 -0700
Subject: Re: [Ltrace-devel] Tracing dependent libraries
From: ice799 at gmail.com
To: roddomi at hotmail.com; ltrace-devel at lists.alioth.debian.org
Replying to this on-list just incase other people have this problem.
Not sure if I ever submit this patch back to the list, but I added support for backtraces so you can see the function call stack for traced functions.
The problem with this feature is that I didn't take the time to fix the configure script so that it would disable that code if you don't have libunwind on your system.
There are two solutions:
1.) The simplest solution (until I or some one else fixes the configure script) is to install libunwind library and header files on your system and try building my branch again.
or
2.) Rewind the source tree in git to before that commit was made. To do this you can just: git checkout a95f1 -b before_unwind
That will create a local branch called "before_unwind" (the first byte of the sha before the libunwind commit are a95f1).
The downside is that if you do this you lose some of the man page cleanup and a small bugfix.
Sorry for the pain.
joe
On Tue, Mar 30, 2010 at 11:11 AM, Rodrigo Dominguez <roddomi at hotmail.com> wrote:
Thanks. I was able to checkout your code.
I am getting the following errors after ‘./configure
&& make’
make -C sysdeps/linux-gnu
make[1]: Entering directory
`/home/rdomingu/ltrace/sysdeps/linux-gnu'
gcc -Wall -g -O2 -iquote /home/rdomingu/ltrace -iquote
/home/rdomingu/ltrace/sysdeps/linux-gnu
-DSYSCONFDIR=\"/usr/local/etc\" -I /usr/include/libelf
-I/home/rdomingu/ltrace/sysdeps/linux-gnu/x86_64 -c -o events.o events.c
In file included from events.c:12:
/home/rdomingu/ltrace/common.h:1:23: error: libunwind.h: No such
file or directory
In file included from /home/rdomingu/ltrace/common.h:11,
from events.c:12:
/home/rdomingu/ltrace/elf.h:4:18: error: gelf.h: No such file or
directory
In file included from /home/rdomingu/ltrace/common.h:11,
from events.c:12:
/home/rdomingu/ltrace/elf.h:9: error: expected
specifier-qualifier-list before âElfâ
/home/rdomingu/ltrace/elf.h:50: error: expected â=â,
â,â, â;â, âasmâ or â__attribute__â
before âarch_plt_sym_valâ
In file included from events.c:12:
/home/rdomingu/ltrace/common.h:193: error: expected
specifier-qualifier-list before âunw_addr_space_tâ
In file included from events.c:12:
/home/rdomingu/ltrace/common.h:234: error: expected declaration
specifiers or â...â before âGElf_Symâ
/home/rdomingu/ltrace/common.h:236: error: expected
â)â before âaddrâ
make[1]: *** [events.o] Error 1
make[1]: Leaving directory
`/home/rdomingu/ltrace/sysdeps/linux-gnu'
make: *** [sysdeps/sysdep.o] Error 2
From: Joe Damato
[mailto:ice799 at gmail.com]
Sent: Tuesday, March 30, 2010 1:12 PM
To: Rodrigo Dominguez
Cc: ltrace-devel at lists.alioth.debian.org
Subject: Re: [Ltrace-devel] Tracing dependent libraries
Not a dumb question at all. My code isn't part of the
official repository, but it is on github at: git://github.com/ice799/ltrace.git
My code is in the branch "libdl"
So you should:
git clone git://github.com/ice799/ltrace.git
git checkout -b libdl origin/libdl
and you will be sitting in the libdl branch.
You can take a look at the commits on that branch by doing
git log. If a particular commit interests you, you can git show <sha> to
look at the diff.
If you have any other questions/issues getting my code or
getting it to build feel free to email me off list.
joe
On Tue, Mar 30, 2010 at 9:35 AM, Rodrigo Dominguez <roddomi at hotmail.com>
wrote:
Joe,
I am sorry for the dumb question but how
do you checkout a branch from github. I am not familiar with git. I ran:
git clone git://git.debian.org/git/collab-maint/ltrace.git
but this only gets me the master branch.
Thank you.
From: Joe
Damato [mailto:ice799 at gmail.com]
Sent: Tuesday, March 09, 2010 5:20 PM
To: Rodrigo Dominguez
Cc: ltrace-devel at lists.alioth.debian.org
Subject: Re: [Ltrace-devel] Tracing dependent libraries
I
implemented support for libdl and you can get that tree from github: http://github.com/ice799/ltrace/tree/libdl
I
have *not* implemented tracing calls from libraries to other libraries, though.
doing that should be pretty straightforward. i don't really have the cycles
right now to implement that in the near term but I am willing to point people
in the right direction if they are interested in implementing it.
otherwise
as soon as i have time to do it (probably later this month), i can implement it.
joe
On
Tue, Mar 9, 2010 at 2:13 PM, Rodrigo Dominguez <roddomi at hotmail.com>
wrote:
How
can I get ltrace to trace dependent libraries (libraries called from
within libraries)? All I was able to find was this old post:
http://sourceware.org/ml/binutils/2006-09/msg00009.html
Has this been implemented since then?
Thank you.
_______________________________________________
Ltrace-devel mailing list
Ltrace-devel at lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/ltrace-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/ltrace-devel/attachments/20100330/327c774f/attachment.htm>
More information about the Ltrace-devel
mailing list