On Tue, 2012-11-13 at 21:30 +0100, Jan Kratochvil wrote:
Current dwfl_report_elf function has parameter "GElf_Addr
base" but it means
bias, not the base address.
If the documentation is wrong/misleading in libdwfl.h we really should
also fix/clarify that.
I admit that I always get a little confused myself. If I got it right
then the bias should refer to the offset from the p_vaddr of an ELF
segment. And the base should refer the low address of the Dwfl_Module,
which is fixed for the main ET_EXEC and ET_CORE at the lowest p_vaddr in
the ELF file, but dynamic for ET_DYN (and the kernel).
Even if I got the above right I might still get confused about the
meaning of the terms for ET_REL (there are no p_hdrs, so the terms don't
really make sense there do they?). So please do correct me if I seem
wrong/confused.
Some applications (such as Linux kernel perf)
cannot easily find out the bias but they know the base address.
I tried to implement it without this function but I could not.
Is using dwfl_report_elf () vs dwfl_report_elf_baseaddr () only
different for ET_DYN files, or does it also change things for reporting
other ELF files?
Thanks,
Mark