Example #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Generator.PostBuild: Begin");

            // Find the project root
            string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            while (true)
            {
                if (Directory.Exists(Path.Combine(path, "Root")) && Directory.Exists(Path.Combine(path, "System")) && Directory.Exists(Path.Combine(path, "Tools")) && Directory.Exists(Path.Combine(path, "VMware")))
                    break;

                if (path.Length == 2)
                {
                    MessageBox.Show("Unable to find project root", "Generator.PostBuild", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                path = Path.GetDirectoryName(path);
            }
            Root = path;

            // Construct environment and run the interface
            using (VirtualMachine = new VMwareVirtualMachine(Path.Combine(Root, @"VMware\System.vmx")))
                Output.Generate();

            //Wrappers.Generate();

            Console.WriteLine("Generator.PostBuild: End");
        }
Example #2
0
 private void DoResume(VirtualMachine vm)
 {
     try
     {
         vm.Resume();
     }
     catch (InvalidOperationException e)
     {
         Log.WriteLine(TraceLevel.Error, "Debugger", "DoResume> {0}", e.Message);
     }
 }
Example #3
0
        public void Shutdown()
        {
            if (!m_shutDown)
            {
                if (m_vm != null)
                {
                    // Tell everyone that the debugger is going away.
                    if (ms_running)
                        Broadcaster.Invoke("debugger stopped", this);
                    Broadcaster.Unregister(this);

                    // Force the VM to exit (which should kill the debugee).
                    try
                    {
                        Log.WriteLine(TraceLevel.Info, "Debugger", "Exiting VM");
                        m_vm.Exit(5);
                    }
                    catch (System.Net.Sockets.SocketException e)
                    {
                        Log.WriteLine(TraceLevel.Warning, "Debugger", "Error exiting VM: {0}", e.Message);
                    }
                    catch (VMDisconnectedException)
                    {
                    }

                    // If the debugee did not exit then give it a bit more time and then
                    // hit it with a big hammer. (The debuggee will die asynchronously
                    // so we'll often land in this code).
                    Process process = m_vm.Process;
                    if (process != null && !process.HasExited)
                    {
                        NSApplication.sharedApplication().BeginInvoke(() => DoKillProcess(process), TimeSpan.FromSeconds(3));
                    }
                }

                m_shutDown = true;
                m_vm = null;
                m_thread = null;
                m_currentThread = null;
                ms_running = false;
            }
        }