예제 #1
0
        static void Main(string[] args)
        {
            System.Diagnostics.TextWriterTraceListener writer = new
   System.Diagnostics.TextWriterTraceListener(System.Console.Out);
            System.Diagnostics.Debug.Listeners.Add(writer);

            JdwpParameters parameters = null;
            int pid = 0;
            for (int i = 0; i < args.Length; i++)
            {
                String str = args[i];
                Console.Out.WriteLine(str);
                Console.Out.Flush();
                if (str.StartsWith("-Xrunjdwp") || str.StartsWith("-agentlib:jdwp"))
                {
                    parameters = new JdwpParameters();
                    parameters.Parse(str);

                }
                if (str.StartsWith("-pid:"))
                {
                    pid = Int32.Parse(str.Substring(5, str.Length - 5));
                }
            }
            if (parameters != null && pid != 0)
            {
                JdwpConnection conn = new JdwpConnection(parameters);
                conn.Connect();
                Console.Error.WriteLine("Started");
                TargetVM target = new TargetVM(pid, new JdwpEventHandler(conn));
                JdwpHandler handler = new JdwpHandler(conn, target);
                handler.Run();
                //System.Threading.Thread.Sleep(5000);
            }
            else
            {
                Environment.Exit(3);
            }
        }
예제 #2
0
파일: Debugger.cs 프로젝트: zgramana/ikvm
        static void Main(string[] args)
        {
            System.Diagnostics.TextWriterTraceListener writer = new
                                                                System.Diagnostics.TextWriterTraceListener(System.Console.Out);
            System.Diagnostics.Debug.Listeners.Add(writer);

            JdwpParameters parameters = null;
            int            pid        = 0;

            for (int i = 0; i < args.Length; i++)
            {
                String str = args[i];
                Console.Out.WriteLine(str);
                Console.Out.Flush();
                if (str.StartsWith("-Xrunjdwp") || str.StartsWith("-agentlib:jdwp"))
                {
                    parameters = new JdwpParameters();
                    parameters.Parse(str);
                }
                if (str.StartsWith("-pid:"))
                {
                    pid = Int32.Parse(str.Substring(5, str.Length - 5));
                }
            }
            if (parameters != null && pid != 0)
            {
                JdwpConnection conn = new JdwpConnection(parameters);
                conn.Connect();
                Console.Error.WriteLine("Started");
                TargetVM    target  = new TargetVM(pid, new JdwpEventHandler(conn));
                JdwpHandler handler = new JdwpHandler(conn, target);
                handler.Run();
                //System.Threading.Thread.Sleep(5000);
            }
            else
            {
                Environment.Exit(3);
            }
        }