Пример #1
0
        /// <summary>
        /// 开始调试
        /// </summary>
        public void Run()
        {
            // 获取源代码-中间代码信息
            intermediateCodeInformations = GetIntermediateCodeInformation();

            nextLines = new Dictionary <int, List <int> >();

            savedInstructions = new Dictionary <int, IntermediateCode>();

            // 获取最大行信息
            maxLine = int.MinValue;

            foreach (int key in intermediateCodeInformations.Keys)
            {
                if (key > maxLine)
                {
                    maxLine = key;
                }
            }

            // 遍历断点信息
            foreach (int breakpoint in breakpoints)
            {
                // 保存断点处指令并替换为int指令
                if (intermediateCodeInformations.ContainsKey(breakpoint))
                {
                    IntermediateCodeInformation information = intermediateCodeInformations[breakpoint];
                    int address            = information.Address;
                    IntermediateCode saved = vm.ReplaceWithInt(address);
                    savedInstructions.Add(address, saved);
                }
            }
            vm.Run();
        }