Browse Source

Bugfixes - Local variables on thread without symbols; Can't click on function without symbols; Added CurrentFunction to NDebugger

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@257 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
fb0252d6f5
  1. 9
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs
  2. 1
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
  3. 38
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs
  4. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  5. 23
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/NDebugger-Processes.cs
  6. 16
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/NDebugger-Threads.cs
  7. 10
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs

9
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs

@ -86,8 +86,11 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
void CallStackListItemActivate(object sender, EventArgs e) void CallStackListItemActivate(object sender, EventArgs e)
{ {
if (debuggerCore.IsCurrentProcessSafeForInspection) { if (debuggerCore.IsCurrentThreadSafeForInspection) {
debuggerCore.CurrentThread.CurrentFunction = (Function)(callStackList.SelectedItems[0].Tag); Function f = (Function)(callStackList.SelectedItems[0].Tag);
if (f.HasSymbols) {
debuggerCore.CurrentFunction = f;
}
} }
} }
@ -105,7 +108,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
{ {
callStackList.BeginUpdate(); callStackList.BeginUpdate();
callStackList.Items.Clear(); callStackList.Items.Clear();
if (debuggerCore.IsCurrentProcessSafeForInspection) { if (debuggerCore.IsCurrentThreadSafeForInspection) {
foreach (Function f in debuggerCore.CurrentThread.Callstack) { foreach (Function f in debuggerCore.CurrentThread.Callstack) {
ListViewItem item = new ListViewItem(new string[] { f.Name, "" }); ListViewItem item = new ListViewItem(new string[] { f.Name, "" });
item.Tag = f; item.Tag = f;

1
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs

@ -384,6 +384,7 @@ namespace ICSharpCode.SharpDevelop.Services
{ {
SourcecodeSegment nextStatement = debugger.NextStatement; SourcecodeSegment nextStatement = debugger.NextStatement;
if (nextStatement == null) { if (nextStatement == null) {
DebuggerService.RemoveCurrentLineMarker();
return; return;
} }
DebuggerService.JumpToCurrentLine(nextStatement.SourceFullFilename, nextStatement.StartLine, nextStatement.StartColumn, nextStatement.EndLine, nextStatement.EndColumn); DebuggerService.JumpToCurrentLine(nextStatement.SourceFullFilename, nextStatement.StartLine, nextStatement.StartColumn, nextStatement.EndLine, nextStatement.EndColumn);

38
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs

@ -185,49 +185,43 @@ namespace DebuggerLibrary
AddProcess(process); AddProcess(process);
} }
public bool IsCurrentProcessSafeForInspection { public Function CurrentFunction {
get { get {
if (CurrentProcess == null) { if (IsCurrentThreadSafeForInspection) {
return false; return CurrentThread.CurrentFunction;
} else { } else {
return CurrentProcess.IsProcessSafeForInspection; return null;
} }
} }
set {
if (IsCurrentThreadSafeForInspection) {
CurrentThread.CurrentFunction = value;
} }
internal void CheckThatCurrentProcessIsSafeForInspection()
{
if (CurrentProcess == null) {
throw new DebuggerException("There is no process being debugged.");
} else {
CurrentProcess.CheckThatProcessIsSafeForInspection();
} }
} }
public Thread CurrentThread { public bool IsCurrentFunctionSafeForInspection {
get { get {
if (CurrentProcess == null) return null; if (IsCurrentThreadSafeForInspection &&
return CurrentProcess.CurrentThread; CurrentThread.CurrentFunction != null &&
CurrentThread.CurrentFunction.HasSymbols) {
return true;
} else {
return false;
} }
set {
CurrentProcess.CurrentThread = value;
} }
} }
public SourcecodeSegment NextStatement { public SourcecodeSegment NextStatement {
get { get {
if (!IsCurrentProcessSafeForInspection) return null; if (!IsCurrentFunctionSafeForInspection) return null;
if (CurrentProcess.CurrentThread.CurrentFunction == null) {
return null;
} else {
return CurrentProcess.CurrentThread.CurrentFunction.NextStatement; return CurrentProcess.CurrentThread.CurrentFunction.NextStatement;
} }
} }
}
public VariableCollection LocalVariables { public VariableCollection LocalVariables {
get { get {
if (!IsCurrentProcessSafeForInspection) return VariableCollection.Empty; if (!IsCurrentFunctionSafeForInspection) return VariableCollection.Empty;
return CurrentProcess.CurrentThread.CurrentFunction.GetVariables(); return CurrentProcess.CurrentThread.CurrentFunction.GetVariables();
} }
} }

6
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs

@ -45,6 +45,12 @@ namespace DebuggerLibrary
} }
} }
public bool HasSymbols {
get {
return module.SymbolsLoaded;
}
}
internal ICorDebugClass ContaingClass { internal ICorDebugClass ContaingClass {
get { get {
ICorDebugClass corClass; ICorDebugClass corClass;

23
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/NDebugger-Processes.cs

@ -21,6 +21,12 @@ namespace DebuggerLibrary
public event EventHandler<ProcessEventArgs> ProcessStarted; public event EventHandler<ProcessEventArgs> ProcessStarted;
public event EventHandler<ProcessEventArgs> ProcessExited; public event EventHandler<ProcessEventArgs> ProcessExited;
public IList<Process> Processes {
get {
return processCollection.AsReadOnly();
}
}
public Process CurrentProcess { public Process CurrentProcess {
get { get {
if (currentProcess == null && Processes.Count > 0) { if (currentProcess == null && Processes.Count > 0) {
@ -33,9 +39,22 @@ namespace DebuggerLibrary
} }
} }
public IList<Process> Processes { public bool IsCurrentProcessSafeForInspection {
get { get {
return processCollection.AsReadOnly(); if (CurrentProcess == null) {
return false;
} else {
return CurrentProcess.IsProcessSafeForInspection;
}
}
}
internal void CheckThatCurrentProcessIsSafeForInspection()
{
if (CurrentProcess == null) {
throw new DebuggerException("There is no process being debugged.");
} else {
CurrentProcess.CheckThatProcessIsSafeForInspection();
} }
} }

16
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/NDebugger-Threads.cs

@ -47,6 +47,22 @@ namespace DebuggerLibrary
} }
} }
public Thread CurrentThread {
get {
if (CurrentProcess == null) return null;
return CurrentProcess.CurrentThread;
}
set {
CurrentProcess.CurrentThread = value;
}
}
public bool IsCurrentThreadSafeForInspection {
get {
return IsCurrentProcessSafeForInspection;
}
}
internal Thread GetThread(ICorDebugThread corThread) internal Thread GetThread(ICorDebugThread corThread)
{ {
foreach(Thread thread in threadCollection) { foreach(Thread thread in threadCollection) {

10
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs

@ -232,14 +232,16 @@ namespace DebuggerLibrary
if (currentFunction == null) { if (currentFunction == null) {
currentFunction = LastFunctionWithLoadedSymbols; currentFunction = LastFunctionWithLoadedSymbols;
} }
if (currentFunction == null) {
currentFunction = LastFunction;
}
return currentFunction; return currentFunction;
} }
set { set {
if (value != null && !value.HasSymbols) {
throw new DebuggerException("CurrentFunction must have symbols");
}
currentFunction = value; currentFunction = value;
if (debugger.ManagedCallback.HandlingCallback == false) { if (debugger.ManagedCallback.HandlingCallback == false) {
debugger.OnDebuggingPaused(PausedReason.CurrentFunctionChanged); debugger.OnDebuggingPaused(PausedReason.CurrentFunctionChanged);
} }
@ -249,7 +251,7 @@ namespace DebuggerLibrary
public Function LastFunctionWithLoadedSymbols { public Function LastFunctionWithLoadedSymbols {
get { get {
foreach (Function function in Callstack) { foreach (Function function in Callstack) {
if (function.Module.SymbolsLoaded) { if (function.HasSymbols) {
return function; return function;
} }
} }

Loading…
Cancel
Save