Completely replace win32 enh debugger (GUI debugger frontend for Bochs internal dbg)

Used new code by bewing, converging to cross-platform GUI frontend
This commit is contained in:
Stanislav Shwartsman 2008-12-27 12:06:39 +00:00
parent f2f5d5c915
commit 9b85851b12
12 changed files with 5548 additions and 4580 deletions

4
bochs/configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in Id: configure.in,v 1.376 2008/12/11 21:00:01 sshwarts Exp .
# From configure.in Id: configure.in,v 1.377 2008/12/11 21:19:37 sshwarts Exp .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61.
#
@ -37975,7 +37975,7 @@ fi
LIBS="$LIBS -lcomctl32"
fi
fi
DIALOG_OBJS="win32dialog.o win32_enh_dbg.o"
DIALOG_OBJS="win32dialog.o win32_enh_dbg_osdep.o"
EXPORT_DYNAMIC=""
;;
esac

View File

@ -2,7 +2,7 @@ dnl // Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(bochs.h)
AC_REVISION([[$Id: configure.in,v 1.377 2008-12-11 21:19:37 sshwarts Exp $]])
AC_REVISION([[$Id: configure.in,v 1.378 2008-12-27 12:06:39 sshwarts Exp $]])
AC_CONFIG_HEADER(config.h)
AC_CONFIG_HEADER(ltdlconf.h)
@ -2641,7 +2641,7 @@ case $target in
LIBS="$LIBS -lcomctl32"
fi
fi
DIALOG_OBJS="win32dialog.o win32_enh_dbg.o"
DIALOG_OBJS="win32dialog.o win32_enh_dbg_osdep.o"
EXPORT_DYNAMIC=""
;;
esac

View File

@ -70,7 +70,7 @@ GUI_OBJS_RFB = rfb.o
GUI_OBJS_AMIGAOS = amigaos.o
GUI_OBJS_WX = wx.o
GUI_OBJS_WX_SUPPORT = wxmain.o wxdialog.o
OBJS_THAT_CANNOT_BE_PLUGINS = keymap.o gui.o siminterface.o textconfig.o @DIALOG_OBJS@
OBJS_THAT_CANNOT_BE_PLUGINS = keymap.o gui.o siminterface.o textconfig.o enh_dbg.o @DIALOG_OBJS@
OBJS_THAT_CAN_BE_PLUGINS = @GUI_OBJS@
X_LIBS = @X_LIBS@
@ -351,7 +351,7 @@ win32.o: win32.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h ../bx_debug/debug.
../iodev/unmapped.h ../iodev/ne2k.h ../iodev/guest2host.h \
../iodev/slowdown_timer.h ../iodev/extfpuirq.h ../iodev/gameport.h \
win32dialog.h ../config.h win32res.h ../font/vga.bitmap.h
win32_enh_dbg.o: win32_enh_dbg.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
enh_dbg.o: enh_dbg.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
../gui/siminterface.h ../memory/memory.h ../pc_system.h ../plugin.h \
../extplugin.h ../gui/gui.h ../gui/textconfig.h ../config.h \
@ -374,6 +374,11 @@ win32dialog.o: win32dialog.@CPP_SUFFIX@ win32dialog.h ../config.h ../bochs.h \
../bxversion.h ../gui/siminterface.h ../memory/memory.h ../pc_system.h \
../plugin.h ../extplugin.h ../gui/gui.h ../gui/textconfig.h ../config.h \
../gui/keymap.h ../instrument/stubs/instrument.h win32res.h
win32_enh_dbg_osdep.o: win32_enh_dbg_osdep.@CPP_SUFFIX@ win32dialog.h ../config.h ../bochs.h \
../config.h ../osdep.h ../bx_debug/debug.h ../config.h ../osdep.h \
../bxversion.h ../gui/siminterface.h ../memory/memory.h ../pc_system.h \
../plugin.h ../extplugin.h ../gui/gui.h ../gui/textconfig.h ../config.h \
../gui/keymap.h ../instrument/stubs/instrument.h win32res.h
wx.o: wx.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h ../bx_debug/debug.h \
../bxversion.h ../gui/siminterface.h ../memory/memory.h ../pc_system.h \
../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h ../gui/textconfig.h \
@ -569,7 +574,7 @@ win32.lo: win32.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h ../bx_debug/debug
../iodev/unmapped.h ../iodev/ne2k.h ../iodev/guest2host.h \
../iodev/slowdown_timer.h ../iodev/extfpuirq.h ../iodev/gameport.h \
win32dialog.h ../config.h win32res.h ../font/vga.bitmap.h
win32_enh_dbg.lo: win32_enh_dbg.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
enh_dbg.lo: enh_dbg.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
../gui/siminterface.h ../memory/memory.h ../pc_system.h ../plugin.h \
../extplugin.h ../gui/gui.h ../gui/textconfig.h ../config.h \
@ -592,6 +597,11 @@ win32dialog.lo: win32dialog.@CPP_SUFFIX@ win32dialog.h ../config.h ../bochs.h \
../bxversion.h ../gui/siminterface.h ../memory/memory.h ../pc_system.h \
../plugin.h ../extplugin.h ../gui/gui.h ../gui/textconfig.h ../config.h \
../gui/keymap.h ../instrument/stubs/instrument.h win32res.h
win32_enh_dbg_osdep.lo: win32_enh_dbg_osdep.@CPP_SUFFIX@ win32dialog.h ../config.h ../bochs.h \
../config.h ../osdep.h ../bx_debug/debug.h ../config.h ../osdep.h \
../bxversion.h ../gui/siminterface.h ../memory/memory.h ../pc_system.h \
../plugin.h ../extplugin.h ../gui/gui.h ../gui/textconfig.h ../config.h \
../gui/keymap.h ../instrument/stubs/instrument.h win32res.h
wx.lo: wx.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h ../bx_debug/debug.h \
../bxversion.h ../gui/siminterface.h ../memory/memory.h ../pc_system.h \
../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h ../gui/textconfig.h \

