VirtualBox

Changeset 20744 in vbox for trunk/include


Ignore:
Timestamp:
Jun 21, 2009 3:43:57 PM (16 years ago)
Author:
vboxsync
Message:

IPRT: RTDbg coding.

Location:
trunk/include/iprt
Files:
3 edited

Legend:

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

    r20741 r20744  
    6363#define RTDBGSEGIDX_SPECIAL_FIRST   (RTDBGSEGIDX_LAST + 1U)
    6464
     65
     66/** Max length (including '\\0') of a segment name. */
     67#define RTDBG_SEGMENT_NAME_LENGTH   (128 - 8 - 8 - 8 - 4 - 4)
     68
     69/**
     70 * Debug module segment.
     71 */
     72typedef struct RTDBGSEGMENT
     73{
     74    /** The load address.
     75     * RTUINTPTR_MAX if not applicable. */
     76    RTUINTPTR           Address;
     77    /** The image relative virtual address of the segment.
     78     * RTUINTPTR_MAX if not applicable. */
     79    RTUINTPTR           uRva;
     80    /** The segment size. */
     81    RTUINTPTR           cb;
     82    /** The segment flags. (reserved) */
     83    uint32_t            fFlags;
     84    /** The segment index. */
     85    RTDBGSEGIDX         iSeg;
     86    /** Symbol name. */
     87    char                szName[RTDBG_SEGMENT_NAME_LENGTH];
     88} RTDBGSEGMENT;
     89/** Pointer to a debug module segment. */
     90typedef RTDBGSEGMENT *PRTDBGSEGMENT;
     91/** Pointer to a const debug module segment. */
     92typedef RTDBGSEGMENT const *PCRTDBGSEGMENT;
     93
     94
     95
    6596/** Max length (including '\\0') of a symbol name. */
    66 #define RTDBG_SYMBOL_NAME_LENGTH   (512 - 8 - 4 - 4 - 4)
     97#define RTDBG_SYMBOL_NAME_LENGTH    (384 - 8 - 8 - 8 - 4 - 4 - 8)
    6798
    6899/**
     
    75106     * as RTDbgMod, but the mapping address if you ask RTDbgAs. */
    76107    RTUINTPTR           Value;
     108    /** Symbol size. */
     109    RTUINTPTR           cb;
    77110    /** Offset into the segment specified by iSeg. */
    78111    RTUINTPTR           offSeg;
    79112    /** Segment number. */
    80113    RTDBGSEGIDX         iSeg;
    81     /** Symbol size. */
    82     uint32_t            cb;
    83114    /** Symbol Flags. (reserved). */
    84115    uint32_t            fFlags;
     116    /** Symbol ordinal.
     117     * This is set to UINT32_MAX if the ordinals aren't supported. */
     118    uint32_t            iOrdinal;
    85119    /** Symbol name. */
    86120    char                szName[RTDBG_SYMBOL_NAME_LENGTH];
     
    116150
    117151/** Max length (including '\\0') of a debug info file name. */
    118 #define RTDBG_FILE_NAME_LENGTH   (260)
     152#define RTDBG_FILE_NAME_LENGTH      (260)
    119153
    120154
     
    134168    /** Line number. */
    135169    uint32_t            uLineNo;
     170    /** Symbol ordinal.
     171     * This is set to UINT32_MAX if the ordinals aren't supported. */
     172    uint32_t            iOrdinal;
    136173    /** Filename. */
    137174    char                szFilename[RTDBG_FILE_NAME_LENGTH];
     
    418455 * @param   cb              The size of the symbol.
    419456 * @param   fFlags          Symbol flags.
    420  */
    421 RTDECL(int) RTDbgAsSymbolAdd(RTDBGAS hDbgAs, const char *pszSymbol, RTUINTPTR Addr, RTUINTPTR cb, uint32_t fFlags);
     457 * @param   piOrdinal       Where to return the symbol ordinal on success. If
     458 *                          the interpreter doesn't do ordinals, this will be set to
     459 *                          UINT32_MAX. Optional
     460 */
     461RTDECL(int) RTDbgAsSymbolAdd(RTDBGAS hDbgAs, const char *pszSymbol, RTUINTPTR Addr, RTUINTPTR cb, uint32_t fFlags, uint32_t *piOrdinal);
    422462
    423463/**
     
    491531 */
    492532RTDECL(int) RTDbgAs(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTINTPTR poffDisp, PRTDBGLINE pLine);
     533
     534/**
     535 * Adds a line number to a module in the address space.
     536 *
     537 * @returns IPRT status code. See RTDbgModSymbolAdd for more specific ones.
     538 * @retval  VERR_INVALID_HANDLE if hDbgAs is invalid.
     539 * @retval  VERR_NOT_FOUND if no module was found at the specified address.
     540 * @retval  VERR_NOT_SUPPORTED if the module interpret doesn't support adding
     541 *          custom symbols.
     542 *
     543 * @param   hDbgAs          The address space handle.
     544 * @param   pszFile         The file name.
     545 * @param   uLineNo         The line number.
     546 * @param   Addr            The address of the symbol.
     547 * @param   piOrdinal       Where to return the line number ordinal on success.
     548 *                          If the interpreter doesn't do ordinals, this will be
     549 *                          set to UINT32_MAX. Optional.
     550 */
     551RTDECL(int) RTDbgAsLineAdd(RTDBGAS hDbgAs, const char *pszFile, uint32_t uLineNo, RTUINTPTR Addr, uint32_t *piOrdinal);
    493552
    494553/**
     
    524583RTDECL(const char *) RTDbgModName(RTDBGMOD hDbgMod);
    525584RTDECL(RTUINTPTR)   RTDbgModImageSize(RTDBGMOD hDbgMod);
     585
     586RTDECL(int)         RTDbgModSegmentAdd(RTDBGMOD hDbgMod, RTUINTPTR uRva, RTUINTPTR cb, const char *pszName, size_t cchName, uint32_t fFlags, PRTDBGSEGIDX piSeg);
     587RTDECL(RTDBGSEGIDX) RTDbgModSegmentCount(RTDBGMOD hDbgMod);
     588RTDECL(int)         RTDbgModSegmentByIndex(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, PRTDBGSEGMENT pSegInfo);
    526589RTDECL(RTUINTPTR)   RTDbgModSegmentSize(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg);
    527590RTDECL(RTUINTPTR)   RTDbgModSegmentRva(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg);
    528 RTDECL(RTDBGSEGIDX) RTDbgModSegmentCount(RTDBGMOD hDbgMod);
    529 
    530 RTDECL(int)         RTDbgModSymbolAdd(RTDBGMOD hDbgMod, const char *pszSymbol, RTDBGSEGIDX iSeg, RTUINTPTR off, RTUINTPTR cb, uint32_t fFlags);
     591
     592RTDECL(int)         RTDbgModSymbolAdd(RTDBGMOD hDbgMod, const char *pszSymbol, RTDBGSEGIDX iSeg, RTUINTPTR off, RTUINTPTR cb, uint32_t fFlags, uint32_t *piOrdinal);
    531593RTDECL(uint32_t)    RTDbgModSymbolCount(RTDBGMOD hDbgMod);
    532594RTDECL(int)         RTDbgModSymbolByIndex(RTDBGMOD hDbgMod, uint32_t iSymbol, PRTDBGSYMBOL pSymbol);
     
    536598RTDECL(int)         RTDbgModSymbolByNameA(RTDBGMOD hDbgMod, const char *pszSymbol, PRTDBGSYMBOL *ppSymbol);
    537599
    538 RTDECL(int)         RTDbgModLineAdd(RTDBGMOD hDbgMod, const char *pszFile, uint32_t uLineNo, RTDBGSEGIDX iSeg, RTUINTPTR off);
     600RTDECL(int)         RTDbgModLineAdd(RTDBGMOD hDbgMod, const char *pszFile, uint32_t uLineNo, RTDBGSEGIDX iSeg, RTUINTPTR off, uint32_t *piOrdinal);
    539601RTDECL(int)         RTDbgModLineByAddr(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE pLine);
    540602RTDECL(int)         RTDbgModLineByAddrA(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE *ppLine);
  • trunk/include/iprt/err.h

    r20740 r20744  
    939939 * @{
    940940 */
     941/** The module contains no line number information. */
     942#define VERR_DBG_NO_LINE_NUMBERS                (-650)
     943/** The module contains no symbol information. */
     944#define VERR_DBG_NO_SYMBOLS                     (-651)
    941945/** The specified segment:offset address was invalid. Typically an attempt at
    942946 * addressing outside the segment boundrary. */
    943 #define VERR_DBG_INVALID_ADDRESS                (-650)
     947#define VERR_DBG_INVALID_ADDRESS                (-652)
    944948/** Invalid segment index. */
    945 #define VERR_DBG_INVALID_SEGMENT_INDEX          (-651)
     949#define VERR_DBG_INVALID_SEGMENT_INDEX          (-653)
    946950/** Invalid segment offset. */
    947 #define VERR_DBG_INVALID_SEGMENT_OFFSET         (-652)
     951#define VERR_DBG_INVALID_SEGMENT_OFFSET         (-654)
    948952/** Invalid image relative virtual address. */
    949 #define VERR_DBG_INVALID_RVA                    (-653)
    950 /** The module contains no line number information. */
    951 #define VERR_DBG_NO_LINE_NUMBERS                (-654)
     953#define VERR_DBG_INVALID_RVA                    (-655)
    952954/** Address conflict within a module/segment.
    953955 * Attempted to add a symbol or line number that fully or partially overlaps with an existing one.  */
    954 #define VERR_DBG_ADDRESS_CONFLICT               (-655)
     956#define VERR_DBG_ADDRESS_CONFLICT               (-656)
    955957/** Duplicate symbol within the module.
    956958 * Attempted to add a symbol which name already exists within the module.  */
    957 #define VERR_DBG_DUPLICATE_SYMBOL               (-656)
     959#define VERR_DBG_DUPLICATE_SYMBOL               (-657)
     960/** The segment index specified when adding a new segment is already in use. */
     961#define VERR_DBG_SEGMENT_INDEX_CONFLICT         (-658)
     962/** No line number was found for the specified address/ordinal/whatever. */
     963#define VERR_DBG_LINE_NOT_FOUND                 (-659)
    958964/** The length of the symbol name is out of range.
    959965 * This means it is an empty string or that it's greater or equal to
    960966 * RTDBG_SYMBOL_NAME_LENGTH. */
    961 #define VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE       (-657)
     967#define VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE       (-660)
    962968/** The length of the file name is out of range.
    963969 * This means it is an empty string or that it's greater or equal to
    964970 * RTDBG_FILE_NAME_LENGTH. */
    965 #define VERR_DBG_FILE_NAME_OUT_OF_RANGE         (-658)
     971#define VERR_DBG_FILE_NAME_OUT_OF_RANGE         (-661)
    966972/** @} */
    967973
  • trunk/include/iprt/err.mac

    r20542 r20744  
    274274%define VERR_LDRELF_INVALID_RELOCATION_OFFSET    (-639)
    275275%define VERR_LDRELF_NO_SYMBOL_OR_NO_STRING_TABS    (-640)
    276 %define VERR_DBGMOD_INVALID_ADDRESS    (-650)
     276%define VERR_DBG_NO_LINE_NUMBERS    (-650)
     277%define VERR_DBG_NO_SYMBOLS    (-651)
     278%define VERR_DBG_INVALID_ADDRESS    (-652)
     279%define VERR_DBG_INVALID_SEGMENT_INDEX    (-653)
     280%define VERR_DBG_INVALID_SEGMENT_OFFSET    (-654)
     281%define VERR_DBG_INVALID_RVA    (-655)
     282%define VERR_DBG_ADDRESS_CONFLICT    (-656)
     283%define VERR_DBG_DUPLICATE_SYMBOL    (-657)
     284%define VERR_DBG_SEGMENT_INDEX_CONFLICT    (-658)
     285%define VERR_DBG_LINE_NOT_FOUND    (-659)
     286%define VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE    (-660)
     287%define VERR_DBG_FILE_NAME_OUT_OF_RANGE    (-661)
    277288%define VERR_RT_REQUEST_INVALID_TYPE    (-700)
    278289%define VERR_RT_REQUEST_STATE    (-701)
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