From: Volker R. <vru...@us...> - 2006-09-07 18:51:19
|
Update of /cvsroot/bochs/bochs/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29506/gui Modified Files: siminterface.cc siminterface.h Log Message: - several changes for restart support in wx (not yet complete) * don't initialize cpu specific parameters for the wx debugger if they already exist * separate siminterface method init_save_restore() added * old wx specific handling in quit_sim() removed * new bx_list_c method clear() deletes all parameters from the list * moved devices cleanup code from the pc_system to a new devices method exit() * pc_system init code now sets ticksTotal to 0 Index: siminterface.cc =================================================================== RCS file: /cvsroot/bochs/bochs/gui/siminterface.cc,v retrieving revision 1.165 retrieving revision 1.166 diff -u -d -r1.165 -r1.166 --- siminterface.cc 4 Sep 2006 18:36:47 -0000 1.165 +++ siminterface.cc 7 Sep 2006 18:50:51 -0000 1.166 @@ -144,6 +144,7 @@ virtual Bit32s save_user_options(FILE *fp); #if BX_SUPPORT_SAVE_RESTORE // save/restore support + virtual void init_save_restore(); virtual bx_bool save_state(const char *checkpoint_path); virtual bx_bool restore_config(); virtual bx_bool restore_logopts(); @@ -274,16 +275,6 @@ "bochs", "list of top level bochs parameters", 30); -#if BX_SUPPORT_SAVE_RESTORE - bx_list_c *list = new bx_list_c(root_param, - "save_restore", - "subtree for save/restore", - 30); - new bx_list_c(list, - "cpu", - "CPU State", - BX_MAX_SMP_THREADS_SUPPORTED); -#endif } } @@ -362,14 +353,8 @@ if (quit_context != NULL) { longjmp(*quit_context, 1); BX_PANIC(("in bx_real_sim_c::quit_sim, longjmp should never return")); - } - if (SIM->is_wx_selected()) { - // in wxWidgets, the whole simulator is running in a separate thread. - // our only job is to end the thread as soon as possible, NOT to shut - // down the whole application with an exit. - bx_stop_simulation(); } else { - // just a single thread. Use exit() to stop the application. + // use exit() to stop the application. if (!code) BX_PANIC(("Quit simulation command")); ::exit(exit_code); @@ -611,13 +596,6 @@ refresh_ci(); refresh_counter = 0; } -#if 0 - // watch for memory leaks. Allocate a small block of memory, print the - // pointer that is returned, then free. - BxEvent *memcheck = new BxEvent (); - BX_INFO(("memory allocation at %p", memcheck)); - delete memcheck; -#endif } // create a disk image file called filename, size=512 bytes * sectors. @@ -872,6 +850,24 @@ } #if BX_SUPPORT_SAVE_RESTORE +void bx_real_sim_c::init_save_restore() +{ + bx_list_c *list; + + if ((list = get_sr_root()) != NULL) { + list->clear(); + } else { + list = new bx_list_c(root_param, + "save_restore", + "subtree for save/restore", + 30); + } + new bx_list_c(list, + "cpu", + "CPU State", + BX_MAX_SMP_THREADS_SUPPORTED); +} + bx_bool bx_real_sim_c::save_state(const char *checkpoint_path) { char sr_file[BX_PATHNAME_LEN]; @@ -2057,3 +2053,14 @@ get(i)->reset(); } } + +void bx_list_c::clear() +{ + int i, imax = get_size(); + bx_param_c *param; + for (i=0; i<imax; i++) { + param = get(i); + delete param; + } + this->size = 0; +} Index: siminterface.h =================================================================== RCS file: /cvsroot/bochs/bochs/gui/siminterface.h,v retrieving revision 1.200 retrieving revision 1.201 diff -u -d -r1.200 -r1.201 --- siminterface.h 29 Aug 2006 20:10:26 -0000 1.200 +++ siminterface.h 7 Sep 2006 18:50:51 -0000 1.201 @@ -964,6 +964,7 @@ void set_parent(bx_param_c *newparent); bx_param_c *get_parent() { return parent; } virtual void reset(); + virtual void clear(); #if BX_USE_TEXTCONFIG virtual void text_print(FILE *); virtual int text_ask(FILE *fpin, FILE *fpout); @@ -1231,6 +1232,7 @@ virtual Bit32s save_user_options(FILE *fp) {return -1;} #if BX_SUPPORT_SAVE_RESTORE // save/restore support + virtual void init_save_restore() {} virtual bx_bool save_state(const char *checkpoint_path) {return 0;} virtual bx_bool restore_config() {return 0;} virtual bx_bool restore_logopts() {return 0;} |