3456
bochs/gui/enh_dbg.cc Executable file

File diff suppressed because it is too large Load Diff

68
bochs/gui/enh_dbg.h Executable file
View File

@ -0,0 +1,68 @@
#ifndef BX_ENH_DBG_DEF_H
#define BX_ENH_DBG_DEF_H
#include "win32dialog.h"
// FIXME: platform dependent!
#define TreeParent HTREEITEM
void MakeTreeChild (HTREEITEM *h_P, int ChildCount, HTREEITEM *h_TC);
void MoveLists();
void SetStatusText(int column, char *buf); // should it be here ?
void MakeListsGray();
void DispMessage(char *msg, char *title);
void InsertListRow(char *ColumnText[], int ColumnCount, int listnum, int LineCount, int grouping);
void StartListUpdate(int listnum);
void EndListUpdate(int listnum);
void RedrawColumns(int listnum);
void Invalidate(int i);
void TakeInputFocus();
bx_bool ShowAskDialog();
bx_bool NewFont();
void GrayMenuItem(int flag, int CmdIndex);
void ShowMemData(bx_bool initting);
void SetMenuCheckmark (int flag, int CmdIndex);
void ClearInputWindow();
void VSizeChange();
void ToggleWSchecks(int newWS, int oldWS);
void SetOutWinTxt();
void ShowFW();
void GetInputEntry(char *buf);
void SelectHistory(int UpDown);
void HideTree();
void FillPTree();
int GetASMTopIdx();
void ScrollASM(int pixels);
void GetLIText(int listnum, int itemnum, int column, char *buf);
void SetLIState(int listnum, int itemnum, bx_bool Select);
int GetNextSelectedLI(int listnum, int StartPt);
bx_bool OSInit();
void SpecialInit();
void dbgOnToggle(bx_bool on);
#define CHK_CMD_MODEB CMD_MODEB
#define CHK_CMD_ONECPU CMD_ONECPU
#define CHK_CMD_UCASE CMD_UCASE
#define CHK_CMD_IOWIN CMD_IOWIN
#define CHK_CMD_SBTN CMD_SBTN
#define CHK_CMD_MHEX CMD_MHEX
#define CHK_CMD_MASCII CMD_MASCII
#define CHK_CMD_LEND CMD_LEND
#define CHK_CMD_IGNSA CMD_IGNSA
#define CHK_CMD_IGNNT CMD_IGNNT
#define CHK_CMD_RCLR CMD_RCLR
#define CHK_CMD_EREG CMD_EREG
//#define CHK_CMD_SREG S_REG HIHI -- don't need these?
//#define CHK_CMD_SYSR SYS_R
//#define CHK_CMD_CREG C_REG
//#define CHK_CMD_FPUR FPU_R
//#define CHK_CMD_XMMR XMM_R
//#define CHK_CMD_DREG D_REG
//#define CHK_CMD_TREG T_REG
#endif

View File

