<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2014-04-30 22:33 GMT+02:00 Petr Machata <span dir="ltr"><<a href="mailto:pmachata@redhat.com" target="_blank">pmachata@redhat.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="">Ciapata Koza <<a href="mailto:ciapatakoza@gmail.com">ciapatakoza@gmail.com</a>> writes:<br>
<br>
> I have got trouble with usage of ltrace.<br>
<br>
</div>What version of ltrace is this? From what sources? ARM hasn't been<br>
properly supported in 0.6.0 and 0.7.x with recent kernels, but the<br>
failure that you cite is not what I'd expect.<br>
<div class=""><br></div></blockquote><div><br>ltrace 0.7.91 obtained from <code>git://<a href="http://git.debian.org/git/collab-maint/ltrace.git">git.debian.org/git/collab-maint/ltrace.git</a></code><br>libelf-0.8.13<br>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="">
> I have done build under raspbian (arm), no errors everything looks fine.<br>
><br>
> Binary can be run (help will be displayed), but when I try to really use<br>
> ltrace( ./ltrace ls ) then I get an error:<br>
><br>
> Couldn't get data of section #0 from "/proc/3829/exe": no error<br>
<br>
</div>The message comes from here:<br>
<br>
scn = elf_getscn(lte->elf, i);<br>
if (scn == NULL || gelf_getshdr(scn, &shdr) == NULL) {<br>
fprintf(stderr, "Couldn't get section #%d from"<br>
" \"%s\": %s\n", i, filename, elf_errmsg(-1));<br>
exit(EXIT_FAILURE);<br>
}<br>
<br>
You'll have to figure out why either elf_getscn or gelf_getshdr return<br>
NULL. That might be a problem in libelf, or maybe we somehow pass<br>
lte->elf == NULL to elf_getscn (which would be a problem in ltrace).<br>
<br>
Building with the following patch might tell us more:<br>
<br>
diff --git a/ltrace-elf.c b/ltrace-elf.c<br>
index f638342..de932a1 100644<br>
--- a/ltrace-elf.c<br>
+++ b/ltrace-elf.c<br>
@@ -582,7 +582,9 @@ ltelf_read_elf(struct ltelf *lte, const char *filename)<br>
GElf_Shdr shdr;<br>
const char *name;<br>
<br>
+ assert (lte->elf != NULL);<br>
scn = elf_getscn(lte->elf, i);<br>
+ assert (scn != NULL);<br>
if (scn == NULL || gelf_getshdr(scn, &shdr) == NULL) {<br>
fprintf(stderr, "Couldn't get section #%d from"<br>
" \"%s\": %s\n", i, filename,<br>
elf_errmsg(-1));<br>
<br>
Thanks,<br>
PM<br>
</blockquote></div><br></div><div class="gmail_extra">This code change nothing changed, no assertion is thrown.<br><br></div><div class="gmail_extra">To compile it I used following lines:<br>./autogen.sh armv7l-*-linux-gnueabihf<br>
<br>./configure --host=arm-linux-gnueabi --enable-static --disable-shared --enable-static=no --with-libelf=/home/pi/src/libelf-0.8.13/<br></div><div class="gmail_extra">OR<br>./configure --enable-static --disable-shared --enable-static=no --with-libelf=/home/pi/src/libelf-0.8.13/<br>
<br>make "CFLAGS=-static -static-libgcc -Wl, -Bstatic -static-libstdc++ -Wl, -Bstatic -L."<br></div><div class="gmail_extra">OR<br></div><div class="gmail_extra">make<br><br></div><div class="gmail_extra">./ltrace pwd<br>
</div><div class="gmail_extra"><br>Output:<br>root@raspberrypi:/home/pi/src/ltrace# ./ltrace pwd<br>Couldn't get data of section #0 from "/proc/14845/exe": no error<br>root@raspberrypi:/home/pi/src/ltrace# /home/pi/src/ltrace<br>
<br></div><div class="gmail_extra">And after it hangs...<br></div><div class="gmail_extra"><br><br></div></div>