使用 GDB 调试器调试 Q

Debug Q With GDB Debugger

这真是一个普遍的问题。 我试着四处寻找帮助,但它是关于 gdp 调试器的。 我编译一个程序,它需要两个字符串作为参数。

我 运行 它带有 r 和它后面的两个参数,但是当我插入一个像“break 33”这样的中断并在第 33 行中断然后再次 运行 它时,我无法继续进入它并且它不会在我休息时停止。 我不能 step break continue 等等

gcc -g -o debugme debugme.c
Directory: /home/
Tue Oct  6 20:03:14 EDT 2015
[]$ debugme "hi there" "bye bye"
String '0' - 'debugme'
String '1' - 'hi there'
String '2' - 'bye bye'
Total number of command-line arguments: 2
(gdb)
Tue Oct  6 20:06:56 EDT 2015
[]$ cd cosc220
[]$ gdb debugme
GNU gdb (GDB; openSUSE 13.1) 7.6.50.20130731-cvs
Copyright (C) 2013 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-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
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 /home/...done.                                                
(gdb) break 33                                                                                                
Breakpoint 1 at 0x4005c7: file debugme.c, line 33.                                                            
(gdb) delete 1
(gdb)
(gdb) break 33
Breakpoint 2 at 0x4005c7: file debugme.c, line 33.
(gdb)

我需要输入什么才能使它起作用? 它告诉我我的程序不是 运行ning,我尝试查看我的调用堆栈但它是空的 我稍后为 运行 输入 r(我只是没有在此处包括它)

您需要在 gdb 中按 r 以便您的程序再次启动 运行。

What do I need to type for this to work?

您可能应该阅读介绍,例如 this one

你要找的命令是run,但是一旦你运行你的程序到了断点,你可能会有更多的问题,所以从介绍开始可能仍然是一个好主意。

原来我们学校的服务器上没有安装... 打脸,已经可以了