1
/////////////////////////////////////////////////////////////////////////
2
// $Id: enh_dbg.h,v 1.13 2009/04/12 05:52:38 sshwarts Exp $
3
/////////////////////////////////////////////////////////////////////////
5
// BOCHS ENHANCED DEBUGGER Ver 1.2
6
// (C) Chourdakis Michael, 2008
7
// http://www.turboirc.com
9
// Modified by Bruce Ewing
12
#ifndef BX_ENH_DBG_DEF_H
13
#define BX_ENH_DBG_DEF_H
15
#if BX_DEBUGGER && BX_DEBUGGER_GUI
18
// workaround broken code if IS_WIN98 not defined
31
void SetStatusText(int column, const char *buf); // should it be here ?
33
void DispMessage(const char *msg, const char *title);
34
void InsertListRow(char *ColumnText[], int ColumnCount, int listnum, int LineCount, int grouping);
35
void StartListUpdate(int listnum);
36
void EndListUpdate(int listnum);
37
void RedrawColumns(int listnum);
38
void Invalidate(int i);
39
void TakeInputFocus();
40
bx_bool ShowAskDialog();
42
void GrayMenuItem(int flag, int CmdIndex);
43
void ShowMemData(bx_bool initting);
44
void SetMenuCheckmark (int flag, int CmdIndex);
45
void ClearInputWindow();
47
void ToggleWSchecks(int newWS, int oldWS);
50
void GetInputEntry(char *buf);
51
void SelectHistory(int UpDown);
52
void DelWatchpoint(bx_phy_address *wp_array, unsigned *TotEntries, int i);
58
void ScrollASM(int pixels);
60
void GetLIText(int listnum, int itemnum, int column, char *buf);
61
void SetLIState(int listnum, int itemnum, bx_bool Select);
62
int GetNextSelectedLI(int listnum, int StartPt);
68
void ParseIDText(const char *x);
70
extern char *debug_cmd;
71
extern bx_bool debug_cmd_ready;
72
extern bx_bool vgaw_refresh;
76
#define CHK_CMD_MODEB CMD_MODEB
77
#define CHK_CMD_ONECPU CMD_ONECPU
78
#define CHK_CMD_UCASE CMD_UCASE
79
#define CHK_CMD_IOWIN CMD_IOWIN
80
#define CHK_CMD_SBTN CMD_SBTN
81
#define CHK_CMD_MHEX CMD_MHEX
82
#define CHK_CMD_MASCII CMD_MASCII
83
#define CHK_CMD_LEND CMD_LEND
84
#define CHK_CMD_IGNSA CMD_IGNSA
85
#define CHK_CMD_IGNNT CMD_IGNNT
86
#define CHK_CMD_RCLR CMD_RCLR
87
#define CHK_CMD_EREG CMD_EREG
112
#define CHK_CMD_MODEB MODE_BRK
113
#define CHK_CMD_ONECPU ONE_CPU
114
#define CHK_CMD_UCASE U_CASE
115
#define CHK_CMD_IOWIN IO_WIN
116
#define CHK_CMD_SBTN SHOW_BTN
117
#define CHK_CMD_MHEX MD_HEX
118
#define CHK_CMD_MASCII MD_ASC
119
#define CHK_CMD_LEND L_END
120
#define CHK_CMD_IGNSA IGN_SA
121
#define CHK_CMD_IGNNT IGN_NT
122
#define CHK_CMD_RCLR R_CLR
123
#define CHK_CMD_EREG E_REG
129
// Need to define my version of the win32 "virtual keys"
131
#define VK_PRIOR 65365
132
#define VK_NEXT 65366
143
#define VK_DOWN 65364
144
#define VK_RETURN 65293
145
#define VK_LEFT 65361
146
#define VK_RIGHT 65363
148
#define VK_HOME 65360
149
#define VK_DELETE 65535
150
#define VK_ESCAPE 65307
154
// User Customizable initial settings:
156
extern bx_bool SeeReg[8];
158
extern bx_bool SingleCPU; // Display all SMP CPUs
159
extern bx_bool ShowIOWindows; // Display the Input and Output Internal Debugger windows
160
extern bx_bool ShowButtons; // Display the top-row Step/Continue pushbuttons
161
extern bx_bool SeeRegColors; // Display registers with background color "groups"
162
extern bx_bool ignoreNxtT; // Do not show "Next at t=" output lines
163
extern bx_bool ignSSDisasm; // Do not show extra disassembly line at each break
164
extern int UprCase; // 1 = convert all Asm, Register names, Register values to uppercase
165
extern int DumpInAsciiMode; // bit 1 = show ASCII in dumps, bit 2 = show hex, value=0 is illegal
167
extern bx_bool isLittleEndian;
169
// How to use DockOrder: the Register list is window 1, ASM is window 2, MemDump is window 3
170
// Create the hex value with the digits in the order you want the windows to be.
171
// 0x312 would have MemDump on the left, Register in the middle, ASM on the right
172
extern short DockOrder; // set the default List "docking" (Reg, ASM, Dump)
174
#define STACK_ENTRIES 50 // # of words/dwords/qwords to display in stack window
175
// Note: STACK_ENTRIES must be <= 512
177
// END of User Customizable settings
180
#define FMT_LLCAPX "%016llX"
182
#define FMT_LLCAPX "%016I64X"
185
#define MAX_ASM 2048 // max entries in ASM window
187
extern bx_bool SA_valid;
188
extern Bit64u SelectedDataAddress;
189
extern Bit64u CurrentAsmLA; // = EIP/RIP -- for highlighting in ASM window
190
extern Bit64u BottomAsmLA; // beginning and end addrs on ASM window
191
extern Bit64u TopAsmLA;
193
extern Bit64u PrevPtime; // any number other than 0
194
extern Bit64u NewPtime; // used to test whether sim has "updated"
195
extern unsigned TotCPUs; // # of CPUs in a multi-CPU simulation
196
extern unsigned CurrentCPU; // cpu that is being displayed
198
// AskTest stuff -- for the generic dialog box
205
extern struct ASKTEXT ask_str;
207
// window resizing/docking stuff
208
extern int OneCharWide; // average width of a char in current font (pixels)
209
extern int Sizing; // current "resizing/docking mode"
210
extern int Resize_HiX; // horizontal limits of the current resize operation (pixels)
211
extern int Resize_LoX;
212
extern unsigned ListWidthPix[3]; // set initial proportions of Reg, Asm, Dump windows
213
extern int CurCenterList;
214
extern bx_bool DumpHasFocus;
216
// BarClix holds the x-axis position (in pixels or logical units) of the two resizing bars,
217
// in parent coordinates (ie. any window that contains the lists)
218
extern unsigned short BarClix[2];
220
extern bx_bool AtBreak; // Status indicators
221
extern bx_bool StatusChange;
223
extern bx_bool doOneTimeInit; // Internal flags
224
extern bx_bool ResizeColmns; // address/value column autosize flag
225
extern bx_bool FWflag; // friendly warning has been shown to user once already
227
extern Bit64u PStackLA; // to calculate alignment between prev and current stack
228
extern bx_bool StackEntChg[STACK_ENTRIES]; // flag for "change detected" on each stack line
230
// List Window indexes = DockOrder window numbers -1
236
#define VIEW_MEMDUMP 0
239
#define VIEW_PAGING 3
244
extern bx_bool DumpInitted; // has the MemDump window ever been filled with data?
245
extern int DumpAlign;
246
extern int PrevDAD; // saves "previous DumpAlign value" (forces column autosize)
247
extern Bit64u DumpStart; // current emulated address (lin or phys) of DataDump
248
extern bx_bool doDumpRefresh;
249
extern int DViewMode;
250
extern bx_bool LinearDump; // FALSE = memdump uses physical addressing
252
extern char *tmpcb; // 512b is allocated in bigbuf
253
extern char *AsciiHex; // Unsigned char to printable hex xlat table
255
#define outbufSIZE 40960
256
extern char bigbuf[outbufSIZE]; // 40K preallocated storage for all char buffers (see DoAllInit)
257
extern char *OutWindow; // buffer for the Output window
258
#define OutWinSIZE 10240
259
extern int PO_Tdelay; // delay before displaying partial output lines
261
extern int AsmPgSize;
262
extern int ListLineRatio; // number of vertical pixels in a ListView Item
263
extern int ListVerticalPix; // number of vertical pixels in each List
264
extern int AsmLineCount; // # of disassembled asm lines loaded
265
extern Bit64u AsmLA[MAX_ASM]; // linear address of each disassembled ASM line
268
extern int CommandHistoryIdx;
269
#define CmdHistorySize 64
270
extern char *CmdHistory[CmdHistorySize]; // 64 command History storage (fixed 80b each)
271
extern int CmdHInsert; // index of next history entry to store
273
// register storage -- names and values
291
#define EFL_Rnum 17 // it makes the most sense if EFLAGS is between RXX and EXX
292
#define EAX_Rnum 18 // because it "belongs with" both sets of GP registers
314
#define EFER_Rnum 40 // currently used to mark the last entry in rV[]
345
// #define TR0_Rnum 71 -- put Test Registers in here when they are supported
346
#define TOT_REG_NUM 72
347
// extra "register numbers" for registers that have more than one part
374
#define EXTRA_REGS 28
376
extern Bit8u RegColor[TOT_REG_NUM]; // specifies foreground and background color of registers
377
// Text color is red if the upper bit is set. Background is set according to ColorList.
378
extern int RitemToRnum[TOT_REG_NUM]; // mapping from Reg List Item# to register number
380
// do the linear breakpoint list as 2 arrays, rather than a structure -- much easier to search!
381
extern bx_address BrkLAddr[BX_DBG_MAX_LIN_BPOINTS];
382
extern int BreakCount;
384
// Breakpoint Dump Window stuff
385
extern unsigned short BrkpIDMap[256];
386
extern unsigned short WWP_BaseEntry;
387
extern unsigned short RWP_BaseEntry;
388
extern unsigned short EndLinEntry;
389
extern unsigned short EndPhyEntry;
390
extern unsigned short WWPSnapCount;
391
extern unsigned short RWPSnapCount;
392
extern bx_phy_address WWP_Snapshot[16];
393
extern bx_phy_address RWP_Snapshot[16];
396
extern Bit32s xClick; // halfway through a mouseclick flag + location
397
extern Bit32s yClick; // values are in Listview coordinates
399
#include "wenhdbg_res.h" // MenuIDs
401
static const char* DC0txt[2] = {"P.Address","L.Address"}; // DumpMode definitions in text
403
static const char* BTxt[6] = {
411
static int BtnLkup[6] = {
412
CMD_CONT, CMD_STEP1, CMD_STEPN, CMD_RFRSH, CMD_BREAK