Browse Source

fix evaluation in console pad; refactoring;

pull/16/head
Eusebiu Marcu 15 years ago
parent
commit
4c83b381c9
  1. 9
      src/AddIns/Debugger/Debugger.AddIn/Pads/ConsolePad.cs
  2. 16
      src/AddIns/Debugger/Debugger.AddIn/Pads/WatchPad.cs
  3. 6
      src/AddIns/Debugger/Debugger.Core/StackFrame.cs
  4. 3
      src/Main/Base/Project/Src/Services/Debugger/CurrentLineBookmark.cs

9
src/AddIns/Debugger/Debugger.AddIn/Pads/ConsolePad.cs

@ -52,7 +52,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -52,7 +52,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
return "The process is running";
}
try {
Value val = ExpressionEvaluator.Evaluate(code, SelectedLanguage, process.SelectedStackFrame);
Value val = ExpressionEvaluator.Evaluate(code, SelectedLanguage, process.SelectedThread.MostRecentStackFrame);
return ExpressionEvaluator.FormatValue(val);
} catch (GetValueException e) {
return e.Message;
@ -107,7 +107,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -107,7 +107,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
if (this.process == null || this.process.IsRunning)
return;
if (this.process.SelectedStackFrame == null || this.process.SelectedStackFrame.NextStatement == null)
if (this.process.SelectedThread.MostRecentStackFrame == null || this.process.SelectedThread.MostRecentStackFrame.NextStatement == null)
return;
foreach (char ch in e.Text) {
@ -119,7 +119,10 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -119,7 +119,10 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
void ShowDotCompletion(string currentText)
{
var seg = process.SelectedStackFrame.NextStatement;
if (this.process.SelectedThread.MostRecentStackFrame == null || this.process.SelectedThread.MostRecentStackFrame.NextStatement == null)
return;
var seg = process.SelectedThread.MostRecentStackFrame.NextStatement;
var expressionFinder = ParserService.GetExpressionFinder(seg.Filename);
var info = ParserService.GetParseInformation(seg.Filename);

16
src/AddIns/Debugger/Debugger.AddIn/Pads/WatchPad.cs

@ -170,25 +170,25 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -170,25 +170,25 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
Utils.DoEvents(debuggedProcess);
List<TreeNode> nodes = new List<TreeNode>();
foreach (var nod in watchList.WatchItems) {
foreach (var node in watchList.WatchItems) {
try {
LoggingService.Info("Evaluating: " + (string.IsNullOrEmpty(nod.Name) ? "is null or empty!" : nod.Name));
var nodExpression = debugger.GetExpression(nod.Name);
LoggingService.Info("Evaluating: " + (string.IsNullOrEmpty(node.Name) ? "is null or empty!" : node.Name));
var nodExpression = debugger.GetExpression(node.Name);
//Value val = ExpressionEvaluator.Evaluate(nod.Name, nod.Language, debuggedProcess.SelectedStackFrame);
ExpressionNode valNode = new ExpressionNode(null, nod.Name, nodExpression);
ExpressionNode valNode = new ExpressionNode(null, node.Name, nodExpression);
nodes.Add(valNode);
}
catch (GetValueException) {
string error = String.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.InvalidExpression}"), nod.Name);
ErrorInfoNode infoNode = new ErrorInfoNode(nod.Name, error);
string error = String.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.InvalidExpression}"), node.Name);
ErrorInfoNode infoNode = new ErrorInfoNode(node.Name, error);
nodes.Add(infoNode);
}
}
// rebuild list
watchList.WatchItems.Clear();
foreach (var nod in nodes)
watchList.WatchItems.Add(nod);
foreach (var node in nodes)
watchList.WatchItems.Add(node);
}
catch(AbortedBecauseDebuggeeResumedException) { }
catch(Exception ex) {

6
src/AddIns/Debugger/Debugger.Core/StackFrame.cs

@ -63,7 +63,7 @@ namespace Debugger @@ -63,7 +63,7 @@ namespace Debugger
/// (That is has accesss to the .pdb file) </summary>
public bool HasSymbols {
get {
return GetSegmentForOffet(0) != null;
return GetSegmentForOffset(0) != null;
}
}
@ -143,7 +143,7 @@ namespace Debugger @@ -143,7 +143,7 @@ namespace Debugger
public int SourceCodeLine { get; set; }
SourcecodeSegment GetSegmentForOffet(int offset)
SourcecodeSegment GetSegmentForOffset(int offset)
{
if (SourceCodeLine != 0)
return SourcecodeSegment.ResolveForIL(this.MethodInfo.DebugModule, corFunction, SourceCodeLine, offset, ILRanges);
@ -241,7 +241,7 @@ namespace Debugger @@ -241,7 +241,7 @@ namespace Debugger
/// </summary>
public SourcecodeSegment NextStatement {
get {
return GetSegmentForOffet(IP);
return GetSegmentForOffset(IP);
}
}

3
src/Main/Base/Project/Src/Services/Debugger/CurrentLineBookmark.cs

@ -27,6 +27,9 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -27,6 +27,9 @@ namespace ICSharpCode.SharpDevelop.Debugging
if (tecp != null) {
SetPosition(tecp.TextEditor.FileName, tecp.TextEditor.Document, makerStartLine, makerStartColumn, makerEndLine, makerEndColumn);
} else {
if (makerStartLine == 0)
return;
dynamic codeView = viewContent.Control;
SetPosition(null, codeView.TextEditor.Document as IDocument, makerStartLine, makerStartColumn, makerEndLine, makerEndColumn);
codeView.IconBarManager.Bookmarks.Add(CurrentLineBookmark.instance);

Loading…
Cancel
Save