| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
#ifndef ___VBox_dbgf_h |
|---|
| 31 |
#define ___VBox_dbgf_h |
|---|
| 32 |
|
|---|
| 33 |
#include <VBox/cdefs.h> |
|---|
| 34 |
#include <VBox/types.h> |
|---|
| 35 |
#include <VBox/vmm.h> |
|---|
| 36 |
#include <VBox/log.h> |
|---|
| 37 |
|
|---|
| 38 |
#include <iprt/stdarg.h> |
|---|
| 39 |
|
|---|
| 40 |
__BEGIN_DECLS |
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
#ifdef IN_RC |
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
VMMRCDECL(int) DBGFGCTrap01Handler(PVM pVM, PCPUMCTXCORE pRegFrame, RTGCUINTREG uDr6); |
|---|
| 53 |
VMMRCDECL(int) DBGFGCTrap03Handler(PVM pVM, PCPUMCTXCORE pRegFrame); |
|---|
| 54 |
|
|---|
| 55 |
#endif |
|---|
| 56 |
|
|---|
| 57 |
#ifdef IN_RING0 |
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
VMMR0DECL(int) DBGFR0Trap01Handler(PVM pVM, PCPUMCTXCORE pRegFrame, RTGCUINTREG uDr6); |
|---|
| 63 |
VMMR0DECL(int) DBGFR0Trap03Handler(PVM pVM, PCPUMCTXCORE pRegFrame); |
|---|
| 64 |
|
|---|
| 65 |
#endif |
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
typedef struct DBGFADDRESS |
|---|
| 73 |
{ |
|---|
| 74 |
|
|---|
| 75 |
RTGCUINTPTR FlatPtr; |
|---|
| 76 |
|
|---|
| 77 |
RTGCUINTPTR off; |
|---|
| 78 |
|
|---|
| 79 |
RTSEL Sel; |
|---|
| 80 |
|
|---|
| 81 |
uint16_t fFlags; |
|---|
| 82 |
} DBGFADDRESS; |
|---|
| 83 |
|
|---|
| 84 |
typedef DBGFADDRESS *PDBGFADDRESS; |
|---|
| 85 |
|
|---|
| 86 |
typedef const DBGFADDRESS *PCDBGFADDRESS; |
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
#define DBGFADDRESS_FLAGS_FAR16 0 |
|---|
| 92 |
|
|---|
| 93 |
#define DBGFADDRESS_FLAGS_FAR32 1 |
|---|
| 94 |
|
|---|
| 95 |
#define DBGFADDRESS_FLAGS_FAR64 2 |
|---|
| 96 |
|
|---|
| 97 |
#define DBGFADDRESS_FLAGS_FLAT 3 |
|---|
| 98 |
|
|---|
| 99 |
#define DBGFADDRESS_FLAGS_PHYS 4 |
|---|
| 100 |
|
|---|
| 101 |
#define DBGFADDRESS_FLAGS_TYPE_MASK 7 |
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 |
#define DBGFADDRESS_FLAGS_VALID RT_BIT(3) |
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
#define DBGFADDRESS_FLAGS_HMA RT_BIT(4) |
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
#define DBGFADDRESS_IS_FLAT(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FLAT ) |
|---|
| 112 |
|
|---|
| 113 |
#define DBGFADDRESS_IS_PHYS(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_PHYS ) |
|---|
| 114 |
|
|---|
| 115 |
#define DBGFADDRESS_IS_FAR16(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR16 ) |
|---|
| 116 |
|
|---|
| 117 |
#define DBGFADDRESS_IS_FAR32(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR32 ) |
|---|
| 118 |
|
|---|
| 119 |
#define DBGFADDRESS_IS_FAR64(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR64 ) |
|---|
| 120 |
|
|---|
| 121 |
#define DBGFADDRESS_IS_VALID(pAddress) ( !!((pAddress)->fFlags & DBGFADDRESS_FLAGS_VALID) ) |
|---|
| 122 |
|
|---|
| 123 |
#define DBGFADDRESS_IS_HMA(pAddress) ( !!((pAddress)->fFlags & DBGFADDRESS_FLAGS_HMA) ) |
|---|
| 124 |
|
|---|
| 125 |
|
|---|
| 126 |
VMMR3DECL(int) DBGFR3AddrFromSelOff(PVM pVM, PDBGFADDRESS pAddress, RTSEL Sel, RTUINTPTR off); |
|---|
| 127 |
VMMR3DECL(PDBGFADDRESS) DBGFR3AddrFromFlat(PVM pVM, PDBGFADDRESS pAddress, RTGCUINTPTR FlatPtr); |
|---|
| 128 |
VMMR3DECL(void) DBGFR3AddrFromPhys(PVM pVM, PDBGFADDRESS pAddress, RTGCPHYS PhysAddr); |
|---|
| 129 |
VMMR3DECL(bool) DBGFR3AddrIsValid(PVM pVM, PCDBGFADDRESS pAddress); |
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
typedef enum DBGFEVENTTYPE |
|---|
| 138 |
{ |
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 |
|
|---|
| 142 |
DBGFEVENT_HALT_DONE = 0, |
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
DBGFEVENT_DETACH_DONE, |
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 |
|
|---|
| 150 |
DBGFEVENT_INVALID_COMMAND, |
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 |
|
|---|
| 157 |
DBGFEVENT_FATAL_ERROR = 100, |
|---|
| 158 |
|
|---|
| 159 |
|
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 |
DBGFEVENT_BREAKPOINT, |
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
DBGFEVENT_BREAKPOINT_HYPER, |
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 |
DBGFEVENT_ASSERTION_HYPER, |
|---|
| 172 |
|
|---|
| 173 |
|
|---|
| 174 |
|
|---|
| 175 |
DBGFEVENT_STEPPED, |
|---|
| 176 |
|
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
DBGFEVENT_STEPPED_HYPER, |
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
|
|---|
| 183 |
DBGFEVENT_DEV_STOP, |
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 |
|
|---|
| 187 |
DBGFEVENT_TERMINATING, |
|---|
| 188 |
|
|---|
| 189 |
|
|---|
| 190 |
DBGFEVENT_32BIT_HACK = 0x7fffffff |
|---|
| 191 |
} DBGFEVENTTYPE; |
|---|
| 192 |
|
|---|
| 193 |
|
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
typedef enum DBGFEVENTCTX |
|---|
| 198 |
{ |
|---|
| 199 |
|
|---|
| 200 |
DBGFEVENTCTX_INVALID = 0, |
|---|
| 201 |
|
|---|
| 202 |
DBGFEVENTCTX_RAW, |
|---|
| 203 |
|
|---|
| 204 |
DBGFEVENTCTX_REM, |
|---|
| 205 |
|
|---|
| 206 |
DBGFEVENTCTX_HWACCL, |
|---|
| 207 |
|
|---|
| 208 |
DBGFEVENTCTX_HYPER, |
|---|
| 209 |
|
|---|
| 210 |
DBGFEVENTCTX_OTHER, |
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 |
DBGFEVENTCTX_32BIT_HACK = 0x7fffffff |
|---|
| 214 |
} DBGFEVENTCTX; |
|---|
| 215 |
|
|---|
| 216 |
|
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 |
typedef struct DBGFEVENT |
|---|
| 220 |
{ |
|---|
| 221 |
|
|---|
| 222 |
DBGFEVENTTYPE enmType; |
|---|
| 223 |
|
|---|
| 224 |
DBGFEVENTCTX enmCtx; |
|---|
| 225 |
|
|---|
| 226 |
union |
|---|
| 227 |
{ |
|---|
| 228 |
|
|---|
| 229 |
struct |
|---|
| 230 |
{ |
|---|
| 231 |
|
|---|
| 232 |
int rc; |
|---|
| 233 |
} FatalError; |
|---|
| 234 |
|
|---|
| 235 |
|
|---|
| 236 |
struct |
|---|
| 237 |
{ |
|---|
| 238 |
|
|---|
| 239 |
R3PTRTYPE(const char *) pszFile; |
|---|
| 240 |
|
|---|
| 241 |
R3PTRTYPE(const char *) pszFunction; |
|---|
| 242 |
|
|---|
| 243 |
R3PTRTYPE(const char *) pszMessage; |
|---|
| 244 |
|
|---|
| 245 |
unsigned uLine; |
|---|
| 246 |
} Src; |
|---|
| 247 |
|
|---|
| 248 |
|
|---|
| 249 |
struct |
|---|
| 250 |
{ |
|---|
| 251 |
|
|---|
| 252 |
R3PTRTYPE(const char *) pszMsg1; |
|---|
| 253 |
|
|---|
| 254 |
R3PTRTYPE(const char *) pszMsg2; |
|---|
| 255 |
} Assert; |
|---|
| 256 |
|
|---|
| 257 |
|
|---|
| 258 |
struct DBGFEVENTBP |
|---|
| 259 |
{ |
|---|
| 260 |
|
|---|
| 261 |
RTUINT iBp; |
|---|
| 262 |
} Bp; |
|---|
| 263 |
|
|---|
| 264 |
uint64_t au64Padding[4]; |
|---|
| 265 |
} u; |
|---|
| 266 |
} DBGFEVENT; |
|---|
| 267 |
|
|---|
| 268 |
typedef DBGFEVENT *PDBGFEVENT; |
|---|
| 269 |
|
|---|
| 270 |
typedef const DBGFEVENT *PCDBGFEVENT; |
|---|
| 271 |
|
|---|
| 272 |
|
|---|
| 273 |
|
|---|
| 274 |
|
|---|
| 275 |
|
|---|
| 276 |
|
|---|
| 277 |
|
|---|
| 278 |
|
|---|
| 279 |
#ifdef VBOX_STRICT |
|---|
| 280 |
# define DBGFSTOP(pVM) DBGFR3EventSrc(pVM, DBGFEVENT_DEV_STOP, __FILE__, __LINE__, __PRETTY_FUNCTION__, NULL) |
|---|
| 281 |
#else |
|---|
| 282 |
# define DBGFSTOP(pVM) VINF_SUCCESS |
|---|
| 283 |
#endif |
|---|
| 284 |
|
|---|
| 285 |
VMMR3DECL(int) DBGFR3Init(PVM pVM); |
|---|
| 286 |
VMMR3DECL(int) DBGFR3Term(PVM pVM); |
|---|
| 287 |
VMMR3DECL(void) DBGFR3Relocate(PVM pVM, RTGCINTPTR offDelta); |
|---|
| 288 |
VMMR3DECL(int) DBGFR3VMMForcedAction(PVM pVM); |
|---|
| 289 |
VMMR3DECL(int) DBGFR3Event(PVM pVM, DBGFEVENTTYPE enmEvent); |
|---|
| 290 |
VMMR3DECL(int) DBGFR3EventSrc(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszFile, unsigned uLine, const char *pszFunction, const char *pszFormat, ...); |
|---|
| 291 |
VMMR3DECL(int) DBGFR3EventSrcV(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszFile, unsigned uLine, const char *pszFunction, const char *pszFormat, va_list args); |
|---|
| 292 |
VMMR3DECL(int) DBGFR3EventAssertion(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszMsg1, const char *pszMsg2); |
|---|
| 293 |
VMMR3DECL(int) DBGFR3EventBreakpoint(PVM pVM, DBGFEVENTTYPE enmEvent); |
|---|
| 294 |
VMMR3DECL(int) DBGFR3Attach(PVM pVM); |
|---|
| 295 |
VMMR3DECL(int) DBGFR3Detach(PVM pVM); |
|---|
| 296 |
VMMR3DECL(int) DBGFR3EventWait(PVM pVM, unsigned cMillies, PCDBGFEVENT *ppEvent); |
|---|
| 297 |
VMMR3DECL(int) DBGFR3Halt(PVM pVM); |
|---|
| 298 |
VMMR3DECL(bool) DBGFR3IsHalted(PVM pVM); |
|---|
| 299 |
VMMR3DECL(bool) DBGFR3CanWait(PVM pVM); |
|---|
| 300 |
VMMR3DECL(int) DBGFR3Resume(PVM pVM); |
|---|
| 301 |
VMMR3DECL(int) DBGFR3Step(PVM pVM); |
|---|
| 302 |
VMMR3DECL(int) DBGFR3PrgStep(PVM pVM); |
|---|
| 303 |
|
|---|
| 304 |
|
|---|
| 305 |
|
|---|
| 306 |
typedef enum DBGFBPTYPE |
|---|
| 307 |
{ |
|---|
| 308 |
|
|---|
| 309 |
DBGFBPTYPE_FREE = 0, |
|---|
| 310 |
|
|---|
| 311 |
DBGFBPTYPE_REG, |
|---|
| 312 |
|
|---|
| 313 |
DBGFBPTYPE_INT3, |
|---|
| 314 |
|
|---|
| 315 |
DBGFBPTYPE_REM, |
|---|
| 316 |
|
|---|
| 317 |
DBGFBPTYPE_32BIT_HACK = 0x7fffffff |
|---|
| 318 |
} DBGFBPTYPE; |
|---|
| 319 |
|
|---|
| 320 |
|
|---|
| 321 |
|
|---|
| 322 |
|
|---|
| 323 |
|
|---|
| 324 |
typedef struct DBGFBP |
|---|
| 325 |
{ |
|---|
| 326 |
|
|---|
| 327 |
uint64_t cHits; |
|---|
| 328 |
|
|---|
| 329 |
uint64_t iHitTrigger; |
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 |
uint64_t iHitDisable; |
|---|
| 333 |
|
|---|
| 334 |
|
|---|
| 335 |
RTGCUINTPTR GCPtr; |
|---|
| 336 |
|
|---|
| 337 |
RTUINT iBp; |
|---|
| 338 |
|
|---|
| 339 |
bool fEnabled; |
|---|
| 340 |
|
|---|
| 341 |
|
|---|
| 342 |
DBGFBPTYPE enmType; |
|---|
| 343 |
|
|---|
| 344 |
#if GC_ARCH_BITS == 64 |
|---|
| 345 |
uint32_t u32Padding; |
|---|
| 346 |
#endif |
|---|
| 347 |
|
|---|
| 348 |
|
|---|
| 349 |
union |
|---|
| 350 |
{ |
|---|
| 351 |
|
|---|
| 352 |
struct DBGFBPREG |
|---|
| 353 |
{ |
|---|
| 354 |
|
|---|
| 355 |
uint8_t iReg; |
|---|
| 356 |
|
|---|
| 357 |
uint8_t fType; |
|---|
| 358 |
|
|---|
| 359 |
uint8_t cb; |
|---|
| 360 |
} Reg; |
|---|
| 361 |
|
|---|
| 362 |
struct DBGFBPINT3 |
|---|
| 363 |
{ |
|---|
| 364 |
|
|---|
| 365 |
uint8_t bOrg; |
|---|
| 366 |
} Int3; |
|---|
| 367 |
|
|---|
| 368 |
|
|---|
| 369 |
struct DBGFBPREM |
|---|
| 370 |
{ |
|---|
| 371 |
|
|---|
| 372 |
uint8_t fDummy; |
|---|
| 373 |
} Rem; |
|---|
| 374 |
|
|---|
| 375 |
uint64_t u64Padding; |
|---|
| 376 |
} u; |
|---|
| 377 |
} DBGFBP; |
|---|
| 378 |
|
|---|
| 379 |
|
|---|
| 380 |
typedef DBGFBP *PDBGFBP; |
|---|
| 381 |
|
|---|
| 382 |
typedef const DBGFBP *PCDBGFBP; |
|---|
| 383 |
|
|---|
| 384 |
|
|---|
| 385 |
VMMR3DECL(int) DBGFR3BpSet(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, PRTUINT piBp); |
|---|
| 386 |
VMMR3DECL(int) DBGFR3BpSetReg(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, |
|---|
| 387 |
uint8_t fType, uint8_t cb, PRTUINT piBp); |
|---|
| 388 |
VMMR3DECL(int) DBGFR3BpSetREM(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, PRTUINT piBp); |
|---|
| 389 |
VMMR3DECL(int) DBGFR3BpClear(PVM pVM, RTUINT iBp); |
|---|
| 390 |
VMMR3DECL(int) DBGFR3BpEnable(PVM pVM, RTUINT iBp); |
|---|
| 391 |
VMMR3DECL(int) DBGFR3BpDisable(PVM pVM, RTUINT iBp); |
|---|
| 392 |
|
|---|
| 393 |
|
|---|
| 394 |
|
|---|
| 395 |
|
|---|
| 396 |
|
|---|
| 397 |
|
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 |
|
|---|
| 401 |
typedef DECLCALLBACK(int) FNDBGFBPENUM(PVM pVM, void *pvUser, PCDBGFBP pBp); |
|---|
| 402 |
|
|---|
| 403 |
typedef FNDBGFBPENUM *PFNDBGFBPENUM; |
|---|
| 404 |
|
|---|
| 405 |
VMMR3DECL(int) DBGFR3BpEnum(PVM pVM, PFNDBGFBPENUM pfnCallback, void *pvUser); |
|---|
| 406 |
VMMDECL(RTGCUINTREG) DBGFBpGetDR7(PVM pVM); |
|---|
| 407 |
VMMDECL(RTGCUINTREG) DBGFBpGetDR0(PVM pVM); |
|---|
| 408 |
VMMDECL(RTGCUINTREG) DBGFBpGetDR1(PVM pVM); |
|---|
| 409 |
VMMDECL(RTGCUINTREG) DBGFBpGetDR2(PVM pVM); |
|---|
| 410 |
VMMDECL(RTGCUINTREG) DBGFBpGetDR3(PVM pVM); |
|---|
| 411 |
VMMDECL(bool) DBGFIsStepping(PVM pVM); |
|---|
| 412 |
|
|---|
| 413 |
|
|---|
| 414 |
|
|---|
| 415 |
|
|---|
| 416 |
|
|---|
| 417 |
typedef struct DBGFINFOHLP *PDBGFINFOHLP; |
|---|
| 418 |
|
|---|
| 419 |
typedef const struct DBGFINFOHLP *PCDBGFINFOHLP; |
|---|
| 420 |
|
|---|
| 421 |
|
|---|
| 422 |
|
|---|
| 423 |
|
|---|
| 424 |
typedef struct DBGFINFOHLP |
|---|
| 425 |
{ |
|---|
| 426 |
|
|---|
| 427 |
|
|---|
| 428 |
|
|---|
| 429 |
|
|---|
| 430 |
|
|---|
| 431 |
|
|---|
| 432 |
|
|---|
| 433 |
DECLCALLBACKMEMBER(void, pfnPrintf)(PCDBGFINFOHLP pHlp, const char *pszFormat, ...); |
|---|
| 434 |
|
|---|
| 435 |
|
|---|
| 436 |
|
|---|
| 437 |
|
|---|
| 438 |
|
|---|
| 439 |
|
|---|
| 440 |
|
|---|
| 441 |
|
|---|
| 442 |
DECLCALLBACKMEMBER(void, pfnPrintfV)(PCDBGFINFOHLP pHlp, const char *pszFormat, va_list args); |
|---|
| 443 |
} DBGFINFOHLP; |
|---|
| 444 |
|
|---|
| 445 |
|
|---|
| 446 |
|
|---|
| 447 |
|
|---|
| 448 |
|
|---|
| 449 |
|
|---|
| 450 |
|
|---|
| 451 |
|
|---|
| 452 |
|
|---|
| 453 |
typedef DECLCALLBACK(void) FNDBGFHANDLERDEV(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs); |
|---|
| 454 |
|
|---|
| 455 |
typedef FNDBGFHANDLERDEV *PFNDBGFHANDLERDEV; |
|---|
| 456 |
|
|---|
| 457 |
|
|---|
| 458 |
|
|---|
| 459 |
|
|---|
| 460 |
|
|---|
| 461 |
|
|---|
| 462 |
|
|---|
| 463 |
|
|---|
| 464 |
typedef DECLCALLBACK(void) FNDBGFHANDLERDRV(PPDMDRVINS pDrvIns, PCDBGFINFOHLP pHlp, const char *pszArgs); |
|---|
| 465 |
|
|---|
| 466 |
typedef FNDBGFHANDLERDRV *PFNDBGFHANDLERDRV; |
|---|
| 467 |
|
|---|
| 468 |
|
|---|
| 469 |
|
|---|
| 470 |
|
|---|
| 471 |
|
|---|
| 472 |
|
|---|
| 473 |
|
|---|
| 474 |
|
|---|
| 475 |
typedef DECLCALLBACK(void) FNDBGFHANDLERINT(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs); |
|---|
| 476 |
|
|---|
| 477 |
typedef FNDBGFHANDLERINT *PFNDBGFHANDLERINT; |
|---|
| 478 |
|
|---|
| 479 |
|
|---|
| 480 |
|
|---|
| 481 |
|
|---|
| 482 |
|
|---|
| 483 |
|
|---|
| 484 |
|
|---|
| 485 |
|
|---|
| 486 |
typedef DECLCALLBACK(void) FNDBGFHANDLEREXT(void *pvUser, PCDBGFINFOHLP pHlp, const char *pszArgs); |
|---|
| 487 |
|
|---|
| 488 |
typedef FNDBGFHANDLEREXT *PFNDBGFHANDLEREXT; |
|---|
| 489 |
|
|---|
| 490 |
|
|---|
| 491 |
|
|---|
| 492 |
|
|---|
| 493 |
|
|---|
| 494 |
#define DBGFINFO_FLAGS_RUN_ON_EMT RT_BIT(0) |
|---|
| 495 |
|
|---|
| 496 |
|
|---|
| 497 |
VMMR3DECL(int) DBGFR3InfoRegisterDevice(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDEV pfnHandler, PPDMDEVINS pDevIns); |
|---|
| 498 |
VMMR3DECL(int) DBGFR3InfoRegisterDriver(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDRV pfnHandler, PPDMDRVINS pDrvIns); |
|---|
| 499 |
VMMR3DECL(int) DBGFR3InfoRegisterInternal(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler); |
|---|
| 500 |
VMMR3DECL(int) DBGFR3InfoRegisterInternalEx(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler, uint32_t fFlags); |
|---|
| 501 |
VMMR3DECL(int) DBGFR3InfoRegisterExternal(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLEREXT pfnHandler, void *pvUser); |
|---|
| 502 |
VMMR3DECL(int) DBGFR3InfoDeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName); |
|---|
| 503 |
VMMR3DECL(int) DBGFR3InfoDeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName); |
|---|
| 504 |
VMMR3DECL(int) DBGFR3InfoDeregisterInternal(PVM pVM, const char *pszName); |
|---|
| 505 |
VMMR3DECL(int) DBGFR3InfoDeregisterExternal(PVM pVM, const char *pszName); |
|---|
| 506 |
VMMR3DECL(int) DBGFR3Info(PVM pVM, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp); |
|---|
| 507 |
|
|---|
| 508 |
|
|---|
| 509 |
|
|---|
| 510 |
|
|---|
| 511 |
|
|---|
| 512 |
|
|---|
| 513 |
|
|---|
| 514 |
|
|---|
| 515 |
#ifdef LOG_ENABLED |
|---|
| 516 |
#define DBGFR3InfoLog(pVM, pszName, pszArgs) \ |
|---|
| 517 |
do { \ |
|---|
| 518 |
if (LogIsEnabled()) \ |
|---|
| 519 |
DBGFR3Info(pVM, pszName, pszArgs, NULL); \ |
|---|
| 520 |
} while (0) |
|---|
| 521 |
#else |
|---|
| 522 |
#define DBGFR3InfoLog(pVM, pszName, pszArgs) do { } while (0) |
|---|
| 523 |
#endif |
|---|
| 524 |
|
|---|
| 525 |
|
|---|
| 526 |
|
|---|
| 527 |
|
|---|
| 528 |
|
|---|
| 529 |
|
|---|
| 530 |
|
|---|
| 531 |
|
|---|
| 532 |
|
|---|
| 533 |
|
|---|
| 534 |
|
|---|
| 535 |
typedef DECLCALLBACK(int) FNDBGFINFOENUM(PVM pVM, const char *pszName, const char *pszDesc, void *pvUser); |
|---|
| 536 |
|
|---|
| 537 |
typedef FNDBGFINFOENUM *PFNDBGFINFOENUM; |
|---|
| 538 |
|
|---|
| 539 |
VMMR3DECL(int) DBGFR3InfoEnum(PVM pVM, PFNDBGFINFOENUM pfnCallback, void *pvUser); |
|---|
| 540 |
VMMR3DECL(PCDBGFINFOHLP) DBGFR3InfoLogHlp(void); |
|---|
| 541 |
VMMR3DECL(PCDBGFINFOHLP) DBGFR3InfoLogRelHlp(void); |
|---|
| 542 |
|
|---|
| 543 |
|
|---|
| 544 |
|
|---|
| 545 |
VMMR3DECL(int) DBGFR3LogModifyGroups(PVM pVM, const char *pszGroupSettings); |
|---|
| 546 |
VMMR3DECL(int) DBGFR3LogModifyFlags(PVM pVM, const char *pszFlagSettings); |
|---|
| 547 |
VMMR3DECL(int) DBGFR3LogModifyDestinations(PVM pVM, const char *pszDestSettings); |
|---|
| 548 |
|
|---|
| 549 |
|
|---|
| 550 |
|
|---|
| 551 |
|
|---|
| 552 |
#define DBGF_SYMBOL_NAME_LENGTH 512 |
|---|
| 553 |
|
|---|
| 554 |
|
|---|
| 555 |
|
|---|
| 556 |
|
|---|
| 557 |
typedef struct DBGFSYMBOL |
|---|
| 558 |
{ |
|---|
| 559 |
|
|---|
| 560 |
RTGCUINTPTR Value; |
|---|
| 561 |
|
|---|
| 562 |
uint32_t cb; |
|---|
| 563 |
|
|---|
| 564 |
uint32_t fFlags; |
|---|
| 565 |
|
|---|
| 566 |
char szName[DBGF_SYMBOL_NAME_LENGTH]; |
|---|
| 567 |
} DBGFSYMBOL; |
|---|
| 568 |
|
|---|
| 569 |
typedef DBGFSYMBOL *PDBGFSYMBOL; |
|---|
| 570 |
|
|---|
| 571 |
typedef const DBGFSYMBOL *PCDBGFSYMBOL; |
|---|
| 572 |
|
|---|
| 573 |
|
|---|
| 574 |
|
|---|
| 575 |
|
|---|
| 576 |
typedef struct DBGFLINE |
|---|
| 577 |
{ |
|---|
| 578 |
|
|---|
| 579 |
RTGCUINTPTR Address; |
|---|
| 580 |
|
|---|
| 581 |
uint32_t uLineNo; |
|---|
| 582 |
|
|---|
| 583 |
char szFilename[260]; |
|---|
| 584 |
} DBGFLINE; |
|---|
| 585 |
|
|---|
| 586 |
typedef DBGFLINE *PDBGFLINE; |
|---|
| 587 |
|
|---|
| 588 |
typedef const DBGFLINE *PCDBGFLINE; |
|---|
| 589 |
|
|---|
| 590 |
VMMR3DECL(int) DBGFR3ModuleLoad(PVM pVM, const char *pszFilename, RTGCUINTPTR AddressDelta, const char *pszName, RTGCUINTPTR ModuleAddress, unsigned cbImage); |
|---|
| 591 |
VMMR3DECL(void) DBGFR3ModuleRelocate(PVM pVM, RTGCUINTPTR OldImageBase, RTGCUINTPTR NewImageBase, RTGCUINTPTR cbImage, |
|---|
| 592 |
const char *pszFilename, const char *pszName); |
|---|
| 593 |
VMMR3DECL(int) DBGFR3SymbolAdd(PVM pVM, RTGCUINTPTR ModuleAddress, RTGCUINTPTR SymbolAddress, RTUINT cbSymbol, const char *pszSymbol); |
|---|
| 594 |
VMMR3DECL(int) DBGFR3SymbolByAddr(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement, PDBGFSYMBOL pSymbol); |
|---|
| 595 |
VMMR3DECL(int) DBGFR3SymbolByName(PVM pVM, const char *pszSymbol, PDBGFSYMBOL pSymbol); |
|---|
| 596 |
VMMR3DECL(PDBGFSYMBOL) DBGFR3SymbolByAddrAlloc(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement); |
|---|
| 597 |
VMMR3DECL(PDBGFSYMBOL) DBGFR3SymbolByNameAlloc(PVM pVM, const char *pszSymbol); |
|---|
| 598 |
VMMR3DECL(void) DBGFR3SymbolFree(PDBGFSYMBOL pSymbol); |
|---|
| 599 |
VMMR3DECL(int) DBGFR3LineByAddr(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement, PDBGFLINE pLine); |
|---|
| 600 |
VMMR3DECL(PDBGFLINE) DBGFR3LineByAddrAlloc(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement); |
|---|
| 601 |
VMMR3DECL(void) DBGFR3LineFree(PDBGFLINE pLine); |
|---|
| 602 |
|
|---|
| 603 |
|
|---|
| 604 |
|
|---|
| 605 |
|
|---|
| 606 |
|
|---|
| 607 |
typedef enum DBGFRETRUNTYPE |
|---|
| 608 |
{ |
|---|
| 609 |
|
|---|
| 610 |
DBGFRETURNTYPE_INVALID = 0, |
|---|
| 611 |
|
|---|
| 612 |
DBGFRETURNTYPE_NEAR16, |
|---|
| 613 |
|
|---|
| 614 |
DBGFRETURNTYPE_NEAR32, |
|---|
| 615 |
|
|---|
| 616 |
DBGFRETURNTYPE_NEAR64, |
|---|
| 617 |
|
|---|
| 618 |
DBGFRETURNTYPE_FAR16, |
|---|
| 619 |
|
|---|
| 620 |
DBGFRETURNTYPE_FAR32, |
|---|
| 621 |
|
|---|
| 622 |
DBGFRETURNTYPE_FAR64, |
|---|
| 623 |
|
|---|
| 624 |
DBGFRETURNTYPE_IRET16, |
|---|
| 625 |
|
|---|
| 626 |
DBGFRETURNTYPE_IRET32, |
|---|
| 627 |
|
|---|
| 628 |
DBGFRETURNTYPE_IRET32_PRIV, |
|---|
| 629 |
|
|---|
| 630 |
DBGFRETURNTYPE_IRET32_V86, |
|---|
| 631 |
|
|---|
| 632 |
DBGFRETURNTYPE_IRET64, |
|---|
| 633 |
|
|---|
| 634 |
DBGFRETURNTYPE_32BIT_HACK = 0x7fffffff |
|---|
| 635 |
} DBGFRETURNTYPE; |
|---|
| 636 |
|
|---|
| 637 |
|
|---|
| 638 |
|
|---|
| 639 |
|
|---|
| 640 |
|
|---|
| 641 |
|
|---|
| 642 |
|
|---|
| 643 |
DECLINLINE(unsigned) DBGFReturnTypeSize(DBGFRETURNTYPE enmRetType) |
|---|
| 644 |
{ |
|---|
| 645 |
switch (enmRetType) |
|---|
| 646 |
{ |
|---|
| 647 |
case DBGFRETURNTYPE_NEAR16: return 2; |
|---|
| 648 |
case DBGFRETURNTYPE_NEAR32: return 4; |
|---|
| 649 |
case DBGFRETURNTYPE_NEAR64: return 8; |
|---|
| 650 |
case DBGFRETURNTYPE_FAR16: return 4; |
|---|
| 651 |
case DBGFRETURNTYPE_FAR32: return 4; |
|---|
| 652 |
case DBGFRETURNTYPE_FAR64: return 8; |
|---|
| 653 |
case DBGFRETURNTYPE_IRET16: return 6; |
|---|
| 654 |
case DBGFRETURNTYPE_IRET32: return 4*3; |
|---|
| 655 |
case DBGFRETURNTYPE_IRET32_PRIV: return 4*5; |
|---|
| 656 |
case DBGFRETURNTYPE_IRET32_V86: return 4*9; |
|---|
| 657 |
case DBGFRETURNTYPE_IRET64: |
|---|
| 658 |
default: |
|---|
| 659 |
return 0; |
|---|
| 660 |
} |
|---|
| 661 |
} |
|---|
| 662 |
|
|---|
| 663 |
|
|---|
| 664 |
|
|---|
| 665 |
typedef struct DBGFSTACKFRAME *PDBGFSTACKFRAME; |
|---|
| 666 |
|
|---|
| 667 |
|
|---|
| 668 |
|
|---|
| 669 |
typedef struct DBGFSTACKFRAME |
|---|
| 670 |
{ |
|---|
| 671 |
|
|---|
| 672 |
RTUINT iFrame; |
|---|
| 673 |
|
|---|
| 674 |
RTUINT fFlags; |
|---|
| 675 |
|
|---|
| 676 |
|
|---|
| 677 |
DBGFADDRESS AddrFrame; |
|---|
| 678 |
|
|---|
| 679 |
|
|---|
| 680 |
DBGFADDRESS AddrStack; |
|---|
| 681 |
|
|---|
| 682 |
|
|---|
| 683 |
DBGFADDRESS AddrPC; |
|---|
| 684 |
|
|---|
| 685 |
PDBGFSYMBOL pSymPC; |
|---|
| 686 |
|
|---|
| 687 |
PDBGFLINE pLinePC; |
|---|
| 688 |
|
|---|
| 689 |
|
|---|
| 690 |
|
|---|
| 691 |
DBGFADDRESS AddrReturnFrame; |
|---|
| 692 |
|
|---|
| 693 |
|
|---|
| 694 |
DBGFADDRESS AddrReturnStack; |
|---|
| 695 |
|
|---|
| 696 |
DBGFRETURNTYPE enmReturnType; |
|---|
| 697 |
|
|---|
| 698 |
|
|---|
| 699 |
|
|---|
| 700 |
DBGFADDRESS AddrReturnPC; |
|---|
| 701 |
|
|---|
| 702 |
PDBGFSYMBOL pSymReturnPC; |
|---|
| 703 |
|
|---|
| 704 |
PDBGFLINE pLineReturnPC; |
|---|
| 705 |
|
|---|
| 706 |
|
|---|
| 707 |
union |
|---|
| 708 |
{ |
|---|
| 709 |
|
|---|
| 710 |
uint64_t au64[4]; |
|---|
| 711 |
|
|---|
| 712 |
uint32_t au32[8]; |
|---|
| 713 |
|
|---|
| 714 |
uint16_t au16[16]; |
|---|
| 715 |
|
|---|
| 716 |
uint8_t au8[32]; |
|---|
| 717 |
} Args; |
|---|
| 718 |
|
|---|
| 719 |
|
|---|
| 720 |
|
|---|
| 721 |
PDBGFSTACKFRAME pNext; |
|---|
| 722 |
|
|---|
| 723 |
|
|---|
| 724 |
PDBGFSTACKFRAME pFirst; |
|---|
| 725 |
} DBGFSTACKFRAME; |
|---|
| 726 |
|
|---|
| 727 |
|
|---|
| 728 |
|
|---|
| 729 |
|
|---|
| 730 |
|
|---|
| 731 |
#define DBGFSTACKFRAME_FLAGS_ALL_VALID RT_BIT(0) |
|---|
| 732 |
|
|---|
| 733 |
|
|---|
| 734 |
#define DBGFSTACKFRAME_FLAGS_LAST RT_BIT(1) |
|---|
| 735 |
|
|---|
| 736 |
#define DBGFSTACKFRAME_FLAGS_LOOP RT_BIT(2) |
|---|
| 737 |
|
|---|
| 738 |
#define DBGFSTACKFRAME_FLAGS_MAX_DEPTH RT_BIT(3) |
|---|
| 739 |
|
|---|
| 740 |
|
|---|
| 741 |
VMMR3DECL(int) DBGFR3StackWalkBeginGuest(PVM pVM, PDBGFSTACKFRAME pFrame); |
|---|
| 742 |
VMMR3DECL(int) DBGFR3StackWalkBeginHyper(PVM pVM, PDBGFSTACKFRAME pFrame); |
|---|
| 743 |
VMMR3DECL(int) DBGFR3StackWalkNext(PVM pVM, PDBGFSTACKFRAME pFrame); |
|---|
| 744 |
VMMR3DECL(void) DBGFR3StackWalkEnd(PVM pVM, PDBGFSTACKFRAME pFrame); |
|---|
| 745 |
|
|---|
| 746 |
|
|---|
| 747 |
|
|---|
| 748 |
|
|---|
| 749 |
|
|---|
| 750 |
|
|---|
| 751 |
|
|---|
| 752 |
#define DBGF_DISAS_FLAGS_CURRENT_GUEST RT_BIT(0) |
|---|
| 753 |
|
|---|
| 754 |
#define DBGF_DISAS_FLAGS_CURRENT_HYPER RT_BIT(1) |
|---|
| 755 |
|
|---|
| 756 |
#define DBGF_DISAS_FLAGS_NO_ANNOTATION RT_BIT(2) |
|---|
| 757 |
|
|---|
| 758 |
#define DBGF_DISAS_FLAGS_NO_SYMBOLS RT_BIT(3) |
|---|
| 759 |
|
|---|
| 760 |
#define DBGF_DISAS_FLAGS_NO_BYTES RT_BIT(4) |
|---|
| 761 |
|
|---|
| 762 |
#define DBGF_DISAS_FLAGS_NO_ADDRESS RT_BIT(5) |
|---|
| 763 |
|
|---|
| 764 |
|
|---|
| 765 |
|
|---|
| 766 |
#define DBGF_SEL_FLAT 1 |
|---|
| 767 |
|
|---|
| 768 |
VMMR3DECL(int) DBGFR3DisasInstrEx(PVM pVM, RTSEL Sel, RTGCPTR GCPtr, unsigned fFlags, char *pszOutput, uint32_t cchOutput, uint32_t *pcbInstr); |
|---|
| 769 |
VMMR3DECL(int) DBGFR3DisasInstr(PVM pVM, RTSEL Sel, RTGCPTR GCPtr, char *pszOutput, uint32_t cbOutput); |
|---|
| 770 |
VMMR3DECL(int) DBGFR3DisasInstrCurrent(PVM pVM, char *pszOutput, uint32_t cbOutput); |
|---|
| 771 |
VMMR3DECL(int) DBGFR3DisasInstrCurrentLogInternal(PVM pVM, const char *pszPrefix); |
|---|
| 772 |
|
|---|
| 773 |
|
|---|
| 774 |
|
|---|
| 775 |
|
|---|
| 776 |
|
|---|
| 777 |
#ifdef LOG_ENABLED |
|---|
| 778 |
# define DBGFR3DisasInstrCurrentLog(pVM, pszPrefix) \ |
|---|
| 779 |
do { \ |
|---|
| 780 |
if (LogIsEnabled()) \ |
|---|
| 781 |
DBGFR3DisasInstrCurrentLogInternal(pVM, pszPrefix); \ |
|---|
| 782 |
} while (0) |
|---|
| 783 |
#else |
|---|
| 784 |
# define DBGFR3DisasInstrCurrentLog(pVM, pszPrefix) do { } while (0) |
|---|
| 785 |
#endif |
|---|
| 786 |
|
|---|
| 787 |
VMMR3DECL(int) DBGFR3DisasInstrLogInternal(PVM pVM, RTSEL Sel, RTGCPTR GCPtr); |
|---|
| 788 |
|
|---|
| 789 |
|
|---|
| 790 |
|
|---|
| 791 |
|
|---|
| 792 |
|
|---|
| 793 |
#ifdef LOG_ENABLED |
|---|
| 794 |
# define DBGFR3DisasInstrLog(pVM, Sel, GCPtr) \ |
|---|
| 795 |
do { \ |
|---|
| 796 |
if (LogIsEnabled()) \ |
|---|
| 797 |
DBGFR3DisasInstrLogInternal(pVM, Sel, GCPtr); \ |
|---|
| 798 |
} while (0) |
|---|
| 799 |
#else |
|---|
| 800 |
# define DBGFR3DisasInstrLog(pVM, Sel, GCPtr) do { } while (0) |
|---|
| 801 |
#endif |
|---|
| 802 |
|
|---|
| 803 |
|
|---|
| 804 |
VMMR3DECL(int) DBGFR3MemScan(PVM pVM, PCDBGFADDRESS pAddress, RTGCUINTPTR cbRange, const uint8_t *pabNeedle, size_t cbNeedle, PDBGFADDRESS pHitAddress); |
|---|
| 805 |
VMMR3DECL(int) DBGFR3MemRead(PVM pVM, PCDBGFADDRESS pAddress, void *pvBuf, size_t cbRead); |
|---|
| 806 |
VMMR3DECL(int) DBGFR3MemReadString(PVM pVM, PCDBGFADDRESS pAddress, char *pszBuf, size_t cbBuf); |
|---|
| 807 |
|
|---|
| 808 |
|
|---|
| 809 |
|
|---|
| 810 |
|
|---|
| 811 |
|
|---|
| 812 |
|
|---|
| 813 |
|
|---|
| 814 |
|
|---|
| 815 |
typedef enum DBGFOSINTERFACE |
|---|
| 816 |
{ |
|---|
| 817 |
|
|---|
| 818 |
DBGFOSINTERFACE_INVALID = 0, |
|---|
| 819 |
|
|---|
| 820 |
DBGFOSINTERFACE_PROCESS, |
|---|
| 821 |
|
|---|
| 822 |
DBGFOSINTERFACE_THREAD, |
|---|
| 823 |
|
|---|
| 824 |
DBGFOSINTERFACE_END, |
|---|
| 825 |
|
|---|
| 826 |
DBGFOSINTERFACE_32BIT_HACK = 0x7fffffff |
|---|
| 827 |
} DBGFOSINTERFACE; |
|---|
| 828 |
|
|---|
| 829 |
typedef DBGFOSINTERFACE *PDBGFOSINTERFACE; |
|---|
| 830 |
|
|---|
| 831 |
typedef DBGFOSINTERFACE const *PCDBGFOSINTERFACE; |
|---|
| 832 |
|
|---|
| 833 |
|
|---|
| 834 |
|
|---|
| 835 |
|
|---|
| 836 |
|
|---|
| 837 |
|
|---|
| 838 |
|
|---|
| 839 |
typedef struct DBGFOSREG |
|---|
| 840 |
{ |
|---|
| 841 |
|
|---|
| 842 |
uint32_t u32Magic; |
|---|
| 843 |
|
|---|
| 844 |
uint32_t fFlags; |
|---|
| 845 |
|
|---|
| 846 |
uint32_t cbData; |
|---|
| 847 |
|
|---|
| 848 |
char szName[24]; |
|---|
| 849 |
|
|---|
| 850 |
|
|---|
| 851 |
|
|---|