gdb设置配色方案

时间:2024-04-08 11:40:37

找了好久,发现国内没有相关的资料,于是在这里说明一下:
文档地址:https://sourceware.org/gdb/current/onlinedocs/gdb/Output-Styling.html
格式:
set style textType attr value
textType :要设置颜色的字符类型,如源码(source),地址(address)
所有的type如下:
address filename function sources variable
attr: 颜色位置,共有三种:
background(背景颜色) foreground(字体颜色) intensity(控制粗细)
value:颜色或者粗细(如attr为intensity时,只能选择normal’ (the default), ‘bold’, and ‘dim’)
例子:

  1. 设置address类型的格式
    set style address foreground green
    set style address background red
    set style address intensity bold
    gdb设置配色方案
  2. 设置完成后地址的样式
    gdb设置配色方案
  3. 如果需要永久保存自己设置的GDB样式,可以找到.gdbinit文件,将命令添加到末尾即可(windows可以在gdb的安装目录下全局搜索)
    gdb设置配色方案