示例#1
0
文件: Debugger.cs 项目: kztao/FlingOS
        /// <summary>
        /// Loads the current method's C# code (if it isn't plugged).
        /// </summary>
        private void LoadCurrentMethodCS()
        {
            if(CurrentILOpInfo != null)
            {
                string methodSig = CurrentMethod.MethodSignature;
                string[] reversedSig = Kernel.Compiler.Utils.ReverseMethodSignature(methodSig);

                string SymbolName = reversedSig[1];
                string MethodName = reversedSig[2];

                try
                {
                    currentCSSymbol= ThePDBDumpManager.Symbols[SymbolName];
                    //TODO - Choosing First here is wrong as one function name can be overridden.
                    //       We need to fix this so we can properly identify which override we are 
                    //       executing.
                    currentCSMethod = (from methods in currentCSSymbol.Methods
                                       where methods.FunctionName == MethodName
                                       select methods).First();
                    currentCSLine = null;

                    for (int i = 0; i < currentCSMethod.Lines.Count; i++)
                    {
                        PDB_LineInfo testLine = currentCSMethod.Lines[i];
                        if(CurrentILOpInfo.Position >= testLine.ILStartNum &&
                            CurrentILOpInfo.Position <= testLine.ILEndNum)
                        {
                            currentCSLine = testLine;
                            break;
                        }
                    }
                }
                catch
                {
                    currentCSLine = null;
                    currentCSSymbol = null;
                    currentCSMethod = null;
                }
            }
            else
            {
                currentCSLine = null;
                currentCSSymbol = null;
                currentCSMethod = null;
            }
        }
示例#2
0
文件: Debugger.cs 项目: kztao/FlingOS
        /// <summary>
        /// Sends a request for the brwak address.
        /// </summary>
        public void GetBreakAddress()
        {
            currentMethod = null;
            currentMethodASM = null;
            currentNearestLabels = null;
            currentNearestMethodBasedLabel = null;
            if (currentILOpInfo != null)
            {
                lastILOpInfo = currentILOpInfo;
            }
            currentILOpInfo = null;
            arguments = null;
            locals = null;
            currentCSLine = null;
            currentCSMethod = null;
            currentCSSymbol = null;

            TheSerial.Write((byte)DebugCommands.GetBreakAddress);
            WaitForCommand();
        }