VirtualBox

Changeset 20799 in vbox for trunk/include/iprt/dbg.h


Ignore:
Timestamp:
Jun 22, 2009 10:36:56 PM (15 years ago)
Author:
vboxsync
Message:

IPRT: More RTDbgMod code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/dbg.h

    r20744 r20799  
    575575 * @{
    576576 */
    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 */
     594RTDECL(int)         RTDbgModCreate(PRTDBGMOD phDbgMod, const char *pszName, RTUINTPTR cbSeg, uint32_t fFlags);
     595
    578596RTDECL(int)         RTDbgModCreateDeferred(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, RTUINTPTR cb, uint32_t fFlags);
    579597RTDECL(int)         RTDbgModCreateFromImage(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, uint32_t fFlags);
    580598RTDECL(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 */
    581610RTDECL(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 */
    582624RTDECL(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 */
    583633RTDECL(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 */
     646RTDECL(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 */
    584659RTDECL(RTUINTPTR)   RTDbgModImageSize(RTDBGMOD hDbgMod);
    585660
    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 */
     691RTDECL(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 */
    587705RTDECL(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 */
    588724RTDECL(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 */
    589740RTDECL(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 */
    590755RTDECL(RTUINTPTR)   RTDbgModSegmentRva(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg);
    591756
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette