Changeset 40689 in vbox for trunk/src/VBox/Runtime/r0drv/solaris
- Timestamp:
- Mar 28, 2012 3:06:05 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 77143
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/solaris/dbg-r0drv-solaris.c
r40670 r40689 38 38 #include <iprt/mem.h> 39 39 #include <iprt/string.h> 40 #include <iprt/thread.h> 40 41 41 42 #include <sys/kobj.h> … … 48 49 * Structures and Typedefs * 49 50 *******************************************************************************/ 51 /** 52 * Solaris kernel debug info instance data. 53 */ 50 54 typedef struct RTDBGKRNLINFOINT 51 55 { 52 /** Magic value ( ). */56 /** Magic value (RTDBGKRNLINFO_MAGIC). */ 53 57 uint32_t volatile u32Magic; 54 58 /** The number of threads referencing this object. */ … … 59 63 modctl_t *pGenUnixMod; 60 64 } RTDBGKRNLINFOINT; 65 /** Pointer to the solaris kernel debug info instance data. */ 61 66 typedef struct RTDBGKRNLINFOINT *PRTDBGKRNLINFOINT; 67 62 68 /** Magic value for RTDBGKRNLINFOINT::u32Magic. (John Carmack) */ 63 69 #define RTDBGKRNLINFO_MAGIC UINT32_C(0x19700820) … … 74 80 return VERR_NO_MEMORY; 75 81 76 int rc = VINF_SUCCESS; 82 int rc; 83 /** @todo r=bird: Where do we release this module? I see other users (crypto) of 84 * this API mod_release_mod(). Not sure if this is a real issue with a primary 85 * module like genunix, though. Another thing, I noticed that mod_hold_by_name 86 * will (a) allocated a module if not found and (b) replace the filename with 87 * what you hand in under certain conditions. These issues doesn't apply with 88 * genunix, but is worth keeping in mind if other modules needs to be held. A 89 * safer alternative would probably be mod_name_to_modid + mod_hold_by_id. */ 77 90 pThis->pGenUnixMod = mod_hold_by_name("genunix"); 78 91 if (RT_LIKELY(pThis->pGenUnixMod)) … … 94 107 return VINF_SUCCESS; 95 108 } 96 else 97 { 98 LogRel(("RTR0DbgKrnlInfoOpen: ctf_modopen failed. err=%d\n", err)); 99 rc = VERR_INTERNAL_ERROR_2; 100 } 109 110 LogRel(("RTR0DbgKrnlInfoOpen: ctf_modopen failed. err=%d\n", err)); 111 rc = VERR_INTERNAL_ERROR_2; 101 112 } 102 113 else … … 116 127 Assert(cRefs && cRefs < 100000); 117 128 NOREF(cRefs); 118 } 119 120 static void rtR0DbgKrnlInfoDestroy(RTDBGKRNLINFO hKrnlInfo) 121 { 122 PRTDBGKRNLINFOINT pThis = hKrnlInfo; 123 AssertPtrReturnVoid(pThis); 124 AssertPtrReturnVoid(pThis->u32Magic == RTDBGKRNLINFO_MAGIC); 125 RT_ASSERT_PREEMPTIBLE(); 126 129 return cRefs; 130 } 131 132 133 static void rtR0DbgKrnlInfoDestroy(PRTDBGKRNLINFOINT pThis) 134 { 135 pThis->u32Magic = ~RTDBGKRNLINFO_MAGIC; 127 136 ctf_close(pThis->pGenUnixCTF); 128 137 mod_release_mod(pThis->pGenUnixMod); … … 138 147 RT_ASSERT_PREEMPTIBLE(); 139 148 140 if (ASMAtomicDecU32(&pThis->cRefs) == 0) 149 uint32_t cRefs = ASMAtomicDecU32(&pThis->cRefs); 150 if (cRefs == 0) 141 151 rtR0DbgKrnlInfoDestroy(pThis); 152 return cRefs; 142 153 } 143 154 144 155 145 156 RTR0DECL(int) RTR0DbgKrnlInfoQueryMember(RTDBGKRNLINFO hKrnlInfo, const char *pszStructure, 146 157 const char *pszMember, size_t *poffMember) 147 158 { 148 159 PRTDBGKRNLINFOINT pThis = hKrnlInfo; … … 179 190 AssertPtrReturn(pszSymbol, VERR_INVALID_PARAMETER); 180 191 AssertPtrReturn(ppvSymbol, VERR_INVALID_PARAMETER); 181 RT_ASSERT_PREEMPTIBLE();182 183 NOREF(pszModule); 184 *ppvSymbol = kobj_getsymvalue(pszSymbol, 1 /* only kernel */);192 AssertReturn(!pszModule, VERR_MODULE_NOT_FOUND); 193 RT_ASSERT_PREEMPTIBLE(); 194 195 *ppvSymbol = (void *)kobj_getsymvalue((char *)pszSymbol, 1 /* only kernel */); 185 196 if (*ppvSymbol) 186 197 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.