VirtualBox

Changeset 40855 in vbox


Ignore:
Timestamp:
Apr 10, 2012 3:10:41 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
77384
Message:

RTR0DbgKrnlInfo: Release shall accept NIL handle. Made QuerySymbol accept ppvSymbol=NULL. Promoted the magic.

Location:
trunk
Files:
3 edited

Legend:

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

    r40705 r40855  
    11511151# endif /* IN_RING3 */
    11521152
    1153 # ifdef IN_RING0
    11541153
    11551154/** @name Kernel Debug Info API
     
    12321231 * @param   pszModule       Reserved for future extensions. Pass NULL.
    12331232 * @param   pszSymbol       The C name of the symbol.
    1234  * @param   ppvSymbol       Where to return the symbol value.
     1233 * @param   ppvSymbol       Where to return the symbol value, passing NULL is
     1234 *                          OK. This may be modified even on failure, in
     1235 *                          particular, it will be set to NULL when
     1236 *                          VERR_SYMBOL_NOT_FOUND is returned.
    12351237 *
    12361238 * @sa      RTLdrGetSymbol.
     
    12401242/** @} */
    12411243
    1242 # endif /* IN_RING0 */
    1243 
    12441244/** @} */
    12451245
  • trunk/src/VBox/Runtime/include/internal/magics.h

    r40029 r40855  
    3939/** Magic number for RTDBGMODVTIMG::u32Magic. (Cecil McBee) */
    4040#define RTDBGMODVTIMG_MAGIC             UINT32_C(0x19350419)
     41/** Magic value for RTDBGKRNLINFOINT::u32Magic. (John Carmack) */
     42#define RTDBGKRNLINFO_MAGIC             UINT32_C(0x19700820)
    4143/** The value of RTDIR::u32Magic. (Michael Ende) */
    4244#define RTDIR_MAGIC                     UINT32_C(0x19291112)
  • trunk/src/VBox/Runtime/r0drv/solaris/dbg-r0drv-solaris.c

    r40745 r40855  
    4040#include <iprt/string.h>
    4141#include <iprt/thread.h>
     42
     43#include "internal/magics.h"
    4244
    4345
     
    6264typedef struct RTDBGKRNLINFOINT *PRTDBGKRNLINFOINT;
    6365
    64 /** Magic value for RTDBGKRNLINFOINT::u32Magic. (John Carmack) */
    65 #define RTDBGKRNLINFO_MAGIC       UINT32_C(0x19700820)
    66 
    6766
    6867/**
     
    168167{
    169168    PRTDBGKRNLINFOINT pThis = hKrnlInfo;
     169    AssertPtrReturn(pThis, UINT32_MAX);
     170    AssertMsgReturn(pThis->u32Magic == RTDBGKRNLINFO_MAGIC, ("%p: u32Magic=%RX32\n", pThis, pThis->u32Magic), UINT32_MAX);
     171
    170172    uint32_t cRefs = ASMAtomicIncU32(&pThis->cRefs);
    171173    Assert(cRefs && cRefs < 100000);
     
    177179{
    178180    PRTDBGKRNLINFOINT pThis = hKrnlInfo;
     181    if (pThis == NIL_RTDBGKRNLINFO)
     182        return 0;
    179183    AssertPtrReturn(pThis, UINT32_MAX);
    180184    AssertMsgReturn(pThis->u32Magic == RTDBGKRNLINFO_MAGIC, ("%p: u32Magic=%RX32\n", pThis, pThis->u32Magic), UINT32_MAX);
     
    227231    AssertMsgReturn(pThis->u32Magic == RTDBGKRNLINFO_MAGIC, ("%p: u32Magic=%RX32\n", pThis, pThis->u32Magic), VERR_INVALID_HANDLE);
    228232    AssertPtrReturn(pszSymbol, VERR_INVALID_PARAMETER);
    229     AssertPtrReturn(ppvSymbol, VERR_INVALID_PARAMETER);
     233    AssertPtrNullReturn(ppvSymbol, VERR_INVALID_PARAMETER);
    230234    AssertReturn(!pszModule, VERR_MODULE_NOT_FOUND);
    231235    RT_ASSERT_PREEMPTIBLE();
    232236
    233     *ppvSymbol = (void *)kobj_getsymvalue((char *)pszSymbol, 1 /* only kernel */);
    234     if (*ppvSymbol)
     237    uintptr_t uValue = kobj_getsymvalue((char *)pszSymbol, 1 /* only kernel */);
     238    if (ppvSymbol)
     239        *ppvSymbol = (void *)uValue;
     240    if (uValue)
    235241        return VINF_SUCCESS;
    236 
    237242    return VERR_SYMBOL_NOT_FOUND;
    238243}
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