cprint settings via print parameters
This issue is to handle cprint options as gdb.Parameter
, similar to what is done in !140 (merged) for the sleep size:
- replace:
- GV_ModuleState.sticky_display_mode = os.environ.get("CPRINT_V", '0')
- GV_ModuleState.sticky_pretty_mode = os.environ.get("CPRINT_P", '')
+ GV_ModuleState.sticky_display_mode = ParameterCPrintDisplayMode()
+ GV_ModuleState.sticky_pretty_mode = ParameterCPrintDisplayPretty()
- Write the parameter classes and move the documentation (and validation to set the mode, both in general and as one-time override like in "auto-step") there; starter:
class ParameterCPrintDisplayMode (gdb.Parameter):
"""display mode for cprint"""
def __init__(self):
self.set_doc = """Set display mode for cprint.
MOVE DOCS FOR DISPLAY MODE HERE"""
self.show_doc = "Speed value for auto-step."
super(ParameterCPrintDisplayMode, self).__init__("print cprint-display-mode", gdb.COMMAND_DATA, gdb.PARAM_ENUM)
self.value = '0'
self.backup = self.value
...
class ParameterCPrintDisplayPretty(gdb.Parameter):
"""default for pretty-printing with cprint"""
def __init__(self):
self.set_doc = """Set default for pretty-display.
MOVE DOCS FOR PRETTY-PRINT HERE"""
self.show_doc = "Pretty-printing for cprint."
super(ParameterCPrintDisplayPretty, self).__init__("print cprint-pretty-display", gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)
self.value = false
@rdubner What's your take on this?