本帖最后由 yyguzhou 于 2012-10-31 13:10 编辑 inline int add(int a, int b) { return a+b; } int main() { int c = add(1, 2); return 0; } 我想看add函数展开后的汇编代码 用g++ test.cpp -S后发现还是普通的函数调用,请问该如何查看呢?需要加其它的参数吗?
我手头有一个ELF-32BIT....的文件,没有源代码,但是想了解这个文件中的内容,怎么能够达到这个目的呢?有什么办法可以查看源代码吗? 还有.o的文件,又怎么查看源代码呢? 望高手赐教!
我手头有一个ELF-32BIT....的文件,没有源代码,但是想了解这个文件中的内容,怎么能够达到这个目的呢?有什么办法可以查看源代码吗? 还有.o的文件,又怎么查看源代码呢? 望高手赐教!
大家都知道gdb调试的时候,如果使用命令
display /i $pc
每次程序中断后就可以看到即将被执行的下一条汇编指令比如:
0x8048771
譬如下面这段代码怎样理解: /* how to get the thread information struct from C */ static inline struct thread_info *current_thread_info(void) { struct thread_info *ti; __asm__("andl %%esp,%0; ":"=r" (ti) : "0" (~(THREAD_SIZE - 1))); return ti; }
譬如下面这段代码怎样理解: /* how to get the thread information struct from C */ static inline struct thread_info *current_thread_info(void) { struct thread_info *ti; __asm__("andl %%esp,%0; ":"=r" (ti) : "0" (~(THREAD_SIZE - 1))); return ti; }
首先,我承认,我是Linux菜鸟。然后,开始吧。 1、从 http://www.kernel.org/pub/linux/kernel 下载你所要看的内核压缩包,如 Linux 2.4.0.tar.gz; 2、在windows下用WinRAR解压到目录 .../Linux 2.4; 3、用软件 Source Insight(推荐)或用 Ultra Edit 建一个工程,将目录(.../Linux 2.4)整个包含即可。 4、由于Linux源代码的目录有 270个左右,所以,要知道目录结构,否则看上去很乱。有一本书《Understand the Linux Ke...
以find命令为例: 第一步,确定命令属于哪个rpm包: #rpm -qf /usr/bin/find findutils-4.1-34第二步,查找findutils的源码包findutils-4.1-34.src.rpm,这个一般在发行版的网站上可以找到(比如FC6的源码在这里可以找到: http://ftp.kddilabs.jp/Linux/packages/fedora/core/6/source/SRPMS/ )。 也可以到rpmfind.net上查找,输入rpm包的名字就可以找到相关的源码包,有的也可以得到软件对应的网站。第三步,安装源码包: rpm...
请看: int main() { unsigned char buf[]={0xB8,0x10,0x00}; __asm { jmp buf } return 0; } 我在buf里存放的汇编代码,现在想在C里调用,可是用 jmp buf提示错误illegal size for operand和illegal instruction size, 请问该怎么调用?