mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 13:58:40 +00:00
scoped log gathering; communicate ctrl logs -> user via events
This commit is contained in:
+31
-6
@@ -18,7 +18,6 @@ log_alloc(void)
|
|||||||
Arena *arena = arena_alloc();
|
Arena *arena = arena_alloc();
|
||||||
Log *log = push_array(arena, Log, 1);
|
Log *log = push_array(arena, Log, 1);
|
||||||
log->arena = arena;
|
log->arena = arena;
|
||||||
log->log_buffer_start_pos = arena_pos(arena);
|
|
||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,9 +39,10 @@ log_select(Log *log)
|
|||||||
internal void
|
internal void
|
||||||
log_msg(String8 string)
|
log_msg(String8 string)
|
||||||
{
|
{
|
||||||
if(log_active != 0)
|
if(log_active != 0 && log_active->top_scope != 0)
|
||||||
{
|
{
|
||||||
str8_list_push(log_active->arena, &log_active->log_buffer_strings, string);
|
String8 string_copy = push_str8_copy(log_active->arena, string);
|
||||||
|
str8_list_push(log_active->arena, &log_active->top_scope->strings, string_copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,12 +61,37 @@ log_msgf(char *fmt, ...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: Log Scopes
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
log_clear(void)
|
log_scope_begin(void)
|
||||||
{
|
{
|
||||||
if(log_active != 0)
|
if(log_active != 0)
|
||||||
{
|
{
|
||||||
arena_pop_to(log_active->arena, log_active->log_buffer_start_pos);
|
U64 pos = arena_pos(log_active->arena);
|
||||||
MemoryZeroStruct(&log_active->log_buffer_strings);
|
LogScope *scope = push_array(log_active->arena, LogScope, 1);
|
||||||
|
scope->pos = pos;
|
||||||
|
SLLStackPush(log_active->top_scope, scope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal String8
|
||||||
|
log_scope_end(Arena *arena)
|
||||||
|
{
|
||||||
|
String8 result = {0};
|
||||||
|
if(log_active != 0)
|
||||||
|
{
|
||||||
|
LogScope *scope = log_active->top_scope;
|
||||||
|
if(scope != 0)
|
||||||
|
{
|
||||||
|
SLLStackPop(log_active->top_scope);
|
||||||
|
if(arena != 0)
|
||||||
|
{
|
||||||
|
result = str8_list_join(arena, &scope->strings, 0);
|
||||||
|
}
|
||||||
|
arena_pop_to(log_active->arena, scope->pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|||||||
+17
-5
@@ -5,14 +5,21 @@
|
|||||||
#define BASE_LOG_H
|
#define BASE_LOG_H
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Log Type
|
//~ rjf: Log Types
|
||||||
|
|
||||||
|
typedef struct LogScope LogScope;
|
||||||
|
struct LogScope
|
||||||
|
{
|
||||||
|
LogScope *next;
|
||||||
|
U64 pos;
|
||||||
|
String8List strings;
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct Log Log;
|
typedef struct Log Log;
|
||||||
struct Log
|
struct Log
|
||||||
{
|
{
|
||||||
Arena *arena;
|
Arena *arena;
|
||||||
U64 log_buffer_start_pos;
|
LogScope *top_scope;
|
||||||
String8List log_buffer_strings;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
@@ -23,10 +30,15 @@ internal void log_release(Log *log);
|
|||||||
internal void log_select(Log *log);
|
internal void log_select(Log *log);
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Log Building/Clearing
|
//~ rjf: Log Building
|
||||||
|
|
||||||
internal void log_msg(String8 string);
|
internal void log_msg(String8 string);
|
||||||
internal void log_msgf(char *fmt, ...);
|
internal void log_msgf(char *fmt, ...);
|
||||||
internal void log_clear(void);
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: Log Scopes
|
||||||
|
|
||||||
|
internal void log_scope_begin(void);
|
||||||
|
internal String8 log_scope_end(Arena *arena);
|
||||||
|
|
||||||
#endif // BASE_LOG_H
|
#endif // BASE_LOG_H
|
||||||
|
|||||||
@@ -1929,6 +1929,7 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
|||||||
if(next_event_node != 0)
|
if(next_event_node != 0)
|
||||||
{
|
{
|
||||||
DMN_Event *ev = &next_event_node->v;
|
DMN_Event *ev = &next_event_node->v;
|
||||||
|
log_scope_begin();
|
||||||
log_msgf("--- event ---\n");
|
log_msgf("--- event ---\n");
|
||||||
log_msgf("kind: %S\n", dmn_event_kind_string_table[ev->kind]);
|
log_msgf("kind: %S\n", dmn_event_kind_string_table[ev->kind]);
|
||||||
log_msgf("exception_kind: %S\n", dmn_exception_kind_string_table[ev->exception_kind]);
|
log_msgf("exception_kind: %S\n", dmn_exception_kind_string_table[ev->exception_kind]);
|
||||||
@@ -1939,6 +1940,15 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
|||||||
log_msgf("address: 0x%I64x\n", ev->address);
|
log_msgf("address: 0x%I64x\n", ev->address);
|
||||||
log_msgf("string: \"%S\"\n", ev->string);
|
log_msgf("string: \"%S\"\n", ev->string);
|
||||||
log_msgf("ip_vaddr: 0x%I64x\n", ev->instruction_pointer);
|
log_msgf("ip_vaddr: 0x%I64x\n", ev->instruction_pointer);
|
||||||
|
String8 log = log_scope_end(scratch.arena);
|
||||||
|
if(log.size != 0)
|
||||||
|
{
|
||||||
|
CTRL_EventList evts = {0};
|
||||||
|
CTRL_Event *evt = ctrl_event_list_push(scratch.arena, &evts);
|
||||||
|
evt->kind = CTRL_EventKind_Log;
|
||||||
|
evt->string = log;
|
||||||
|
ctrl_c2u_push_events(&evts);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// rjf: determine if we should filter
|
// rjf: determine if we should filter
|
||||||
|
|||||||
@@ -302,6 +302,9 @@ typedef enum CTRL_EventKind
|
|||||||
CTRL_EventKind_MemDecommit,
|
CTRL_EventKind_MemDecommit,
|
||||||
CTRL_EventKind_MemRelease,
|
CTRL_EventKind_MemRelease,
|
||||||
|
|
||||||
|
//- rjf: log
|
||||||
|
CTRL_EventKind_Log,
|
||||||
|
|
||||||
CTRL_EventKind_COUNT
|
CTRL_EventKind_COUNT
|
||||||
}
|
}
|
||||||
CTRL_EventKind;
|
CTRL_EventKind;
|
||||||
|
|||||||
+13
-13
@@ -1,14 +1,6 @@
|
|||||||
// Copyright (c) 2024 Epic Games Tools
|
// Copyright (c) 2024 Epic Games Tools
|
||||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
//~ rjf: Demon/Cleanup Pass Tasks
|
|
||||||
//
|
|
||||||
// [ ] TLS eval -> in-process-memory EXE info
|
|
||||||
// [ ] unwinding -> in-process-memory EXE info
|
|
||||||
// [ ] "root" concept in hash store, which buckets keys & allows usage code to
|
|
||||||
// jettison a collection of keys in retained mode fashion
|
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Frontend/UI Pass Tasks
|
//~ rjf: Frontend/UI Pass Tasks
|
||||||
//
|
//
|
||||||
@@ -57,6 +49,9 @@
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Hot, High Priority Tasks (Complete Unusability, Crashes, Fire-Worthy)
|
//~ rjf: Hot, High Priority Tasks (Complete Unusability, Crashes, Fire-Worthy)
|
||||||
//
|
//
|
||||||
|
// [ ] robustify dbgi layer to renames (cache should not be based only on
|
||||||
|
// path - must invalidate naturally when new filetime occurs)
|
||||||
|
//
|
||||||
// [ ] raddbg jai.exe my_file.jai -- foobar -> raddbg consumes `--` incorrectly
|
// [ ] raddbg jai.exe my_file.jai -- foobar -> raddbg consumes `--` incorrectly
|
||||||
// [ ] PDB files distributed with the build are not found by DbgHelp!!!
|
// [ ] PDB files distributed with the build are not found by DbgHelp!!!
|
||||||
// [ ] Jai compiler debugging crash
|
// [ ] Jai compiler debugging crash
|
||||||
@@ -82,6 +77,14 @@
|
|||||||
//
|
//
|
||||||
// [ ] ** Converter performance & heuristics for asynchronously doing it early
|
// [ ] ** Converter performance & heuristics for asynchronously doing it early
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: Demon/Cleanup Pass Tasks
|
||||||
|
//
|
||||||
|
// [ ] TLS eval -> in-process-memory EXE info
|
||||||
|
// [ ] unwinding -> in-process-memory EXE info
|
||||||
|
// [ ] "root" concept in hash store, which buckets keys & allows usage code to
|
||||||
|
// jettison a collection of keys in retained mode fashion
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Hot, Medium Priority Tasks (Low-Hanging-Fruit Features, UI Jank, Cleanup)
|
//~ rjf: Hot, Medium Priority Tasks (Low-Hanging-Fruit Features, UI Jank, Cleanup)
|
||||||
//
|
//
|
||||||
@@ -198,7 +201,6 @@
|
|||||||
// the files myself in the shell, but it seemed weird that there was no
|
// the files myself in the shell, but it seemed weird that there was no
|
||||||
// "save" option in the menus.
|
// "save" option in the menus.
|
||||||
//
|
//
|
||||||
// [ ] @cleanup @feature double & triple click select in source views
|
|
||||||
// [ ] @feature debug info overrides (both path-based AND module-based)
|
// [ ] @feature debug info overrides (both path-based AND module-based)
|
||||||
// [ ] configure tab size
|
// [ ] configure tab size
|
||||||
// [ ] auto-scroll output window
|
// [ ] auto-scroll output window
|
||||||
@@ -315,8 +317,6 @@
|
|||||||
// [ ] @bug view-snapping in scroll-lists, accounting for mapping between
|
// [ ] @bug view-snapping in scroll-lists, accounting for mapping between
|
||||||
// visual positions & logical positions (variably sized rows in watch,
|
// visual positions & logical positions (variably sized rows in watch,
|
||||||
// table headers, etc.)
|
// table headers, etc.)
|
||||||
// [ ] @bug selected frame should be keyed by run_idx or something so that it
|
|
||||||
// can gracefully reset to the top frame when running
|
|
||||||
// [ ] @cleanup collapse DF_CfgNodes into just being MD trees, find another way
|
// [ ] @cleanup collapse DF_CfgNodes into just being MD trees, find another way
|
||||||
// to encode config source - don't need it at every node
|
// to encode config source - don't need it at every node
|
||||||
// [ ] @cleanup straighten out index/number space & types & terminology for
|
// [ ] @cleanup straighten out index/number space & types & terminology for
|
||||||
@@ -335,8 +335,6 @@
|
|||||||
// when editing)
|
// when editing)
|
||||||
// [ ] @feature eval system -> somehow evaluate breakpoint hit counts? "meta"
|
// [ ] @feature eval system -> somehow evaluate breakpoint hit counts? "meta"
|
||||||
// variables?
|
// variables?
|
||||||
// [ ] @feature watch window labels
|
|
||||||
// [ ] @feature scheduler -> thread grid view?
|
|
||||||
//
|
//
|
||||||
// [ ] @feature disasm view improvement features
|
// [ ] @feature disasm view improvement features
|
||||||
// [ ] interleaved src/dasm view
|
// [ ] interleaved src/dasm view
|
||||||
@@ -411,6 +409,8 @@
|
|||||||
// bit more user-friendly?
|
// bit more user-friendly?
|
||||||
//
|
//
|
||||||
// [x] The cursor feels a bit too huge vertically.
|
// [x] The cursor feels a bit too huge vertically.
|
||||||
|
// [x] @feature watch window labels
|
||||||
|
// [x] @cleanup @feature double & triple click select in source views
|
||||||
|
|
||||||
#ifndef RADDBG_H
|
#ifndef RADDBG_H
|
||||||
#define RADDBG_H
|
#define RADDBG_H
|
||||||
|
|||||||
Reference in New Issue
Block a user