[英]Gdb and external functions
所以我有以下代碼
(gdb) list
#include<stdio.h>
#include<string.h>
int main()
{
char str_a[20];
strcpy(str_a,"Hello World!\n");
printf(str_a);
}
但是,當我使用gdb進行反匯編時,未引用strcpy。 而是顯示了函數strcpy的內部。
(gdb) disassemble main
Dump of assembler code for function main:
0x00000000004004fd <+0>: push rbp
0x00000000004004fe <+1>: mov rbp,rsp
0x0000000000400501 <+4>: sub rsp,0x20
0x0000000000400505 <+8>: lea rax,[rbp-0x20]
0x0000000000400509 <+12>: movabs rdx,0x6f57206f6c6c6548
0x0000000000400513 <+22>: mov QWORD PTR [rax],rdx
0x0000000000400516 <+25>: mov DWORD PTR [rax+0x8],0x21646c72
0x000000000040051d <+32>: mov WORD PTR [rax+0xc],0xa
0x0000000000400523 <+38>: lea rax,[rbp-0x20]
0x0000000000400527 <+42>: mov rdi,rax
0x000000000040052a <+45>: mov eax,0x0
0x000000000040052f <+50>: call 0x4003e0 <printf@plt>
0x0000000000400534 <+55>: leave
0x0000000000400535 <+56>: ret
End of assembler dump.
如何獲得GDB引用strcpy的方式,就像引用printf一樣? 我正在用“ gcc -g”進行編譯
嘗試使用-fno-builtin
編譯程序。
在您的gcc
, strcpy
是一個內置函數。 另請參見6.56 GCC提供的其他內置函數 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.