Edit (updated question)

I have a simple C program:

   // it is not important to know what the code does you may skip the code 

main.c

#include <bsp.h>

unsigned int   AppCtr;
unsigned char  AppFlag;
int SOME_LARGE_VARIABLE;

static  void  AppTest (void);

void  main (void)
{
    AppCtr  = 0;
    AppFlag = 0;        
    AppTest();
}

static void Foo(void){
    SOME_LARGE_VARIABLE=15; 
}


static  void  AppTest (void)
{
    unsigned int  i;
    i = 0;
    while (i < 200000) {
        i++;
    }

    BSP_Test();      
    SOME_LARGE_VARIABLE=3;    
    Foo();
}

bsp.c

extern int SOME_LARGE_VARIABLE;
extern unsigned char  AppFlag;

unsigned int long My_GREAT_COUNTER;

void  BSP_Test (void) {
  SOME_LARGE_VARIABLE = 5;
  My_GREAT_COUNTER = 4;
}

(the program does not do anything useful... My goal is to extract the variable names their location where they are being declared and their memory address)

When I compile the program I get the file a.out which is an elf file containing debug information.

Someone on the company wrote a program in .net 5 years ago that will get all this information from the a.out file. This is what the code returns:

   //  Name          Display Name                    Type      Size     Address

enter image description here

For this small program it works great and also for other large projects.

That code is 2000 lines long with several bugs and it does not support .NET version 4. That's why I am trying to recreate it.


So my question is, I am lost in the sense that I don't know what approach to take in order to solve this problem. These are the options I have been considering:

  1. Organize the buggy code

Edit
Report