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