Changeset 46156 in vbox
- Timestamp:
- May 18, 2013 1:35:16 AM (12 years ago)
- Location:
- trunk/src/VBox/Debugger
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/DBGCEmulateCodeView.cpp
r46114 r46156 689 689 RTINTPTR off; 690 690 DBGFADDRESS Addr; 691 int rc = DBGFR3AsSymbolByAddr(pUVM, pDbgc->hDbgAs, DBGFR3AddrFromFlat(pDbgc->pUVM, &Addr, pBp->GCPtr), &off, &Sym, NULL); 691 int rc = DBGFR3AsSymbolByAddr(pUVM, pDbgc->hDbgAs, DBGFR3AddrFromFlat(pDbgc->pUVM, &Addr, pBp->GCPtr), 692 RTDBGSYMADDR_FLAGS_LESS_OR_EQUAL, &off, &Sym, NULL); 692 693 if (RT_SUCCESS(rc)) 693 694 { … … 697 698 DBGCCmdHlpPrintf(&pDbgc->CmdHlp, "%s+%RGv", Sym.szName, off); 698 699 else 699 DBGCCmdHlpPrintf(&pDbgc->CmdHlp, "%s +%RGv", Sym.szName, -off);700 DBGCCmdHlpPrintf(&pDbgc->CmdHlp, "%s-%RGv", Sym.szName, -off); 700 701 } 701 702 … … 854 855 } 855 856 return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "Failed to set REM breakpoint at %RGv", Address.FlatPtr); 857 } 858 859 860 /** 861 * Helps the unassmble ('u') command display symbols it starts at and passes. 862 * 863 * @param pUVM The user mode VM handle. 864 * @param pCmdHlp The command helpers for printing via. 865 * @param hDbgAs The address space to look up addresses in. 866 * @param pAddress The current address. 867 * @param pcbCallAgain Where to return the distance to the next check (in 868 * instruction bytes). 869 */ 870 static void dbgcCmdUnassambleHelpListNear(PUVM pUVM, PDBGCCMDHLP pCmdHlp, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress, 871 PRTUINTPTR pcbCallAgain) 872 { 873 RTDBGSYMBOL Symbol; 874 RTGCINTPTR offDispSym; 875 int rc = DBGFR3AsSymbolByAddr(pUVM, hDbgAs, pAddress, RTDBGSYMADDR_FLAGS_LESS_OR_EQUAL, &offDispSym, &Symbol, NULL); 876 if (RT_FAILURE(rc) || offDispSym > _1G) 877 rc = DBGFR3AsSymbolByAddr(pUVM, hDbgAs, pAddress, RTDBGSYMADDR_FLAGS_GREATER_OR_EQUAL, &offDispSym, &Symbol, NULL); 878 if (RT_SUCCESS(rc) && offDispSym < _1G) 879 { 880 if (!offDispSym) 881 { 882 DBGCCmdHlpPrintf(pCmdHlp, "%s:\n", Symbol.szName); 883 *pcbCallAgain = Symbol.cb; 884 } 885 else if (offDispSym > 0) 886 { 887 DBGCCmdHlpPrintf(pCmdHlp, "%s+%#llx:\n", Symbol.szName, (uint64_t)offDispSym); 888 *pcbCallAgain = Symbol.cb > (RTGCUINTPTR)offDispSym ? Symbol.cb - (RTGCUINTPTR)offDispSym : 1; 889 } 890 else 891 { 892 DBGCCmdHlpPrintf(pCmdHlp, "%s-%#llx:\n", Symbol.szName, (uint64_t)-offDispSym); 893 *pcbCallAgain = (RTGCUINTPTR)-offDispSym + Symbol.cb; 894 } 895 } 896 else 897 *pcbCallAgain = UINT32_MAX; 856 898 } 857 899 … … 887 929 case 'v': fFlags |= DBGF_DISAS_FLAGS_16BIT_REAL_MODE; break; 888 930 } 931 932 /** @todo should use DBGFADDRESS for everything */ 889 933 890 934 /* … … 913 957 fFlags |= DBGF_DISAS_FLAGS_CURRENT_GUEST; 914 958 else 915 fFlags |= DBGF_DISAS_FLAGS_CURRENT_HYPER ;959 fFlags |= DBGF_DISAS_FLAGS_CURRENT_HYPER | DBGF_DISAS_FLAGS_HYPER; 916 960 } 917 961 pDbgc->DisasmPos.enmRangeType = DBGCVAR_RANGE_NONE; … … 948 992 * Convert physical and host addresses to guest addresses. 949 993 */ 994 RTDBGAS hDbgAs = pDbgc->hDbgAs; 950 995 int rc; 951 996 switch (pDbgc->DisasmPos.enmType) … … 955 1000 break; 956 1001 case DBGCVAR_TYPE_GC_PHYS: 1002 hDbgAs = DBGF_AS_PHYS; 957 1003 case DBGCVAR_TYPE_HC_FLAT: 958 1004 case DBGCVAR_TYPE_HC_PHYS: … … 968 1014 } 969 1015 970 /* 971 * Print address. 972 * todo: Change to list near. 973 */ 974 #if 0 975 rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, "%DV:\n", &pDbgc->DisasmPos); 1016 DBGFADDRESS CurAddr; 1017 rc = DBGCCmdHlpVarToDbgfAddr(pCmdHlp, &pDbgc->DisasmPos, &CurAddr); 976 1018 if (RT_FAILURE(rc)) 977 return rc; 978 #endif 1019 return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "DBGCCmdHlpVarToDbgfAddr failed on '%Dv'", &pDbgc->DisasmPos); 1020 1021 if (CurAddr.fFlags & DBGFADDRESS_FLAGS_HMA) 1022 fFlags |= DBGF_DISAS_FLAGS_HYPER; /* This crap is due to not using DBGFADDRESS as DBGFR3Disas* input. */ 1023 1024 /* 1025 * Figure out where we are and display it. Also calculate when we need to 1026 * check for a new symbol if possible. 1027 */ 1028 RTGCUINTPTR cbCheckSymbol; 1029 dbgcCmdUnassambleHelpListNear(pUVM, pCmdHlp, hDbgAs, &CurAddr, &cbCheckSymbol); 979 1030 980 1031 /* … … 1008 1059 { 1009 1060 /* bitch. */ 1010 rc= DBGCCmdHlpPrintf(pCmdHlp, "Failed to disassemble instruction, skipping one byte.\n");1011 if (RT_FAILURE(rc ))1012 return rc ;1061 int rc2 = DBGCCmdHlpPrintf(pCmdHlp, "Failed to disassemble instruction, skipping one byte.\n"); 1062 if (RT_FAILURE(rc2)) 1063 return rc2; 1013 1064 if (cTries-- > 0) 1014 1065 return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "Too many disassembly failures. Giving up"); … … 1029 1080 break; 1030 1081 fFlags &= ~(DBGF_DISAS_FLAGS_CURRENT_GUEST | DBGF_DISAS_FLAGS_CURRENT_HYPER); 1082 1083 /* Print next symbol? */ 1084 if (cbCheckSymbol <= cbInstr) 1085 { 1086 rc = DBGCCmdHlpVarToDbgfAddr(pCmdHlp, &pDbgc->DisasmPos, &CurAddr); 1087 if (RT_SUCCESS(rc)) 1088 dbgcCmdUnassambleHelpListNear(pUVM, pCmdHlp, hDbgAs, &CurAddr, &cbCheckSymbol); 1089 else 1090 cbCheckSymbol = UINT32_MAX; 1091 } 1092 else 1093 cbCheckSymbol -= cbInstr; 1031 1094 } 1032 1095 … … 3818 3881 RTINTPTR offDisp; 3819 3882 DBGFADDRESS Addr; 3820 rc = DBGFR3AsSymbolByAddr(pUVM, pDbgc->hDbgAs, DBGFR3AddrFromFlat(pDbgc->pUVM, &Addr, AddrVar.u.GCFlat), &offDisp, &Symbol, NULL); 3883 rc = DBGFR3AsSymbolByAddr(pUVM, pDbgc->hDbgAs, DBGFR3AddrFromFlat(pDbgc->pUVM, &Addr, AddrVar.u.GCFlat), 3884 RTDBGSYMADDR_FLAGS_LESS_OR_EQUAL, &offDisp, &Symbol, NULL); 3821 3885 if (RT_FAILURE(rc)) 3822 3886 return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "DBGFR3ASymbolByAddr(,,%RGv,,)\n", AddrVar.u.GCFlat); … … 3843 3907 static DECLCALLBACK(int) dbgcCmdListNear(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs) 3844 3908 { 3909 PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp); 3845 3910 if (!cArgs) 3846 3911 { … … 3849 3914 */ 3850 3915 DBGCVAR AddrVar; 3851 int rc = DBGCCmdHlpEval(pCmdHlp, &AddrVar, "%%(cs:eip)"); 3916 const char *pszFmtExpr = pDbgc->fRegCtxGuest ? "%%(cs:eip)" : "%%(.cs:.eip)"; 3917 int rc = DBGCCmdHlpEval(pCmdHlp, &AddrVar, pszFmtExpr); 3852 3918 if (RT_FAILURE(rc)) 3853 return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "% %(cs:eip)\n");3919 return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "%s\n", pszFmtExpr + 1); 3854 3920 return dbgcDoListNear(pCmdHlp, pUVM, &AddrVar); 3855 3921 } -
trunk/src/VBox/Debugger/DBGCOps.cpp
r44528 r46156 456 456 AssertReturn(pArg->enmType == DBGCVAR_TYPE_SYMBOL, VERR_DBGC_PARSE_BUG); 457 457 458 /* Detect references to hypervisor registers. */ 459 const char *pszReg = pArg->u.pszString; 460 VMCPUID idCpu = pDbgc->idCpu; 461 if (pszReg[0] == '.') 462 { 463 pszReg++; 464 idCpu |= DBGFREG_HYPER_VMCPUID; 465 } 466 458 467 /* 459 468 * If the desired result is a symbol, pass the argument along unmodified. … … 462 471 if (enmCat == DBGCVAR_CAT_SYMBOL) 463 472 { 464 int rc = DBGFR3RegNmValidate(pDbgc->pUVM, pDbgc->idCpu, pArg->u.pszString);473 int rc = DBGFR3RegNmValidate(pDbgc->pUVM, idCpu, pszReg); 465 474 if (RT_SUCCESS(rc)) 466 475 DBGCVAR_INIT_STRING(pResult, pArg->u.pszString); … … 473 482 DBGFREGVALTYPE enmType; 474 483 DBGFREGVAL Value; 475 int rc = DBGFR3RegNmQuery(pDbgc->pUVM, pDbgc->idCpu, pArg->u.pszString, &Value, &enmType);484 int rc = DBGFR3RegNmQuery(pDbgc->pUVM, idCpu, pszReg, &Value, &enmType); 476 485 if (RT_SUCCESS(rc)) 477 486 { -
trunk/src/VBox/Debugger/DBGConsole.cpp
r46137 r46156 237 237 "ip;" 238 238 ; 239 size_t const cchSymbol = strlen(pszSymbol); 240 if ( (cchSymbol == 2 && strstr(s_szTwoLetterRegisters, pszSymbol)) 241 || (cchSymbol == 3 && strstr(s_szThreeLetterRegisters, pszSymbol)) 242 || (cchSymbol == 6 && strstr(s_szSixLetterRegisters, pszSymbol))) 239 const char *pszRegSym = *pszSymbol == '.' ? pszSymbol + 1 : pszSymbol; 240 size_t const cchRegSym = strlen(pszRegSym); 241 if ( (cchRegSym == 2 && strstr(s_szTwoLetterRegisters, pszRegSym)) 242 || (cchRegSym == 3 && strstr(s_szThreeLetterRegisters, pszRegSym)) 243 || (cchRegSym == 6 && strstr(s_szSixLetterRegisters, pszRegSym))) 243 244 { 244 245 if (!strchr(pszSymbol, ';')) -
trunk/src/VBox/Debugger/testcase/tstDBGCStubs.cpp
r46137 r46156 169 169 return VERR_INTERNAL_ERROR; 170 170 } 171 VMMR3DECL(int) DBGFR3AsSymbolByAddr(PUVM pUVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress, PRTGCINTPTR poffDisplacement, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod)171 VMMR3DECL(int) DBGFR3AsSymbolByAddr(PUVM pUVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress, uint32_t fFlags, PRTGCINTPTR poffDisplacement, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod) 172 172 { 173 173 return VERR_INTERNAL_ERROR;
Note:
See TracChangeset
for help on using the changeset viewer.