- text snapshot check option added to parameter tree

- GDB stub options are now regular parameters
- syntax of text_snapshot_check bochsrc directive changed
This commit is contained in:
Volker Ruppert 2006-03-04 12:43:47 +00:00
parent 93898e11b2
commit dbe0918d59
7 changed files with 77 additions and 50 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.185 2006-03-03 20:29:49 vruppert Exp $
// $Id: bochs.h,v 1.186 2006-03-04 12:43:46 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -470,13 +470,6 @@ typedef struct {
bx_param_string_c *Odebugger_filename;
} bx_log_options;
typedef struct {
unsigned int port;
unsigned int text_base;
unsigned int data_base;
unsigned int bss_base;
} bx_gdbstub_t;
#define BX_KBD_XT_TYPE 0
#define BX_KBD_AT_TYPE 1
#define BX_KBD_MF_TYPE 2
@ -489,9 +482,7 @@ typedef struct {
#define BX_N_PCI_SLOTS 5
typedef struct BOCHSAPI {
bx_param_bool_c *Otext_snapshot_check;
bx_log_options log;
bx_gdbstub_t gdbstub;
} bx_options_t;
BOCHSAPI extern bx_options_t bx_options;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: config.cc,v 1.92 2006-03-03 20:29:50 vruppert Exp $
// $Id: config.cc,v 1.93 2006-03-04 12:43:46 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -1520,23 +1520,52 @@ void bx_init_options()
deplist->add(logfile);
loglevel->set_dependent_list(deplist);
// misc options
bx_options.Otext_snapshot_check = new bx_param_bool_c(BXP_TEXT_SNAPSHOT_CHECK,
// misc options subtree
bx_list_c *misc = new bx_list_c(root_param, "misc", "Configure Everything Else");
misc->get_options()->set(bx_list_c::SHOW_PARENT);
bx_param_num_c *gdbstub_opt;
// text snapshot check panic
new bx_param_bool_c(misc,
"text_snapshot_check",
"Enable text snapshot check panic",
"Enable panic when text on screen matches snapchk.txt.\nUseful for regression testing.\nIn win32, turns off CR/LF in snapshots and cuts.",
0);
// GDB stub
bx_options.gdbstub.port = 1234;
bx_options.gdbstub.text_base = 0;
bx_options.gdbstub.data_base = 0;
bx_options.gdbstub.bss_base = 0;
bx_param_c *other_init_list[] = {
SIM->get_param(BXP_TEXT_SNAPSHOT_CHECK),
NULL
};
menu = new bx_list_c(BXP_MENU_MISC, "misc", "Configure Everything Else", other_init_list);
menu->get_options()->set(bx_list_c::SHOW_PARENT);
menu = new bx_list_c(misc, "gdbstub", "GDB Stub Options");
menu->get_options()->set(bx_list_c::SHOW_PARENT | bx_list_c::USE_BOX_TITLE);
menu->set_enabled(BX_GDBSTUB);
enabled = new bx_param_bool_c(menu,
"enabled",
"Enable GDB stub",
"",
0);
enabled->set_enabled(BX_GDBSTUB);
gdbstub_opt = new bx_param_num_c(menu,
"port",
"Port",
"TCP/IP port for GDB stub",
0, 65535,
1234);
gdbstub_opt = new bx_param_num_c(menu,
"text_base",
"Text base",
"",
0, BX_MAX_BIT32U,
0);
gdbstub_opt = new bx_param_num_c(menu,
"data_base",
"Data base",
"",
0, BX_MAX_BIT32U,
0);
gdbstub_opt = new bx_param_num_c(menu,
"bss_base",
"BSS base",
"",
0, BX_MAX_BIT32U,
0);
enabled->set_dependent_list(menu->clone());
// log options
bx_options.log.Ofilename = new bx_param_filename_c(BXP_LOG_FILENAME,
@ -1618,7 +1647,7 @@ void bx_reset_options()
SIM->get_param("sound")->reset();
// misc
bx_options.Otext_snapshot_check->reset();
SIM->get_param("misc")->reset();
// logfile
bx_options.log.Ofilename->reset();
@ -2503,11 +2532,14 @@ static Bit32s parse_line_formatted(char *context, int num_params, char *params[]
if (num_params != 2) {
PARSE_ERR(("%s: text_snapshot_check directive: wrong # args.", context));
}
if (!strncmp(params[1], "enable", 6)) {
bx_options.Otext_snapshot_check->set (1);
} else if (!strncmp(params[1], "disable", 7)) {
bx_options.Otext_snapshot_check->set (0);
} else bx_options.Otext_snapshot_check->set (!!(atol(params[1])));
if (!strncmp(params[1], "enabled=", 8)) {
if (params[1][8] == '0' || params[1][8] == '1')
SIM->get_param_bool(BXPN_TEXT_SNAPSHOT_CHECK)->set(params[1][8] - '0');
else
PARSE_ERR(("%s: text_snapshot_check directive malformed.", context));
} else {
PARSE_ERR(("%s: text_snapshot_check directive malformed.", context));
}
} else if (!strcmp(params[0], "mouse")) {
if (num_params < 2) {
PARSE_ERR(("%s: mouse directive malformed.", context));
@ -2746,13 +2778,16 @@ static Bit32s parse_line_formatted(char *context, int num_params, char *params[]
if (num_params < 2) {
PARSE_ERR(("%s: gdbstub directive: wrong # args.", context));
}
base = (bx_list_c*) SIM->get_param(BXPN_GDBSTUB);
for (i=1; i<num_params; i++) {
if (!strncmp(params[i], "enabled=", 8)) {
if (params[i][8] == '0') {
SIM->get_param_bool("enabled", base)->set(0);
BX_INFO(("Disabled gdbstub"));
bx_dbg.gdbstub_enabled = 0;
}
else if (params[i][8] == '1') {
SIM->get_param_bool("enabled", base)->set(1);
BX_INFO(("Enabled gdbstub"));
bx_dbg.gdbstub_enabled = 1;
}
@ -2761,16 +2796,16 @@ static Bit32s parse_line_formatted(char *context, int num_params, char *params[]
}
}
else if (!strncmp(params[i], "port=", 5)) {
bx_options.gdbstub.port = atoi(&params[i][5]);
SIM->get_param_num("port", base) = atoi(&params[i][5]);
}
else if (!strncmp(params[i], "text_base=", 10)) {
bx_options.gdbstub.text_base = atoi(&params[i][10]);
SIM->get_param_num("text_base", base) = atoi(&params[i][10]);
}
else if (!strncmp(params[i], "data_base=", 10)) {
bx_options.gdbstub.data_base = atoi(&params[i][10]);
SIM->get_param_num("data_base", base) = atoi(&params[i][10]);
}
else if (!strncmp(params[i], "bss_base=", 9)) {
bx_options.gdbstub.bss_base = atoi(&params[i][9]);
SIM->get_param_num("bss_base", base) = atoi(&params[i][9]);
}
else {
PARSE_ERR(("%s: gdbstub directive malformed.", context));
@ -3385,7 +3420,7 @@ int bx_write_configuration(char *rc, int overwrite)
fprintf(fp, "cpu: count=1, ips=%u, reset_on_triple_fault=%d\n",
SIM->get_param_num(BXPN_IPS)->get(), SIM->get_param_bool(BXPN_RESET_ON_TRIPLE_FAULT)->get());
#endif
fprintf(fp, "text_snapshot_check: %d\n", bx_options.Otext_snapshot_check->get());
fprintf(fp, "text_snapshot_check: enabled=%d\n", SIM->get_param_bool(BXPN_TEXT_SNAPSHOT_CHECK)->get());
fprintf(fp, "private_colormap: enabled=%d\n", SIM->get_param_bool(BXPN_PRIVATE_COLORMAP)->get());
#if BX_WITH_AMIGAOS
fprintf(fp, "fullscreen: enabled=%d\n", SIM->get_param_bool(BXPN_FULLSCREEN)->get());

View File

@ -27,6 +27,7 @@ static int last_stop_reason = GDBSTUB_STOP_NO_REASON;
#define GDBSTUB_TRACE (0xac2)
#define GDBSTUB_USER_BREAK (0xac3)
static bx_list_c *gdbstub_list;
static int listen_socket_fd;
static int socket_fd;
@ -775,9 +776,9 @@ static void debug_loop(void)
{
sprintf(obuf,
"Text=%x;Data=%x;Bss=%x",
bx_options.gdbstub.text_base,
bx_options.gdbstub.data_base,
bx_options.gdbstub.bss_base);
SIM->get_param_num("text_base", gdbstub_list)->get(),
SIM->get_param_num("data_base", gdbstub_list)->get(),
SIM->get_param_num("bss_base", gdbstub_list)->get());
put_reply(obuf);
}
else
@ -882,7 +883,8 @@ static void wait_for_connect(int portn)
void bx_gdbstub_init(int argc, char* argv[])
{
int portn = bx_options.gdbstub.port;
gdbstub_list = (bx_list_c*) SIM->get_param(BXPN_GDBSTUB);
int portn = SIM->get_param_num("port", gdbstub_list)->get();
#ifdef __MINGW32__
WSADATA wsaData;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.cc,v 1.92 2006-02-27 09:37:58 vruppert Exp $
// $Id: gui.cc,v 1.93 2006-03-04 12:43:47 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -220,7 +220,7 @@ bx_gui_c::init(int argc, char **argv, unsigned tilewidth, unsigned tileheight)
BX_GRAVITY_RIGHT, userbutton_handler);
BX_GUI_THIS set_tooltip(BX_GUI_THIS user_hbar_id, "Send keyboard shortcut");
if(bx_options.Otext_snapshot_check->get()) {
if (SIM->get_param_bool(BXPN_TEXT_SNAPSHOT_CHECK)->get()) {
bx_pc_system.register_timer(this, bx_gui_c::snapshot_checker, (unsigned) 1000000, 1, 1, "snap_chk");
}
@ -370,7 +370,7 @@ bx_gui_c::make_text_snapshot (char **snapshot, Bit32u *length)
}
while ((txt_addr > 0) && (clean_snap[txt_addr-1] == ' ')) txt_addr--;
#ifdef WIN32
if(!(bx_options.Otext_snapshot_check->get())) {
if(!(SIM->get_param_bool(BXPN_TEXT_SNAPSHOT_CHECK)->get())) {
clean_snap[txt_addr++] = 13;
}
#endif

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.h,v 1.171 2006-03-03 20:29:50 vruppert Exp $
// $Id: siminterface.h,v 1.172 2006-03-04 12:43:47 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Intro to siminterface by Bryce Denney:
@ -215,6 +215,8 @@ typedef enum {
#define BXPN_SB16_WAVEFILE "sound.sb16.wavefile"
#define BXPN_SB16_DMATIMER "sound.sb16.dmatimer"
#define BXPN_SB16_LOGLEVEL "sound.sb16.loglevel"
#define BXPN_TEXT_SNAPSHOT_CHECK "misc.text_snapshot_check"
#define BXPN_GDBSTUB "misc.gdbstub"
// base value for generated new parameter id
#define BXP_NEW_PARAM_ID 1001
@ -225,15 +227,12 @@ typedef enum {
// it's only important that they all be different from each other.
typedef enum {
BXP_NULL = 301,
BXP_TEXT_SNAPSHOT_CHECK,
BXP_LOG_FILENAME,
BXP_LOG_PREFIX,
BXP_DEBUGGER_LOG_FILENAME,
BXP_MENU_MAIN,
BXP_MENU_MEMORY,
BXP_MENU_DISK,
BXP_MENU_MISC,
BXP_MENU_RUNTIME,
BXP_BOCHS_START, // How Bochs starts
// experiment: add params for CPU registers

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: textconfig.cc,v 1.44 2006-03-03 20:29:50 vruppert Exp $
// $Id: textconfig.cc,v 1.45 2006-03-04 12:43:47 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// This is code for a text-mode configuration interface. Note that this file
@ -501,7 +501,7 @@ int bx_config_interface (int menu)
case 13: do_menu2("ports", NULL); break;
case 14: do_menu2("network", NULL); break;
case 15: do_menu2(BXPN_SB16, NULL); break;
case 16: do_menu(BXP_MENU_MISC); break;
case 16: do_menu2("misc", NULL); break;
default: BAD_OPTION(menu, choice);
}
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////
// $Id: wxmain.cc,v 1.125 2006-03-03 20:29:50 vruppert Exp $
// $Id: wxmain.cc,v 1.126 2006-03-04 12:43:47 vruppert Exp $
/////////////////////////////////////////////////////////////////
//
// wxmain.cc implements the wxWidgets frame, toolbar, menus, and dialogs.
@ -685,7 +685,7 @@ void MyFrame::OnEditSound(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnEditOther(wxCommandEvent& WXUNUSED(event))
{
ParamDialog dlg(this, -1);
bx_list_c *list = (bx_list_c*) SIM->get_param(BXP_MENU_MISC);
bx_list_c *list = (bx_list_c*) SIM->get_param("misc");
dlg.SetTitle(list->get_title()->getptr());
dlg.AddParam(list);
dlg.SetRuntimeFlag(sim_thread != NULL);