Closed Bug 1604971 Opened 4 years ago Closed 4 years ago

Prettyprint structs generated by cbindgen

Categories

(Core :: CSS Parsing and Computation, task, P3)

task

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: TYLin, Unassigned)

References

Details

I notice after Bug 1602317 moving consts into the structs which is generated by cbindgen, printing the structs in gdb will also print those const. If a struct has many consts like WritingMode, the printed string becomes very verbose. Same of any logical layout structs like LogicalSize, LogicalRect, etc. that have a WritingMode member variables.

This is an example of a LogicalSize dump in gdb.

(rr) p cbSize
$5 = {mWritingMode = {bits = 1 '\001', static VERTICAL = {bits = 1 '\001', static VERTICAL = <same as static member of an already seen type>, static INLINE_REVERSED = {bits = 2 '\002', 
        static VERTICAL = <same as static member of an already seen type>, static INLINE_REVERSED = <same as static member of an already seen type>, static VERTICAL_LR = {bits = 4 '\004', 
          static VERTICAL = <same as static member of an already seen type>, static INLINE_REVERSED = <same as static member of an already seen type>, static VERTICAL_LR = <same as static member of an already seen type>, 
          static LINE_INVERTED = {bits = 8 '\b', static VERTICAL = <same as static member of an already seen type>, static INLINE_REVERSED = <same as static member of an already seen type>, 
            static VERTICAL_LR = <same as static member of an already seen type>, static LINE_INVERTED = <same as static member of an already seen type>, static RTL = {bits = 16 '\020', 
              static VERTICAL = <same as static member of an already seen type>, static INLINE_REVERSED = <same as static member of an already seen type>, static VERTICAL_LR = <same as static member of an already seen type>, 
              static LINE_INVERTED = <same as static member of an already seen type>, static RTL = <same as static member of an already seen type>, static VERTICAL_SIDEWAYS = {bits = 32 ' ', 
                static VERTICAL = <same as static member of an already seen type>, static INLINE_REVERSED = <same as static member of an already seen type>, static VERTICAL_LR = <same as static member of an already seen type>, 
                static LINE_INVERTED = <same as static member of an already seen type>, static RTL = <same as static member of an already seen type>, static VERTICAL_SIDEWAYS = <same as static member of an already seen type>, 
                static TEXT_SIDEWAYS = {bits = 64 '@', static VERTICAL = <same as static member of an already seen type>, static INLINE_REVERSED = <same as static member of an already seen type>, 
                  static VERTICAL_LR = <same as static member of an already seen type>, static LINE_INVERTED = <same as static member of an already seen type>, static RTL = <same as static member of an already seen type>, 
                  static VERTICAL_SIDEWAYS = <same as static member of an already seen type>, static TEXT_SIDEWAYS = <same as static member of an already seen type>, static UPRIGHT = <optimized out>}, static UPRIGHT = <optimized out>}, 
              static TEXT_SIDEWAYS = <same as static member of an already seen type>, static UPRIGHT = <optimized out>}, static VERTICAL_SIDEWAYS = <same as static member of an already seen type>, 
            static TEXT_SIDEWAYS = <same as static member of an already seen type>, static UPRIGHT = <optimized out>}, static RTL = <same as static member of an already seen type>, 
          static VERTICAL_SIDEWAYS = <same as static member of an already seen type>, static TEXT_SIDEWAYS = <same as static member of an already seen type>, static UPRIGHT = <optimized out>}, 
        static LINE_INVERTED = <same as static member of an already seen type>, static RTL = <same as static member of an already seen type>, static VERTICAL_SIDEWAYS = <same as static member of an already seen type>, 
        static TEXT_SIDEWAYS = <same as static member of an already seen type>, static UPRIGHT = <optimized out>}, static VERTICAL_LR = <same as static member of an already seen type>, 
      static LINE_INVERTED = <same as static member of an already seen type>, static RTL = <same as static member of an already seen type>, static VERTICAL_SIDEWAYS = <same as static member of an already seen type>, 
      static TEXT_SIDEWAYS = <same as static member of an already seen type>, static UPRIGHT = <optimized out>}, static INLINE_REVERSED = <same as static member of an already seen type>, 
    static VERTICAL_LR = <same as static member of an already seen type>, static LINE_INVERTED = <same as static member of an already seen type>, static RTL = <same as static member of an already seen type>, 
    static VERTICAL_SIDEWAYS = <same as static member of an already seen type>, static TEXT_SIDEWAYS = <same as static member of an already seen type>, static UPRIGHT = <optimized out>}, mSize = {<mozilla::gfx::BaseSize<int, nsSize>> = {
      {{width = -526, height = 59760}, components = {-526, 59760}}}, <No data fields>}}

I wonder whether it is possible to add a general prettyprinter to exclude all these consts in https://searchfox.org/mozilla-central/source/python/gdbpp/gdbpp. Otherwise we could add prettyprinters to those structs that was inpected frequently (either directly or indirectly) in gdb such as WritingMode.

set print static-members off?

I think per the above (and after checking on slack I wasn't misunderstanding) this is wfm, but lmk if you disagree :)

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME

I agree. The gdb config in comment 1 works for me.

You need to log in before you can comment on or make changes to this bug.