[Ltrace-devel] Fwd: Couldn't get data of section #0 from "/proc/3829/exe": no error

Petr Machata pmachata at redhat.com
Wed Apr 30 20:33:23 UTC 2014


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.

> 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



More information about the Ltrace-devel mailing list