GDB/C++;-回溯时如何隐藏常量静态字段? < >我用GDB调试C++代码。有东西在晃动,所以我点击“回溯已满”进行检查。不幸的是,一些成员变量是包含const static字段的类实例。有许多const static字段。此外,这些const static字段本身就是所述类的实例: class foo { public: int val; foo(int _val) : val(_val) {} static const foo FOO_5 = foo(5); static const foo FOO_6 = foo(6); static const foo FOO_7 = foo(7); ... }

GDB/C++;-回溯时如何隐藏常量静态字段? < >我用GDB调试C++代码。有东西在晃动,所以我点击“回溯已满”进行检查。不幸的是,一些成员变量是包含const static字段的类实例。有许多const static字段。此外,这些const static字段本身就是所述类的实例: class foo { public: int val; foo(int _val) : val(_val) {} static const foo FOO_5 = foo(5); static const foo FOO_6 = foo(6); static const foo FOO_7 = foo(7); ... },c++,gdb,C++,Gdb,(我的真实代码是一个字体格式化类,带有粗体、斜体、黑色、红色等预设) 结果是gdb感觉需要吐出所述类的每个成员(以及每个成员等)的每个const static字段。这会导致许多屏幕上显示相同的const static字段: gdb文本墙: mItems = std::vector of length 0, capacity 0, activeFormat = { _vptr.sttfont_format = 0x555555590898 <vtable for s

(我的真实代码是一个字体格式化类,带有粗体、斜体、黑色、红色等预设)

结果是gdb感觉需要吐出所述类的每个成员(以及每个成员等)的每个
const static
字段。这会导致许多屏幕上显示相同的
const static
字段:

gdb文本墙:

 mItems = std::vector of length 0, capacity 0, activeFormat = {
            _vptr.sttfont_format = 0x555555590898 <vtable for sttfont_format+16>, r = 255 '\377', g = 255 '\377', b = 255 '\377', 
            a = 255 '\377', format = 0 '\000', flags = 0 '\000', padding = "\000", static FORMAT_NONE = 0 '\000', 
            static FORMAT_BOLD = 1 '\001', static FORMAT_ITALIC = 2 '\002', static FORMAT_UNDERLINE = 4 '\004', 
            static FORMAT_STRIKETHROUGH = 8 '\b', static FORMAT_RENDER_EVEN_IF_CALLBACK_EXISTS = 128 '\200', 
            static FORMAT_FLAGS_COLOUR_SET = 1 '\001', static bold = {
              _vptr.sttfont_format = 0x555555590898 <vtable for sttfont_format+16>, r = 255 '\377', g = 255 '\377', b = 255 '\377', 
              a = 255 '\377', format = 1 '\001', flags = 0 '\000', padding = "\000", static FORMAT_NONE = 0 '\000', 
              static FORMAT_BOLD = 1 '\001', static FORMAT_ITALIC = 2 '\002', static FORMAT_UNDERLINE = 4 '\004', 
              static FORMAT_STRIKETHROUGH = 8 '\b', static FORMAT_RENDER_EVEN_IF_CALLBACK_EXISTS = 128 '\200', 
              static FORMAT_FLAGS_COLOUR_SET = 1 '\001', static bold = <same as static member of an already seen type>, static italic = {
                _vptr.sttfont_format = 0x555555590898 <vtable for sttfont_format+16>, r = 255 '\377', g = 255 '\377', b = 255 '\377', 
                a = 255 '\377', format = 2 '\002', flags = 0 '\000', padding = "\000", static FORMAT_NONE = 0 '\000', 
                static FORMAT_BOLD = 1 '\001', static FORMAT_ITALIC = 2 '\002', static FORMAT_UNDERLINE = 4 '\004', 
                static FORMAT_STRIKETHROUGH = 8 '\b', static FORMAT_RENDER_EVEN_IF_CALLBACK_EXISTS = 128 '\200', 
                static FORMAT_FLAGS_COLOUR_SET = 1 '\001', static bold = <same as static member of an already seen type>, 
                static italic = <same as static member of an already seen type>, static underline = {
                  _vptr.sttfont_format = 0x555555590898 <vtable for sttfont_format+16>, r = 255 '\377', g = 255 '\377', b = 255 '\377', 
                  a = 255 '\377', format = 4 '\004', flags = 0 '\000', padding = "\000", static FORMAT_NONE = 0 '\000', 
                  static FORMAT_BOLD = 1 '\001', static FORMAT_ITALIC = 2 '\002', static FORMAT_UNDERLINE = 4 '\004', 
                  static FORMAT_STRIKETHROUGH = 8 '\b', static FORMAT_RENDER_EVEN_IF_CALLBACK_EXISTS = 128 '\200', 
                  static FORMAT_FLAGS_COLOUR_SET = 1 '\001', static bold = <same as static member of an already seen type>, 
                  static italic = <same as static member of an already seen type>, 
                  static underline = <same as static member of an already seen type>, static strikethrough = {
                    _vptr.sttfont_format = 0x555555590898 <vtable for sttfont_format+16>, r = 255 '\377', g = 255 '\377', b = 255 '\377', 
                    a = 255 '\377', format = 8 '\b', flags = 0 '\000', padding = "\000", static FORMAT_NONE = 0 '\000', 
                    static FORMAT_BOLD = 1 '\001', static FORMAT_ITALIC = 2 '\002', static FORMAT_UNDERLINE = 4 '\004', 
                    static FORMAT_STRIKETHROUGH = 8 '\b', static FORMAT_RENDER_EVEN_IF_CALLBACK_EXISTS = 128 '\200', 
                    static FORMAT_FLAGS_COLOUR_SET = 1 '\001', static bold = <same as static member of an already seen type>, 
                    static italic = <same as static member of an already seen type>, 
                    static underline = <same as static member of an already seen type>, 
                    static strikethrough = <same as static member of an already seen type>, static red = {
                      _vptr.sttfont_format = 0x555555590898 <vtable for sttfont_format+16>, r = 255 '\377', g = 0 '\000', b = 0 '\000', 
                      a = 255 '\377', format = 0 '\000', flags = 1 '\001', padding = "\000", static FORMAT_NONE = 0 '\000', 
                      static FORMAT_BOLD = 1 '\001', static FORMAT_ITALIC = 2 '\002', static FORMAT_UNDERLINE = 4 '\004', 
                      static FORMAT_STRIKETHROUGH = 8 '\b', static FORMAT_RENDER_EVEN_IF_CALLBACK_EXISTS = 128 '\200', 
                      static FORMAT_FLAGS_COLOUR_SET = 1 '\001', static bold = <same as static member of an already seen type>, 
                      static italic = <same as static member of an already seen type>, 
                      static underline = <same as static member of an already seen type>, 
                      static strikethrough = <same as static member of an already seen type>, 
                      static red = <same as static member of an already seen type>, static green = {
                        _vptr.sttfont_format = 0x555555590898 <vtable for sttfont_format+16>, r = 0 '\000', g = 255 '\377', b = 0 '\000', 
                        a = 255 '\377', format = 0 '\000', flags = 1 '\001', padding = "\000", static FORMAT_NONE = 0 '\000', 
                        static FORMAT_BOLD = 1 '\001', static FORMAT_ITALIC = 2 '\002', static FORMAT_UNDERLINE = 4 '\004', 
                        static FORMAT_STRIKETHROUGH = 8 '\b', static FORMAT_RENDER_EVEN_IF_CALLBACK_EXISTS = 128 '\200', 
                        static FORMAT_FLAGS_COLOUR_SET = 1 '\001', static bold = <same as static member of an already seen type>, 
                        static italic = <same as static member of an already seen type>, 
                        static underline = <same as static member of an already seen type>, 
                        static strikethrough = <same as static member of an already seen type>, 
                        static red = <same as static member of an already seen type>, 
                        static green = <same as static member of an already seen type>, static blue = {
                          _vptr.sttfont_format = 0x555555590898 <vtable for sttfont_format+16>, r = 0 '\000', g = 0 '\000', 
                          b = 255 '\377', a = 255 '\377', format = 0 '\000', flags = 1 '\001', padding = "\000", 
                          static FORMAT_NONE = 0 '\000', static FORMAT_BOLD = 1 '\001', static FORMAT_ITALIC = 2 '\002', 
                          static FORMAT_UNDERLINE = 4 '\004', static FORMAT_STRIKETHROUGH = 8 '\b', 
                          static FORMAT_RENDER_EVEN_IF_CALLBACK_EXISTS = 128 '\200', static FORMAT_FLAGS_COLOUR_SET = 1 '\001', 
                          static bold = <same as static member of an already seen type>, 
                          static italic = <same as static member of an already seen type>, 
                          static underline = <same as static member of an already seen type>, 
                          static strikethrough = <same as static member of an already seen type>, 
                          static red = <same as static member of an already seen type>, 
                          static green = <same as static member of an already seen type>, 
                          static blue = <same as static member of an already seen type>, static yellow = {
                            _vptr.sttfont_format = 0x555555590898 <vtable for sttfont_format+16>, r = 255 '\377', g = 255 '\377', 
                            b = 0 '\000', a = 255 '\377', format = 0 '\000', flags = 1 '\001', padding = "\000", 
                            static FORMAT_NONE = 0 '\000', static FORMAT_BOLD = 1 '\001', static FORMAT_ITALIC = 2 '\002', 
                            static FORMAT_UNDERLINE = 4 '\004', static FORMAT_STRIKETHROUGH = 8 '\b', 
                            static FORMAT_RENDER_EVEN_IF_CALLBACK_EXISTS = 128 '\200', static FORMAT_FLAGS_COLOUR_SET = 1 '\001', 
                            static bold = <same as static member of an already seen type>, 
                            static italic = <same as static member of an already seen type>, 
                            static underline = <same as static member of an already seen type>, 
                            static strikethrough = <same as static member of an already seen type>, 
                            static red = <same as static member of an already seen type>, 
--Type <RET> for more, q to quit, c to continue without paging--
                            y seen type>, static blue = <same as static member of an already seen type>, static yellow = <same as static member of an already seen type>, static black = {
                              _vptr.sttfont_format = 0x555555590898 <vtable for sttfont_format+16>, r = 0 '\000', g = 0 '\000', b = 0 '\000', a = 255 '\377', format = 0 '\000', flags = 1 '\001', padding = "\000", static FORMAT_NONE = 0 '\000', static FORMAT_BOLD = 1 '\001', 
                              static FORMAT_ITALIC = 2 '\002', static FORMAT_UNDERLINE = 4 '\004', static FORMAT_STRIKETHROUGH = 8 '\b', static FORMAT_RENDER_EVEN_IF_CALLBACK_EXISTS = 128 '\200', static FORMAT_FLAGS_COLOUR_SET = 1 '\001', 
                              static bold = <same as static member of an already seen type>, static italic = <same as static member of an already seen type>, static underline = <same as static member of an already seen type>, 
                              static strikethrough = <same as static member of an already seen type>, static red = <same as static member of an already seen type>, static green = <same as static member of an already seen type>, 
                              static blue = <same as static member of an already seen type>, static yellow = <same as static member of an already seen type>, static black = <same as static member of an already seen type>, static white = {
                                _vptr.sttfont_format = 0x555555590898 <vtable for sttfont_format+16>, r = 255 '\377', g = 255 '\377', b = 255 '\377', a = 255 '\377', format = 0 '\000', flags = 1 '\001', padding = "\000", static FORMAT_NONE = 0 '\000', 
                                static FORMAT_BOLD = 1 '\001', static FORMAT_ITALIC = 2 '\002', static FORMAT_UNDERLINE = 4 '\004', static FORMAT_STRIKETHROUGH = 8 '\b', static FORMAT_RENDER_EVEN_IF_CALLBACK_EXISTS = 128 '\200', static FORMAT_FLAGS_COLOUR_SET = 1 '\001', 
                                static bold = <same as static member of an already seen type>, static italic = <same as static member of an already seen type>, static underline = <same as static member of an already seen type>, 
                                static strikethrough = <same as static member of an already seen type>, static red = <same as static member of an already seen type>, static green = <same as static member of an already seen type>, 
                                static blue = <same as static member of an already seen type>, static yellow = <same as static member of an already seen type>, static black = <same as static member of an already seen type>, 
                                static white = <same as static member of an already seen type>, static magenta = {_vptr.sttfont_format = 0x555555590898 <vtable for sttfont_format+16>, r = 255 '\377', g = 0 '\000', b = 255 '\377', a = 255 '\377', format = 0 '\000', 
                                  flags = 1 '\001', padding = "\000", static FORMAT_NONE = 0 '\000', static FORMAT_BOLD = 1 '\001', static FORMAT_ITALIC = 2 '\002', static FORMAT_UNDERLINE = 4 '\004', static FORMAT_STRIKETHROUGH = 8 '\b', 
                                  static FORMAT_RENDER_EVEN_IF_CALLBACK_EXISTS = 128 '\200', static FORMAT_FLAGS_COLOUR_SET = 1 '\001', static bold = <same as static member of an already seen type>, static italic = <same as static member of an already seen type>, 
                                  static underline = <same as static member of an already seen type>, static strikethrough = <same as static member of an already seen type>, static red = <same as static member of an already seen type>, 
                                  static green = <same as static member of an already seen type>, static blue = <same as static member of an already seen type>, static yellow = <same as static member of an already seen type>, 
                                  static black = <same as static member of an already seen type>, static white = <same as static member of an already seen type>, static magenta = <same as static member of an already seen type>, static cyan = {
                                    _vptr.sttfont_format = 0x555555590898 <vtable for sttfont_format+16>, r = 0 '\000', g = 255 '\377', b = 255 '\377', a = 255 '\377', format = 0 '\000', flags = 1 '\001', padding = "\000", static FORMAT_NONE = 0 '\000', 
                                    static FORMAT_BOLD = 1 '\001', static FORMAT_ITALIC = 2 '\002', static FORMAT_UNDERLINE = 4 '\004', static FORMAT_STRIKETHROUGH = 8 '\b', static FORMAT_RENDER_EVEN_IF_CALLBACK_EXISTS = 128 '\200', static FORMAT_FLAGS_COLOUR_SET = 1 '\001', 
                                    static bold = <same as static member of an already seen type>, static italic = <same as static member of an already seen type>, static underline = <same as static member of an already seen type>, 
                                    static strikethrough = <same as static member of an already seen type>, static red = <same as static member of an already seen type>, static green = <same as static member of an already seen type>, 
                                    static blue = <same as static member of an already seen type>, static yellow = <same as static member of an already seen type>, static black = <same as static member of an already seen type>, 
                                    static white = <same as static member of an already seen type>, static magenta = <same as static member of an already seen type>, static cyan = <same as static member of an already seen type>, static grey = {
                                      _vptr.sttfont_format = 0x555555590898 <vtable for sttfont_format+16>, r = 128 '\200', g = 128 '\200', b = 128 '\200', a = 255 '\377', format = 0 '\000', flags = 1 '\001', padding = "\000", static FORMAT_NONE = 0 '\000', 
                                      static FORMAT_BOLD = 1 '\001', static FORMAT_ITALIC = 2 '\002', static FORMAT_UNDERLINE = 4 '\004', static FORMAT_STRIKETHROUGH = 8 '\b', static FORMAT_RENDER_EVEN_IF_CALLBACK_EXISTS = 128 '\200', static FORMAT_FLAGS_COLOUR_SET = 1 '\001', 
                                      static bold = <same as static member of an already seen type>, static italic = <same as static member of an already seen type>, static underline = <same as static member of an already seen type>, 
                                      static strikethrough = <same as static member of an already seen type>, static red = <same as static member of an already seen type>, static green = <same as static member of an already seen type>, 
                                      static blue = <same as static member of an already seen type>, static yellow = <same as static member of an already seen type>, static black = <same as static member of an already seen type>, 
                                      static white = <same as static member of an already seen type>, static magenta = <same as static member of an already seen type>, static cyan = <same as static member of an already seen type>, 
                                      static grey = <same as static member of an already seen type>, static reset = {<No data fields>}}, static reset = <same as static member of an already seen type>}, static grey = <same as static member of an already seen type>, 
                                  static reset = <same as static member of an already seen type>}, static cyan = <same as static member of an already seen type>, static grey = <same as static member of an already seen type>, 
                                static reset = <same as static member of an already seen type>}, static magenta = <same as static member of an already seen type>, static cyan = <same as static member of an already seen type>, 
                              static grey = <same as static member of an already seen type>, static reset = <same as static member of an already seen type>}, static white = <same as static member of an already seen type>, 
                            static magenta = <same as static member of an already seen type>, static cyan = <same as static member of an already seen type>, static grey = <same as static member of an already seen type>, 
                            static reset = <same as static member of an already seen type>}, static black = <same as static member of an already seen type>, static white = <same as static member of an already seen type>, 
                          static magenta = <same as static member of an already seen type>, static cyan = <same as static member of an already seen type>, static grey = <same as static member of an already seen type>, 
                          static reset = <same as static member of an already seen type>}, static yellow = <same as static member of an already seen type>, static black = <same as static member of an already seen type>, 
                        static white = <same as static member of an already seen type>, static magenta = <same as static member of an already seen type>, static cyan = <same as static member of an already seen type>, static grey = <same as static member of an already seen type>, 
                        static reset = <same as static member of an already seen type>}, static blue = <same as static member of an already seen type>, static yellow = <same as static member of an already seen type>, static black = <same as static member of an already seen type>, 
                      static white = <same as static member of an already seen type>, static magenta = <same as static member of an already seen type>, static cyan = <same as static member of an already seen type>, static grey = <same as static member of an already seen type>, 
                      static reset = <same as static member of an already seen type>}, static green = <same as static member of an already seen type>, static blue = <same as static member of an already seen type>, static yellow = <same as static member of an already seen type>, 
                    static black = <same as static member of an already seen type>, static white = <same as static member of an already seen type>, static magenta = <same as static member of an already seen type>, static cyan = <same as static member of an already seen type>, 
                    static grey = <same as static member of an already seen type>, static reset = <same as static member of an already seen type>}, static red = <same as static member of an already seen type>, static green = <same as static member of an already seen type>, 
                  static blue = <same as static member of an already seen type>, static yellow = <same as static member of an already seen type>, static black = <same as static member of an already seen type>, static white = <same as static member of an already seen type>, 
                  static magenta = <same as static member of an already seen type>, static cyan = <same as static member of an already seen type>, static grey = <same as static member of an already seen type>, static reset = <same as static member of an already seen type>}, 
                static strikethrough = <same as static member of an already seen type>, static red = <same as static member of an already seen type>, static green = <same as static member of an already seen type>, static blue = <same as static member of an already seen type>, 
                static yellow = <same as static member of an already seen type>, static black = <same as static member of an already seen type>, static white = <same as static member of an already seen type>, static magenta = <same as static member of an already seen type>, 
                static cyan = <same as static member of an already seen type>, static grey = <same as static member of an already seen type>, static reset = <same as static member of an already seen type>}, static underline = <same as static member of an already seen type>, 
              static strikethrough = <same as static member of an already seen type>, static red = <same as static member of an already seen type>, static green = <same as static member of an already seen type>, static blue = <same as static member of an already seen type>, 
              static yellow = <same as static member of an already seen type>, static black = <same as static member of an already seen type>, static white = <same as static member of an already seen type>, static magenta = <same as static member of an already seen type>, 
              static cyan = <same as static member of an already seen type>, static grey = <same as static member of an already seen type>, static reset = <same as static member of an already seen type>}, static italic = <same as static member of an already seen type>, 
            static underline = <same as static member of an already seen type>, static strikethrough = <same as static member of an already seen type>, static red = <same as static member of an already seen type>, static green = <same as static member of an already seen type>, 
            static blue = <same as static member of an already seen type>, static yellow = <same as static member of an already seen type>, static black = <same as static member of an already seen type>, static white = <same as static member of an already seen type>, 
            static magenta = <same as static member of an already seen type>, static cyan = <same as static member of an already seen type>, static grey = <same as static member of an already seen type>, static reset = <same as static member of an already seen type>}}

