- Timestamp:
- Jun 22, 2009 10:36:56 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/dbg.h
r20744 r20799 575 575 * @{ 576 576 */ 577 RTDECL(int) RTDbgModCreate(PRTDBGMOD phDbgMod, const char *pszName, RTUINTPTR cb, uint32_t fFlags); 577 578 /** 579 * Creates a module based on the default debug info container. 580 * 581 * This can be used to manually load a module and its symbol. The primary user 582 * group is the debug info interpreters, which use this API to create an 583 * efficient debug info container behind the scenes and forward all queries to 584 * it once the info has been loaded. 585 * 586 * @returns IPRT status code. 587 * 588 * @param phDbgMod Where to return the module handle. 589 * @param pszName The name of the module (mandatory). 590 * @param cbSeg The size of initial segment. If zero, segments will 591 * have to be added manually using RTDbgModSegmentAdd. 592 * @param fFlags Flags reserved for future extensions, MBZ for now. 593 */ 594 RTDECL(int) RTDbgModCreate(PRTDBGMOD phDbgMod, const char *pszName, RTUINTPTR cbSeg, uint32_t fFlags); 595 578 596 RTDECL(int) RTDbgModCreateDeferred(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, RTUINTPTR cb, uint32_t fFlags); 579 597 RTDECL(int) RTDbgModCreateFromImage(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, uint32_t fFlags); 580 598 RTDECL(int) RTDbgModCreateFromMap(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, RTUINTPTR uSubtrahend, uint32_t fFlags); 599 600 601 /** 602 * Retains another reference to the module. 603 * 604 * @returns New reference count, UINT32_MAX on invalid handle (asserted). 605 * 606 * @param hDbgMod The module handle. 607 * 608 * @remarks Will not take any locks. 609 */ 581 610 RTDECL(uint32_t) RTDbgModRetain(RTDBGMOD hDbgMod); 611 612 /** 613 * Release a reference to the module. 614 * 615 * When the reference count reaches zero, the module is destroyed. 616 * 617 * @returns New reference count, UINT32_MAX on invalid handle (asserted). 618 * 619 * @param hDbgMod The module handle. The NIL handle is quietly ignored 620 * and 0 is returned. 621 * 622 * @remarks Will not take any locks. 623 */ 582 624 RTDECL(uint32_t) RTDbgModRelease(RTDBGMOD hDbgMod); 625 626 /** 627 * Gets the module name. 628 * 629 * @returns Pointer to a read only string containing the name. 630 * 631 * @param hDbgMod The module handle. 632 */ 583 633 RTDECL(const char *) RTDbgModName(RTDBGMOD hDbgMod); 634 635 /** 636 * Converts an image relative address to a segment:offset address. 637 * 638 * @returns Segment index on success. 639 * NIL_RTDBGSEGIDX is returned if the module handle or the RVA are 640 * invalid. 641 * 642 * @param hDbgMod The module handle. 643 * @param uRva The image relative address to convert. 644 * @param poffSeg Where to return the segment offset. Optional. 645 */ 646 RTDECL(RTDBGSEGIDX) RTDbgModRvaToSegOff(RTDBGMOD hDbgMod, RTUINTPTR uRva, PRTUINTPTR poffSeg); 647 648 /** 649 * Image size when mapped if segments are mapped adjecently. 650 * 651 * For ELF, PE, and Mach-O images this is (usually) a natural query, for LX and 652 * NE and such it's a bit odder and the answer may not make much sense for them. 653 * 654 * @returns Image mapped size. 655 * UINTPTR_MAX is returned if the handle is invalid. 656 * 657 * @param hDbgMod The module handle. 658 */ 584 659 RTDECL(RTUINTPTR) RTDbgModImageSize(RTDBGMOD hDbgMod); 585 660 586 RTDECL(int) RTDbgModSegmentAdd(RTDBGMOD hDbgMod, RTUINTPTR uRva, RTUINTPTR cb, const char *pszName, size_t cchName, uint32_t fFlags, PRTDBGSEGIDX piSeg); 661 662 /** 663 * Adds a segment to the module. Optional feature. 664 * 665 * This method is intended used for manually constructing debug info for a 666 * module. The main usage is from other debug info interpreters that want to 667 * avoid writing a debug info database and instead uses the standard container 668 * behind the scenes. 669 * 670 * @returns IPRT status code. 671 * @retval VERR_NOT_SUPPORTED if this feature isn't support by the debug info 672 * interpreter. This is a common return code. 673 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 674 * @retval VERR_DBG_ADDRESS_WRAP if uRva+cb wraps around. 675 * @retval VERR_DBG_SEGMENT_NAME_OUT_OF_RANGE if pszName is too short or long. 676 * @retval VERR_INVALID_PARAMETER if fFlags contains undefined flags. 677 * @retval VERR_DBG_SPECIAL_SEGMENT if *piSeg is a special segment. 678 * @retval VERR_DBG_INVALID_SEGMENT_INDEX if *piSeg doesn't meet expectations. 679 * 680 * @param hDbgMod The module handle. 681 * @param uRva The image relative address of the segment. 682 * @param cb The size of the segment. 683 * @param pszName The segment name. Does not normally need to be 684 * unique, although this is somewhat up to the 685 * debug interpreter to decide. 686 * @param fFlags Segment flags. Reserved for future used, MBZ. 687 * @param piSeg The segment index or NIL_RTDBGSEGIDX on input. 688 * The assigned segment index on successful return. 689 * Optional. 690 */ 691 RTDECL(int) RTDbgModSegmentAdd(RTDBGMOD hDbgMod, RTUINTPTR uRva, RTUINTPTR cb, const char *pszName, 692 uint32_t fFlags, PRTDBGSEGIDX piSeg); 693 694 /** 695 * Gets the number of segments in the module. 696 * 697 * This is can be used to determin the range which can be passed to 698 * RTDbgModSegmentByIndex and derivates. 699 * 700 * @returns The segment relative address. 701 * NIL_RTDBGSEGIDX if the handle is invalid. 702 * 703 * @param hDbgMod The module handle. 704 */ 587 705 RTDECL(RTDBGSEGIDX) RTDbgModSegmentCount(RTDBGMOD hDbgMod); 706 707 /** 708 * Query information about a segment. 709 * 710 * This can be used together with RTDbgModSegmentCount to enumerate segments. 711 * The index starts a 0 and stops one below RTDbgModSegmentCount. 712 * 713 * @returns IPRT status code. 714 * @retval VERR_DBG_INVALID_SEGMENT_INDEX if iSeg is too high. 715 * @retval VERR_DBG_SPECIAL_SEGMENT if iSeg indicates a special segment. 716 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 717 * 718 * @param hDbgMod The module handle. 719 * @param iSeg The segment index. No special segments. 720 * @param pSegInfo Where to return the segment info. The 721 * RTDBGSEGMENT::Address member will be set to 722 * RTUINTPTR_MAX or the load address used at link time. 723 */ 588 724 RTDECL(int) RTDbgModSegmentByIndex(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, PRTDBGSEGMENT pSegInfo); 725 726 /** 727 * Gets the size of a segment. 728 * 729 * This is a just a wrapper around RTDbgModSegmentByIndex. 730 * 731 * @returns The segment size. 732 * UINTPTR_MAX is returned if either the handle and segment index are 733 * invalid. 734 * 735 * @param hDbgMod The module handle. 736 * @param iSeg The segment index. RTDBGSEGIDX_ABS is not allowed. 737 * If RTDBGSEGIDX_RVA is used, the functions returns 738 * the same value as RTDbgModImageSize. 739 */ 589 740 RTDECL(RTUINTPTR) RTDbgModSegmentSize(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg); 741 742 /** 743 * Gets the image relative address of a segment. 744 * 745 * This is a just a wrapper around RTDbgModSegmentByIndex. 746 * 747 * @returns The segment relative address. 748 * UINTPTR_MAX is returned if either the handle and segment index are 749 * invalid. 750 * 751 * @param hDbgMod The module handle. 752 * @param iSeg The segment index. No special segment indexes 753 * allowed (asserted). 754 */ 590 755 RTDECL(RTUINTPTR) RTDbgModSegmentRva(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg); 591 756 -
trunk/include/iprt/err.h
r20756 r20799 952 952 /** Invalid image relative virtual address. */ 953 953 #define VERR_DBG_INVALID_RVA (-655) 954 /** Invalid image relative virtual address. */ 955 #define VERR_DBG_SPECIAL_SEGMENT (-656) 954 956 /** Address conflict within a module/segment. 955 957 * Attempted to add a segment, symbol or line number that fully or partially 956 958 * overlaps with an existing one. */ 957 #define VERR_DBG_ADDRESS_CONFLICT (-65 6)959 #define VERR_DBG_ADDRESS_CONFLICT (-657) 958 960 /** Duplicate symbol within the module. 959 961 * Attempted to add a symbol which name already exists within the module. */ 960 #define VERR_DBG_DUPLICATE_SYMBOL (-65 7)962 #define VERR_DBG_DUPLICATE_SYMBOL (-658) 961 963 /** The segment index specified when adding a new segment is already in use. */ 962 #define VERR_DBG_SEGMENT_INDEX_CONFLICT (-65 8)964 #define VERR_DBG_SEGMENT_INDEX_CONFLICT (-659) 963 965 /** No line number was found for the specified address/ordinal/whatever. */ 964 #define VERR_DBG_LINE_NOT_FOUND (-6 59)966 #define VERR_DBG_LINE_NOT_FOUND (-660) 965 967 /** The length of the symbol name is out of range. 966 968 * This means it is an empty string or that it's greater or equal to 967 969 * RTDBG_SYMBOL_NAME_LENGTH. */ 968 #define VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE (-66 0)970 #define VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE (-661) 969 971 /** The length of the file name is out of range. 970 972 * This means it is an empty string or that it's greater or equal to 971 973 * RTDBG_FILE_NAME_LENGTH. */ 972 #define VERR_DBG_FILE_NAME_OUT_OF_RANGE (-661) 974 #define VERR_DBG_FILE_NAME_OUT_OF_RANGE (-662) 975 /** The length of the segment name is out of range. 976 * This means it is an empty string or that it is greater or equal to 977 * RTDBG_SEGMENT_NAME_LENGTH. */ 978 #define VERR_DBG_SEGMENT_NAME_OUT_OF_RANGE (-663) 979 /** The specified address range wraps around. */ 980 #define VERR_DBG_ADDRESS_WRAP (-664) 973 981 /** @} */ 974 982 -
trunk/src/VBox/Runtime/common/dbg/dbgmod.cpp
r20744 r20799 196 196 * Creates a module based on the default debug info container. 197 197 * 198 * This can be used to manually load a module and its symbol. 198 * This can be used to manually load a module and its symbol. The primary user 199 * group is the debug info interpreters, which use this API to create an 200 * efficient debug info container behind the scenes and forward all queries to 201 * it once the info has been loaded. 199 202 * 200 203 * @returns IPRT status code. … … 202 205 * @param phDbgMod Where to return the module handle. 203 206 * @param pszName The name of the module (mandatory). 204 * @param cb The size of the module. Must be greater than zero. 207 * @param cbSeg The size of initial segment. If zero, segments will 208 * have to be added manually using RTDbgModSegmentAdd. 205 209 * @param fFlags Flags reserved for future extensions, MBZ for now. 206 210 */ 207 RTDECL(int) RTDbgModCreate(PRTDBGMOD phDbgMod, const char *pszName, RTUINTPTR cb, uint32_t fFlags)211 RTDECL(int) RTDbgModCreate(PRTDBGMOD phDbgMod, const char *pszName, RTUINTPTR cbSeg, uint32_t fFlags) 208 212 { 209 213 /* … … 214 218 AssertPtrReturn(pszName, VERR_INVALID_POINTER); 215 219 AssertReturn(*pszName, VERR_INVALID_PARAMETER); 216 AssertReturn(cb > 0, VERR_INVALID_PARAMETER);217 220 AssertReturn(fFlags == 0, VERR_INVALID_PARAMETER); 218 221 … … 232 235 if (RT_SUCCESS(rc)) 233 236 { 234 pDbgMod->pszName = RTStr Dup(pszName);237 pDbgMod->pszName = RTStrCacheEnter(g_hDbgModStrCache, pszName); 235 238 if (pDbgMod->pszName) 236 239 { 237 rc = rtDbgModContainerCreate(pDbgMod, cb );240 rc = rtDbgModContainerCreate(pDbgMod, cbSeg); 238 241 if (RT_SUCCESS(rc)) 239 242 { … … 241 244 return rc; 242 245 } 243 RTStr Free(pDbgMod->pszName);246 RTStrCacheRelease(g_hDbgModStrCache, pDbgMod->pszName); 244 247 } 245 248 RTCritSectDelete(&pDbgMod->CritSect); … … 273 276 * @param pDbgMod The module instance. 274 277 */ 275 static void 278 static void rtDbgModDestroy(PRTDBGMODINT pDbgMod) 276 279 { 277 280 /* … … 298 301 */ 299 302 ASMAtomicWriteU32(&pDbgMod->u32Magic, ~RTDBGMOD_MAGIC); 300 RTStr Free(pDbgMod->pszName);301 RTStr Free(pDbgMod->pszImgFile);302 RTStr Free(pDbgMod->pszDbgFile);303 RTStrCacheRelease(g_hDbgModStrCache, pDbgMod->pszName); 304 RTStrCacheRelease(g_hDbgModStrCache, pDbgMod->pszImgFile); 305 RTStrCacheRelease(g_hDbgModStrCache, pDbgMod->pszDbgFile); 303 306 RTCritSectLeave(&pDbgMod->CritSect); /* paranoia */ 304 307 RTCritSectDelete(&pDbgMod->CritSect); … … 355 358 * @returns Pointer to a read only string containing the name. 356 359 * 357 * @param hDbgMod 360 * @param hDbgMod The module handle. 358 361 */ 359 362 RTDECL(const char *) RTDbgModName(RTDBGMOD hDbgMod) … … 365 368 366 369 367 RTDECL(RTUINTPTR) RTDbgModImageSize(RTDBGMOD hDbgMod) 368 { 369 return 1; 370 } 371 372 RTDECL(RTUINTPTR) RTDbgModSegmentSize(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg) 373 { 374 return 1; 375 } 376 377 RTDECL(RTUINTPTR) RTDbgModSegmentRva(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg) 378 { 379 return 0; 380 } 381 370 /** 371 * Converts an image relative address to a segment:offset address. 372 * 373 * @returns Segment index on success. 374 * NIL_RTDBGSEGIDX is returned if the module handle or the RVA are 375 * invalid. 376 * 377 * @param hDbgMod The module handle. 378 * @param uRva The image relative address to convert. 379 * @param poffSeg Where to return the segment offset. Optional. 380 */ 381 RTDECL(RTDBGSEGIDX) RTDbgModRvaToSegOff(RTDBGMOD hDbgMod, RTUINTPTR uRva, PRTUINTPTR poffSeg) 382 { 383 PRTDBGMODINT pDbgMod = hDbgMod; 384 RTDBGMOD_VALID_RETURN_RC(pDbgMod, NIL_RTDBGSEGIDX); 385 RTDBGMOD_LOCK(pDbgMod); 386 387 RTDBGSEGIDX iSeg = pDbgMod->pDbgVt->pfnRvaToSegOff(pDbgMod, uRva, poffSeg); 388 389 RTDBGMOD_UNLOCK(pDbgMod); 390 return iSeg; 391 } 392 393 394 /** 395 * Image size when mapped if segments are mapped adjecently. 396 * 397 * For ELF, PE, and Mach-O images this is (usually) a natural query, for LX and 398 * NE and such it's a bit odder and the answer may not make much sense for them. 399 * 400 * @returns Image mapped size. 401 * UINTPTR_MAX is returned if the handle is invalid. 402 * 403 * @param hDbgMod The module handle. 404 */ 405 RTDECL(RTUINTPTR) RTDbgModImageSize(RTDBGMOD hDbgMod) 406 { 407 PRTDBGMODINT pDbgMod = hDbgMod; 408 RTDBGMOD_VALID_RETURN_RC(pDbgMod, UINTPTR_MAX); 409 RTDBGMOD_LOCK(pDbgMod); 410 411 RTUINTPTR cbImage = pDbgMod->pDbgVt->pfnImageSize(pDbgMod); 412 413 RTDBGMOD_UNLOCK(pDbgMod); 414 return cbImage; 415 } 416 417 418 /** 419 * Adds a segment to the module. Optional feature. 420 * 421 * This method is intended used for manually constructing debug info for a 422 * module. The main usage is from other debug info interpreters that want to 423 * avoid writing a debug info database and instead uses the standard container 424 * behind the scenes. 425 * 426 * @returns IPRT status code. 427 * @retval VERR_NOT_SUPPORTED if this feature isn't support by the debug info 428 * interpreter. This is a common return code. 429 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 430 * @retval VERR_DBG_ADDRESS_WRAP if uRva+cb wraps around. 431 * @retval VERR_DBG_SEGMENT_NAME_OUT_OF_RANGE if pszName is too short or long. 432 * @retval VERR_INVALID_PARAMETER if fFlags contains undefined flags. 433 * @retval VERR_DBG_SPECIAL_SEGMENT if *piSeg is a special segment. 434 * @retval VERR_DBG_INVALID_SEGMENT_INDEX if *piSeg doesn't meet expectations. 435 * 436 * @param hDbgMod The module handle. 437 * @param uRva The image relative address of the segment. 438 * @param cb The size of the segment. 439 * @param pszName The segment name. Does not normally need to be 440 * unique, although this is somewhat up to the 441 * debug interpreter to decide. 442 * @param fFlags Segment flags. Reserved for future used, MBZ. 443 * @param piSeg The segment index or NIL_RTDBGSEGIDX on input. 444 * The assigned segment index on successful return. 445 * Optional. 446 */ 447 RTDECL(int) RTDbgModSegmentAdd(RTDBGMOD hDbgMod, RTUINTPTR uRva, RTUINTPTR cb, const char *pszName, 448 uint32_t fFlags, PRTDBGSEGIDX piSeg) 449 { 450 /* 451 * Validate input. 452 */ 453 PRTDBGMODINT pDbgMod = hDbgMod; 454 RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE); 455 AssertMsgReturn(uRva + cb >= uRva, ("uRva=%RTptr cb=%RTptr\n", uRva, cb), VERR_DBG_ADDRESS_WRAP); 456 AssertPtr(*pszName); 457 size_t cchName = strlen(pszName); 458 AssertReturn(cchName > 0, VERR_DBG_SEGMENT_NAME_OUT_OF_RANGE); 459 AssertReturn(cchName < RTDBG_SEGMENT_NAME_LENGTH, VERR_DBG_SEGMENT_NAME_OUT_OF_RANGE); 460 AssertMsgReturn(!fFlags, ("%#x\n", fFlags), VERR_INVALID_PARAMETER); 461 AssertPtrNull(piSeg); 462 AssertMsgReturn(!piSeg || *piSeg == NIL_RTDBGSEGIDX || *piSeg <= RTDBGSEGIDX_LAST, ("%#x\n", *piSeg), VERR_DBG_SPECIAL_SEGMENT); 463 464 /* 465 * Do the deed. 466 */ 467 RTDBGMOD_LOCK(pDbgMod); 468 int rc = pDbgMod->pDbgVt->pfnSegmentAdd(pDbgMod, uRva, cb, pszName, cchName, fFlags, piSeg); 469 RTDBGMOD_UNLOCK(pDbgMod); 470 471 return rc; 472 473 } 474 475 476 /** 477 * Gets the number of segments in the module. 478 * 479 * This is can be used to determin the range which can be passed to 480 * RTDbgModSegmentByIndex and derivates. 481 * 482 * @returns The segment relative address. 483 * NIL_RTDBGSEGIDX if the handle is invalid. 484 * 485 * @param hDbgMod The module handle. 486 */ 382 487 RTDECL(RTDBGSEGIDX) RTDbgModSegmentCount(RTDBGMOD hDbgMod) 383 488 { 384 return 1; 385 } 489 PRTDBGMODINT pDbgMod = hDbgMod; 490 RTDBGMOD_VALID_RETURN_RC(pDbgMod, NIL_RTDBGSEGIDX); 491 RTDBGMOD_LOCK(pDbgMod); 492 493 RTDBGSEGIDX cSegs = pDbgMod->pDbgVt->pfnSegmentCount(pDbgMod); 494 495 RTDBGMOD_UNLOCK(pDbgMod); 496 return cSegs; 497 } 498 499 500 /** 501 * Query information about a segment. 502 * 503 * This can be used together with RTDbgModSegmentCount to enumerate segments. 504 * The index starts a 0 and stops one below RTDbgModSegmentCount. 505 * 506 * @returns IPRT status code. 507 * @retval VERR_DBG_INVALID_SEGMENT_INDEX if iSeg is too high. 508 * @retval VERR_DBG_SPECIAL_SEGMENT if iSeg indicates a special segment. 509 * @retval VERR_INVALID_HANDLE if hDbgMod is invalid. 510 * 511 * @param hDbgMod The module handle. 512 * @param iSeg The segment index. No special segments. 513 * @param pSegInfo Where to return the segment info. The 514 * RTDBGSEGMENT::Address member will be set to 515 * RTUINTPTR_MAX or the load address used at link time. 516 */ 517 RTDECL(int) RTDbgModSegmentByIndex(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, PRTDBGSEGMENT pSegInfo) 518 { 519 AssertMsgReturn(iSeg <= RTDBGSEGIDX_LAST, ("%#x\n", iSeg), VERR_DBG_SPECIAL_SEGMENT); 520 PRTDBGMODINT pDbgMod = hDbgMod; 521 RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE); 522 RTDBGMOD_LOCK(pDbgMod); 523 524 int rc = pDbgMod->pDbgVt->pfnSegmentByIndex(pDbgMod, iSeg, pSegInfo); 525 526 RTDBGMOD_UNLOCK(pDbgMod); 527 return RT_SUCCESS(rc); 528 } 529 530 531 /** 532 * Gets the size of a segment. 533 * 534 * This is a just a wrapper around RTDbgModSegmentByIndex. 535 * 536 * @returns The segment size. 537 * UINTPTR_MAX is returned if either the handle and segment index are 538 * invalid. 539 * 540 * @param hDbgMod The module handle. 541 * @param iSeg The segment index. RTDBGSEGIDX_ABS is not allowed. 542 * If RTDBGSEGIDX_RVA is used, the functions returns 543 * the same value as RTDbgModImageSize. 544 */ 545 RTDECL(RTUINTPTR) RTDbgModSegmentSize(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg) 546 { 547 if (iSeg == RTDBGSEGIDX_RVA) 548 return RTDbgModImageSize(hDbgMod); 549 RTDBGSEGMENT SegInfo; 550 int rc = RTDbgModSegmentByIndex(hDbgMod, iSeg, &SegInfo); 551 return RT_SUCCESS(rc) ? SegInfo.cb : RTUINTPTR_MAX; 552 } 553 554 555 /** 556 * Gets the image relative address of a segment. 557 * 558 * This is a just a wrapper around RTDbgModSegmentByIndex. 559 * 560 * @returns The segment relative address. 561 * UINTPTR_MAX is returned if either the handle and segment index are 562 * invalid. 563 * 564 * @param hDbgMod The module handle. 565 * @param iSeg The segment index. No special segment indexes 566 * allowed (asserted). 567 */ 568 RTDECL(RTUINTPTR) RTDbgModSegmentRva(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg) 569 { 570 RTDBGSEGMENT SegInfo; 571 int rc = RTDbgModSegmentByIndex(hDbgMod, iSeg, &SegInfo); 572 return RT_SUCCESS(rc) ? SegInfo.uRva : RTUINTPTR_MAX; 573 } 574 575 386 576 387 577 -
trunk/src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp
r20756 r20799 594 594 pThis->paSegs[iSeg].pszName = NULL; 595 595 } 596 596 597 RTAvlrUIntPtrDestroy(&pThis->AbsAddrTree, rtDbgModContainer_DestroyTreeNode, NULL); 597 598 pThis->Names = NULL; … … 599 600 RTMemFree(pThis->paSegs); 600 601 pThis->paSegs = NULL; 602 601 603 RTMemFree(pThis); 602 604 … … 650 652 * @returns IPRT status code. 651 653 * @param pMod The module instance. 652 * @param cb The module size. 654 * @param cbSeg The size of the initial segment. 0 if segments are to be 655 * created manually later on. 653 656 */ 654 int rtDbgModContainerCreate(PRTDBGMODINT pMod, RTUINTPTR cb )657 int rtDbgModContainerCreate(PRTDBGMODINT pMod, RTUINTPTR cbSeg) 655 658 { 656 659 PRTDBGMODCTN pThis = (PRTDBGMODCTN)RTMemAlloc(sizeof(*pThis)); … … 664 667 pThis->paSegs = NULL; 665 668 pThis->cSegs = 0; 666 pThis->cb = cb; /** @todo the module size stuff doesn't quite make sense yet. Need to look at segments first, I guess. */669 pThis->cb = 0; 667 670 pThis->iNextSymbolOrdinal = 0; 668 671 pThis->iNextLineOrdinal = 0; … … 670 673 pMod->pDbgVt = &g_rtDbgModVtDbgContainer; 671 674 pMod->pvDbgPriv = pThis; 675 676 /* 677 * Add the initial segment. 678 */ 679 if (cbSeg) 680 { 681 int rc = rtDbgModContainer_SegmentAdd(pMod, 0, cbSeg, "default", sizeof("default") - 1, 0, NULL); 682 if (RT_FAILURE(rc)) 683 { 684 RTMemFree(pThis); 685 pMod->pDbgVt = NULL; 686 pMod->pvDbgPriv = NULL; 687 return rc; 688 } 689 } 690 672 691 return VINF_SUCCESS; 673 692 } -
trunk/src/VBox/Runtime/include/internal/dbgmod.h
r20756 r20799 374 374 uint32_t volatile cRefs; 375 375 /** The module name (short). */ 376 char 376 char const *pszName; 377 377 /** The module filename. Can be NULL. */ 378 char 378 char const *pszImgFile; 379 379 /** The debug info file (if external). Can be NULL. */ 380 char 380 char const *pszDbgFile; 381 381 382 382 /** Critical section serializing access to the module. */ … … 401 401 402 402 403 int rtDbgModContainerCreate(PRTDBGMODINT pMod, RTUINTPTR cb );403 int rtDbgModContainerCreate(PRTDBGMODINT pMod, RTUINTPTR cbSeg); 404 404 405 405 /** @} */
Note:
See TracChangeset
for help on using the changeset viewer.