==================================
对于gdb的命令很多人可能都已经很熟悉了,本文介绍的mi层命令可能很少有人用到,它也是gdb的一部分,主要目的是为一些目标系统如IDE等提 供调试功能,如eclipse下c/c++的cdt插件的底层就是调用的mi层命令,cdt的包里面有两个类RxThread,TxThread就是一个 发送mi命令,一个接收返回数据的,大家有兴趣可以研究下。
mi的命令依然是以文本行方式提供的,并兼容我们常用的gdb CLI命令,下面我们看一下它的进入和退出:
?进入命令 gdb --interpreter mi ****.exe
?推出命令 quit
效果如下:
D:\exercise\c\test>gdb --interpreter mi
~"GNU gdb 6.3.50_2004-12-28-cvs (cygwin-special)\n"
~"Copyright 2004 Free Software Foundation, Inc.\n"
~"GDB is free software, covered by the GNU General Public License, and you are\n
"
~"welcome to change it and/or distribute copies of it under certain conditions.\
n"
~"Type "show copying" to see the conditions.\n"
~"There is absolutely no warranty for GDB.
n"
~"This GDB was configured as "i686-pc-cygwin"."
~"\n"
(gdb)
quit
&"quit\n"
D:\exercise\c\test>
mi的命令总共分为以下几个部分:
1.断点(Breakpoint)
2.程序环境(Program Context)
3.线程(Thread)
4.程序执行(Program Execution)
5.栈(Stack)
6.变量(Variable)
7.数据(Da
8.跟踪点(Tracepoint)
9.符号(Symbol)
10.文件(File)
11.目标数据(Target Manipulation)
12.其它杂项
我们以下面这段代码为例演示各种命令的执行结果:
![GDB/MI <wbr>使用介绍](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
![GDB/MI <wbr>使用介绍](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
![GDB/MI <wbr>使用介绍](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
![GDB/MI <wbr>使用介绍](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
![GDB/MI <wbr>使用介绍](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
![GDB/MI <wbr>使用介绍](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
![GDB/MI <wbr>使用介绍](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
![GDB/MI <wbr>使用介绍](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
![GDB/MI <wbr>使用介绍](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
![GDB/MI <wbr>使用介绍](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
![GDB/MI <wbr>使用介绍](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
![GDB/MI <wbr>使用介绍](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
![GDB/MI <wbr>使用介绍](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)