fix treatment of 0-terminator in raddbg data section, fix encoding of auto view rules in raddbg data section

This commit is contained in:
Ryan Fleury
2025-03-26 16:28:13 -07:00
parent b154c5a120
commit dc967f5274
3 changed files with 40 additions and 15 deletions
+7 -1
View File
@@ -23,7 +23,13 @@
#define raddbg_watch(fmt, ...) raddbg_watch__impl((fmt), __VA_ARGS__) #define raddbg_watch(fmt, ...) raddbg_watch__impl((fmt), __VA_ARGS__)
#define raddbg_pin(expr, ...) /* NOTE(rjf): inspected by debugger ui - does not change program execution */ #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_log(fmt, ...) raddbg_log__impl((fmt), __VA_ARGS__)
#define raddbg_auto_view_rule(type, ...) raddbg_exe_data static char raddbg_auto_view_rule_data__##__COUNTER__[] = ("auto_view_rule: {type:" #type ", view_rule: " #__VA_ARGS__ "}") #define raddbg_auto_view_rule(type, ...) raddbg_exe_data static char raddbg_glue(raddbg_auto_view_rule_data__, __COUNTER__)[] = ("auto_view_rule: {type: \"" #type "\", view_rule: \"" #__VA_ARGS__ "\"}")
////////////////////////////////
//~ Helpers
#define raddbg_glue_(a, b) a##b
#define raddbg_glue(a, b) raddbg_glue_(a, b)
//////////////////////////////// ////////////////////////////////
//~ Win32 Implementations //~ Win32 Implementations
+13
View File
@@ -1602,6 +1602,15 @@ basic_inline_tests(void)
//////////////////////////////// ////////////////////////////////
//~ rjf: Fancy Visualization Eval Tests //~ rjf: Fancy Visualization Eval Tests
struct Bitmap
{
unsigned char *base;
int width;
int height;
};
// raddbg_auto_view_rule(Bitmap, wrap(base) bitmap(width, height));
raddbg_auto_view_rule(Bitmap, wrap($expr.base));
static unsigned int static unsigned int
mule_bswap_u32(unsigned int x) mule_bswap_u32(unsigned int x)
{ {
@@ -1708,6 +1717,10 @@ fancy_viz_eval_tests(void)
} }
int x2 = 0; int x2 = 0;
//- rjf: auto-view-rule'd bitmaps
Bitmap foo = {(unsigned char *)&bitmap[0], 18, 18};
raddbg_pin(foo);
//- rjf: 3D geometry //- rjf: 3D geometry
float vertex_data[] = // pos.x, pos.y, pos.z, nor.x, nor.y, nor.z, tex.u, tex.v, col.r, col.g, col.b, ... float vertex_data[] = // pos.x, pos.y, pos.z, nor.x, nor.y, nor.z, tex.u, tex.v, col.r, col.g, col.b, ...
{ {
+7 -1
View File
@@ -13906,7 +13906,12 @@ rd_frame(void)
for(CTRL_EntityNode *n = modules.first; n != 0; n = n->next) for(CTRL_EntityNode *n = modules.first; n != 0; n = n->next)
{ {
String8 raddbg_data = ctrl_raddbg_data_from_module(scratch.arena, n->v->handle); String8 raddbg_data = ctrl_raddbg_data_from_module(scratch.arena, n->v->handle);
RD_CfgList cfgs = rd_cfg_tree_list_from_string(scratch.arena, raddbg_data); U8 split_char = 0;
String8List raddbg_data_text_parts = str8_split(scratch.arena, raddbg_data, &split_char, 1, 0);
for(String8Node *text_n = raddbg_data_text_parts.first; text_n != 0; text_n = text_n->next)
{
String8 text = text_n->string;
RD_CfgList cfgs = rd_cfg_tree_list_from_string(scratch.arena, text);
RD_Cfg *immediate_root = rd_immediate_cfg_from_keyf("module_%S_cfgs", ctrl_string_from_handle(scratch.arena, n->v->handle)); RD_Cfg *immediate_root = rd_immediate_cfg_from_keyf("module_%S_cfgs", ctrl_string_from_handle(scratch.arena, n->v->handle));
for(RD_CfgNode *n = cfgs.first; n != 0; n = n->next) for(RD_CfgNode *n = cfgs.first; n != 0; n = n->next)
{ {
@@ -13914,6 +13919,7 @@ rd_frame(void)
rd_cfg_list_push(scratch.arena, &immediate_auto_view_rules, n->v); rd_cfg_list_push(scratch.arena, &immediate_auto_view_rules, n->v);
} }
} }
}
//- rjf: add auto-hook rules for auto-view-rules //- rjf: add auto-hook rules for auto-view-rules
{ {