gpt4 book ai didi

c - 为什么 gdb 不会在 strcpy 上中断?

转载 作者:太空狗 更新时间:2023-10-29 17:26:22 25 4
gpt4 key购买 nike

<分区>

请看下面的命令行。我设置了两个断点:一个在 strcpy 上,另一个在 printf 上。为什么它会跳过断点 1?

root@ninja:~/Desktop/Programs# gcc -g -o exp exp.c
root@ninja:~/Desktop/Programs# gdb -q exp
Reading symbols from /root/Desktop/Programs/exp...done.
(gdb) list
1 #include <stdio.h>
2 #include <string.h>
3
4 int main() {
5 char str_a[20];
6
7 strcpy(str_a, "Hello world!\n");
8 printf(str_a);
9 }
(gdb) break strcpy
Function "strcpy" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (strcpy) pending.
(gdb) break printf
Breakpoint 2 at 0x8048300
(gdb) run
Starting program: /root/Desktop/Programs/exp

Breakpoint 2, 0xb7eabf54 in printf () from /lib/i386-linux-gnu/i686/cmov/libc.so.6
(gdb) i r eip
eip 0xb7eabf54 0xb7eabf54 <printf+4>
(gdb) cont
Continuing.
Hello world!
[Inferior 1 (process 3726) exited with code 015]

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com