Changeset 32741 in vbox
- Timestamp:
- Sep 23, 2010 11:21:52 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/manual/en_US/user_Troubleshooting.xml
r32387 r32741 179 179 </itemizedlist></para> 180 180 181 <para>The debugger can be enabled in t woways:<itemizedlist>181 <para>The debugger can be enabled in three ways:<itemizedlist> 182 182 <listitem> 183 183 <para>Start the <computeroutput>VirtualBox</computeroutput> … … 194 194 <computeroutput>VBOX_GUI_DBG_ENABLED</computeroutput> or 195 195 <computeroutput>VBOX_GUI_DBG_AUTO_SHOW</computeroutput> 196 environment variable to an arbitrary value before launching the 197 VirtualBox process. Setting these variables (only their presence 198 is checked) is effective even when the first VirtualBox process is 199 the VM selector window. VMs subsequently launched from the 200 selector will have the debugger enabled.</para> 201 </listitem> 196 environment variable to <computeroutput>true</computeroutput> 197 before launching the VirtualBox process. Setting these variables 198 (only their presence is checked) is effective even when the first 199 VirtualBox process is the VM selector window. VMs subsequently 200 launched from the selector will have the debugger enabled.</para> 201 </listitem> 202 203 <listitem> 204 <para>Set the 205 <computeroutput>GUI/Dbg/Enabled</computeroutput> extra data item to 206 <computeroutput>true</computeroutput> before launching the 207 VM. This can be set globally or on a per VM basis.</para> 208 </listitem> 209 202 210 </itemizedlist></para> 203 211 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.cpp
r30868 r32741 80 80 const char* VBoxDefs::GUI_Accelerate2D_PixformatAYUV = "GUI/Accelerate2D/PixformatAYUV"; 81 81 #endif 82 #ifdef VBOX_WITH_DEBUGGER_GUI 83 const char* VBoxDefs::GUI_DbgEnabled = "GUI/Dbg/Enabled"; 84 const char* VBoxDefs::GUI_DbgAutoShow = "GUI/Dbg/AutoShow"; 85 #endif 82 86 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h
r30868 r32741 159 159 static const char* GUI_Accelerate2D_PixformatAYUV; 160 160 #endif 161 162 #ifdef VBOX_WITH_DEBUGGER_GUI 163 static const char* VBoxDefs::GUI_DbgEnabled; 164 static const char* VBoxDefs::GUI_DbgAutoShow; 165 #endif 161 166 }; 162 167 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r32436 r32741 4415 4415 return QObject::eventFilter (aObject, aEvent); 4416 4416 } 4417 4418 #ifdef VBOX_WITH_DEBUGGER_GUI 4419 4420 bool VBoxGlobal::isDebuggerEnabled(CMachine &aMachine) 4421 { 4422 return isDebuggerWorker(&mDbgEnabled, aMachine, VBoxDefs::GUI_DbgEnabled); 4423 } 4424 4425 bool VBoxGlobal::isDebuggerAutoShowEnabled(CMachine &aMachine) 4426 { 4427 return isDebuggerWorker(&mDbgAutoShow, aMachine, VBoxDefs::GUI_DbgAutoShow); 4428 } 4429 4430 bool VBoxGlobal::isDebuggerAutoShowCommandLineEnabled(CMachine &aMachine) 4431 { 4432 return isDebuggerWorker(&mDbgAutoShowCommandLine, aMachine, VBoxDefs::GUI_DbgAutoShow); 4433 } 4434 4435 bool VBoxGlobal::isDebuggerAutoShowStatisticsEnabled(CMachine &aMachine) 4436 { 4437 return isDebuggerWorker(&mDbgAutoShowStatistics, aMachine, VBoxDefs::GUI_DbgAutoShow); 4438 } 4439 4440 #endif /* VBOX_WITH_DEBUGGER_GUI */ 4417 4441 4418 4442 // Private members … … 4667 4691 #ifdef VBOX_WITH_DEBUGGER_GUI 4668 4692 # ifdef VBOX_WITH_DEBUGGER_GUI_MENU 4669 mDbgEnabled = true;4693 initDebuggerVar(&mDbgEnabled, "VBOX_GUI_DBG_ENABLED", VBoxDefs::GUI_DbgEnabled, true); 4670 4694 # else 4671 mDbgEnabled = RTEnvExist("VBOX_GUI_DBG_ENABLED");4695 initDebuggerVar(&mDbgEnabled, "VBOX_GUI_DBG_ENABLED", VBoxDefs::GUI_DbgEnabled, false); 4672 4696 # endif 4673 mDbgAutoShow = mDbgAutoShowCommandLine = mDbgAutoShowStatistics4674 = RTEnvExist("VBOX_GUI_DBG_AUTO_SHOW");4697 initDebuggerVar(&mDbgAutoShow, "VBOX_GUI_DBG_AUTO_SHOW", VBoxDefs::GUI_DbgAutoShow, false); 4698 mDbgAutoShowCommandLine = mDbgAutoShowStatistics = mDbgAutoShow; 4675 4699 mStartPaused = false; 4676 4700 #endif … … 4727 4751 else if (!::strcmp (arg, "-dbg") || !::strcmp (arg, "--dbg")) 4728 4752 { 4729 mDbgEnabled = true;4753 setDebuggerVar(&mDbgEnabled, true); 4730 4754 } 4731 4755 else if (!::strcmp( arg, "-debug") || !::strcmp (arg, "--debug")) 4732 4756 { 4733 mDbgEnabled = true; 4734 mDbgAutoShow = mDbgAutoShowCommandLine = mDbgAutoShowStatistics = true; 4757 setDebuggerVar(&mDbgEnabled, true); 4758 setDebuggerVar(&mDbgAutoShow, true); 4759 setDebuggerVar(&mDbgAutoShowCommandLine, true); 4760 setDebuggerVar(&mDbgAutoShowStatistics, true); 4735 4761 mStartPaused = true; 4736 4762 } 4737 4763 else if (!::strcmp (arg, "--debug-command-line")) 4738 4764 { 4739 mDbgEnabled = true; 4740 mDbgAutoShow = mDbgAutoShowCommandLine = true; 4765 setDebuggerVar(&mDbgEnabled, true); 4766 setDebuggerVar(&mDbgAutoShow, true); 4767 setDebuggerVar(&mDbgAutoShowCommandLine, true); 4741 4768 mStartPaused = true; 4742 4769 } 4743 4770 else if (!::strcmp (arg, "--debug-statistics")) 4744 4771 { 4745 mDbgEnabled = true; 4746 mDbgAutoShow = mDbgAutoShowStatistics = true; 4772 setDebuggerVar(&mDbgEnabled, true); 4773 setDebuggerVar(&mDbgAutoShow, true); 4774 setDebuggerVar(&mDbgAutoShowStatistics, true); 4747 4775 mStartPaused = true; 4748 4776 } 4749 4777 else if (!::strcmp (arg, "-no-debug") || !::strcmp (arg, "--no-debug")) 4750 4778 { 4751 mDbgEnabled = false;4752 mDbgAutoShow = false;4753 mDbgAutoShowCommandLine = false;4754 mDbgAutoShowStatistics = false;4779 setDebuggerVar(&mDbgEnabled, false); 4780 setDebuggerVar(&mDbgAutoShow, false); 4781 setDebuggerVar(&mDbgAutoShowCommandLine, false); 4782 setDebuggerVar(&mDbgAutoShowStatistics, false); 4755 4783 } 4756 4784 /* Not quite debug options, but they're only useful with the debugger bits. */ … … 4817 4845 mValid = true; 4818 4846 } 4847 4819 4848 4820 4849 /** @internal … … 4895 4924 mValid = false; 4896 4925 } 4926 4927 #ifdef VBOX_WITH_DEBUGGER_GUI 4928 4929 # define VBOXGLOBAL_DBG_CFG_VAR_FALSE (0) 4930 # define VBOXGLOBAL_DBG_CFG_VAR_TRUE (1) 4931 # define VBOXGLOBAL_DBG_CFG_VAR_MASK (1) 4932 # define VBOXGLOBAL_DBG_CFG_VAR_CMD_LINE RT_BIT(3) 4933 # define VBOXGLOBAL_DBG_CFG_VAR_DONE RT_BIT(4) 4934 4935 /** 4936 * Initialize a debugger config variable. 4937 * 4938 * @param piDbgCfgVar The debugger config variable to init. 4939 * @param pszEnvVar The environment variable name relating to this 4940 * variable. 4941 * @param pszExtraDataName The extra data name relating to this variable. 4942 * @param fDefault The default value. 4943 */ 4944 void VBoxGlobal::initDebuggerVar(int *piDbgCfgVar, const char *pszEnvVar, const char *pszExtraDataName, bool fDefault) 4945 { 4946 QString strEnvValue; 4947 char szEnvValue[256]; 4948 int rc = RTEnvGetEx(RTENV_DEFAULT, pszEnvVar, szEnvValue, sizeof(szEnvValue), NULL); 4949 if (RT_SUCCESS(rc)) 4950 { 4951 strEnvValue = QString::fromUtf8(&szEnvValue[0]).toLower().trimmed(); 4952 if (strEnvValue.isEmpty()) 4953 strEnvValue = "yes"; 4954 } 4955 else if (rc != VERR_ENV_VAR_NOT_FOUND) 4956 strEnvValue = "veto"; 4957 4958 QString strExtraValue = mVBox.GetExtraData(pszExtraDataName).toLower().trimmed(); 4959 if (strExtraValue.isEmpty()) 4960 strExtraValue = QString(); 4961 4962 if ( strEnvValue.contains("veto") || strExtraValue.contains("veto")) 4963 *piDbgCfgVar = VBOXGLOBAL_DBG_CFG_VAR_DONE | VBOXGLOBAL_DBG_CFG_VAR_FALSE; 4964 else if (strEnvValue.isNull() && strExtraValue.isNull()) 4965 *piDbgCfgVar = fDefault ? VBOXGLOBAL_DBG_CFG_VAR_TRUE : VBOXGLOBAL_DBG_CFG_VAR_FALSE; 4966 else 4967 { 4968 QString *pStr = !strEnvValue.isEmpty() ? &strEnvValue : &strExtraValue; 4969 if ( pStr->startsWith("y") // yes 4970 || pStr->startsWith("e") // enabled 4971 || pStr->startsWith("t") // true 4972 || pStr->startsWith("on") 4973 || pStr->toLongLong() != 0) 4974 *piDbgCfgVar = VBOXGLOBAL_DBG_CFG_VAR_TRUE; 4975 else if ( pStr->startsWith("n") // o 4976 || pStr->startsWith("d") // disable 4977 || pStr->startsWith("f") // false 4978 || pStr->startsWith("off") 4979 || pStr->contains("veto") 4980 || pStr->toLongLong() == 0) 4981 *piDbgCfgVar = VBOXGLOBAL_DBG_CFG_VAR_FALSE; 4982 else 4983 { 4984 LogFunc(("Ignoring unknown value '%s' for '%s'\n", pStr->toAscii().constData(), pStr == &strEnvValue ? pszEnvVar : pszExtraDataName)); 4985 *piDbgCfgVar = fDefault ? VBOXGLOBAL_DBG_CFG_VAR_TRUE : VBOXGLOBAL_DBG_CFG_VAR_FALSE; 4986 } 4987 } 4988 } 4989 4990 /** 4991 * Set a debugger config variable according according to start up argument. 4992 * 4993 * @param piDbgCfgVar The debugger config variable to set. 4994 * @param fState The value from the command line. 4995 */ 4996 void VBoxGlobal::setDebuggerVar(int *piDbgCfgVar, bool fState) 4997 { 4998 if (!(*piDbgCfgVar & VBOXGLOBAL_DBG_CFG_VAR_DONE)) 4999 *piDbgCfgVar = (fState ? VBOXGLOBAL_DBG_CFG_VAR_TRUE : VBOXGLOBAL_DBG_CFG_VAR_FALSE) 5000 | VBOXGLOBAL_DBG_CFG_VAR_CMD_LINE; 5001 } 5002 5003 /** 5004 * Checks the state of a debugger config variable, updating it with the machine 5005 * settings on the first invocation. 5006 * 5007 * @returns true / false. 5008 * @param piDbgCfgVar The debugger config variable to consult. 5009 * @param rMachine Reference to the machine object. 5010 * @param pszExtraDataName The extra data name relating to this variable. 5011 */ 5012 bool VBoxGlobal::isDebuggerWorker(int *piDbgCfgVar, CMachine &rMachine, const char *pszExtraDataName) 5013 { 5014 if (!(*piDbgCfgVar & VBOXGLOBAL_DBG_CFG_VAR_DONE) && !rMachine.isNull()) 5015 { 5016 QString str = mVBox.GetExtraData(pszExtraDataName).toLower().trimmed(); 5017 if (str.contains("veto")) 5018 *piDbgCfgVar = VBOXGLOBAL_DBG_CFG_VAR_DONE | VBOXGLOBAL_DBG_CFG_VAR_FALSE; 5019 else if (str.isEmpty() || (*piDbgCfgVar & VBOXGLOBAL_DBG_CFG_VAR_CMD_LINE)) 5020 *piDbgCfgVar |= VBOXGLOBAL_DBG_CFG_VAR_DONE; 5021 else if ( str.startsWith("y") // yes 5022 || str.startsWith("e") // enabled 5023 || str.startsWith("t") // true 5024 || str.startsWith("on") 5025 || str.toLongLong() != 0) 5026 *piDbgCfgVar = VBOXGLOBAL_DBG_CFG_VAR_DONE | VBOXGLOBAL_DBG_CFG_VAR_TRUE; 5027 else if ( str.startsWith("n") // no 5028 || str.startsWith("d") // disable 5029 || str.startsWith("f") // false 5030 || str.toLongLong() == 0) 5031 *piDbgCfgVar = VBOXGLOBAL_DBG_CFG_VAR_DONE | VBOXGLOBAL_DBG_CFG_VAR_FALSE; 5032 else 5033 *piDbgCfgVar |= VBOXGLOBAL_DBG_CFG_VAR_DONE; 5034 } 5035 5036 return (*piDbgCfgVar & VBOXGLOBAL_DBG_CFG_VAR_MASK) == VBOXGLOBAL_DBG_CFG_VAR_TRUE; 5037 } 5038 5039 #endif /* VBOX_WITH_DEBUGGER_GUI */ 4897 5040 4898 5041 /** @fn vboxGlobal -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r31759 r32741 166 166 167 167 #ifdef VBOX_WITH_DEBUGGER_GUI 168 bool isDebuggerEnabled( ) const { return mDbgEnabled; }169 bool isDebuggerAutoShowEnabled( ) const { return mDbgAutoShow; }170 bool isDebuggerAutoShowCommandLineEnabled( ) const { return mDbgAutoShowCommandLine; }171 bool isDebuggerAutoShowStatisticsEnabled( ) const { return mDbgAutoShowStatistics; }168 bool isDebuggerEnabled(CMachine &aMachine); 169 bool isDebuggerAutoShowEnabled(CMachine &aMachine); 170 bool isDebuggerAutoShowCommandLineEnabled(CMachine &aMachine); 171 bool isDebuggerAutoShowStatisticsEnabled(CMachine &aMachine); 172 172 RTLDRMOD getDebuggerModule() const { return mhVBoxDbg; } 173 173 … … 712 712 713 713 void init(); 714 #ifdef VBOX_WITH_DEBUGGER_GUI 715 void initDebuggerVar(int *piDbgCfgVar, const char *pszEnvVar, const char *pszExtraDataName, bool fDefault = false); 716 void setDebuggerVar(int *piDbgCfgVar, bool fState); 717 bool isDebuggerWorker(int *piDbgCfgVar, CMachine &rMachine, const char *pszExtraDataName); 718 #endif 714 719 715 720 bool mValid; … … 749 754 * Use --dbg, the env.var. VBOX_GUI_DBG_ENABLED, --debug or the env.var. 750 755 * VBOX_GUI_DBG_AUTO_SHOW to enable. */ 751 boolmDbgEnabled;756 int mDbgEnabled; 752 757 /** Whether to show the debugger automatically with the console. 753 758 * Use --debug or the env.var. VBOX_GUI_DBG_AUTO_SHOW to enable. */ 754 boolmDbgAutoShow;759 int mDbgAutoShow; 755 760 /** Whether to show the command line window when mDbgAutoShow is set. */ 756 boolmDbgAutoShowCommandLine;761 int mDbgAutoShowCommandLine; 757 762 /** Whether to show the statistics window when mDbgAutoShow is set. */ 758 boolmDbgAutoShowStatistics;763 int mDbgAutoShowStatistics; 759 764 /** VBoxDbg module handle. */ 760 765 RTLDRMOD mhVBoxDbg; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r32468 r32741 661 661 void UIMachineLogic::prepareDebugger() 662 662 { 663 if (vboxGlobal().isDebuggerAutoShowEnabled()) 663 CMachine machine = uisession()->session().GetMachine(); 664 if (!machine.isNull() && vboxGlobal().isDebuggerAutoShowEnabled(machine)) 664 665 { 665 666 /* console in upper left corner of the desktop. */ … … 670 671 // move (QPoint (rct.x(), rct.y())); 671 672 672 if (vboxGlobal().isDebuggerAutoShowStatisticsEnabled( ))673 if (vboxGlobal().isDebuggerAutoShowStatisticsEnabled(machine)) 673 674 sltShowDebugStatistics(); 674 if (vboxGlobal().isDebuggerAutoShowCommandLineEnabled( ))675 if (vboxGlobal().isDebuggerAutoShowCommandLineEnabled(machine)) 675 676 sltShowDebugCommandLine(); 676 677 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp
r30753 r32741 113 113 #ifdef VBOX_WITH_DEBUGGER_GUI 114 114 /* Debug submenu: */ 115 if ( fOptions & UIMainMenuType_Debug 116 && vboxGlobal().isDebuggerEnabled()) 117 { 118 QMenu *pMenuDebug = pActionsPool->action(UIActionIndex_Menu_Debug)->menu(); 119 prepareMenuDebug(pMenuDebug, pActionsPool); 120 preparedSubMenus << pMenuDebug; 115 if (fOptions & UIMainMenuType_Debug) 116 { 117 CMachine machine; /** @todo we should try get the machine here. But we'll 118 * probably be fine with the cached values. */ 119 if (vboxGlobal().isDebuggerEnabled(machine)) 120 { 121 QMenu *pMenuDebug = pActionsPool->action(UIActionIndex_Menu_Debug)->menu(); 122 prepareMenuDebug(pMenuDebug, pActionsPool); 123 preparedSubMenus << pMenuDebug; 124 } 121 125 } 122 126 #endif -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r32407 r32741 520 520 /* HACK ALERT! Really ugly workaround for the resizing to 9x1 done by DevVGA if provoked before power on. */ 521 521 QSize fb(m_pFrameBuffer->width(), m_pFrameBuffer->height()); 522 if ((fb.width() < 16 || fb.height() < 16) && (vboxGlobal().isStartPausedEnabled() || vboxGlobal().isDebuggerAutoShowEnabled())) 522 if (fb.width() < 16 || fb.height() < 16) 523 { 524 CMachine machine = uisession()->session().GetMachine(); 525 if ( vboxGlobal().isStartPausedEnabled() 526 || vboxGlobal().isDebuggerAutoShowEnabled(machine)) 523 527 fb = QSize(640, 480); 528 } 524 529 return QSize(fb.width() + frameWidth() * 2, fb.height() + frameWidth() * 2); 525 530 #else /* VBOX_WITH_DEBUGGER */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r32482 r32741 185 185 186 186 /* Power UP machine: */ 187 CProgress progress = vboxGlobal().isStartPausedEnabled() || vboxGlobal().isDebuggerAutoShowEnabled( ) ?187 CProgress progress = vboxGlobal().isStartPausedEnabled() || vboxGlobal().isDebuggerAutoShowEnabled(machine) ? 188 188 console.PowerUpPaused() : console.PowerUp(); 189 189
Note:
See TracChangeset
for help on using the changeset viewer.