繁体   English   中英

使用GDB调试器调试Q

[英]Debug Q With GDB Debugger

这确实是一个普遍的问题。 我尝试到处寻找帮助,但这与gdp调试器有关。 我编译一个程序,它需要两个字符串作为参数。

我用r和它后面的两个参数运行它,但是当我插入一个类似'break 33'的中断并在第33行中断,然后再次运行它时,我无法进入它,并且它不会在中断处停止。 我无法分步继续,等等。

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)

我需要输入什么才能使其正常工作? 它告诉我我的程序未运行,我尝试查看我的调用堆栈,它为空,我键入r以便稍后运行(我只是未在此处包括它)

您需要在gdb上按r键,以便您的程序再次开始运行。

我需要输入什么才能使其正常工作?

您可能应该阅读一篇介绍,例如本篇

您要查找的命令已run ,但是一旦将程序运行到断点,您可能会有更多问题,因此从介绍开始可能仍然是一个好主意。

事实证明,我们学校没有将其安装在服务器上。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM