From f29fbf73de18b588c9e1673c9823376470556c6a Mon Sep 17 00:00:00 2001 From: attilavs2 Date: Sun, 28 Jul 2024 22:08:32 +0200 Subject: [PATCH] Add gdb support if DEBUGMODE is enabled --- CMakeLists.txt | 10 +++++----- src/main.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eaca920..72e8878 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,11 +104,11 @@ target_link_libraries(myaddin LibProf::LibProf Gint::Gint) if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G) # fx colormode if("${COLORMODE_fx}" STREQUAL 1b) - target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -DCOLOR1BIT) + target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -g -DCOLOR1BIT) endif() if("${COLORMODE_fx}" STREQUAL 2b) - target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -DCOLOR2BIT) + target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -g -DCOLOR2BIT) endif() if("${COLORMODE_fx}" STREQUAL 1b) @@ -126,15 +126,15 @@ if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G) elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50) # cg colormode if("${COLORMODE_cg}" STREQUAL 1b) - target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -DCOLOR1BIT) + target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -g -DCOLOR1BIT) endif() if("${COLORMODE_cg}" STREQUAL 2b) - target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -DCOLOR2BIT) + target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -g -DCOLOR2BIT) endif() if("${COLORMODE_cg}" STREQUAL EGA64) - target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -DCOLOREGA) + target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -g -DCOLOREGA) endif() if("${COLORMODE_cg}" STREQUAL 1b) diff --git a/src/main.c b/src/main.c index abb7180..9812b20 100644 --- a/src/main.c +++ b/src/main.c @@ -1,4 +1,3 @@ - #include #include #include @@ -20,6 +19,10 @@ #include #endif //GRAYMODEOK +#if DEBUGMODE + #include +#endif /*DEBUGMODE*/ + #include #include @@ -92,6 +95,10 @@ int update_time(void) { int main(void) { + #if DEBUGMODE + gdb_start_on_exception(); + #endif /*DEBUGMODE*/ + __printf_enable_fp(); int timer; @@ -113,7 +120,6 @@ int main(void) { usb_open(interfaces, GINT_CALL_NULL); #endif - /* start grayscale engine */ #if GRAYMODEOK