Hi Martin,
On Mon, 2022-12-19 at 15:19 +0100, Martin Liška wrote:
> On 12/15/22 14:17, Mark Wielaard wrote:
> > Is there a particular way you are running eu-readelf? Is it with
> > generic -w or -a, or decoding a specific section type?
>
> Hello.
>
> $ LD_LIBRARY_PATH=./libelf ./src/readelf -w
> ~/Programming/testcases/a.out
>
> where I get:
>
> ./src/readelf: cannot get debug context descriptor: No DWARF
> information found
>
> DWARF section [37] '.debug_info' at offset 0x1ab2:
> [Offset]
> ./src/readelf: cannot get next unit: no error
>
> Call frame information section [13] '.eh_frame' at offset 0x4a8:
> ...
>
>
> t��o5��=I�iAp@a����S^R/<�����^�qi�ַp@
[...]
> So basically a garbage. And I don't know how to bail out properly?
Aha. If you have that a.out somewhere I can take a look. I suspect this
is because we expect all .debug sections to have been decompressed in
libdw/dwarf_begin_elf.c, but that isn't really true, see check_section
in that file which has:
if ((shdr->sh_flags & SHF_COMPRESSED) != 0)
{
if (elf_compress (scn, 0, 0) < 0)
{
/* It would be nice if we could fail with a specific error.
But we don't know if this was an essential section or not.
So just continue for now. See also valid_p(). */
return result;
}
}
We should probably adjust valid_p so it produces a more appropriate
error message and/or add additional checks in readlelf.c.
But lets do that after this patch goes in.
Cheers,
Mark