From 11a430341d5a70a26ba670a8a78e85402ca119a6 Mon Sep 17 00:00:00 2001 From: negativeExponent Date: Wed, 7 Jul 2021 08:49:59 +0800 Subject: [PATCH] Do not compile debugger codes by default - Reduces binary to about half the size - Compile with DEBUG=1 to build core with debug code --- Makefile | 11 ++++++++--- libpcsxcore/psxinterpreter.c | 6 ++++++ libpcsxcore/psxmem.c | 4 ++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3d718268..a01c4df3 100644 --- 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 \ diff --git a/libpcsxcore/psxinterpreter.c b/libpcsxcore/psxinterpreter.c index cf3de798..d3e42e9f 100644 --- a/libpcsxcore/psxinterpreter.c +++ b/libpcsxcore/psxinterpreter.c @@ -39,6 +39,12 @@ static u32 branchPC; #define debugI() #endif +#ifdef NDEBUG +void StartDebugger() {} +void ProcessDebug() {} +void StopDebugger() {} +#endif + void execI(); // Subsets diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c index 70de76b7..1825cfe4 100644 --- a/libpcsxcore/psxmem.c +++ b/libpcsxcore/psxmem.c @@ -39,6 +39,10 @@ #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); -- 2.39.5