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