mItems=std::长度为0、容量为0的向量,activeFormat={
_vptr.sttfont_格式=0x5555590898,r=255'\377',g=255'\377',b=255'\377',
a=255'\377',格式=0'\000',标志=0'\000',padding=“\000”,静态格式\u NONE=0'\000',
静态格式\u粗体=1'\001',静态格式\u斜体=2'\002',静态格式\u下划线=4'\004',
静态格式删除线=8'\b',静态格式渲染即使存在回调=128'\200',
静态格式\u标志\u颜色\u集=1'\001',静态粗体={
_vptr.sttfont_格式=0x5555590898,r=255'\377',g=255'\377',b=255'\377',
a=255'\377',format=1'\001',flags=0'\000',padding=“\000”,static format\u NONE=0'\000',
静态格式\u粗体=1'\001',静态格式\u斜体=2'\002',静态格式\u下划线=4'\004',
静态格式删除线=8'\b',静态格式渲染即使存在回调=128'\200',
静态格式\u标志\u颜色\u集=1'\001',静态粗体=,静态斜体={
_vptr.sttfont_格式=0x5555590898,r=255'\377',g=255'\377',b=255'\377',
a=255'\377',格式=2'\002',标志=0'\000',padding=“\000”,静态格式\u NONE=0'\000',
静态格式\u粗体=1'\001',静态格式\u斜体=2'\002',静态格式\u下划线=4'\004',
静态格式删除线=8'\b',静态格式渲染即使存在回调=128'\200',
静态格式\u标志\u颜色\u集合=1'\001',静态粗体=,
静态斜体=,静态下划线={
_vptr.sttfont_格式=0x5555590898,r=255'\377',g=255'\377',b=255'\377',
a=255'\377',格式=4'\004',标志=0'\000',padding=“\000”,静态格式\u NONE=0'\000',
静态格式\u粗体=1'\001',静态格式\u斜体=2'\002',静态格式\u下划线=4'\004',
静态格式删除线=8'\b',静态格式渲染即使存在回调=128'\200',
静态格式\u标志\u颜色\u集合=1'\001',静态粗体=,
静态斜体=,
静态下划线=,静态删除线={
_vptr.sttfont_格式=0x5555590898,r=255'\377',g=255'\377',b=255'\377',
a=255'\377',format=8'\b',flags=0'\000',padding=“\000”,static format\u NONE=0'\000',
静态格式\u粗体=1'\001',静态格式\u斜体=2'\002',静态格式\u下划线=4'\004',
静态格式删除线=8'\b',静态格式渲染即使存在回调=128'\200',
静态格式\u标志\u颜色\u集合=1'\001',静态粗体=,
静态斜体=,
静态下划线=,
静态删除线=,静态红色={
_vptr.sttfont_格式=0x5555590898,r=255'\377',g=0'\000',b=0'\000',
a=255'\377',格式=0'\000',标志=1'\001',padding=“\000”,静态格式\u NONE=0'\000',
静态格式\u粗体=1'\001',静态格式\u斜体=2'\002',静态格式\u下划线=4'\004',
静态格式删除线=8'\b',静态格式渲染即使存在回调=128'\200',
静态格式\u标志\u颜色\u集合=1'\001',静态粗体=,
静态斜体=,
静态下划线=,
静态删除线=,
静态红色=,静态绿色={
_vptr.sttfont_格式=0x5555590898,r=0'\000',g=255'\377',b=0'\000',
a=255'\377',格式=0'\000',标志=1'\001',padding=“\000”,静态格式\u NONE=0'\000',
静态格式\u粗体=1'\001',静态格式\u斜体=2'\002',静态格式\u下划线=4'\004',
静态格式删除线=8'\b',静态格式渲染即使存在回调=128'\200',
静态格式\u标志\u颜色\u集合=1'\001',静态粗体=,
静态斜体=,
静态下划线=,
静态删除线=,
静态红色=,
静态绿色=,静态蓝色={
_vptr.sttfont_格式=0x5555590898,r=0'\000',g=0'\000',
b=255'\377',a=255'\377',格式=0'\000',标志=1'\001',padding=“\000”,
静态格式\u NONE=0'\000',静态格式\u BOLD=1'\001',静态格式\u ITALIC=2'\002',
静态格式\u下划线=4'\004',静态格式\u删除线=8'\b',
静态格式\u渲染\u偶数\u如果\u回调\u存在=128'\200',静态格式\u标志\u颜色\u集=1'\001',
静态粗体