ldd pvs dis on solaris 10

时间:2023-03-10 06:53:17
ldd  pvs  dis   on solaris 10
#include <QtGui/QApplication>
#include <QtGui/QDialog>
int main(int argc, char *argv[]) {
// initialize resources, if needed
// Q_INIT_RESOURCE(resfile); QApplication app(argc, argv);
QDialog *tt=new QDialog();
tt->show();
return app.exec();
}
//oracle solaris studio 12.3 qt appliction

生成  "qt" 程序
bash-3.2# ldd qt
        libQtGui.so.4 =>         /usr/local/Trolltech/Qt-4.8.7/lib/libQtGui.so.4
        libQtCore.so.4 =>        /usr/local/Trolltech/Qt-4.8.7/lib/libQtCore.so. 4
        libpthread.so.1 =>       /lib/libpthread.so.1
        librt.so.1 =>    /lib/librt.so.1
        libCstd.so.1 =>  /usr/lib/libCstd.so.1
        libCrun.so.1 =>  /usr/lib/libCrun.so.1
        libthread.so.1 =>        /lib/libthread.so.1
        libm.so.2 =>     /lib/libm.so.2
        libc.so.1 =>     /lib/libc.so.1
        libgthread-2.0.so.0 =>   /usr/lib/libgthread-2.0.so.0
        libglib-2.0.so.0 =>      /usr/lib/libglib-2.0.so.0
        libpng12.so.0 =>         /usr/lib/libpng12.so.0
        libz.so.1 =>     /usr/lib/libz.so.1
        libfreetype.so.6 =>      /usr/sfw/lib/libfreetype.so.6
        libSM.so.6 =>    /usr/lib/libSM.so.6
        libICE.so.6 =>   /usr/lib/libICE.so.6
        libXrender.so.1 =>       /usr/sfw/lib/libXrender.so.1
        libfontconfig.so.1 =>    /usr/lib/libfontconfig.so.1
        libXext.so.0 =>  /usr/lib/libXext.so.0
        libX11.so.4 =>   /usr/lib/libX11.so.4
        libresolv.so.2 =>        /lib/libresolv.so.2
        libsocket.so.1 =>        /lib/libsocket.so.1
        libnsl.so.1 =>   /lib/libnsl.so.1
        libdl.so.1 =>    /lib/libdl.so.1
        libaio.so.1 =>   /lib/libaio.so.1
        libmd.so.1 =>    /lib/libmd.so.1
        libexpat.so.0 =>         /usr/sfw/lib/libexpat.so.0
        libmp.so.2 =>    /lib/libmp.so.2
        libscf.so.1 =>   /lib/libscf.so.1
        libdoor.so.1 =>  /lib/libdoor.so.1
        libuutil.so.1 =>         /lib/libuutil.so.1
        libgen.so.1 =>   /lib/libgen.so.1

左边是应用要找的库

右连是找到的库

ldd    -r    <app>  即报告应用是否找不到库,也会报告找不到的函数

LD_LIBRARY_PATH:   指定搜索函数库的路径 ,包括了32与64位库

LD_LIBRARY_PATH_32:

LD_LIBRARY_PATH_64:

ldd -u  <app>    :检查没有用到的库

