Enable show-param support in debugger.
Fixed print_tree function to correctly print 64-bit data
This commit is contained in:
parent
36d4ee68e4
commit
34061a2f22
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: dbg_main.cc,v 1.65 2006-04-29 09:27:49 sshwarts Exp $
|
||||
// $Id: dbg_main.cc,v 1.66 2006-05-30 19:46:31 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -197,12 +197,12 @@ int bx_dbg_main(int argc, char *argv[])
|
||||
if (!debugger_log) {
|
||||
BX_PANIC(("Can not open debugger log file '%s'",
|
||||
SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->getptr()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
BX_INFO(("Using debugger log file %s",
|
||||
SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->getptr()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if BX_DISASM
|
||||
memset(bx_disasm_ibuf, 0, sizeof(bx_disasm_ibuf));
|
||||
@ -211,21 +211,6 @@ int bx_dbg_main(int argc, char *argv[])
|
||||
// parse any remaining args in the usual way
|
||||
bx_parse_cmdline(1, bochs_argc, bochs_argv);
|
||||
|
||||
// initialize hardware
|
||||
bx_init_hardware();
|
||||
|
||||
// Moved from main.cc, just like in main.cc before set_init_done()
|
||||
if (SIM->get_param_enum(BXPN_LOAD32BITOS_WHICH)->get()) {
|
||||
void bx_load32bitOSimagehack(void);
|
||||
bx_load32bitOSimagehack();
|
||||
}
|
||||
SIM->set_init_done(1);
|
||||
|
||||
// update headerbar buttons since drive status can change during init
|
||||
bx_gui->update_drive_status_buttons();
|
||||
// iniialize statusbar and set all items inactive
|
||||
bx_gui->statusbar_setitem(-1, 0);
|
||||
|
||||
// create a boolean parameter that will tell if the simulation is
|
||||
// running (continue command) or waiting for user response. This affects
|
||||
// some parts of the GUI.
|
||||
@ -958,7 +943,7 @@ void bx_dbg_show_command(const char* arg)
|
||||
DEV_vga_refresh();
|
||||
return;
|
||||
} else {
|
||||
printf("Unrecognized arg: %s (only 'mode', 'int', 'softint', 'extint', 'iret', 'call', 'off', 'dbg-all' and 'dbg-none' are valid)\n", arg);
|
||||
dbg_printf("Unrecognized arg: %s (only 'mode', 'int', 'softint', 'extint', 'iret', 'call', 'off', 'dbg-all' and 'dbg-none' are valid)\n", arg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -982,6 +967,19 @@ void bx_dbg_show_command(const char* arg)
|
||||
}
|
||||
}
|
||||
|
||||
void bx_dbg_show_param_command(char *param)
|
||||
{
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
// remove leading and trailing quotas
|
||||
if (param[0]=='\"') param++;
|
||||
unsigned len = strlen(param);
|
||||
if (param[len - 1] == '\"') param[len - 1] = '\0';
|
||||
dbg_printf("show param name: <%s>\n", param);
|
||||
print_tree(SIM->get_param(param, SIM->get_sr_root()), 0);
|
||||
#else
|
||||
dbg_printf("You must compile with save/restore to use this command !\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
// return non zero to cause a stop
|
||||
int bx_dbg_show_symbolic(void)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: debug.h,v 1.24 2006-04-29 09:27:49 sshwarts Exp $
|
||||
// $Id: debug.h,v 1.25 2006-05-30 19:46:31 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -240,6 +240,7 @@ void bx_dbg_modebp_command(void);
|
||||
void bx_dbg_where_command(void);
|
||||
void bx_dbg_print_string_command(bx_address addr);
|
||||
void bx_dbg_show_command(const char*);
|
||||
void bx_dbg_show_param_command(char *param);
|
||||
void bx_dbg_print_stack_command(unsigned nwords);
|
||||
void bx_dbg_watch(int read, Bit32u address);
|
||||
void bx_dbg_unwatch(int read, Bit32u address);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: parser.y,v 1.17 2006-05-21 16:48:05 sshwarts Exp $
|
||||
// $Id: parser.y,v 1.18 2006-05-30 19:46:31 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
%{
|
||||
@ -240,6 +240,11 @@ show_command:
|
||||
bx_dbg_show_command($2);
|
||||
free($1); free($2);
|
||||
}
|
||||
| BX_TOKEN_SHOW BX_TOKEN_STRING '\n'
|
||||
{
|
||||
bx_dbg_show_param_command($2);
|
||||
free($1); free($2);
|
||||
}
|
||||
| BX_TOKEN_SHOW '\n'
|
||||
{
|
||||
bx_dbg_show_command(0);
|
||||
|
@ -892,10 +892,7 @@ void bx_gdbstub_init(int argc, char* argv[])
|
||||
WSAStartup(2, &wsaData);
|
||||
#endif
|
||||
|
||||
bx_init_hardware();
|
||||
|
||||
/* Wait for connect */
|
||||
|
||||
printf("Waiting for gdb connection on localhost:%d\n", portn);
|
||||
wait_for_connect(portn);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.336 2006-05-28 16:39:24 vruppert Exp $
|
||||
// $Id: main.cc,v 1.337 2006-05-30 19:46:31 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -199,17 +199,17 @@ void print_tree(bx_param_c *node, int level)
|
||||
}
|
||||
switch (node->get_type()) {
|
||||
case BXT_PARAM_NUM:
|
||||
if (((bx_param_num_c*)node)->get_base() == 10) {
|
||||
printf("%s = %d (number)\n", node->get_name(), ((bx_param_num_c*)node)->get());
|
||||
if (((bx_param_num_c*)node)->get_base() == BASE_DEC) {
|
||||
printf("%s = " FMT_LL "d (number)\n", node->get_name(), ((bx_param_num_c*)node)->get64());
|
||||
} else {
|
||||
printf("%s = 0x%x (hex number)\n", node->get_name(), ((bx_param_num_c*)node)->get());
|
||||
printf("%s = 0x" FMT_LL "x (hex number)\n", node->get_name(), ((bx_param_num_c*)node)->get64());
|
||||
}
|
||||
break;
|
||||
case BXT_PARAM_BOOL:
|
||||
printf("%s = %s (boolean)\n", node->get_name(), ((bx_param_bool_c*)node)->get()?"true":"false");
|
||||
printf("%s = %s (boolean)\n", node->get_name(), ((bx_param_bool_c*)node)->get()?"true":"false");
|
||||
break;
|
||||
case BXT_PARAM_ENUM:
|
||||
printf("%s = '%s' (enum)\n", node->get_name(), ((bx_param_enum_c*)node)->get_selected());
|
||||
printf("%s = '%s' (enum)\n", node->get_name(), ((bx_param_enum_c*)node)->get_selected());
|
||||
break;
|
||||
case BXT_PARAM_STRING:
|
||||
if (((bx_param_string_c*)node)->get_options()->get() & bx_param_string_c::RAW_BYTES) {
|
||||
@ -223,9 +223,9 @@ void print_tree(bx_param_c *node, int level)
|
||||
sprintf(tmpbyte, "%02x", (Bit8u)((bx_param_string_c*)node)->getptr()[i]);
|
||||
strcat(tmpstr, tmpbyte);
|
||||
}
|
||||
printf("%s = '%s' (raw byte string)\n", node->get_name(), tmpstr);
|
||||
printf("%s = '%s' (raw byte string)\n", node->get_name(), tmpstr);
|
||||
} else {
|
||||
printf("%s = '%s' (string)\n", node->get_name(), ((bx_param_string_c*)node)->getptr());
|
||||
printf("%s = '%s' (string)\n", node->get_name(), ((bx_param_string_c*)node)->getptr());
|
||||
}
|
||||
break;
|
||||
case BXT_LIST:
|
||||
@ -239,11 +239,11 @@ void print_tree(bx_param_c *node, int level)
|
||||
}
|
||||
#if BX_SUPPORT_SAVE_RESTORE
|
||||
case BXT_PARAM_DATA:
|
||||
printf("%s = 'size=%d' (binary data)\n", node->get_name(), ((bx_shadow_data_c*)node)->get_size());
|
||||
printf("%s = 'size=%d' (binary data)\n", node->get_name(), ((bx_shadow_data_c*)node)->get_size());
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
printf("%s (unknown parameter type)\n", node->get_name());
|
||||
printf("%s (unknown parameter type)\n", node->get_name());
|
||||
}
|
||||
}
|
||||
|
||||
@ -833,40 +833,38 @@ int bx_begin_simulation (int argc, char *argv[])
|
||||
BX_ASSERT(bx_cpu_count < BX_MAX_SMP_THREADS_SUPPORTED);
|
||||
BX_ASSERT(bx_cpu_count > 0);
|
||||
|
||||
bx_init_hardware();
|
||||
|
||||
if (SIM->get_param_enum(BXPN_LOAD32BITOS_WHICH)->get()) {
|
||||
void bx_load32bitOSimagehack(void);
|
||||
bx_load32bitOSimagehack();
|
||||
}
|
||||
|
||||
SIM->set_init_done(1);
|
||||
|
||||
// update headerbar buttons since drive status can change during init
|
||||
bx_gui->update_drive_status_buttons();
|
||||
// iniialize statusbar and set all items inactive
|
||||
bx_gui->statusbar_setitem(-1, 0);
|
||||
|
||||
// The set handler for mouse_enabled does not actually update the gui
|
||||
// until init_done is set. This forces the set handler to be called,
|
||||
// which sets up the mouse enabled GUI-specific stuff correctly.
|
||||
// Not a great solution but it works. BBD
|
||||
SIM->get_param_bool(BXPN_MOUSE_ENABLED)->set(SIM->get_param_bool(BXPN_MOUSE_ENABLED)->get());
|
||||
|
||||
#if BX_DEBUGGER
|
||||
// If using the debugger, it will take control and call
|
||||
// bx_init_hardware() and cpu_loop()
|
||||
bx_dbg_main(argc, argv);
|
||||
#else
|
||||
#else
|
||||
#if BX_GDBSTUB
|
||||
// If using gdbstub, it will take control and call
|
||||
// bx_init_hardware() and cpu_loop()
|
||||
if (bx_dbg.gdbstub_enabled) {
|
||||
bx_gdbstub_init (argc, argv);
|
||||
}
|
||||
if (bx_dbg.gdbstub_enabled) bx_gdbstub_init(argc, argv);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
bx_init_hardware();
|
||||
|
||||
if (SIM->get_param_enum(BXPN_LOAD32BITOS_WHICH)->get()) {
|
||||
void bx_load32bitOSimagehack(void);
|
||||
bx_load32bitOSimagehack();
|
||||
}
|
||||
|
||||
SIM->set_init_done (1);
|
||||
|
||||
// update headerbar buttons since drive status can change during init
|
||||
bx_gui->update_drive_status_buttons ();
|
||||
// iniialize statusbar and set all items inactive
|
||||
bx_gui->statusbar_setitem(-1, 0);
|
||||
|
||||
// The set handler for mouse_enabled does not actually update the gui
|
||||
// until init_done is set. This forces the set handler to be called,
|
||||
// which sets up the mouse enabled GUI-specific stuff correctly.
|
||||
// Not a great solution but it works. BBD
|
||||
SIM->get_param_bool(BXPN_MOUSE_ENABLED)->set(SIM->get_param_bool(BXPN_MOUSE_ENABLED)->get());
|
||||
|
||||
#if BX_SUPPORT_SMP == 0
|
||||
// only one processor, run as fast as possible by not messing with
|
||||
// quantums and loops.
|
||||
@ -890,7 +888,7 @@ int bx_begin_simulation (int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif /* ! BX_DEBUGGER */
|
||||
#endif /* BX_DEBUGGER == 0 */
|
||||
BX_INFO(("cpu loop quit, shutting down simulator"));
|
||||
bx_atexit();
|
||||
return(0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user