view rules / auto view rules -> views / type views

This commit is contained in:
Ryan Fleury
2025-05-02 09:50:41 -07:00
parent 2dbe8d42eb
commit a96546c5f5
15 changed files with 89 additions and 236 deletions
+1 -1
View File
@@ -645,7 +645,7 @@ struct E_String2TypeKeyMap
};
////////////////////////////////
//~ rjf: Type Pattern -> Hook Key Data Structure (Auto View Rules)
//~ rjf: Type Pattern -> Hook Key Data Structure (Type Views)
typedef struct E_AutoHookNode E_AutoHookNode;
struct E_AutoHookNode
@@ -1,107 +0,0 @@
// 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 xr xe display_name docs schema description)
EV_ViewRuleTable:
{
{x Array array "array" - - x - "Array" x "x:{expr}" "Specifies that a pointer points to N elements, rather than only 1." }
{x List list "list" - - - x "Array" x "x:{expr}" "Specifies that a pointer points to N elements, rather than only 1." }
{x Slice slice "slice" - - x - "Slice" x "" "Specifies that a pointer within a struct, also containing an integer, points to the number of elements encoded by the integer." }
{x ByteSwap bswap "bswap" x - x - "Byte Swap" x "" "Specifies that all integral evaluations should be byte-swapped, such that their endianness is reversed." }
{x Cast cast "cast" - - x - "Cast" x "x:{type}" "Specifies that the expression to which the view rule is applied should be casted to the provided type." }
{x Wrap wrap "wrap" - - x - "Wrap" x "x:{expr}" "Specifies that the expression should be wrapped with the view-rule-specified expression, which will refer to the original expression as `$expr`." }
{x Only only "only" x - x - "Only" x "" "Specifies that only the provided member names should be shown in user-defined-type expansions." }
{x Omit omit "omit" x - x - "Omit" x "" "Specifies that the provided member names should not be shown in user-defined-type expansions." }
{x Bin bin "bin" x - - - "Display In Binary" x "" "Specifies that all numeric values should be shown in base 2 (binary)." }
{x Oct oct "oct" x - - - "Display In Octal" x "" "Specifies that all numeric values should be shown in base 8 (octal)." }
{x Dec dec "dec" x - - - "Display In Decimal" x "" "Specifies that all numeric values should be shown in base 10 (decimal)." }
{x Hex hex "hex" x - - - "Display In Hexadecimal" x "" "Specifies that all numeric values should be shown in base 16 (hexadecimal)." }
{x NoAddress no_addr "no_addr" x - - - "Omit Addresses" x "" "Specifies that addresses should be omitted from visualizations, if possible." }
}
@@ -1,11 +1,6 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Generated Code
#include "generated/eval_visualization.meta.c"
////////////////////////////////
//~ rjf: Nil/Identity View Rule Hooks
@@ -220,11 +220,6 @@ struct EV_WindowedRowList
U64 count_before_semantic;
};
////////////////////////////////
//~ rjf: Generated Code
#include "generated/eval_visualization.meta.h"
////////////////////////////////
//~ rjf: String Generation Types
@@ -1,5 +0,0 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
//- GENERATED CODE
@@ -1,9 +0,0 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
//- GENERATED CODE
#ifndef EVAL_VISUALIZATION_META_H
#define EVAL_VISUALIZATION_META_H
#endif // EVAL_VISUALIZATION_META_H
+2 -2
View File
@@ -26,7 +26,7 @@
# define raddbg_pin(expr, ...)
# define raddbg_log(fmt, ...) ((void)0)
# define raddbg_entry_point(...) struct raddbg_gen_data_id(){int __unused__}
# define raddbg_auto_view_rule(type, ...) struct raddbg_gen_data_id(){int __unused__}
# define raddbg_type_view(type, ...) struct raddbg_gen_data_id(){int __unused__}
# define raddbg_add_breakpoint(ptr, size, r, w, x) ((void)0)
# define raddbg_remove_breakpoint(ptr, size, r, w, x) ((void)0)
#else
@@ -40,7 +40,7 @@
# define raddbg_pin(expr, ...) /* NOTE(rjf): inspected by debugger ui - does not change program execution */
# define raddbg_log(fmt, ...) raddbg_log__impl((fmt), __VA_ARGS__)
# define raddbg_entry_point(...) raddbg_exe_data static char raddbg_gen_data_id()[] = ("entry_point: \"" #__VA_ARGS__ "\"")
# define raddbg_auto_view_rule(type, ...) raddbg_exe_data static char raddbg_gen_data_id()[] = ("auto_view_rule: {type: \"" #type "\", view_rule: \"" #__VA_ARGS__ "\"}")
# define raddbg_type_view(type, ...) raddbg_exe_data static char raddbg_gen_data_id()[] = ("type_view: {type: \"" #type "\", expr: \"" #__VA_ARGS__ "\"}")
# define raddbg_add_breakpoint(ptr, size, r, w, x) raddbg_add_or_remove_breakpoint__impl((ptr), (1), (size), (r), (w), (x))
# define raddbg_remove_breakpoint(ptr, size, r, w, x) raddbg_add_or_remove_breakpoint__impl((ptr), (0), (size), (r), (w), (x))
#endif
+13 -13
View File
@@ -107,8 +107,8 @@ void optimized_struct_parameters_eval_tests(void);
#include <memory>
#include <stdint.h>
raddbg_auto_view_rule(std::vector<?>, slice(_Mypair._Myval2));
raddbg_auto_view_rule(std::unique_ptr<?>, _Mypair._Myval2);
raddbg_type_view(std::vector<?>, slice(_Mypair._Myval2));
raddbg_type_view(std::unique_ptr<?>, _Mypair._Myval2);
struct Basics
{
@@ -156,7 +156,7 @@ struct Dynamic_Array
Pair *pairs;
int count;
};
raddbg_auto_view_rule(Dynamic_Array, slice($));
raddbg_type_view(Dynamic_Array, slice($));
struct Struct_With_Embedded_Arrays
{
@@ -189,14 +189,14 @@ union Vector_R2
};
float v[2];
};
raddbg_auto_view_rule(Vector_R2, only($, x, y));
raddbg_type_view(Vector_R2, only($, x, y));
typedef union Matrix4x4F32 Matrix4x4F32;
union Matrix4x4F32
{
float elements[4][4];
};
raddbg_auto_view_rule(Matrix4x4F32, table($.elements, $[0], $[1], $[2], $[3]));
raddbg_type_view(Matrix4x4F32, table($.elements, $[0], $[1], $[2], $[3]));
enum Kind
{
@@ -250,12 +250,12 @@ struct Discriminated_Union
} fourth;
};
};
raddbg_auto_view_rule(Discriminated_Union,
kind == Kind.First ? first :
kind == Kind.Second ? second :
kind == Kind.Third ? third :
kind == Kind.Fourth ? fourth :
$);
raddbg_type_view(Discriminated_Union,
kind == Kind.First ? first :
kind == Kind.Second ? second :
kind == Kind.Third ? third :
kind == Kind.Fourth ? fourth :
$);
struct Linked_List{
Linked_List *next;
@@ -1716,7 +1716,7 @@ struct Bitmap
int width;
int height;
};
raddbg_auto_view_rule(Bitmap, lens:bitmap(base, width, height));
raddbg_type_view(Bitmap, lens:bitmap(base, width, height));
static unsigned int
mule_bswap_u32(unsigned int x)
@@ -1837,7 +1837,7 @@ fancy_viz_eval_tests(void)
}
int x2 = 0;
//- rjf: auto-view-rule'd bitmaps
//- rjf: type-viewed bitmaps
Bitmap foo = {(unsigned char *)&pixels[0], 18, 18};
raddbg_pin(foo);
+9 -10
View File
@@ -50,7 +50,7 @@ str8_lit_comp("query:processes"),
str8_lit_comp("query:machines"),
str8_lit_comp("query:modules"),
str8_lit_comp("query:file_path_maps"),
str8_lit_comp("query:auto_view_rules"),
str8_lit_comp("query:type_views"),
str8_lit_comp("query:output"),
str8_lit_comp(""),
str8_lit_comp(""),
@@ -60,13 +60,13 @@ str8_lit_comp(""),
str8_lit_comp(""),
};
RD_VocabInfo rd_vocab_info_table[333] =
RD_VocabInfo rd_vocab_info_table[332] =
{
{str8_lit_comp("auto_view_rule"), str8_lit_comp("auto_view_rules"), str8_lit_comp("Auto View Rule"), str8_lit_comp("Auto View Rules"), RD_IconKind_Binoculars},
{str8_lit_comp("type_view"), str8_lit_comp("type_views"), str8_lit_comp("Type View"), str8_lit_comp("Type Views"), RD_IconKind_Binoculars},
{str8_lit_comp("file_path_map"), str8_lit_comp("file_path_maps"), str8_lit_comp("File Path Map"), str8_lit_comp("File Path Maps"), RD_IconKind_FileOutline},
{str8_lit_comp("watch_pin"), str8_lit_comp("watch_pins"), str8_lit_comp("Watch Pin"), str8_lit_comp("Watch Pins"), RD_IconKind_Pin},
{str8_lit_comp("watch"), str8_lit_comp("watches"), str8_lit_comp("Watch"), str8_lit_comp("Watches"), RD_IconKind_Binoculars},
{str8_lit_comp("view_rule"), str8_lit_comp("view_rules"), str8_lit_comp("View Rule"), str8_lit_comp("View Rules"), RD_IconKind_Binoculars},
{str8_lit_comp("view"), str8_lit_comp("views"), str8_lit_comp("View"), str8_lit_comp("Views"), RD_IconKind_Binoculars},
{str8_lit_comp("breakpoint"), str8_lit_comp("breakpoints"), str8_lit_comp("Breakpoint"), str8_lit_comp("Breakpoints"), RD_IconKind_CircleFilled},
{str8_lit_comp("condition"), str8_lit_comp("conditions"), str8_lit_comp("Condition"), str8_lit_comp("Conditions"), RD_IconKind_Null},
{str8_lit_comp("location"), str8_lit_comp("locations"), str8_lit_comp("Location"), str8_lit_comp("Locations"), RD_IconKind_Null},
@@ -89,7 +89,6 @@ RD_VocabInfo rd_vocab_info_table[333] =
{str8_lit_comp("stdin_path"), str8_lit_comp("stdin_paths"), str8_lit_comp("Standard Input Path"), str8_lit_comp("Standard Input Paths"), RD_IconKind_Null},
{str8_lit_comp("window"), str8_lit_comp("windows"), str8_lit_comp("Window"), str8_lit_comp("Windows"), RD_IconKind_Window},
{str8_lit_comp("panel"), str8_lit_comp("panels"), str8_lit_comp("Panel"), str8_lit_comp("Panels"), RD_IconKind_Null},
{str8_lit_comp("view"), str8_lit_comp("views"), str8_lit_comp("View"), str8_lit_comp("Views"), RD_IconKind_Null},
{str8_lit_comp("tab"), str8_lit_comp("tabs"), str8_lit_comp("Tab"), str8_lit_comp("Tabs"), RD_IconKind_Null},
{str8_lit_comp("recent_project"), str8_lit_comp("recent_projects"), str8_lit_comp("Recent Project"), str8_lit_comp("Recent Projects"), RD_IconKind_Briefcase},
{str8_lit_comp("recent_file"), str8_lit_comp("recent_files"), str8_lit_comp("Recent File"), str8_lit_comp("Recent Files"), RD_IconKind_FileOutline},
@@ -347,7 +346,7 @@ RD_VocabInfo rd_vocab_info_table[333] =
{str8_lit_comp("disable_breakpoint"), str8_lit_comp(""), str8_lit_comp("Disable Breakpoint"), str8_lit_comp(""), RD_IconKind_CheckHollow},
{str8_lit_comp("add_watch_pin"), str8_lit_comp(""), str8_lit_comp("Add Watch Pin"), str8_lit_comp(""), RD_IconKind_Pin},
{str8_lit_comp("toggle_watch_pin"), str8_lit_comp(""), str8_lit_comp("Toggle Watch Pin"), str8_lit_comp(""), RD_IconKind_Pin},
{str8_lit_comp("add_auto_view_rule"), str8_lit_comp(""), str8_lit_comp("Add Auto View Rule"), str8_lit_comp(""), RD_IconKind_Binoculars},
{str8_lit_comp("add_type_view"), str8_lit_comp(""), str8_lit_comp("Add Type View"), str8_lit_comp(""), RD_IconKind_Binoculars},
{str8_lit_comp("add_file_path_map"), str8_lit_comp(""), str8_lit_comp("Add File Path Map"), str8_lit_comp(""), RD_IconKind_FileOutline},
{str8_lit_comp("open_theme"), str8_lit_comp(""), str8_lit_comp("Open Theme"), str8_lit_comp(""), RD_IconKind_Palette},
{str8_lit_comp("add_theme_color"), str8_lit_comp(""), str8_lit_comp("Add Theme Color"), str8_lit_comp(""), RD_IconKind_Palette},
@@ -387,7 +386,7 @@ RD_VocabInfo rd_vocab_info_table[333] =
{str8_lit_comp("machines"), str8_lit_comp(""), str8_lit_comp("Machines"), str8_lit_comp(""), RD_IconKind_Machine},
{str8_lit_comp("modules"), str8_lit_comp(""), str8_lit_comp("Modules"), str8_lit_comp(""), RD_IconKind_Module},
{str8_lit_comp("file_path_maps"), str8_lit_comp(""), str8_lit_comp("File Path Map"), str8_lit_comp(""), RD_IconKind_FileOutline},
{str8_lit_comp("auto_view_rules"), str8_lit_comp(""), str8_lit_comp("Auto View Rules"), str8_lit_comp(""), RD_IconKind_Binoculars},
{str8_lit_comp("type_views"), str8_lit_comp(""), str8_lit_comp("Type Views"), str8_lit_comp(""), RD_IconKind_Binoculars},
{str8_lit_comp("output"), str8_lit_comp(""), str8_lit_comp("Output"), str8_lit_comp(""), RD_IconKind_List},
{str8_lit_comp("text"), str8_lit_comp(""), str8_lit_comp("Text"), str8_lit_comp(""), RD_IconKind_FileOutline},
{str8_lit_comp("disasm"), str8_lit_comp(""), str8_lit_comp("Disassembly"), str8_lit_comp(""), RD_IconKind_Glasses},
@@ -415,7 +414,7 @@ RD_NameSchemaInfo rd_name_schema_info_table[23] =
{str8_lit_comp("breakpoint"), str8_lit_comp("@row_commands(enable_cfg, duplicate_cfg, remove_cfg)\n@collection_commands(toggle_breakpoint, add_breakpoint, add_address_breakpoint)\nx:\n{\n 'label': code_string,\n 'condition': code_string,\n 'source_location': string,\n 'address_location': code_string,\n 'hit_count': u64,\n 'address_range_size': @or(0, 1, 2, 4, 8) u64,\n 'break_on_write': bool,\n 'break_on_read': bool,\n 'break_on_execute': bool,\n @no_expand @default(1) 'enabled': bool,\n}\n")},
{str8_lit_comp("watch_pin"), str8_lit_comp("@row_commands(duplicate_cfg, remove_cfg)\n@collection_commands(add_watch_pin, toggle_watch_pin)\nx:\n{\n 'expression': code_string,\n 'source_location': string,\n 'address_location': code_string,\n}\n")},
{str8_lit_comp("file_path_map"), str8_lit_comp("@collection_commands(add_file_path_map) @row_commands(remove_cfg) x:{'source': @absolute path, 'dest': @absolute path}")},
{str8_lit_comp("auto_view_rule"), str8_lit_comp("@collection_commands(add_auto_view_rule) @row_commands(remove_cfg) x:{'type':code_string, 'view_rule':code_string}")},
{str8_lit_comp("type_view"), str8_lit_comp("@collection_commands(add_type_view) @row_commands(remove_cfg) x:{'type':code_string, 'expr':code_string}")},
{str8_lit_comp("recent_project"), str8_lit_comp("x:{'path':path}")},
{str8_lit_comp("recent_file"), str8_lit_comp("x:{'path':path}")},
{str8_lit_comp("machine"), str8_lit_comp("x:{'label':code_string, @no_expand 'active':bool, 'unattached_processes':query, 'processes':query}")},
@@ -650,7 +649,7 @@ RD_CmdKindInfo rd_cmd_kind_info_table[225] =
{ str8_lit_comp("disable_breakpoint"), str8_lit_comp("Disables a breakpoint."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*1)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Cfg, str8_lit_comp("query:breakpoints"), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("add_watch_pin"), str8_lit_comp("Places a watch pin at a given location (file path and line number or address)."), str8_lit_comp(""), str8_lit_comp("$watch_pins,"), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*1)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Expr, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("toggle_watch_pin"), str8_lit_comp("Places or removes a watch pin at a given location (file path and line number or address)."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*0)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*1)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Expr, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("add_auto_view_rule"), str8_lit_comp("Adds a new auto view rule."), str8_lit_comp(""), str8_lit_comp("$auto_view_rules,"), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_String, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("add_type_view"), str8_lit_comp("Adds a new type view."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_String, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("add_file_path_map"), str8_lit_comp("Adds a new file path map."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("open_theme"), str8_lit_comp("Opens a theme file."), str8_lit_comp("color"), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*1)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_FilePath, str8_lit_comp("folder:\"$input\""), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("add_theme_color"), str8_lit_comp("Adds a new theme color."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
@@ -690,7 +689,7 @@ RD_CmdKindInfo rd_cmd_kind_info_table[225] =
{ str8_lit_comp("machines"), str8_lit_comp("Opens a Machines tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
{ str8_lit_comp("modules"), str8_lit_comp("Opens a Modules tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
{ str8_lit_comp("file_path_maps"), str8_lit_comp("Opens a File Path Map tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
{ str8_lit_comp("auto_view_rules"), str8_lit_comp("Opens a Auto View Rules tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
{ str8_lit_comp("type_views"), str8_lit_comp("Opens a Type Views tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
{ str8_lit_comp("output"), str8_lit_comp("Opens a Output tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
{ str8_lit_comp("text"), str8_lit_comp("Opens a Text tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
{ str8_lit_comp("disasm"), str8_lit_comp("Opens a Disassembly tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
+4 -4
View File
@@ -233,7 +233,7 @@ RD_CmdKind_EnableBreakpoint,
RD_CmdKind_DisableBreakpoint,
RD_CmdKind_AddWatchPin,
RD_CmdKind_ToggleWatchPin,
RD_CmdKind_AddAutoViewRule,
RD_CmdKind_AddTypeView,
RD_CmdKind_AddFilePathMap,
RD_CmdKind_OpenTheme,
RD_CmdKind_AddThemeColor,
@@ -273,7 +273,7 @@ RD_CmdKind_OpenProcesses,
RD_CmdKind_OpenMachines,
RD_CmdKind_OpenModules,
RD_CmdKind_OpenFilePathMaps,
RD_CmdKind_OpenAutoViewRules,
RD_CmdKind_OpenTypeViews,
RD_CmdKind_OpenOutput,
RD_CmdKind_OpenText,
RD_CmdKind_OpenDisasm,
@@ -631,7 +631,7 @@ X(processes) \
X(machines) \
X(modules) \
X(file_path_maps) \
X(auto_view_rules) \
X(type_views) \
Y(output, text, "query:output")\
Y(text, text, "")\
Y(disasm, disasm, "")\
@@ -688,7 +688,7 @@ Z(getting_started)\
C_LINKAGE_BEGIN
extern String8 rd_tab_fast_path_view_name_table[24];
extern String8 rd_tab_fast_path_query_name_table[24];
extern RD_VocabInfo rd_vocab_info_table[333];
extern RD_VocabInfo rd_vocab_info_table[332];
extern RD_NameSchemaInfo rd_name_schema_info_table[23];
extern Rng1U64 rd_reg_slot_range_table[43];
extern String8 rd_binding_version_remap_old_name_table[8];
+8 -9
View File
@@ -33,7 +33,7 @@ RD_WatchTabFastPathTable:
{Machines "Machines" machines 1 Machine }
{Modules "Modules" modules 1 Module }
{FilePathMaps "File Path Map" file_path_maps 1 FileOutline }
{AutoViewRules "Auto View Rules" auto_view_rules 1 Binoculars }
{TypeViews "Type Views" type_views 1 Binoculars }
}
@table(name display_name name_lower view query icon)
@@ -83,11 +83,11 @@ RD_VocabTable:
// NOTE(rjf): the _ character is used as a fastpath for default rules. when
// pluralizing, you just append an `s`, and so on.
{
{auto_view_rule _ "Auto View Rule" _ Binoculars }
{type_view _ "Type View" _ Binoculars }
{file_path_map _ "File Path Map" _ FileOutline }
{watch_pin _ "Watch Pin" _ Pin }
{watch watches "Watch" "Watches" Binoculars }
{view_rule _ "View Rule" _ Binoculars }
{view _ "View" _ Binoculars }
{breakpoint _ "Breakpoint" _ CircleFilled }
{condition _ "Condition" _ Null }
{location _ "Location" _ Null }
@@ -110,7 +110,6 @@ RD_VocabTable:
{stdin_path _ "Standard Input Path" _ Null }
{window _ "Window" _ Window }
{panel _ "Panel" _ Null }
{view _ "View" _ Null }
{tab _ "Tab" _ Null }
{recent_project _ "Recent Project" _ Briefcase }
{recent_file _ "Recent File" _ FileOutline }
@@ -611,10 +610,10 @@ RD_VocabTable:
```@collection_commands(add_file_path_map) @row_commands(remove_cfg) x:{'source': @absolute path, 'dest': @absolute path}```,
}
//- rjf: auto view rules
//- rjf: type views
{
auto_view_rule,
```@collection_commands(add_auto_view_rule) @row_commands(remove_cfg) x:{'type':code_string, 'view_rule':code_string}```,
type_view,
```@collection_commands(add_type_view) @row_commands(remove_cfg) x:{'type':code_string, 'expr':code_string}```,
}
//- rjf: recent projects
@@ -961,8 +960,8 @@ RD_CmdTable: // | | | |
{AddWatchPin 1 1 0 0 "" Expr null Nil Null 0 0 0 0 1 1 1 Pin "add_watch_pin" "Add Watch Pin" "Places a watch pin at a given location (file path and line number or address)." "" "$watch_pins," }
{ToggleWatchPin 1 0 0 0 "" Expr null Nil Null 0 0 0 0 1 1 1 Pin "toggle_watch_pin" "Toggle Watch Pin" "Places or removes a watch pin at a given location (file path and line number or address)." "" "" }
//- rjf: auto view rule
{AddAutoViewRule 0 0 0 0 "" String null Nil Null 0 0 0 0 0 0 0 Binoculars "add_auto_view_rule" "Add Auto View Rule" "Adds a new auto view rule." "" "$auto_view_rules," }
//- rjf: type views
{AddTypeView 0 0 0 0 "" String null Nil Null 0 0 0 0 0 0 0 Binoculars "add_type_view" "Add Type View" "Adds a new type view." "" "" }
//- rjf: file path maps
{AddFilePathMap 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 FileOutline "add_file_path_map" "Add File Path Map" "Adds a new file path map." "" "" }
+45 -15
View File
@@ -2388,12 +2388,14 @@ rd_view_from_eval(RD_Cfg *parent, E_Eval eval)
E_TypeKey type_key = eval.irtree.type_key;
E_Type *type = e_type_from_key__cached(type_key);
String8 schema_name = str8_lit("watch");
B32 type_is_visualizer = 0;
if(type->kind == E_TypeKind_Lens)
{
RD_ViewUIRule *view_ui_rule = rd_view_ui_rule_from_string(type->name);
if(view_ui_rule != &rd_nil_view_ui_rule)
{
schema_name = type->name;
type_is_visualizer = 1;
}
}
RD_Cfg *view = rd_cfg_child_from_string_or_alloc(parent, schema_name);
@@ -2401,7 +2403,7 @@ rd_view_from_eval(RD_Cfg *parent, E_Eval eval)
{
// rjf: get expression evaluation
E_Eval expr_eval = eval;
if(eval.expr->kind == E_ExprKind_Call)
if(eval.expr->kind == E_ExprKind_Call && type_is_visualizer)
{
expr_eval = e_eval_from_expr(eval.expr->first->next);
}
@@ -8456,6 +8458,17 @@ rd_window_frame(void)
}
}
//- rjf: visualizers -> accept expression drops
UI_Box *view_drop_site = &ui_nil_box;
{
RD_ViewUIRule *view_ui_rule = rd_view_ui_rule_from_string(selected_tab->string);
if(view_ui_rule != &rd_nil_view_ui_rule && rd_drag_is_active() && rd_state->drag_drop_regs_slot == RD_RegSlot_Expr)
{
UI_FixedSize(dim_2f32(content_rect))
view_drop_site = ui_build_box_from_stringf(UI_BoxFlag_DropSite|UI_BoxFlag_Floating, "drop_site_%I64x", selected_tab->id);
}
}
//- rjf: build view container
UI_Box *view_container_box = &ui_nil_box;
UI_FixedWidth(dim_2f32(content_rect).x)
@@ -8494,6 +8507,23 @@ rd_window_frame(void)
rd_view_ui(content_rect);
}
//- rjf: accept expression drops
if(view_drop_site != &ui_nil_box)
{
UI_Signal sig = ui_signal_from_box(view_drop_site);
if(ui_key_match(view_drop_site->key, ui_drop_hot_key()))
{
UI_Parent(view_drop_site) UI_WidthFill UI_HeightFill UI_TagF("drop_site") UI_Transparency(0.5f)
{
ui_build_box_from_key(UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawBorder, ui_key_zero());
}
if(rd_drag_drop())
{
rd_store_view_expr_string(rd_state->drag_drop_regs->expr);
}
}
}
//- rjf: pop interaction registers; commit if this is the selected view
RD_Regs *view_regs = rd_pop_regs();
if(panel_is_focused)
@@ -11374,7 +11404,7 @@ rd_frame(void)
str8_lit("watch_pin"),
str8_lit("target"),
str8_lit("file_path_map"),
str8_lit("auto_view_rule"),
str8_lit("type_view"),
str8_lit("recent_project"),
str8_lit("recent_file"),
};
@@ -11885,9 +11915,9 @@ rd_frame(void)
ev_select_expand_rule_table(expand_rule_table);
////////////////////////////
//- rjf: gather auto-view-rules from loaded modules
//- rjf: gather config from loaded modules
//
RD_CfgList immediate_auto_view_rules = {0};
RD_CfgList immediate_type_views = {0};
CTRL_EntityArray modules = ctrl_entity_array_from_kind(d_state->ctrl_entity_store, CTRL_EntityKind_Module);
for EachIndex(idx, modules.count)
{
@@ -11906,20 +11936,20 @@ rd_frame(void)
RD_Cfg *immediate_root = rd_immediate_cfg_from_keyf("module_%S_cfg_%I64x", module_name, cfg_idx);
rd_cfg_release_all_children(immediate_root);
rd_cfg_insert_child(immediate_root, immediate_root->last, n->v);
rd_cfg_list_push(scratch.arena, &immediate_auto_view_rules, n->v);
rd_cfg_list_push(scratch.arena, &immediate_type_views, n->v);
}
}
}
////////////////////////////
//- rjf: add auto-hook rules for auto-view-rules
//- rjf: add auto-hook rules for type views
//
{
RD_CfgList auto_view_rules = rd_cfg_top_level_list_from_string(scratch.arena, str8_lit("auto_view_rule"));
RD_CfgList type_views = rd_cfg_top_level_list_from_string(scratch.arena, str8_lit("type_view"));
RD_CfgList rules_lists[] =
{
auto_view_rules,
immediate_auto_view_rules,
type_views,
immediate_type_views,
};
for EachElement(list_idx, rules_lists)
{
@@ -11927,9 +11957,9 @@ rd_frame(void)
for(RD_CfgNode *n = list.first; n != 0; n = n->next)
{
RD_Cfg *rule = n->v;
String8 type_string = rd_cfg_child_from_string(rule, str8_lit("type"))->first->string;
String8 view_rule_string = rd_cfg_child_from_string(rule, str8_lit("view_rule"))->first->string;
e_auto_hook_map_insert_new(scratch.arena, auto_hook_map, .type_pattern = type_string, .tag_expr_string = view_rule_string);
String8 type_string = rd_cfg_child_from_string(rule, str8_lit("type"))->first->string;
String8 expr_string = rd_cfg_child_from_string(rule, str8_lit("expr"))->first->string;
e_auto_hook_map_insert_new(scratch.arena, auto_hook_map, .type_pattern = type_string, .tag_expr_string = expr_string);
}
}
}
@@ -14619,11 +14649,11 @@ rd_frame(void)
}
}break;
//- rjf: auto view rules
case RD_CmdKind_AddAutoViewRule:
//- rjf: type views
case RD_CmdKind_AddTypeView:
{
RD_Cfg *project = rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("project"));
rd_cfg_new(project, str8_lit("auto_view_rule"));
rd_cfg_new(project, str8_lit("type_view"));
}break;
//- rjf: file path maps
+3 -4
View File
@@ -176,10 +176,9 @@
// - `raddbg_entry_point(name)`, e.g. `raddbg_entry_point(entry_point)`:
// declares the entry point for an executable, which the debugger will use
// when stepping into a program, rather than the defaults (e.g. `main`).
// - `raddbg_auto_view_rule(<type|pattern>, <view_rule>)`, e.g.
// `raddbg_auto_view_rule(DynamicArray<?>, slice)`: declares an
// auto-view-rule from source code, rather than from debugger
// configuration.
// - `raddbg_type_view(<type|pattern>, <expression>)`, e.g.
// `raddbg_type_view(DynamicArray<?>, slice($))`: declares a type view from
// source code, rather than from debugger configuration.
// - The debugger now incorporates the loaded project in all window titles.
// - Fixed an annoyance where the debugger would open a console window, even
// for graphical programs, causing a flicker.
-43
View File
@@ -119,49 +119,6 @@ struct RD_WatchRowCellInfo
RD_ViewUIRule *view_ui_rule;
};
typedef enum RD_WatchViewColumnKind
{
RD_WatchViewColumnKind_Expr,
RD_WatchViewColumnKind_Value,
RD_WatchViewColumnKind_Type,
RD_WatchViewColumnKind_ViewRule,
RD_WatchViewColumnKind_Member,
RD_WatchViewColumnKind_CallStackFrame,
RD_WatchViewColumnKind_CallStackFrameSelection,
RD_WatchViewColumnKind_Module,
RD_WatchViewColumnKind_COUNT
}
RD_WatchViewColumnKind;
typedef struct RD_WatchViewColumnParams RD_WatchViewColumnParams;
struct RD_WatchViewColumnParams
{
String8 string;
String8 display_string;
String8 view_rule;
B32 is_non_code;
B32 dequote_string;
B32 rangify_braces;
};
typedef struct RD_WatchViewColumn RD_WatchViewColumn;
struct RD_WatchViewColumn
{
RD_WatchViewColumn *next;
RD_WatchViewColumn *prev;
RD_WatchViewColumnKind kind;
F32 pct;
U8 string_buffer[1024];
U64 string_size;
U8 display_string_buffer[1024];
U64 display_string_size;
U8 view_rule_buffer[1024];
U64 view_rule_size;
B32 is_non_code;
B32 dequote_string;
B32 rangify_braces;
};
typedef struct RD_WatchPt RD_WatchPt;
struct RD_WatchPt
{
+4 -4
View File
@@ -333,11 +333,11 @@ rd_title_fstrs_from_cfg(Arena *arena, RD_Cfg *cfg)
}
}
//- rjf: special case: auto view rule
if(str8_match(cfg->string, str8_lit("auto_view_rule"), 0))
//- rjf: special case: type views
if(str8_match(cfg->string, str8_lit("type_view"), 0))
{
String8 src_string = rd_cfg_child_from_string(cfg, str8_lit("type"))->first->string;
String8 dst_string = rd_cfg_child_from_string(cfg, str8_lit("view_rule"))->first->string;
String8 dst_string = rd_cfg_child_from_string(cfg, str8_lit("expr"))->first->string;
Vec4F32 src_color = rgba;
Vec4F32 dst_color = rgba;
DR_FStrList src_fstrs = {0};
@@ -354,7 +354,7 @@ rd_title_fstrs_from_cfg(Arena *arena, RD_Cfg *cfg)
}
if(dst_string.size == 0)
{
dst_string = str8_lit("(view rule)");
dst_string = str8_lit("(expression)");
dst_color = rgba_secondary;
dr_fstrs_push_new(arena, &dst_fstrs, &params, dst_string, .color = dst_color);
}