Nm utility
The nm utility outputs to the standard device a table of symbols for each file specified in the argument list.symbol tables arec used to debug applications. The utility displays the name of each symbol and in formation about its type: a data symbol(a variable), a program symbol (a label or a function name), and so on.
Ex:-
nm ./hello1
./hello1:
080494bc d _DYNAMIC
08049590 d _GLOBAL_OFFSET_TABLE_
0804848c R _IO_stdin_used
w _Jv_RegisterClasses
080494ac d __CTOR_END__
080494a8 d __CTOR_LIST__
080494b4 d __DTOR_END__
080494b0 d __DTOR_LIST__
080484a4 r __FRAME_END__
080494b8 d __JCR_END__
080494b8 d __JCR_LIST__
080495b4 A __bss_start
080495a8 D __data_start
08048440 t __do_global_ctors_aux
08048320 t __do_global_dtors_aux
080495ac D __dso_handle
w __gmon_start__
0804843a T __i686.get_pc_thunk.bx
080494a8 d __init_array_end
080494a8 d __init_array_start
080483d0 T __libc_csu_fini
080483e0 T __libc_csu_init
U __libc_start_main@@GLIBC_2.0
080495b4 A _edata
080495b8 A _end
0804846c T _fini
08048488 R _fp_hw
08048274 T _init
080482f0 T _start
080495b4 b completed.5843
080495a8 W data_start
08048350 t frame_dummy
08048374 T main
080495b0 d p.5841
U puts@@GLIBC_2.0
Strip utility
when a program has been debugged, the symbol table can be deleted from it. This is accomplished using the strip utility.
ex:- strip ./your_prog
Size
The size utility displays section sizes in each of the specified files. By default, the size of only the command(.text) , data (.data), and un -initialized data (.bss) sections and the total size of these sections are listed in the decimal and hexadecimal format.
to list the sizes of all sections in the file, the -A flag is used.
Ex:-
size ./hello1
text data bss dec hex filename
852 268 4 1124 464 ./hello1
Ex:-
size -A ./hello1
./hello1 :
section size addr
.interp 19 134512916
.note.ABI-tag 32 134512936
.hash 40 134512968
.gnu.hash 32 134513008
.dynsym 80 134513040
.dynstr 74 134513120
.gnu.version 10 134513194
.gnu.version_r 32 134513204
.rel.dyn 8 134513236
.rel.plt 24 134513244
.init 48 134513268
.plt 64 134513316
.text 380 134513392
.fini 28 134513772
.rodata 25 134513800
.eh_frame 4 134513828
.ctors 8 134517928
.dtors 8 134517936
.jcr 4 134517944
.dynamic 208 134517948
.got 4 134518156
.got.plt 24 134518160
.data 12 134518184
.bss 4 134518196
.comment 294 0
.debug_aranges 112 0
.debug_pubnames 64 0
.debug_info 770 0
.debug_abbrev 215 0
.debug_line 358 0
.debug_frame 80 0
.debug_str 187 0
.debug_loc 67 0
.debug_ranges 64 0
Total 3383
NB:- verified on gcc version 4.2.4
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment