gdb stub fixups

This commit is contained in:
zeromus 2009-06-10 20:30:15 +00:00
parent 71eac340d5
commit 7d69942bbb
6 changed files with 38 additions and 26 deletions

View File

@ -22,6 +22,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "types.h"
#include "arm_instructions.h"
#include "thumb_instructions.h"
#include "cp15.h"

View File

@ -25,12 +25,14 @@
#include <stdio.h>
#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 }
};

View File

@ -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();

View File

@ -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"},

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="shift_jis"?>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
@ -674,6 +674,14 @@
>
</File>
</Filter>
<Filter
Name="gdbstub"
>
<File
RelativePath="..\gdbstub\gdbstub.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="windows"

View File

@ -407,12 +407,12 @@ LRESULT CALLBACK EmulationSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, L
LRESULT CALLBACK MicrophoneSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
struct configured_features {
u16 arm9_gdb_port;
u16 arm7_gdb_port;
const char *cflash_disk_image_file;
};
//struct configured_features {
// u16 arm9_gdb_port;
// u16 arm7_gdb_port;
//
// const char *cflash_disk_image_file;
//};
int KeyInDelayInCount=10;
@ -487,13 +487,13 @@ VOID CALLBACK KeyInputTimer( UINT idEvent, UINT uMsg, DWORD_PTR dwUser, DWORD_PT
// }
}
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 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