1 | /* $Id: DBGCInternal.h 76564 2019-01-01 03:57:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * DBGC - Debugger Console, Internal Header File.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2019 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef DEBUGGER_INCLUDED_SRC_DBGCInternal_h
|
---|
19 | #define DEBUGGER_INCLUDED_SRC_DBGCInternal_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 |
|
---|
25 | /*******************************************************************************
|
---|
26 | * Header Files *
|
---|
27 | *******************************************************************************/
|
---|
28 | #include <VBox/dbg.h>
|
---|
29 | #include <VBox/err.h>
|
---|
30 |
|
---|
31 |
|
---|
32 | /*******************************************************************************
|
---|
33 | * Structures and Typedefs *
|
---|
34 | *******************************************************************************/
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * Debugger console per breakpoint data.
|
---|
38 | */
|
---|
39 | typedef struct DBGCBP
|
---|
40 | {
|
---|
41 | /** Pointer to the next breakpoint in the list. */
|
---|
42 | struct DBGCBP *pNext;
|
---|
43 | /** The breakpoint identifier. */
|
---|
44 | uint32_t iBp;
|
---|
45 | /** The size of the command. */
|
---|
46 | size_t cchCmd;
|
---|
47 | /** The command to execute when the breakpoint is hit. */
|
---|
48 | char szCmd[1];
|
---|
49 | } DBGCBP;
|
---|
50 | /** Pointer to a breakpoint. */
|
---|
51 | typedef DBGCBP *PDBGCBP;
|
---|
52 |
|
---|
53 |
|
---|
54 | typedef enum DBGCEVTSTATE
|
---|
55 | {
|
---|
56 | kDbgcEvtState_Invalid = 0,
|
---|
57 | kDbgcEvtState_Disabled,
|
---|
58 | kDbgcEvtState_Enabled,
|
---|
59 | kDbgcEvtState_Notify
|
---|
60 | } DBGCEVTSTATE;
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * Debugger console per event configuration.
|
---|
64 | */
|
---|
65 | typedef struct DBGCEVTCFG
|
---|
66 | {
|
---|
67 | /** The event state. */
|
---|
68 | DBGCEVTSTATE enmState;
|
---|
69 | /** The size of the command. */
|
---|
70 | size_t cchCmd;
|
---|
71 | /** The command to execute when the event occurs. */
|
---|
72 | char szCmd[1];
|
---|
73 | } DBGCEVTCFG;
|
---|
74 | /** Pointer to a event configuration. */
|
---|
75 | typedef DBGCEVTCFG *PDBGCEVTCFG;
|
---|
76 | /** Pointer to a const event configuration. */
|
---|
77 | typedef DBGCEVTCFG const *PCDBGCEVTCFG;
|
---|
78 |
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * Named variable.
|
---|
82 | *
|
---|
83 | * Always allocated from heap in one single block.
|
---|
84 | */
|
---|
85 | typedef struct DBGCNAMEDVAR
|
---|
86 | {
|
---|
87 | /** The variable. */
|
---|
88 | DBGCVAR Var;
|
---|
89 | /** Its name. */
|
---|
90 | char szName[1];
|
---|
91 | } DBGCNAMEDVAR;
|
---|
92 | /** Pointer to named variable. */
|
---|
93 | typedef DBGCNAMEDVAR *PDBGCNAMEDVAR;
|
---|
94 |
|
---|
95 |
|
---|
96 | /**
|
---|
97 | * Debugger console status
|
---|
98 | */
|
---|
99 | typedef enum DBGCSTATUS
|
---|
100 | {
|
---|
101 | /** Normal status, .*/
|
---|
102 | DBGC_HALTED
|
---|
103 |
|
---|
104 | } DBGCSTATUS;
|
---|
105 |
|
---|
106 |
|
---|
107 | /**
|
---|
108 | * Debugger console instance data.
|
---|
109 | */
|
---|
110 | typedef struct DBGC
|
---|
111 | {
|
---|
112 | /** Command helpers. */
|
---|
113 | DBGCCMDHLP CmdHlp;
|
---|
114 | /** Wrappers for DBGF output. */
|
---|
115 | DBGFINFOHLP DbgfOutputHlp;
|
---|
116 | /** Pointer to backend callback structure. */
|
---|
117 | PDBGCBACK pBack;
|
---|
118 |
|
---|
119 | /** Pointer to the current VM. */
|
---|
120 | PVM pVM;
|
---|
121 | /** The user mode handle of the current VM. */
|
---|
122 | PUVM pUVM;
|
---|
123 | /** The ID of current virtual CPU. */
|
---|
124 | VMCPUID idCpu;
|
---|
125 | /** The current address space handle. */
|
---|
126 | RTDBGAS hDbgAs;
|
---|
127 | /** The current debugger emulation. */
|
---|
128 | const char *pszEmulation;
|
---|
129 | /** Pointer to the commands for the current debugger emulation. */
|
---|
130 | PCDBGCCMD paEmulationCmds;
|
---|
131 | /** The number of commands paEmulationCmds points to. */
|
---|
132 | uint32_t cEmulationCmds;
|
---|
133 | /** Pointer to the functions for the current debugger emulation. */
|
---|
134 | PCDBGCFUNC paEmulationFuncs;
|
---|
135 | /** The number of functions paEmulationFuncs points to. */
|
---|
136 | uint32_t cEmulationFuncs;
|
---|
137 | /** Log indicator. (If set we're writing the log to the console.) */
|
---|
138 | bool fLog;
|
---|
139 |
|
---|
140 | /** Indicates whether we're in guest (true) or hypervisor (false) register context. */
|
---|
141 | bool fRegCtxGuest;
|
---|
142 | /** Indicates whether the register are terse or sparse. */
|
---|
143 | bool fRegTerse;
|
---|
144 | /** Whether to display registers when tracing. */
|
---|
145 | bool fStepTraceRegs;
|
---|
146 | /** Counter use to suppress the printing of the headers. */
|
---|
147 | uint8_t cPagingHierarchyDumps;
|
---|
148 |
|
---|
149 | /** Current disassembler position. */
|
---|
150 | DBGCVAR DisasmPos;
|
---|
151 | /** The flags that goes with DisasmPos. */
|
---|
152 | uint32_t fDisasm;
|
---|
153 | /** Current source position. (flat GC) */
|
---|
154 | DBGCVAR SourcePos;
|
---|
155 | /** Current memory dump position. */
|
---|
156 | DBGCVAR DumpPos;
|
---|
157 | /** Size of the previous dump element. */
|
---|
158 | unsigned cbDumpElement;
|
---|
159 | /** Points to DisasmPos, SourcePos or DumpPos depending on which was
|
---|
160 | * used last. */
|
---|
161 | PCDBGCVAR pLastPos;
|
---|
162 |
|
---|
163 | /** Number of variables in papVars. */
|
---|
164 | unsigned cVars;
|
---|
165 | /** Array of global variables.
|
---|
166 | * Global variables can be referenced using the $ operator and set
|
---|
167 | * and unset using command with those names. */
|
---|
168 | PDBGCNAMEDVAR *papVars;
|
---|
169 |
|
---|
170 | /** The list of breakpoints. (singly linked) */
|
---|
171 | PDBGCBP pFirstBp;
|
---|
172 |
|
---|
173 | /** Software interrupt events. */
|
---|
174 | PDBGCEVTCFG apSoftInts[256];
|
---|
175 | /** Hardware interrupt events. */
|
---|
176 | PDBGCEVTCFG apHardInts[256];
|
---|
177 | /** Selectable events (first few entries are unused). */
|
---|
178 | PDBGCEVTCFG apEventCfgs[DBGFEVENT_END];
|
---|
179 |
|
---|
180 | /** Save search pattern. */
|
---|
181 | uint8_t abSearch[256];
|
---|
182 | /** The length of the search pattern. */
|
---|
183 | uint32_t cbSearch;
|
---|
184 | /** The search unit */
|
---|
185 | uint32_t cbSearchUnit;
|
---|
186 | /** The max hits. */
|
---|
187 | uint64_t cMaxSearchHits;
|
---|
188 | /** The address to resume searching from. */
|
---|
189 | DBGFADDRESS SearchAddr;
|
---|
190 | /** What's left of the original search range. */
|
---|
191 | RTGCUINTPTR cbSearchRange;
|
---|
192 |
|
---|
193 | /** @name Parsing and Execution
|
---|
194 | * @{ */
|
---|
195 |
|
---|
196 | /** Input buffer. */
|
---|
197 | char achInput[2048];
|
---|
198 | /** To ease debugging. */
|
---|
199 | unsigned uInputZero;
|
---|
200 | /** Write index in the input buffer. */
|
---|
201 | unsigned iWrite;
|
---|
202 | /** Read index in the input buffer. */
|
---|
203 | unsigned iRead;
|
---|
204 | /** The number of lines in the buffer. */
|
---|
205 | unsigned cInputLines;
|
---|
206 | /** Indicates that we have a buffer overflow condition.
|
---|
207 | * This means that input is ignored up to the next newline. */
|
---|
208 | bool fInputOverflow;
|
---|
209 | /** Indicates whether or we're ready for input. */
|
---|
210 | bool fReady;
|
---|
211 | /** Scratch buffer position. */
|
---|
212 | char *pszScratch;
|
---|
213 | /** Scratch buffer. */
|
---|
214 | char achScratch[16384];
|
---|
215 | /** Argument array position. */
|
---|
216 | unsigned iArg;
|
---|
217 | /** Array of argument variables. */
|
---|
218 | DBGCVAR aArgs[100];
|
---|
219 |
|
---|
220 | /** rc from the last dbgcHlpPrintfV(). */
|
---|
221 | int rcOutput;
|
---|
222 | /** The last character we wrote. */
|
---|
223 | char chLastOutput;
|
---|
224 |
|
---|
225 | /** rc from the last command. */
|
---|
226 | int rcCmd;
|
---|
227 | /** @} */
|
---|
228 |
|
---|
229 | /** The command history file (not yet implemented). */
|
---|
230 | char *pszHistoryFile;
|
---|
231 | /** The global debugger init script. */
|
---|
232 | char *pszGlobalInitScript;
|
---|
233 | /** The per VM debugger init script. */
|
---|
234 | char *pszLocalInitScript;
|
---|
235 | } DBGC;
|
---|
236 | /** Pointer to debugger console instance data. */
|
---|
237 | typedef DBGC *PDBGC;
|
---|
238 |
|
---|
239 | /** Converts a Command Helper pointer to a pointer to DBGC instance data. */
|
---|
240 | #define DBGC_CMDHLP2DBGC(pCmdHlp) ( (PDBGC)((uintptr_t)(pCmdHlp) - RT_UOFFSETOF(DBGC, CmdHlp)) )
|
---|
241 |
|
---|
242 |
|
---|
243 | /**
|
---|
244 | * Chunk of external commands.
|
---|
245 | */
|
---|
246 | typedef struct DBGCEXTCMDS
|
---|
247 | {
|
---|
248 | /** Number of commands descriptors. */
|
---|
249 | unsigned cCmds;
|
---|
250 | /** Pointer to array of command descriptors. */
|
---|
251 | PCDBGCCMD paCmds;
|
---|
252 | /** Pointer to the next chunk. */
|
---|
253 | struct DBGCEXTCMDS *pNext;
|
---|
254 | } DBGCEXTCMDS;
|
---|
255 | /** Pointer to chunk of external commands. */
|
---|
256 | typedef DBGCEXTCMDS *PDBGCEXTCMDS;
|
---|
257 |
|
---|
258 |
|
---|
259 | /**
|
---|
260 | * Chunk of external functions.
|
---|
261 | */
|
---|
262 | typedef struct DBGCEXTFUNCS
|
---|
263 | {
|
---|
264 | /** Number of functions descriptors. */
|
---|
265 | uint32_t cFuncs;
|
---|
266 | /** Pointer to array of functions descriptors. */
|
---|
267 | PCDBGCFUNC paFuncs;
|
---|
268 | /** Pointer to the next chunk. */
|
---|
269 | struct DBGCEXTFUNCS *pNext;
|
---|
270 | } DBGCEXTFUNCS;
|
---|
271 | /** Pointer to chunk of external functions. */
|
---|
272 | typedef DBGCEXTFUNCS *PDBGCEXTFUNCS;
|
---|
273 |
|
---|
274 |
|
---|
275 |
|
---|
276 | /**
|
---|
277 | * Unary operator handler function.
|
---|
278 | *
|
---|
279 | * @returns 0 on success.
|
---|
280 | * @returns VBox evaluation / parsing error code on failure.
|
---|
281 | * The caller does the bitching.
|
---|
282 | * @param pDbgc Debugger console instance data.
|
---|
283 | * @param pArg The argument.
|
---|
284 | * @param enmCat The desired result category. Can be ignored.
|
---|
285 | * @param pResult Where to store the result.
|
---|
286 | */
|
---|
287 | typedef DECLCALLBACK(int) FNDBGCOPUNARY(PDBGC pDbgc, PCDBGCVAR pArg, DBGCVARCAT enmCat, PDBGCVAR pResult);
|
---|
288 | /** Pointer to a unary operator handler function. */
|
---|
289 | typedef FNDBGCOPUNARY *PFNDBGCOPUNARY;
|
---|
290 |
|
---|
291 |
|
---|
292 | /**
|
---|
293 | * Binary operator handler function.
|
---|
294 | *
|
---|
295 | * @returns 0 on success.
|
---|
296 | * @returns VBox evaluation / parsing error code on failure.
|
---|
297 | * The caller does the bitching.
|
---|
298 | * @param pDbgc Debugger console instance data.
|
---|
299 | * @param pArg1 The first argument.
|
---|
300 | * @param pArg2 The 2nd argument.
|
---|
301 | * @param pResult Where to store the result.
|
---|
302 | */
|
---|
303 | typedef DECLCALLBACK(int) FNDBGCOPBINARY(PDBGC pDbgc, PCDBGCVAR pArg1, PCDBGCVAR pArg2, PDBGCVAR pResult);
|
---|
304 | /** Pointer to a binary operator handler function. */
|
---|
305 | typedef FNDBGCOPBINARY *PFNDBGCOPBINARY;
|
---|
306 |
|
---|
307 |
|
---|
308 | /**
|
---|
309 | * Operator descriptor.
|
---|
310 | */
|
---|
311 | typedef struct DBGCOP
|
---|
312 | {
|
---|
313 | /** Operator mnemonic. */
|
---|
314 | char szName[4];
|
---|
315 | /** Length of name. */
|
---|
316 | const unsigned cchName;
|
---|
317 | /** Whether or not this is a binary operator.
|
---|
318 | * Unary operators are evaluated right-to-left while binary are left-to-right. */
|
---|
319 | bool fBinary;
|
---|
320 | /** Precedence level. */
|
---|
321 | unsigned iPrecedence;
|
---|
322 | /** Unary operator handler. */
|
---|
323 | PFNDBGCOPUNARY pfnHandlerUnary;
|
---|
324 | /** Binary operator handler. */
|
---|
325 | PFNDBGCOPBINARY pfnHandlerBinary;
|
---|
326 | /** The category of the 1st argument.
|
---|
327 | * Set to DBGCVAR_CAT_ANY if anything goes. */
|
---|
328 | DBGCVARCAT enmCatArg1;
|
---|
329 | /** The category of the 2nd argument.
|
---|
330 | * Set to DBGCVAR_CAT_ANY if anything goes. */
|
---|
331 | DBGCVARCAT enmCatArg2;
|
---|
332 | /** Operator description. */
|
---|
333 | const char *pszDescription;
|
---|
334 | } DBGCOP;
|
---|
335 | /** Pointer to an operator descriptor. */
|
---|
336 | typedef DBGCOP *PDBGCOP;
|
---|
337 | /** Pointer to a const operator descriptor. */
|
---|
338 | typedef const DBGCOP *PCDBGCOP;
|
---|
339 |
|
---|
340 |
|
---|
341 |
|
---|
342 | /** Pointer to symbol descriptor. */
|
---|
343 | typedef struct DBGCSYM *PDBGCSYM;
|
---|
344 | /** Pointer to const symbol descriptor. */
|
---|
345 | typedef const struct DBGCSYM *PCDBGCSYM;
|
---|
346 |
|
---|
347 | /**
|
---|
348 | * Get builtin symbol.
|
---|
349 | *
|
---|
350 | * @returns 0 on success.
|
---|
351 | * @returns VBox evaluation / parsing error code on failure.
|
---|
352 | * The caller does the bitching.
|
---|
353 | * @param pSymDesc Pointer to the symbol descriptor.
|
---|
354 | * @param pCmdHlp Pointer to the command callback structure.
|
---|
355 | * @param enmType The result type.
|
---|
356 | * @param pResult Where to store the result.
|
---|
357 | */
|
---|
358 | typedef DECLCALLBACK(int) FNDBGCSYMGET(PCDBGCSYM pSymDesc, PDBGCCMDHLP pCmdHlp, DBGCVARTYPE enmType, PDBGCVAR pResult);
|
---|
359 | /** Pointer to get function for a builtin symbol. */
|
---|
360 | typedef FNDBGCSYMGET *PFNDBGCSYMGET;
|
---|
361 |
|
---|
362 | /**
|
---|
363 | * Set builtin symbol.
|
---|
364 | *
|
---|
365 | * @returns 0 on success.
|
---|
366 | * @returns VBox evaluation / parsing error code on failure.
|
---|
367 | * The caller does the bitching.
|
---|
368 | * @param pSymDesc Pointer to the symbol descriptor.
|
---|
369 | * @param pCmdHlp Pointer to the command callback structure.
|
---|
370 | * @param pValue The value to assign the symbol.
|
---|
371 | */
|
---|
372 | typedef DECLCALLBACK(int) FNDBGCSYMSET(PCDBGCSYM pSymDesc, PDBGCCMDHLP pCmdHlp, PCDBGCVAR pValue);
|
---|
373 | /** Pointer to set function for a builtin symbol. */
|
---|
374 | typedef FNDBGCSYMSET *PFNDBGCSYMSET;
|
---|
375 |
|
---|
376 |
|
---|
377 | /**
|
---|
378 | * Symbol description (for builtin symbols).
|
---|
379 | */
|
---|
380 | typedef struct DBGCSYM
|
---|
381 | {
|
---|
382 | /** Symbol name. */
|
---|
383 | const char *pszName;
|
---|
384 | /** Get function. */
|
---|
385 | PFNDBGCSYMGET pfnGet;
|
---|
386 | /** Set function. (NULL if readonly) */
|
---|
387 | PFNDBGCSYMSET pfnSet;
|
---|
388 | /** User data. */
|
---|
389 | unsigned uUser;
|
---|
390 | } DBGCSYM;
|
---|
391 |
|
---|
392 |
|
---|
393 | /** Selectable debug event kind. */
|
---|
394 | typedef enum
|
---|
395 | {
|
---|
396 | kDbgcSxEventKind_Plain,
|
---|
397 | kDbgcSxEventKind_Interrupt
|
---|
398 | } DBGCSXEVENTKIND;
|
---|
399 |
|
---|
400 | /**
|
---|
401 | * Selectable debug event name / type lookup table entry.
|
---|
402 | *
|
---|
403 | * This also contains the default setting and an alternative name.
|
---|
404 | */
|
---|
405 | typedef struct DBGCSXEVT
|
---|
406 | {
|
---|
407 | /** The event type. */
|
---|
408 | DBGFEVENTTYPE enmType;
|
---|
409 | /** The event name. */
|
---|
410 | const char *pszName;
|
---|
411 | /** Alternative event name (optional). */
|
---|
412 | const char *pszAltNm;
|
---|
413 | /** The kind of event. */
|
---|
414 | DBGCSXEVENTKIND enmKind;
|
---|
415 | /** The default state. */
|
---|
416 | DBGCEVTSTATE enmDefault;
|
---|
417 | /** Flags, DBGCSXEVT_F_XXX. */
|
---|
418 | uint32_t fFlags;
|
---|
419 | /** Description for use when reporting the event, optional. */
|
---|
420 | const char *pszDesc;
|
---|
421 | } DBGCSXEVT;
|
---|
422 | /** Pointer to a constant selectable debug event descriptor. */
|
---|
423 | typedef DBGCSXEVT const *PCDBGCSXEVT;
|
---|
424 |
|
---|
425 | /** @name DBGCSXEVT_F_XXX
|
---|
426 | * @{ */
|
---|
427 | #define DBGCSXEVT_F_TAKE_ARG RT_BIT_32(0)
|
---|
428 | /** Windows bugcheck, should take 5 arguments. */
|
---|
429 | #define DBGCSXEVT_F_BUGCHECK RT_BIT_32(1)
|
---|
430 | /** @} */
|
---|
431 |
|
---|
432 |
|
---|
433 | /**
|
---|
434 | * Control flow graph basic block dumper state
|
---|
435 | */
|
---|
436 | typedef struct DBGCFLOWBBDUMP
|
---|
437 | {
|
---|
438 | /** The basic block referenced. */
|
---|
439 | DBGFFLOWBB hFlowBb;
|
---|
440 | /** Cached start address. */
|
---|
441 | DBGFADDRESS AddrStart;
|
---|
442 | /** Target address. */
|
---|
443 | DBGFADDRESS AddrTarget;
|
---|
444 | /** Width of the basic block in chars. */
|
---|
445 | uint32_t cchWidth;
|
---|
446 | /** Height of the basic block in chars. */
|
---|
447 | uint32_t cchHeight;
|
---|
448 | /** X coordinate of the start. */
|
---|
449 | uint32_t uStartX;
|
---|
450 | /** Y coordinate of the start. */
|
---|
451 | uint32_t uStartY;
|
---|
452 | } DBGCFLOWBBDUMP;
|
---|
453 | /** Pointer to the control flow graph basic block dump state. */
|
---|
454 | typedef DBGCFLOWBBDUMP *PDBGCFLOWBBDUMP;
|
---|
455 |
|
---|
456 |
|
---|
457 | /**
|
---|
458 | * Control flow graph branch table dumper state.
|
---|
459 | */
|
---|
460 | typedef struct DBGCFLOWBRANCHTBLDUMP
|
---|
461 | {
|
---|
462 | /** The branch table referenced. */
|
---|
463 | DBGFFLOWBRANCHTBL hFlowBranchTbl;
|
---|
464 | /** Cached start address. */
|
---|
465 | DBGFADDRESS AddrStart;
|
---|
466 | /** Width of the branch table in chars. */
|
---|
467 | uint32_t cchWidth;
|
---|
468 | /** Height of the branch table in chars. */
|
---|
469 | uint32_t cchHeight;
|
---|
470 | /** X coordinate of the start. */
|
---|
471 | uint32_t uStartX;
|
---|
472 | /** Y coordinate of the start. */
|
---|
473 | uint32_t uStartY;
|
---|
474 | } DBGCFLOWBRANCHTBLDUMP;
|
---|
475 | /** Pointer to control flow graph branch table state. */
|
---|
476 | typedef DBGCFLOWBRANCHTBLDUMP *PDBGCFLOWBRANCHTBLDUMP;
|
---|
477 |
|
---|
478 | /*******************************************************************************
|
---|
479 | * Internal Functions *
|
---|
480 | *******************************************************************************/
|
---|
481 | int dbgcBpAdd(PDBGC pDbgc, RTUINT iBp, const char *pszCmd);
|
---|
482 | int dbgcBpUpdate(PDBGC pDbgc, RTUINT iBp, const char *pszCmd);
|
---|
483 | int dbgcBpDelete(PDBGC pDbgc, RTUINT iBp);
|
---|
484 | PDBGCBP dbgcBpGet(PDBGC pDbgc, RTUINT iBp);
|
---|
485 | int dbgcBpExec(PDBGC pDbgc, RTUINT iBp);
|
---|
486 |
|
---|
487 | void dbgcEvalInit(void);
|
---|
488 | int dbgcEvalSub(PDBGC pDbgc, char *pszExpr, size_t cchExpr, DBGCVARCAT enmCategory, PDBGCVAR pResult);
|
---|
489 | int dbgcEvalCommand(PDBGC pDbgc, char *pszCmd, size_t cchCmd, bool fNoExecute);
|
---|
490 | int dbgcEvalScript(PDBGC pDbgc, const char *pszFilename, bool fAnnounce);
|
---|
491 |
|
---|
492 | int dbgcSymbolGet(PDBGC pDbgc, const char *pszSymbol, DBGCVARTYPE enmType, PDBGCVAR pResult);
|
---|
493 | PCDBGCSYM dbgcLookupRegisterSymbol(PDBGC pDbgc, const char *pszSymbol);
|
---|
494 | PCDBGCOP dbgcOperatorLookup(PDBGC pDbgc, const char *pszExpr, bool fPreferBinary, char chPrev);
|
---|
495 | PCDBGCCMD dbgcCommandLookup(PDBGC pDbgc, const char *pachName, size_t cchName, bool fExternal);
|
---|
496 | PCDBGCFUNC dbgcFunctionLookup(PDBGC pDbgc, const char *pachName, size_t cchName, bool fExternal);
|
---|
497 |
|
---|
498 | DECLCALLBACK(int) dbgcOpRegister(PDBGC pDbgc, PCDBGCVAR pArg, DBGCVARCAT enmCat, PDBGCVAR pResult);
|
---|
499 | DECLCALLBACK(int) dbgcOpAddrFlat(PDBGC pDbgc, PCDBGCVAR pArg, DBGCVARCAT enmCat, PDBGCVAR pResult);
|
---|
500 | DECLCALLBACK(int) dbgcOpAddrHost(PDBGC pDbgc, PCDBGCVAR pArg, DBGCVARCAT enmCat, PDBGCVAR pResult);
|
---|
501 | DECLCALLBACK(int) dbgcOpAddrPhys(PDBGC pDbgc, PCDBGCVAR pArg, DBGCVARCAT enmCat, PDBGCVAR pResult);
|
---|
502 | DECLCALLBACK(int) dbgcOpAddrHostPhys(PDBGC pDbgc, PCDBGCVAR pArg, DBGCVARCAT enmCat, PDBGCVAR pResult);
|
---|
503 |
|
---|
504 | void dbgcInitCmdHlp(PDBGC pDbgc);
|
---|
505 |
|
---|
506 | void dbgcEventInit(PDBGC pDbgc);
|
---|
507 | void dbgcEventTerm(PDBGC pDbgc);
|
---|
508 |
|
---|
509 | /** Console ASCII screen handle. */
|
---|
510 | typedef struct DBGCSCREENINT *DBGCSCREEN;
|
---|
511 | /** Pointer to ASCII screen handle. */
|
---|
512 | typedef DBGCSCREEN *PDBGCSCREEN;
|
---|
513 |
|
---|
514 | /**
|
---|
515 | * ASCII screen blit callback.
|
---|
516 | *
|
---|
517 | * @returns VBox status code. Any non VINF_SUCCESS status code will abort the dumping.
|
---|
518 | *
|
---|
519 | * @param psz The string to dump
|
---|
520 | * @param pvUser Opaque user data.
|
---|
521 | */
|
---|
522 | typedef DECLCALLBACK(int) FNDGCSCREENBLIT(const char *psz, void *pvUser);
|
---|
523 | /** Pointer to a FNDGCSCREENBLIT. */
|
---|
524 | typedef FNDGCSCREENBLIT *PFNDGCSCREENBLIT;
|
---|
525 |
|
---|
526 | /**
|
---|
527 | * ASCII screen supported colors.
|
---|
528 | */
|
---|
529 | typedef enum DBGCSCREENCOLOR
|
---|
530 | {
|
---|
531 | /** Invalid color. */
|
---|
532 | DBGCSCREENCOLOR_INVALID = 0,
|
---|
533 | /** Default color of the terminal. */
|
---|
534 | DBGCSCREENCOLOR_DEFAULT,
|
---|
535 | /** Black. */
|
---|
536 | DBGCSCREENCOLOR_BLACK,
|
---|
537 | DBGCSCREENCOLOR_BLACK_BRIGHT,
|
---|
538 | /** Red. */
|
---|
539 | DBGCSCREENCOLOR_RED,
|
---|
540 | DBGCSCREENCOLOR_RED_BRIGHT,
|
---|
541 | /** Green. */
|
---|
542 | DBGCSCREENCOLOR_GREEN,
|
---|
543 | DBGCSCREENCOLOR_GREEN_BRIGHT,
|
---|
544 | /** Yellow. */
|
---|
545 | DBGCSCREENCOLOR_YELLOW,
|
---|
546 | DBGCSCREENCOLOR_YELLOW_BRIGHT,
|
---|
547 | /** Blue. */
|
---|
548 | DBGCSCREENCOLOR_BLUE,
|
---|
549 | DBGCSCREENCOLOR_BLUE_BRIGHT,
|
---|
550 | /** Magenta. */
|
---|
551 | DBGCSCREENCOLOR_MAGENTA,
|
---|
552 | DBGCSCREENCOLOR_MAGENTA_BRIGHT,
|
---|
553 | /** Cyan. */
|
---|
554 | DBGCSCREENCOLOR_CYAN,
|
---|
555 | DBGCSCREENCOLOR_CYAN_BRIGHT,
|
---|
556 | /** White. */
|
---|
557 | DBGCSCREENCOLOR_WHITE,
|
---|
558 | DBGCSCREENCOLOR_WHITE_BRIGHT
|
---|
559 | } DBGCSCREENCOLOR;
|
---|
560 | /** Pointer to a screen color. */
|
---|
561 | typedef DBGCSCREENCOLOR *PDBGCSCREENCOLOR;
|
---|
562 |
|
---|
563 | DECLHIDDEN(int) dbgcScreenAsciiCreate(PDBGCSCREEN phScreen, uint32_t cchWidth, uint32_t cchHeight);
|
---|
564 | DECLHIDDEN(void) dbgcScreenAsciiDestroy(DBGCSCREEN hScreen);
|
---|
565 | DECLHIDDEN(int) dbgcScreenAsciiBlit(DBGCSCREEN hScreen, PFNDGCSCREENBLIT pfnBlit, void *pvUser, bool fAddColors);
|
---|
566 | DECLHIDDEN(int) dbgcScreenAsciiDrawLineVertical(DBGCSCREEN hScreen, uint32_t uX, uint32_t uStartY,
|
---|
567 | uint32_t uEndY, char ch, DBGCSCREENCOLOR enmColor);
|
---|
568 | DECLHIDDEN(int) dbgcScreenAsciiDrawLineHorizontal(DBGCSCREEN hScreen, uint32_t uStartX, uint32_t uEndX,
|
---|
569 | uint32_t uY, char ch, DBGCSCREENCOLOR enmColor);
|
---|
570 | DECLHIDDEN(int) dbgcScreenAsciiDrawCharacter(DBGCSCREEN hScreen, uint32_t uX, uint32_t uY, char ch,
|
---|
571 | DBGCSCREENCOLOR enmColor);
|
---|
572 | DECLHIDDEN(int) dbgcScreenAsciiDrawString(DBGCSCREEN hScreen, uint32_t uX, uint32_t uY, const char *pszText,
|
---|
573 | DBGCSCREENCOLOR enmColor);
|
---|
574 |
|
---|
575 | /* For tstDBGCParser: */
|
---|
576 | int dbgcCreate(PDBGC *ppDbgc, PDBGCBACK pBack, unsigned fFlags);
|
---|
577 | int dbgcRun(PDBGC pDbgc);
|
---|
578 | int dbgcProcessInput(PDBGC pDbgc, bool fNoExecute);
|
---|
579 | void dbgcDestroy(PDBGC pDbgc);
|
---|
580 |
|
---|
581 |
|
---|
582 | /*******************************************************************************
|
---|
583 | * Global Variables *
|
---|
584 | *******************************************************************************/
|
---|
585 | extern const DBGCCMD g_aDbgcCmds[];
|
---|
586 | extern const uint32_t g_cDbgcCmds;
|
---|
587 | extern const DBGCFUNC g_aDbgcFuncs[];
|
---|
588 | extern const uint32_t g_cDbgcFuncs;
|
---|
589 | extern const DBGCCMD g_aCmdsCodeView[];
|
---|
590 | extern const uint32_t g_cCmdsCodeView;
|
---|
591 | extern const DBGCFUNC g_aFuncsCodeView[];
|
---|
592 | extern const uint32_t g_cFuncsCodeView;
|
---|
593 | extern const DBGCOP g_aDbgcOps[];
|
---|
594 | extern const uint32_t g_cDbgcOps;
|
---|
595 | extern const DBGCSXEVT g_aDbgcSxEvents[];
|
---|
596 | extern const uint32_t g_cDbgcSxEvents;
|
---|
597 |
|
---|
598 |
|
---|
599 | /*******************************************************************************
|
---|
600 | * Defined Constants And Macros *
|
---|
601 | *******************************************************************************/
|
---|
602 | /** Locks the g_pExtCmdsHead and g_pExtFuncsHead lists for reading. */
|
---|
603 | #define DBGCEXTLISTS_LOCK_RD() do { } while (0)
|
---|
604 | /** Locks the g_pExtCmdsHead and g_pExtFuncsHead lists for writing. */
|
---|
605 | #define DBGCEXTLISTS_LOCK_WR() do { } while (0)
|
---|
606 | /** UnLocks the g_pExtCmdsHead and g_pExtFuncsHead lists after reading. */
|
---|
607 | #define DBGCEXTLISTS_UNLOCK_RD() do { } while (0)
|
---|
608 | /** UnLocks the g_pExtCmdsHead and g_pExtFuncsHead lists after writing. */
|
---|
609 | #define DBGCEXTLISTS_UNLOCK_WR() do { } while (0)
|
---|
610 |
|
---|
611 |
|
---|
612 |
|
---|
613 | #endif /* !DEBUGGER_INCLUDED_SRC_DBGCInternal_h */
|
---|
614 |
|
---|