本文整理汇总了C#中Microsoft.SPOT.Debugger.Engine.SetExecutionMode方法的典型用法代码示例。如果您正苦于以下问题:C# Engine.SetExecutionMode方法的具体用法?C# Engine.SetExecutionMode怎么用?C# Engine.SetExecutionMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.SPOT.Debugger.Engine
的用法示例。
在下文中一共展示了Engine.SetExecutionMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: bwConnecter_DoWork
private void bwConnecter_DoWork(System.Object sender, DoWorkEventArgs e)
{
BackgroundConnectorArguments bca = (BackgroundConnectorArguments)e.Argument;
_DBG.PortDefinition port = bca.connectPort;
Debug.Assert(m_engine == null);
e.Result = false;
#if USE_CONNECTION_MANAGER
m_engine = m_port.DebugPortSupplier.Manager.Connect(port);
#else
m_engine = new _DBG.Engine(port);
#endif
m_killEmulator = false;
lock (m_engine)
{
m_engine.StopDebuggerOnConnect = true;
m_engine.OnCommand += new _DBG.CommandEventHandler(OnWPCommand);
m_engine.OnMessage += new _DBG.MessageEventHandler(OnWPMessage);
m_engine.Start();
const int retries = 50;
bool connected = false;
for (int i = 0; connected == false && i < retries; i++)
{
if (bwConnecter.CancellationPending)
{
e.Cancel = true;
return;
}
connected = m_engine.TryToConnect(1, 100, false, _DBG.ConnectionSource.TinyCLR);
}
if (connected)
{
if (m_engine.Capabilities.Profiling == false)
{
throw new ApplicationException("This device is not running a version of TinyCLR that supports profiling.");
}
//Move IsDeviceInInitializeState(), IsDeviceInExitedState(), GetDeviceState(),EnsureProcessIsInInitializedState() to Debugger.dll?
uint executionMode = 0;
m_engine.SetExecutionMode(0, 0, out executionMode);
if (bca.reboot || (executionMode & _WP.Commands.Debugging_Execution_ChangeConditions.c_State_Mask) != _WP.Commands.Debugging_Execution_ChangeConditions.c_State_Initialize)
{
m_engine.RebootDevice(_DBG.Engine.RebootOption.RebootClrWaitForDebugger);
m_engine.TryToConnect(10, 1000);
m_engine.SetExecutionMode(0, 0, out executionMode);
Debug.Assert((executionMode & _WP.Commands.Debugging_Execution_ChangeConditions.c_State_Mask) == _WP.Commands.Debugging_Execution_ChangeConditions.c_State_Initialize);
}
m_engine.ThrowOnCommunicationFailure = true;
m_session = new _PRF.ProfilerSession(m_engine);
if (m_exporter != null)
{
m_exporter.Close();
}
switch (bca.exporter)
{
case BackgroundConnectorArguments.ExporterType.CLRProfiler:
m_exporter = new _PRF.Exporter_CLRProfiler(m_session, bca.outputFileName);
break;
#if DEBUG
case BackgroundConnectorArguments.ExporterType.OffProf:
m_exporter = new _PRF.Exporter_OffProf(m_session, bca.outputFileName);
break;
#endif
default:
throw new ArgumentException("Unsupported export format");
}
m_session.EnableProfiling();
e.Result = true;
}
}
return;
}