Wednesday 15 February 2012

linux - How to get segment addresses from executable file and find stack address -



linux - How to get segment addresses from executable file and find stack address -

i need start , end of segments can executable file , instance using objdump command (text,data,bss). need obtain info file phone call from(program should retrieve info itself). how can this. have tried start , end addresses of stack segment. have tried address of first , lastly local variables, show part of total stack. how can addresses of total stack ?

i grateful help. thx in advance.

i need start , end of segments can executable file , instance using size command (text,data,bss).

the .text, .data , .bss sections, not segments. sections may not nowadays in file at all, segments must (only segments required @ runtime).

how can this.

study /usr/include/elf.h, , many resources available on web. each elf file begins elf{32,64}_ehdr, contains .e_phoff , .e_phnum. using these members, can find , decode segment table. can utilize .e_shoff , .e_shnum find section table (if present).

also have tried start , end addresses of stack segment

you can't: stack start not contained in binary, dynamically determined kernel @ process start time. further, end of stack dynamic property of running program, , depends on programme doing, ulimit settings.

linux stack elf segment

No comments:

Post a Comment