//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public CLangDebuggeeStackFrame (CLangDebugger debugger, CLangDebuggeeThread thread, MiResultValueTuple frameTuple, string frameName) : base (debugger.Engine, thread as DebuggeeThread, frameName) { m_debugger = debugger; if (frameTuple == null) { throw new ArgumentNullException ("frameTuple"); } m_queriedRegisters = false; m_queriedArgumentsAndLocals = false; GetInfoFromCurrentLevel (frameTuple); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void GetInfoFromCurrentLevel (MiResultValueTuple frameTuple) { LoggingUtils.PrintFunction (); try { if (frameTuple == null) { throw new ArgumentNullException ("frameTuple"); } if (frameTuple.HasField ("level")) { m_stackLevel = frameTuple ["level"] [0].GetUnsignedInt (); } // // Discover the function or shared library location. // if (frameTuple.HasField ("addr")) { m_locationAddress = new DebuggeeAddress (frameTuple ["addr"] [0].GetString ()); } else { m_locationAddress = new DebuggeeAddress ("0x0"); } if (frameTuple.HasField ("func")) { m_locationFunction = frameTuple ["func"] [0].GetString (); } else { m_locationFunction = "??"; } m_locationIsSymbolicated = !(m_locationFunction.Equals ("??")); if (frameTuple.HasField ("from")) { m_locationModule = Path.GetFileName (frameTuple ["from"] [0].GetString ()); } else { m_locationModule = string.Empty; } // // Generate code and document contexts for this frame location. // if (frameTuple.HasField ("fullname") && frameTuple.HasField ("line")) { // // If the symbol table isn't yet loaded, we'll need to specify exactly the location of this stack frame. // TEXT_POSITION [] textPositions = new TEXT_POSITION [2]; textPositions [0].dwLine = frameTuple ["line"] [0].GetUnsignedInt () - 1; textPositions [0].dwColumn = 0; textPositions [1].dwLine = textPositions [0].dwLine; textPositions [1].dwColumn = textPositions [0].dwColumn; string filename = PathUtils.ConvertPathCygwinToWindows (frameTuple ["fullname"] [0].GetString ()); m_documentContext = new DebuggeeDocumentContext (m_debugger.Engine, filename, textPositions [0], textPositions [1]); m_codeContext = CLangDebuggeeCodeContext.GetCodeContextForLocation (m_debugger, m_locationAddress.ToString ()); if (m_codeContext == null) { throw new InvalidOperationException (); } } else { m_codeContext = CLangDebuggeeCodeContext.GetCodeContextForLocation (m_debugger, m_locationAddress.ToString ()); m_documentContext = (m_codeContext != null) ? m_codeContext.DocumentContext : null; } } catch (Exception e) { LoggingUtils.HandleException (e); } }