VirtualBox

Changeset 20740 in vbox for trunk/include


Ignore:
Timestamp:
Jun 21, 2009 2:09:28 AM (16 years ago)
Author:
vboxsync
Message:

iprt: More RTDbg coding; added a new AVL tree for RTUINPTR.

Location:
trunk/include/iprt
Files:
4 edited

Legend:

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

    r20374 r20740  
    615615
    616616
     617/** AVL tree of RTUINTPTR.
     618 * @{
     619 */
     620
     621/**
     622 * AVL RTUINTPTR node core.
     623 */
     624typedef struct _AVLUIntPtrNodeCore
     625{
     626    /** Key value. */
     627    RTUINTPTR                   Key;
     628    /** Offset to the left leaf node, relative to this field. */
     629    struct _AVLUIntPtrNodeCore *pLeft;
     630    /** Offset to the right leaf node, relative to this field. */
     631    struct _AVLUIntPtrNodeCore *pRight;
     632    /** Height of this tree: max(height(left), height(right)) + 1 */
     633    unsigned char               uchHeight;
     634} AVLUINTPTRNODECORE;
     635/** Pointer to a RTUINTPTR AVL node core.*/
     636typedef AVLUINTPTRNODECORE *PAVLUINTPTRNODECORE;
     637
     638/** A pointer based tree with RTUINTPTR keys. */
     639typedef PAVLUINTPTRNODECORE AVLUINTPTRTREE;
     640/** Pointer to a offset base tree with RTUINTPTR keys. */
     641typedef AVLUINTPTRTREE     *PAVLUINTPTRTREE;
     642
     643/** Pointer to an internal tree pointer.
     644 * In this case it's a pointer to a pointer. */
     645typedef AVLUINTPTRTREE     *PPAVLUINTPTRNODECORE;
     646
     647/** Callback function for RTAvlUIntPtrDoWithAll() and RTAvlUIntPtrDestroy(). */
     648typedef DECLCALLBACK(int)    AVLUINTPTRCALLBACK(PAVLUINTPTRNODECORE pNode, void *pvUser);
     649/** Pointer to callback function for RTAvlUIntPtrDoWithAll() and RTAvlUIntPtrDestroy(). */
     650typedef AVLUINTPTRCALLBACK *PAVLUINTPTRCALLBACK;
     651
     652RTDECL(bool)                    RTAvlUIntPtrInsert(    PAVLUINTPTRTREE pTree, PAVLUINTPTRNODECORE pNode);
     653RTDECL(PAVLUINTPTRNODECORE)     RTAvlUIntPtrRemove(    PAVLUINTPTRTREE pTree, RTUINTPTR Key);
     654RTDECL(PAVLUINTPTRNODECORE)     RTAvlUIntPtrGet(       PAVLUINTPTRTREE pTree, RTUINTPTR Key);
     655RTDECL(PAVLUINTPTRNODECORE)     RTAvlUIntPtrGetBestFit(PAVLUINTPTRTREE pTree, RTUINTPTR Key, bool fAbove);
     656RTDECL(int)                     RTAvlUIntPtrDoWithAll( PAVLUINTPTRTREE pTree, int fFromLeft, PAVLUINTPTRCALLBACK pfnCallBack, void *pvParam);
     657RTDECL(int)                     RTAvlUIntPtrDestroy(   PAVLUINTPTRTREE pTree, PAVLUINTPTRCALLBACK pfnCallBack, void *pvParam);
     658RTDECL(PAVLUINTPTRNODECORE)     RTAvlUIntPtrGetRoot(   PAVLUINTPTRTREE pTree);
     659RTDECL(PAVLUINTPTRNODECORE)     RTAvlUIntPtrGetLeft(   PAVLUINTPTRNODECORE pNode);
     660RTDECL(PAVLUINTPTRNODECORE)     RTAvlUIntPtrGetRight(  PAVLUINTPTRNODECORE pNode);
     661
     662/** @} */
     663
     664
    617665/** AVL tree of RTUINTPTR ranges.
    618666 * @{
     
    620668
    621669/**
    622  * AVL Core node.
     670 * AVL RTUINTPTR range node core.
    623671 */
    624672typedef struct _AVLRUIntPtrNodeCore
    625673{
    626674    /** First key value in the range (inclusive). */
    627     RTUINTPTR           Key;
     675    RTUINTPTR                       Key;
    628676    /** Last key value in the range (inclusive). */
    629     RTUINTPTR           KeyLast;
    630     /** Offset to the left leaf node, relative to this field. */
    631     struct _AVLRUIntPtrNodeCore *pLeft;
    632     /** Offset to the right leaf node, relative to this field. */
    633     struct _AVLRUIntPtrNodeCore *pRight;
    634     /** Height of this tree: max(height(left), height(right)) + 1 */
    635     unsigned char       uchHeight;
    636 } AVLRUINTPTRNODECORE, *PAVLRUINTPTRNODECORE;
    637 
    638 /** A offset base tree with RTUINTPTR keys. */
     677    RTUINTPTR                       KeyLast;
     678    /** Offset to the left leaf node, relative to this field. */
     679    struct _AVLRUIntPtrNodeCore    *pLeft;
     680    /** Offset to the right leaf node, relative to this field. */
     681    struct _AVLRUIntPtrNodeCore    *pRight;
     682    /** Height of this tree: max(height(left), height(right)) + 1 */
     683    unsigned char                   uchHeight;
     684} AVLRUINTPTRNODECORE;
     685/** Pointer to an AVL RTUINTPTR range node code. */
     686typedef AVLRUINTPTRNODECORE *PAVLRUINTPTRNODECORE;
     687
     688/** A pointer based tree with RTUINTPTR ranges. */
    639689typedef PAVLRUINTPTRNODECORE AVLRUINTPTRTREE;
    640 /** Pointer to a offset base tree with RTUINTPTR keys. */
     690/** Pointer to a pointer based tree with RTUINTPTR ranges. */
    641691typedef AVLRUINTPTRTREE     *PAVLRUINTPTRTREE;
    642692
    643693/** Pointer to an internal tree pointer.
    644  * In this case it's a pointer to a relative offset. */
     694 * In this case it's a pointer to a pointer. */
    645695typedef AVLRUINTPTRTREE     *PPAVLRUINTPTRNODECORE;
    646696
  • trunk/include/iprt/dbg.h

    r20738 r20740  
    7171typedef struct RTDBGSYMBOL
    7272{
    73     /** Symbol value (address). */
     73    /** Symbol value (address).
     74     * This depends a bit who you ask. It will be the same as offSeg when you
     75     * as RTDbgMod, but the mapping address if you ask RTDbgAs. */
    7476    RTUINTPTR           Value;
    75     /** Segment number when applicable or NIL_RTDBGSEGIDX. */
     77    /** Offset into the segment specified by iSeg. */
     78    RTUINTPTR           offSeg;
     79    /** Segment number. */
    7680    RTDBGSEGIDX         iSeg;
    7781    /** Symbol size. */
     
    8791typedef const RTDBGSYMBOL *PCRTDBGSYMBOL;
    8892
     93/**
     94 * Allocate a new symbol structure.
     95 *
     96 * @returns Pointer to a new structure on success, NULL on failure.
     97 */
    8998RTDECL(PRTDBGSYMBOL) RTDbgSymbolAlloc(void);
     99
     100/**
     101 * Duplicates a symbol structure.
     102 *
     103 * @returns Pointer to duplicate on success, NULL on failure.
     104 *
     105 * @param   pSymbol         The symbol to duplicate.
     106 */
    90107RTDECL(PRTDBGSYMBOL) RTDbgSymbolDup(PCRTDBGSYMBOL pSymbol);
    91 RTDECL(void)         RTDbgSymbolFree(PRTDBGSYMBOL pSymbol);
     108
     109/**
     110 * Free a symbol structure previously allocated by a RTDbg method.
     111 *
     112 * @param   pSymbol         The symbol to free. NULL is ignored.
     113 */
     114RTDECL(void) RTDbgSymbolFree(PRTDBGSYMBOL pSymbol);
     115
     116
     117/** Max length (including '\\0') of a debug info file name. */
     118#define RTDBG_FILE_NAME_LENGTH   (260)
    92119
    93120
     
    97124typedef struct RTDBGLINE
    98125{
    99     /** Address. */
     126    /** Address.
     127     * This depends a bit who you ask. It will be the same as offSeg when you
     128     * as RTDbgMod, but the mapping address if you ask RTDbgAs. */
    100129    RTUINTPTR           Address;
    101     /** Segment number when applicable or NIL_RTDBGSEGIDX. */
     130    /** Offset into the segment specified by iSeg. */
     131    RTUINTPTR           offSeg;
     132    /** Segment number. */
    102133    RTDBGSEGIDX         iSeg;
    103134    /** Line number. */
    104135    uint32_t            uLineNo;
    105136    /** Filename. */
    106     char                szFilename[260];
     137    char                szFilename[RTDBG_FILE_NAME_LENGTH];
    107138} RTDBGLINE;
    108139/** Pointer to debug line number. */
     
    360391 * @retval  VERR_INVALID_HANDLE if hDbgAs is invalid.
    361392 * @retval  VERR_NOT_FOUND if no module was found at the specified address.
     393 * @retval  VERR_NOT_SUPPORTED if the module interpret doesn't support adding
     394 *          custom symbols.
    362395 *
    363396 * @param   hDbgAs          The address space handle.
     
    365398 * @param   Addr            The address of the symbol.
    366399 * @param   cb              The size of the symbol.
    367  */
    368 RTDECL(int) RTDbgAsSymbolAdd(RTDBGAS hDbgAs, const char *pszSymbol, RTUINTPTR Addr, uint32_t cb);
     400 * @param   fFlags          Symbol flags.
     401 */
     402RTDECL(int) RTDbgAsSymbolAdd(RTDBGAS hDbgAs, const char *pszSymbol, RTUINTPTR Addr, RTUINTPTR cb, uint32_t fFlags);
    369403
    370404/**
     
    472506RTDECL(RTUINTPTR)   RTDbgModImageSize(RTDBGMOD hDbgMod);
    473507RTDECL(RTUINTPTR)   RTDbgModSegmentSize(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg);
     508RTDECL(RTUINTPTR)   RTDbgModSegmentRva(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg);
    474509RTDECL(RTDBGSEGIDX) RTDbgModSegmentCount(RTDBGMOD hDbgMod);
    475510
    476 RTDECL(int)         RTDbgModSymbolAdd(RTDBGMOD hDbgMod, const char *pszSymbol, RTDBGSEGIDX iSeg, RTUINTPTR off, uint32_t cb);
     511RTDECL(int)         RTDbgModSymbolAdd(RTDBGMOD hDbgMod, const char *pszSymbol, RTDBGSEGIDX iSeg, RTUINTPTR off, RTUINTPTR cb, uint32_t fFlags);
    477512RTDECL(uint32_t)    RTDbgModSymbolCount(RTDBGMOD hDbgMod);
    478513RTDECL(int)         RTDbgModSymbolByIndex(RTDBGMOD hDbgMod, uint32_t iSymbol, PRTDBGSYMBOL pSymbol);
     
    482517RTDECL(int)         RTDbgModSymbolByNameA(RTDBGMOD hDbgMod, const char *pszSymbol, PRTDBGSYMBOL *ppSymbol);
    483518
     519RTDECL(int)         RTDbgModLineAdd(RTDBGMOD hDbgMod, const char *pszFile, uint32_t uLineNo, RTDBGSEGIDX iSeg, RTUINTPTR off);
    484520RTDECL(int)         RTDbgModLineByAddr(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE pLine);
    485521RTDECL(int)         RTDbgModLineByAddrA(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE *ppLine);
  • trunk/include/iprt/err.h

    r20739 r20740  
    946946/** Invalid segment offset. */
    947947#define VERR_DBG_INVALID_SEGMENT_OFFSET         (-652)
     948/** Invalid image relative virtual address. */
     949#define VERR_DBG_INVALID_RVA                    (-653)
    948950/** The module contains no line number information. */
    949 #define VERR_DBG_NO_LINE_NUMBERS                (-653)
     951#define VERR_DBG_NO_LINE_NUMBERS                (-654)
     952/** Address conflict within a module/segment.
     953 * Attempted to add a symbol or line number that fully or partially overlaps with an existing one.  */
     954#define VERR_DBG_ADDRESS_CONFLICT               (-655)
     955/** Duplicate symbol within the module.
     956 * Attempted to add a symbol which name already exists within the module.  */
     957#define VERR_DBG_DUPLICATE_SYMBOL               (-656)
     958/** The length of the symbol name is out of range.
     959 * This means it is an empty string or that it's greater or equal to
     960 * RTDBG_SYMBOL_NAME_LENGTH. */
     961#define VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE       (-657)
     962/** The length of the file name is out of range.
     963 * This means it is an empty string or that it's greater or equal to
     964 * RTDBG_FILE_NAME_LENGTH. */
     965#define VERR_DBG_FILE_NAME_OUT_OF_RANGE         (-658)
    950966/** @} */
    951967
  • trunk/include/iprt/types.h

    r20360 r20740  
    388388/** Pointer const to unsigned integer which can contain both GC and HC pointers. */
    389389typedef const RTUINTPTR *PCRTUINTPTR;
     390/** The maximum value the RTUINTPTR type can hold. */
     391#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32)
     392# define RTUINTPTR_MAX  UINT32_MAX
     393#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
     394# define RTUINTPTR_MAX  UINT64_MAX
     395#else
     396#  error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
     397#endif
    390398
    391399/** Signed integer. */
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