GDB dashboard

用 Python 实现 GDB 的模块化可视化界面。(Modular visual interface for GDB in Python)

Github星跟踪图

GDB dashboard

GDB dashboard 是一个使用 Python API 编写的独立的 .gdbinit 文件,它可以实现一个模块化的界面,显示正在调试的程序的相关信息。它的主要目标是减少检查当前程序状态所需的 GDB 命令数量,从而使开发人员能够主要关注控制流程。

快速启动

只需将 .gdbinit 放在你的主目录中,例如用:

wget -P ~ https://git.io/.gdbinit

可以选择安装 Pygments 来启用语法高亮。

pip install pygments

然后像往常一样调试,每次劣质程序停止时,仪表盘会自动出现。

请记住,没有重新定义GDB命令,相反,所有的功能都可以通过主仪表板命令来实现(见帮助仪表板)。

前往 wiki 学习如何执行最重要的任务。


主要指标

概览
名称与所有者cyrus-and/gdb-dashboard
主编程语言Python
编程语言Python (语言数: 1)
平台Linux, Mac, Windows
许可证MIT License
所有者活动
创建于2015-09-09 16:53:23
推送于2025-02-09 17:13:43
最后一次提交2025-02-09 18:03:54
发布数38
最新版本名称v0.17.4 (发布于 )
第一版名称v0.0.1 (发布于 )
用户参与
星数11.7k
关注者数224
派生数804
提交数412
已启用问题?
问题数257
打开的问题数10
拉请求数23
打开的拉请求数6
关闭的拉请求数39
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?

GDB dashboard

GDB dashboard is a standalone .gdbinit file written using the Python API that enables a modular interface showing relevant information about the program being debugged. Its main goal is to reduce the number of GDB commands needed to inspect the status of current program thus allowing the developer to primarily focus on the control flow.

Screenshot

Quickstart

Just place .gdbinit in your home directory, for example with:

wget -P ~ git.io/.gdbinit

Optionally install [Pygments][] to enable syntax highlighting:

pip install pygments

Then debug as usual, the dashboard will appear automatically when the inferior program stops. Keep in mind that no GDB command has been redefined, instead all the features are available via the main dashboard command (see help dashboard).

The wiki also can be useful as it contains some common use cases.

Requirements

GDB dashboard requires at least GDB 7.7 compiled with Python 2.7 in order to work properly, see #1 for more details and possible workarounds. To find the Python version used by GDB run:

gdb --batch -ex 'python import sys; print(sys.version)'

Make sure that the system locale is configured to use UTF-8, in most cases it already is, otherwise (in case of UnicodeEncodeError errors) a simple solution is to export the following environment variable:

export LC_CTYPE=C.UTF-8

On Windows the windows-curses Python package is needed in order to obtain the correct terminal size.

GDB dashboard is not meant to work seamlessly with additional front ends, e.g., TUI, Nemiver, QtCreator, etc. either instruct the front end to not load the .gdbinit file or load the dashboard manually.

Default modules

Follows the list of bundled default modules, refer to the GDB help system for the full syntax.

assembly shows the disassembled code surrounding the program counter. The instructions constituting the current statement are marked, if available.

history lists the last entries of the GDB value history.

memory allows to inspect memory regions.

registers shows the CPU registers and their values.

source show the program source code, if available.

stack shows the current stack trace including the function name and the file location, if available. Optionally lists the frame arguments and locals too.

threads lists the currently available threads.

variables shows arguments and locals of the selected frame.

expressions watches user expressions.

breakpoints displays the breakpoints list.

Commands

The GDB documentation is available at help dashboard. Just like any GDB command, abbreviations are possible, so da, dash, etc. all resolve to dashboard.

dashboard

This is the root command and it is used to manually redisplay the dashboard.

dashboard -configuration [<file>]

Display and optionally write to <file> the current configuration (layout, styles, outputs). This command allows to configure the dashboard live then make the changes permanent, for example:

dashboard -configuration ~/.gdbinit.d/auto

dashboard -output [<file>]

By default the dashboard is displayed in the GDB terminal together with the prompt and the program I/O but it may be convenient to display the whole dashboard or individual modules to other terminals.

This command allows to specify the destination terminal for both the dashboard and the modules, in such a way that when the output of a module is not specified then the dashboard output is used. To restore the original value run the command omitting the file.

To identify the TTY file name associated with terminal use the tty system command, those entries are often in the format /dev/pts/<n>.

The dashboard -layout command can be used to display a summary of the active modules and their outputs.

If <file> is not a valid terminal then the size of the GDB terminal is used to render the modules.

dashboard -enabled [on