/** * Query an address space by process ID. * * @returns Retained address space handle if found, NIL_RTDBGAS if not. * * @param pUVM The user mode VM handle. * @param ProcId The process ID. */ VMMR3DECL(RTDBGAS) DBGFR3AsQueryByPid(PUVM pUVM, RTPROCESS ProcId) { /* * Validate the input. */ UVM_ASSERT_VALID_EXT_RETURN(pUVM, NIL_RTDBGAS); AssertReturn(ProcId != NIL_RTPROCESS, NIL_RTDBGAS); /* * Look it up in the PID tree and retain the result. */ RTDBGAS hDbgAs = NIL_RTDBGAS; DBGF_AS_DB_LOCK_READ(pUVM); PAVLU32NODECORE pNode = RTAvlU32Get(&pUVM->dbgf.s.AsPidTree, ProcId); if (pNode) { PDBGFASDBNODE pDbNode = RT_FROM_MEMBER(pNode, DBGFASDBNODE, PidCore); hDbgAs = (RTDBGAS)pDbNode->HandleCore.Key; uint32_t cRefs = RTDbgAsRetain(hDbgAs); if (RT_UNLIKELY(cRefs == UINT32_MAX)) hDbgAs = NIL_RTDBGAS; } DBGF_AS_DB_UNLOCK_READ(pUVM); return hDbgAs; }
/** @copydoc RTDBGMODVTDBG::pfnSymbolByOrdinal */ static DECLCALLBACK(int) rtDbgModContainer_SymbolByOrdinal(PRTDBGMODINT pMod, uint32_t iOrdinal, PRTDBGSYMBOL pSymInfo) { PRTDBGMODCTN pThis = (PRTDBGMODCTN)pMod->pvDbgPriv; /* * Look it up in the ordinal tree. */ if (iOrdinal >= pThis->iNextSymbolOrdinal) return pThis->iNextSymbolOrdinal ? VERR_DBG_NO_SYMBOLS : VERR_SYMBOL_NOT_FOUND; PAVLU32NODECORE pAvlCore = RTAvlU32Get(&pThis->SymbolOrdinalTree, iOrdinal); AssertReturn(pAvlCore, VERR_SYMBOL_NOT_FOUND); PCRTDBGMODCTNSYMBOL pMySym = RT_FROM_MEMBER(pAvlCore, RTDBGMODCTNSYMBOL const, OrdinalCore); return rtDbgModContainerReturnSymbol(pMySym, pSymInfo); }
/** @copydoc RTDBGMODVTDBG::pfnLineByOrdinal */ static DECLCALLBACK(int) rtDbgModContainer_LineByOrdinal(PRTDBGMODINT pMod, uint32_t iOrdinal, PRTDBGLINE pLineInfo) { PRTDBGMODCTN pThis = (PRTDBGMODCTN)pMod->pvDbgPriv; /* * Look it up. */ if (iOrdinal >= pThis->iNextLineOrdinal) return pThis->iNextLineOrdinal ? VERR_DBG_LINE_NOT_FOUND : VERR_DBG_NO_LINE_NUMBERS; PAVLU32NODECORE pAvlCore = RTAvlU32Get(&pThis->LineOrdinalTree, iOrdinal); AssertReturn(pAvlCore, VERR_DBG_LINE_NOT_FOUND); PCRTDBGMODCTNLINE pMyLine = RT_FROM_MEMBER(pAvlCore, RTDBGMODCTNLINE const, OrdinalCore); pLineInfo->Address = pMyLine->AddrCore.Key; pLineInfo->offSeg = pMyLine->AddrCore.Key; pLineInfo->iSeg = pMyLine->iSeg; pLineInfo->uLineNo = pMyLine->uLineNo; pLineInfo->iOrdinal = pMyLine->OrdinalCore.Key; strcpy(pLineInfo->szFilename, pMyLine->pszFile); return VINF_SUCCESS; }