Commit Graph

349 Commits

Author SHA1 Message Date
Bryce Denney
ad8bb1023b - move the dependent_list structure up the hierarchy to bx_param_num_c,
instead of bx_param_bool_c.  There are several cases where I need an
  enum to enable/disable some fields, and this change should allow
  that.
- modified: gui/siminterface.h gui/siminterface.cc
2002-09-17 04:47:55 +00:00
Bryce Denney
6a50742b20 - clean up ^M pollution from working in cygwin 2002-09-16 17:00:16 +00:00
Bryce Denney
39a6dfc935 - I've added some debugger features recently, but now that I've tested
wxWindows without debugger, I needed to add some more cases of
  #if BX_DEBUGGER to make it work.  It is certainly possible to
  handle such problems by always compiling in the debug dialogs but
  only instantiating them if debug support is compiled in, but I have
  chosen (for now) to put #if BX_DEBUGGER around things like this.
- modified: gui/wxdialog.h gui/wxdialog.cc
2002-09-16 16:04:15 +00:00
Bryce Denney
5af13700e6 - I've added some debugger features recently, but now that I've tested
wxWindows without debugger, I needed to add some more cases of #if
  BX_DEBUGGER to make it work.  All the problems I found were things like
  referencing a debug structure which was never initialized (NULL).  It is
  possible to handle such problems by always compiling in the debug dialogs but
  only instantiating them if debug support is compiled in, but I have chosen
  (for now) to put #if BX_DEBUGGER around things like this.
2002-09-16 15:28:19 +00:00
Bryce Denney
2b388ceddf - rename debug_fputs to debug_puts. Since it doesn't take a file handle,
this is more consistent.
2002-09-16 13:04:13 +00:00
Bryce Denney
6d13447818 - rename debug_fputs to debug_puts. Since it doesn't take a file handle,
this is more consistent.
2002-09-15 12:08:40 +00:00
Bryce Denney
00e769f1e6 - fix fputs bug (args were reversed)
- now debugger code always calls SIM->debug_fputs and the siminterface
  code decides what to do with it.
2002-09-15 12:07:09 +00:00
Bryce Denney
bbae3335a2 - add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger.  Also allows the user to
  type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
  (used to be fprintf to stderr) so that in wxWindows I can redirect
  it all to the wxWindows debug log screen.  Added debug_fputs to
  siminterface which actually sends the text to the GUI by creating
  a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
  and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows.  There are other ways to stop execution.
  Also, signal handling with multiple threads is very strange and different
  on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
  running freely or not.  This is used by the wxWindows GUI to enable or
  disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons.  When the sim is running
  freely, I disable continue and step, and enable stop.  When the sim stops
  to wait for the user, I disable stop and enable continue and step.  The
  change of enables used to be triggered by actually pressing the button,
  but then if you started/stopped the simulation in some other way (typing
  in debug log window) the enables were never changed.  Now the enables are
  controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
  itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
  its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
  I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
  gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
  gui/wxmain.h
2002-09-15 11:21:35 +00:00
Bryce Denney
6c6de2d151 - enable/disable the debugger command buttons Continue, Stop, Step
at the appropriate times.  For example, you can't stop when you're
  stopped.  You can't step when it's running.
- modified: gui/wxdialog.cc gui/wxdialog.h
2002-09-13 22:03:05 +00:00
Bryce Denney
0585191e49 - to quit cleanly with the wxwindows debugger, post a "quit" command
to the sim_thread. Otherwise the sim_thread may sit waiting for a
  command forever and the process never terminates.
2002-09-13 21:53:37 +00:00
Bryce Denney
5b693b960e - only call isSimThread() if compiling with wxWindows 2002-09-13 20:02:07 +00:00
Bryce Denney
98d4c2f823 - fix minor compile problem with wxWindows and no debugger.
- only show continue,stop,step,commit buttons when debugger on.
- modified: gui/wxdialog.cc gui/wxmain.cc
2002-09-13 19:51:06 +00:00
Bryce Denney
565b3846c9 - add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger.  The Bochs debugger calls SIM->debug_get_next_command() which
  does not return until a debugger command is found.  The siminterface sends an
  synchronous event to the wxWindows thread with a blank to be filled in with a
  debugger command.  wxWindows fills in the blank and sends the synchronous
  event back, and the Bochs debugger interprets it as if it was typed on
  the command line.  For the long term I haven't decided whether to stick with
  sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
  all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
  some things to protected members&fields, separating out functionality
  that is most likely to be replaced into virtual functions, and making it
  generally more flexible.  The new CpuRegistersDialog is based on
  ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
  wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
  which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
  where they don't exist.  Add an eflags shadow parameter that represents all
  of the bits of eflags at once.  There are also boolean shadow params for
  each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
  gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
  gui/wxmain.cc gui/wxmain.h
2002-09-13 19:39:38 +00:00
Bryce Denney
8f860f0fd1 - use wxConfigBase::Get() instead of wxConfig::Get() because in some cases
the wxConfig::Get is not defined.
2002-09-13 17:43:57 +00:00
Bryce Denney
be2cdca3e0 - extend bx_shadow_num_c so that it can handle bit fields of variable
length.  (The first guinea pig is the 2-bit IOPL field in eflags.)
  Also it can have a pointer to a Bit8u, Bit16u, Bit32u and signed
  equivalents and do the right thing.
- add lots more CPU fields as parameters: EBP ESI EDI ESP, all segment regs,
  LDTR, GDTR, eflags, DR*, TR*, CR*.  These are all visible on a
  ridiculously tall dialog box that will one day become the debugger.
2002-09-11 03:53:48 +00:00
Bryce Denney
3ad2afe73e - normally Sim2CI events are sent from the simulation thread to the
wxWindows thread.  However, when the wxWindows thread calls
  Bochs code, for example SIM->some_action() that triggers a
  BX_PANIC(), then the Sim2CI event is created in the wxWindows
  thread.  This used to cause thread deadlock, but now it is
  recognized and handled safely.
2002-09-11 03:52:27 +00:00
Volker Ruppert
813cc30712 - the win32 gui now uses the vga_charmap data for the vga text display if the
fontheight is >=14
- removed unnecessary GetDC() call in function create_vga_font()
2002-09-08 16:41:19 +00:00
Volker Ruppert
0ac366ada2 - the wx gui now uses the vga_charmap data for the vga text display 2002-09-08 09:23:45 +00:00
Volker Ruppert
d23d121674 - new function set_text_charmap() stores the vga charmap data in the array
vga_charmap
- the SDL gui uses the charmap data for the vga text display
  * TODO: implement this feature for other guis
- removed unused variables in sdl.cc and gui.cc
- fixed a warning in vga.cc
2002-09-08 07:56:10 +00:00
Volker Ruppert
1332f37bce - do the longjmp() only when variable quit_context is not NULL 2002-09-07 14:27:50 +00:00
Bryce Denney
f0d1e765b5 - there were two calls to wxMutexGuiLeave()...bad! 2002-09-06 16:59:54 +00:00
Bryce Denney
80a3900b8b - apply a patch I've been working on
- modified files: config.h.in cpu/init.cc debug/dbg_main.cc gui/control.cc
  gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
  gui/wxmain.cc gui/wxmain.h iodev/keyboard.cc

----------------------------------------------------------------------
Patch name: patch.wx-show-cpu2
Author: Bryce Denney
Date: Fri Sep  6 12:13:28 EDT 2002

Description:

Second try at implementing the "Debug:Show Cpu" and "Debug:Show
Keyboard" dialog with values that change as the simulation proceeds.
(Nobody gets to see the first try.)  This is the first step toward
making something resembling a wxWindows debugger.

First, variables which are going to be visible in the CI must be
registered as parameters.  For some variables, it might be acceptable
to change them from Bit32u into bx_param_num_c and access them only
with set/get methods, but for most variables it would be a horrible
pain and wreck performance.