bash-3.2# ldd -u qt
libQtGui.so. => /usr/local/Trolltech/Qt-4.8./lib/libQtGui.so.
libQtCore.so. => /usr/local/Trolltech/Qt-4.8./lib/libQtCore.so.
libpthread.so. => /lib/libpthread.so.
librt.so. => /lib/librt.so.
libCstd.so. => /usr/lib/libCstd.so.
libCrun.so. => /usr/lib/libCrun.so.
libthread.so. => /lib/libthread.so.
libm.so. => /lib/libm.so.
libc.so. => /lib/libc.so.
libgthread-2.0.so. => /usr/lib/libgthread-2.0.so.
libglib-2.0.so. => /usr/lib/libglib-2.0.so.
libpng12.so. => /usr/lib/libpng12.so.
libz.so. => /usr/lib/libz.so.
libfreetype.so. => /usr/sfw/lib/libfreetype.so.
libSM.so. => /usr/lib/libSM.so.
libICE.so. => /usr/lib/libICE.so.
libXrender.so. => /usr/sfw/lib/libXrender.so.
libfontconfig.so. => /usr/lib/libfontconfig.so.
libXext.so. => /usr/lib/libXext.so.
libX11.so. => /usr/lib/libX11.so.
libresolv.so. => /lib/libresolv.so.
libsocket.so. => /lib/libsocket.so.
libnsl.so. => /lib/libnsl.so.
libdl.so. => /lib/libdl.so.
libaio.so. => /lib/libaio.so.
libmd.so. => /lib/libmd.so.
libexpat.so. => /usr/sfw/lib/libexpat.so.
libmp.so. => /lib/libmp.so.
libscf.so. => /lib/libscf.so.
libdoor.so. => /lib/libdoor.so.
libuutil.so. => /lib/libuutil.so.
libgen.so. => /lib/libgen.so.
未使用的对象=/lib/librt.so.
未使用的对象=/lib/libthread.so.
未使用的对象=/usr/lib/libgthread-2.0.so.
未使用的对象=/usr/lib/libpng12.so.
未使用的对象=/usr/lib/libz.so.
未使用的对象=/usr/sfw/lib/libfreetype.so.
未使用的对象=/usr/lib/libSM.so.
未使用的对象=/usr/sfw/lib/libXrender.so.
未使用的对象=/usr/lib/libfontconfig.so.
未使用的对象=/usr/lib/libXext.so.
未使用的对象=/lib/libdl.so.
未使用的对象=/lib/libaio.so.
未使用的对象=/lib/libmd.so.
未使用的对象=/usr/sfw/lib/libexpat.so.
未使用的对象=/lib/libmp.so.
未使用的对象=/lib/libscf.so.
未使用的对象=/lib/libdoor.so.
未使用的对象=/lib/libuutil.so.
未使用的对象=/lib/libgen.so.

ldd   -i   <app> 报告库初始化的顺序

bash-3.2# ldd -i qt
libQtGui.so. => /usr/local/Trolltech/Qt-4.8./lib/libQtGui.so.
libQtCore.so. => /usr/local/Trolltech/Qt-4.8./lib/libQtCore.so.
libpthread.so. => /lib/libpthread.so.
librt.so. => /lib/librt.so.
libCstd.so. => /usr/lib/libCstd.so.
libCrun.so. => /usr/lib/libCrun.so.
libthread.so. => /lib/libthread.so.
libm.so. => /lib/libm.so.
libc.so. => /lib/libc.so.
libgthread-2.0.so. => /usr/lib/libgthread-2.0.so.
libglib-2.0.so. => /usr/lib/libglib-2.0.so.
libpng12.so. => /usr/lib/libpng12.so.
libz.so. => /usr/lib/libz.so.
libfreetype.so. => /usr/sfw/lib/libfreetype.so.
libSM.so. => /usr/lib/libSM.so.
libICE.so. => /usr/lib/libICE.so.
libXrender.so. => /usr/sfw/lib/libXrender.so.
libfontconfig.so. => /usr/lib/libfontconfig.so.
libXext.so. => /usr/lib/libXext.so.
libX11.so. => /usr/lib/libX11.so.
libresolv.so. => /lib/libresolv.so.
libsocket.so. => /lib/libsocket.so.
libnsl.so. => /lib/libnsl.so.
libdl.so. => /lib/libdl.so.
libaio.so. => /lib/libaio.so.
libmd.so. => /lib/libmd.so.
libexpat.so. => /usr/sfw/lib/libexpat.so.
libmp.so. => /lib/libmp.so.
libscf.so. => /lib/libscf.so.
libdoor.so. => /lib/libdoor.so.
libuutil.so. => /lib/libuutil.so.
libgen.so. => /lib/libgen.so. 检测到循环相依,群组 []:
/lib/libnsl.so.
/lib/librt.so. 检测到循环相依,群组 []:
/usr/lib/libX11.so.
/usr/lib/libXext.so. 初始对象=/lib/libc.so.
初始对象=/lib/libaio.so.
初始对象=/lib/libmd.so.
初始对象=/lib/libmp.so.
初始对象=/lib/libdoor.so.
初始对象=/lib/libuutil.so.
初始对象=/lib/libgen.so.
初始对象=/lib/libscf.so.
init object=/lib/libnsl.so. - 循环群组 [],为以下的引用:
init object=/lib/librt.so. - 循环群组 [],为以下的引用:
初始对象=/usr/lib/libz.so.
初始对象=/usr/local/Trolltech/Qt-4.8./lib/libQtCore.so.
初始对象=/usr/lib/libpng12.so.
初始对象=/usr/sfw/lib/libfreetype.so.
初始对象=/lib/libsocket.so.
初始对象=/usr/lib/libICE.so.
初始对象=/usr/lib/libSM.so.
init object=/usr/lib/libX11.so. - 循环群组 [],为以下的引用:
/usr/lib/libXext.so.
init object=/usr/lib/libXext.so. - 循环群组 [],为以下的引用:
/usr/lib/libX11.so.
初始对象=/usr/sfw/lib/libXrender.so.
初始对象=/lib/libresolv.so.
初始对象=/usr/local/Trolltech/Qt-4.8./lib/libQtGui.so.
初始对象=/usr/lib/libCrun.so.
初始对象=/usr/lib/libCstd.so.
初始对象=/usr/sfw/lib/libexpat.so.

file  <app>     :报告文件内容的类型

bash-3.2# file ./qt
./qt:           ELF 32-bit LSB executable 80386 Version 1 [FPU], dynamically linked, not stripped

nm   <app>  :报告文件中的符号

a.out

#include <stdio.h>
#include <stdlib.h> #define RPT 10000000
int main()
{ int i=;
for( i=;i<RPT;i++)
{ while(); } }
bash-3.2# nm a.out

a.out:

[Index]   Value      Size      Type  Bind  Other Shndx   Name

[]     | |         |SECT |LOCL |    |      |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |SECT |LOCL | | |
[] | | |FILE |LOCL | |ABS |.c
[] | | |OBJT |GLOB | | |_DYNAMIC
[] | | |OBJT |LOCL | | |_END_
[] | | |OBJT |GLOB | | |_GLOBAL_OFFSET_TABLE_
[] | | |NOTY |WEAK | |UNDEF |_Jv_RegisterClasses
[] | | |OBJT |GLOB | | |_PROCEDURE_LINKAGE_TABLE_
[] | | |OBJT |LOCL | | |_START_
[] | | |NOTY |WEAK | |UNDEF |__1cG__CrunMdo_exit_code6F_v_
[] | | |OBJT |LOCL | | |__CTOR_END__
[] | | |OBJT |LOCL | | |__CTOR_LIST__
[] | | |OBJT |LOCL | | |__DTOR_END__
[] | | |OBJT |LOCL | | |__DTOR_LIST__
[] | | |OBJT |LOCL | | |__EH_FRAME_BEGIN__
[] | | |OBJT |LOCL | | |__FRAME_END__
[] | | |OBJT |LOCL | | |__JCR_END__
[] | | |OBJT |LOCL | | |__JCR_LIST__
[] | | |OBJT |GLOB | | |___Argv
[] | | |NOTY |WEAK | |UNDEF |__deregister_frame_info_bases
[] | | |OBJT |LOCL | | |__do_exit_code_ptr
[] | | |FUNC |LOCL | | |__do_global_ctors_aux
[] | | |FUNC |LOCL | | |__do_global_dtors_aux
[] | | |OBJT |GLOB | | |__dso_handle
[] | | |FUNC |GLOB | |UNDEF |__fpstart
[] | | |FUNC |GLOB | | |__fsr
[] | | |NOTY |WEAK | |UNDEF |__fsr_init_value
[] | | |OBJT |LOCL | | |__get_exit_frame_monitor_ptr
[] | | |OBJT |GLOB | | |__longdouble_used
[] | | |NOTY |WEAK | |UNDEF |__register_frame_info_bases
[] | | |OBJT |GLOB | | |_edata
[] | | |OBJT |GLOB | | |_end
[] | | |OBJT |GLOB | | |_environ
[] | | |OBJT |GLOB | | |_etext
[] | | |FUNC |GLOB | |UNDEF |_exit
[] | | |FUNC |GLOB | | |_fini
[] | | |FUNC |WEAK | |UNDEF |_get_exit_frame_monitor[] | | |FUNC |GLOB | | |_init
[] | | |OBJT |GLOB | | |_lib_version
[] | | |FUNC |GLOB | | |_mcount
[] | | |FUNC |GLOB | | |_start
[] | | |FILE |LOCL | |ABS |a.out
[] | | |FUNC |GLOB | |UNDEF |atexit
[] | | |OBJT |LOCL | | |completed.
[] | | |FILE |LOCL | |ABS |crti.s
[] | | |FILE |LOCL | |ABS |crtn.s
[] | | |FILE |LOCL | |ABS |crtstuff.c
[] | | |FILE |LOCL | |ABS |crtstuff.c
[] | | |OBJT |WEAK | | |environ
[] | | |FUNC |GLOB | |UNDEF |exit
[] | | |FUNC |LOCL | | |frame_dummy
[] | | |FILE |LOCL | |ABS |fsr.s
[] | | |FUNC |GLOB | | |main
[] | | |OBJT |LOCL | | |object.
[] | | |OBJT |LOCL | | |p.
[] | | |OBJT |LOCL | | |trap_table
[] | | |FILE |LOCL | |ABS |values-Xa.c

pvs  <app>  :报告程序需要的库

bash-3.2# pvs /bin/ls
        libsec.so.1 (SUNW_1.2, SUNWprivate_1.1);
        libc.so.1 (SUNW_1.19, SUNWprivate_1.1);

pvs    -d    <库>  :显示库中定的版本

bash-3.2# pvs -d /usr/lib/libc.so.1
        libc.so.1;
        SUNW_1.23;
        SUNW_1.22.7;
        SUNW_1.22.6;
        SUNW_1.22.5;
        SUNW_1.22.4;
        SUNW_1.22.3;
        SUNW_1.22.2;
        SUNW_1.22.1;
        SUNW_1.22;
        SUNW_1.21.3;
        SUNW_1.21.2;
        SUNW_1.21.1;
        SUNW_1.21;
        SUNW_1.20.4;
        SUNW_1.20.1;
        SUNW_1.20;
        SUNW_1.19;
        SUNW_1.18.1;
        SUNW_1.18;
        SUNW_1.17;
        SUNW_1.16;
        SUNW_1.15;
        SUNW_1.14;
        SUNW_1.13;
        SUNW_1.12;
        SUNW_1.11;
        SUNW_1.10;
        SUNW_1.9;
        SUNW_1.8;
        SUNW_1.7;
        SUNW_1.6;
        SUNW_1.5;
        SUNW_1.4;
        SUNW_1.3;
        SUNW_1.2;
        SUNW_1.1;
        SUNW_0.9;
        SUNW_0.8;
        SUNW_0.7;
        SYSVABI_1.3;
        SUNWprivate_1.1;

pvs -ds  <库> :导出的函数版本

bash-3.2# pvs -ds /usr/lib/libdl.so.1
        libdl.so.1:
                _DYNAMIC;
                _edata;
                _etext;
                _end;
                _PROCEDURE_LINKAGE_TABLE_;
        SUNW_1.5:
                dl_iterate_phdr;
        SUNW_1.4:
                dladdr1;
        SUNW_1.3:
        SUNW_0.8:
                dladdr;
        SUNW_0.7:
                dlopen;
                dlsym;
                dlerror;
                dlclose;
        SUNW_1.2:
        SUNW_1.1:
                dlmopen;
                dldump;
                dlinfo;
        SUNWprivate_1.1:
                _dlerror;
                _dlmopen;
                _dldump;
                _dlinfo;
                _dladdr;
                _dladdr1;
                _dlclose;
                _dlopen;
                _ld_libc;
                _dlsym;

dis    <app>

gcc  -g 2.c

#include <stdio.h>
#include <stdlib.h> #define RPT 10000000
int main()
{ int i=;
for( i=;i<RPT;i++)
{ while(); } }
bash-3.2# dis a.out
disassembly for a.out section .plt
_PROCEDURE_LINKAGE_TABLE_: ff 0b pushl 0x8060b70
0x805085a: ff 0b jmp *0x8060b74
0x8050860: addb %al,(%eax)
0x8050862: addb %al,(%eax)
atexit()
atexit: ff 0b jmp *0x8060b78
0x805086a: pushl $0x0
0x805086f: e9 e0 ff ff ff jmp -0x1b <_PROCEDURE_LINKAGE_TABLE_>
__fpstart()
__fpstart: ff 7c 0b jmp *0x8060b7c
0x805087a: pushl $0x8
0x805087f: e9 d0 ff ff ff jmp -0x2b <_PROCEDURE_LINKAGE_TABLE_>
exit()
exit: ff 0b jmp *0x8060b80
0x805088a: pushl $0x10
0x805088f: e9 c0 ff ff ff jmp -0x3b <_PROCEDURE_LINKAGE_TABLE_>
_exit()
_exit: ff 0b jmp *0x8060b84
0x805089a: pushl $0x18
0x805089f: e9 b0 ff ff ff jmp -0x4b <_PROCEDURE_LINKAGE_TABLE_>
0x80508a4: ff 8c 0b jmp *0x8060b8c
0x80508aa: pushl $0x20
0x80508af: e9 a0 ff ff ff jmp -0x5b <_PROCEDURE_LINKAGE_TABLE_>
0x80508b4: ff 0b jmp *0x8060b94
0x80508ba: pushl $0x28
0x80508bf: e9 ff ff ff jmp -0x6b <_PROCEDURE_LINKAGE_TABLE_>
0x80508c4: ff 9c 0b jmp *0x8060b9c
0x80508ca: pushl $0x30
0x80508cf: e9 ff ff ff jmp -0x7b <_PROCEDURE_LINKAGE_TABLE_>
_get_exit_frame_monitor()
_get_exit_frame_monitor: ff a0 0b jmp *0x8060ba0
0x80508da: pushl $0x38
0x80508df: e9 ff ff ff jmp -0x8b <_PROCEDURE_LINKAGE_TABLE_> section .text
_start()
_start: 6a pushl $0x0
_start+0x2: 6a pushl $0x0
_start+0x4: 8b ec movl %esp,%ebp
_start+0x6: b8 a4 0b movl $0x8060ba4,%eax
_start+0xb: c0 testl %eax,%eax
_start+0xd: je +0xb <_start+0x18>
_start+0xf: pushl %edx
_start+0x10: e8 6b ff ff ff call -0x90 <atexit>
_start+0x15: c4 addl $0x4,%esp
_start+0x18: 0b pushl $0x8050b50
_start+0x1d: e8 5e ff ff ff call -0x9d <atexit>
_start+0x22: c4 addl $0x4,%esp
_start+0x25: 8d d8 0c leal 0x8060cd8,%eax
_start+0x2b: 8b movl (%eax),%eax
_start+0x2d: c0 testl %eax,%eax
_start+0x2f: je +0x17 <_start+0x46>
_start+0x31: 8d dc 0c leal 0x8060cdc,%eax
_start+0x37: 8b movl (%eax),%eax
_start+0x39: c0 testl %eax,%eax
_start+0x3b: je +0xb <_start+0x46>
_start+0x3d: pushl %eax
_start+0x3e: e8 3d ff ff ff call -0xbe <atexit>
_start+0x43: c4 addl $0x4,%esp
_start+0x46: 8b movl 0x8(%ebp),%eax
_start+0x49: 8b d0 0c movl 0x8060cd0,%edx
_start+0x4f: d2 testl %edx,%edx
_start+0x51: 0a jne +0xc <_start+0x5d>
_start+0x53: 8d leal 0x10(%ebp,%eax,),%edx
_start+0x57: d0 0c movl %edx,0x8060cd0
_start+0x5d: e4 f0 andl $0xfffffff0,%esp
_start+0x60: pushl %edx
_start+0x61: 8d 0c leal 0xc(%ebp),%edx
_start+0x64: d4 0c movl %edx,0x8060cd4
_start+0x6a: pushl %edx
_start+0x6b: pushl %eax
_start+0x6c: e8 1f ff ff ff call -0xdc <__fpstart>
_start+0x71: e8 call +0x27 <__fsr>
_start+0x76: e8 d1 call +0x1d6 <_init>
_start+0x7b: e8 call +0x15d <main>
_start+0x80: c4 0c addl $0xc,%esp
_start+0x83: pushl %eax
_start+0x84: pushl %eax
_start+0x85: e8 ff ff ff call -0xe5 <exit>
_start+0x8a: c4 addl $0x4,%esp
_start+0x8d: e8 1e ff ff ff call -0xdd <_exit>
_start+0x92: c4 addl $0x4,%esp
_start+0x95: f4 hlt
0x805097a: nop
0x805097b: nop
__fsr()
__fsr: pushl %ebp
__fsr+0x1: 8b ec movl %esp,%ebp
__fsr+0x3: pushl %edx
__fsr+0x4: pushl %ecx
__fsr+0x5: ec subl $0x4,%esp
__fsr+0x8: b9 movl $0x0,%ecx
__fsr+0xd: d1 e9 shrl $0x1,%ecx
__fsr+0xf: f9 cmpl $0x0,%ecx
__fsr+0x12: je +0x62 <__fsr+0x74>
__fsr+0x14: 9b fwait
__fsr+0x15: d9 7c fnstcw 0x0(%esp)
__fsr+0x19: 8b d1 movl %ecx,%edx
__fsr+0x1b: e2 1f andl $0x1f,%edx
__fsr+0x1e: 8a e0 0c movb 0x8060ce0(%edx),%al
__fsr+0x24: andb %al,0x0(%esp)
__fsr+0x28: f7 c1 testl $0x200,%ecx
__fsr+0x2e: je +0x7 <__fsr+0x35>
__fsr+0x30: fd andb $0xfd,0x0(%esp)
__fsr+0x35: 8b d1 movl %ecx,%edx
__fsr+0x37: e2 andl $0x60,%edx
__fsr+0x3a: je +0x1a <__fsr+0x54>
__fsr+0x3c: 8b c2 movl %edx,%eax
__fsr+0x3e: e0 andl $0x20,%eax
__fsr+0x41: d1 e0 shll $0x1,%eax
__fsr+0x43: d0 xorl %eax,%edx
__fsr+0x45: c1 e2 shll $0x5,%edx
__fsr+0x48: ff andw $0xf3ff,0x0(%esp)
f3
__fsr+0x4f: orw %dx,0x0(%esp)
__fsr+0x54: e1 andl $0x180,%ecx
__fsr+0x5a: je +0x16 <__fsr+0x70>
__fsr+0x5c: f1 xorl $0x180,%ecx
__fsr+0x62: d1 e1 shll $0x1,%ecx
__fsr+0x64: ff andw $0xfcff,0x0(%esp)
fc
__fsr+0x6b: 4c orw %cx,0x0(%esp)
__fsr+0x70: d9 6c fldcw 0x0(%esp)
__fsr+0x74: c4 addl $0x4,%esp
__fsr+0x77: popl %ecx
__fsr+0x78: 5a popl %edx
__fsr+0x79: 5d popl %ebp
__fsr+0x7a: c3 ret
0x80509f7: nop
_mcount()
_mcount: c3 ret
0x80509f9: nop
0x80509fa: nop
0x80509fb: nop
__do_global_dtors_aux()
__do_global_dtors_aux: pushl %ebp
0x80509fd: e5 movl %esp,%ebp
0x80509ff: pushl %ebx
0x8050a00: e8 call +0x5 <0x8050a05>
0x8050a05: 5b popl %ebx
0x8050a06: c3 addl $0x10167,%ebx
0x8050a0c: pushl %edx
0x8050a0d: bb b4 cmpb $0x0,0x1b4(%ebx) 0x8050a14: 0d je +0xf <0x8050a23>
0x8050a16: eb 3a jmp +0x3c <0x8050a52>
0x8050a18: c0 addl $0x4,%eax
0x8050a1b: b0 movl %eax,0x1b0(%ebx)
0x8050a21: ff d2 call *%edx
0x8050a23: 8b b0 movl 0x1b0(%ebx),%eax
0x8050a29: 8b movl (%eax),%edx
0x8050a2b: d2 testl %edx,%edx
0x8050a2d: e9 jne -0x15 <0x8050a18>
0x8050a2f: 8b 1c movl 0x1c(%ebx),%eax
0x8050a35: c0 testl %eax,%eax
0x8050a37: je +0x14 <0x8050a4b>
0x8050a39: ec 0c subl $0xc,%esp
0x8050a3c: 8d leal 0x160(%ebx),%eax
0x8050a42: pushl %eax
0x8050a43: e8 5c fe ff ff call -0x19f <0x80508a4>
0x8050a48: c4 addl $0x10,%esp
0x8050a4b: c6 b4 movb $0x1,0x1b4(%ebx) 0x8050a52: 8b 5d fc movl -0x4(%ebp),%ebx
0x8050a55: c9 leave
0x8050a56: c3 ret
0x8050a57: nop
frame_dummy()
frame_dummy: pushl %ebp
0x8050a59: e5 movl %esp,%ebp
0x8050a5b: pushl %ebx
0x8050a5c: e8 call +0x5 <0x8050a61>
0x8050a61: 5b popl %ebx
0x8050a62: c3 0b addl $0x1010b,%ebx
0x8050a68: pushl %eax
0x8050a69: 8b movl 0x24(%ebx),%eax
0x8050a6f: c0 testl %eax,%eax
0x8050a71: je +0x1b <0x8050a8c>
0x8050a73: pushl %ebx
0x8050a74: 6a pushl $0x0
0x8050a76: 8d b8 leal 0x1b8(%ebx),%eax
0x8050a7c: pushl %eax
0x8050a7d: 8d leal 0x160(%ebx),%eax
0x8050a83: pushl %eax
0x8050a84: e8 2b fe ff ff call -0x1d0 <0x80508b4>
0x8050a89: c4 addl $0x10,%esp
0x8050a8c: 8b ac movl 0x1ac(%ebx),%eax
0x8050a92: c0 testl %eax,%eax
0x8050a94: 1e je +0x20 <0x8050ab4>
0x8050a96: 8b 8b 2c movl 0x2c(%ebx),%ecx
0x8050a9c: c9 testl %ecx,%ecx
0x8050a9e: je +0x16 <0x8050ab4>
0x8050aa0: ec 0c subl $0xc,%esp
0x8050aa3: 8d ac leal 0x1ac(%ebx),%eax
0x8050aa9: pushl %eax
0x8050aaa: e8 fe ff ff call -0x1e6 <0x80508c4>
0x8050aaf: c4 addl $0x10,%esp
0x8050ab2: f6 movl %esi,%esi
0x8050ab4: 8b 5d fc movl -0x4(%ebp),%ebx
0x8050ab7: c9 leave
0x8050ab8: c3 ret
0x8050ab9: nop
0x8050aba: nop
0x8050abb: nop
main()
main: pushl %ebp
main+0x1: e5 movl %esp,%ebp
main+0x3: ec subl $0x8,%esp
main+0x6: e4 f0 andl $0xfffffff0,%esp
main+0x9: b8 movl $0x0,%eax
main+0xe: c0 0f addl $0xf,%eax
main+0x11: c0 0f addl $0xf,%eax
main+0x14: c1 e8 shrl $0x4,%eax
main+0x17: c1 e0 shll $0x4,%eax
main+0x1a: c4 subl %eax,%esp
main+0x1c: c7 fc movl $0x1,-0x4(%ebp) main+0x23: c7 fc movl $0x0,-0x4(%ebp) main+0x2a: 7d fc 7f cmpl $0x98967f,-0x4(%ebp) main+0x31: 7f jg +0x4 <main+0x35>
main+0x33: eb fe jmp -0x0 <main+0x33>
main+0x35: c9 leave
main+0x36: c3 ret
0x8050af3: nop
__do_global_ctors_aux()
__do_global_ctors_aux: pushl %ebp
0x8050af5: e5 movl %esp,%ebp
0x8050af7: pushl %esi
0x8050af8: pushl %ebx
0x8050af9: e8 call +0x5 <0x8050afe>
0x8050afe: 5b popl %ebx
0x8050aff: c3 6e addl $0x1006e,%ebx
0x8050b05: 8d a0 leal 0x1a0(%ebx),%eax
0x8050b0b: 8d fc leal -0x4(%eax),%esi
0x8050b0e: 8b fc movl -0x4(%eax),%eax
0x8050b11: eb jmp +0xa <0x8050b1b>
0x8050b13: nop
0x8050b14: ee subl $0x4,%esi
0x8050b17: ff d0 call *%eax
0x8050b19: 8b movl (%esi),%eax
0x8050b1b: f8 ff cmpl $-0x1,%eax
0x8050b1e: f4 jne -0xa <0x8050b14>
0x8050b20: 5b popl %ebx
0x8050b21: 5e popl %esi
0x8050b22: c9 leave
0x8050b23: c3 ret section .init
_init()
_init: pushl %ebp
_init+0x1: 8b ec movl %esp,%ebp
_init+0x3: pushl %ebx
_init+0x4: e8 call +0x5 <_init+0x9>
_init+0x9: 5b popl %ebx
_init+0xa: c3 addl $0x10033,%ebx
_init+0x10: e8 ff ff ff call -0xe8 <frame_dummy>
_init+0x15: e8 aa ff ff ff call -0x51 <__do_global_ctors_aux>
_init+0x1a: 5b popl %ebx
_init+0x1b: c9 leave
_init+0x1c: c3 ret section .fini
_fini()
_fini: pushl %ebp
_fini+0x1: 8b ec movl %esp,%ebp
_fini+0x3: pushl %ebx
_fini+0x4: e8 call +0x5 <_fini+0x9>
_fini+0x9: 5b popl %ebx
_fini+0xa: c3 addl $0x10013,%ebx
_fini+0x10: e8 fe ff ff call -0x164 <__do_global_dtors_aux>
_fini+0x15: 5b popl %ebx
_fini+0x16: c9 leave
_fini+0x17: c3 ret

size  <app>    :报告应用,库,或目标文件中各种段的大小

bash-3.2# size ./a.out
+ + = 3388 即可执行代码+数据(已初始化的数据)+bss(未初始化的数据)
bash-3.2# size -fn ./a.out
(.interp) + (.eh_frame_hdr) + (.hash) + (.dynsym) + (.dynstr) + (.SUNW_version) + (.SUNW_versym) + (.SUNW_reloc)
+ (.rel.plt) + (.plt) + (.text) + (.init) + (.fini) + (.rodata) + (.got) + (.dynamic) + (.eh_frame) +
(.data) + (.ctors) + (.dtors) + (.jcr) + (.data.rel.local) + (.bss) + (.symtab) + (.strtab) + (.comment)
+ (.debug_abbrev) + (.debug_info) + (.debug_line) + (.debug_frame) + (.debug_pubnames) + (.debug_aranges) +
306(.shstrtab) =

dumpstabs a.out | grep 2.c
 53:                      2.c  00000000  00000000  LOCAL    FILE  SHN_ABS

-------------------------------------------------------------------------------------------
 dwarfdump a.out | grep 2.c
                DW_AT_name                  2.c
                DW_AT_decl_file             1 //2.c
                DW_AT_decl_file             1 //2.c
//2.c:  [  7,-1]        0x8050abc       // new statement
//2.c:  [  7,-1]        0x8050ad8       // new statement
//2.c:  [  8,-1]        0x8050adf       // new statement
//2.c:  [ 11,-1]        0x8050aef       // new statement
//2.c:  [ 16,-1]        0x8050af1       // new statement
//2.c:  [ 16,-1]        0x8050af3       // new statement        // end of text sequence
                DW_AT_name                  2.c

--------------------------------------------------------------------------------------------------------

dump -av a.out

----------------------------------------------------------------------------------------------------------

bash-3.2# mcs -p a.out

a.out:

@(#)SunOS 5.10 Generic January 2005

GCC: (GNU) 3.4.3 (csl-sol210-3_4-branch+sol_rpath)

ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.1514

bash-3.2# mcs  -a "hello" a.out

bash-3.2# mcs -p a.out

a.out:

@(#)SunOS 5.10 Generic January 2005

GCC: (GNU) 3.4.3 (csl-sol210-3_4-branch+sol_rpath)

ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.1514 hello

---------------------------------------------------------------------------------------------