Month: June 2015

libelf include issue

When you meet this:

../../library/libpeter/io.h:43:1: warning: (this will be reported only once per input file)
In file included from /toolchain/include/libelf/libelf.h:31:0,
                 from /toolchain/include/libelf.h:1,
                 from pshell.c:13:
/toolchain/include/libelf/sys_elf.h:70:32: fatal error: elf.h: No such file or directory
 # include __LIBELF_HEADER_ELF_H

Just comment out the following line in /toolchain/include/libelf/sys_elf.h

/* Define to `<elf.h>' or `<sys/elf.h>' if one of them is present */
#define __LIBELF_HEADER_ELF_H <elf.h>

When I build the libelf in mac and in linux, the output sys_elf.h is different, in mac, the above line is not exist, so my OS is able to compile.


read count : 168

How to lookup the value of each parameter from dwarf and memory location

Here are the steps to lookup the parameter value

1) Look into the “info” section from dwarf, “objdump –dwarf=info”. There is a die DW_AT_LOCATION (DW_OP_freg:0), telling you the offset to the frame register.

2) Look at the CIE from .eh_frames section, “objdump –dwarf=frames”. It will tell you the formula of calculating the CFA, such as DW_CFA_def_cfa: r4 (esp) of 4

3) Add the value of DW_OP_freg as an offset to DW_CFA_def_cfa and get the value from that memory location, it is a virtual address, not physical address.

read count : 330