drop WITH_DEBUGGER, debugger is always built and embedded

This commit is contained in:
Gwenhael Le Moine 2023-09-06 17:03:14 +02:00
parent 5412d63b72
commit 5205e2c6d9
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
8 changed files with 12 additions and 59 deletions

View file

@ -3,9 +3,6 @@
# possible values: x11, sdl1
GUI ?= x11
# possible values: yes, no
WITH_DEBUGGER ?= yes
VERSION_MAJOR = 0
VERSION_MINOR = 12
PATCHLEVEL = 1
@ -46,13 +43,13 @@ DOTOS = src/main.o \
src/x48_resources.o \
src/x48.o
ifeq ($(WITH_DEBUGGER), yes)
DOTOS += src/debugger.o \
src/debugger_disasm.o \
src/debugger_rpl.o
CFLAGS += $(shell pkg-config --cflags readline) -DWITH_DEBUGGER=1
LIBS += $(shell pkg-config --libs readline)
endif
### debugger
DOTOS += src/debugger.o \
src/debugger_disasm.o \
src/debugger_rpl.o
CFLAGS += $(shell pkg-config --cflags readline)
LIBS += $(shell pkg-config --libs readline)
### /debugger
.PHONY: all clean clean-all pretty-code install

View file

@ -20,6 +20,8 @@ See https://github.com/gwenhael-le-moine/x48ng/issues
## What more I would like to do:
1. clean-up further.
- drop use of the `verbose` variable
- use seperate files for x11 and sdl1 specific code
2. split the core emulator in a lib and have the GUI use that to cleanly separate the two.
3. have a more modern GUI in gtk4
4. can something be merged from droid48? [ https://github.com/shagr4th/droid48 ]
@ -35,11 +37,6 @@ To build the X11 version run `make GUI=x11`
To build the SDL1 version run `make GUI=sdl1`
### Debugger
Debugger is not built by default.
To build the debugger compile with `make WITH_DEBUGGER=yes`
## Installation
1. Run `sudo make install PREFIX=/usr DOCDIR=/usr/doc/x48ng MANDIR=/usr/man DESTDIR=/tmp/package` filling in your own values for PREFIX, DOCDIR, MANDIR and DESTDIR.

View file

@ -6,9 +6,7 @@
#include "timer.h"
#include "x48.h"
#if defined( WITH_DEBUGGER )
#include "debugger.h" /* enter_debugger, TRAP_INSTRUCTION, ILLEGAL_INSTRUCTION */
#endif
extern int throttle;
@ -2198,9 +2196,7 @@ inline int step_instruction( void ) {
op3 = read_nibbles( saturn.PC + 4, 1 );
saturn.PC += 5;
if ( op3 != 0 ) {
#if defined( WITH_DEBUGGER )
enter_debugger |= TRAP_INSTRUCTION;
#endif
return 1;
}
} else {
@ -2224,10 +2220,8 @@ inline int step_instruction( void ) {
}
instructions++;
#if defined( WITH_DEBUGGER )
if ( stop )
enter_debugger |= ILLEGAL_INSTRUCTION;
#endif
return stop;
}
@ -2438,10 +2432,6 @@ void emulate( void ) {
if ( schedule_event-- <= 0 )
schedule();
} while (
#if defined( WITH_DEBUGGER )
!enter_debugger
#else
1
#endif
);
}

View file

@ -8,9 +8,7 @@
#include "timer.h"
#include "x48.h"
#if defined( WITH_DEBUGGER )
#include "debugger.h" /* in_debugger, enter_debugger */
#endif
static int interrupt_called = 0;
extern long nibble_masks[ 16 ];
@ -275,11 +273,9 @@ void do_shutdown( void ) {
saturn.int_pending = 0;
}
#if defined( WITH_DEBUGGER )
if ( in_debugger )
wake = 1;
else
#endif
wake = 0;
alarms = 0;
@ -340,10 +336,8 @@ void do_shutdown( void ) {
alarms++;
}
#if defined( WITH_DEBUGGER )
if ( enter_debugger )
wake = 1;
#endif
} while ( wake == 0 );
stop_timer( IDLE_TIMER );

