Changeset 41565 in vbox for trunk/src/VBox/Debugger/DBGCEmulateCodeView.cpp
- Timestamp:
- Jun 4, 2012 2:07:38 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/DBGCEmulateCodeView.cpp
r41562 r41565 4212 4212 4213 4213 4214 /** 4215 * @callback_method_impl{Reads a unsigned 8-bit value.} 4216 */ 4217 static DECLCALLBACK(int) dbgcFuncReadU8(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs, 4218 PDBGCVAR pResult) 4219 { 4220 AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG); 4221 AssertReturn(DBGCVAR_ISPOINTER(paArgs[0].enmType), VERR_DBGC_PARSE_BUG); 4222 AssertReturn(paArgs[0].enmRangeType == DBGCVAR_RANGE_NONE, VERR_DBGC_PARSE_BUG); 4223 4224 uint8_t b; 4225 int rc = DBGCCmdHlpMemRead(pCmdHlp, pVM, &b, sizeof(b), &paArgs[0], NULL); 4226 if (RT_FAILURE(rc)) 4227 return rc; 4228 DBGCVAR_INIT_NUMBER(pResult, b); 4229 4230 NOREF(pFunc); 4231 return VINF_SUCCESS; 4232 } 4233 4234 4235 /** 4236 * @callback_method_impl{Reads a unsigned 16-bit value.} 4237 */ 4238 static DECLCALLBACK(int) dbgcFuncReadU16(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs, 4239 PDBGCVAR pResult) 4240 { 4241 AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG); 4242 AssertReturn(DBGCVAR_ISPOINTER(paArgs[0].enmType), VERR_DBGC_PARSE_BUG); 4243 AssertReturn(paArgs[0].enmRangeType == DBGCVAR_RANGE_NONE, VERR_DBGC_PARSE_BUG); 4244 4245 uint16_t u16; 4246 int rc = DBGCCmdHlpMemRead(pCmdHlp, pVM, &u16, sizeof(u16), &paArgs[0], NULL); 4247 if (RT_FAILURE(rc)) 4248 return rc; 4249 DBGCVAR_INIT_NUMBER(pResult, u16); 4250 4251 NOREF(pFunc); 4252 return VINF_SUCCESS; 4253 } 4254 4255 4256 /** 4257 * @callback_method_impl{Reads a unsigned 32-bit value.} 4258 */ 4259 static DECLCALLBACK(int) dbgcFuncReadU32(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs, 4260 PDBGCVAR pResult) 4261 { 4262 AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG); 4263 AssertReturn(DBGCVAR_ISPOINTER(paArgs[0].enmType), VERR_DBGC_PARSE_BUG); 4264 AssertReturn(paArgs[0].enmRangeType == DBGCVAR_RANGE_NONE, VERR_DBGC_PARSE_BUG); 4265 4266 uint32_t u32; 4267 int rc = DBGCCmdHlpMemRead(pCmdHlp, pVM, &u32, sizeof(u32), &paArgs[0], NULL); 4268 if (RT_FAILURE(rc)) 4269 return rc; 4270 DBGCVAR_INIT_NUMBER(pResult, u32); 4271 4272 NOREF(pFunc); 4273 return VINF_SUCCESS; 4274 } 4275 4276 4277 /** 4278 * @callback_method_impl{Reads a unsigned 64-bit value.} 4279 */ 4280 static DECLCALLBACK(int) dbgcFuncReadU64(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs, 4281 PDBGCVAR pResult) 4282 { 4283 AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG); 4284 AssertReturn(DBGCVAR_ISPOINTER(paArgs[0].enmType), VERR_DBGC_PARSE_BUG); 4285 AssertReturn(paArgs[0].enmRangeType == DBGCVAR_RANGE_NONE, VERR_DBGC_PARSE_BUG); 4286 4287 uint64_t u64; 4288 int rc = DBGCCmdHlpMemRead(pCmdHlp, pVM, &u64, sizeof(u64), &paArgs[0], NULL); 4289 if (RT_FAILURE(rc)) 4290 return rc; 4291 DBGCVAR_INIT_NUMBER(pResult, u64); 4292 4293 NOREF(pFunc); 4294 return VINF_SUCCESS; 4295 } 4296 4297 4298 /** 4299 * @callback_method_impl{Reads a unsigned pointer-sized value.} 4300 */ 4301 static DECLCALLBACK(int) dbgcFuncReadPtr(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs, 4302 PDBGCVAR pResult) 4303 { 4304 AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG); 4305 AssertReturn(DBGCVAR_ISPOINTER(paArgs[0].enmType), VERR_DBGC_PARSE_BUG); 4306 AssertReturn(paArgs[0].enmRangeType == DBGCVAR_RANGE_NONE, VERR_DBGC_PARSE_BUG); 4307 4308 CPUMMODE enmMode = DBGCCmdHlpGetCpuMode(pCmdHlp); 4309 if (enmMode == CPUMMODE_LONG) 4310 return dbgcFuncReadU64(pFunc, pCmdHlp, pVM, paArgs, cArgs, pResult); 4311 return dbgcFuncReadU32(pFunc, pCmdHlp, pVM, paArgs, cArgs, pResult); 4312 } 4313 4214 4314 4215 4315 /** … … 4220 4320 { 4221 4321 AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG); 4322 4222 4323 uint16_t uHi; 4223 4324 switch (paArgs[0].enmType) … … 4232 4333 AssertFailedReturn(VERR_DBGC_PARSE_BUG); 4233 4334 } 4234 4235 4335 DBGCVAR_INIT_NUMBER(pResult, uHi); 4336 DBGCVAR_SET_RANGE(pResult, paArgs[0].enmRangeType, paArgs[0].u64Range); 4337 4236 4338 NOREF(pFunc); NOREF(pCmdHlp); NOREF(pVM); 4237 4339 return VINF_SUCCESS; … … 4246 4348 { 4247 4349 AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG); 4350 4248 4351 uint16_t uLow; 4249 4352 switch (paArgs[0].enmType) … … 4258 4361 AssertFailedReturn(VERR_DBGC_PARSE_BUG); 4259 4362 } 4260 4261 4363 DBGCVAR_INIT_NUMBER(pResult, uLow); 4364 DBGCVAR_SET_RANGE(pResult, paArgs[0].enmRangeType, paArgs[0].u64Range); 4365 4262 4366 NOREF(pFunc); NOREF(pCmdHlp); NOREF(pVM); 4263 4367 return VINF_SUCCESS; 4264 4368 } 4265 4369 4370 4371 /** 4372 * @callback_method_impl{The low(value) function implementation.} 4373 */ 4374 static DECLCALLBACK(int) dbgcFuncNot(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs, 4375 PDBGCVAR pResult) 4376 { 4377 AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG); 4378 NOREF(pFunc); NOREF(pCmdHlp); NOREF(pVM); 4379 return DBGCCmdHlpEval(pCmdHlp, pResult, "!(%Dv)", &paArgs[0]); 4380 } 4381 4382 4383 /** Generic pointer argument wo/ range. */ 4384 static const DBGCVARDESC g_aArgPointerWoRange[] = 4385 { 4386 /* cTimesMin, cTimesMax, enmCategory, fFlags, pszName, pszDescription */ 4387 { 1, 1, DBGCVAR_CAT_POINTER_NO_RANGE, 0, "value", "Address or number." }, 4388 }; 4266 4389 4267 4390 /** Generic pointer or number argument. */ … … 4279 4402 const DBGCFUNC g_aFuncsCodeView[] = 4280 4403 { 4404 { "by", 1, 1, &g_aArgPointerWoRange[0], RT_ELEMENTS(g_aArgPointerWoRange), 0, dbgcFuncReadU8, "address", "Reads a byte at the given address." }, 4405 { "dwo", 1, 1, &g_aArgPointerWoRange[0], RT_ELEMENTS(g_aArgPointerWoRange), 0, dbgcFuncReadU32, "address", "Reads a 32-bit value at the given address." }, 4281 4406 { "hi", 1, 1, &g_aArgPointerNumber[0], RT_ELEMENTS(g_aArgPointerNumber), 0, dbgcFuncHi, "value", "Returns the high 16-bit bits of a value." }, 4282 4407 { "low", 1, 1, &g_aArgPointerNumber[0], RT_ELEMENTS(g_aArgPointerNumber), 0, dbgcFuncLow, "value", "Returns the low 16-bit bits of a value." }, 4408 { "not", 1, 1, &g_aArgPointerNumber[0], RT_ELEMENTS(g_aArgPointerNumber), 0, dbgcFuncNot, "address", "Boolean NOT." }, 4409 { "poi", 1, 1, &g_aArgPointerWoRange[0], RT_ELEMENTS(g_aArgPointerWoRange), 0, dbgcFuncReadPtr, "address", "Reads a pointer sized (CS) value at the given address." }, 4410 { "qwo", 1, 1, &g_aArgPointerWoRange[0], RT_ELEMENTS(g_aArgPointerWoRange), 0, dbgcFuncReadU64, "address", "Reads a 32-bit value at the given address." }, 4411 { "wo", 1, 1, &g_aArgPointerWoRange[0], RT_ELEMENTS(g_aArgPointerWoRange), 0, dbgcFuncReadU16, "address", "Reads a 16-bit value at the given address." }, 4283 4412 }; 4284 4413
Note:
See TracChangeset
for help on using the changeset viewer.