<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
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&nbsp; I created (libB.so):<br>
<br>
#include &lt;dlfcn.h&gt;<br>
<br>
int main(void)<br>
{<br>
&nbsp;&nbsp;&nbsp; void *handle;<br>
&nbsp;&nbsp;&nbsp; int (*myFunctionB)(void);<br>
<br>
&nbsp;&nbsp;&nbsp; handle = dlopen("./libB.so", RTLD_LAZY);<br>
&nbsp;&nbsp;&nbsp; myFunctionB = dlsym(handle, "functionB");<br>
&nbsp;&nbsp;&nbsp; (*myFunctionB)();<br>
<br>
&nbsp;&nbsp;&nbsp; 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&nbsp;&nbsp;&nbsp;&nbsp; seconds&nbsp; usecs/call&nbsp;&nbsp;&nbsp;&nbsp; calls&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function<br>
------ ----------- ----------- --------- --------------------<br>
&nbsp;99.36&nbsp;&nbsp;&nbsp; 0.003254&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3254&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 dlopen<br>
&nbsp; 0.64&nbsp;&nbsp;&nbsp; 0.000021&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 21&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 dlsym<br>
------ ----------- ----------- --------- --------------------<br>
100.00&nbsp;&nbsp;&nbsp; 0.003275&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 total<br>
<br>
Am I missing something? Or am I misunderstanding the libdl support you added?<br>
<br>
Thank you.<br><br><hr id="stopSpelling">Date: Tue, 30 Mar 2010 11:53:02 -0700<br>Subject: Re: [Ltrace-devel] Tracing dependent libraries<br>From: ice799@gmail.com<br>To: roddomi@hotmail.com; ltrace-devel@lists.alioth.debian.org<br><br>Replying to this on-list just incase other people have this problem.<div><br></div><div>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.</div>
<div><br></div><div>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.</div><div><br></div><div>
There are two solutions:</div><div><br></div><div>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.</div>
<div><br></div><div>or</div><div><br></div><div>2.) Rewind the source tree in git to before that commit was made. To do this you can just:&nbsp;git checkout a95f1 -b before_unwind</div><div><br></div><div>That will create a local branch called "before_unwind" (the first byte of the sha before the libunwind commit are a95f1).</div>
<div><br></div><div>The downside is that if you do this you lose some of the man page cleanup and a small bugfix.</div><div><br></div><div>Sorry for the pain.</div><div><br></div><div>joe</div><div><br><div class="ecxgmail_quote">
On Tue, Mar 30, 2010 at 11:11 AM, Rodrigo Dominguez <span dir="ltr">&lt;<a href="mailto:roddomi@hotmail.com">roddomi@hotmail.com</a>&gt;</span> wrote:<br><blockquote class="ecxgmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">










<div lang="EN-US">

<div>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Thanks. I was able to checkout your code.</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">I am getting the following errors after ‘./configure
&amp;&amp; make’</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">make -C sysdeps/linux-gnu</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">make[1]: Entering directory
`/home/rdomingu/ltrace/sysdeps/linux-gnu'</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">gcc -Wall -g -O2 -iquote /home/rdomingu/ltrace -iquote
/home/rdomingu/ltrace/sysdeps/linux-gnu
-DSYSCONFDIR=\"/usr/local/etc\"&nbsp; -I /usr/include/libelf
-I/home/rdomingu/ltrace/sysdeps/linux-gnu/x86_64&nbsp; -c -o events.o events.c</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">In file included from events.c:12:</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">/home/rdomingu/ltrace/common.h:1:23: error: libunwind.h: No such
file or directory</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">In file included from /home/rdomingu/ltrace/common.h:11,</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
from events.c:12:</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">/home/rdomingu/ltrace/elf.h:4:18: error: gelf.h: No such file or
directory</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">In file included from /home/rdomingu/ltrace/common.h:11,</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
from events.c:12:</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">/home/rdomingu/ltrace/elf.h:9: error: expected
specifier-qualifier-list before âElfâ</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">/home/rdomingu/ltrace/elf.h:50: error: expected â=â,
â,â, â;â, âasmâ or â__attribute__â
before âarch_plt_sym_valâ</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">In file included from events.c:12:</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">/home/rdomingu/ltrace/common.h:193: error: expected
specifier-qualifier-list before âunw_addr_space_tâ</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">In file included from events.c:12:</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">/home/rdomingu/ltrace/common.h:234: error: expected declaration
specifiers or â...â before âGElf_Symâ</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">/home/rdomingu/ltrace/common.h:236: error: expected
â)â before âaddrâ</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">make[1]: *** [events.o] Error 1</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">make[1]: Leaving directory
`/home/rdomingu/ltrace/sysdeps/linux-gnu'</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">make: *** [sysdeps/sysdep.o] Error 2</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>

<div style="border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color blue; border-width: medium medium medium 1.5pt; padding: 0in 0in 0in 4pt;">

<div>

<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0in 0in;">

<p class="ecxMsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> Joe Damato
[mailto:<a href="mailto:ice799@gmail.com">ice799@gmail.com</a>] <br>
<b>Sent:</b> Tuesday, March 30, 2010 1:12 PM</span></p><div><div></div><div class="h5"><br>
<b>To:</b> Rodrigo Dominguez<br>
<b>Cc:</b> <a href="mailto:ltrace-devel@lists.alioth.debian.org">ltrace-devel@lists.alioth.debian.org</a><br>
<b>Subject:</b> Re: [Ltrace-devel] Tracing dependent libraries</div></div><BR>

</div>

</div><div><div></div><div class="h5">

<p class="ecxMsoNormal">&nbsp;</p>

<p class="ecxMsoNormal">Not a dumb question at all. My code isn't part of the
official repository, but it is on github&nbsp;at:&nbsp;git://<a href="http://github.com/ice799/ltrace.git">github.com/ice799/ltrace.git</a>
</p>

<div>

<p class="ecxMsoNormal">&nbsp;</p>

</div>

<div>

<p class="ecxMsoNormal">My code is in the branch "libdl"</p>

</div>

<div>

<p class="ecxMsoNormal">&nbsp;</p>

</div>

<div>

<p class="ecxMsoNormal">So you should:</p>

</div>

<div>

<p class="ecxMsoNormal">&nbsp;</p>

</div>

<div>

<p class="ecxMsoNormal">git clone&nbsp;git://<a href="http://github.com/ice799/ltrace.git">github.com/ice799/ltrace.git</a></p>

</div>

<div>

<p class="ecxMsoNormal">git checkout -b libdl origin/libdl</p>

</div>

<div>

<p class="ecxMsoNormal">&nbsp;</p>

</div>

<div>

<p class="ecxMsoNormal">and you will be sitting in the libdl branch.</p>

</div>

<div>

<p class="ecxMsoNormal">&nbsp;</p>

</div>

<div>

<p class="ecxMsoNormal">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 &lt;sha&gt; to
look at the diff.</p>

</div>

<div>

<p class="ecxMsoNormal">&nbsp;</p>

</div>

<div>

<p class="ecxMsoNormal">If you have any other questions/issues getting my code or
getting it to build feel free to email me off list.</p>

</div>

<div>

<p class="ecxMsoNormal">&nbsp;</p>

</div>

<div>

<p class="ecxMsoNormal">joe</p>

</div>

<div>

<p class="ecxMsoNormal">&nbsp;</p>

<div>

<p class="ecxMsoNormal">On Tue, Mar 30, 2010 at 9:35 AM, Rodrigo Dominguez &lt;<a href="mailto:roddomi@hotmail.com">roddomi@hotmail.com</a>&gt;
wrote:</p>

<div>

<div>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Joe,</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">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></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">git clone git://<a href="http://git.debian.org/git/collab-maint/ltrace.git">git.debian.org/git/collab-maint/ltrace.git</a></span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">but this only gets me the master branch.</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Thank you.</span></p>

<p class="ecxMsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>

<div style="border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color blue; border-width: medium medium medium 1.5pt; padding: 0in 0in 0in 4pt;">

<div>

<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0in 0in;">

<p class="ecxMsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> Joe
Damato [mailto:<a href="mailto:ice799@gmail.com">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">ltrace-devel@lists.alioth.debian.org</a><br>
<b>Subject:</b> Re: [Ltrace-devel] Tracing dependent libraries</span></p>

</div>

</div>

<div>

<div>

<p class="ecxMsoNormal">&nbsp;</p>

<p class="ecxMsoNormal" style="margin-bottom: 12pt;">I
implemented support for libdl and you can get that tree from github: <a href="http://github.com/ice799/ltrace/tree/libdl">http://github.com/ice799/ltrace/tree/libdl</a></p>

<div>

<p class="ecxMsoNormal">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.</p>

</div>

<div>

<p class="ecxMsoNormal">&nbsp;</p>

</div>

<div>

<p class="ecxMsoNormal">otherwise
as soon as i have time to do it (probably later this month), i can implement it.</p>

<div>

<p class="ecxMsoNormal">&nbsp;</p>

</div>

<div>

<p class="ecxMsoNormal">joe&nbsp;</p>

<div>

<p class="ecxMsoNormal">&nbsp;</p>

</div>

<div>

<p class="ecxMsoNormal">On
Tue, Mar 9, 2010 at 2:13 PM, Rodrigo Dominguez &lt;<a href="mailto:roddomi@hotmail.com">roddomi@hotmail.com</a>&gt;
wrote:</p>

<p class="ecxMsoNormal">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">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">Ltrace-devel@lists.alioth.debian.org</a><br>
<a href="http://lists.alioth.debian.org/mailman/listinfo/ltrace-devel">http://lists.alioth.debian.org/mailman/listinfo/ltrace-devel</a></p>

</div>

<p class="ecxMsoNormal">&nbsp;</p>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

<p class="ecxMsoNormal">&nbsp;</p>

</div>

</div></div></div>

</div>

</div>


</blockquote></div><br></div>                                               </body>
</html>