VSNDK.DebugEngine.AD7Thread.getFunctionName C# (CSharp) Method

getFunctionName() public method

Gets the function name.
public getFunctionName ( ) : string
return string
        public string getFunctionName()
        {
            string func = "";

            if ((this._id != "") && (this._id != this._engine.currentThread()._id))
                _engine.eDispatcher.selectThread(this._id);

            string stackResponse = _engine.eDispatcher.getStackFrames().Replace("#;;;;", "");

            if (stackResponse != "")
            {
                string[] frameStrings = stackResponse.Split('#');

                // Query the stack depth without inquiring GDB.
                int numStackFrames = frameStrings.Length;

                if (numStackFrames > 30) // limiting the amount of stackFrames to avoid VS crashing.
                    numStackFrames = 30;

                for (int i = 0; i < numStackFrames; i++)
                {
                    string[] frameInfo = frameStrings[i].Split(';');
                    if (frameInfo.Length >= 2)
                    {
                        if ((frameInfo[2] != "") && (frameInfo[2] != "??") && (!frameInfo[2].Contains("object.")))
                        {
                            func = frameInfo[2];
                            break;
                        }
                    }
                }

                if ((this._id != "") && (this._id != this._engine.currentThread()._id))
                    _engine.eDispatcher.selectThread(this._engine.currentThread()._id);
            }

            return func;
        }