View file

@ -13,9 +13,7 @@
#include "x48.h"
#include "x48_resources.h"
#if defined( WITH_DEBUGGER )
#include "debugger.h" /* enter_debugger, USER_INTERRUPT, exec_flags, emulate_debug, debug */
#endif
#if defined( GUI_IS_X11 )
char* progname;
@ -26,11 +24,9 @@ char** saved_argv;
void signal_handler( int sig ) {
switch ( sig ) {
#if defined( WITH_DEBUGGER )
case SIGINT: /* Ctrl-C */
enter_debugger |= USER_INTERRUPT;
break;
#endif
case SIGALRM:
got_alarm = 1;
break;
@ -112,7 +108,6 @@ int main( int argc, char** argv ) {
#endif
sigaction( SIGALRM, &sa, ( struct sigaction* )0 );
#if defined( WITH_DEBUGGER )
sigemptyset( &set );
sigaddset( &set, SIGINT );
sa.sa_handler = signal_handler;
@ -121,7 +116,6 @@ int main( int argc, char** argv ) {
sa.sa_flags = SA_RESTART;
#endif
sigaction( SIGINT, &sa, ( struct sigaction* )0 );
#endif
sigemptyset( &set );
sigaddset( &set, SIGPIPE );
@ -156,16 +150,12 @@ int main( int argc, char** argv ) {
/* Start emulation loop */
/************************/
do {
#if defined( WITH_DEBUGGER )
if ( !exec_flags )
#endif
emulate();
#if defined( WITH_DEBUGGER )
else
emulate_debug();
debug();
#endif
} while ( 1 );
return 0;

View file

@ -317,11 +317,7 @@ t1_t2_ticks get_t1_t2( void ) {
access_time -= stop;
#if defined( WITH_DEBUGGER )
if ( adj_time_pending || in_debugger ) {
#else
if ( adj_time_pending ) {
#endif
/*
* We have been inside an interrupt for very long, maybe
* or we are sleeping in the debugger.

View file

@ -6389,14 +6389,12 @@ int get_ui_event( void ) {
}
}
}
#if defined( WITH_DEBUGGER )
else if ( xev.xbutton.button == Button3 ) {
/* TODO Make cut from the screen work. */
get_stack();
} else {
/* printf("In display %d\n", xev.xbutton.button); */
}
#endif
} /* else {
printf("In display %d\n", xev.xbutton.button);
} */
} else {
if ( xev.xbutton.button == Button1 ||
xev.xbutton.button == Button2 ||

View file

@ -7,12 +7,7 @@
#include "x48_errors.h"
#include "x48_resources.h"
#if defined( WITH_DEBUGGER )
#include "debugger.h" /* `disassembler_mode` & `CLASS_MNEMONICS` */
#else
#define HP_MNEMONICS 0
#define CLASS_MNEMONICS 1
#endif
int verbose;
int useTerminal;
@ -369,10 +364,8 @@ void get_resources( void ) {
useSerial = 0;
initialize = 0;
resetOnStartup = 0;
#if defined( WITH_DEBUGGER )
useDebugger = 1;
disassembler_mode = CLASS_MNEMONICS; // HP_MNEMONICS
#endif
netbook = 0;
throttle = 0;
@ -398,11 +391,9 @@ void get_resources( void ) {
romFileName = get_string_resource( "romFileName", "RomFileName" );
homeDirectory = get_string_resource( "homeDirectory", "HomeDirectory" );
#if defined( WITH_DEBUGGER )
useDebugger = get_boolean_resource( "useDebugger", "UseDebugger" );
disassembler_mode = get_mnemonic_resource( "disassemblerMnemonics",
"DisassemblerMnemonics" );
#endif
netbook = get_boolean_resource( "netbook", "Netbook" );