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
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
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.
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
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
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
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.
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.
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
- 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.
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
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
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
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.
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
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.
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:".
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.
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.
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
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.