[qwaq] Hook up the debugger modules

Now to write all the high level stuff. Wheeeee
This commit is contained in:
Bill Currie 2020-03-24 20:15:35 +09:00
parent 12f7b52fff
commit 32d77eabac
2 changed files with 28 additions and 9 deletions

View file

@ -53,6 +53,7 @@
#include "QF/zone.h" #include "QF/zone.h"
#include "qwaq.h" #include "qwaq.h"
#include "qwaq-debug.h"
#define MAX_EDICTS 1024 #define MAX_EDICTS 1024
@ -141,8 +142,10 @@ init_qf (void)
} }
typedef void (*progsinit_f) (progs_t *pr);
static progs_t * static progs_t *
create_progs (void) create_progs (progsinit_f *funcs)
{ {
progs_t *pr = calloc (1, sizeof (*pr)); progs_t *pr = calloc (1, sizeof (*pr));
@ -154,10 +157,9 @@ create_progs (void)
PR_Init_Cvars (); PR_Init_Cvars ();
PR_Init (pr); PR_Init (pr);
RUA_Init (pr, 0); RUA_Init (pr, 0);
Key_Progs_Init (pr); // FIXME not all threads while (*funcs) {
PR_Cmds_Init (pr); // FIXME not all threads (*funcs++) (pr);
BI_Init (pr); // FIXME not all threads }
QWAQ_EditBuffer_Init (pr); // FIXME not all threads
return pr; return pr;
} }
@ -183,7 +185,7 @@ load_progs (progs_t *pr, const char *name)
} }
static void static void
spawn_progs (qwaq_thread_t *thread) spawn_progs (qwaq_thread_t *thread, progsinit_f *funcs)
{ {
dfunction_t *dfunc; dfunction_t *dfunc;
const char *name = 0; const char *name = 0;
@ -192,7 +194,7 @@ spawn_progs (qwaq_thread_t *thread)
progs_t *pr; progs_t *pr;
thread->main_func = 0; thread->main_func = 0;
pr = thread->pr = create_progs (); pr = thread->pr = create_progs (funcs);
if (thread->args.size) { if (thread->args.size) {
name = thread->args.a[0]; name = thread->args.a[0];
} }
@ -321,6 +323,20 @@ done:
return qargs_ind; return qargs_ind;
} }
static progsinit_f main_app[] = {
Key_Progs_Init,
PR_Cmds_Init,
BI_Init,
QWAQ_EditBuffer_Init,
QWAQ_Debug_Init,
0
};
static progsinit_f target_app[] = {
QWAQ_DebugTarget_Init,
0
};
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
@ -378,6 +394,8 @@ main (int argc, char **argv)
for (size_t i = 1, thread_ind = 0; i < thread_data.size; i++) { for (size_t i = 1, thread_ind = 0; i < thread_data.size; i++) {
qwaq_thread_t *thread = thread_data.a[i]; qwaq_thread_t *thread = thread_data.a[i];
progsinit_f *app_funcs = target_app;
if (thread->args.size && thread->args.a[0] if (thread->args.size && thread->args.a[0]
&& strcmp (thread->args.a[0], "--qargs")) { && strcmp (thread->args.a[0], "--qargs")) {
// skip the args set that's passed to qargs // skip the args set that's passed to qargs
@ -391,8 +409,9 @@ main (int argc, char **argv)
} }
if (main_ind < 0) { if (main_ind < 0) {
main_ind = i; main_ind = i;
app_funcs = main_app;
} }
spawn_progs (thread); spawn_progs (thread, app_funcs);
} }
if (main_ind >= 0) { if (main_ind >= 0) {
// threads might start new threads before the end is reached // threads might start new threads before the end is reached

View file

@ -3,7 +3,7 @@
#include "event.h" #include "event.h"
enum { typedef enum {
qe_debug_event = 0x0100, qe_debug_event = 0x0100,
} qwaq_debug_messages; } qwaq_debug_messages;