<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>It works great. Thank you.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Joe Damato
[mailto:ice799@gmail.com] <br>
<b>Sent:</b> Wednesday, March 31, 2010 2:35 PM<br>
<b>To:</b> Rodrigo Dominguez<br>
<b>Cc:</b> ltrace-devel@lists.alioth.debian.org<br>
<b>Subject:</b> Re: [Ltrace-devel] Tracing dependent libraries<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Hi -<o:p></o:p></p>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>Sorry for the delayed response. Very busy few days. You need
to specify on the command line the name of the symbol you want to trace. I'm
actually not sure if -c works with libdl symbols, but I THINK it does. Please
let me know. If not, I can fix it.<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>You name the symbol on the command line with -x, so for
example I usually use ltrace like this:<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>ltrace -ttTgx functionB -x functionC -x functionD<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>tt - prefix line with time of day in microsecs<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal>T - amount of time spent in the call<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal>g - an option I added to tell ltrace NOT to trace libc --
tracing libc can be noisy and annoying<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal>x - the symbol name I want to trace<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>x will look for the symbol name in the binary and all
currently linked libraries (i.e. if you ltrace attached after dlsym, it'll pick
it up just fine) and if nothing is found it'll listen and attach when the
symbol is dlsym'd later (i.e. if you start your application with ltrace and
dlsym hasnt happened yet).<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>let me know if it works for you --<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal>joe<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
<div>
<p class=MsoNormal>On Tue, Mar 30, 2010 at 1:13 PM, Rodrigo Dominguez <<a
href="mailto:roddomi@hotmail.com">roddomi@hotmail.com</a>> wrote:<o:p></o:p></p>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'>Joe,<br>
<br>
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):<br>
<br>
#include <dlfcn.h><br>
<br>
int main(void)<br>
{<br>
void *handle;<br>
int (*myFunctionB)(void);<br>
<br>
handle = dlopen("./libB.so", RTLD_LAZY);<br>
myFunctionB = dlsym(handle, "functionB");<br>
(*myFunctionB)();<br>
<br>
return 0;<br>
}<br>
<br>
Neither the system ltrace nor your ltrace show the call to functionB. This is
the output:<br>
<br>
$ ltrace -c ./a.out<br>
Inside libB::functionB<br>
% time seconds usecs/call
calls function<br>
------ ----------- ----------- --------- --------------------<br>
99.36
0.003254
3254 1 dlopen<br>
0.64
0.000021
21 1 dlsym<br>
------ ----------- ----------- --------- --------------------<br>
100.00
0.003275
2 total<br>
<br>
Am I missing something? Or am I misunderstanding the libdl support you added?<br>
<br>
Thank you.<o:p></o:p></p>
<div class=MsoNormal align=center style='text-align:center'>
<hr size=2 width="100%" align=center>
</div>
<p class=MsoNormal>Date: Tue, 30 Mar 2010 11:53:02 -0700<o:p></o:p></p>
<div>
<p class=MsoNormal><br>
Subject: Re: [Ltrace-devel] Tracing dependent libraries<o:p></o:p></p>
</div>
<p class=MsoNormal>From: <a href="mailto:ice799@gmail.com" target="_blank">ice799@gmail.com</a><br>
To: <a href="mailto:roddomi@hotmail.com" target="_blank">roddomi@hotmail.com</a>;
<a href="mailto:ltrace-devel@lists.alioth.debian.org" target="_blank">ltrace-devel@lists.alioth.debian.org</a><o:p></o:p></p>
<div>
<div>
<p class=MsoNormal><br>
<br>
Replying to this on-list just incase other people have this problem.<o:p></o:p></p>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>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.<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>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.<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>There are two solutions:<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>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.<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>or<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>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<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>That will create a local branch called
"before_unwind" (the first byte of the sha before the libunwind
commit are a95f1).<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>The downside is that if you do this you lose some of the man
page cleanup and a small bugfix.<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>Sorry for the pain.<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>joe<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
<div>
<p class=MsoNormal>On Tue, Mar 30, 2010 at 11:11 AM, Rodrigo Dominguez <<a
href="mailto:roddomi@hotmail.com" target="_blank">roddomi@hotmail.com</a>>
wrote:<o:p></o:p></p>
<div>
<div>
<p><span style='font-size:11.0pt;color:#1F497D'>Thanks. I was able to checkout
your code.</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>I am getting the following errors
after ‘./configure && make’</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>make -C sysdeps/linux-gnu</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>make[1]: Entering directory
`/home/rdomingu/ltrace/sysdeps/linux-gnu'</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>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</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>In file included from
events.c:12:</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>/home/rdomingu/ltrace/common.h:1:23:
error: libunwind.h: No such file or directory</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>In file included from
/home/rdomingu/ltrace/common.h:11,</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
from events.c:12:</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>/home/rdomingu/ltrace/elf.h:4:18:
error: gelf.h: No such file or directory</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>In file included from
/home/rdomingu/ltrace/common.h:11,</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>
from events.c:12:</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>/home/rdomingu/ltrace/elf.h:9:
error: expected specifier-qualifier-list before âElfâ</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>/home/rdomingu/ltrace/elf.h:50:
error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before
âarch_plt_sym_valâ</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>In file included from
events.c:12:</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>/home/rdomingu/ltrace/common.h:193:
error: expected specifier-qualifier-list before âunw_addr_space_tâ</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>In file included from
events.c:12:</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>/home/rdomingu/ltrace/common.h:234:
error: expected declaration specifiers or â...â before âGElf_Symâ</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>/home/rdomingu/ltrace/common.h:236:
error: expected â)â before âaddrâ</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>make[1]: *** [events.o] Error 1</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>make[1]: Leaving directory
`/home/rdomingu/ltrace/sysdeps/linux-gnu'</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>make: *** [sysdeps/sysdep.o]
Error 2</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<div style='border:none;border-left:solid windowtext 1.5pt;padding:0in 0in 0in 4.0pt;
border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color blue'>
<div>
<div style='border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;
border-color:-moz-use-text-color -moz-use-text-color'>
<p><b><span style='font-size:10.0pt'>From:</span></b><span style='font-size:
10.0pt'> Joe Damato [mailto:<a href="mailto:ice799@gmail.com" target="_blank">ice799@gmail.com</a>]
<br>
<b>Sent:</b> Tuesday, March 30, 2010 1:12 PM</span><o:p></o:p></p>
<div>
<div>
<p class=MsoNormal><br>
<b>To:</b> Rodrigo Dominguez<br>
<b>Cc:</b> <a href="mailto:ltrace-devel@lists.alioth.debian.org" target="_blank">ltrace-devel@lists.alioth.debian.org</a><br>
<b>Subject:</b> Re: [Ltrace-devel] Tracing dependent libraries<o:p></o:p></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</div>
<div>
<div>
<p> <o:p></o:p></p>
<p>Not a dumb question at all. My code isn't part of the official repository,
but it is on github at: git://<a
href="http://github.com/ice799/ltrace.git" target="_blank">github.com/ice799/ltrace.git</a>
<o:p></o:p></p>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>My code is in the branch "libdl"<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>So you should:<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>git clone git://<a href="http://github.com/ice799/ltrace.git"
target="_blank">github.com/ice799/ltrace.git</a><o:p></o:p></p>
</div>
<div>
<p>git checkout -b libdl origin/libdl<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>and you will be sitting in the libdl branch.<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>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.<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>If you have any other questions/issues getting my code or getting it to
build feel free to email me off list.<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>joe<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
<div>
<p>On Tue, Mar 30, 2010 at 9:35 AM, Rodrigo Dominguez <<a
href="mailto:roddomi@hotmail.com" target="_blank">roddomi@hotmail.com</a>>
wrote:<o:p></o:p></p>
<div>
<div>
<p><span style='font-size:11.0pt;color:#1F497D'>Joe,</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>I am sorry for the dumb
question but how do you checkout a branch from github. I am not familiar with
git. I ran:</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>git clone git://<a
href="http://git.debian.org/git/collab-maint/ltrace.git" target="_blank">git.debian.org/git/collab-maint/ltrace.git</a></span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>but this only gets me the
master branch.</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>Thank you.</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<div style='border:none;border-left:solid windowtext 1.5pt;padding:0in 0in 0in 4.0pt;
border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color blue'>
<div>
<div style='border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;
border-color:-moz-use-text-color -moz-use-text-color'>
<p><b><span style='font-size:10.0pt'>From:</span></b><span style='font-size:
10.0pt'> Joe Damato [mailto:<a href="mailto:ice799@gmail.com" target="_blank">ice799@gmail.com</a>]
<br>
<b>Sent:</b> Tuesday, March 09, 2010 5:20 PM<br>
<b>To:</b> Rodrigo Dominguez<br>
<b>Cc:</b> <a href="mailto:ltrace-devel@lists.alioth.debian.org" target="_blank">ltrace-devel@lists.alioth.debian.org</a><br>
<b>Subject:</b> Re: [Ltrace-devel] Tracing dependent libraries</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p> <o:p></o:p></p>
<p style='margin-bottom:12.0pt'>I implemented support for libdl and you can get
that tree from github: <a href="http://github.com/ice799/ltrace/tree/libdl"
target="_blank">http://github.com/ice799/ltrace/tree/libdl</a><o:p></o:p></p>
<div>
<p>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.<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>otherwise as soon as i have time to do it (probably later this month), i can
implement it.<o:p></o:p></p>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>joe <o:p></o:p></p>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>On Tue, Mar 9, 2010 at 2:13 PM, Rodrigo Dominguez <<a
href="mailto:roddomi@hotmail.com" target="_blank">roddomi@hotmail.com</a>>
wrote:<o:p></o:p></p>
<p>How can I get ltrace to trace dependent libraries (libraries called from<br>
within libraries)? All I was able to find was this old post:<br>
<br>
<a href="http://sourceware.org/ml/binutils/2006-09/msg00009.html"
target="_blank">http://sourceware.org/ml/binutils/2006-09/msg00009.html</a><br>
<br>
Has this been implemented since then?<br>
<br>
Thank you.<br>
<br>
<br>
_______________________________________________<br>
Ltrace-devel mailing list<br>
<a href="mailto:Ltrace-devel@lists.alioth.debian.org" target="_blank">Ltrace-devel@lists.alioth.debian.org</a><br>
<a href="http://lists.alioth.debian.org/mailman/listinfo/ltrace-devel"
target="_blank">http://lists.alioth.debian.org/mailman/listinfo/ltrace-devel</a><o:p></o:p></p>
</div>
<p> <o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p> <o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</div>
</div>
</body>
</html>