EMR3Dbg.cpp revision e79fc6c1566bf913db2ab67366af04053ea8aaa1
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync/* $Id$ */
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync/** @file
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * EM - Execution Monitor / Manager, Debugger Related Bits.
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync */
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync/*
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync * Copyright (C) 2006-2013 Oracle Corporation
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync *
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * available from http://www.virtualbox.org. This file is free software;
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * you can redistribute it and/or modify it under the terms of the GNU
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * General Public License (GPL) as published by the Free Software
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync */
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync/*******************************************************************************
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync* Header Files *
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync*******************************************************************************/
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync#define LOG_GROUP LOG_GROUP_EM
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync#include <VBox/vmm/em.h>
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync#include <VBox/dbg.h>
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync#include "EMInternal.h"
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsync/** @callback_method_impl{FNDBGCCMD,
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * Implements the '.alliem' command. }
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync */
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsyncstatic DECLCALLBACK(int) enmR3DbgCmdAllIem(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync{
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync int rc;
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsync bool f;
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync if (cArgs == 0)
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync {
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync rc = EMR3QueryExecutionPolicy(pUVM, EMEXECPOLICY_IEM_ALL, &f);
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync if (RT_FAILURE(rc))
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "EMR3QueryExecutionPolicy(,EMEXECPOLICY_IEM_ALL,");
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync DBGCCmdHlpPrintf(pCmdHlp, f ? "alliem: enabled\n" : "alliem: disabled\n");
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync }
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync else
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync {
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync rc = DBGCCmdHlpVarToBool(pCmdHlp, &paArgs[0], &f);
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync if (RT_FAILURE(rc))
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "DBGCCmdHlpVarToBool");
7af218a7441de38fc9e814919db04bae3e917664vboxsync rc = EMR3SetExecutionPolicy(pUVM, EMEXECPOLICY_IEM_ALL, f);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync if (RT_FAILURE(rc))
2a2b173b54c259e34320ce0acf26f18e9382ce2avboxsync return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "EMR3SetExecutionPolicy(,EMEXECPOLICY_IEM_ALL,%RTbool)", f);
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync }
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync return VINF_SUCCESS;
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync}
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** Describes a optional boolean argument. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncstatic DBGCVARDESC const g_BoolArg = { 0, 1, DBGCVAR_CAT_ANY, 0, "boolean", "Boolean value." };
1c822ec4298d5d20b0fb1cc20346c5d4e4e596bfvboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** Commands. */
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsyncstatic DBGCCMD const g_aCmds[] =
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync{
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync {
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync "alliem", 0, 1, &g_BoolArg, 1, 0, enmR3DbgCmdAllIem, "[boolean]",
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync "Enables or disabled executing ALL code in IEM, if no arguments are given it displays the current status."
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync },
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync};
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncint emR3InitDbg(PVM pVM)
1c822ec4298d5d20b0fb1cc20346c5d4e4e596bfvboxsync{
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync int rc = DBGCRegisterCommands(&g_aCmds[0], RT_ELEMENTS(g_aCmds));
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync AssertLogRelRC(rc);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync return rc;
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync}
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync