免费教程_免费网赚教程_破解版软件-寂涯网络学习基地

当前位置: 主页 > 系统综合 > 各类编程 > 深入跟踪 Hello World 执行(6)

深入跟踪 Hello World 执行(6)

时间:2012-04-08 14:21来源:未知 整理:寂涯网络 点击:


---Type <return> to continue, or q <return> to quit---
0xb7e11811 <  libc_start_main+385>: mov         %eax,(%esp)
0xb7e11814 <  libc_start_main+388>: call        *%ecx
0xb7e11816 <  libc_start_main+390>: mov         -0x44(%ebp),%ecx
0xb7e11819 <  libc_start_main+393>: mov         0x1c0(%ecx),%edx
0xb7e1181f <  libc_start_main+399>: add         $0x1,%esi
0xb7e11822 <  libc_start_main+402>: mov         0x20(%edi),%edi
0xb7e11825 <  libc_start_main+405>: cmp         %edx,%esi
0xb7e11827 <  libc_start_main+407>: jb                              0xb7e11800
<  libc_start_main+368>
0xb7e11829 <  libc_start_main+409>: jmp         0xb7e11720
<  libc_start_main+144>
0xb7e1182e <  libc_start_main+414>: mov         0x10(%ebp),%ecx
0xb7e11831 <  libc_start_main+417>: mov         (%ecx),%eax
0xb7e11833 <  libc_start_main+419>: mov         %eax,0x4(%esp)
0xb7e11837 <  libc_start_main+423>: lea         -0x1f3b8(%ebx),%eax
0xb7e1183d <  libc_start_main+429>: mov         %eax,(%esp)
0xb7e11840 <  libc_start_main+432>: call        *0x194(%edx)
0xb7e11846 <  libc_start_main+438>: jmp         0xb7e116ed <  libc_start_main+93>
End of assembler dump.
省略了很多,代码太多,去研究比较麻烦,但毕竟这是在 LINUX 下,我们可以找下 glibc
的源代码, libc_start_main 位于 glibc 库 csu 目录下 libc_start.c 文件,我们看一下
代码,如下所示:
019 #include <stdlib.h>
020 #include <stdio.h>
021 #include <unistd.h>
022 #include <ldsodefs.h>
023 #include <bp-start.h>
024 #include <bp-sym.h>
025
026 extern void  libc_init_first (int argc, char **argv, char **envp);
027
028 extern int  libc_multiple_libcs;
029
030 #include <tls.h>
031 #ifndef SHARED
032 # include <dl-osinfo.h>
033 extern void  pthread_initialize_minimal (void);
034 # ifndef THREAD_SET_STACK_GUARD
035 /** Only exported for architectures that don't store the stack guard canary
036    in thread local area.    */
037 uintptr_t  stack_chk_guard attribute_relro;
038 # endif
039 #endif
040
041 #ifdef HAVE_PTR_NTHREADS
042 /** We need atomic operations.       */
043 # include <atomic.h>
044 #endif
045  046
047 #ifdef LIBC_START_MAIN
048 # ifdef LIBC_START_DISABLE_INLINE
049 #   define STATIC static
050 # else
051 #   define STATIC static inline  attribute   ((always_inline))
052 # endif
053 #else
054 # define STATIC
055 # define LIBC_START_MAIN BP_SYM (  libc_start_main)
056 #endif
057
058 #ifdef MAIN_AUXVEC_ARG
059 /** main gets passed a pointer to the auxiliary.        */
060 # define MAIN_AUXVEC_DECL      , void *
061 # define MAIN_AUXVEC_PARAM      , auxvec
062 #else
063 # define MAIN_AUXVEC_DECL
064 # define MAIN_AUXVEC_PARAM
065 #endif
066
067 STATIC int LIBC_START_MAIN (int (*main) (int, char **, char **
068                    MAIN_AUXVEC_DECL),
069                int argc,
070                char *__unbounded *  unbounded ubp_av,
071 #ifdef LIBC_START_MAIN_AUXVEC_ARG
072                ElfW(auxv_t) *  unbounded auxvec,
073 #endif
074  typeof (main) init,

本页地址 http://www.jybase.net/biancheng/20120408819.html

百度搜索更多

谷歌搜索更多

顶一下
(1)
100%
踩一下
(0)
0%
------分隔线----------------------------

评价:
昵称: 验证码:点击我更换图片
推荐内容
赞助商
赞助商


关于本站免责声明视频更新google百度地图视频地图RRS订阅

如有什么问题请在本站留言,或发邮件到 hxt167#foxmail.com