Ejemplo n.º 1
0
        public override void StackTrace(Response response, dynamic arguments)
        {
            BackTraceCmd cmd = new BackTraceCmd();
            BackTraceRes res = SendOneCmdAndWaitForResponse(cmd) as BackTraceRes;

            var stackFrames = new List <StackFrame>();

            if (res != null)
            {
                for (int i = 0; i < res.m_frames.Count; ++i)
                {
                    var frame = res.m_frames[i];
                    var file  = frame.Item1;
                    file = Path.Combine(_t_work_dir, file);
                    var line      = frame.Item3;
                    var func_name = frame.Item2;
                    var source    = VSCodeDebugAdapter.Source.Create(Path.GetFileName(file), ConvertDebuggerPathToClient(file));
                    stackFrames.Add(new StackFrame(i + 1, func_name, source, line, 0));
                }
            }

            SendResponse(response, new StackTraceResponseBody(stackFrames));
        }
Ejemplo n.º 2
0
        DebugCmd ParseCmd(string line)
        {
            string[] args = System.Text.RegularExpressions.Regex.Split(line, @"\s+");
            if (args.Length == 0)
            {
                return(null);
            }
            if (args[0] == "b" && args.Length == 3)
            {
                BreakCmd   cmd   = new BreakCmd();
                BreakPoint point = new BreakPoint();
                point.file_name = args[1];
                point.line      = Convert.ToInt32(args[2]);
                cmd.m_cmd_mode  = BreakCmd.BreakCmdMode.Set;
                cmd.m_break_points.Add(point);
                return(cmd);
            }
            else if (args[0] == "br" && args.Length >= 2)
            {
                BreakCmd cmd = new BreakCmd();
                if (args[1] == "list")
                {
                    cmd.m_cmd_mode = BreakCmd.BreakCmdMode.List;
                    return(cmd);
                }
                else if (args[1] == "clear")
                {
                    cmd.m_cmd_mode = BreakCmd.BreakCmdMode.DeleteAll;
                    return(cmd);
                }
                else if (args[1] == "delete" && args.Length >= 3)
                {
                    cmd.m_cmd_mode = BreakCmd.BreakCmdMode.Delete;
                    for (int i = 2; i < args.Length; ++i)
                    {
                        BreakPoint point = new BreakPoint();
                        point.index = Convert.ToInt32(args[i]);
                        cmd.m_break_points.Add(point);
                    }
                    return(cmd);
                }
            }
            else if (args[0] == "c")
            {
                Continue cmd = new Continue();
                return(cmd);
            }
            else if (args[0] == "n")
            {
                StepOver cmd = new StepOver();
                return(cmd);
            }
            else if (args[0] == "s")
            {
                StepIn cmd = new StepIn();
                return(cmd);
            }
            else if (args[0] == "f")
            {
                StepOut cmd = new StepOut();
                return(cmd);
            }
            else if (args[0] == "bt")
            {
                BackTraceCmd cmd = new BackTraceCmd();
                return(cmd);
            }
            else if (args[0] == "p" && args.Length == 2)
            {
                PrintCmd cmd = new PrintCmd();
                cmd.m_name = args[1];
                return(cmd);
            }
            else if (args[0] == "t")
            {
                Terminate cmd = new Terminate();
                return(cmd);
            }
            else if (args[0] == "h")
            {
                Console.Write(_help_info);
            }
            else
            {
                Console.WriteLine("what do you want? type 'h' for help");
            }

            return(null);
        }