To deal with this, I introduced the concept of a shadow parameter.  A
normal parameter has its value stored inside the struct, but a shadow
parameter has only a pointer to the value.  Shadow params allow you to
treat any variable as if it was a parameter, without having to change
its type and access it using get/set methods.  Of course, a shadow
param's value is controlled by someone else, so it can change at any
time.

To demonstrate and test the registration of shadow parameters, I
added code in cpu/init.cc to register a few CPU registers and
code in iodev/keyboard.cc to register a few keyboard state values.
Now these parameters are visible in the Debug:Show CPU and
Debug:Show Keyboard dialog boxes.

The Debug:Show* dialog boxes are created by the ParamDialog class,
which already understands how to display each type of parameter,
including the new shadow parameters (because they are just a subclass
of a normal parameter class).  I have added a ParamDialog::Refresh()
method, which rereads the value from every parameter that it is
displaying and changes the displayed value.  At the moment, in the
Debug:Show CPU dialog, changing the values has no effect.  However
this is trivial to add when it's time (just call CommitChanges!).  It
wouldn't really make sense to change the values unless you have paused
the simulation, for example when single stepping with the debugger.

The Refresh() method must be called periodically or else the dialog
will show the initial values forever.  At the moment, Refresh() is
called when the simulator sends an async event called
BX_ASYNC_EVT_REFRESH, created by a call to SIM->refresh_ci ().

Details:
- implement shadow parameter class for Bit32s, called bx_shadow_num_c.
  implement shadow parameter class for Boolean, called bx_shadow_bool_c.
  more to follow (I need one for every type!)
- now the simulator thread can request that the config interface refresh
  its display.  For now, the refresh event causes the CI to check every
  parameter it is watching and change the display value.  Later, it may
  be worth the trouble to keep track of which parameters have actually
  changed.  Code in the simulator thread calls SIM->refresh_ci(), which
  creates an async event called BX_ASYNC_EVT_REFRESH and sends it to
  the config interface.  When it arrives in the wxWindows gui thread,
  it calls RefreshDialogs(), which calls the Refresh() method on any
  dialogs that might need it.
- in the debugger, SIM->refresh_ci() is called before every prompt
  is printed.  Otherwise, the refresh would wait until the next
  SIM->periodic(), which might be thousands of cycles.  This way,
  when you're single stepping, the dialogs update with every step.
- To improve performance, the CI has a flag (MyFrame::WantRefresh())
  which tells whether it has any need for refresh events.  If no
  dialogs are showing that need refresh events, then no event is sent
  between threads.
- add a few defaults to the param classes that affect the settings of
  newly created parameters.  When declaring a lot of params with
  similar settings it's more compact to set the default for new params
  rather than to change each one separately.  default_text_format is
  the printf format string for displaying numbers.  default_base is
  the default base for displaying numbers (0, 16, 2, etc.)
- I added to ParamDialog to make it able to display modeless dialog
  boxes such as "Debug:Show CPU".  The new Refresh() method queries
  all the parameters for their current value and changes the value in
  the wxWindows control.  The ParamDialog class still needs a little
  work; for example, if it's modal it should have Cancel/Ok buttons,
  but if it's going to be modeless it should maybe have Apply (commit
  any changes) and Close.
2002-09-06 16:43:26 +00:00
Bryce Denney
c1f363c7b5 - not using the config button in wxwindows 2002-09-06 15:00:54 +00:00
Bryce Denney
70d0a6b844 - now that wxmain.h class definition includes a few dialogs from wxdialog.h,
wxdialog must come first.
2002-09-06 14:40:22 +00:00
Bryce Denney
47d7669685 - remove a huge chunk of obsolete code 2002-09-06 04:43:03 +00:00
Bryce Denney
781b06e791 - remove obsolete testing code 2002-09-06 04:41:39 +00:00
Volker Ruppert
b978b19405 - adding strdup() fixes the 'const' problem with gcc 2.95.3 2002-09-05 20:16:19 +00:00
Bryce Denney
e41cfeb329 - put "log filename" onto the LogOptions dialog instead of EditOther
- remove config button from toolbar for wxWindows, since that's what all
  the menus are for!
2002-09-05 17:27:50 +00:00
Bryce Denney
7a2bb1f5a6 - force wxWindows to put all log messages to stderr. (Sometimes it is
tempted to bring up dialog boxes to display the debug messages.)
2002-09-05 16:41:54 +00:00
Bryce Denney
fce114ed19 - eliminate printfs in wxwindows code--use wxLogDebug instead 2002-09-05 16:27:06 +00:00
Bryce Denney
7cef3cc3a4 - clean up memory usage after bx_gui_c::get_clipboard_text for win32,
X windows, wxWindows.  Each platform has its own way of returning
  a variable length string, and its own rules about how you're supposed
  to dispose of the string.  Now all platforms do the same thing: they
  allocate a Bit8u buffer with C++ "new" and copy the clipboard data in,
  then release the clipboard data in the platform-specific correct way.
  The Bit8u buffer is sent to the keyboard code, which frees it with
  delete [] when finished.
- modified: gui/wxmain.cc gui/wxmain.h
2002-09-05 16:01:34 +00:00
Bryce Denney
eb12552eef - in the panic dialog box, change the "Die" button to "Kill Sim".
It wasn't clear if die meant to kill the simulation or the whole app.
2002-09-05 15:58:39 +00:00
Bryce Denney
17624e7549 - clean up memory usage after bx_gui_c::get_clipboard_text for win32,
X windows, wxWindows.  Each platform has its own way of returning
  a variable length string, and its own rules about how you're supposed
  to dispose of the string.  Now all platforms do the same thing: they
  allocate a Bit8u buffer with C++ "new" and copy the clipboard data in,
  then release the clipboard data in the platform-specific correct way.
  The Bit8u buffer is sent to the keyboard code, which frees it with
  delete [] when finished.
- modified: gui/wx.cc gui/x.cc gui/win32.cc iodev/keyboard.cc
2002-09-05 15:57:37 +00:00
Bryce Denney
5feb140d70 - restore signal handling to default when bochs thread dies 2002-09-05 15:51:03 +00:00
Bryce Denney
ce2f799033 - fix bug in key mapping. I typed BX_KEY_MINUS for two different keys. 2002-09-05 15:13:34 +00:00
Bryce Denney
892eaab88c - in wxwindows compile, only include the wxwindows cflags on the few
files that need them.  This is more in line with the other gui libraries,
  and the compile line is easier to read.
- modified: Makefile.in configure.in configure gui/Makefile.in
2002-09-05 15:12:13 +00:00
Bryce Denney
28801ce9ff - implement clipboard functions for wxWindows
- enable keymapping for wxWindows, by inserting bx_keymap.loadKeymap(NULL)
  call in wx.cc
2002-09-05 13:38:44 +00:00
Bryce Denney
b9bfa8ed7f - fix signal handling in wxWindows. The problem was that a signal gets
delivered to both the GUI and simulator thread, so they both call
  bx_signal_handler.  This can lead to deadlock as multiple threads enter
  BX_PANIC and try to show a dialog box at once.  To solve the problem, I made
  a function isSimThread() which can be called from anywhere.  If the
  bx_signal_handler is called from any thread OTHER THAN the simulation thread,
  it returns without doing anything.  As a result, only one thread is allowed
  to enter the signal handler code, and now control-C works correctly.
2002-09-05 07:48:39 +00:00
Bryce Denney
b79630a14e - Volker introduced the -q command line switch in August 2002, which tells
Bochs to immediately read the bochsrc and start simulating immediately (as
  opposed to going into the configuration interface first).  Now -q does
  the right thing in the wxWindows interface.  It behaves as if you selected
  Read Configuration and then Simulate:Start.
