gpt4 book ai didi

linux - GDB 显示 'Cannot find bounds of current function' 步进

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:09:56 26 4
gpt4 key购买 nike

我们在 VMWare 中运行 Linux Debian。使用 gdb 调试时,如果尝试跨过 memset/memcmp/strcmp 等...,gdb 会返回以下错误:

Cannot find bounds of current function

我们不会尝试进入那些 c 函数,而只会跳过它们。有什么想法吗?

已编辑:

我添加了导致问题的示例代码和编译标志。这可能与在 64 位机器上运行 32 位可执行文件有关。

版本是:

$ uname -a
Linux lavilinux 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with- bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5)

$ gdb --version
GNU gdb (GDB) 7.4.1-debian
...
This GDB was configured as "x86_64-linux-gnu".

示例失败代码:ma​​in.cpp

#include <string>
#include "string.h"
#include "stdio.h"

char* rb_my_exe;
int
main(int argc, char* argv[])
{
if (strcmp(argv[0], "isgreat") == 0)
printf("Hello World!\n");
return 0;
}

我的编译方式:

$ g++ -g -fexceptions -m32 -fstrict-aliasing -c -o main.o main.cpp
$ g++ -static -m32 -o main main.o

gdb 中的结果:

(gdb) start
Temporary breakpoint 1 at 0x80482dd: file main.cpp, line 9.
Starting program: /tmp/compile/main

Temporary breakpoint 1, main (argc=1, argv=0xffffd2d4) at main.cpp:9
9 if (strcmp(argv[0], "isgreat") == 0)
(gdb) n
0x080481b0 in ?? ()
(gdb) bt
#0 0x080481b0 in ?? ()
#1 0x0804849f in __libc_start_main ()
#2 0x080481e1 in _start ()
(gdb)

有什么想法吗?

最佳答案

遇到同样的问题。通过跟踪内存访问修复它

关于linux - GDB 显示 'Cannot find bounds of current function' 步进,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19632435/

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