Do not compile debugger codes by default
authornegativeExponent <negativeExponent@users.noreply.github.com>
Wed, 7 Jul 2021 00:49:59 +0000 (08:49 +0800)
committernegativeExponent <negativeExponent@users.noreply.github.com>
Wed, 7 Jul 2021 01:13:30 +0000 (09:13 +0800)
- Reduces binary to about half the size
- Compile with DEBUG=1 to build core with debug code

Makefile
libpcsxcore/psxinterpreter.c
libpcsxcore/psxmem.c

index 3d71826..a01c4df 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -45,13 +45,18 @@ CFLAGS += -DPCNT
 endif
 
 # core
-OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \
-       libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/mdec.o \
+OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o \
+       libpcsxcore/decode_xa.o libpcsxcore/mdec.o \
        libpcsxcore/misc.o libpcsxcore/plugins.o libpcsxcore/ppf.o libpcsxcore/psxbios.o \
        libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o libpcsxcore/psxhle.o \
        libpcsxcore/psxhw.o libpcsxcore/psxinterpreter.o libpcsxcore/psxmem.o libpcsxcore/r3000a.o \
-       libpcsxcore/sio.o libpcsxcore/socket.o libpcsxcore/spu.o
+       libpcsxcore/sio.o libpcsxcore/spu.o
 OBJS += libpcsxcore/gte.o libpcsxcore/gte_nf.o libpcsxcore/gte_divider.o
+
+ifeq ($(DEBUG), 1)
+OBJS += libpcsxcore/debug.o    libpcsxcore/socket.o libpcsxcore/disr3000a.o
+endif
+
 ifeq ($(WANT_ZLIB),1)
 CFLAGS += -Ideps/libchdr/deps/zlib-1.2.11
 OBJS += deps/libchdr/deps/zlib-1.2.11/adler32.o \
index cf3de79..d3e42e9 100644 (file)
@@ -39,6 +39,12 @@ static u32 branchPC;
 #define debugI()
 #endif
 
+#ifdef NDEBUG
+void StartDebugger() {}
+void ProcessDebug() {}
+void StopDebugger() {}
+#endif
+
 void execI();
 
 // Subsets
index 70de76b..1825cfe 100644 (file)
 #define MAP_ANONYMOUS MAP_ANON
 #endif
 
+#ifdef NDEBUG
+void DebugCheckBP(u32 address, enum breakpoint_types type) {}
+#endif
+
 void *(*psxMapHook)(unsigned long addr, size_t size, int is_fixed,
                enum psxMapTag tag);
 void (*psxUnmapHook)(void *ptr, size_t size, enum psxMapTag tag);