Changeset 72269 in vbox for trunk/src/VBox/Debugger/DBGCEmulateCodeView.cpp
- Timestamp:
- May 20, 2018 11:30:10 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/DBGCEmulateCodeView.cpp
r69500 r72269 5893 5893 * those matching the input. 5894 5894 */ 5895 RTDBGAS hAs = DBGFR3AsResolveAndRetain(pUVM, pDbgc->hDbgAs); 5896 uint32_t cMods = RTDbgAsModuleCount(hAs); 5897 for (uint32_t iMod = 0; iMod < cMods; iMod++) 5898 { 5899 RTDBGMOD hMod = RTDbgAsModuleByIndex(hAs, iMod); 5900 if (hMod != NIL_RTDBGMOD) 5901 { 5902 bool const fDeferred = RTDbgModIsDeferred(hMod); 5903 bool const fExports = RTDbgModIsExports(hMod); 5904 uint32_t const cSegs = fDeferred ? 1 : RTDbgModSegmentCount(hMod); 5905 const char * const pszName = RTDbgModName(hMod); 5906 const char * const pszImgFile = RTDbgModImageFile(hMod); 5907 const char * const pszImgFileUsed = RTDbgModImageFileUsed(hMod); 5908 const char * const pszDbgFile = RTDbgModDebugFile(hMod); 5909 if ( cArgs == 0 5910 || dbgcCmdListModuleMatch(pszName, paArgs, cArgs)) 5895 RTDBGAS hAsCurAlias = pDbgc->hDbgAs; 5896 for (uint32_t iAs = 0;; iAs++) 5897 { 5898 RTDBGAS hAs = DBGFR3AsResolveAndRetain(pUVM, hAsCurAlias); 5899 uint32_t cMods = RTDbgAsModuleCount(hAs); 5900 for (uint32_t iMod = 0; iMod < cMods; iMod++) 5901 { 5902 RTDBGMOD hMod = RTDbgAsModuleByIndex(hAs, iMod); 5903 if (hMod != NIL_RTDBGMOD) 5911 5904 { 5912 /* 5913 * Find the mapping with the lower address, preferring a full 5914 * image mapping, for the main line. 5915 */ 5916 RTDBGASMAPINFO aMappings[128]; 5917 uint32_t cMappings = RT_ELEMENTS(aMappings); 5918 int rc = RTDbgAsModuleQueryMapByIndex(hAs, iMod, &aMappings[0], &cMappings, 0 /*fFlags*/); 5919 if (RT_SUCCESS(rc)) 5905 bool const fDeferred = RTDbgModIsDeferred(hMod); 5906 bool const fExports = RTDbgModIsExports(hMod); 5907 uint32_t const cSegs = fDeferred ? 1 : RTDbgModSegmentCount(hMod); 5908 const char * const pszName = RTDbgModName(hMod); 5909 const char * const pszImgFile = RTDbgModImageFile(hMod); 5910 const char * const pszImgFileUsed = RTDbgModImageFileUsed(hMod); 5911 const char * const pszDbgFile = RTDbgModDebugFile(hMod); 5912 if ( cArgs == 0 5913 || dbgcCmdListModuleMatch(pszName, paArgs, cArgs)) 5920 5914 { 5921 bool fFull = false; 5922 RTUINTPTR uMin = RTUINTPTR_MAX; 5923 for (uint32_t iMap = 0; iMap < cMappings; iMap++) 5924 if ( aMappings[iMap].Address < uMin 5925 && ( !fFull 5926 || aMappings[iMap].iSeg == NIL_RTDBGSEGIDX)) 5927 uMin = aMappings[iMap].Address; 5928 if (!fVerbose || !pszImgFile) 5929 DBGCCmdHlpPrintf(pCmdHlp, "%RGv %04x %s%s\n", (RTGCUINTPTR)uMin, cSegs, pszName, 5930 fExports ? " (exports)" : fDeferred ? " (deferred)" : ""); 5931 else 5932 DBGCCmdHlpPrintf(pCmdHlp, "%RGv %04x %-12s %s%s\n", (RTGCUINTPTR)uMin, cSegs, pszName, pszImgFile, 5933 fExports ? " (exports)" : fDeferred ? " (deferred)" : ""); 5934 if (fVerbose && pszImgFileUsed) 5935 DBGCCmdHlpPrintf(pCmdHlp, " Local image: %s\n", pszImgFileUsed); 5936 if (fVerbose && pszDbgFile) 5937 DBGCCmdHlpPrintf(pCmdHlp, " Debug file: %s\n", pszDbgFile); 5938 5939 if (fMappings) 5915 /* 5916 * Find the mapping with the lower address, preferring a full 5917 * image mapping, for the main line. 5918 */ 5919 RTDBGASMAPINFO aMappings[128]; 5920 uint32_t cMappings = RT_ELEMENTS(aMappings); 5921 int rc = RTDbgAsModuleQueryMapByIndex(hAs, iMod, &aMappings[0], &cMappings, 0 /*fFlags*/); 5922 if (RT_SUCCESS(rc)) 5940 5923 { 5941 /* sort by address first - not very efficient. */ 5942 for (uint32_t i = 0; i + 1 < cMappings; i++) 5943 for (uint32_t j = i + 1; j < cMappings; j++) 5944 if (aMappings[j].Address < aMappings[i].Address) 5924 bool fFull = false; 5925 RTUINTPTR uMin = RTUINTPTR_MAX; 5926 for (uint32_t iMap = 0; iMap < cMappings; iMap++) 5927 if ( aMappings[iMap].Address < uMin 5928 && ( !fFull 5929 || aMappings[iMap].iSeg == NIL_RTDBGSEGIDX)) 5930 uMin = aMappings[iMap].Address; 5931 if (!fVerbose || !pszImgFile) 5932 DBGCCmdHlpPrintf(pCmdHlp, "%RGv %04x %s%s\n", (RTGCUINTPTR)uMin, cSegs, pszName, 5933 fExports ? " (exports)" : fDeferred ? " (deferred)" : ""); 5934 else 5935 DBGCCmdHlpPrintf(pCmdHlp, "%RGv %04x %-12s %s%s\n", (RTGCUINTPTR)uMin, cSegs, pszName, pszImgFile, 5936 fExports ? " (exports)" : fDeferred ? " (deferred)" : ""); 5937 if (fVerbose && pszImgFileUsed) 5938 DBGCCmdHlpPrintf(pCmdHlp, " Local image: %s\n", pszImgFileUsed); 5939 if (fVerbose && pszDbgFile) 5940 DBGCCmdHlpPrintf(pCmdHlp, " Debug file: %s\n", pszDbgFile); 5941 5942 if (fMappings) 5943 { 5944 /* sort by address first - not very efficient. */ 5945 for (uint32_t i = 0; i + 1 < cMappings; i++) 5946 for (uint32_t j = i + 1; j < cMappings; j++) 5947 if (aMappings[j].Address < aMappings[i].Address) 5948 { 5949 RTDBGASMAPINFO Tmp = aMappings[j]; 5950 aMappings[j] = aMappings[i]; 5951 aMappings[i] = Tmp; 5952 } 5953 5954 /* print */ 5955 if ( cMappings == 1 5956 && aMappings[0].iSeg == NIL_RTDBGSEGIDX 5957 && !fDeferred) 5958 { 5959 for (uint32_t iSeg = 0; iSeg < cSegs; iSeg++) 5945 5960 { 5946 RTDBGASMAPINFO Tmp = aMappings[j]; 5947 aMappings[j] = aMappings[i]; 5948 aMappings[i] = Tmp; 5961 RTDBGSEGMENT SegInfo; 5962 rc = RTDbgModSegmentByIndex(hMod, iSeg, &SegInfo); 5963 if (RT_SUCCESS(rc)) 5964 { 5965 if (SegInfo.uRva != RTUINTPTR_MAX) 5966 DBGCCmdHlpPrintf(pCmdHlp, " %RGv %RGv #%02x %s\n", 5967 (RTGCUINTPTR)(aMappings[0].Address + SegInfo.uRva), 5968 (RTGCUINTPTR)SegInfo.cb, iSeg, SegInfo.szName); 5969 else 5970 DBGCCmdHlpPrintf(pCmdHlp, " %*s %RGv #%02x %s\n", 5971 sizeof(RTGCUINTPTR)*2, "noload", 5972 (RTGCUINTPTR)SegInfo.cb, iSeg, SegInfo.szName); 5973 } 5974 else 5975 DBGCCmdHlpPrintf(pCmdHlp, " Error query segment #%u: %Rrc\n", iSeg, rc); 5949 5976 } 5950 5951 /* print */ 5952 if ( cMappings == 1 5953 && aMappings[0].iSeg == NIL_RTDBGSEGIDX 5954 && !fDeferred) 5955 { 5956 for (uint32_t iSeg = 0; iSeg < cSegs; iSeg++) 5977 } 5978 else 5957 5979 { 5958 RTDBGSEGMENT SegInfo; 5959 rc = RTDbgModSegmentByIndex(hMod, iSeg, &SegInfo); 5960 if (RT_SUCCESS(rc)) 5961 { 5962 if (SegInfo.uRva != RTUINTPTR_MAX) 5980 for (uint32_t iMap = 0; iMap < cMappings; iMap++) 5981 if (aMappings[iMap].iSeg == NIL_RTDBGSEGIDX) 5982 DBGCCmdHlpPrintf(pCmdHlp, " %RGv %RGv <everything>\n", 5983 (RTGCUINTPTR)aMappings[iMap].Address, 5984 (RTGCUINTPTR)RTDbgModImageSize(hMod)); 5985 else if (!fDeferred) 5986 { 5987 RTDBGSEGMENT SegInfo; 5988 rc = RTDbgModSegmentByIndex(hMod, aMappings[iMap].iSeg, &SegInfo); 5989 if (RT_FAILURE(rc)) 5990 { 5991 RT_ZERO(SegInfo); 5992 strcpy(SegInfo.szName, "error"); 5993 } 5963 5994 DBGCCmdHlpPrintf(pCmdHlp, " %RGv %RGv #%02x %s\n", 5964 (RTGCUINTPTR)(aMappings[0].Address + SegInfo.uRva), 5965 (RTGCUINTPTR)SegInfo.cb, iSeg, SegInfo.szName); 5995 (RTGCUINTPTR)aMappings[iMap].Address, 5996 (RTGCUINTPTR)SegInfo.cb, 5997 aMappings[iMap].iSeg, SegInfo.szName); 5998 } 5966 5999 else 5967 DBGCCmdHlpPrintf(pCmdHlp, " %*s %RGv #%02x %s\n", 5968 sizeof(RTGCUINTPTR)*2, "noload", 5969 (RTGCUINTPTR)SegInfo.cb, iSeg, SegInfo.szName); 5970 } 5971 else 5972 DBGCCmdHlpPrintf(pCmdHlp, " Error query segment #%u: %Rrc\n", iSeg, rc); 6000 DBGCCmdHlpPrintf(pCmdHlp, " %RGv #%02x\n", 6001 (RTGCUINTPTR)aMappings[iMap].Address, aMappings[iMap].iSeg); 5973 6002 } 5974 6003 } 5975 else5976 {5977 for (uint32_t iMap = 0; iMap < cMappings; iMap++)5978 if (aMappings[iMap].iSeg == NIL_RTDBGSEGIDX)5979 DBGCCmdHlpPrintf(pCmdHlp, " %RGv %RGv <everything>\n",5980 (RTGCUINTPTR)aMappings[iMap].Address,5981 (RTGCUINTPTR)RTDbgModImageSize(hMod));5982 else if (!fDeferred)5983 {5984 RTDBGSEGMENT SegInfo;5985 rc = RTDbgModSegmentByIndex(hMod, aMappings[iMap].iSeg, &SegInfo);5986 if (RT_FAILURE(rc))5987 {5988 RT_ZERO(SegInfo);5989 strcpy(SegInfo.szName, "error");5990 }5991 DBGCCmdHlpPrintf(pCmdHlp, " %RGv %RGv #%02x %s\n",5992 (RTGCUINTPTR)aMappings[iMap].Address,5993 (RTGCUINTPTR)SegInfo.cb,5994 aMappings[iMap].iSeg, SegInfo.szName);5995 }5996 else5997 DBGCCmdHlpPrintf(pCmdHlp, " %RGv #%02x\n",5998 (RTGCUINTPTR)aMappings[iMap].Address, aMappings[iMap].iSeg);5999 }6000 6004 } 6005 else 6006 DBGCCmdHlpPrintf(pCmdHlp, "%.*s %04x %s (rc=%Rrc)\n", 6007 sizeof(RTGCPTR) * 2, "???????????", cSegs, pszName, rc); 6008 /** @todo missing address space API for enumerating the mappings. */ 6001 6009 } 6002 else 6003 DBGCCmdHlpPrintf(pCmdHlp, "%.*s %04x %s (rc=%Rrc)\n", 6004 sizeof(RTGCPTR) * 2, "???????????", cSegs, pszName, rc); 6005 /** @todo missing address space API for enumerating the mappings. */ 6010 RTDbgModRelease(hMod); 6006 6011 } 6007 RTDbgModRelease(hMod); 6008 } 6009 } 6010 RTDbgAsRelease(hAs); 6012 } 6013 RTDbgAsRelease(hAs); 6014 6015 /* For DBGF_AS_RC_AND_GC_GLOBAL we're required to do more work. */ 6016 if (hAsCurAlias != DBGF_AS_RC_AND_GC_GLOBAL) 6017 break; 6018 AssertBreak(iAs == 0); 6019 hAsCurAlias = DBGF_AS_GLOBAL; 6020 } 6011 6021 6012 6022 NOREF(pCmd);
Note:
See TracChangeset
for help on using the changeset viewer.