Changeset 9273 in vbox for trunk/src/VBox
- Timestamp:
- May 31, 2008 6:46:03 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 31474
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/DBGFDisas.cpp
r9154 r9273 20 20 */ 21 21 22 #define USE_DIS_FORMAT 22 23 23 24 /******************************************************************************* … … 92 93 static int dbgfR3DisasInstrFirst(PVM pVM, PSELMSELINFO pSelInfo, PGMMODE enmMode, RTGCPTR GCPtr, PDBGFDISASSTATE pState) 93 94 { 94 pState->Cpu.mode = pSelInfo->Raw.Gen.u1DefBig ? CPUMODE_32BIT : CPUMODE_16BIT;95 pState->Cpu.pfnReadBytes = dbgfR3DisasInstrRead;96 95 pState->GCPtrSegBase = pSelInfo->GCPtrBase; 97 96 pState->GCPtrSegEnd = pSelInfo->cbLimit + 1 + (RTGCUINTPTR)pSelInfo->GCPtrBase; … … 104 103 Assert((uintptr_t)GCPtr == GCPtr); 105 104 uint32_t cbInstr; 105 #ifdef USE_DIS_FORMAT 106 int rc = DISCoreOneEx(GCPtr, 107 pSelInfo->Raw.Gen.u1DefBig 108 ? enmMode >= PGMMODE_AMD64 && pSelInfo->Raw.Gen.u1Reserved 109 ? CPUMODE_64BIT 110 : CPUMODE_32BIT 111 : CPUMODE_16BIT, 112 dbgfR3DisasInstrRead, 113 &pState->Cpu, 114 &pState->Cpu, 115 &cbInstr); 116 #else 117 pState->Cpu.mode = pSelInfo->Raw.Gen.u1DefBig ? CPUMODE_32BIT : CPUMODE_16BIT; 118 pState->Cpu.pfnReadBytes = dbgfR3DisasInstrRead; 106 119 int rc = DISInstr(&pState->Cpu, GCPtr, 0, &cbInstr, NULL); 120 #endif 107 121 if (VBOX_SUCCESS(rc)) 108 122 { … … 231 245 232 246 247 #ifdef USE_DIS_FORMAT 248 /** 249 * @copydoc FNDISGETSYMBOL 250 */ 251 static DECLCALLBACK(int) dbgfR3DisasGetSymbol(PCDISCPUSTATE pCpu, uint32_t u32Sel, RTUINTPTR uAddress, char *pszBuf, size_t cchBuf, RTINTPTR *poff, void *pvUser) 252 { 253 PDBGFDISASSTATE pState = (PDBGFDISASSTATE)pCpu; 254 PCSELMSELINFO pSelInfo = (PCSELMSELINFO)pvUser; 255 DBGFSYMBOL Sym; 256 RTGCINTPTR off; 257 int rc; 258 259 if (DIS_FMT_SEL_IS_REG(u32Sel)) 260 { 261 if (DIS_FMT_SEL_GET_REG(u32Sel) == USE_REG_CS) 262 rc = DBGFR3SymbolByAddr(pState->pVM, uAddress + pSelInfo->GCPtrBase, &off, &Sym); 263 else 264 rc = VERR_SYMBOL_NOT_FOUND; /** @todo implement this */ 265 } 266 else 267 { 268 if (pSelInfo->Sel == DIS_FMT_SEL_GET_VALUE(u32Sel)) 269 rc = DBGFR3SymbolByAddr(pState->pVM, uAddress + pSelInfo->GCPtrBase, &off, &Sym); 270 else 271 rc = VERR_SYMBOL_NOT_FOUND; /** @todo implement this */ 272 } 273 274 if (RT_SUCCESS(rc)) 275 { 276 size_t cchName = strlen(Sym.szName); 277 if (cchName >= cchBuf) 278 cchName = cchBuf - 1; 279 memcpy(pszBuf, Sym.szName, cchName); 280 pszBuf[cchName] = '\0'; 281 282 *poff = off; 283 } 284 285 return rc; 286 } 287 #else 233 288 /** 234 289 * Copy a string and return pointer to the terminator char in the copy. … … 240 295 return pszDst + cch; 241 296 } 297 #endif 242 298 243 299 … … 361 417 * Format it. 362 418 */ 419 #ifdef USE_DIS_FORMAT 420 char szBuf[512]; 421 DISFormatYasmEx(&State.Cpu, szBuf, sizeof(szBuf), 422 DIS_FMT_FLAGS_RELATIVE_BRANCH, 423 fFlags & DBGF_DISAS_FLAGS_NO_SYMBOLS ? NULL : dbgfR3DisasGetSymbol, 424 &SelInfo); 425 #else 363 426 char szBuf[512]; 364 427 char *psz = &szBuf[0]; … … 429 492 case CPUMODE_16BIT: GCPtrTarget &= UINT16_MAX; break; 430 493 case CPUMODE_32BIT: GCPtrTarget &= UINT32_MAX; break; 494 case CPUMODE_64BIT: GCPtrTarget &= UINT64_MAX; break; 431 495 default: break; 432 496 } … … 558 622 } /* foreach char in pszFormat */ 559 623 *psz = '\0'; 624 #endif /* !USE_DIS_FORMAT */ 560 625 561 626 /*
Note:
See TracChangeset
for help on using the changeset viewer.