diff --git a/tools/lldb_pretty_printers.py b/tools/lldb_pretty_printers.py index 7bb6aa78c2..dd4fe77add 100644 --- a/tools/lldb_pretty_printers.py +++ b/tools/lldb_pretty_printers.py @@ -1,7 +1,7 @@ # pretty printing for the zig language, zig standard library, and zig stage 2 compiler. # put commands in ~/.lldbinit to run them automatically when starting lldb # `command script import /path/to/zig/tools/lldb_pretty_printers.py` to import this file -# `type category enable zig` to enable pretty printing for the zig language +# `type category enable zig.lang` to enable pretty printing for the zig language # `type category enable zig.std` to enable pretty printing for the zig standard library # `type category enable zig.stage2` to enable pretty printing for the zig stage 2 compiler import lldb @@ -688,11 +688,14 @@ def add(debugger, *, category, regex=False, type, identifier=None, synth=False, def MultiArrayList_Entry(type): return '^multi_array_list\\.MultiArrayList\\(%s\\)\\.Entry__struct_[1-9][0-9]*$' % type def __lldb_init_module(debugger, _=None): + # Initialize Zig Categories + debugger.HandleCommand('type category define --language c99 zig.lang zig.std') + # Initialize Zig Language - add(debugger, category='zig', regex=True, type='^\\[\\]', identifier='zig_Slice', synth=True, expand=True, summary='len=${svar%#}') - add(debugger, category='zig', type='[]u8', identifier='zig_String', summary=True) - add(debugger, category='zig', regex=True, type='^\\?', identifier='zig_Optional', synth=True, summary=True) - add(debugger, category='zig', regex=True, type='^(error{.*}|anyerror)!', identifier='zig_ErrorUnion', synth=True, inline_children=True, summary=True) + add(debugger, category='zig.lang', regex=True, type='^\\[\\]', identifier='zig_Slice', synth=True, expand=True, summary='len=${svar%#}') + add(debugger, category='zig.lang', type='[]u8', identifier='zig_String', summary=True) + add(debugger, category='zig.lang', regex=True, type='^\\?', identifier='zig_Optional', synth=True, summary=True) + add(debugger, category='zig.lang', regex=True, type='^(error{.*}|anyerror)!', identifier='zig_ErrorUnion', synth=True, inline_children=True, summary=True) # Initialize Zig Standard Library add(debugger, category='zig.std', type='mem.Allocator', summary='${var.ptr}')