[SOLVED] I would like to know what library is used to programmatically read custom variable structure information in ELF files?

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] I would like to know what library is used to programmatically read custom variable structure information in ELF files?

    a ELF file contains debug info, then the types of variables, structures, and great many other kinds of info can be extracted from that binary.Theoretically possible, but I don't know how to program the implementation by c language
    For example if I have an embedded struct and variable like this:

    typedef struct

    {

    unsigned int varA;

    unsigned int varB;

    }T_myStruct;



    T_myStruct data;

    I want to get the address and type of not only data, but preferably data.varA and data.varB. I used segger ELFlib without success, and I was wondering if there was a more suitable library.
  • If the variable is a static / global one and therefore is valid over the whole program lifetime, SEGGER ELFLib is the way to go.

    If it is a local one, things get more complicated because it is located on the stack and only valid while in scope.
    It also does not have any fixed absolute address then but is located relative to the stack frame of the function it is in.

    If you have licensed the ELFLib, did you consider issuing an official support ticket when running into an issue?
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.