@ -1,179 +1,114 @@
// include file for the Win32 Enhanced GUI debugger frontend
// include file for the Enhanced GUI debugger frontend
#ifndef BX_WENH_DBG_H
#define BX_WENH_DBG_H
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
// User Customizable initial settings:
bx_bool SeeReg[8] = {
TRUE, // in 64bit mode, show 32bit versions of registers also (EAX, ...)
FALSE, // show segment registers (CS, ...)
FALSE, // show GDTR, IDTR, LDTR, Task Reg
FALSE, // show control register (CR0, ...)
FALSE, // show FPU (STi) / MMX registers
FALSE, // show XMM registers
FALSE, // show the Debug Registers (DR0, ...)
FALSE // Test Registers not yet supported in bochs (2.3.7)
};
extern bx_bool SeeReg[8];
bx_bool ShowIOWindows = TRUE; // Display the top-row Step/Continue pushbuttons
bx_bool ShowButtons = TRUE; // Display the top-row Step/Continue pushbuttons
bx_bool SeeRegColors = TRUE; // Display registers with background color "groups"
bx_bool ignoreNxtT = TRUE; // Do not show "Next at t=" output lines
bx_bool ignSSDisasm = TRUE; // Do not show extra disassembly line at each break
int UprCase = 1; // 1 = convert all Asm, Register names, Register values to uppercase
int DumpInAsciiMode = 3; // bit 1 = show ASCII in dumps, bit 2 = show hex, value=0 is illegal
extern bx_bool SingleCPU; // Display all SMP CPUs
extern bx_bool ShowIOWindows; // Display the Input and Output Internal Debugger windows
extern bx_bool ShowButtons; // Display the top-row Step/Continue pushbuttons
extern bx_bool SeeRegColors; // Display registers with background color "groups"
extern bx_bool ignoreNxtT; // Do not show "Next at t=" output lines
extern bx_bool ignSSDisasm; // Do not show extra disassembly line at each break
extern int UprCase; // 1 = convert all Asm, Register names, Register values to uppercase
extern int DumpInAsciiMode; // bit 1 = show ASCII in dumps, bit 2 = show hex, value=0 is illegal
bx_bool isLittleEndian = TRUE;
int DefaultAsmLines = 250; // default # of asm lines disassembled and "cached"
int bottommargin = 6; // ASM autoscroller tries to leave this many lines below
int topmargin = 3; // autoscroller tries to leave this many lines above
extern bx_bool isLittleEndian;
extern int DefaultAsmLines; // default # of asm lines disassembled and "cached"
extern int bottommargin; // ASM autoscroller tries to leave this many lines below
extern int topmargin; // autoscroller tries to leave this many lines above
// Note: topmargin must be less than bottommargin
// How to use DockOrder: the Register list is window 1, ASM is window 2, MemDump is window 3
// Create the hex value with the digits in the order you want the windows to be.
// 0x312 would have MemDump on the left, Register in the middle, ASM on the right
short DockOrder = 0x123; // set the default List "docking" (Reg, ASM, Dump)
extern short DockOrder; // set the default List "docking" (Reg, ASM, Dump)
COLORREF ColorList[16] = { // background "register type" colors indexed by RegColor value
RGB(255,255,255), // white
RGB(200,255,255), // blue (aqua)
RGB(230,230,230), // gray
RGB(248,255,200), // yellow
RGB(216,216,255), // purple
RGB(200,255,200), // green
RGB(255,230,200), // orange
RGB(255,255,255), // user definable
RGB(255,255,255),
RGB(255,255,255),
RGB(255,255,255),
RGB(255,255,255),
RGB(255,255,255),
RGB(255,255,255),
RGB(255,255,255),
RGB(255,255,255)
};
#define STATUS_WIN_OVERLAP 4 // # of "extra" pixels at the top of a Status window
#define STACK_ENTRIES 50 // # of words/dwords/qwords to display in stack window
#define STACK_ENTRIES 50 // # of words/dwords/qwords to display in stack window
// Note: STACK_ENTRIES must be <= 512
// END of User Customizable settings
#include <math.h>
#include "iodev/iodev.h"
#include "wenhdbg_res.h" // MenuIDs
#ifndef LVS_EX_DOUBLEBUFFER
#define IS_WIN98
// these two defines may not exist in some compilers
#define LVS_EX_DOUBLEBUFFER 0
#define LVIF_GROUPID 0
#endif
#define MAX_ASM 2048 // max entries in ASM window
// The wordsize popup is the 13th entry in the Opt menu -- COUNTING SEPARATORS
// Index = (entry number - 1) -- if the Opt menu is modified, then update this value
// -- or else the checkmarks won't work
#define WS_POPUP_IDX 12
// Handles to Windows and global stuff
HWND hY; // complete parent window
HWND hL[3]; // 0=registers, 1=Asm, 2=MemDump
HWND hE_I; // command input window
HWND hS_S; // "status" window at bottom
HWND hE_O; // debugger text output
HWND hT; // param_tree window
HWND hBTN[5]; // button row
HWND hCPUt[BX_MAX_SMP_THREADS_SUPPORTED]; // "tabs" for the individual CPUs
HFONT CustomFont = NULL;
HMENU hOptMenu; // "Options" popup menu (needed to set check marks)
HMENU hViewMenu; // "View" popup menu (needed to gray entries)
HMENU hCmdMenu; // "Command" popup menu (needed to gray entries)
// one "defualtProc" for each edit window (Input and Output)
WNDPROC wEdit[2];
WNDPROC wBtn; // all the buttons have the same Proc
WNDPROC wTreeView;
WNDPROC wListView; // all the lists use the same Proc
//HANDLE hTCevent[BX_MAX_SMP_THREADS_SUPPORTED]; // Start/Sleep Control for cpu_loop threads
// get a "class" to access the disassebler
// Note; any instance has access to all the member functions -- that is enough!
// -- i.e. No further initialization necessary.
static disassembler bx_disassemble;
// for refreshing the bochs VGA window:
BOCHSAPI extern bx_devices_c bx_devices;
// Note: all these BSS global variables are initialized to 0 automatically
Bit64u SelectedDataAddress = 0;
Bit64u CurrentAsmLA = 0; // = EIP/RIP -- for highlighting in ASM window
Bit64u BottomAsmLA; // beginning and end addrs on ASM window
Bit64u TopAsmLA;
extern bx_bool SA_valid;
extern Bit64u SelectedDataAddress;
extern Bit64u CurrentAsmLA; // = EIP/RIP -- for highlighting in ASM window
extern Bit64u BottomAsmLA; // beginning and end addrs on ASM window
extern Bit64u TopAsmLA;
Bit32u PrevStepNSize = 50; // cpu_loop control variables
//Bit32u RequestedLoops; // number of cpu_loops the user is asking for
//bx_bool DoBreak; // stop a local subthreaded cpu_loop
Bit64u PrevPtime = 9; // any number other than 0
Bit64u NewPtime; // used to test whether sim has "updated"
unsigned int TotCPUs; // # of CPUs in a multi-CPU simulation
unsigned int CurrentCPU; // cpu that is being displayed
extern Bit32u PrevStepNSize; // cpu_loop control variables
//Bit32u RequestedLoops; // number of cpu_loops the user is asking for
//bx_bool DoBreak; // stop a local subthreaded cpu_loop
extern Bit64u PrevPtime; // any number other than 0
extern Bit64u NewPtime; // used to test whether sim has "updated"
extern unsigned TotCPUs; // # of CPUs in a multi-CPU simulation
extern unsigned CurrentCPU; // cpu that is being displayed
// AskTest stuff -- for the generic dialog box
struct ASKTEXT {
char* title;
char* prompt;
char* reply;
};
extern struct ASKTEXT ask_str;
// window resizing/docking stuff
HCURSOR hCursResize;
HCURSOR hCursDock;
HCURSOR hCursArrow;
LVHITTESTINFO lvht; // calculate and remember which list item was clicked
int OneCharWide; // average width of a char in current font
int Sizing = 0; // current "resizing/docking mode"
int Resize_HiX; // horizontal limits of the current resize operation
int Resize_LoX;
unsigned short BarScrx[2]; // position of central listview's left and right borders in SCREEN coordinates
unsigned short BarClix[2]; // in client coordinates
unsigned int ListWidthPix[3] = {5,7,8}; // set initial proportions of Reg, Asm, Dump windows
unsigned int LstTop = 0;
int CurCenterList;
int SizeList; // pre-docking list #
bx_bool DumpHasFocus = FALSE;
Bit32s xClick = -1; // halfway through a mouseclick flag + location
Bit32s yClick; // values are in Listview coordinates
Bit32u CurTimeStamp; // last mousedown time
short nDock[36] = { // lookup table for alternate DockOrders
0x231, 0x312, 0x231, 0x213, 0x132, 0x132,
0x213, 0x321, 0x123, 0x123, 0x321, 0x312,
0x213, 0x213, 0x123, 0x312, 0x321, 0x312,
0x132, 0x123, 0x132, 0x321, 0x231, 0x231,
0x312, 0x312, 0x231, 0x213, 0x132, 0x213,
0x132, 0x123, 0x321, 0x321, 0x123, 0x231
};
extern int OneCharWide; // average width of a char in current font (pixels)
extern int Sizing; // current "resizing/docking mode"
extern int Resize_HiX; // horizontal limits of the current resize operation (pixels)
extern int Resize_LoX;
extern unsigned ListWidthPix[3]; // set initial proportions of Reg, Asm, Dump windows
extern unsigned LstTop;
extern int CurCenterList;
extern int SizeList; // pre-docking list #
extern bx_bool DumpHasFocus;
extern Bit32s xClick; // halfway through a mouseclick flag + location
extern Bit32s yClick; // values are in Listview coordinates
extern Bit32u CurTimeStamp; // last mousedown time
// BarClix holds the x-axis position (in pixels or logical units) of the two resizing bars,
// in parent coordinates (ie. any window that contains the lists)
extern unsigned short BarClix[2];
// base window "styles" for the 3 listviews.
long LVStyle[3] = {
LVS_REPORT | WS_CHILD,
LVS_SHOWSELALWAYS | LVS_REPORT | WS_CHILD,
LVS_SHOWSELALWAYS | LVS_REPORT | WS_CHILD | WS_VISIBLE
};
extern bx_bool AtBreak; // Status indicators
extern bx_bool PrevAtBreak;
extern bx_bool CpuModeChange;
extern bx_bool StatusChange;
bx_bool AtBreak = FALSE; // Status indicators
bx_bool PrevAtBreak = FALSE;
bx_bool CpuModeChange = TRUE;
bx_bool StatusChange = TRUE;
extern bx_bool In64Mode; // CPU modes
extern bx_bool In32Mode;
extern unsigned CpuMode;
extern Bit32u InPaging; // Storage for the top bit of CR0, unmodified
bx_bool In64Mode = FALSE; // CPU modes
bx_bool In32Mode = FALSE;
unsigned CpuMode = 0;
Bit32u InPaging = 0; // Storage for the top bit of CR0, unmodified
extern bx_bool doOneTimeInit; // Internal flags
extern bx_bool ResizeColmns; // address/value column autosize flag
extern bx_bool FWflag; // friendly warning has been shown to user once already
extern int StackSized; // autosize flag for stack window
bx_bool doOneTimeInit = TRUE; // Internal flags
bx_bool ResizeColmns; // address/value column autosize flag
bx_bool dbgOn = FALSE; // the bochs internal debugger needs some time to get started
bx_bool FWflag = FALSE; // friendly warning has been shown to user once already
int StackSized; // autosize flag for stack window
extern char *PrevStack; // buffer for testing changes in stack values
extern Bit64u PStackLA; // to calculate alignment between prev and current stack
extern bx_bool StackEntChg[STACK_ENTRIES]; // flag for "change detected" on each stack line
extern bx_bool StkInvOnce; // sometimes need to specially invalidate the stack window
char *PrevStack; // buffer for testing changes in stack values
Bit64u PStackLA = 0; // to calculate alignment between prev and current stack
bx_bool StackEntChg[STACK_ENTRIES]; // flag for "change detected" on each stack line
bx_bool StkInvOnce = FALSE; // sometimes need to specially invalidate the stack window
// List Window indexes = DockOrder window numbers -1
#define REG_WND 0
#define ASM_WND 1
#define DUMP_WND 2
// DViewModes
#define VIEW_MEMDUMP 0
@ -181,41 +116,42 @@ bx_bool StkInvOnce = FALSE; // sometimes need to specially invalidate th
#define VIEW_IDT 2
#define VIEW_PAGING 3
#define VIEW_STACK 4
#define VIEW_PTREE 5
#define VIEW_BREAK 5
#define VIEW_PTREE 6
bx_bool DumpInitted = FALSE; // has the MemDump window ever been filled with data?
int DumpAlign = 1;
int PrevDAD; // saves "previous DumpAlign value" (forces column autosize)
char *DataDump;
Bit64u DumpStart = 0; // current emulated address (lin or phys) of DataDump
bx_bool doDumpRefresh;
int DViewMode = VIEW_MEMDUMP;
bx_bool DumpMode = 1; // 0 physical, 1 linear
char* DC0txt[2] = {"P.Address","L.Address"}; // DumpMode definitions in text
extern bx_bool DumpInitted; // has the MemDump window ever been filled with data?
extern int DumpAlign;
extern int PrevDAD; // saves "previous DumpAlign value" (forces column autosize)
extern char *DataDump;
extern Bit64u DumpStart; // current emulated address (lin or phys) of DataDump
extern bx_bool doDumpRefresh;
extern int DViewMode;
extern bx_bool LinearDump; // FALSE = memdump uses physical addressing
// make some global 512b temp char buffers -- they are needed to test against overflows anyway
char *tmpcb, *tmpcd; // space is allocated in bigbuf
char *tmpce, *tmpcf; // exclusively for use in subthreads
char *AsciiHex; // Unsigned char to printable hex xlat table
extern char *tmpcb; // 512b is allocated in bigbuf
extern char *AsmData; // 5K for binary disassembly data
extern char *CurStack; // Stack workspace (400b usually)
extern char *AsciiHex; // Unsigned char to printable hex xlat table
#define outbufSIZE 30720
char bigbuf[outbufSIZE]; // 30K preallocated storage for all char buffers (see DoAllInit)
char *DbgAppendPtr = bigbuf;
char *OutWindow; // buffer for the Output window
#define outbufSIZE 40960
extern char bigbuf[outbufSIZE]; // 40K preallocated storage for all char buffers (see DoAllInit)
extern char *DbgAppendPtr;
extern char *OutWindow; // buffer for the Output window
#define OutWinSIZE 10240
int OutWinCnt = OutWinSIZE; // available size of OutWindow buffer
int PO_Tdelay = 0; // delay before displaying partial output lines
extern int OutWinCnt; // available size of OutWindow buffer
extern int PO_Tdelay; // delay before displaying partial output lines
int AsmLineCount = 1; // # of disassembled asm lines loaded
int AsmPgSize = 0;
int ListLineRatio; // number of vertical pixels in a ListView Item
int ListVerticalPix; // number of vertical pixels in each List
Bit64u AsmLA[MAX_ASM]; // linear address of each disassembled ASM line
extern int AsmLineCount; // # of disassembled asm lines loaded
extern int AsmPgSize;
extern int ListLineRatio; // number of vertical pixels in a ListView Item
extern int ListVerticalPix; // number of vertical pixels in each List
extern Bit64u AsmLA[MAX_ASM]; // linear address of each disassembled ASM line
// Command stuff
int CommandHistoryIdx = 0;
char *CmdHistory[64]; // 64 command History storage (fixed 80b each)
int CmdHInsert = 0; // index of next history entry to store
extern int CommandHistoryIdx;
#define CmdHistorySize 64
extern char *CmdHistory[CmdHistorySize]; // 64 command History storage (fixed 80b each)
extern int CmdHInsert; // index of next history entry to store
// register storage -- names and values
#define RAX_Rnum 0
@ -320,71 +256,35 @@ int CmdHInsert = 0; // index of next history entry to store
#define XMMF_hi 96
#define EXTRA_REGS 28
char * EflBName[16] = {
"cf", "pf", "af", "zf", "sf", "tf", "if", "df", "of", "nt", "rf", "vm", "ac", "vif", "vip", "id"
};
int EflBNameLen[16] = {
2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,2
};
int EflBitVal[16] = {
1, 4, 0x10, 0x40, 0x80, 0x100, 0x200, 0x400, 0x800, 0x4000, 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000
};
// only pay special attention to registers up to EFER
char* RegLCName[EFER_Rnum + 1] = {
"rax","rbx","rcx","rdx","rsi","rdi","rbp","rsp","rip",
"r8","r9","r10","r11","r12","r13","r14","r15",
"eflags","eax","ebx","ecx","edx","esi","edi","ebp","esp","eip",
"cs","ds","es","ss","fs","gs",
"gdtr","idtr","ldtr","tr","cr0","cr3","cr4","efer"
};
char* RDispName[EFER_Rnum + 1];
bx_param_num_c *RegObject[BX_MAX_SMP_THREADS_SUPPORTED][TOT_REG_NUM + EXTRA_REGS];
Bit64u rV[EFER_Rnum + 1]; // current values of registers
Bit64u PV[EFER_Rnum + 1]; // previous values of registers
Bit32s GDT_Len; // "limits" (= bytesize-1) for GDT and IDT
Bit32s IDT_Len;
Bit8u RegColor[TOT_REG_NUM]; // specifies foreground and background color of registers
extern char* RDispName[EFER_Rnum + 1];
extern bx_param_num_c *RegObject[BX_MAX_SMP_THREADS_SUPPORTED][TOT_REG_NUM + EXTRA_REGS];
extern Bit64u rV[EFER_Rnum + 1]; // current values of registers
extern Bit64u PV[EFER_Rnum + 1]; // previous values of registers
extern Bit32s GDT_Len; // "limits" (= bytesize-1) for GDT and IDT
extern Bit32s IDT_Len;
extern Bit8u RegColor[TOT_REG_NUM]; // specifies foreground and background color of registers
// Text color is red if the upper bit is set. Background is set according to ColorList.
int RitemToRnum[TOT_REG_NUM]; // mapping from Reg List Item# to register number
extern int RitemToRnum[TOT_REG_NUM]; // mapping from Reg List Item# to register number
// lviG is a generic ListViewItem with GroupID -- reused many times
LV_ITEM lviG = {LVIF_TEXT | LVIF_GROUPID,0,0,0,0,(LPSTR)0,0,0,0};
TVINSERTSTRUCT tvis; // tree-view generic item
Bit64u ladrmin = 0; // bochs linear addressing access variables
Bit64u ladrmax = 0;
Bit64u l_p_offset;
#define BTN_BASE 1024
#define MULTICPU_BTN_BASE 1030
int BtnLkup[6] = {
CMD_CONT, CMD_STEP1, CMD_STEPN, CMD_BREAK, CMD_RFRSH, CMD_BRKALL
};
char* BTxt[6] = {"Continue [c]","Step [s]","Step N [s ###]","Break [^C]","Refresh","Break All"};
char* GDTt2[8] = {"16-bit code","64-bit code","32-bit code","16-bit data","64-bit data","32-bit data","Illegal","Unused"};
char* GDTsT[] = { "","Available 16bit TSS","LDT","Busy 16bit TSS","16bit Call Gate",
"Task Gate","16bit Interrupt Gate","16bit Trap Gate","Reserved",
"Available 32bit TSS","Reserved","Busy 32bit TSS","32bit Call Gate",
"Reserved","32bit Interrupt Gate","32bit Trap Gate"
};
// Register hex display formats -- index by UprCase
char* Fmt64b[2] = { "%016I64x", "%016I64X" };
char* Fmt32b[2] = { "%08x", "%08X" };
char* Fmt16b[2] = { "%04x", "%04X" };
char* xDT64Fmt[2] = { "%016I64x (%4x)", "%016I64X (%4X)" };
char* xDT32Fmt[2] = { "%08x (%4x)", "%08X (%4X)" };
extern Bit64u ladrmin; // bochs linear addressing access variables
extern Bit64u ladrmax;
extern Bit64u l_p_offset;
// do the linear breakpoint list as 2 arrays, rather than a structure -- much easier to search!
bx_address BrkLAddr[BX_DBG_MAX_LIN_BPOINTS];
unsigned int BrkIdx[BX_DBG_MAX_LIN_BPOINTS];
int BreakCount = 0;
extern bx_address BrkLAddr[BX_DBG_MAX_LIN_BPOINTS];
extern unsigned BrkIdx[BX_DBG_MAX_LIN_BPOINTS];
extern int BreakCount;
// AskTest stuff
struct ASKTEXT {
const TCHAR* ti;
const TCHAR* as;
TCHAR* re;
int DefT;
};
// Breakpoint Dump Window stuff
extern unsigned short BrkpIDMap[256];
extern unsigned short WWP_BaseEntry;
extern unsigned short RWP_BaseEntry;
extern unsigned short EndLinEntry;
extern unsigned short EndPhyEntry;
extern unsigned short WWPSnapCount;
extern unsigned short RWPSnapCount;
extern bx_phy_address WWP_Snapshot[16];
extern bx_phy_address RWP_Snapshot[16];
extern char UCtable[256];
#endif

