C/C++ Linux GDB API [英] C/C++ Linux GDB API

查看:26
本文介绍了C/C++ Linux GDB API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Linux 上制作一个 GDB 命令行程序的小 GUI 版本,以便更轻松地调试小 C 程序.可能已经存在一些,特别是在 IDE 中,但我想让它变得有趣并让 GDB 更好地了解它.

I want to make me a small GUI version of the GDB command line program on Linux to make debugging of small C programs more easier. There may exists already some especially in IDEs but I want to make it for fun and get better known to GDB.

现在我想知道 GDB 是否有 API,这样我就可以直接从代码中访问 GDB 命令,而不必通过终端绕道而行,例如使用 popen.

Now I wanted to know whether GDB has a API so I can access GDB commands directly from code and I don't have to make a detour through the terminal for example with popen.

如果 GDB 中不存在这样的 API,那么最简单的方法是启动 GDB hidden 并向其发送命令,从中检索输出?

If there does not exists such a API from GDB, whats the simplest way to start GDB hidden and send commands to it, retrieve outputs from it?

推荐答案

Eclipse 和 KDevelop 等许多 IDE 都使用 GDB MI(机器接口).它是 GDB 的基于行的面向机器的文本接口.在此处查看完整列表:https://sourceware.org/gdb/wiki/GDB%20Front%20 结束.

Many IDEs such as Eclipse and KDevelop use GDB MI (Machine Interface). It is line based machine oriented text interface to GDB. See full list here: https://sourceware.org/gdb/wiki/GDB%20Front%20Ends.

查看这些链接以开始使用 GDB MI:

See these links to get started with GDB MI:

这篇关于C/C++ Linux GDB API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