mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-11-14 02:03:27 -08:00
raddbg/dbg_engine: machine -> server; dbg_server: checkpoint; raddbg_server: hook up response sending (to sender client), and event sending (to all connected clients)
This commit is contained in:
1 parent
c269823e15
commit
6cfaae9a22
18 files changed
+499
-159
No files matched your search
+1
-1
@@ -49,7 +49,7 @@ commands =
|
||||
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg debug telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
// .f1 = { .win = "raddbg_stable --ipc kill_all && build radbin", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
.f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg_server telemetry debug", .linux = "./build.sh raddbg debug meta", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
.f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg telemetry debug", .linux = "./build.sh raddbg debug meta", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
|
||||
//- rjf: [raddbg wsl]
|
||||
// .f1 = { .win = "wsl ./build.sh raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
|
||||
@@ -39,10 +39,10 @@ D_CmdTable: // | | |
|
||||
{ThawThread 1 1 "query:threads" Thread 0 0 0 0 0 1 1 Unlocked "thaw_thread" "Thaw Thread" "Thaws the passed thread." "" "" }
|
||||
{FreezeProcess 1 1 "query:processes" Process 0 0 0 0 0 1 1 Locked "freeze_process" "Freeze Process" "Freezes the passed process." "" "" }
|
||||
{ThawProcess 1 1 "query:processes" Process 0 0 0 0 0 1 1 Unlocked "thaw_process" "Thaw Process" "Thaws the passed process." "" "" }
|
||||
{FreezeMachine 0 1 "query:machines" Machine 0 0 0 0 0 1 1 Locked "freeze_machine" "Freeze Machine" "Freezes the passed machine." "" "" }
|
||||
{ThawMachine 0 1 "query:machines" Machine 0 0 0 0 0 1 1 Unlocked "thaw_machine" "Thaw Machine" "Thaws the passed machine." "" "" }
|
||||
{FreezeLocalMachine 1 1 "" Null 0 0 0 0 0 0 0 Machine "freeze_local_machine" "Freeze Local Machine" "Freezes the local machine." "" "" }
|
||||
{ThawLocalMachine 1 1 "" Null 0 0 0 0 0 0 0 Machine "thaw_local_machine" "Thaw Local Machine" "Thaws the local machine." "" "" }
|
||||
{FreezeServer 0 1 "query:servers" Server 0 0 0 0 0 1 1 Locked "freeze_server " "Freeze Server " "Freezes the passed server." "" "" }
|
||||
{ThawServer 0 1 "query:servers" Server 0 0 0 0 0 1 1 Unlocked "thaw_server" "Thaw Server" "Thaws the passed server." "" "" }
|
||||
{FreezeLocalServer 1 1 "" Null 0 0 0 0 0 0 0 Machine "freeze_local_server" "Freeze Local Server" "Freezes the local server." "" "" }
|
||||
{ThawLocalServer 1 1 "" Null 0 0 0 0 0 0 0 Machine "thaw_local_server" "Thaw Local Server" "Thaws the local server." "" "" }
|
||||
{FreezeEntity 0 0 "" Null 0 0 0 0 0 0 0 Unlocked "freeze_entity" "Freeze Entity" "Freezes an entity." "" "" }
|
||||
{ThawEntity 0 0 "" Null 0 0 0 0 0 0 0 Locked "thaw_entity" "Thaw Entity" "Thaws an entity." "" "" }
|
||||
|
||||
@@ -58,10 +58,10 @@ D_CmdTable: // | | |
|
||||
|
||||
//- rjf: crash dump opening
|
||||
{OpenCrashDump 1 1 `folder:\\"$input\\"` FilePath 0 0 0 0 0 1 1 FileOutline "open_crash_dump" "Open Crash Dump" "Opens a crash dump file and recreates debuggee state at the time of the crash." "" "" }
|
||||
|
||||
//- rjf: remote debugger connecting
|
||||
{OpenRemoteDebugger 1 1 "" String 0 0 0 0 0 1 1 Machine "open_remote_debugger" "Open Remote Debugger" "Opens a remote debugger by IP address." "" "" }
|
||||
{CloseRemoteDebugger 1 1 "query:machines" CtrlEntity 0 0 0 0 0 1 1 Machine "close_remote_debugger" "Close Remote Debugger" "Closes a remote debugger." "" "" }
|
||||
|
||||
//- rjf: remote debug server connecting
|
||||
{OpenRemoteServer 1 1 "" String 0 0 0 0 0 1 1 Machine "open_remote_server" "Open Remote Server" "Opens a remote debug server by IP address." "" "" }
|
||||
{CloseRemoteServer 1 1 "query:servers" CtrlEntity 0 0 0 0 0 1 1 Machine "close_remote_server" "Close Remote Server" "Closes a remote debug server." "" "" }
|
||||
}
|
||||
|
||||
@enum D_CmdKind:
|
||||
@@ -108,7 +108,7 @@ D_DevToggleTable:
|
||||
D_EntityKindTable:
|
||||
{
|
||||
{Root root "Root" }
|
||||
{Machine machine "Machine" }
|
||||
{Server server "Server" }
|
||||
{Process process "Process" }
|
||||
{Thread thread "Thread" }
|
||||
{Module module "Module" }
|
||||
|
||||
@@ -915,10 +915,10 @@ d_entity_ctx_rw_store_alloc(void)
|
||||
store->ctx.hash_slots_count = 1024;
|
||||
store->ctx.hash_slots = push_array(arena, D_EntityHashSlot, store->ctx.hash_slots_count);
|
||||
D_Entity *root = store->ctx.root = d_entity_alloc(store, &d_entity_nil, D_EntityKind_Root, Arch_Null, d_handle_zero(), 0);
|
||||
D_Entity *local_machine = d_entity_alloc(store, root, D_EntityKind_Machine, Arch_CURRENT, d_handle_from_dmn(D_DemonID_LocalHost, dmn_handle_zero()), 0);
|
||||
D_Entity *local_server = d_entity_alloc(store, root, D_EntityKind_Server, Arch_CURRENT, d_handle_from_dmn(D_DemonID_LocalHost, dmn_handle_zero()), 0);
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
String8 local_machine_name = push_str8f(scratch.arena, "This PC (%S)", get_system_info()->machine_name);
|
||||
d_entity_equip_string(store, local_machine, local_machine_name);
|
||||
String8 local_server_name = str8f(scratch.arena, "Local (%S)", get_system_info()->machine_name);
|
||||
d_entity_equip_string(store, local_server, local_server_name);
|
||||
scratch_end(scratch);
|
||||
return store;
|
||||
}
|
||||
@@ -2501,8 +2501,8 @@ d_ctrl_thread__entry_point(void *p)
|
||||
case D_MsgKind_COUNT:{}break;
|
||||
|
||||
//- rjf: remote debuggers
|
||||
case D_MsgKind_OpenRemoteDebugger:{}break;
|
||||
case D_MsgKind_CloseRemoteDebugger:{}break;
|
||||
case D_MsgKind_OpenRemoteServer: {d_ctrl_thread__open_remote_server(ctrl_ctx, msg);}break;
|
||||
case D_MsgKind_CloseRemoteServer:{d_ctrl_thread__close_remote_server(ctrl_ctx, msg);}break;
|
||||
|
||||
//- rjf: target operations
|
||||
case D_MsgKind_Launch: {d_ctrl_thread__launch (ctrl_ctx, msg);}break;
|
||||
@@ -3567,12 +3567,12 @@ d_ctrl_thread__eval_scope_begin(Arena *arena, D_BreakpointList *user_bps, D_Enti
|
||||
{
|
||||
U64 eval_module_idx = 0;
|
||||
U64 eval_dbg_info_idx = 0;
|
||||
for(D_Entity *machine = entity_ctx->root->first;
|
||||
machine != &d_entity_nil;
|
||||
machine = machine->next)
|
||||
for(D_Entity *server = entity_ctx->root->first;
|
||||
server != &d_entity_nil;
|
||||
server = server->next)
|
||||
{
|
||||
if(machine->kind != D_EntityKind_Machine) { continue; }
|
||||
for(D_Entity *process = machine->first;
|
||||
if(server->kind != D_EntityKind_Server) { continue; }
|
||||
for(D_Entity *process = server->first;
|
||||
process != &d_entity_nil;
|
||||
process = process->next)
|
||||
{
|
||||
@@ -3810,6 +3810,18 @@ d_ctrl_thread__end_and_flush_log(void)
|
||||
|
||||
//- rjf: msg kind implementations
|
||||
|
||||
internal void
|
||||
d_ctrl_thread__open_remote_server(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
internal void
|
||||
d_ctrl_thread__close_remote_server(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
internal void
|
||||
d_ctrl_thread__launch(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg)
|
||||
{
|
||||
@@ -4702,7 +4714,7 @@ d_ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg)
|
||||
machine != &d_entity_nil;
|
||||
machine = machine->next)
|
||||
{
|
||||
if(machine->kind != D_EntityKind_Machine) { continue; }
|
||||
if(machine->kind != D_EntityKind_Server) { continue; }
|
||||
for(D_Entity *process = machine->first; process != &d_entity_nil; process = process->next)
|
||||
{
|
||||
if(process->kind != D_EntityKind_Process) { continue; }
|
||||
@@ -4759,7 +4771,7 @@ d_ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg)
|
||||
machine != &d_entity_nil;
|
||||
machine = machine->next)
|
||||
{
|
||||
if(machine->kind != D_EntityKind_Machine) { continue; }
|
||||
if(machine->kind != D_EntityKind_Server) { continue; }
|
||||
for(D_Entity *process = machine->first; process != &d_entity_nil; process = process->next)
|
||||
{
|
||||
if(process->kind != D_EntityKind_Process) { continue; }
|
||||
@@ -4864,7 +4876,7 @@ d_ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg)
|
||||
machine != &d_entity_nil;
|
||||
machine = machine->next)
|
||||
{
|
||||
if(machine->kind != D_EntityKind_Machine) { continue; }
|
||||
if(machine->kind != D_EntityKind_Server) { continue; }
|
||||
for(D_Entity *process = machine->first; process != &d_entity_nil; process = process->next)
|
||||
{
|
||||
if(process->kind != D_EntityKind_Process) { continue; }
|
||||
|
||||
@@ -624,6 +624,8 @@ internal void d_ctrl_thread__eval_scope_end(D_EvalScope *scope);
|
||||
internal void d_ctrl_thread__end_and_flush_log(void);
|
||||
|
||||
//- rjf: msg kind implementations
|
||||
internal void d_ctrl_thread__open_remote_server(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg);
|
||||
internal void d_ctrl_thread__close_remote_server(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg);
|
||||
internal void d_ctrl_thread__launch(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg);
|
||||
internal void d_ctrl_thread__attach(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg);
|
||||
internal void d_ctrl_thread__open_crash_dump(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg);
|
||||
|
||||
@@ -2047,7 +2047,7 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
|
||||
D_EntityArray processes = d_entity_array_from_kind(D_EntityKind_Process);
|
||||
if(processes.count != 0)
|
||||
{
|
||||
d_cmd(D_CmdKind_Continue, .machine = params->machine, .process = params->process, .thread = params->thread);
|
||||
d_cmd(D_CmdKind_Continue, .server = params->server, .process = params->process, .thread = params->thread);
|
||||
}
|
||||
else if(!d_ctrl_targets_running())
|
||||
{
|
||||
@@ -2092,25 +2092,25 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
|
||||
case D_CmdKind_ThawThread:
|
||||
case D_CmdKind_FreezeProcess:
|
||||
case D_CmdKind_ThawProcess:
|
||||
case D_CmdKind_FreezeMachine:
|
||||
case D_CmdKind_ThawMachine:
|
||||
case D_CmdKind_FreezeServer:
|
||||
case D_CmdKind_ThawServer:
|
||||
{
|
||||
D_CmdKind disptch_kind = ((cmd->kind == D_CmdKind_FreezeThread ||
|
||||
cmd->kind == D_CmdKind_FreezeProcess ||
|
||||
cmd->kind == D_CmdKind_FreezeMachine)
|
||||
cmd->kind == D_CmdKind_FreezeServer)
|
||||
? D_CmdKind_FreezeEntity
|
||||
: D_CmdKind_ThawEntity);
|
||||
d_push_cmd(disptch_kind, params);
|
||||
}break;
|
||||
case D_CmdKind_FreezeLocalMachine:
|
||||
case D_CmdKind_FreezeLocalServer:
|
||||
{
|
||||
D_DemonID demon_id = D_DemonID_LocalHost;
|
||||
d_cmd(D_CmdKind_FreezeMachine, .entity = d_handle_from_dmn(demon_id, dmn_handle_zero()));
|
||||
d_cmd(D_CmdKind_FreezeServer, .entity = d_handle_from_dmn(demon_id, dmn_handle_zero()));
|
||||
}break;
|
||||
case D_CmdKind_ThawLocalMachine:
|
||||
case D_CmdKind_ThawLocalServer:
|
||||
{
|
||||
D_DemonID demon_id = D_DemonID_LocalHost;
|
||||
d_cmd(D_CmdKind_ThawMachine, .entity = d_handle_from_dmn(demon_id, dmn_handle_zero()));
|
||||
d_cmd(D_CmdKind_ThawServer, .entity = d_handle_from_dmn(demon_id, dmn_handle_zero()));
|
||||
}break;
|
||||
case D_CmdKind_FreezeEntity:
|
||||
case D_CmdKind_ThawEntity:
|
||||
@@ -2193,18 +2193,18 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
|
||||
}break;
|
||||
|
||||
//- rjf: opening/closing remote debuggers
|
||||
case D_CmdKind_OpenRemoteDebugger:
|
||||
case D_CmdKind_OpenRemoteServer:
|
||||
{
|
||||
D_Msg *msg = d_msg_list_push(scratch.arena, &ctrl_msgs);
|
||||
msg->kind = D_MsgKind_OpenRemoteDebugger;
|
||||
msg->kind = D_MsgKind_OpenRemoteServer;
|
||||
msg->path = str8_copy(scratch.arena, params->string);
|
||||
MemoryCopyArray(msg->exception_code_filters, exception_code_filters);
|
||||
msg->auto_download_debug_info = auto_download_debug_info;
|
||||
}break;
|
||||
case D_CmdKind_CloseRemoteDebugger:
|
||||
case D_CmdKind_CloseRemoteServer:
|
||||
{
|
||||
D_Msg *msg = d_msg_list_push(scratch.arena, &ctrl_msgs);
|
||||
msg->kind = D_MsgKind_CloseRemoteDebugger;
|
||||
msg->kind = D_MsgKind_CloseRemoteServer;
|
||||
msg->entity = params->entity;
|
||||
MemoryCopyArray(msg->exception_code_filters, exception_code_filters);
|
||||
msg->auto_download_debug_info = auto_download_debug_info;
|
||||
|
||||
@@ -59,7 +59,7 @@ D_RunKind;
|
||||
typedef struct D_CmdParams D_CmdParams;
|
||||
struct D_CmdParams
|
||||
{
|
||||
D_Handle machine;
|
||||
D_Handle server;
|
||||
D_Handle process;
|
||||
D_Handle thread;
|
||||
D_Handle entity;
|
||||
@@ -160,8 +160,8 @@ struct D_RunLocalsCache
|
||||
typedef enum D_MsgKind
|
||||
{
|
||||
D_MsgKind_Null,
|
||||
D_MsgKind_OpenRemoteDebugger,
|
||||
D_MsgKind_CloseRemoteDebugger,
|
||||
D_MsgKind_OpenRemoteServer,
|
||||
D_MsgKind_CloseRemoteServer,
|
||||
D_MsgKind_Launch,
|
||||
D_MsgKind_Attach,
|
||||
D_MsgKind_OpenCrashDump,
|
||||
@@ -265,6 +265,10 @@ typedef enum D_EventKind
|
||||
D_EventKind_MemDecommit,
|
||||
D_EventKind_MemRelease,
|
||||
|
||||
//- rjf: remote connections
|
||||
D_EventKind_RemoteControllerConnect,
|
||||
D_EventKind_RemoteControllerDisconnect,
|
||||
|
||||
D_EventKind_COUNT
|
||||
}
|
||||
D_EventKind;
|
||||
|
||||
@@ -8,7 +8,7 @@ String8 d_entity_kind_code_name_table[13] =
|
||||
{
|
||||
{0},
|
||||
str8_lit_comp("root"),
|
||||
str8_lit_comp("machine"),
|
||||
str8_lit_comp("server"),
|
||||
str8_lit_comp("process"),
|
||||
str8_lit_comp("thread"),
|
||||
str8_lit_comp("module"),
|
||||
@@ -25,7 +25,7 @@ String8 d_entity_kind_display_string_table[13] =
|
||||
{
|
||||
{0},
|
||||
str8_lit_comp("Root"),
|
||||
str8_lit_comp("Machine"),
|
||||
str8_lit_comp("Server"),
|
||||
str8_lit_comp("Process"),
|
||||
str8_lit_comp("Thread"),
|
||||
str8_lit_comp("Module"),
|
||||
|
||||
@@ -34,10 +34,10 @@ D_CmdKind_FreezeThread,
|
||||
D_CmdKind_ThawThread,
|
||||
D_CmdKind_FreezeProcess,
|
||||
D_CmdKind_ThawProcess,
|
||||
D_CmdKind_FreezeMachine,
|
||||
D_CmdKind_ThawMachine,
|
||||
D_CmdKind_FreezeLocalMachine,
|
||||
D_CmdKind_ThawLocalMachine,
|
||||
D_CmdKind_FreezeServer,
|
||||
D_CmdKind_ThawServer,
|
||||
D_CmdKind_FreezeLocalServer,
|
||||
D_CmdKind_ThawLocalServer,
|
||||
D_CmdKind_FreezeEntity,
|
||||
D_CmdKind_ThawEntity,
|
||||
D_CmdKind_SetEntityColor,
|
||||
@@ -45,8 +45,8 @@ D_CmdKind_SetEntityName,
|
||||
D_CmdKind_DownloadModuleDebugInfo,
|
||||
D_CmdKind_Attach,
|
||||
D_CmdKind_OpenCrashDump,
|
||||
D_CmdKind_OpenRemoteDebugger,
|
||||
D_CmdKind_CloseRemoteDebugger,
|
||||
D_CmdKind_OpenRemoteServer,
|
||||
D_CmdKind_CloseRemoteServer,
|
||||
D_CmdKind_COUNT,
|
||||
} D_CmdKind;
|
||||
|
||||
@@ -54,7 +54,7 @@ typedef enum D_EntityKind
|
||||
{
|
||||
D_EntityKind_Null,
|
||||
D_EntityKind_Root,
|
||||
D_EntityKind_Machine,
|
||||
D_EntityKind_Server,
|
||||
D_EntityKind_Process,
|
||||
D_EntityKind_Thread,
|
||||
D_EntityKind_Module,
|
||||
|
||||
+223
-11
@@ -7,15 +7,9 @@
|
||||
internal DS_Msg
|
||||
ds_msg_from_serialized(Arena *arena, String8 data)
|
||||
{
|
||||
//- rjf: unpack message
|
||||
U16 magic_maybe = 0;
|
||||
str8_deserial_read_struct(data, 0, &magic_maybe);
|
||||
|
||||
//- rjf: parse message
|
||||
DS_Msg msg = {0};
|
||||
if(magic_maybe == DS_MSG_MAGIC)
|
||||
{
|
||||
U64 off = sizeof(magic_maybe);
|
||||
U64 off = 0;
|
||||
|
||||
// rjf: read flat parts
|
||||
off += str8_deserial_read_struct(data, off, &msg.kind);
|
||||
@@ -76,7 +70,6 @@ ds_msg_from_serialized(Arena *arena, String8 data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
@@ -85,11 +78,61 @@ ds_serialized_from_msg(Arena *arena, DS_Msg *msg)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8List srl = {0};
|
||||
str8_serial_begin(scratch.arena, &srl);
|
||||
{
|
||||
// TODO(rjf)
|
||||
// rjf: write flat parts
|
||||
str8_serial_push_struct(scratch.arena, &srl, &msg->kind);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &msg->flags);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &msg->msg_id);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &msg->vaddr_range);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &msg->access_flags);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &msg->entity);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &msg->pid);
|
||||
|
||||
// rjf: write command line strings
|
||||
{
|
||||
str8_serial_push_struct(scratch.arena, &srl, &msg->command_line.node_count);
|
||||
for EachNode(n, String8Node, msg->command_line.first)
|
||||
{
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->string.size);
|
||||
str8_serial_push_string(scratch.arena, &srl, n->string);
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: write path
|
||||
{
|
||||
str8_serial_push_struct(scratch.arena, &srl, &msg->path.size);
|
||||
str8_serial_push_string(scratch.arena, &srl, msg->path);
|
||||
}
|
||||
|
||||
// rjf: write environment strings
|
||||
{
|
||||
str8_serial_push_struct(scratch.arena, &srl, &msg->env.node_count);
|
||||
for EachNode(n, String8Node, msg->command_line.first)
|
||||
{
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->string.size);
|
||||
str8_serial_push_string(scratch.arena, &srl, n->string);
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: write traps
|
||||
{
|
||||
str8_serial_push_struct(scratch.arena, &srl, &msg->traps.trap_count);
|
||||
for EachNode(n, DMN_TrapChunkNode, msg->traps.first)
|
||||
{
|
||||
for EachIndex(idx, n->count)
|
||||
{
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v[idx].process);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v[idx].vaddr);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v[idx].id);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v[idx].flags);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v[idx].size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String8 result = str8_serial_end(arena, &srl);
|
||||
scratch_end(scratch);
|
||||
String8 result = str8_list_join(arena, &srl, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -97,12 +140,181 @@ internal DS_Response
|
||||
ds_response_from_serialized(Arena *arena, String8 data)
|
||||
{
|
||||
DS_Response result = {0};
|
||||
{
|
||||
U64 off = 0;
|
||||
|
||||
// rjf: read flat parts
|
||||
off += str8_deserial_read_struct(data, off, &result.msg_id);
|
||||
off += str8_deserial_read_struct(data, off, &result.entity);
|
||||
off += str8_deserial_read_struct(data, off, &result.pid);
|
||||
off += str8_deserial_read_struct(data, off, &result.good);
|
||||
|
||||
// rjf: read data payload
|
||||
off += str8_deserial_read_struct(data, off, &result.data.size);
|
||||
result.data.str = push_array(arena, U8, result.data.size);
|
||||
off += str8_deserial_read(data, off, result.data.str, result.data.size, result.data.size);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
ds_serialized_from_response(Arena *arena, DS_Response *response)
|
||||
{
|
||||
String8 result = {0};
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8List srl = {0};
|
||||
str8_serial_begin(scratch.arena, &srl);
|
||||
{
|
||||
// rjf: write flat parts
|
||||
str8_serial_push_struct(scratch.arena, &srl, &response->msg_id);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &response->entity);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &response->pid);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &response->good);
|
||||
|
||||
// rjf: write data payload
|
||||
str8_serial_push_struct(scratch.arena, &srl, &response->data.size);
|
||||
str8_serial_push_string(scratch.arena, &srl, response->data);
|
||||
}
|
||||
String8 result = str8_serial_end(arena, &srl);
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal DMN_EventList
|
||||
ds_dmn_events_from_serialized(Arena *arena, String8 data)
|
||||
{
|
||||
DMN_EventList evts = {0};
|
||||
{
|
||||
U64 off = 0;
|
||||
U64 demon_event_count = 0;
|
||||
off += str8_deserial_read_struct(data, off, &demon_event_count);
|
||||
for EachIndex(idx, demon_event_count)
|
||||
{
|
||||
DMN_Event *evt = dmn_event_list_push(arena, &evts);
|
||||
|
||||
// rjf: read flat parts
|
||||
off += str8_deserial_read_struct(data, off, &evt->kind);
|
||||
off += str8_deserial_read_struct(data, off, &evt->error_kind);
|
||||
off += str8_deserial_read_struct(data, off, &evt->memory_kind);
|
||||
off += str8_deserial_read_struct(data, off, &evt->exception_kind);
|
||||
off += str8_deserial_read_struct(data, off, &evt->process);
|
||||
off += str8_deserial_read_struct(data, off, &evt->thread);
|
||||
off += str8_deserial_read_struct(data, off, &evt->module);
|
||||
off += str8_deserial_read_struct(data, off, &evt->arch);
|
||||
off += str8_deserial_read_struct(data, off, &evt->address);
|
||||
off += str8_deserial_read_struct(data, off, &evt->size);
|
||||
off += str8_deserial_read_struct(data, off, &evt->code);
|
||||
off += str8_deserial_read_struct(data, off, &evt->flags);
|
||||
off += str8_deserial_read_struct(data, off, &evt->instruction_pointer);
|
||||
off += str8_deserial_read_struct(data, off, &evt->stack_pointer);
|
||||
off += str8_deserial_read_struct(data, off, &evt->user_data);
|
||||
off += str8_deserial_read_struct(data, off, &evt->exception_repeated);
|
||||
off += str8_deserial_read_struct(data, off, &evt->tls_root_vaddr);
|
||||
|
||||
// rjf: read string
|
||||
off += str8_deserial_read_struct(data, off, &evt->string.size);
|
||||
evt->string.str = push_array(arena, U8, evt->string.size);
|
||||
off += str8_deserial_read(data, off, evt->string.str, evt->string.size, 1);
|
||||
|
||||
// rjf: read module info
|
||||
B8 has_module_info = 0;
|
||||
off += str8_deserial_read_struct(data, off, &has_module_info);
|
||||
if(!has_module_info)
|
||||
{
|
||||
evt->module_info = &dmn_module_info_nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
evt->module_info = push_array(arena, DMN_ModuleInfo, 1);
|
||||
|
||||
// rjf: read flat parts
|
||||
off += str8_deserial_read_struct(data, off, &evt->module_info->arch);
|
||||
off += str8_deserial_read_struct(data, off, &evt->module_info->vsize);
|
||||
off += str8_deserial_read_struct(data, off, &evt->module_info->entry_point_voff);
|
||||
off += str8_deserial_read_struct(data, off, &evt->module_info->debug_info_guid);
|
||||
off += str8_deserial_read_struct(data, off, &evt->module_info->debug_info_timestamp);
|
||||
off += str8_deserial_read_struct(data, off, &evt->module_info->debug_info_age);
|
||||
off += str8_deserial_read_struct(data, off, &evt->module_info->tls_index);
|
||||
off += str8_deserial_read_struct(data, off, &evt->module_info->tls_offset);
|
||||
off += str8_deserial_read_struct(data, off, &evt->module_info->pe_intel_pdatas_vaddr_range);
|
||||
off += str8_deserial_read_struct(data, off, &evt->module_info->eh_frame_header_vaddr_range);
|
||||
off += str8_deserial_read_struct(data, off, &evt->module_info->raddbg_info_voff_range);
|
||||
off += str8_deserial_read_struct(data, off, &evt->module_info->raddbg_is_attached_marker_voff);
|
||||
|
||||
// rjf: read paths
|
||||
off += str8_deserial_read_struct(data, off, &evt->module_info->module_path.size);
|
||||
evt->module_info->module_path.str = push_array(arena, U8, evt->module_info->module_path.size);
|
||||
off += str8_deserial_read(data, off, evt->module_info->module_path.str, evt->module_info->module_path.size, 1);
|
||||
off += str8_deserial_read_struct(data, off, &evt->module_info->debug_info_path.size);
|
||||
evt->module_info->debug_info_path.str = push_array(arena, U8, evt->module_info->debug_info_path.size);
|
||||
off += str8_deserial_read(data, off, evt->module_info->debug_info_path.str, evt->module_info->debug_info_path.size, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return evts;
|
||||
}
|
||||
|
||||
internal String8
|
||||
ds_serialized_from_dmn_events(Arena *arena, DMN_EventList evts)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8List srl = {0};
|
||||
str8_serial_begin(scratch.arena, &srl);
|
||||
{
|
||||
// rjf: write events
|
||||
str8_serial_push_struct(scratch.arena, &srl, &evts.count);
|
||||
for EachNode(n, DMN_EventNode, evts.first)
|
||||
{
|
||||
// rjf: write flat parts
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.kind);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.error_kind);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.memory_kind);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.exception_kind);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.process);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.thread);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.module);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.arch);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.address);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.size);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.code);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.flags);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.instruction_pointer);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.stack_pointer);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.user_data);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.exception_repeated);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.tls_root_vaddr);
|
||||
|
||||
// rjf: write string
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.string.size);
|
||||
str8_serial_push_string(scratch.arena, &srl, n->v.string);
|
||||
|
||||
// rjf: write module info
|
||||
B8 has_module_info = (n->v.module_info != 0 && n->v.module_info != &dmn_module_info_nil);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &has_module_info);
|
||||
if(has_module_info)
|
||||
{
|
||||
// rjf: write flat parts
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.module_info->arch);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.module_info->vsize);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.module_info->entry_point_voff);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.module_info->debug_info_guid);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.module_info->debug_info_timestamp);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.module_info->debug_info_age);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.module_info->tls_index);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.module_info->tls_offset);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.module_info->pe_intel_pdatas_vaddr_range);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.module_info->eh_frame_header_vaddr_range);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.module_info->raddbg_info_voff_range);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.module_info->raddbg_is_attached_marker_voff);
|
||||
|
||||
// rjf: write paths
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.module_info->module_path.size);
|
||||
str8_serial_push_string(scratch.arena, &srl, n->v.module_info->module_path);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &n->v.module_info->debug_info_path.size);
|
||||
str8_serial_push_string(scratch.arena, &srl, n->v.module_info->debug_info_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
String8 result = str8_serial_end(arena, &srl);
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
@@ -5,9 +5,30 @@
|
||||
#define DBG_SERVER_H
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Messages (Client -> Server)
|
||||
//~ rjf: Packet Headers
|
||||
|
||||
#define DS_MSG_MAGIC 0x7273
|
||||
#define DS_PACKET_MAGIC 0x7273
|
||||
#define DS_PACKET_VERSION 0x0
|
||||
|
||||
typedef U8 DS_PacketKind;
|
||||
enum
|
||||
{
|
||||
DS_PacketKind_Msg,
|
||||
DS_PacketKind_Response,
|
||||
DS_PacketKind_Event,
|
||||
};
|
||||
|
||||
typedef struct DS_PacketHeader DS_PacketHeader;
|
||||
struct DS_PacketHeader
|
||||
{
|
||||
U16 magic;
|
||||
DS_PacketKind kind;
|
||||
U8 version;
|
||||
U32 payload_size;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Messages (Client -> Server)
|
||||
|
||||
typedef enum DS_MsgKind
|
||||
{
|
||||
@@ -86,11 +107,10 @@ typedef struct DS_Response DS_Response;
|
||||
struct DS_Response
|
||||
{
|
||||
U64 msg_id;
|
||||
String8 data;
|
||||
DMN_Handle entity;
|
||||
U64 pid;
|
||||
B32 good;
|
||||
DMN_EventList events;
|
||||
String8 data;
|
||||
};
|
||||
|
||||
typedef struct DS_ResponseNode DS_ResponseNode;
|
||||
@@ -107,5 +127,7 @@ internal DS_Msg ds_msg_from_serialized(Arena *arena, String8 data);
|
||||
internal String8 ds_serialized_from_msg(Arena *arena, DS_Msg *msg);
|
||||
internal DS_Response ds_response_from_serialized(Arena *arena, String8 data);
|
||||
internal String8 ds_serialized_from_response(Arena *arena, DS_Response *response);
|
||||
internal DMN_EventList ds_dmn_events_from_serialized(Arena *arena, String8 data);
|
||||
internal String8 ds_serialized_from_dmn_events(Arena *arena, DMN_EventList evts);
|
||||
|
||||
#endif // DBG_SERVER_H
|
||||
@@ -49,7 +49,7 @@ str8_lit_comp("query:watch_pins"),
|
||||
str8_lit_comp("query:debug_infos"),
|
||||
str8_lit_comp("query:threads"),
|
||||
str8_lit_comp("query:processes"),
|
||||
str8_lit_comp("query:machines"),
|
||||
str8_lit_comp("query:servers"),
|
||||
str8_lit_comp("query:modules"),
|
||||
str8_lit_comp("query:file_path_maps"),
|
||||
str8_lit_comp("query:type_views"),
|
||||
@@ -62,7 +62,7 @@ str8_lit_comp(""),
|
||||
str8_lit_comp(""),
|
||||
};
|
||||
|
||||
RD_VocabInfo rd_vocab_info_table[374] =
|
||||
RD_VocabInfo rd_vocab_info_table[373] =
|
||||
{
|
||||
{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},
|
||||
@@ -122,6 +122,7 @@ RD_VocabInfo rd_vocab_info_table[374] =
|
||||
{str8_lit_comp("process"), str8_lit_comp("processes"), str8_lit_comp("Process"), str8_lit_comp("Processes"), RD_IconKind_Scheduler},
|
||||
{str8_lit_comp("processes"), str8_lit_comp(""), str8_lit_comp("Processes"), str8_lit_comp(""), RD_IconKind_Scheduler},
|
||||
{str8_lit_comp("machine"), str8_lit_comp("machines"), str8_lit_comp("Machine"), str8_lit_comp("Machines"), RD_IconKind_Machine},
|
||||
{str8_lit_comp("server"), str8_lit_comp("servers"), str8_lit_comp("Server"), str8_lit_comp("Servers"), RD_IconKind_Machine},
|
||||
{str8_lit_comp("module"), str8_lit_comp("modules"), str8_lit_comp("Module"), str8_lit_comp("Modules"), RD_IconKind_Module},
|
||||
{str8_lit_comp("getting_started"), str8_lit_comp(""), str8_lit_comp("Getting Started"), str8_lit_comp(""), RD_IconKind_QuestionMark},
|
||||
{str8_lit_comp("disasm"), str8_lit_comp(""), str8_lit_comp("Disassembly"), str8_lit_comp(""), RD_IconKind_Glasses},
|
||||
@@ -203,10 +204,10 @@ RD_VocabInfo rd_vocab_info_table[374] =
|
||||
{str8_lit_comp("thaw_thread"), str8_lit_comp(""), str8_lit_comp("Thaw Thread"), str8_lit_comp(""), RD_IconKind_Unlocked},
|
||||
{str8_lit_comp("freeze_process"), str8_lit_comp(""), str8_lit_comp("Freeze Process"), str8_lit_comp(""), RD_IconKind_Locked},
|
||||
{str8_lit_comp("thaw_process"), str8_lit_comp(""), str8_lit_comp("Thaw Process"), str8_lit_comp(""), RD_IconKind_Unlocked},
|
||||
{str8_lit_comp("freeze_machine"), str8_lit_comp(""), str8_lit_comp("Freeze Machine"), str8_lit_comp(""), RD_IconKind_Locked},
|
||||
{str8_lit_comp("thaw_machine"), str8_lit_comp(""), str8_lit_comp("Thaw Machine"), str8_lit_comp(""), RD_IconKind_Unlocked},
|
||||
{str8_lit_comp("freeze_local_machine"), str8_lit_comp(""), str8_lit_comp("Freeze Local Machine"), str8_lit_comp(""), RD_IconKind_Machine},
|
||||
{str8_lit_comp("thaw_local_machine"), str8_lit_comp(""), str8_lit_comp("Thaw Local Machine"), str8_lit_comp(""), RD_IconKind_Machine},
|
||||
{str8_lit_comp("freeze_server "), str8_lit_comp(""), str8_lit_comp("Freeze Server "), str8_lit_comp(""), RD_IconKind_Locked},
|
||||
{str8_lit_comp("thaw_server"), str8_lit_comp(""), str8_lit_comp("Thaw Server"), str8_lit_comp(""), RD_IconKind_Unlocked},
|
||||
{str8_lit_comp("freeze_local_server"), str8_lit_comp(""), str8_lit_comp("Freeze Local Server"), str8_lit_comp(""), RD_IconKind_Machine},
|
||||
{str8_lit_comp("thaw_local_server"), str8_lit_comp(""), str8_lit_comp("Thaw Local Server"), str8_lit_comp(""), RD_IconKind_Machine},
|
||||
{str8_lit_comp("freeze_entity"), str8_lit_comp(""), str8_lit_comp("Freeze Entity"), str8_lit_comp(""), RD_IconKind_Unlocked},
|
||||
{str8_lit_comp("thaw_entity"), str8_lit_comp(""), str8_lit_comp("Thaw Entity"), str8_lit_comp(""), RD_IconKind_Locked},
|
||||
{str8_lit_comp("set_entity_color"), str8_lit_comp(""), str8_lit_comp("Set Entity Color"), str8_lit_comp(""), RD_IconKind_Null},
|
||||
@@ -214,8 +215,8 @@ RD_VocabInfo rd_vocab_info_table[374] =
|
||||
{str8_lit_comp("download_module_debug_info"), str8_lit_comp(""), str8_lit_comp("Download Module Debug Info"), str8_lit_comp(""), RD_IconKind_Module},
|
||||
{str8_lit_comp("attach"), str8_lit_comp(""), str8_lit_comp("Attach"), str8_lit_comp(""), RD_IconKind_Null},
|
||||
{str8_lit_comp("open_crash_dump"), str8_lit_comp(""), str8_lit_comp("Open Crash Dump"), str8_lit_comp(""), RD_IconKind_FileOutline},
|
||||
{str8_lit_comp("open_remote_debugger"), str8_lit_comp(""), str8_lit_comp("Open Remote Debugger"), str8_lit_comp(""), RD_IconKind_Machine},
|
||||
{str8_lit_comp("close_remote_debugger"), str8_lit_comp(""), str8_lit_comp("Close Remote Debugger"), str8_lit_comp(""), RD_IconKind_Machine},
|
||||
{str8_lit_comp("open_remote_server"), str8_lit_comp(""), str8_lit_comp("Open Remote Server"), str8_lit_comp(""), RD_IconKind_Machine},
|
||||
{str8_lit_comp("close_remote_server"), str8_lit_comp(""), str8_lit_comp("Close Remote Server"), str8_lit_comp(""), RD_IconKind_Machine},
|
||||
{str8_lit_comp("exit"), str8_lit_comp(""), str8_lit_comp("Exit"), str8_lit_comp(""), RD_IconKind_X},
|
||||
{str8_lit_comp("open_palette"), str8_lit_comp(""), str8_lit_comp("Open Palette"), str8_lit_comp(""), RD_IconKind_List},
|
||||
{str8_lit_comp("run_command"), str8_lit_comp(""), str8_lit_comp("Run Command"), str8_lit_comp(""), RD_IconKind_Null},
|
||||
@@ -223,8 +224,6 @@ RD_VocabInfo rd_vocab_info_table[374] =
|
||||
{str8_lit_comp("state"), str8_lit_comp(""), str8_lit_comp("State"), str8_lit_comp(""), RD_IconKind_Null},
|
||||
{str8_lit_comp("eval"), str8_lit_comp(""), str8_lit_comp("Eval"), str8_lit_comp(""), RD_IconKind_Null},
|
||||
{str8_lit_comp("line_from_vaddr"), str8_lit_comp(""), str8_lit_comp("Line From Virtual Address"), str8_lit_comp(""), RD_IconKind_Null},
|
||||
{str8_lit_comp("remote_controller_connect"), str8_lit_comp(""), str8_lit_comp("Remote Controller Connect"), str8_lit_comp(""), RD_IconKind_Null},
|
||||
{str8_lit_comp("remote_controller_disconnect"), str8_lit_comp(""), str8_lit_comp("Remote Controller Disconnect"), str8_lit_comp(""), RD_IconKind_Null},
|
||||
{str8_lit_comp("wm_event"), str8_lit_comp(""), str8_lit_comp("OS Event"), str8_lit_comp(""), RD_IconKind_Null},
|
||||
{str8_lit_comp("select_thread"), str8_lit_comp(""), str8_lit_comp("Select Thread"), str8_lit_comp(""), RD_IconKind_Thread},
|
||||
{str8_lit_comp("select_unwind"), str8_lit_comp(""), str8_lit_comp("Select Unwind"), str8_lit_comp(""), RD_IconKind_Null},
|
||||
@@ -427,7 +426,7 @@ RD_VocabInfo rd_vocab_info_table[374] =
|
||||
{str8_lit_comp("debug_infos"), str8_lit_comp(""), str8_lit_comp("Debug Info"), str8_lit_comp(""), RD_IconKind_Module},
|
||||
{str8_lit_comp("threads"), str8_lit_comp(""), str8_lit_comp("Threads"), str8_lit_comp(""), RD_IconKind_Threads},
|
||||
{str8_lit_comp("processes"), str8_lit_comp(""), str8_lit_comp("Processes"), str8_lit_comp(""), RD_IconKind_Scheduler},
|
||||
{str8_lit_comp("machines"), str8_lit_comp(""), str8_lit_comp("Machines"), str8_lit_comp(""), RD_IconKind_Machine},
|
||||
{str8_lit_comp("servers"), str8_lit_comp(""), str8_lit_comp("Servers"), 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("type_views"), str8_lit_comp(""), str8_lit_comp("Type Views"), str8_lit_comp(""), RD_IconKind_Binoculars},
|
||||
@@ -477,7 +476,7 @@ RD_NameSchemaInfo rd_name_schema_info_table[39] =
|
||||
{str8_lit_comp("file_path_map"), 0, str8_lit_comp("@collection_commands(add_file_path_map) @row_commands(remove_cfg) x:{'source': @no_relativize path, 'dest': @no_relativize path}")},
|
||||
{str8_lit_comp("type_view"), 0, str8_lit_comp("@collection_commands(add_type_view) @row_commands(remove_cfg) x:{'type':expr_string, 'expr':expr_string}")},
|
||||
{str8_lit_comp("recent_project"), 0, str8_lit_comp("x:{'path':path, 'name':string}")},
|
||||
{str8_lit_comp("machine"), 0, str8_lit_comp("x:{'label':code_string, @no_expand 'active':bool, 'unattached_processes':set, 'processes':set}")},
|
||||
{str8_lit_comp("server"), 0, str8_lit_comp("x:{'label':code_string, @no_expand 'active':bool, 'unattached_processes':set, 'processes':set}")},
|
||||
{str8_lit_comp("process"), 0, str8_lit_comp("x:{'label':code_string, 'id':u64, @no_expand 'active':bool, 'modules':set, 'threads':set, @query @no_expand 'memory':address_space}")},
|
||||
{str8_lit_comp("module"), 0, str8_lit_comp("x:{'exe':path, 'dbg':path, 'vaddr_range':vaddr_range}")},
|
||||
{str8_lit_comp("thread"), 0, str8_lit_comp("x:{'label':code_string, 'id':u64, @no_expand 'active':bool, 'call_stack':set}")},
|
||||
@@ -486,7 +485,7 @@ RD_NameSchemaInfo rd_name_schema_info_table[39] =
|
||||
String8 rd_reg_slot_code_name_table[56] =
|
||||
{
|
||||
{0},
|
||||
str8_lit_comp("machine"),
|
||||
str8_lit_comp("server"),
|
||||
str8_lit_comp("module"),
|
||||
str8_lit_comp("process"),
|
||||
str8_lit_comp("thread"),
|
||||
@@ -546,7 +545,7 @@ str8_lit_comp("wm_event"),
|
||||
Rng1U64 rd_reg_slot_range_table[56] =
|
||||
{
|
||||
{0},
|
||||
{OffsetOf(RD_Regs, machine), OffsetOf(RD_Regs, machine) + sizeof(D_Handle)},
|
||||
{OffsetOf(RD_Regs, server), OffsetOf(RD_Regs, server) + sizeof(D_Handle)},
|
||||
{OffsetOf(RD_Regs, module), OffsetOf(RD_Regs, module) + sizeof(D_Handle)},
|
||||
{OffsetOf(RD_Regs, process), OffsetOf(RD_Regs, process) + sizeof(D_Handle)},
|
||||
{OffsetOf(RD_Regs, thread), OffsetOf(RD_Regs, thread) + sizeof(D_Handle)},
|
||||
@@ -603,7 +602,7 @@ Rng1U64 rd_reg_slot_range_table[56] =
|
||||
{OffsetOf(RD_Regs, wm_event), OffsetOf(RD_Regs, wm_event) + sizeof(WM_Event *)},
|
||||
};
|
||||
|
||||
RD_CmdKindInfo rd_cmd_kind_info_table[261] =
|
||||
RD_CmdKindInfo rd_cmd_kind_info_table[259] =
|
||||
{
|
||||
{0},
|
||||
{ str8_lit_comp("launch_and_run"), str8_lit_comp("Starts debugging a new instance of a target, then runs."), str8_lit_comp("launch,start,run,target"), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(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_Cfg, str8_lit_comp("query:targets")}},
|
||||
@@ -631,10 +630,10 @@ RD_CmdKindInfo rd_cmd_kind_info_table[261] =
|
||||
{ str8_lit_comp("thaw_thread"), str8_lit_comp("Thaws the passed thread."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(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_Thread, str8_lit_comp("query:threads")}},
|
||||
{ str8_lit_comp("freeze_process"), str8_lit_comp("Freezes the passed process."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(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_Process, str8_lit_comp("query:processes")}},
|
||||
{ str8_lit_comp("thaw_process"), str8_lit_comp("Thaws the passed process."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(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_Process, str8_lit_comp("query:processes")}},
|
||||
{ str8_lit_comp("freeze_machine"), str8_lit_comp("Freezes the passed machine."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(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_Machine, str8_lit_comp("query:machines")}},
|
||||
{ str8_lit_comp("thaw_machine"), str8_lit_comp("Thaws the passed machine."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(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_Machine, str8_lit_comp("query:machines")}},
|
||||
{ str8_lit_comp("freeze_local_machine"), str8_lit_comp("Freezes the local machine."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(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("thaw_local_machine"), str8_lit_comp("Thaws the local machine."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(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("freeze_server "), str8_lit_comp("Freezes the passed server."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(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_Server, str8_lit_comp("query:servers")}},
|
||||
{ str8_lit_comp("thaw_server"), str8_lit_comp("Thaws the passed server."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(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_Server, str8_lit_comp("query:servers")}},
|
||||
{ str8_lit_comp("freeze_local_server"), str8_lit_comp("Freezes the local server."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(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("thaw_local_server"), str8_lit_comp("Thaws the local server."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(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("freeze_entity"), str8_lit_comp("Freezes an entity."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*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("thaw_entity"), str8_lit_comp("Thaws an entity."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*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("set_entity_color"), str8_lit_comp("Sets the passed entity's color."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*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("")}},
|
||||
@@ -642,8 +641,8 @@ RD_CmdKindInfo rd_cmd_kind_info_table[261] =
|
||||
{ str8_lit_comp("download_module_debug_info"), str8_lit_comp("Tries to download a module's debug info from symbol server(s)."), str8_lit_comp(""), str8_lit_comp("{module_commands}"), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(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_CtrlEntity, str8_lit_comp("query:modules")}},
|
||||
{ str8_lit_comp("attach"), str8_lit_comp("Attaches to a process that is already running on the local machine."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(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_PID, str8_lit_comp("query:unattached_processes")}},
|
||||
{ str8_lit_comp("open_crash_dump"), str8_lit_comp("Opens a crash dump file and recreates debuggee state at the time of the crash."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(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("open_remote_debugger"), str8_lit_comp("Opens a remote debugger by IP address."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(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_String, str8_lit_comp("")}},
|
||||
{ str8_lit_comp("close_remote_debugger"), str8_lit_comp("Closes a remote debugger."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(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_CtrlEntity, str8_lit_comp("query:machines")}},
|
||||
{ str8_lit_comp("open_remote_server"), str8_lit_comp("Opens a remote debug server by IP address."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(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_String, str8_lit_comp("")}},
|
||||
{ str8_lit_comp("close_remote_server"), str8_lit_comp("Closes a remote debug server."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(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_CtrlEntity, str8_lit_comp("query:servers")}},
|
||||
{ str8_lit_comp("exit"), str8_lit_comp("Exits the debugger."), str8_lit_comp("quit,close,abort"), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(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("open_palette"), str8_lit_comp("Opens the palette."), str8_lit_comp("help,cmd,lister"), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(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("run_command"), str8_lit_comp("Runs a command from the command palette."), str8_lit_comp("help,cmd"), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(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_CmdName, str8_lit_comp("query:commands")}},
|
||||
@@ -651,8 +650,6 @@ RD_CmdKindInfo rd_cmd_kind_info_table[261] =
|
||||
{ str8_lit_comp("state"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*1), {(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("eval"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*1), {(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_Expr, str8_lit_comp("")}},
|
||||
{ str8_lit_comp("line_from_vaddr"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*1), {(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_Vaddr, str8_lit_comp("")}},
|
||||
{ str8_lit_comp("remote_controller_connect"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*1), {(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("remote_controller_disconnect"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*1), {(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("wm_event"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*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("select_thread"), str8_lit_comp("Selects a thread."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(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_Thread, str8_lit_comp("query:threads")}},
|
||||
{ str8_lit_comp("select_unwind"), str8_lit_comp("Selects an unwind frame number for the selected thread."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*1), {(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("query:call_stack")}},
|
||||
@@ -855,7 +852,7 @@ RD_CmdKindInfo rd_cmd_kind_info_table[261] =
|
||||
{ str8_lit_comp("debug_infos"), str8_lit_comp("Opens a Debug Info tab."), {0}, str8_lit_comp("{tab_commands}"), RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs},
|
||||
{ str8_lit_comp("threads"), str8_lit_comp("Opens a Threads tab."), {0}, str8_lit_comp("{tab_commands}"), RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs},
|
||||
{ str8_lit_comp("processes"), str8_lit_comp("Opens a Processes tab."), {0}, str8_lit_comp("{tab_commands}"), RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs},
|
||||
{ str8_lit_comp("machines"), str8_lit_comp("Opens a Machines tab."), {0}, str8_lit_comp("{tab_commands}"), RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs},
|
||||
{ str8_lit_comp("servers"), str8_lit_comp("Opens a Servers tab."), {0}, str8_lit_comp("{tab_commands}"), RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs},
|
||||
{ str8_lit_comp("modules"), str8_lit_comp("Opens a Modules tab."), {0}, str8_lit_comp("{tab_commands}"), RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs},
|
||||
{ str8_lit_comp("file_path_maps"), str8_lit_comp("Opens a File Path Map tab."), {0}, str8_lit_comp("{tab_commands}"), RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs},
|
||||
{ str8_lit_comp("type_views"), str8_lit_comp("Opens a Type Views tab."), {0}, str8_lit_comp("{tab_commands}"), RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs},
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
typedef enum RD_RegSlot
|
||||
{
|
||||
RD_RegSlot_Null,
|
||||
RD_RegSlot_Machine,
|
||||
RD_RegSlot_Server,
|
||||
RD_RegSlot_Module,
|
||||
RD_RegSlot_Process,
|
||||
RD_RegSlot_Thread,
|
||||
@@ -95,10 +95,10 @@ RD_CmdKind_FreezeThread,
|
||||
RD_CmdKind_ThawThread,
|
||||
RD_CmdKind_FreezeProcess,
|
||||
RD_CmdKind_ThawProcess,
|
||||
RD_CmdKind_FreezeMachine,
|
||||
RD_CmdKind_ThawMachine,
|
||||
RD_CmdKind_FreezeLocalMachine,
|
||||
RD_CmdKind_ThawLocalMachine,
|
||||
RD_CmdKind_FreezeServer,
|
||||
RD_CmdKind_ThawServer,
|
||||
RD_CmdKind_FreezeLocalServer,
|
||||
RD_CmdKind_ThawLocalServer,
|
||||
RD_CmdKind_FreezeEntity,
|
||||
RD_CmdKind_ThawEntity,
|
||||
RD_CmdKind_SetEntityColor,
|
||||
@@ -106,8 +106,8 @@ RD_CmdKind_SetEntityName,
|
||||
RD_CmdKind_DownloadModuleDebugInfo,
|
||||
RD_CmdKind_Attach,
|
||||
RD_CmdKind_OpenCrashDump,
|
||||
RD_CmdKind_OpenRemoteDebugger,
|
||||
RD_CmdKind_CloseRemoteDebugger,
|
||||
RD_CmdKind_OpenRemoteServer,
|
||||
RD_CmdKind_CloseRemoteServer,
|
||||
RD_CmdKind_Exit,
|
||||
RD_CmdKind_OpenPalette,
|
||||
RD_CmdKind_RunCommand,
|
||||
@@ -115,8 +115,6 @@ RD_CmdKind_RunExternalDriverTextCommand,
|
||||
RD_CmdKind_State,
|
||||
RD_CmdKind_Eval,
|
||||
RD_CmdKind_LineFromVAddr,
|
||||
RD_CmdKind_RemoteControllerConnect,
|
||||
RD_CmdKind_RemoteControllerDisconnect,
|
||||
RD_CmdKind_WMEvent,
|
||||
RD_CmdKind_SelectThread,
|
||||
RD_CmdKind_SelectUnwind,
|
||||
@@ -319,7 +317,7 @@ RD_CmdKind_OpenWatchPins,
|
||||
RD_CmdKind_OpenDebugInfos,
|
||||
RD_CmdKind_OpenThreads,
|
||||
RD_CmdKind_OpenProcesses,
|
||||
RD_CmdKind_OpenMachines,
|
||||
RD_CmdKind_OpenServers,
|
||||
RD_CmdKind_OpenModules,
|
||||
RD_CmdKind_OpenFilePathMaps,
|
||||
RD_CmdKind_OpenTypeViews,
|
||||
@@ -470,7 +468,7 @@ String8 schema;
|
||||
typedef struct RD_Regs RD_Regs;
|
||||
struct RD_Regs
|
||||
{
|
||||
D_Handle machine;
|
||||
D_Handle server;
|
||||
D_Handle module;
|
||||
D_Handle process;
|
||||
D_Handle thread;
|
||||
@@ -561,7 +559,7 @@ X(watch_pins) \
|
||||
X(debug_infos) \
|
||||
X(threads) \
|
||||
X(processes) \
|
||||
X(machines) \
|
||||
X(servers) \
|
||||
X(modules) \
|
||||
X(file_path_maps) \
|
||||
X(type_views) \
|
||||
@@ -575,7 +573,7 @@ Y(geo3d, geo3d, "")\
|
||||
Z(getting_started)\
|
||||
|
||||
#define rd_regs_lit_init_top \
|
||||
.machine = rd_regs()->machine,\
|
||||
.server = rd_regs()->server,\
|
||||
.module = rd_regs()->module,\
|
||||
.process = rd_regs()->process,\
|
||||
.thread = rd_regs()->thread,\
|
||||
@@ -634,7 +632,7 @@ Z(getting_started)\
|
||||
C_LINKAGE_BEGIN
|
||||
extern String8 rd_tab_fast_path_view_name_table[25];
|
||||
extern String8 rd_tab_fast_path_query_name_table[25];
|
||||
extern RD_VocabInfo rd_vocab_info_table[374];
|
||||
extern RD_VocabInfo rd_vocab_info_table[373];
|
||||
extern RD_NameSchemaInfo rd_name_schema_info_table[39];
|
||||
extern String8 rd_reg_slot_code_name_table[56];
|
||||
extern Rng1U64 rd_reg_slot_range_table[56];
|
||||
|
||||
@@ -36,7 +36,7 @@ RD_WatchTabFastPathTable:
|
||||
{DebugInfos "Debug Info" debug_infos 1 Module "Displays, and allows editing of, the list of all debug info files that the debugger has loaded."}
|
||||
{Threads "Threads" threads 1 Threads "Displays the list of all threads in all processes to which the debugger is attached."}
|
||||
{Processes "Processes" processes 1 Scheduler "Displays the list of all processes to which the debugger is attached."}
|
||||
{Machines "Machines" machines 1 Machine "Displays the list of all machines to which the debugger is connected."}
|
||||
{Servers "Servers" servers 1 Machine "Displays the list of all servers to which the debugger is connected."}
|
||||
{Modules "Modules" modules 1 Module "Displays the list of all modules in all processes to which the debugger is attached."}
|
||||
{FilePathMaps "File Path Map" file_path_maps 1 FileOutline "Displays, and allows editing of, the list of all file path maps. This allows remapping source code paths referenced by debug information to other paths on your local machine."}
|
||||
{TypeViews "Type Views" type_views 1 Binoculars "Displays, and allows editing of, the list of all type views, which allow automatically adjusting the visualizations for evaluations of a certain type."}
|
||||
@@ -147,6 +147,7 @@ RD_VocabTable:
|
||||
{process processes "Process" "Processes" Scheduler }
|
||||
{processes "" "Processes" "" Scheduler }
|
||||
{machine _ "Machine" _ Machine }
|
||||
{server _ "Server" _ Machine }
|
||||
{module _ "Module" _ Module }
|
||||
{getting_started "" "Getting Started" "" QuestionMark }
|
||||
{disasm "" "Disassembly" "" Glasses }
|
||||
@@ -878,9 +879,9 @@ RD_VocabTable:
|
||||
```x:{'path':path, 'name':string}```,
|
||||
}
|
||||
|
||||
//- rjf: @schema machine
|
||||
//- rjf: @schema server
|
||||
{
|
||||
machine, 0,
|
||||
server, 0,
|
||||
```x:{'label':code_string, @no_expand 'active':bool, 'unattached_processes':set, 'processes':set}```,
|
||||
}
|
||||
|
||||
@@ -922,7 +923,7 @@ RD_VocabTable:
|
||||
RD_RegTable:
|
||||
{
|
||||
// rjf: ctrl entities
|
||||
{D_Handle machine Machine }
|
||||
{D_Handle server Server }
|
||||
{D_Handle module Module }
|
||||
{D_Handle process Process }
|
||||
{D_Handle thread Thread }
|
||||
@@ -1046,8 +1047,6 @@ RD_CmdTable: // | | | |
|
||||
{State 0 0 1 "" Null 0 0 0 0 0 0 0 Null "state" "State" "" "" "" }
|
||||
{Eval 0 0 1 "" Expr 0 0 0 0 0 0 0 Null "eval" "Eval" "" "" "" }
|
||||
{LineFromVAddr 0 0 1 "" Vaddr 0 0 0 0 0 0 0 Null "line_from_vaddr" "Line From Virtual Address" "" "" "" }
|
||||
{RemoteControllerConnect 0 0 1 "" Null 0 0 0 0 0 0 0 Null "remote_controller_connect" "Remote Controller Connect" "" "" "" }
|
||||
{RemoteControllerDisconnect 0 0 1 "" Null 0 0 0 0 0 0 0 Null "remote_controller_disconnect" "Remote Controller Disconnect" "" "" "" }
|
||||
|
||||
//- rjf: os event passthrough
|
||||
{WMEvent 0 0 0 "" Null 0 0 0 0 0 0 0 Null "wm_event" "OS Event" "" "" "" }
|
||||
|
||||
+30
-30
@@ -2496,7 +2496,7 @@ rd_view_ui(Rng2F32 rect)
|
||||
else if(entity->kind == D_EntityKind_Thread) { rd_regs()->thread = entity->handle; }
|
||||
else if(entity->kind == D_EntityKind_Module) { rd_regs()->module = entity->handle; }
|
||||
else if(entity->kind == D_EntityKind_Process) { rd_regs()->process = entity->handle; }
|
||||
else if(entity->kind == D_EntityKind_Machine) { rd_regs()->machine = entity->handle; }
|
||||
else if(entity->kind == D_EntityKind_Server) { rd_regs()->server = entity->handle; }
|
||||
rd_cmd(RD_CmdKind_CompleteQuery);
|
||||
}
|
||||
}break;
|
||||
@@ -4728,7 +4728,7 @@ rd_view_ui(Rng2F32 rect)
|
||||
RD_RegsScope(.ctrl_entity = cell_info.entity->handle) switch(cell_info.entity->kind)
|
||||
{
|
||||
default:{rd_drag_begin(RD_RegSlot_CtrlEntity);}break;
|
||||
case D_EntityKind_Machine:{RD_RegsScope(.machine = cell_info.entity->handle) rd_drag_begin(RD_RegSlot_Machine);}break;
|
||||
case D_EntityKind_Server:{RD_RegsScope(.server = cell_info.entity->handle) rd_drag_begin(RD_RegSlot_Server);}break;
|
||||
case D_EntityKind_Process:{RD_RegsScope(.process = cell_info.entity->handle) rd_drag_begin(RD_RegSlot_Process);}break;
|
||||
case D_EntityKind_Module:{RD_RegsScope(.module = cell_info.entity->handle) rd_drag_begin(RD_RegSlot_Module);}break;
|
||||
case D_EntityKind_Thread:{RD_RegsScope(.thread = cell_info.entity->handle) rd_drag_begin(RD_RegSlot_Thread);}break;
|
||||
@@ -6141,7 +6141,7 @@ rd_window_frame(void)
|
||||
////////////////////////
|
||||
//- rjf: control entity tooltips
|
||||
//
|
||||
case RD_RegSlot_Machine: {ctrl_entity = d_entity_from_handle(regs->machine); }goto ctrl_entity_tooltip;
|
||||
case RD_RegSlot_Server: {ctrl_entity = d_entity_from_handle(regs->server); }goto ctrl_entity_tooltip;
|
||||
case RD_RegSlot_Process: {ctrl_entity = d_entity_from_handle(regs->process); }goto ctrl_entity_tooltip;
|
||||
case RD_RegSlot_Module: {ctrl_entity = d_entity_from_handle(regs->module); }goto ctrl_entity_tooltip;
|
||||
case RD_RegSlot_Thread: {ctrl_entity = d_entity_from_handle(regs->thread); }goto ctrl_entity_tooltip;
|
||||
@@ -6368,7 +6368,7 @@ rd_window_frame(void)
|
||||
ID(view);
|
||||
#undef ID
|
||||
#define Handle(name) ui_labelf("%s: [0x%x, 0x%x, 0x%I64x]", #name, (regs->name).demon_id, (regs->name).controller_kind, (regs->name).entity_id)
|
||||
Handle(machine);
|
||||
Handle(server);
|
||||
Handle(process);
|
||||
Handle(module);
|
||||
Handle(thread);
|
||||
@@ -11078,7 +11078,7 @@ rd_regs_fill_slot_from_string(RD_RegSlot slot, String8 query_expr, String8 strin
|
||||
}break;
|
||||
|
||||
//- rjf: ctrl entities
|
||||
case RD_RegSlot_Machine:
|
||||
case RD_RegSlot_Server:
|
||||
case RD_RegSlot_Module:
|
||||
case RD_RegSlot_Process:
|
||||
case RD_RegSlot_Thread:
|
||||
@@ -12840,7 +12840,7 @@ rd_frame(void)
|
||||
//- rjf: add macros for evallable control entities
|
||||
String8 evallable_ctrl_names[] =
|
||||
{
|
||||
str8_lit("machine"),
|
||||
str8_lit("server"),
|
||||
str8_lit("process"),
|
||||
str8_lit("thread"),
|
||||
str8_lit("module"),
|
||||
@@ -12863,9 +12863,9 @@ rd_frame(void)
|
||||
{
|
||||
e_string2expr_map_insert(scratch.arena, macro_map, entity->string, expr);
|
||||
}
|
||||
if(kind == D_EntityKind_Machine && entity->handle.demon_id == D_DemonID_LocalHost)
|
||||
if(kind == D_EntityKind_Server && entity->handle.demon_id == D_DemonID_LocalHost)
|
||||
{
|
||||
e_string2expr_map_insert(scratch.arena, macro_map, str8_lit("local_machine"), expr);
|
||||
e_string2expr_map_insert(scratch.arena, macro_map, str8_lit("local_server"), expr);
|
||||
}
|
||||
if(kind == D_EntityKind_Thread && d_handle_match(rd_base_regs()->thread, entity->handle))
|
||||
{
|
||||
@@ -13623,7 +13623,7 @@ rd_frame(void)
|
||||
if(D_CmdKind_Null < (D_CmdKind)kind && (D_CmdKind)kind < D_CmdKind_COUNT)
|
||||
{
|
||||
D_CmdParams params = {0};
|
||||
params.machine = rd_regs()->machine;
|
||||
params.server = rd_regs()->server;
|
||||
params.process = rd_regs()->process;
|
||||
params.thread = rd_regs()->thread;
|
||||
params.entity = rd_regs()->ctrl_entity;
|
||||
@@ -13687,7 +13687,7 @@ rd_frame(void)
|
||||
str8_list_pushf(scratch.arena, &exprs, "query:targets");
|
||||
str8_list_pushf(scratch.arena, &exprs, "query:breakpoints");
|
||||
str8_list_pushf(scratch.arena, &exprs, "query:recent_projects");
|
||||
str8_list_pushf(scratch.arena, &exprs, "query:machines");
|
||||
str8_list_pushf(scratch.arena, &exprs, "query:servers");
|
||||
str8_list_pushf(scratch.arena, &exprs, "query:processes");
|
||||
str8_list_pushf(scratch.arena, &exprs, "query:threads");
|
||||
str8_list_pushf(scratch.arena, &exprs, "query:modules");
|
||||
@@ -13975,24 +13975,6 @@ rd_frame(void)
|
||||
}
|
||||
str8_list_pushf(rd_state->cmd_output_arena, &rd_state->cmd_outputs, "}\n");
|
||||
}break;
|
||||
case RD_CmdKind_RemoteControllerConnect:
|
||||
{
|
||||
CFG_Node *transient = cfg_node_child_from_string(cfg_node_root(), s("transient"));
|
||||
CFG_Node *ctrlr = cfg_node_new(rd_state->cfg, transient, s("remote_controller"));
|
||||
cfg_node_new(rd_state->cfg, ctrlr, sock_string_from_endpoint(scratch.arena, rd_state->ipc_sock_endpoint));
|
||||
}break;
|
||||
case RD_CmdKind_RemoteControllerDisconnect:
|
||||
{
|
||||
CFG_Node *transient = cfg_node_child_from_string(cfg_node_root(), s("transient"));
|
||||
for(CFG_Node *child = transient; child != &cfg_nil_node; child = child->next)
|
||||
{
|
||||
if(str8_match(child->string, s("remote_controller"), 0) && str8_match(child->first->string, rd_regs()->string, 0))
|
||||
{
|
||||
cfg_node_release(rd_state->cfg, child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}break;
|
||||
|
||||
//- rjf: exiting
|
||||
case RD_CmdKind_Exit:
|
||||
@@ -17366,13 +17348,13 @@ rd_frame(void)
|
||||
D_Entity *thread = d_entity_from_handle(rd_regs()->thread);
|
||||
D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process);
|
||||
D_Entity *module = d_module_from_process_vaddr(process, d_cached_ip_from_thread(thread->handle));
|
||||
D_Entity *machine = d_entity_ancestor_from_kind(process, D_EntityKind_Machine);
|
||||
D_Entity *server = d_entity_ancestor_from_kind(process, D_EntityKind_Server);
|
||||
rd_state->base_regs.v.unwind_count = 0;
|
||||
rd_state->base_regs.v.inline_depth = 0;
|
||||
rd_state->base_regs.v.thread = thread->handle;
|
||||
rd_state->base_regs.v.module = module->handle;
|
||||
rd_state->base_regs.v.process = process->handle;
|
||||
rd_state->base_regs.v.machine = machine->handle;
|
||||
rd_state->base_regs.v.server = server->handle;
|
||||
rd_cmd(RD_CmdKind_FindThread, .thread = thread->handle, .unwind_count = 0, .inline_depth = 0);
|
||||
}break;
|
||||
case RD_CmdKind_SelectUnwind:
|
||||
@@ -18382,6 +18364,24 @@ rd_frame(void)
|
||||
MTX_Op op = {r1u64(max_U64, max_U64), evt->string};
|
||||
mtx_push_op(key, op);
|
||||
}break;
|
||||
case D_EventKind_RemoteControllerConnect:
|
||||
{
|
||||
CFG_Node *transient = cfg_node_child_from_string(cfg_node_root(), s("transient"));
|
||||
CFG_Node *ctrlr = cfg_node_new(rd_state->cfg, transient, s("remote_controller"));
|
||||
cfg_node_new(rd_state->cfg, ctrlr, sock_string_from_endpoint(scratch.arena, rd_state->ipc_sock_endpoint));
|
||||
}break;
|
||||
case D_EventKind_RemoteControllerDisconnect:
|
||||
{
|
||||
CFG_Node *transient = cfg_node_child_from_string(cfg_node_root(), s("transient"));
|
||||
for(CFG_Node *child = transient; child != &cfg_nil_node; child = child->next)
|
||||
{
|
||||
if(str8_match(child->string, s("remote_controller"), 0) && str8_match(child->first->string, rd_regs()->string, 0))
|
||||
{
|
||||
cfg_node_release(rd_state->cfg, child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1705,14 +1705,14 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(unattached_processes)
|
||||
|
||||
//- rjf: gather all machines we're searching through
|
||||
D_EntityArray machines = {0};
|
||||
if(lhs_entity->kind == D_EntityKind_Machine)
|
||||
if(lhs_entity->kind == D_EntityKind_Server)
|
||||
{
|
||||
machines.v = &lhs_entity;
|
||||
machines.count = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
machines = d_entity_array_from_kind(D_EntityKind_Machine);
|
||||
machines = d_entity_array_from_kind(D_EntityKind_Server);
|
||||
}
|
||||
|
||||
//- rjf: gather system processes from this machine
|
||||
|
||||
@@ -1607,7 +1607,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval,
|
||||
.flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Indented|RD_WatchCellFlag_Button,
|
||||
.pct = 1.f);
|
||||
if(entity->kind == D_EntityKind_Machine ||
|
||||
if(entity->kind == D_EntityKind_Server ||
|
||||
entity->kind == D_EntityKind_Process ||
|
||||
entity->kind == D_EntityKind_Thread)
|
||||
{
|
||||
|
||||
@@ -476,7 +476,7 @@ rd_title_fstrs_from_ctrl_entity(Arena *arena, D_Entity *entity, B32 include_extr
|
||||
switch(entity->kind)
|
||||
{
|
||||
default:{}break;
|
||||
case D_EntityKind_Machine: {icon_kind = RD_IconKind_Machine;}break;
|
||||
case D_EntityKind_Server: {icon_kind = RD_IconKind_Machine;}break;
|
||||
case D_EntityKind_Process: {icon_kind = RD_IconKind_Threads;}break;
|
||||
case D_EntityKind_Thread: {icon_kind = RD_IconKind_Thread; name_is_code = 1;}break;
|
||||
case D_EntityKind_Module: {icon_kind = RD_IconKind_Module;}break;
|
||||
@@ -493,7 +493,7 @@ rd_title_fstrs_from_ctrl_entity(Arena *arena, D_Entity *entity, B32 include_extr
|
||||
}
|
||||
|
||||
//- rjf: push frozen icon, if frozen
|
||||
if((entity->kind == D_EntityKind_Machine ||
|
||||
if((entity->kind == D_EntityKind_Server ||
|
||||
entity->kind == D_EntityKind_Process ||
|
||||
entity->kind == D_EntityKind_Thread) &&
|
||||
d_entity_tree_is_frozen(entity))
|
||||
|
||||
@@ -43,17 +43,50 @@
|
||||
////////////////////////////////
|
||||
//~ rjf: Globals
|
||||
|
||||
typedef struct RDS_Msg RDS_Msg;
|
||||
struct RDS_Msg
|
||||
{
|
||||
RDS_Msg *next;
|
||||
SOCK_Endpoint endpoint;
|
||||
String8 msg_raw;
|
||||
};
|
||||
|
||||
typedef struct RDS_Client RDS_Client;
|
||||
struct RDS_Client
|
||||
{
|
||||
RDS_Client *order_next;
|
||||
RDS_Client *order_prev;
|
||||
RDS_Client *hash_next;
|
||||
RDS_Client *hash_prev;
|
||||
SOCK_Endpoint endpoint;
|
||||
};
|
||||
|
||||
typedef struct RDS_ClientSlot RDS_ClientSlot;
|
||||
struct RDS_ClientSlot
|
||||
{
|
||||
RDS_Client *first;
|
||||
RDS_Client *last;
|
||||
};
|
||||
|
||||
typedef struct RDS_State RDS_State;
|
||||
struct RDS_State
|
||||
{
|
||||
Arena *arena;
|
||||
SOCK_Session sock_session;
|
||||
|
||||
//- rjf: connected clients
|
||||
RDS_ClientSlot *client_slots;
|
||||
U64 client_slots_count;
|
||||
RDS_Client *first_client;
|
||||
RDS_Client *last_client;
|
||||
RDS_Client *free_client;
|
||||
|
||||
//- rjf: client -> demon messages
|
||||
RWMutex c2d_rw_mutex;
|
||||
CondVar c2d_cv;
|
||||
Arena *c2d_arena;
|
||||
String8List c2d_msgs;
|
||||
RDS_Msg *c2d_msg_first;
|
||||
RDS_Msg *c2d_msg_last;
|
||||
|
||||
//- rjf: demon run state
|
||||
B32 demon_is_running;
|
||||
@@ -76,14 +109,21 @@ dmn_thread__entry_point(void *p)
|
||||
////////////////////////////
|
||||
//- rjf: get next messages
|
||||
//
|
||||
String8List msgs = {0};
|
||||
RDS_Msg *msg_first = 0;
|
||||
RDS_Msg *msg_last = 0;
|
||||
RWMutexScope(rds_state->c2d_rw_mutex, 1) for(;;)
|
||||
{
|
||||
if(rds_state->c2d_msgs.node_count != 0)
|
||||
if(rds_state->c2d_msg_first != 0)
|
||||
{
|
||||
msgs = str8_list_copy(scratch.arena, &rds_state->c2d_msgs);
|
||||
MemoryZeroStruct(&rds_state->c2d_msgs);
|
||||
for EachNode(src, RDS_Msg, rds_state->c2d_msg_first)
|
||||
{
|
||||
RDS_Msg *dst = push_array(scratch.arena, RDS_Msg, 1);
|
||||
SLLQueuePush(msg_first, msg_last, dst);
|
||||
dst->endpoint = src->endpoint;
|
||||
dst->msg_raw = str8_copy(scratch.arena, src->msg_raw);
|
||||
}
|
||||
arena_clear(rds_state->c2d_arena);
|
||||
rds_state->c2d_msg_first = rds_state->c2d_msg_last = 0;
|
||||
break;
|
||||
}
|
||||
cond_var_wait_rw_w(rds_state->c2d_cv, rds_state->c2d_rw_mutex, max_U64);
|
||||
@@ -92,13 +132,14 @@ dmn_thread__entry_point(void *p)
|
||||
////////////////////////////
|
||||
//- rjf: do messages, push responses
|
||||
//
|
||||
for(String8Node *msg_n = msgs.first; msg_n != 0; msg_n = msg_n->next)
|
||||
for(RDS_Msg *msg_n = msg_first; msg_n != 0; msg_n = msg_n->next)
|
||||
{
|
||||
//- rjf: unpack message
|
||||
DS_Msg msg = ds_msg_from_serialized(scratch.arena, msg_n->string);
|
||||
DS_Msg msg = ds_msg_from_serialized(scratch.arena, msg_n->msg_raw);
|
||||
|
||||
//- rjf: do action, get response
|
||||
DS_Response response = {0};
|
||||
DMN_EventList events = {0};
|
||||
switch(msg.kind)
|
||||
{
|
||||
default:{}break;
|
||||
@@ -150,12 +191,26 @@ dmn_thread__entry_point(void *p)
|
||||
ctrls.run_entities_are_unfrozen = !!(msg.flags & DS_MsgFlag_RunEntitiesAreUnfrozen);
|
||||
ctrls.run_entities_are_processes = !!(msg.flags & DS_MsgFlag_RunEntitiesAreProcesses);
|
||||
};
|
||||
response.events = dmn_ctrl_run(scratch.arena, ctrl_ctx, &ctrls);
|
||||
response.good = 1;
|
||||
events = dmn_ctrl_run(scratch.arena, ctrl_ctx, &ctrls);
|
||||
}break;
|
||||
}
|
||||
|
||||
//- rjf: pack response & push
|
||||
String8 data = ds_serialized_from_response(scratch.arena, &response);
|
||||
//- rjf: pack response & send back to the originating endpoint of the message
|
||||
{
|
||||
String8 data = ds_serialized_from_response(scratch.arena, &response);
|
||||
sock_send(rds_state->sock_session, SOCK_Protocol_TCP, msg_n->endpoint, data, max_U64);
|
||||
}
|
||||
|
||||
//- rjf: pack events & send to all connected client
|
||||
if(events.count != 0)
|
||||
{
|
||||
String8 data = ds_serialized_from_dmn_events(scratch.arena, events);
|
||||
for(RDS_Client *c = rds_state->first_client; c != 0; c = c->order_next)
|
||||
{
|
||||
sock_send(rds_state->sock_session, SOCK_Protocol_TCP, c->endpoint, data, max_U64);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scratch_end(scratch);
|
||||
@@ -203,16 +258,50 @@ entry_point(CmdLine *cmd_line)
|
||||
String8 data = {0};
|
||||
sock_recv(scratch.arena, rds_state->sock_session, &protocol, &endpoint, &data, max_U64);
|
||||
|
||||
//- rjf: parse magic prefix
|
||||
U16 magic_maybe = 0;
|
||||
str8_deserial_read_struct(data, 0, &magic_maybe);
|
||||
//- rjf: store this client, if we don't have it
|
||||
{
|
||||
U64 hash = u64_hash_from_str8(str8_struct(&endpoint));
|
||||
U64 slot_idx = hash%rds_state->client_slots_count;
|
||||
RDS_Client *client = 0;
|
||||
for(RDS_Client *c = rds_state->client_slots[slot_idx].first; c != 0; c = c->hash_next)
|
||||
{
|
||||
if(MemoryMatchStruct(&c->endpoint, &endpoint))
|
||||
{
|
||||
client = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(client == 0)
|
||||
{
|
||||
client = rds_state->free_client;
|
||||
if(client != 0)
|
||||
{
|
||||
SLLStackPop_N(rds_state->free_client, order_next);
|
||||
}
|
||||
else
|
||||
{
|
||||
client = push_array(rds_state->arena, RDS_Client, 1);
|
||||
}
|
||||
DLLPushBack_NP(rds_state->client_slots[slot_idx].first, rds_state->client_slots[slot_idx].last, client, hash_next, hash_prev);
|
||||
DLLPushBack_NP(rds_state->first_client, rds_state->last_client, client, order_next, order_prev);
|
||||
client->endpoint = endpoint;
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: get packet header
|
||||
DS_PacketHeader header = {0};
|
||||
if(data.size >= sizeof(header))
|
||||
{
|
||||
MemoryCopy(&header, data.str, sizeof(header));
|
||||
}
|
||||
B32 header_is_good = (header.magic == DS_PACKET_MAGIC && header.kind == DS_PacketKind_Msg && header.version == DS_PACKET_VERSION);
|
||||
|
||||
//- rjf: log message info
|
||||
{
|
||||
String8 endpoint_string = sock_string_from_endpoint(scratch.arena, endpoint);
|
||||
fprintf(stderr, "[got message]\n");
|
||||
fprintf(stderr, " sender: %.*s\n", str8_varg(endpoint_string));
|
||||
fprintf(stderr, " magic: 0x%x\n", (int)magic_maybe);
|
||||
fprintf(stderr, " magic: 0x%x\n", (int)header.magic);
|
||||
}
|
||||
|
||||
//- rjf: try to handle this message on the main thread, before sending to
|
||||
@@ -222,12 +311,14 @@ entry_point(CmdLine *cmd_line)
|
||||
// memory/registers, listing processes, and halting, we want to just do
|
||||
// on the main thread without interrupting the demon at all.
|
||||
DS_MsgKind peek_kind = DS_MsgKind_Null;
|
||||
if(magic_maybe == DS_MSG_MAGIC)
|
||||
if(header_is_good)
|
||||
{
|
||||
str8_deserial_read_struct(data, 2, &peek_kind);
|
||||
String8 msg_raw = str8_skip(data, sizeof(header));
|
||||
str8_deserial_read_struct(msg_raw, 2, &peek_kind);
|
||||
if(peek_kind < DS_MsgKind_Launch || DS_MsgKind_SingleStep < peek_kind)
|
||||
{
|
||||
DS_Msg msg = ds_msg_from_serialized(scratch.arena, data);
|
||||
DS_Response response = {0};
|
||||
switch(msg.kind)
|
||||
{
|
||||
default:{}break;
|
||||
@@ -240,11 +331,14 @@ entry_point(CmdLine *cmd_line)
|
||||
}
|
||||
|
||||
//- rjf: not handled by main thread? -> okay, send to demon thread, if it's ready.
|
||||
if(magic_maybe == DS_MSG_MAGIC && !rds_state->demon_is_running && (DS_MsgKind_Launch <= peek_kind && peek_kind <= DS_MsgKind_SingleStep))
|
||||
if(header_is_good && (DS_MsgKind_Launch <= peek_kind && peek_kind <= DS_MsgKind_SingleStep))
|
||||
{
|
||||
RWMutexScope(rds_state->c2d_rw_mutex, 1)
|
||||
{
|
||||
str8_list_push(rds_state->c2d_arena, &rds_state->c2d_msgs, data);
|
||||
String8 msg_raw = str8_skip(data, sizeof(header));
|
||||
RDS_Msg *msg = push_array(rds_state->c2d_arena, RDS_Msg, 1);
|
||||
msg->endpoint = endpoint;
|
||||
msg->msg_raw = str8_copy(rds_state->c2d_arena, msg_raw);
|
||||
}
|
||||
cond_var_broadcast(rds_state->c2d_cv);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user