From 7d69942bbb523c1b2552a0c1da38e55cde7a6f8b Mon Sep 17 00:00:00 2001 From: zeromus Date: Wed, 10 Jun 2009 20:30:15 +0000 Subject: [PATCH] gdb stub fixups --- desmume/src/armcpu.cpp | 1 + desmume/src/commandline.cpp | 6 ++++ desmume/src/commandline.h | 1 + desmume/src/gtk/main.cpp | 4 --- desmume/src/windows/DeSmuME_2008.vcproj | 10 +++++- desmume/src/windows/main.cpp | 42 ++++++++++++------------- 6 files changed, 38 insertions(+), 26 deletions(-) diff --git a/desmume/src/armcpu.cpp b/desmume/src/armcpu.cpp index 729ccc54b..59b70f98a 100644 --- a/desmume/src/armcpu.cpp +++ b/desmume/src/armcpu.cpp @@ -22,6 +22,7 @@ #include #include #include +#include "types.h" #include "arm_instructions.h" #include "thumb_instructions.h" #include "cp15.h" diff --git a/desmume/src/commandline.cpp b/desmume/src/commandline.cpp index 4326d9d3f..3b0e90620 100644 --- a/desmume/src/commandline.cpp +++ b/desmume/src/commandline.cpp @@ -25,12 +25,14 @@ #include #include "commandline.h" +#include "types.h" CommandLine::CommandLine() : error(NULL) , ctx(g_option_context_new ("")) { load_slot = 0; + arm9_gdb_port = arm7_gdb_port = 0; } CommandLine::~CommandLine() @@ -52,6 +54,10 @@ void CommandLine::loadCommonOptions() { "load-slot", 0, 0, G_OPTION_ARG_INT, &load_slot, "Loads savegame from slot NUM", "NUM"}, { "play-movie", 0, 0, G_OPTION_ARG_FILENAME, &_play_movie_file, "Specifies a dsm format movie to play", "PATH_TO_PLAY_MOVIE"}, { "record-movie", 0, 0, G_OPTION_ARG_FILENAME, &_record_movie_file, "Specifies a path to a new dsm format movie", "PATH_TO_RECORD_MOVIE"}, + #ifdef GDB_STUB + { "arm9gdb", 0, 0, G_OPTION_ARG_INT, &arm9_gdb_port, "Enable the ARM9 GDB stub on the given port", "PORT_NUM"}, + { "arm7gdb", 0, 0, G_OPTION_ARG_INT, &arm7_gdb_port, "Enable the ARM7 GDB stub on the given port", "PORT_NUM"}, + #endif { NULL } }; diff --git a/desmume/src/commandline.h b/desmume/src/commandline.h index 60cb80e4f..a2aaa46a2 100644 --- a/desmume/src/commandline.h +++ b/desmume/src/commandline.h @@ -40,6 +40,7 @@ public: std::string nds_file; std::string play_movie_file; std::string record_movie_file; + int arm9_gdb_port, arm7_gdb_port; //load up the common commandline options void loadCommonOptions(); diff --git a/desmume/src/gtk/main.cpp b/desmume/src/gtk/main.cpp index bdec9a3c0..2aaf037b0 100644 --- a/desmume/src/gtk/main.cpp +++ b/desmume/src/gtk/main.cpp @@ -400,10 +400,6 @@ fill_configured_features( struct configured_features *config, "\t\t\t\t 4 = Italian\n" "\t\t\t\t 5 = Spanish\n", "LANG"}, -#ifdef GDB_STUB - { "arm9gdb", 0, 0, G_OPTION_ARG_INT, &config->arm9_gdb_port, "Enable the ARM9 GDB stub on the given port", "PORT_NUM"}, - { "arm7gdb", 0, 0, G_OPTION_ARG_INT, &config->arm7_gdb_port, "Enable the ARM7 GDB stub on the given port", "PORT_NUM"}, -#endif { "cflash", 0, 0, G_OPTION_ARG_FILENAME, &config->cflash_disk_image_file, "Enable disk image GBAMP compact flash emulation", "PATH_TO_DISK_IMAGE"}, #ifdef HAVE_TIMEOUT { "timeout", 0, 0, G_OPTION_ARG_INT, &config->timeout, "Quit desmume after the specified seconds for testing purpose.", "SECONDS"}, diff --git a/desmume/src/windows/DeSmuME_2008.vcproj b/desmume/src/windows/DeSmuME_2008.vcproj index b75e85ade..a12c2a411 100644 --- a/desmume/src/windows/DeSmuME_2008.vcproj +++ b/desmume/src/windows/DeSmuME_2008.vcproj @@ -1,4 +1,4 @@ - + + + + + arm9_gdb_port = 0; - config->arm7_gdb_port = 0; - - config->cflash_disk_image_file = NULL; -} +//static void +//init_configured_features( struct configured_features *config) { +// config->arm9_gdb_port = 0; +// config->arm7_gdb_port = 0; +// +// config->cflash_disk_image_file = NULL; +//} // // //static int @@ -1571,7 +1571,7 @@ int _main() struct armcpu_ctrl_iface *arm9_ctrl_iface; struct armcpu_ctrl_iface *arm7_ctrl_iface; #endif - struct configured_features my_config; +// struct configured_features my_config; extern bool windows_opengl_init(); oglrender_init = windows_opengl_init; @@ -1614,7 +1614,7 @@ int _main() addonsChangePak(addon_type); #endif - init_configured_features( &my_config); + //init_configured_features( &my_config); /*if ( !fill_configured_features( &my_config, lpszArgument)) { MessageBox(NULL,"Unable to parse command line arguments","Error",MB_OK); return 0; @@ -1757,8 +1757,8 @@ int _main() ViewLights = new TOOLSCLASS(hAppInst, IDD_LIGHT_VIEWER, (DLGPROC) ViewLightsProc); #ifdef GDB_STUB - if ( my_config.arm9_gdb_port != 0) { - arm9_gdb_stub = createStub_gdb( my_config.arm9_gdb_port, + if ( cmdline.arm9_gdb_port != 0) { + arm9_gdb_stub = createStub_gdb( cmdline.arm9_gdb_port, &arm9_memio, &arm9_direct_memory_iface); if ( arm9_gdb_stub == NULL) { @@ -1766,8 +1766,8 @@ int _main() return -1; } } - if ( my_config.arm7_gdb_port != 0) { - arm7_gdb_stub = createStub_gdb( my_config.arm7_gdb_port, + if ( cmdline.arm7_gdb_port != 0) { + arm7_gdb_stub = createStub_gdb( cmdline.arm7_gdb_port, &arm7_memio, &arm7_base_memory_iface); @@ -1788,10 +1788,10 @@ int _main() * This has to come after the NDS_Init where the cpus are set up. */ #ifdef GDB_STUB - if ( my_config.arm9_gdb_port != 0) { + if ( cmdline.arm9_gdb_port != 0) { activateStub_gdb( arm9_gdb_stub, arm9_ctrl_iface); } - if ( my_config.arm7_gdb_port != 0) { + if ( cmdline.arm7_gdb_port != 0) { activateStub_gdb( arm7_gdb_stub, arm7_ctrl_iface); } #endif