Trying to use objdump command in linux to display symbol table information in executable. i have tried a simple program below.
#include<stdio.h>
int global = 0;
typedef struct global_struct{
int a;
int c;
}global_struct;
global_struct gs;
int main()
{
printf("%d\n",global);
printf("%d\n",gs.a);
return 0;
}
compiled with -g option in gcc compiler The output of objdump looks like
00000000004005b0 l F .text 0000000000000000 __do_global_ctors_aux 0000000000000000 l df *ABS* 0000000000000000 symboltable.c 0000000000600870 l O .got.plt 0000000000000000 _GLOBAL_OFFSET_TABLE_ 00000000006006ac l .ctors 0000000000000000 __init_array_end 00000000006006ac l .ctors 0000000000000000 __init_array_start 00000000006006d8 l O .dynamic 0000000000000000 _DYNAMIC 0000000000600898 w .data 0000000000000000 data_start 00000000006008b4 g O .bss 0000000000000008 gs 0000000000000000 F *UND* 0000000000000000 printf@@GLIBC_2.2.5 0000000000400510 g F .text 0000000000000002 __libc_csu_fini 00000000004003e0 g F .text 0000000000000000 _start 0000000000000000 w *UND* 0000000000000000 __gmon_start__ 0000000000000000 w *UND* 0000000000000000 _Jv_RegisterClasses 00000000004005e8 g F .fini 0000000000000000 _fini 0000000000000000 F *UND* 0000000000000000 __libc_start_main@@GLIBC_2.2 00000000006008b0 g O .bss 0000000000000004 global 00000000004005f8 g O .rodata 0000000000000004 _IO_stdin_used 0000000000600898 g .data 0000000000000000 __data_start 0000000000400600 g O .rodata 0000000000000000 .hidden __dso_handle 00000000006006c8 g O .dtors 0000000000000000 .hidden __DTOR_END__ 0000000000400520 g F .text 0000000000000089 __libc_csu_init 000000000060089c g *ABS* 0000000000000000 __bss_start 00000000006008c0 g *ABS* 0000000000000000 _end
My requirement is gs being C structure, I want to know the data members of gs{a,b}. How can i know structure member details from object files. Thanks for your support
debug_
prefix.