- 時間撮記:
- 2016-11-20 上午02:02:27 (8 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Debugger/DBGCEmulateCodeView.cpp
r64592 r64721 65 65 static FNDBGCCMD dbgcCmdEditMem; 66 66 static FNDBGCCMD dbgcCmdGo; 67 static FNDBGCCMD dbgcCmdGoUp; 67 68 static FNDBGCCMD dbgcCmdListModules; 68 69 static FNDBGCCMD dbgcCmdListNear; … … 75 76 static FNDBGCCMD dbgcCmdSearchMem; 76 77 static FNDBGCCMD dbgcCmdSearchMemType; 78 static FNDBGCCMD dbgcCmdStepTrace; 79 static FNDBGCCMD dbgcCmdStepTraceTo; 80 static FNDBGCCMD dbgcCmdStepTraceToggle; 77 81 static FNDBGCCMD dbgcCmdEventCtrl; 78 82 static FNDBGCCMD dbgcCmdEventCtrlList; 79 83 static FNDBGCCMD dbgcCmdEventCtrlReset; 80 84 static FNDBGCCMD dbgcCmdStack; 81 static FNDBGCCMD dbgcCmdTrace;82 85 static FNDBGCCMD dbgcCmdUnassemble; 83 86 static FNDBGCCMD dbgcCmdUnassembleCfg; … … 266 269 /* cTimesMin, cTimesMax, enmCategory, fFlags, pszName, pszDescription */ 267 270 { 1, 1, DBGCVAR_CAT_POINTER, 0, "address", "Pointer to obtain info about." }, 271 }; 272 273 274 /** 'p', 'pc', 'pt', 't', 'tc' and 'tt' arguments. */ 275 static const DBGCVARDESC g_aArgStepTrace[] = 276 { 277 /* cTimesMin, cTimesMax, enmCategory, fFlags, pszName, pszDescription */ 278 { 0, 1, DBGCVAR_CAT_NUMBER, 0, "count", "Number of instructions or source lines to step." }, 279 { 0, 1, DBGCVAR_CAT_STRING, 0, "cmds", "String of commands to be executed afterwards. Quote it!" }, 280 }; 281 282 283 /** 'pa' and 'ta' arguments. */ 284 static const DBGCVARDESC g_aArgStepTraceTo[] = 285 { 286 /* cTimesMin, cTimesMax, enmCategory, fFlags, pszName, pszDescription */ 287 { 1, 1, DBGCVAR_CAT_POINTER, 0, "address", "Where to stop" }, 288 { 0, 1, DBGCVAR_CAT_STRING, 0, "cmds", "String of commands to be executed afterwards. Quote it!" }, 268 289 }; 269 290 … … 390 411 { "eq", 2, 2, &g_aArgEditMem[0], RT_ELEMENTS(g_aArgEditMem), 0, dbgcCmdEditMem, "<addr> <value>", "Write a 8-byte value to memory." }, 391 412 { "g", 0, 0, NULL, 0, 0, dbgcCmdGo, "", "Continue execution." }, 413 { "gu", 0, 0, NULL, 0, 0, dbgcCmdGoUp, "", "Go up - continue execution till after return." }, 392 414 { "k", 0, 0, NULL, 0, 0, dbgcCmdStack, "", "Callstack." }, 393 415 { "kg", 0, 0, NULL, 0, 0, dbgcCmdStack, "", "Callstack - guest." }, … … 400 422 { "ls", 0, 1, &g_aArgListSource[0],RT_ELEMENTS(g_aArgListSource), 0, dbgcCmdListSource, "[addr]", "Source." }, 401 423 { "m", 1, 1, &g_aArgMemoryInfo[0],RT_ELEMENTS(g_aArgMemoryInfo), 0, dbgcCmdMemoryInfo, "<addr>", "Display information about that piece of memory." }, 424 { "p", 0, 2, &g_aArgStepTrace[0], RT_ELEMENTS(g_aArgStepTrace), 0, dbgcCmdStepTrace, "[count] [cmds]", "Step over." }, 425 { "pr", 0, 0, NULL, 0, 0, dbgcCmdStepTraceToggle, "", "Toggle displaying registers for tracing & stepping (no code executed)." }, 426 { "pa", 1, 1, &g_aArgStepTraceTo[0], RT_ELEMENTS(g_aArgStepTraceTo), 0, dbgcCmdStepTraceTo, "<addr> [count] [cmds]","Step to the given address." }, 427 { "pc", 0, 0, &g_aArgStepTrace[0], RT_ELEMENTS(g_aArgStepTrace), 0, dbgcCmdStepTrace, "[count] [cmds]", "Step to the next call instruction." }, 428 { "pt", 0, 0, &g_aArgStepTrace[0], RT_ELEMENTS(g_aArgStepTrace), 0, dbgcCmdStepTrace, "[count] [cmds]", "Step to the next return instruction." }, 402 429 { "r", 0, 3, &g_aArgReg[0], RT_ELEMENTS(g_aArgReg), 0, dbgcCmdReg, "[reg [[=] newval]]", "Show or set register(s) - active reg set." }, 403 430 { "rg", 0, 3, &g_aArgReg[0], RT_ELEMENTS(g_aArgReg), 0, dbgcCmdRegGuest, "[reg [[=] newval]]", "Show or set register(s) - guest reg set." }, … … 419 446 { "sxi", 1, ~0U, &g_aArgEventCtrl[0], RT_ELEMENTS(g_aArgEventCtrl), 0, dbgcCmdEventCtrl, "[-c <cmd>] <event> [..]", "Ignore: Ignore the specified exceptions, exits and other events ('all' = all of them). Without the -c option, the guest runs like normal." }, 420 447 { "sxr", 0, 0, &g_aArgEventCtrlOpt[0], RT_ELEMENTS(g_aArgEventCtrlOpt), 0, dbgcCmdEventCtrlReset, "", "Reset the settings to default for exceptions, exits and other events. All if no filter is specified." }, 421 { "t", 0, 0, NULL, 0, 0, dbgcCmdTrace, "", "Instruction trace (step into)." }, 448 { "t", 0, 2, &g_aArgStepTrace[0], RT_ELEMENTS(g_aArgStepTrace), 0, dbgcCmdStepTrace, "[count] [cmds]", "Trace ." }, 449 { "tr", 0, 0, NULL, 0, 0, dbgcCmdStepTraceToggle, "", "Toggle displaying registers for tracing & stepping (no code executed)." }, 450 { "ta", 1, 1, &g_aArgStepTraceTo[0], RT_ELEMENTS(g_aArgStepTraceTo), 0, dbgcCmdStepTraceTo, "<addr> [count] [cmds]","Trace to the given address." }, 451 { "tc", 0, 0, &g_aArgStepTrace[0], RT_ELEMENTS(g_aArgStepTrace), 0, dbgcCmdStepTrace, "[count] [cmds]", "Trace to the next call instruction." }, 452 { "tt", 0, 0, &g_aArgStepTrace[0], RT_ELEMENTS(g_aArgStepTrace), 0, dbgcCmdStepTrace, "[count] [cmds]", "Trace to the next return instruction." }, 422 453 { "u", 0, 1, &g_aArgUnassemble[0],RT_ELEMENTS(g_aArgUnassemble), 0, dbgcCmdUnassemble, "[addr]", "Unassemble." }, 423 454 { "u64", 0, 1, &g_aArgUnassemble[0],RT_ELEMENTS(g_aArgUnassemble), 0, dbgcCmdUnassemble, "[addr]", "Unassemble 64-bit code." }, … … 595 626 596 627 /** 597 * @callback_method_impl{FNDBGCCMD, The 'g o' command.}628 * @callback_method_impl{FNDBGCCMD, The 'g' command.} 598 629 */ 599 630 static DECLCALLBACK(int) dbgcCmdGo(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs) … … 613 644 NOREF(paArgs); NOREF(cArgs); 614 645 return VINF_SUCCESS; 646 } 647 648 649 /** 650 * @callback_method_impl{FNDBGCCMD, The 'gu' command.} 651 */ 652 static DECLCALLBACK(int) dbgcCmdGoUp(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs) 653 { 654 PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp); 655 RT_NOREF(pCmd, paArgs, cArgs); 656 657 /* The simple way out. */ 658 PDBGFADDRESS pStackPop = NULL; /** @todo try set up some stack limitations */ 659 RTGCPTR cbStackPop = 0; 660 int rc = DBGFR3StepEx(pUVM, pDbgc->idCpu, DBGF_STEP_F_OVER | DBGF_STEP_F_STOP_AFTER_RET, NULL, pStackPop, cbStackPop, _512K); 661 if (RT_SUCCESS(rc)) 662 pDbgc->fReady = false; 663 else 664 return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "DBGFR3StepEx(,,DBGF_STEP_F_OVER | DBGF_STEP_F_STOP_AFTER_RET,) failed"); 665 return rc; 615 666 } 616 667 … … 2483 2534 * Disassemble one instruction at cs:[r|e]ip. 2484 2535 */ 2485 if (!f64BitMode && strstr(pszRegs, " vm ")) /* a bi gugly... */2536 if (!f64BitMode && strstr(pszRegs, " vm ")) /* a bit ugly... */ 2486 2537 return pCmdHlp->pfnExec(pCmdHlp, "uv86 %s", szDisAndRegs + 2); 2487 2538 return pCmdHlp->pfnExec(pCmdHlp, "%s", szDisAndRegs); … … 2555 2606 2556 2607 /** 2557 * @callback_method_impl{FNDBGCCMD, The 't' command.} 2558 */ 2559 static DECLCALLBACK(int) dbgcCmdTrace(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs) 2608 * @callback_method_impl{FNDBGCCMD, The 'pr' and 'tr' commands.} 2609 */ 2610 static DECLCALLBACK(int) dbgcCmdStepTraceToggle(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs) 2611 { 2612 PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp); 2613 Assert(cArgs == 0); NOREF(pCmd); NOREF(pUVM); NOREF(paArgs); NOREF(cArgs); 2614 2615 /* Note! windbg accepts 'r' as a flag to 'p', 'pa', 'pc', 'pt', 't', 2616 'ta', 'tc' and 'tt'. We've simplified it. */ 2617 pDbgc->fStepTraceRegs = !pDbgc->fStepTraceRegs; 2618 return VINF_SUCCESS; 2619 } 2620 2621 2622 /** 2623 * @callback_method_impl{FNDBGCCMD, 2624 * The 'p', 'pc', 'pt', 't', 'tc', and 'tt' commands.} 2625 */ 2626 static DECLCALLBACK(int) dbgcCmdStepTrace(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs) 2560 2627 { 2561 2628 PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp); 2562 2563 int rc = DBGFR3Step(pUVM, pDbgc->idCpu); 2629 if (cArgs != 0) 2630 return DBGCCmdHlpFail(pCmdHlp, pCmd, 2631 "Sorry, but the '%s' command does not currently implement any arguments.\n", pCmd->pszCmd); 2632 2633 /* The 'count' has to be implemented by DBGC, whereas the 2634 filtering is taken care of by DBGF. */ 2635 2636 /* 2637 * Convert the command to DBGF_STEP_F_XXX and other API input. 2638 */ 2639 //DBGFADDRESS StackPop; 2640 PDBGFADDRESS pStackPop = NULL; 2641 RTGCPTR cbStackPop = 0; 2642 uint32_t cMaxSteps = pCmd->pszCmd[0] == 'p' ? _512K : _64K; 2643 uint32_t fFlags = pCmd->pszCmd[0] == 'p' ? DBGF_STEP_F_OVER : DBGF_STEP_F_INTO; 2644 if (pCmd->pszCmd[1] == 'c') 2645 fFlags |= DBGF_STEP_F_STOP_ON_CALL; 2646 else if (pCmd->pszCmd[1] == 't') 2647 fFlags |= DBGF_STEP_F_STOP_ON_RET; 2648 else if (pCmd->pszCmd[0] != 'p') 2649 cMaxSteps = 1; 2650 else 2651 { 2652 /** @todo consider passing RSP + 1 in for 'p' and something else sensible for 2653 * the 'pt' command. */ 2654 } 2655 2656 int rc = DBGFR3StepEx(pUVM, pDbgc->idCpu, fFlags, NULL, pStackPop, cbStackPop, cMaxSteps); 2564 2657 if (RT_SUCCESS(rc)) 2565 2658 pDbgc->fReady = false; 2566 2659 else 2567 r c = pDbgc->CmdHlp.pfnVBoxError(&pDbgc->CmdHlp, rc, "When trying to single step VM %p\n", pDbgc->pVM);2660 return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "DBGFR3StepEx(,,%#x,) failed", fFlags); 2568 2661 2569 2662 NOREF(pCmd); NOREF(paArgs); NOREF(cArgs); 2663 return rc; 2664 } 2665 2666 2667 /** 2668 * @callback_method_impl{FNDBGCCMD, The 'pa' and 'ta' commands.} 2669 */ 2670 static DECLCALLBACK(int) dbgcCmdStepTraceTo(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs) 2671 { 2672 PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp); 2673 if (cArgs != 1) 2674 return DBGCCmdHlpFail(pCmdHlp, pCmd, 2675 "Sorry, but the '%s' command only implements a single argument at present.\n", pCmd->pszCmd); 2676 DBGFADDRESS Address; 2677 int rc = pCmdHlp->pfnVarToDbgfAddr(pCmdHlp, &paArgs[0], &Address); 2678 if (RT_FAILURE(rc)) 2679 return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "VarToDbgfAddr(,%Dv,)\n", &paArgs[0]); 2680 2681 uint32_t cMaxSteps = pCmd->pszCmd[0] == 'p' ? _512K : 1; 2682 uint32_t fFlags = pCmd->pszCmd[0] == 'p' ? DBGF_STEP_F_OVER : DBGF_STEP_F_INTO; 2683 rc = DBGFR3StepEx(pUVM, pDbgc->idCpu, fFlags, &Address, NULL, 0, cMaxSteps); 2684 if (RT_SUCCESS(rc)) 2685 pDbgc->fReady = false; 2686 else 2687 return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "DBGFR3StepEx(,,%#x,) failed", fFlags); 2570 2688 return rc; 2571 2689 }
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器