292
292
/* pszCmd, cArgsMin, cArgsMax, paArgDescs, cArgDescs, fFlags, pfnHandler pszSyntax, ....pszDescription */
293
293
{ "ba", 3, 6, &g_aArgBrkAcc[0], RT_ELEMENTS(g_aArgBrkAcc), 0, dbgcCmdBrkAccess, "<access> <size> <address> [passes [max passes]] [cmds]",
294
294
"Sets a data access breakpoint." },
295
{ "bc", 1, ~0U, &g_aArgBrks[0], RT_ELEMENTS(g_aArgBrks), 0, dbgcCmdBrkClear, "all | <bp#> [bp# []]", "Enabled a set of breakpoints." },
295
{ "bc", 1, ~0U, &g_aArgBrks[0], RT_ELEMENTS(g_aArgBrks), 0, dbgcCmdBrkClear, "all | <bp#> [bp# []]", "Deletes a set of breakpoints." },
296
296
{ "bd", 1, ~0U, &g_aArgBrks[0], RT_ELEMENTS(g_aArgBrks), 0, dbgcCmdBrkDisable, "all | <bp#> [bp# []]", "Disables a set of breakpoints." },
297
{ "be", 1, ~0U, &g_aArgBrks[0], RT_ELEMENTS(g_aArgBrks), 0, dbgcCmdBrkEnable, "all | <bp#> [bp# []]", "Enabled a set of breakpoints." },
297
{ "be", 1, ~0U, &g_aArgBrks[0], RT_ELEMENTS(g_aArgBrks), 0, dbgcCmdBrkEnable, "all | <bp#> [bp# []]", "Enables a set of breakpoints." },
298
298
{ "bl", 0, 0, NULL, 0, 0, dbgcCmdBrkList, "", "Lists all the breakpoints." },
299
299
{ "bp", 1, 4, &g_aArgBrkSet[0], RT_ELEMENTS(g_aArgBrkSet), 0, dbgcCmdBrkSet, "<address> [passes [max passes]] [cmds]",
300
300
"Sets a breakpoint (int 3)." },
4206
4207
return VINF_SUCCESS;
4213
* @callback_method_impl{Reads a unsigned 8-bit value.}
4215
static DECLCALLBACK(int) dbgcFuncReadU8(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs,
4218
AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG);
4219
AssertReturn(DBGCVAR_ISPOINTER(paArgs[0].enmType), VERR_DBGC_PARSE_BUG);
4220
AssertReturn(paArgs[0].enmRangeType == DBGCVAR_RANGE_NONE, VERR_DBGC_PARSE_BUG);
4223
int rc = DBGCCmdHlpMemRead(pCmdHlp, pVM, &b, sizeof(b), &paArgs[0], NULL);
4226
DBGCVAR_INIT_NUMBER(pResult, b);
4229
return VINF_SUCCESS;
4234
* @callback_method_impl{Reads a unsigned 16-bit value.}
4236
static DECLCALLBACK(int) dbgcFuncReadU16(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs,
4239
AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG);
4240
AssertReturn(DBGCVAR_ISPOINTER(paArgs[0].enmType), VERR_DBGC_PARSE_BUG);
4241
AssertReturn(paArgs[0].enmRangeType == DBGCVAR_RANGE_NONE, VERR_DBGC_PARSE_BUG);
4244
int rc = DBGCCmdHlpMemRead(pCmdHlp, pVM, &u16, sizeof(u16), &paArgs[0], NULL);
4247
DBGCVAR_INIT_NUMBER(pResult, u16);
4250
return VINF_SUCCESS;
4255
* @callback_method_impl{Reads a unsigned 32-bit value.}
4257
static DECLCALLBACK(int) dbgcFuncReadU32(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs,
4260
AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG);
4261
AssertReturn(DBGCVAR_ISPOINTER(paArgs[0].enmType), VERR_DBGC_PARSE_BUG);
4262
AssertReturn(paArgs[0].enmRangeType == DBGCVAR_RANGE_NONE, VERR_DBGC_PARSE_BUG);
4265
int rc = DBGCCmdHlpMemRead(pCmdHlp, pVM, &u32, sizeof(u32), &paArgs[0], NULL);
4268
DBGCVAR_INIT_NUMBER(pResult, u32);
4271
return VINF_SUCCESS;
4276
* @callback_method_impl{Reads a unsigned 64-bit value.}
4278
static DECLCALLBACK(int) dbgcFuncReadU64(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs,
4281
AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG);
4282
AssertReturn(DBGCVAR_ISPOINTER(paArgs[0].enmType), VERR_DBGC_PARSE_BUG);
4283
AssertReturn(paArgs[0].enmRangeType == DBGCVAR_RANGE_NONE, VERR_DBGC_PARSE_BUG);
4286
int rc = DBGCCmdHlpMemRead(pCmdHlp, pVM, &u64, sizeof(u64), &paArgs[0], NULL);
4289
DBGCVAR_INIT_NUMBER(pResult, u64);
4292
return VINF_SUCCESS;
4297
* @callback_method_impl{Reads a unsigned pointer-sized value.}
4299
static DECLCALLBACK(int) dbgcFuncReadPtr(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs,
4302
AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG);
4303
AssertReturn(DBGCVAR_ISPOINTER(paArgs[0].enmType), VERR_DBGC_PARSE_BUG);
4304
AssertReturn(paArgs[0].enmRangeType == DBGCVAR_RANGE_NONE, VERR_DBGC_PARSE_BUG);
4306
CPUMMODE enmMode = DBGCCmdHlpGetCpuMode(pCmdHlp);
4307
if (enmMode == CPUMMODE_LONG)
4308
return dbgcFuncReadU64(pFunc, pCmdHlp, pVM, paArgs, cArgs, pResult);
4309
return dbgcFuncReadU32(pFunc, pCmdHlp, pVM, paArgs, cArgs, pResult);
4314
* @callback_method_impl{The hi(value) function implementation.}
4316
static DECLCALLBACK(int) dbgcFuncHi(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs,
4319
AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG);
4322
switch (paArgs[0].enmType)
4324
case DBGCVAR_TYPE_GC_FLAT: uHi = (uint16_t)(paArgs[0].u.GCFlat >> 16); break;
4325
case DBGCVAR_TYPE_GC_FAR: uHi = (uint16_t)paArgs[0].u.GCFar.sel; break;
4326
case DBGCVAR_TYPE_GC_PHYS: uHi = (uint16_t)(paArgs[0].u.GCPhys >> 16); break;
4327
case DBGCVAR_TYPE_HC_FLAT: uHi = (uint16_t)((uintptr_t)paArgs[0].u.pvHCFlat >> 16); break;
4328
case DBGCVAR_TYPE_HC_PHYS: uHi = (uint16_t)(paArgs[0].u.HCPhys >> 16); break;
4329
case DBGCVAR_TYPE_NUMBER: uHi = (uint16_t)(paArgs[0].u.u64Number >> 16); break;
4331
AssertFailedReturn(VERR_DBGC_PARSE_BUG);
4333
DBGCVAR_INIT_NUMBER(pResult, uHi);
4334
DBGCVAR_SET_RANGE(pResult, paArgs[0].enmRangeType, paArgs[0].u64Range);
4336
NOREF(pFunc); NOREF(pCmdHlp); NOREF(pVM);
4337
return VINF_SUCCESS;
4342
* @callback_method_impl{The low(value) function implementation.}
4344
static DECLCALLBACK(int) dbgcFuncLow(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs,
4347
AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG);
4350
switch (paArgs[0].enmType)
4352
case DBGCVAR_TYPE_GC_FLAT: uLow = (uint16_t)paArgs[0].u.GCFlat; break;
4353
case DBGCVAR_TYPE_GC_FAR: uLow = (uint16_t)paArgs[0].u.GCFar.off; break;
4354
case DBGCVAR_TYPE_GC_PHYS: uLow = (uint16_t)paArgs[0].u.GCPhys; break;
4355
case DBGCVAR_TYPE_HC_FLAT: uLow = (uint16_t)(uintptr_t)paArgs[0].u.pvHCFlat; break;
4356
case DBGCVAR_TYPE_HC_PHYS: uLow = (uint16_t)paArgs[0].u.HCPhys; break;
4357
case DBGCVAR_TYPE_NUMBER: uLow = (uint16_t)paArgs[0].u.u64Number; break;
4359
AssertFailedReturn(VERR_DBGC_PARSE_BUG);
4361
DBGCVAR_INIT_NUMBER(pResult, uLow);
4362
DBGCVAR_SET_RANGE(pResult, paArgs[0].enmRangeType, paArgs[0].u64Range);
4364
NOREF(pFunc); NOREF(pCmdHlp); NOREF(pVM);
4365
return VINF_SUCCESS;
4370
* @callback_method_impl{The low(value) function implementation.}
4372
static DECLCALLBACK(int) dbgcFuncNot(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs,
4375
AssertReturn(cArgs == 1, VERR_DBGC_PARSE_BUG);
4376
NOREF(pFunc); NOREF(pCmdHlp); NOREF(pVM);
4377
return DBGCCmdHlpEval(pCmdHlp, pResult, "!(%Dv)", &paArgs[0]);
4381
/** Generic pointer argument wo/ range. */
4382
static const DBGCVARDESC g_aArgPointerWoRange[] =
4384
/* cTimesMin, cTimesMax, enmCategory, fFlags, pszName, pszDescription */
4385
{ 1, 1, DBGCVAR_CAT_POINTER_NO_RANGE, 0, "value", "Address or number." },
4388
/** Generic pointer or number argument. */
4389
static const DBGCVARDESC g_aArgPointerNumber[] =
4391
/* cTimesMin, cTimesMax, enmCategory, fFlags, pszName, pszDescription */
4392
{ 1, 1, DBGCVAR_CAT_POINTER_NUMBER, 0, "value", "Address or number." },
4397
/** Function descriptors for the CodeView / WinDbg emulation.
4398
* The emulation isn't attempting to be identical, only somewhat similar.
4400
const DBGCFUNC g_aFuncsCodeView[] =
4402
{ "by", 1, 1, &g_aArgPointerWoRange[0], RT_ELEMENTS(g_aArgPointerWoRange), 0, dbgcFuncReadU8, "address", "Reads a byte at the given address." },
4403
{ "dwo", 1, 1, &g_aArgPointerWoRange[0], RT_ELEMENTS(g_aArgPointerWoRange), 0, dbgcFuncReadU32, "address", "Reads a 32-bit value at the given address." },
4404
{ "hi", 1, 1, &g_aArgPointerNumber[0], RT_ELEMENTS(g_aArgPointerNumber), 0, dbgcFuncHi, "value", "Returns the high 16-bit bits of a value." },
4405
{ "low", 1, 1, &g_aArgPointerNumber[0], RT_ELEMENTS(g_aArgPointerNumber), 0, dbgcFuncLow, "value", "Returns the low 16-bit bits of a value." },
4406
{ "not", 1, 1, &g_aArgPointerNumber[0], RT_ELEMENTS(g_aArgPointerNumber), 0, dbgcFuncNot, "address", "Boolean NOT." },
4407
{ "poi", 1, 1, &g_aArgPointerWoRange[0], RT_ELEMENTS(g_aArgPointerWoRange), 0, dbgcFuncReadPtr, "address", "Reads a pointer sized (CS) value at the given address." },
4408
{ "qwo", 1, 1, &g_aArgPointerWoRange[0], RT_ELEMENTS(g_aArgPointerWoRange), 0, dbgcFuncReadU64, "address", "Reads a 32-bit value at the given address." },
4409
{ "wo", 1, 1, &g_aArgPointerWoRange[0], RT_ELEMENTS(g_aArgPointerWoRange), 0, dbgcFuncReadU16, "address", "Reads a 16-bit value at the given address." },
4412
/** The number of functions in the CodeView/WinDbg emulation. */
4413
const uint32_t g_cFuncsCodeView = RT_ELEMENTS(g_aFuncsCodeView);