The memory address of main()
is a parameter of __libc_start_main
:
int __libc_start_main(int *(main) (int, char * *, char * *), <-----pointer to main
int argc,
char * * ubp_av,
void (*init) (void),
void (*fini) (void),
void (*rtld_fini) (void),
void (* stack_end));
This means we can find the address of main()
when __libc_start_main()
is called in the _start
routine (from crt1.o
).
In x86 environments, the memory address of main()
will be pushed onto the stack prior to calling __libc_start_main()
, but the way arguments are passed to functions depend on the calling convention implemented by the compiler, and this can vary across compiler toolchains and CPU architectures (arguments may be passed in registers instead, for example). You did not give any information regarding the CPU family the object code in your ELF binary targets (beyond the fact that the architecture is 32-bit) or the compiler used to generate the binary, or any sample disassembly, so I can't be more specific.
As far as I know, information about function parameters is not stored in the symbol table, so there is no command to list them.
At runtime, you may use info args
and info locals
to inspect the values of function arguments and local variables if your binary has been compiled with the -g
flag.