- modified: main.cc gui/siminterface.cc gui/siminterface.h gui/wxmain.cc
2002-09-05 07:01:30 +00:00
Bryce Denney
578cc09f55 - keypad5 is apparantly called GDK_KP_Begin on my keyboard 2002-09-05 06:08:47 +00:00
Bryce Denney
137e132371 - add a bunch of missing key codes for MSW. These will only be used if
wxHAS_RAW_KEY_CODES is not available in the wxWindows library.
  my patch "patch.wx-raw-keycodes" adds wxHAS_RAW_KEY_CODES to the wxWindows
  library, and it will also be in wxWindows 2.3.3 and beyond.
2002-09-04 19:14:08 +00:00
Bryce Denney
9d20ece24c - add #ifdefs per operating system so that the dialog boxes display the
correct name for floppy and cdrom devices:on windows, A:, B:, etc;
  on Linux /dev/fd0 and /dev/cdrom.
- It's perfectly ok to type device names into the blank on those dialog
  boxes, but the label "Disk Image File:" sort of implies that it has to
  be a file.  To try to avoid confusion change the label to simply
  "Disk Image:".
2002-09-04 18:39:20 +00:00
Bryce Denney
5596107acb - (hopefully) solves a thread deadlock problem that showed up occasionally
on win32.  I believe this is the same problem that scarlip referred to as
  "it doesn't start reliably. sometimes it works, sometimes it won't".
  See comments in gui/wx.cc (dimension_update) for details.
- since dimension_update is called from the simulator thread, it needs to
  get the GUI mutex before calling any wxWindows functions.  Now it does.
- add lots of IFDBG_VGA(...) lines which I use to diagnose various problems.
  They are compiled away by default (for performance).  See definition of
  IFDBG_VGA() in gui/wxmain.h.
2002-09-04 15:51:04 +00:00
Bryce Denney
614d2ff681 - we don't need to say "Welcome to wxWindows" on the status line 2002-09-04 14:09:05 +00:00
Bryce Denney
0fe0832b99 - to avoid confusion and bugs I made a new convention on dialog return
values.  All wxWindows dialogs return wxID_OK or wxID_CANCEL.  The
  wxOK and wxCANCEL symbols are ONLY used in input arguments that determine
  whether to display the ok and cancel buttons.  Now I'm doing the same.
  Return values are wxID_OK if they pressed the ok button, and wxID_CANCEL
  if they pressed cancel.
2002-09-04 12:29:04 +00:00
Bryce Denney
33eefab657 - clean up extra ^M's I introduced when playing in win32 land. They are
mostly harmless EXCEPT if they appear after a '\' that's used for line
  continuation.  Then they are a disaster.
2002-09-03 19:04:17 +00:00
Bryce Denney
e0f6cfbf86 - fix appearance of toolbar icons on win32. I think Psyon used
SetToolBitmapSize() to set the icon size to 16x16; when I changed the icon
  size I forgot to change SetToolBitmapSize() and somehow it looked ok on
  wxGTK.
- change mouse tooltip to "(Mouse Not Implemented Yet!)" for now
2002-09-03 17:50:12 +00:00
Bryce Denney
a231b12359 - on win32, apparantly the wxSpinCtrl depends on a native control which only
has a 16bit signed value.  If you try to set the max above 32767, it
  overflows and does stupid things.  To combat this tendency, I now use
  the SPINCTRL_FIX_MAX(x) macro when setting the max range of a spinctrl.
  On platforms that need it, this will saturate the range at 32767.
2002-09-03 17:48:21 +00:00
Bryce Denney
152527af04 - MSVC++: can't use variable as array bounds. In this case it's easy enough
to use a #define.
2002-09-03 16:03:50 +00:00
Bryce Denney
b1614f7019 - MSVC++ doesn't like "#undef label()" it only likes "#undef label"
- add a missing "return" in BrowseTextCtrl()
2002-09-03 16:02:21 +00:00