Changeset 73412 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Jul 31, 2018 4:50:04 PM (6 years ago)
- Location:
- trunk/src/VBox/Runtime/common/dbg
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/dbg/dbgmoddeferred.cpp
r73401 r73412 52 52 { 53 53 AssertPtr(pThis); 54 Assert(pThis->u32Magic == RTDBGMODDEFERRED_MAGIC); 54 55 uint32_t cRefs = ASMAtomicDecU32(&pThis->cRefs); Assert(cRefs < 8); 55 56 if (!cRefs) … … 57 58 RTDbgCfgRelease(pThis->hDbgCfg); 58 59 pThis->hDbgCfg = NIL_RTDBGCFG; 59 pThis->u Magic = UINT32_C(0xdeadf00d);60 pThis->u32Magic = RTDBGMODDEFERRED_MAGIC_DEAD; 60 61 RTMemFree(pThis); 61 62 } … … 155 156 PRTINTPTR poffDisp, PRTDBGLINE pLineInfo) 156 157 { 158 Assert(((PRTDBGMODDEFERRED)pMod->pvDbgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 157 159 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 158 160 if (RT_SUCCESS(rc)) … … 165 167 static DECLCALLBACK(int) rtDbgModDeferredDbg_LineByOrdinal(PRTDBGMODINT pMod, uint32_t iOrdinal, PRTDBGLINE pLineInfo) 166 168 { 169 Assert(((PRTDBGMODDEFERRED)pMod->pvDbgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 167 170 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 168 171 if (RT_SUCCESS(rc)) … … 175 178 static DECLCALLBACK(uint32_t) rtDbgModDeferredDbg_LineCount(PRTDBGMODINT pMod) 176 179 { 180 Assert(((PRTDBGMODDEFERRED)pMod->pvDbgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 177 181 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 178 182 if (RT_SUCCESS(rc)) … … 186 190 uint32_t iSeg, RTUINTPTR off, uint32_t *piOrdinal) 187 191 { 192 Assert(((PRTDBGMODDEFERRED)pMod->pvDbgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 188 193 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 189 194 if (RT_SUCCESS(rc)) … … 237 242 PRTINTPTR poffDisp, PRTDBGSYMBOL pSymInfo) 238 243 { 244 Assert(((PRTDBGMODDEFERRED)pMod->pvDbgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 239 245 if ( (fFlags & RTDBGSYMADDR_FLAGS_SKIP_ABS_IN_DEFERRED) 240 246 && iSeg == RTDBGSEGIDX_ABS) … … 264 270 PRTDBGSYMBOL pSymInfo) 265 271 { 272 Assert(((PRTDBGMODDEFERRED)pMod->pvDbgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 266 273 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 267 274 if (RT_SUCCESS(rc)) … … 286 293 static DECLCALLBACK(int) rtDbgModDeferredDbg_SymbolByOrdinal(PRTDBGMODINT pMod, uint32_t iOrdinal, PRTDBGSYMBOL pSymInfo) 287 294 { 295 Assert(((PRTDBGMODDEFERRED)pMod->pvDbgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 288 296 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 289 297 if (RT_SUCCESS(rc)) … … 306 314 static DECLCALLBACK(uint32_t) rtDbgModDeferredDbg_SymbolCount(PRTDBGMODINT pMod) 307 315 { 316 Assert(((PRTDBGMODDEFERRED)pMod->pvDbgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 308 317 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 309 318 if (RT_SUCCESS(rc)) … … 318 327 uint32_t *piOrdinal) 319 328 { 329 Assert(((PRTDBGMODDEFERRED)pMod->pvDbgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 320 330 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 321 331 if (RT_SUCCESS(rc)) … … 328 338 static DECLCALLBACK(int) rtDbgModDeferredDbg_SegmentByIndex(PRTDBGMODINT pMod, RTDBGSEGIDX iSeg, PRTDBGSEGMENT pSegInfo) 329 339 { 340 Assert(((PRTDBGMODDEFERRED)pMod->pvDbgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 330 341 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 331 342 if (RT_SUCCESS(rc)) … … 351 362 static DECLCALLBACK(RTDBGSEGIDX) rtDbgModDeferredDbg_SegmentCount(PRTDBGMODINT pMod) 352 363 { 364 Assert(((PRTDBGMODDEFERRED)pMod->pvDbgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 353 365 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 354 366 if (RT_SUCCESS(rc)) … … 362 374 size_t cchName, uint32_t fFlags, PRTDBGSEGIDX piSeg) 363 375 { 376 Assert(((PRTDBGMODDEFERRED)pMod->pvDbgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 364 377 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 365 378 if (RT_SUCCESS(rc)) … … 373 386 { 374 387 PRTDBGMODDEFERRED pThis = (PRTDBGMODDEFERRED)pMod->pvDbgPriv; 388 Assert(pThis->u32Magic == RTDBGMODDEFERRED_MAGIC); 375 389 return pThis->cbImage; 376 390 } … … 380 394 static DECLCALLBACK(RTDBGSEGIDX) rtDbgModDeferredDbg_RvaToSegOff(PRTDBGMODINT pMod, RTUINTPTR uRva, PRTUINTPTR poffSeg) 381 395 { 396 Assert(((PRTDBGMODDEFERRED)pMod->pvDbgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 382 397 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 383 398 if (RT_SUCCESS(rc)) … … 390 405 static DECLCALLBACK(int) rtDbgModDeferredDbg_Close(PRTDBGMODINT pMod) 391 406 { 392 rtDbgModDeferredReleaseInstanceData((PRTDBGMODDEFERRED)pMod->pv ImgPriv);407 rtDbgModDeferredReleaseInstanceData((PRTDBGMODDEFERRED)pMod->pvDbgPriv); 393 408 return VINF_SUCCESS; 394 409 } … … 449 464 rtDbgModDeferredImg_QueryProp(PRTDBGMODINT pMod, RTLDRPROP enmProp, void *pvBuf, size_t cbBuf, size_t *pcbRet) 450 465 { 466 Assert(((PRTDBGMODDEFERRED)pMod->pvImgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 451 467 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 452 468 if (RT_SUCCESS(rc)) … … 459 475 static DECLCALLBACK(RTLDRARCH) rtDbgModDeferredImg_GetArch(PRTDBGMODINT pMod) 460 476 { 477 Assert(((PRTDBGMODDEFERRED)pMod->pvImgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 478 461 479 RTLDRARCH enmArch; 462 480 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); … … 472 490 static DECLCALLBACK(RTLDRFMT) rtDbgModDeferredImg_GetFormat(PRTDBGMODINT pMod) 473 491 { 492 Assert(((PRTDBGMODDEFERRED)pMod->pvImgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 493 474 494 RTLDRFMT enmFmt; 475 495 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); … … 485 505 static DECLCALLBACK(int) rtDbgModDeferredImg_ReadAt(PRTDBGMODINT pMod, uint32_t iDbgInfoHint, RTFOFF off, void *pvBuf, size_t cb) 486 506 { 507 Assert(((PRTDBGMODDEFERRED)pMod->pvImgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 487 508 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 488 509 if (RT_SUCCESS(rc)) … … 495 516 static DECLCALLBACK(int) rtDbgModDeferredImg_UnmapPart(PRTDBGMODINT pMod, size_t cb, void const **ppvMap) 496 517 { 518 Assert(((PRTDBGMODDEFERRED)pMod->pvImgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 497 519 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 498 520 if (RT_SUCCESS(rc)) … … 505 527 static DECLCALLBACK(int) rtDbgModDeferredImg_MapPart(PRTDBGMODINT pMod, uint32_t iDbgInfo, RTFOFF off, size_t cb, void const **ppvMap) 506 528 { 529 Assert(((PRTDBGMODDEFERRED)pMod->pvImgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 507 530 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 508 531 if (RT_SUCCESS(rc)) … … 516 539 { 517 540 PRTDBGMODDEFERRED pThis = (PRTDBGMODDEFERRED)pMod->pvImgPriv; 541 Assert(pThis->u32Magic == RTDBGMODDEFERRED_MAGIC); 518 542 return pThis->cbImage; 519 543 } … … 524 548 PRTDBGSEGIDX piSeg, PRTLDRADDR poffSeg) 525 549 { 550 Assert(((PRTDBGMODDEFERRED)pMod->pvImgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 526 551 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 527 552 if (RT_SUCCESS(rc)) … … 535 560 PRTDBGSEGIDX piSeg, PRTLDRADDR poffSeg) 536 561 { 562 Assert(((PRTDBGMODDEFERRED)pMod->pvImgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 537 563 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 538 564 if (RT_SUCCESS(rc)) … … 546 572 PFNRTLDRENUMSYMS pfnCallback, void *pvUser) 547 573 { 574 Assert(((PRTDBGMODDEFERRED)pMod->pvImgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 548 575 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 549 576 if (RT_SUCCESS(rc)) … … 556 583 static DECLCALLBACK(int) rtDbgModDeferredImg_EnumSegments(PRTDBGMODINT pMod, PFNRTLDRENUMSEGS pfnCallback, void *pvUser) 557 584 { 585 Assert(((PRTDBGMODDEFERRED)pMod->pvImgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 558 586 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 559 587 if (RT_SUCCESS(rc)) … … 566 594 static DECLCALLBACK(int) rtDbgModDeferredImg_EnumDbgInfo(PRTDBGMODINT pMod, PFNRTLDRENUMDBG pfnCallback, void *pvUser) 567 595 { 596 Assert(((PRTDBGMODDEFERRED)pMod->pvImgPriv)->u32Magic == RTDBGMODDEFERRED_MAGIC); 568 597 int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/); 569 598 if (RT_SUCCESS(rc)) … … 639 668 return VERR_NO_MEMORY; 640 669 670 pDeferred->u32Magic = RTDBGMODDEFERRED_MAGIC; 671 pDeferred->cRefs = 1 + (pDbgMod->pImgVt == NULL); 641 672 pDeferred->cbImage = cbImage; 642 pDeferred->cRefs = 1 + (pDbgMod->pImgVt == NULL);643 pDeferred->uMagic = UINT32_C(0xbeef0001);644 673 if (hDbgCfg != NIL_RTDBGCFG) 645 674 RTDbgCfgRetain(hDbgCfg); -
trunk/src/VBox/Runtime/common/dbg/dbgmodldr.cpp
r73375 r73412 53 53 typedef struct RTDBGMODLDR 54 54 { 55 /** Magic value (RTDBGMODLDR_MAGIC). */ 56 uint32_t u32Magic; 55 57 /** The loader handle. */ 56 58 RTLDRMOD hLdrMod; … … 65 67 { 66 68 PRTDBGMODLDR pThis = (PRTDBGMODLDR)pMod->pvImgPriv; 69 Assert(pThis->u32Magic == RTDBGMODLDR_MAGIC); 67 70 return RTLdrQueryPropEx(pThis->hLdrMod, enmProp, NULL /*pvBits*/, pvBuf, cbBuf, pcbRet); 68 71 } … … 73 76 { 74 77 PRTDBGMODLDR pThis = (PRTDBGMODLDR)pMod->pvImgPriv; 78 Assert(pThis->u32Magic == RTDBGMODLDR_MAGIC); 75 79 return RTLdrGetArch(pThis->hLdrMod); 76 80 } … … 81 85 { 82 86 PRTDBGMODLDR pThis = (PRTDBGMODLDR)pMod->pvImgPriv; 87 Assert(pThis->u32Magic == RTDBGMODLDR_MAGIC); 83 88 return RTLdrGetFormat(pThis->hLdrMod); 84 89 } … … 89 94 { 90 95 PRTDBGMODLDR pThis = (PRTDBGMODLDR)pMod->pvImgPriv; 96 Assert(pThis->u32Magic == RTDBGMODLDR_MAGIC); 91 97 RT_NOREF_PV(iDbgInfoHint); 92 98 return rtLdrReadAt(pThis->hLdrMod, pvBuf, UINT32_MAX /** @todo iDbgInfo*/, off, cb); … … 97 103 static DECLCALLBACK(int) rtDbgModLdr_UnmapPart(PRTDBGMODINT pMod, size_t cb, void const **ppvMap) 98 104 { 105 Assert(((PRTDBGMODLDR)pMod->pvImgPriv)->u32Magic == RTDBGMODLDR_MAGIC); 99 106 NOREF(pMod); NOREF(cb); 100 107 RTMemFree((void *)*ppvMap); … … 108 115 { 109 116 PRTDBGMODLDR pThis = (PRTDBGMODLDR)pMod->pvImgPriv; 117 Assert(pThis->u32Magic == RTDBGMODLDR_MAGIC); 110 118 111 119 void *pvMap = RTMemAlloc(cb); … … 129 137 { 130 138 PRTDBGMODLDR pThis = (PRTDBGMODLDR)pMod->pvImgPriv; 139 Assert(pThis->u32Magic == RTDBGMODLDR_MAGIC); 131 140 return RTLdrSize(pThis->hLdrMod); 132 141 } … … 137 146 { 138 147 PRTDBGMODLDR pThis = (PRTDBGMODLDR)pMod->pvImgPriv; 148 Assert(pThis->u32Magic == RTDBGMODLDR_MAGIC); 139 149 return RTLdrRvaToSegOffset(pThis->hLdrMod, Rva, piSeg, poffSeg); 140 150 } … … 146 156 { 147 157 PRTDBGMODLDR pThis = (PRTDBGMODLDR)pMod->pvImgPriv; 158 Assert(pThis->u32Magic == RTDBGMODLDR_MAGIC); 148 159 return RTLdrLinkAddressToSegOffset(pThis->hLdrMod, LinkAddress, piSeg, poffSeg); 149 160 } … … 155 166 { 156 167 PRTDBGMODLDR pThis = (PRTDBGMODLDR)pMod->pvImgPriv; 168 Assert(pThis->u32Magic == RTDBGMODLDR_MAGIC); 157 169 return RTLdrEnumSymbols(pThis->hLdrMod, fFlags, NULL /*pvBits*/, BaseAddress, pfnCallback, pvUser); 158 170 } … … 163 175 { 164 176 PRTDBGMODLDR pThis = (PRTDBGMODLDR)pMod->pvImgPriv; 177 Assert(pThis->u32Magic == RTDBGMODLDR_MAGIC); 165 178 return RTLdrEnumSegments(pThis->hLdrMod, pfnCallback, pvUser); 166 179 } … … 171 184 { 172 185 PRTDBGMODLDR pThis = (PRTDBGMODLDR)pMod->pvImgPriv; 186 Assert(pThis->u32Magic == RTDBGMODLDR_MAGIC); 173 187 return RTLdrEnumDbgInfo(pThis->hLdrMod, NULL, pfnCallback, pvUser); 174 188 } … … 180 194 PRTDBGMODLDR pThis = (PRTDBGMODLDR)pMod->pvImgPriv; 181 195 AssertPtr(pThis); 196 Assert(pThis->u32Magic == RTDBGMODLDR_MAGIC); 182 197 183 198 int rc = RTLdrClose(pThis->hLdrMod); AssertRC(rc); 184 pThis->hLdrMod = NIL_RTLDRMOD; 199 pThis->hLdrMod = NIL_RTLDRMOD; 200 pThis->u32Magic = RTDBGMODLDR_MAGIC_DEAD; 185 201 186 202 RTMemFree(pThis); … … 243 259 return VERR_NO_MEMORY; 244 260 261 pThis->u32Magic = RTDBGMODLDR_MAGIC; 245 262 pThis->hLdrMod = hLdrMod; 246 263 pDbgMod->pvImgPriv = pThis;
Note:
See TracChangeset
for help on using the changeset viewer.