new view rule table definition in df, merging graphical view rules & views totally

This commit is contained in:
Ryan Fleury
2024-09-13 13:39:40 -07:00
parent 7cd1d175de
commit 793ad8fe1e
10 changed files with 296 additions and 159 deletions
-84
View File
@@ -81,90 +81,6 @@ D_CmdTable: // | | | |
////////////////////////////////
//~ rjf: Built-In View Rules
//
// @view_rule_info
//
// NOTE(rjf): View rules are subtle in that they may impact any subset of the
// eval visualization pipeline. The "array" view rule, for example, functions
// by tweaking the type of an eval from `X *` to `X (*)[N]` (where N is
// computed from whatever expression is specified by the view rule). The "list"
// view rule, on the other hand, does not require any changes to the actual
// eval nor its type - instead, it follows an alternative path in constructing
// "viz blocks", and then constructing "viz rows" from those blocks. Compare
// these to the simpler 'dec', 'bin', or 'oct' rules, which simply tweak the
// radix used when stringizing numbers, which is something that only occurs in
// single-line eval stringization building.
//
// As such, each view rule specification has a mask, which determines which
// stages it may be used for. For a given view rule specification, if the bit
// corresponding to a particular eval stage is set, then that view rule spec-
// -ification also includes a hook which can be called from that stage.
//
// Below is a list of the stages in the eval visualization pipeline, as well as
// abbreviations which are used in the tables.
//
// expr resolution, "xp" -> provides a chance for a view rule to make
// modifications to expression trees that it is
// applied to
//
// viz block prod, "vb" -> given a resolved eval, produce a list of non-
// windowed "viz blocks", which correspond to one or
// many contiguous rows in a watch-window-style UI.
// one level of expanded struct members, with no sub-
// expansions, would be one viz block. if one of those
// members - in the middle - were expanded too, then
// it would require three viz blocks - one for the
// members before the sub-expansion, one for the
// sub expansion members, and one for the members
// after, and so on. this is done recursively.
//
// viz row prod, "vr" -> given a list of viz blocks, a windowed list of viz
// rows may be produced. each of these rows has info
// for building actual UI in e.g. a watch window -
// whether or not the row can be expanded, whether or
// not the row's value can be edited, what the edit-
// able string is for a row, what the display string
// is for a row, what the expression string is for a
// row, what the type is for a row, and so on.
//
// line stringize, "ls" -> this is the stage used to produce display strings
// in the "viz row prod" stage, as well as basically
// any time UI needs to display the result of an eval
// in a single line. this also occurs recursively,
// descending into members & elements as needed,
// constrained by # of available pixels and font size
// and so on.
//
// row ui build, "ru" -> finally, after the previous stages are completed,
// ui can finally be built according to all of the
// per-row information produced. this is the stage
// where view rules can insert their own arbitrary ui
// on a per-row basis.
//
// view ui build, "vu" -> view rules which want to supply more sophisticated
// visualizers have the ability to provide full
// arbitrary UI hooks, which can either be produced
// in a minified form via watch views, or via a
// standalone tab.
//
// A few other bits are included for various ways in which a view rule may be
// applied throughout the eval visualization pipeline. A list follows:
//
// inherited, "ih" -> is this view rule included, or not included, in
// child expansions?
//
// expandable, "ex" -> does this view rule force the ability to expand
// an expression, even if traditional analysis of type
// info would not allow expansion?
//
// Not all of these stages are specified at this layer, however, since the
// "df_core" layer is for the non-graphical core debugger features. So the
// information pertaining to the eval visualization pipeline stages which
// do require graphical subsystems (e.g. UI, fonts, rendering) are specified
// in the "df_gfx" layer.
//
// For any view rules in this layer which also have graphical features, they
// are specified in both tables under the same name.
@table(coverage_check name name_lower string ih ex xp vb display_name docs schema description)
D_ViewRuleTable:
-29
View File
@@ -231,35 +231,6 @@ d_cfg_table_push_unparsed_string(Arena *arena, D_CfgTable *table, String8 string
}
}
internal D_CfgTable
d_cfg_table_from_inheritance(Arena *arena, D_CfgTable *src)
{
D_CfgTable dst_ = {0};
D_CfgTable *dst = &dst_;
{
dst->slot_count = src->slot_count;
dst->slots = push_array(arena, D_CfgSlot, dst->slot_count);
}
for(D_CfgVal *src_val = src->first_val; src_val != 0 && src_val != &d_nil_cfg_val; src_val = src_val->linear_next)
{
D_ViewRuleSpec *spec = d_view_rule_spec_from_string(src_val->string);
if(spec->info.flags & D_ViewRuleSpecInfoFlag_Inherited)
{
U64 hash = d_hash_from_string(spec->info.string);
U64 dst_slot_idx = hash%dst->slot_count;
D_CfgSlot *dst_slot = &dst->slots[dst_slot_idx];
D_CfgVal *dst_val = push_array(arena, D_CfgVal, 1);
dst_val->first = src_val->first;
dst_val->last = src_val->last;
dst_val->string = src_val->string;
dst_val->insertion_stamp = dst->insertion_stamp_counter;
SLLStackPush_N(dst_slot->first, dst_val, hash_next);
dst->insertion_stamp_counter += 1;
}
}
return dst_;
}
internal D_CfgVal *
d_cfg_val_from_string(D_CfgTable *table, String8 string)
{
-1
View File
@@ -507,7 +507,6 @@ internal String8List d_possible_path_overrides_from_maps_path(Arena *arena, D_Pa
//~ rjf: Config Type Pure Functions
internal void d_cfg_table_push_unparsed_string(Arena *arena, D_CfgTable *table, String8 string, D_CfgSrc source);
internal D_CfgTable d_cfg_table_from_inheritance(Arena *arena, D_CfgTable *src);
internal D_CfgVal *d_cfg_val_from_string(D_CfgTable *table, String8 string);
////////////////////////////////
+86
View File
@@ -801,6 +801,92 @@ DF_IconTable:
@expand(DF_IconTable a) `str8_lit_comp("$(a.text)")`;
}
////////////////////////////////
//~ rjf: Built-In View Rules
@table(name name_lower display_name params_schema icon can_filter filter_is_code typing_automatically_filters show_in_docs description)
DF_ViewRuleTable:
{
//- rjf: basics
{ Empty empty "" "" Null 0 0 0 0 "" }
{ GettingStarted getting_started "Getting Started" "" QuestionMark 0 0 0 0 "" }
//- rjf: meta (settings)
{ ExceptionFilters exception_filters "Exception Filters" "" Gear 0 0 0 1 "An interface which controls whether or not the debugger will halt attached processes upon encountering specific exception codes for the first time." }
{ Settings settings "Settings" "" Gear 0 0 0 1 "An interface to modify general settings for the debugger's appearance and behavior." }
//- rjf: temporary view for loading files - must analyze file before picking viewer
{ PendingFile pending_file "Pending File" "" FileOutline 0 0 0 0 "" }
//- rjf: query listers
{ Commands commands "Commands" "" List 0 0 0 0 "" }
{ FileSystem file_system "File System" "" FileOutline 0 0 0 0 "" }
{ SystemProcesses system_processes "System Processes" "" Null 0 0 0 0 "" }
{ EntityLister entity_lister "Entity List" "" Null 0 0 0 0 "" }
{ SymbolLister symbol_lister "Symbols" "" Null 0 0 0 0 "" }
//- rjf: watch or watch-style tables
{ Watch watch "Watch" "" Binoculars 1 1 1 1 "The familiar 'watch window' debugger interface. Allows the inputting of a number of expressions. Each expression in the table is evaluated within the context of the selected thread's selected call stack frame. If applicable (depending on visualization rules and the expression's type), these expressions may be hierarchically expanded, which displays children as more rows in the table. The values of these expressions may also be edited, and if possible, can be used to write to registers or memory in attached processes. Also contains a new *view rule* column, not found in other major debuggers, which allows per-row specification of various visualization rules. These view rules may be used to visualize and inspect the evaluation of expressions in a variety of ways. To learn more, read the 'View Rules' section." }
{ Locals locals "Locals" "" Binoculars 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with local variables found within the selected call stack frame of the selected thread, according to the associated debug info. View rules and evaluation values can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
{ Registers registers "Registers" "" Binoculars 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with all register names according to the selected thread's architecture. View rules and evaluation values can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
{ Globals globals "Globals" "" Binoculars 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with all global variables within the selected thread's module. View rules and evaluation values can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
{ ThreadLocals thread_locals "Thread Locals" "" Binoculars 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with all thread local variables within the selected thread's module. View rules and evaluation values can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
{ Types types "Types" "" Binoculars 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with all types within the selected thread's module. View rules can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
{ Procedures procedures "Procedures" "" Binoculars 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with all procedures within the selected thread's module. View rules can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
//- rjf: configuration watch tables
{ Targets targets "Targets" "" Target 1 1 1 1 "Displays a list of all targets, as well as controls for enabling, disabling, launching, editing, or deleting each target. For more information on targets, read the `Targets` section." }
{ FilePathMap file_path_map "File Path Map" "" FileOutline 1 1 1 1 "Displays a table of *path maps*. Each path map is a pair of file or folder paths, one being a 'source' path, and one being a 'destination' path. These pairs are used by the debugger when automatically searching for specific files - for instance, when attempting to snap to a source code location specified by debug info. If debug info refers to a path on the machine on which a target executable was originally built, but that path is not valid on the debugger machine, but some alternative path exists, then path maps may be used to redirect the debugger from the debug info's specified paths to the associated appropriate debugger machine file paths." }
{ AutoViewRules auto_view_rules "Auto View Rules" "" Binoculars 1 1 1 1 "Displays a table of *auto view rules*. Each *auto view rule* is a pair, with one element being a type, and the other being a view rule, which should be automatically applied to expressions of that type, when possible." }
{ Breakpoints breakpoints "Breakpoints" "" CircleFilled 1 1 1 1 "Displays a table of all breakpoints, containing information about each breakpoint's name, location, and hit count. Also contains per-breakpoint controls for enabling, deleting, or editing each breakpoint. For more information on breakpoints and their features, read the 'Breakpoints' section." }
{ WatchPins watch_pins "Watch Pins" "" Pin 1 1 1 1 "Displays a table of all watch pins (watched expressions, like those found in `Watch`, but instead of being within a table, being pinned to some source code location, like breakpoints). This table contains each pin's name, location, and controls for editing or deleting each pin." }
//- rjf: debug entity info watch tables
{ Scheduler scheduler "Scheduler" "" Scheduler 1 1 1 1 "Displays all processes and threads to which the debugger is currently attached, and contains controls for selecting and freezing threads." }
{ CallStack call_stack "Call Stack" "" Thread 1 1 1 1 "Displays the call stack of the currently selected thread. Each frame in the call stack contains the associated module, function name, and return address. Allows selection of a particular call stack frame other than the top." }
{ Modules modules "Modules" "" Module 1 1 1 1 "Displays a table of all modules currently loaded by any process to which the debugger is attached. This table displays each module's name, virtual address range in the containing process' address space, and which debug info file is being used by the debugger for the associated module." }
//- rjf: visualizers
{ Text text "Text" "x:{'lang':lang, 'size':expr}" FileOutline 0 0 0 0 "" }
{ Disasm disasm "Disassembly" "x:{'arch':arch, 'size':expr}" Glasses 0 0 0 1 "Displays disassembled instructions in a textual form from the selected thread's containing process virtual address space." }
{ Output output "Output" "" List 0 0 0 1 "Displays debug strings, output from attached processes." }
{ Memory memory "Memory" "x:{'size':expr}" Grid 0 0 0 1 "A hex-editor-like grid interface for viewing memory." }
{ Bitmap bitmap "Bitmap" "x:{'w':expr, 'h':expr, 'fmt':tex2dformat}" Binoculars 0 0 0 1 "Visualizes memory as a bitmap." }
{ ColorRGBA color_rgba "Color (RGBA)" "" Palette 0 0 0 1 "Visualizes memory as an RGBA color." }
{ Geo3D geo3d "Geometry (3D)" "x:{'count':expr, 'vtx':expr, 'vtx_size':expr}" Binoculars 0 0 0 1 "Visualizes memory as 3D geometry." }
}
@enum DF_ViewRuleKind:
{
Null,
@expand(DF_ViewRuleTable a) `$(a.name)`,
COUNT
}
@struct DF_ViewRuleInfo:
{
`String8 string`;
`String8 description`;
`String8 display_name`;
`String8 params_schema`;
`DF_IconKind icon_kind`;
`DF_ViewRuleInfoFlags flags`;
`DF_ViewRuleUIFunctionType *ui`;
};
/*
@gen
{
@expand(DF_ViewRuleTable a) `DF_VIEW_RULE_UI_FUNCTION_DEF($(a.name_lower));`
}
@data(DF_ViewRuleInfo) df_view_rule_kind_info_table:
{
`{0}`,
@expand(DF_ViewRuleTable a) `{str8_lit_comp("$(a.name_lower)"), str8_lit_comp("$(a.description)"), str8_lit_comp("$(a.display_name)"), str8_lit_comp("$(a.params_schema)"), DF_IconKind_$(a.icon), (DF_ViewRuleInfoFlag_ShowInDocs*$(a.show_in_docs)|DF_ViewRuleInfoFlag_CanFilter*$(a.can_filter)|DF_ViewRuleInfoFlag_FilterIsCode*$(a.filter_is_code)|DF_ViewRuleInfoFlag_TypingAutomaticallyFilters*$(a.typing_automatically_filters)), DF_VIEW_RULE_UI_FUNCTION_NAME($(a.name_lower))}`,
}
*/
////////////////////////////////
//~ rjf: Gfx Layer View Kinds
+13
View File
@@ -2134,6 +2134,19 @@ d_eval_string_from_file_path(Arena *arena, String8 string)
return result;
}
////////////////////////////////
//~ rjf: View Rule Kind Functions
internal DF_ViewRuleInfo *
df_view_rule_info_from_string(String8 string)
{
DF_ViewRuleInfo *info = &df_nil_view_rule_info;
{
// TODO(rjf)
}
return info;
}
////////////////////////////////
//~ rjf: View Spec State Functions
+26 -15
View File
@@ -151,9 +151,27 @@ typedef DF_VIEW_CMD_FUNCTION_SIG(DF_ViewCmdFunctionType);
#define DF_VIEW_UI_FUNCTION_DEF(name) internal DF_VIEW_UI_FUNCTION_SIG(DF_VIEW_UI_FUNCTION_NAME(name))
typedef DF_VIEW_UI_FUNCTION_SIG(DF_ViewUIFunctionType);
////////////////////////////////
//~ rjf: View Rule Info Types
typedef U32 DF_ViewRuleInfoFlags;
enum
{
DF_ViewRuleInfoFlag_ShowInDocs = (1<<0),
DF_ViewRuleInfoFlag_CanFilter = (1<<1),
DF_ViewRuleInfoFlag_FilterIsCode = (1<<2),
DF_ViewRuleInfoFlag_TypingAutomaticallyFilters = (1<<3),
};
#define DF_VIEW_RULE_UI_FUNCTION_SIG(name) void name(DF_View *view, String8 string, MD_Node *params, Rng2F32 rect)
#define DF_VIEW_RULE_UI_FUNCTION_NAME(name) df_view_rule_ui_##name
#define DF_VIEW_RULE_UI_FUNCTION_DEF(name) internal DF_VIEW_RULE_UI_FUNCTION_SIG(DF_VIEW_RULE_UI_FUNCTION_NAME(name))
typedef DF_VIEW_RULE_UI_FUNCTION_SIG(DF_ViewRuleUIFunctionType);
////////////////////////////////
//~ rjf: View Specification Types
#if 1 // TODO(rjf): @msgs
typedef U32 DF_ViewSpecFlags;
enum
{
@@ -206,6 +224,7 @@ struct DF_CmdParamSlotViewSpecRuleList
DF_CmdParamSlotViewSpecRuleNode *last;
U64 count;
};
#endif
////////////////////////////////
//~ rjf: View Types
@@ -361,21 +380,6 @@ struct DF_DragDropPayload
TxtPt text_point;
};
////////////////////////////////
//~ rjf: Rich Hover Types
#if 0 // TODO(rjf): @msgs
typedef struct DF_RichHoverInfo DF_RichHoverInfo;
struct DF_RichHoverInfo
{
D_Handle process;
Rng1U64 vaddr_range;
D_Handle module;
Rng1U64 voff_range;
DI_Key dbgi_key;
};
#endif
////////////////////////////////
//~ rjf: View Rule Spec Types
@@ -1004,6 +1008,8 @@ read_only global DF_Entity d_nil_entity =
read_only global DF_CmdKindInfo df_nil_cmd_kind_info = {0};
read_only global DF_ViewRuleInfo df_nil_view_rule_info = {0};
read_only global DF_ViewSpec df_nil_view_spec =
{
&df_nil_view_spec,
@@ -1277,6 +1283,11 @@ internal String8 d_eval_string_from_entity(Arena *arena, DF_Entity *entity);
internal String8 d_file_path_from_eval_string(Arena *arena, String8 string);
internal String8 d_eval_string_from_file_path(Arena *arena, String8 string);
////////////////////////////////
//~ rjf: View Rule Kind Functions
internal DF_ViewRuleInfo *df_view_rule_info_from_string(String8 string);
////////////////////////////////
//~ rjf: View Spec State Functions
+33 -17
View File
@@ -776,24 +776,40 @@ DF_IconKind_Null,
DF_IconKind_Null,
};
DF_ViewRuleSpecInfo df_g_gfx_view_rule_spec_info_table[16] =
DF_ViewRuleSpecInfo df_g_gfx_view_rule_spec_info_table[32] =
{
{ str8_lit_comp("array"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("list"), (DF_ViewRuleSpecInfoFlag_VizRowProd*1)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), DF_VIEW_RULE_VIZ_ROW_PROD_FUNCTION_NAME(list) , 0, 0 },
{ str8_lit_comp("dec"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*1)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, DF_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(dec) , 0 },
{ str8_lit_comp("bin"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*1)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, DF_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(bin) , 0 },
{ str8_lit_comp("oct"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*1)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, DF_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(oct) , 0 },
{ str8_lit_comp("hex"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*1)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, DF_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(hex) , 0 },
{ str8_lit_comp("only"), (DF_ViewRuleSpecInfoFlag_VizRowProd*1)|(DF_ViewRuleSpecInfoFlag_LineStringize*1)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), DF_VIEW_RULE_VIZ_ROW_PROD_FUNCTION_NAME(only) , DF_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(only) , 0 },
{ str8_lit_comp("omit"), (DF_ViewRuleSpecInfoFlag_VizRowProd*1)|(DF_ViewRuleSpecInfoFlag_LineStringize*1)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), DF_VIEW_RULE_VIZ_ROW_PROD_FUNCTION_NAME(omit) , DF_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(omit) , 0 },
{ str8_lit_comp("no_addr"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*1)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, DF_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(no_addr) , 0 },
{ str8_lit_comp("checkbox"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*1)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, DF_VIEW_RULE_ROW_UI_FUNCTION_NAME(checkbox) },
{ str8_lit_comp("color_rgba"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*1)|(DF_ViewRuleSpecInfoFlag_ViewUI*1), 0, 0, DF_VIEW_RULE_ROW_UI_FUNCTION_NAME(color_rgba) },
{ str8_lit_comp("text"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*1), 0, 0, 0 },
{ str8_lit_comp("disasm"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*1), 0, 0, 0 },
{ str8_lit_comp("memory"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*1), 0, 0, 0 },
{ str8_lit_comp("bitmap"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*1), 0, 0, 0 },
{ str8_lit_comp("geo3d"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*1), 0, 0, 0 },
{ str8_lit_comp("Empty"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("GettingStarted"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("ExceptionFilters"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Settings"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("PendingFile"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Commands"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("FileSystem"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("SystemProcesses"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("EntityLister"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("SymbolLister"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Watch"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Locals"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Registers"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Globals"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("ThreadLocals"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Types"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Procedures"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Targets"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("FilePathMap"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("AutoViewRules"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Breakpoints"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("WatchPins"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Scheduler"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("CallStack"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Modules"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Text"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Disasm"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Output"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Memory"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Bitmap"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("ColorRGBA"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
{ str8_lit_comp("Geo3D"), (DF_ViewRuleSpecInfoFlag_VizRowProd*0)|(DF_ViewRuleSpecInfoFlag_LineStringize*0)|(DF_ViewRuleSpecInfoFlag_RowUI*0)|(DF_ViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0 },
};
String8 df_g_theme_preset_display_string_table[9] =
+50 -12
View File
@@ -376,6 +376,44 @@ DF_IconKind_Dot,
DF_IconKind_COUNT,
} DF_IconKind;
typedef enum DF_ViewRuleKind
{
DF_ViewRuleKind_Null,
DF_ViewRuleKind_Empty,
DF_ViewRuleKind_GettingStarted,
DF_ViewRuleKind_ExceptionFilters,
DF_ViewRuleKind_Settings,
DF_ViewRuleKind_PendingFile,
DF_ViewRuleKind_Commands,
DF_ViewRuleKind_FileSystem,
DF_ViewRuleKind_SystemProcesses,
DF_ViewRuleKind_EntityLister,
DF_ViewRuleKind_SymbolLister,
DF_ViewRuleKind_Watch,
DF_ViewRuleKind_Locals,
DF_ViewRuleKind_Registers,
DF_ViewRuleKind_Globals,
DF_ViewRuleKind_ThreadLocals,
DF_ViewRuleKind_Types,
DF_ViewRuleKind_Procedures,
DF_ViewRuleKind_Targets,
DF_ViewRuleKind_FilePathMap,
DF_ViewRuleKind_AutoViewRules,
DF_ViewRuleKind_Breakpoints,
DF_ViewRuleKind_WatchPins,
DF_ViewRuleKind_Scheduler,
DF_ViewRuleKind_CallStack,
DF_ViewRuleKind_Modules,
DF_ViewRuleKind_Text,
DF_ViewRuleKind_Disasm,
DF_ViewRuleKind_Output,
DF_ViewRuleKind_Memory,
DF_ViewRuleKind_Bitmap,
DF_ViewRuleKind_ColorRGBA,
DF_ViewRuleKind_Geo3D,
DF_ViewRuleKind_COUNT,
} DF_ViewRuleKind;
typedef enum DF_ViewKind
{
DF_ViewKind_Null,
@@ -590,6 +628,18 @@ DF_CmdKindFlags flags;
DF_Query query;
};
typedef struct DF_ViewRuleInfo DF_ViewRuleInfo;
struct DF_ViewRuleInfo
{
String8 string;
String8 description;
String8 display_name;
String8 params_schema;
DF_IconKind icon_kind;
DF_ViewRuleInfoFlags flags;
DF_ViewRuleUIFunctionType *ui;
};
#define df_regs_lit_init_top \
.machine = df_regs()->machine,\
.module = df_regs()->module,\
@@ -726,18 +776,6 @@ DF_VIEW_UI_FUNCTION_DEF(geo3d);
DF_VIEW_UI_FUNCTION_DEF(exception_filters);
DF_VIEW_UI_FUNCTION_DEF(settings);
DF_VIEW_RULE_VIZ_ROW_PROD_FUNCTION_DEF(list);
DF_VIEW_RULE_VIZ_ROW_PROD_FUNCTION_DEF(only);
DF_VIEW_RULE_VIZ_ROW_PROD_FUNCTION_DEF(omit);
DF_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(dec);
DF_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(bin);
DF_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(oct);
DF_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(hex);
DF_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(only);
DF_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(omit);
DF_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(no_addr);
DF_VIEW_RULE_ROW_UI_FUNCTION_DEF(checkbox);
DF_VIEW_RULE_ROW_UI_FUNCTION_DEF(color_rgba);
C_LINKAGE_BEGIN
extern DF_CmdKind d_cfg_src_load_cmd_kind_table[4];
extern DF_CmdKind d_cfg_src_write_cmd_kind_table[4];
@@ -1,6 +1,93 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Built-In View Rules
//
// @view_rule_info
//
// NOTE(rjf): View rules are subtle in that they may impact any subset of the
// eval visualization pipeline. The "array" view rule, for example, functions
// by tweaking the type of an eval from `X *` to `X (*)[N]` (where N is
// computed from whatever expression is specified by the view rule). The "list"
// view rule, on the other hand, does not require any changes to the actual
// eval nor its type - instead, it follows an alternative path in constructing
// "viz blocks", and then constructing "viz rows" from those blocks. Compare
// these to the simpler 'dec', 'bin', or 'oct' rules, which simply tweak the
// radix used when stringizing numbers, which is something that only occurs in
// single-line eval stringization building.
//
// As such, each view rule specification has a mask, which determines which
// stages it may be used for. For a given view rule specification, if the bit
// corresponding to a particular eval stage is set, then that view rule spec-
// -ification also includes a hook which can be called from that stage.
//
// Below is a list of the stages in the eval visualization pipeline, as well as
// abbreviations which are used in the tables.
//
// expr resolution, "xp" -> provides a chance for a view rule to make
// modifications to expression trees that it is
// applied to
//
// viz block prod, "vb" -> given a resolved eval, produce a list of non-
// windowed "viz blocks", which correspond to one or
// many contiguous rows in a watch-window-style UI.
// one level of expanded struct members, with no sub-
// expansions, would be one viz block. if one of those
// members - in the middle - were expanded too, then
// it would require three viz blocks - one for the
// members before the sub-expansion, one for the
// sub expansion members, and one for the members
// after, and so on. this is done recursively.
//
// viz row prod, "vr" -> given a list of viz blocks, a windowed list of viz
// rows may be produced. each of these rows has info
// for building actual UI in e.g. a watch window -
// whether or not the row can be expanded, whether or
// not the row's value can be edited, what the edit-
// able string is for a row, what the display string
// is for a row, what the expression string is for a
// row, what the type is for a row, and so on.
//
// line stringize, "ls" -> this is the stage used to produce display strings
// in the "viz row prod" stage, as well as basically
// any time UI needs to display the result of an eval
// in a single line. this also occurs recursively,
// descending into members & elements as needed,
// constrained by # of available pixels and font size
// and so on.
//
// row ui build, "ru" -> finally, after the previous stages are completed,
// ui can finally be built according to all of the
// per-row information produced. this is the stage
// where view rules can insert their own arbitrary ui
// on a per-row basis.
//
// view ui build, "vu" -> view rules which want to supply more sophisticated
// visualizers have the ability to provide full
// arbitrary UI hooks, which can either be produced
// in a minified form via watch views, or via a
// standalone tab.
//
// A few other bits are included for various ways in which a view rule may be
// applied throughout the eval visualization pipeline. A list follows:
//
// inherited, "ih" -> is this view rule included, or not included, in
// child expansions?
//
// expandable, "ex" -> does this view rule force the ability to expand
// an expression, even if traditional analysis of type
// info would not allow expansion?
//
// Not all of these stages are specified at this layer, however, since the
// "df_core" layer is for the non-graphical core debugger features. So the
// information pertaining to the eval visualization pipeline stages which
// do require graphical subsystems (e.g. UI, fonts, rendering) are specified
// in the "df_gfx" layer.
//
// For any view rules in this layer which also have graphical features, they
// are specified in both tables under the same name.
@table(coverage_check name name_lower string ih ex xp vb display_name docs schema description)
EV_ViewRuleTable:
{
@@ -178,7 +178,7 @@ EV_Key key, \
EV_ExpandNode *expand_node, \
String8 string, \
E_Expr *expr, \
EV_ViewRuleList *view_rules, \
EV_ViewRuleList *view_rules, \
MD_Node *view_params, \
S32 depth, \
struct EV_BlockList *out)