~ubuntu-branches/ubuntu/saucy/bochs/saucy-proposed

« back to all changes in this revision

Viewing changes to gui/enh_dbg.h

  • Committer: Bazaar Package Importer
  • Author(s): David Futcher
  • Date: 2009-04-30 07:46:11 UTC
  • mfrom: (1.1.11 upstream) (4.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090430074611-6dih80a5mk2uvxhk
Tags: 2.3.7+20090416-1ubuntu1
* Merge from debian unstable (LP: #370427), remaining changes:
  - debian/patches/12_no-ssp.patch: Build bios with -fno-stack-protector
  - Add Replaces/Conflicts for bochsbios-qemu (<< 2.3.6-2)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/////////////////////////////////////////////////////////////////////////
 
2
// $Id: enh_dbg.h,v 1.13 2009/04/12 05:52:38 sshwarts Exp $
 
3
/////////////////////////////////////////////////////////////////////////
 
4
//
 
5
//  BOCHS ENHANCED DEBUGGER Ver 1.2
 
6
//  (C) Chourdakis Michael, 2008
 
7
//  http://www.turboirc.com
 
8
//
 
9
//  Modified by Bruce Ewing
 
10
//
 
11
 
 
12
#ifndef BX_ENH_DBG_DEF_H
 
13
#define BX_ENH_DBG_DEF_H
 
14
 
 
15
#if BX_DEBUGGER && BX_DEBUGGER_GUI
 
16
 
 
17
#ifndef IS_WIN98
 
18
// workaround broken code if IS_WIN98 not defined
 
19
#define IS_WIN98
 
20
#endif
 
21
 
 
22
#ifndef FALSE
 
23
#define FALSE 0
 
24
#endif
 
25
 
 
26
#ifndef TRUE
 
27
#define TRUE  1
 
28
#endif
 
29
 
 
30
void MoveLists();
 
31
void SetStatusText(int column, const char *buf); // should it be here ?
 
32
void MakeListsGray();
 
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();
 
41
bx_bool NewFont();
 
42
void GrayMenuItem(int flag, int CmdIndex);
 
43
void ShowMemData(bx_bool initting);
 
44
void SetMenuCheckmark (int flag, int CmdIndex);
 
45
void ClearInputWindow();
 
46
void VSizeChange();
 
47
void ToggleWSchecks(int newWS, int oldWS);
 
48
void SetOutWinTxt();
 
49
void ShowFW();
 
50
void GetInputEntry(char *buf);
 
51
void SelectHistory(int UpDown);
 
52
void DelWatchpoint(bx_phy_address *wp_array, unsigned *TotEntries, int i);
 
53
 
 
54
void HideTree();
 
55
void FillPTree();
 
56
 
 
57
int GetASMTopIdx();
 
58
void ScrollASM(int pixels);
 
59
 
 
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);
 
63
 
 
64
bx_bool OSInit();
 
65
void SpecialInit();
 
66
 
 
67
void HitBreak();
 
68
void ParseIDText(const char *x);
 
69
 
 
70
extern char *debug_cmd;
 
71
extern bx_bool debug_cmd_ready;
 
72
extern bx_bool vgaw_refresh;
 
73
 
 
74
#ifdef WIN32
 
75
 
 
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
 
88
 
 
89
#else // GTK+
 
90
 
 
91
// checkmark indices
 
92
#define MODE_BRK    0
 
93
#define ONE_CPU     1
 
94
#define U_CASE      2
 
95
#define IO_WIN      3
 
96
#define SHOW_BTN    4
 
97
#define MD_HEX      5
 
98
#define MD_ASC      6
 
99
#define L_END       7
 
100
#define IGN_SA      8
 
101
#define IGN_NT      9
 
102
#define R_CLR       10
 
103
#define E_REG       11
 
104
#define S_REG       12
 
105
#define SYS_R       13
 
106
#define C_REG       14
 
107
#define FPU_R       15
 
108
#define XMM_R       16
 
109
#define D_REG       17
 
110
//#define T_REG     18
 
111
 
 
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
 
124
 
 
125
#endif
 
126
 
 
127
#ifndef WIN32
 
128
 
 
129
// Need to define my version of the win32 "virtual keys"
 
130
 
 
131
#define VK_PRIOR    65365
 
132
#define VK_NEXT     65366
 
133
#define VK_F2       65471
 
134
#define VK_F3       65472
 
135
#define VK_F4       65473
 
136
#define VK_F5       65474
 
137
#define VK_F6       65475
 
138
#define VK_F7       65476
 
139
#define VK_F8       65477
 
140
#define VK_F9       65478
 
141
#define VK_F11      65480
 
142
#define VK_UP       65362
 
143
#define VK_DOWN     65364
 
144
#define VK_RETURN   65293
 
145
#define VK_LEFT     65361
 
146
#define VK_RIGHT    65363
 
147
#define VK_END      65367
 
148
#define VK_HOME     65360
 
149
#define VK_DELETE   65535
 
150
#define VK_ESCAPE   65307
 
151
 
 
152
#endif
 
153
 
 
154
// User Customizable initial settings:
 
155
 
 
156
extern bx_bool SeeReg[8];
 
157
 
 
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
 
166
 
 
167
extern bx_bool isLittleEndian;
 
168
 
 
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)
 
173
 
 
174
#define STACK_ENTRIES       50 // # of words/dwords/qwords to display in stack window
 
175
// Note: STACK_ENTRIES must be <= 512
 
176
 
 
177
// END of User Customizable settings
 
178
 
 
179
#ifndef WIN32
 
180
#define FMT_LLCAPX  "%016llX"
 
181
#else
 
182
#define FMT_LLCAPX  "%016I64X"
 
183
#endif
 
184
 
 
185
#define MAX_ASM         2048    // max entries in ASM window
 
186
 
 
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;
 
192
 
 
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
 
197
 
 
198
// AskTest stuff -- for the generic dialog box
 
199
struct ASKTEXT {
 
200
    const char* title;
 
201
    const char* prompt;
 
202
    char* reply;
 
203
};
 
204
 
 
205
extern struct ASKTEXT ask_str;
 
206
 
 
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;
 
215
 
 
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];
 
219
 
 
220
extern bx_bool AtBreak;        // Status indicators
 
221
extern bx_bool StatusChange;
 
222
 
 
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
 
226
 
 
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
 
229
 
 
230
// List Window indexes = DockOrder window numbers -1
 
231
#define REG_WND     0
 
232
#define ASM_WND     1
 
233
#define DUMP_WND    2
 
234
 
 
235
// DViewModes
 
236
#define VIEW_MEMDUMP    0
 
237
#define VIEW_GDT        1
 
238
#define VIEW_IDT        2
 
239
#define VIEW_PAGING     3
 
240
#define VIEW_STACK      4
 
241
#define VIEW_BREAK      5
 
242
#define VIEW_PTREE      6
 
243
 
 
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
 
251
 
 
252
extern char *tmpcb;            // 512b is allocated in bigbuf
 
253
extern char *AsciiHex;         // Unsigned char to printable hex xlat table
 
254
 
 
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
 
260
 
 
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
 
266
 
 
267
// Command stuff
 
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
 
272
 
 
273
// register storage -- names and values
 
274
#define RAX_Rnum    0
 
275
#define RBX_Rnum    1
 
276
#define RCX_Rnum    2
 
277
#define RDX_Rnum    3
 
278
#define RSI_Rnum    4
 
279
#define RDI_Rnum    5
 
280
#define RBP_Rnum    6
 
281
#define RSP_Rnum    7
 
282
#define RIP_Rnum    8
 
283
#define R8_Rnum     9
 
284
#define R9_Rnum     10
 
285
#define R10_Rnum    11
 
286
#define R11_Rnum    12
 
287
#define R12_Rnum    13
 
288
#define R13_Rnum    14
 
289
#define R14_Rnum    15
 
290
#define R15_Rnum    16
 
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
 
293
#define EBX_Rnum    19
 
294
#define ECX_Rnum    20
 
295
#define EDX_Rnum    21
 
296
#define ESI_Rnum    22
 
297
#define EDI_Rnum    23
 
298
#define EBP_Rnum    24
 
299
#define ESP_Rnum    25
 
300
#define EIP_Rnum    26
 
301
#define CS_Rnum     27
 
302
#define DS_Rnum     28
 
303
#define ES_Rnum     29
 
304
#define SS_Rnum     30
 
305
#define FS_Rnum     31
 
306
#define GS_Rnum     32
 
307
#define GDTRnum     33
 
308
#define IDTRnum     34
 
309
#define LDTRnum     35
 
310
#define TRRnum      36
 
311
#define CR0_Rnum    37
 
312
#define CR3_Rnum    38
 
313
#define CR4_Rnum    39
 
314
#define EFER_Rnum   40      // currently used to mark the last entry in rV[]
 
315
#define ST0_Rnum    41
 
316
#define ST1_Rnum    42
 
317
#define ST2_Rnum    43
 
318
#define ST3_Rnum    44
 
319
#define ST4_Rnum    45
 
320
#define ST5_Rnum    46
 
321
#define ST6_Rnum    47
 
322
#define ST7_Rnum    48
 
323
#define XMM0_Rnum   49
 
324
#define XMM1_Rnum   50
 
325
#define XMM2_Rnum   51
 
326
#define XMM3_Rnum   52
 
327
#define XMM4_Rnum   53
 
328
#define XMM5_Rnum   54
 
329
#define XMM6_Rnum   55
 
330
#define XMM7_Rnum   56
 
331
#define XMM8_Rnum   57
 
332
#define XMM9_Rnum   58
 
333
#define XMMA_Rnum   59
 
334
#define XMMB_Rnum   60
 
335
#define XMMC_Rnum   61
 
336
#define XMMD_Rnum   62
 
337
#define XMME_Rnum   63
 
338
#define XMMF_Rnum   64
 
339
#define DR0_Rnum    65
 
340
#define DR1_Rnum    66
 
341
#define DR2_Rnum    67
 
342
#define DR3_Rnum    68
 
343
#define DR6_Rnum    69
 
344
#define DR7_Rnum    70
 
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
 
348
#define GDTR_Lim    72
 
349
#define IDTR_Lim    73
 
350
#define ST0_exp     74
 
351
#define ST1_exp     75
 
352
#define ST2_exp     76
 
353
#define ST3_exp     77
 
354
#define ST4_exp     78
 
355
#define ST5_exp     79
 
356
#define ST6_exp     80
 
357
#define ST7_exp     81
 
358
#define XMM0_hi     82
 
359
#define XMM1_hi     82
 
360
#define XMM2_hi     83
 
361
#define XMM3_hi     84
 
362
#define XMM4_hi     85
 
363
#define XMM5_hi     86
 
364
#define XMM6_hi     87
 
365
#define XMM7_hi     88
 
366
#define XMM8_hi     89
 
367
#define XMM9_hi     90
 
368
#define XMMA_hi     91
 
369
#define XMMB_hi     92
 
370
#define XMMC_hi     93
 
371
#define XMMD_hi     94
 
372
#define XMME_hi     95
 
373
#define XMMF_hi     96
 
374
#define EXTRA_REGS  28
 
375
 
 
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
 
379
 
 
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;
 
383
 
 
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];
 
394
 
 
395
extern int SizeList;
 
396
extern Bit32s xClick;          // halfway through a mouseclick flag + location
 
397
extern Bit32s yClick;          // values are in Listview coordinates
 
398
 
 
399
#include "wenhdbg_res.h"    // MenuIDs
 
400
 
 
401
static const char* DC0txt[2] = {"P.Address","L.Address"};    // DumpMode definitions in text
 
402
 
 
403
static const char* BTxt[6] = {
 
404
  "Continue [c]",
 
405
  "Step [s]",
 
406
  "Step N [s ###]",
 
407
  "Refresh",
 
408
  "Break [^C]",
 
409
  "Break All"};
 
410
 
 
411
static int BtnLkup[6] = {
 
412
    CMD_CONT, CMD_STEP1, CMD_STEPN, CMD_RFRSH, CMD_BREAK
 
413
};
 
414
 
 
415
#endif
 
416
 
 
417
#endif