mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-10-12 17:28:14 +03:00
So far only basic debugging functionality is implemented (breakpoints, stepping, stack traces/variables). This is not tested against an established DAP client. My intention is to create a custom GUI frontend and extend the protocol to support xsystem4-specific features, such as inspecting the scene. (This work is underway.) Instruction references are hex-encoded address strings. Clients do not need to obtain them from DAP requests. This is outside the spec, but it is needed for a binary-only debugger. Functions that write directly to stdout (e.g. printf) should generally not be used any more. Instead, use either sys_message (which respects sys_silent) or log_message (which will send the message to the debugger if DAP is enabled). stderr can be used as normal.
57 lines
1.9 KiB
C
57 lines
1.9 KiB
C
/* Copyright (C) 2019 Nunuhara Cabbage <nunuhara@haniwa.technology>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, see <http://gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "system4.h"
|
|
#include "system4/string.h"
|
|
#include "system4/utfsjis.h"
|
|
|
|
#include "hll.h"
|
|
#include "xsystem4.h"
|
|
|
|
static struct string **logs = NULL;
|
|
static int nr_logs = 0;
|
|
|
|
int OutputLog_Create(struct string *name)
|
|
{
|
|
logs = xrealloc_array(logs, nr_logs, nr_logs + 1, sizeof(struct string*));
|
|
logs[nr_logs++] = string_dup(name);
|
|
return nr_logs - 1;
|
|
}
|
|
|
|
static void OutputLog_Output(int handle, struct string *s)
|
|
{
|
|
if (handle < 0 || handle >= nr_logs) {
|
|
log_message("OutputLog", "%s", display_sjis0(s->text));
|
|
} else {
|
|
log_message(display_sjis0(logs[handle]->text), "%s", display_sjis1(s->text));
|
|
}
|
|
}
|
|
|
|
HLL_WARN_UNIMPLEMENTED( , void, OutputLog, Clear, int handle);
|
|
HLL_WARN_UNIMPLEMENTED(0, int, OutputLog, Save, int handle, struct string *filename);
|
|
HLL_WARN_UNIMPLEMENTED(0, bool, OutputLog, EnableAutoSave, int handle, struct string *filename);
|
|
HLL_WARN_UNIMPLEMENTED(0, bool, OutputLog, DisableAutoSave, int handle);
|
|
|
|
HLL_LIBRARY(OutputLog,
|
|
HLL_EXPORT(Create, OutputLog_Create),
|
|
HLL_EXPORT(Output, OutputLog_Output),
|
|
HLL_EXPORT(Clear, OutputLog_Clear),
|
|
HLL_EXPORT(Save, OutputLog_Save),
|
|
HLL_EXPORT(EnableAutoSave, OutputLog_EnableAutoSave),
|
|
HLL_EXPORT(DisableAutoSave, OutputLog_DisableAutoSave));
|