View File

@ -1,55 +1,68 @@
#ifndef BX_ENH_DBG_RES_H
#define BX_ENH_DBG_RES_H
// The menuIDs should not have big "gaps" -- so the switch works well.
// A few small gaps is OK.
#define CMD_CONT 101
#define CMD_STEP1 102
#define CMD_STEPN 103
#define CMD_BREAK 104
#define CMD_BREAK 105
#define CMD_BRKALL 106
#define CMD_BRKPT 107
#define CMD_WPTWR 108
#define CMD_WPTRD 109
#define CMD_FIND 110
#define CMD_RFRSH 111
// View Menu:
#define CMD_PHYDMP 113
#define CMD_LINDMP 114
#define CMD_STACK 115
#define CMD_GDTV 116
#define CMD_IDTV 117
#define CMD_PAGEV 118
#define CMD_CMEM 119
#define CMD_PTREE 120
#define CMD_DISASM 121
// It is important that all the menuIDs on the "Options" menu be higher than on any other menu
// It is important that CMD_MODEB be the lowest menuID on the option window
#define CMD_MODEB 123
#define CMD_DADEF 124
#define CMD_ATTI 125
#define CMD_FONT 126
#define CMD_IOWIN 127
#define CMD_SBTN 128
#define CMD_UCASE 129
#define CMD_MHEX 130
#define CMD_MASCII 131
#define CMD_LEND 132
// The CMD_WS menuID's must be strictly "contiguous" and in-order
#define CMD_WS_1 133
#define CMD_WS_2 134
#define CMD_WS_4 135
#define CMD_WS_8 136
#define CMD_WS16 137
#define CMD_IGNSA 138
#define CMD_IGNNT 139
#define CMD_RCLR 140
#define CMD_VBRK 120
#define CMD_CMEM 121
#define CMD_PTREE 122
#define CMD_DISASM 123
// Options Menu:
#define CMD_MODEB 125
#define CMD_XCEPT 126
#define CMD_ONECPU 127
#define CMD_DADEF 128
#define CMD_ATTI 129
#define CMD_FONT 130
#define CMD_UCASE 131
#define CMD_IOWIN 132
#define CMD_SBTN 133
#define CMD_MHEX 134
#define CMD_MASCII 135
#define CMD_LEND 136
#define CMD_IGNSA 139
#define CMD_IGNNT 140
#define CMD_RCLR 141
// The next 8 menuID's must be strictly "contiguous" and in-order
#define CMD_EREG 141
#define CMD_SREG 142
#define CMD_SYSR 143
#define CMD_CREG 144
#define CMD_FPUR 145
#define CMD_XMMR 146
#define CMD_DREG 147
#define CMD_TREG 148
#define CMD_EREG 142
#define CMD_SREG 143
#define CMD_SYSR 144
#define CMD_CREG 145
#define CMD_FPUR 146
#define CMD_XMMR 147
#define CMD_DREG 148
#define CMD_TREG 149
#define CMD_ABOUT 149
#define CMD_ABOUT 150
// The CMD_WS popup menuID's must be strictly "contiguous" and in-order
#define CMD_WS_1 160
#define CMD_WS_2 161
#define CMD_WS_4 162
#define CMD_WS_8 163
#define CMD_WS16 164
#define MI_FIRST_VIEWITEM CMD_PHYDMP
#define MI_FIRST_OPTITEM CMD_MODEB
#define CMD_IDX_HI CMD_WS16
#define CMD_IDX_LO CMD_CONT
#endif

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32.cc,v 1.121 2008-10-06 22:00:11 sshwarts Exp $
// $Id: win32.cc,v 1.122 2008-12-27 12:06:39 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -178,7 +178,7 @@ static BOOL BxTextMode = TRUE;
static BOOL legacyF12 = FALSE;
static BOOL fix_size = FALSE;
#if BX_DEBUGGER
static BOOL windebug = FALSE;
static BOOL gui_debug = FALSE;
#endif
static HWND hotKeyReceiver = NULL;
static HWND saveParent = NULL;
@ -655,8 +655,8 @@ void bx_win32_gui_c::specific_init(int argc, char **argv, unsigned
if (!strcmp(argv[i], "legacyF12")) {
legacyF12 = TRUE;
#if BX_DEBUGGER
} else if (!strcmp(argv[i], "windebug")) {
windebug = TRUE;
} else if (!strcmp(argv[i], "gui_debug")) {
gui_debug = TRUE;
SIM->set_debug_gui(1);
#endif
} else {
@ -920,7 +920,7 @@ VOID CDECL UIThread(PVOID pvoid)
resize_main_window();
ShowWindow(stInfo.mainWnd, SW_SHOW);
#if BX_DEBUGGER
if (windebug) {
if (gui_debug) {
InitDebugDialog(stInfo.mainWnd);
}
#endif

File diff suppressed because it is too large Load Diff

1805
bochs/gui/win32_enh_dbg_osdep.cc Executable file

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32dialog.cc,v 1.64 2008-12-18 15:37:25 vruppert Exp $
// $Id: win32dialog.cc,v 1.65 2008-12-27 12:06:39 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
#include "win32dialog.h"
@ -15,8 +15,8 @@ static bxevent_handler old_callback = NULL;
static void *old_callback_arg = NULL;
#if BX_DEBUGGER
HWND hDebugDialog = NULL;
char *debug_cmd = NULL;
BOOL debug_cmd_ready = FALSE;
extern char *debug_cmd;
extern bx_bool debug_cmd_ready;
#endif
int AskFilename(HWND hwnd, bx_param_filename_c *param, const char *ext);

View File

@ -1,7 +1,10 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32dialog.h,v 1.12 2008-10-21 13:45:03 sshwarts Exp $
// $Id: win32dialog.h,v 1.13 2008-12-27 12:06:39 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
#ifndef BX_WIN32_DIALOGS_H
#define BX_WIN32_DIALOGS_H
#include "config.h"
#ifndef _WIN32_IE
@ -25,9 +28,11 @@ extern "C" {
int RuntimeOptionsDialog();
#if BX_DEBUGGER
void InitDebugDialog(HWND mainwnd);
void InitDebugDialog(void* mainwnd);
void RefreshDebugDialog();
#endif
void win32_init_notify_callback();
#endif
#endif // BX_WIN32_DIALOGS_H