如何正确使用rbreak命令
How to use the command of rbreak correcly?
我想在Test::Say((处设置中断。break-Test::Say((的方法可以做到。但是,rbbreak-TestSay(
(gdb(rbbreak测试::Say((找不到名为"main.cpp:'Test::Say(("的命名空间、类、结构或联合的成员提示:尝试'main.cpp:'Test::Say(('或'main.cpp:'Test:(('(注意前导单引号。(
class Test
{
public:
Test()
{
}
void Say()
{
printf("Hello word!");
}
};
int main ()
{
Test a;
a.Say();
getchar();
return 0;
}
我建议将gdb升级到最新版本。我用gdb 7.2版复制了你的错误:
/usr/bin/gdb ./a.out
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/rbreak/a.out...done.
(gdb) rbreak Test::Say()
Can't find member of namespace, class, struct, or union named "main.cpp:'Test::Say()"
Hint: try 'main.cpp:'Test::Say()'<TAB> or 'main.cpp:'Test::Say()'<ESC-?>
(Note leading single quote.)
Breakpoint 1 (main.cpp:'Test::Say()') pending.
void Test::Say();
(gdb)
然而,在最近的gdb 7.9版本中,rbreak以exected:的方式工作
$ gdb ./a.out
GNU gdb (GDB) 7.9.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a.out...done.
(gdb) rbreak Test::Say()
Breakpoint 1 at 0x400626: file main.cpp, line 12.
void Test::Say();
(gdb) r
Starting program: /home/rbreak/a.out
Breakpoint 1, Test::Say (this=0x7fffffffdd7f) at main.cpp:12
12 printf("Hello word!");
(gdb)
相关文章:
- 从命令行c++发送文本文件名
- 如何使用 < 和 > 命令获取 c++ 中的输入和输出?
- 为cl.exe(Visual Studio代码)指定命令行C++版本
- 如何在OMNET++中指定与命令行参数组合的输出文件名
- 使用QProcess执行命令,并将结果存储在QStringList中
- 数组长度,为什么从命令行获取时不能使用它?
- 如果用户输入无效,如何使用字符串变量-C++重复输入命令
- clang整洁10忽略了我的NOLINT命令
- 在子目录中使用target_sources()命令时用于单元测试(qtest)的项目结构
- 如何处理linux终端中带有负号(-)的C++中的命令行参数
- VS Code "command":"make"与终端窗口中的命令行"make"不同
- 使用VS Code和CMake Tools运行自定义命令
- 如何使用ESP8266向谷歌主页发送命令
- 如何使 windows 命令提示符在C++可执行文件上显示返回值?
- 未定义的引用 .. 使用 OpenCV 编译 C++ 代码时,从命令行
- 通过 Openssl 命令行加密,通过 c++ 解密
- CMake "--target install"无需"--build"命令行
- Gstreamer 管道从命令 lne 到 c 代码
- 自动"yes"到 Popen SSH 命令
- 如何正确使用rbreak命令