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