linux进程的起始地址,linux应用程序堆和栈起始地址问题

通过cat /proc/进程号/maps获得堆栈地址。

005e9000-00603000 r-xp 00000000 fd:00 4228679    /lib/ld-2.5.so

00603000-00604000 r--p 00019000 fd:00 4228679    /lib/ld-2.5.so

00604000-00605000 rw-p 0001a000 fd:00 4228679    /lib/ld-2.5.so

00607000-00747000 r-xp 00000000 fd:00 4228694    /lib/i686/nosegneg/libc-2.5.so

00747000-00749000 r--p 00140000 fd:00 4228694    /lib/i686/nosegneg/libc-2.5.so

00749000-0074a000 rw-p 00142000 fd:00 4228694    /lib/i686/nosegneg/libc-2.5.so

0074a000-0074d000 rw-p 0074a000 00:00 0

00949000-0094a000 r-xp 00949000 00:00 0          [vdso]

08048000-08049000 r-xp 00000000 fd:00 2066890    /home/temp/a.out

08049000-0804a000 rw-p 00000000 fd:00 2066890    /home/temp/a.out

b7ef2000-b7ef3000 rw-p b7ef2000 00:00 0

b7f07000-b7f09000 rw-p b7f07000 00:00 0

bf946000-bf95c000 rw-p bf946000 00:00 0          [stack]

要想获得更具体的信息,可以使用readelf -S 可执行文件名,获得数据放在虚拟内存的什么位置,以及是否可读写等。

获得如下信息:

There are 28 section headers, starting at offset 0x998:

Section Headers:

[Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al

[ 0]                   NULL            00000000 000000 000000 00      0   0  0

[ 1] .interp           PROGBITS        08048114 000114 000013 00   A  0   0  1

[ 2] .note.ABI-tag     NOTE            08048128 000128 000020 00   A  0   0  4

[ 3] .gnu.hash         GNU_HASH        08048148 000148 000020 04   A  4   0  4

[ 4] .dynsym           DYNSYM          08048168 000168 000050 10   A  5   1  4

[ 5] .dynstr           STRTAB          080481b8 0001b8 00004c 00   A  0   0  1

[ 6] .gnu.version      VERSYM          08048204 000204 00000a 02   A  4   0  2

[ 7] .gnu.version_r    VERNEED         08048210 000210 000020 00   A  5   1  4

[ 8] .rel.dyn          REL             08048230 000230 000008 08   A  4   0  4

[ 9] .rel.plt          REL             08048238 000238 000018 08   A  4  11  4

[10] .init             PROGBITS        08048250 000250 000017 00  AX  0   0  4

[11] .plt              PROGBITS        08048268 000268 000040 04  AX  0   0  4

[12] .text             PROGBITS        080482b0 0002b0 0002c8 00  AX  0   0 16

[13] .fini             PROGBITS        08048578 000578 00001c 00  AX  0   0  4

[14] .rodata           PROGBITS        08048594 000594 000110 00   A  0   0  4

[15] .eh_frame         PROGBITS        080486a4 0006a4 000004 00   A  0   0  4

[16] .ctors            PROGBITS        080496a8 0006a8 000008 00  WA  0   0  4

[17] .dtors            PROGBITS        080496b0 0006b0 000008 00  WA  0   0  4

[18] .jcr              PROGBITS        080496b8 0006b8 000004 00  WA  0   0  4

[19] .dynamic          DYNAMIC         080496bc 0006bc 0000c8 08  WA  5   0  4

[20] .got              PROGBITS        08049784 000784 000004 04  WA  0   0  4

[21] .got.plt          PROGBITS        08049788 000788 000018 04  WA  0   0  4

[22] .data             PROGBITS        080497a0 0007a0 000008 00  WA  0   0  4

[23] .bss              NOBITS          080497a8 0007a8 000008 00  WA  0   0  4

[24] .comment          PROGBITS        00000000 0007a8 000114 00      0   0  1

[25] .shstrtab         STRTAB          00000000 0008bc 0000db 00      0   0  1

[26] .symtab           SYMTAB          00000000 000df8 000460 10     27  48  4

[27] .strtab           STRTAB          00000000 001258 000266 00      0   0  1

Key to Flags:

W (write), A (alloc), X (execute), M (merge), S (strings)

I (info), L (link order), G (group), x (unknown)

O (extra OS processing required) o (OS specific), p (processor specific)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值