windows下使用MinGW的调试工具gdb.exe调试C程序
1、编译源代码
C:MinGW\bin>gcc.exe -g -o program.exe program.c
编译选项上要加上“g”,这样生成的目标程序会含有调试内容,再用gdb调试的时候才能使用。显然加上“g”选项生成的应用程序会比不加的大,但两者运行时没有差别。
2、启动调试
C:MinGW\bin>gdb.exe program.exe

3、设置断点并启动运行
(gdb)break main
(gdb)start
不能直接start,因为程序运行太快了,直接start就运行到程序停止的地方。
break main在start命令之前,设置程序运行的断点,这样start后程序就运行到main处中断。也可以用命令“break FILENAME:LINENO",程序会在FILENAME指定的文件的LINENO指定行停下,例如"break mycode.cpp:4”。

4、其他命令
print VARNAME. That's how you print values of variables, whether local, static, or global. For example, at theforloop, you can typeprint tempto print out the value of thetempvariable.stepThis is equivalent to "step into".nextoradv +1Advance to the next line (like "step over"). You can also advance to a specific line of a specific file with, for example,adv mycode.cpp:8.btPrint a backtrace. This is a stack trace, essentially.continueExactly like a "continue" operation of a visual debugger. It causes the program execution to continue until the next break point or the program exits.
windows下使用MinGW的调试工具gdb.exe调试C程序的更多相关文章
- Windows下使用MinGW在命令行编译运行C++程序
之前学习C语言的时候都是用IDE类似CodeBlocks的工具写完直接编译运行的,今天突然心血来潮,自己下一个编译器,在命令行下,编译运行C++程序,了解一下编译过程. 一.安装编译器 首先你需要下载 ...
- windows下用eclipse+goclipse插件+gdb搭建go语言开发调试环境
windows下用eclipse+goclipse插件+gdb搭建go语言开发调试环境 http://rongmayisheng.com/post/windows%E4%B8%8B%E7%94%A ...
- 手把手教你在Windows下使用MinGW编译libav(参考libx264的编入)
转自:http://www.th7.cn/Program/cp/201407/242762.shtml 手把手教你在Windows下使用MinGW编译libav libav是在Linux下使用纯c语言 ...
- 在Windows下使用MinGW静态编译Assimp
使用MinGW静态编译Assimp 到了5月份了,没有写一篇日志,于是自己从知识库里面拿出一篇文章充数吧.这次将要解说怎样在Windows下使用MinGW静态编译Assimp. Assimp是眼下比較 ...
- windows下使用mingw和msvc静态编译Qt5.15.xx
windows下使用mingw和msvc静态编译Qt5.15.xx 下载并安装相关依赖软件 Python version 2.7 https://www.python.org/downloads/ ( ...
- windows 下使用 mingw编译器 调试时 无法跟进源码
windows 下使用 mingw编译器 调试时 无法跟进源码 最近在公司使用QT 开发,官方在线下载的 安装的QT mingw 都是没有debug版本的 由于没有debug版本动态库 所以你调试的时 ...
- 在Windows下使用Dev-C++开发基于pthread.h的多线程程序【转】
在Windows下使用Dev-C++开发基于pthread.h的多线程程序[转] 在Windows下使用Dev-C++开发基于pthread.h的多线程程序 文章分类:C++编程 ...
- windows下使用pycharm开发基于ansible api的python程序
Window下python安装ansible,基于ansible api开发python程序 在windows下使用pycharm开发基于ansible api的python程序时,发现ansible ...
- 在Windows下利用MinGW编译FFmpeg
目录 [隐藏] 1 环境与软件 2 第一步:安装MinGW 3 第二步:配置编译环境 4 第三步:配置SDL 5 第四步:编译 5.1 编译faac 5.2 编译fdk-aac 5.3 编译x264 ...
随机推荐
- Adding iAds to Cocos2d-x on iOS
http://www.mwebb.me.uk/2013/08/adding-iads-to-cocos2d-x-on-ios.html Looking at the forums it seems a ...
- Helpers Overview
Helpers Overview Helpers are classes that are not part of the core system but can greatly improve it ...
- spring-boot + Ehcache without XML
http://stackoverflow.com/questions/21944202/using-ehcache-in-spring-4-without-xml 1.Ehcache配置类 @Conf ...
- 关于Java中return和finally谁先执行.
例子一: public class A { public static void main(String[] args) { System.out.print(tt()); } public stat ...
- 关于Http协议的解析
HTTP概述 HTTP(hypertext transport protocol),即超文本传输协议.这个协议详细规定了浏览器和万维网服务器之间互相通信的规则. HTTP就是一个通信规则,通信规则规定 ...
- JAXB - The JAXB Context
As we have seen, an object of the class JAXBContext must be constructed as a starting point for othe ...
- hive与hbase集成
http://blog.csdn.net/vah101/article/details/22597341 这篇文章最初是基于介绍HIVE-705.这个功能允许Hive QL命令访问HBase表,进行读 ...
- Android线控的使用
实现方式一:只能在程序为前台时监控 在Activity中即可监听 @Override public boolean onKeyUp(int keyCode, KeyEvent event) { Log ...
- HW--漂亮度2(测试通过)
总结:几个函数的使用 (1) int num=Integer.parseInt(str[0]); //将第一个字符串转成整形数,表示名字个数 (2) String string1=str[i].to ...
- IOS开发之NSObject协议类方法说明
oc中NSObject类是所有类的基类,所有类都要继承自它,那么它的方法就显得特别重要,因为所有类都会有这些基本的方法. 看看oc的源码中NSObject是这样定义的: @interface NSOb ...