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