Browse Source

Some custom exceptions removed

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@203 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
30f4a6b5fc
  1. 4
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/ExceptionHistoryPad.cs
  2. 5
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/RunningThreadsPad.cs
  3. 23
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
  4. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs
  5. 36
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Exceptions.cs
  6. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/NDebugger-Modules.cs
  7. 7
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs
  8. 28
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  9. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/NDebugger-Processes.cs
  10. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/NDebugger-Threads.cs
  11. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs
  12. 8
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs
  13. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectVariable.cs
  14. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs

4
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/ExceptionHistoryPad.cs

@ -91,6 +91,10 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -91,6 +91,10 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
void ExceptionHistoryListItemActivate(object sender, EventArgs e)
{
SourcecodeSegment nextStatement = ((DebuggerLibrary.Exception)(exceptionHistoryList.SelectedItems[0].Tag)).Location;
if (nextStatement == null) {
return;
}
FileService.OpenFile(nextStatement.SourceFullFilename);
IWorkbenchWindow window = FileService.GetOpenFile(nextStatement.SourceFullFilename);

5
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/RunningThreadsPad.cs

@ -118,9 +118,10 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -118,9 +118,10 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
item.Text = e.Thread.ID.ToString();
item.Tag = e.Thread;
item.SubItems.Add(e.Thread.Name);
try {
Function location = e.Thread.LastFunctionWithLoadedSymbols;
if (location != null) {
item.SubItems.Add(e.Thread.CurrentFunction.Name);
} catch (CurrentFunctionNotAviableException) {
} else {
item.SubItems.Add("N/A");
}
item.SubItems.Add(e.Thread.Priority.ToString());

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

@ -396,19 +396,18 @@ namespace ICSharpCode.SharpDevelop.Services @@ -396,19 +396,18 @@ namespace ICSharpCode.SharpDevelop.Services
public void JumpToCurrentLine()
{
//StatusBarService.SetMessage("Source code not aviable!");
try {
SourcecodeSegment nextStatement = debugger.NextStatement;
DebuggerService.JumpToCurrentLine(nextStatement.SourceFullFilename, nextStatement.StartLine, nextStatement.StartColumn, nextStatement.EndLine, nextStatement.EndColumn);
string stepRanges = "";
foreach (int i in nextStatement.StepRanges) {
stepRanges += i.ToString("X") + " ";
}
//StatusBarService.SetMessage("IL:" + nextStatement.ILOffset.ToString("X") + " StepRange:" + stepRanges + " ");
} catch (NextStatementNotAviableException) {
System.Diagnostics.Debug.Fail("Source code not aviable!");
SourcecodeSegment nextStatement = debugger.NextStatement;
if (nextStatement == null) {
//StatusBarService.SetMessage("Source code not aviable!");
return;
}
DebuggerService.JumpToCurrentLine(nextStatement.SourceFullFilename, nextStatement.StartLine, nextStatement.StartColumn, nextStatement.EndLine, nextStatement.EndColumn);
string stepRanges = "";
foreach (int i in nextStatement.StepRanges) {
stepRanges += i.ToString("X") + " ";
}
//StatusBarService.SetMessage("IL:" + nextStatement.ILOffset.ToString("X") + " StepRange:" + stepRanges + " ");
}
void OnIsDebuggingChanged(object sender, DebuggerEventArgs e)

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs

@ -62,7 +62,7 @@ namespace DebuggerLibrary @@ -62,7 +62,7 @@ namespace DebuggerLibrary
}
}
throw new UnableToGetPropertyException(this, "GetBreakpoint(ICorDebugBreakpoint corBreakpoint)", "Breakpoint is not in collection");
throw new DebuggerException("Breakpoint is not in collection");
}
internal Breakpoint AddBreakpoint(Breakpoint breakpoint)

36
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Exceptions.cs

@ -13,39 +13,5 @@ namespace DebuggerLibrary @@ -13,39 +13,5 @@ namespace DebuggerLibrary
public DebuggerException(string message, System.Exception inner): base(message, inner) {}
}
public class UnableToGetPropertyException: DebuggerException
{
public object sender;
public string property;
public string hint;
public UnableToGetPropertyException(object sender, string property): this(sender, property, null)
{
}
public UnableToGetPropertyException(object sender, string property, string hint): base()
{
this.sender = sender;
this.property = property;
this.hint = hint;
}
public override string Message {
get {
return "Sender of exception: " + sender.GetType().ToString() + "\n" +
"Description of sender: " + sender.ToString() + "\n" +
"Unable to get property: " + property.ToString() + "\n" +
((hint != null)?("Comment: " + hint + "\n"):"");
}
}
}
public class BadSignatureException: DebuggerException {}
public class NotAviableException: DebuggerException {}
public class FrameNotAviableException: NotAviableException {}
public class SymbolsNotAviableException: NotAviableException {}
public class CurrentFunctionNotAviableException: NotAviableException {}
public class CurrentThreadNotAviableException: NotAviableException {}
public class NextStatementNotAviableException: NotAviableException {}
public class BadSignatureException: DebuggerException {}
}

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Modules/NDebugger-Modules.cs

@ -46,7 +46,7 @@ namespace DebuggerLibrary @@ -46,7 +46,7 @@ namespace DebuggerLibrary
}
}
throw new UnableToGetPropertyException(this, "GetModule(string filename)", "Module \"" + filename + "\" is not in collection");
throw new DebuggerException("Module \"" + filename + "\" is not in collection");
}
internal Module GetModule(ICorDebugModule corModule)
@ -57,7 +57,7 @@ namespace DebuggerLibrary @@ -57,7 +57,7 @@ namespace DebuggerLibrary
}
}
throw new UnableToGetPropertyException(this, "GetModule(ICorDebugModule corModule)", "Module is not in collection");
throw new DebuggerException("Module is not in collection");
}
internal void AddModule(Module module)

7
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs

@ -43,11 +43,8 @@ namespace DebuggerLibrary @@ -43,11 +43,8 @@ namespace DebuggerLibrary
}
message = runtimeVariableException.SubVariables["_message"].Value.ToString();
}
try {
location = thread.CurrentFunction.NextStatement;
} catch (NextStatementNotAviableException) {
location = new SourcecodeSegment();
}
location = thread.CurrentFunction.NextStatement;
type = runtimeVariable.Type;
}

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

@ -98,8 +98,8 @@ namespace DebuggerLibrary @@ -98,8 +98,8 @@ namespace DebuggerLibrary
internal ISymbolReader symReader {
get {
if (module.SymbolsLoaded == false) throw new SymbolsNotAviableException();
if (module.SymReader == null) throw new SymbolsNotAviableException();
if (module.SymbolsLoaded == false) return null;
if (module.SymReader == null) return null;
return module.SymReader;
}
}
@ -139,12 +139,12 @@ namespace DebuggerLibrary @@ -139,12 +139,12 @@ namespace DebuggerLibrary
}
SourcecodeSegment nextSt;
try {
nextSt = NextStatement;// Cache
} catch (NextStatementNotAviableException) {
nextSt = NextStatement;// Cache
if (nextSt == null) {
System.Diagnostics.Debug.Fail("Unable to step. Next statement not aviable");
return;
}
}
ICorDebugStepper stepper;
corFrame.CreateStepper(out stepper);
@ -167,14 +167,10 @@ namespace DebuggerLibrary @@ -167,14 +167,10 @@ namespace DebuggerLibrary
public SourcecodeSegment NextStatement {
get {
ISymbolMethod symMethod;
try {
symMethod = this.symMethod;
}
catch (FrameNotAviableException) {
throw new NextStatementNotAviableException();
}
catch (SymbolsNotAviableException) {
throw new NextStatementNotAviableException();
symMethod = this.symMethod;
if (symMethod == null) {
return null;
}
int sequencePointCount = symMethod.SequencePointCount;
@ -229,7 +225,7 @@ namespace DebuggerLibrary @@ -229,7 +225,7 @@ namespace DebuggerLibrary
}
// Wow, there are no 'real' sequences
if (startLine[i] == 0xFeeFee) {
throw new NextStatementNotAviableException();
return null;
}
retVal.ModuleFilename = module.FullPath;
@ -266,7 +262,7 @@ namespace DebuggerLibrary @@ -266,7 +262,7 @@ namespace DebuggerLibrary
return retVal;
}
throw new NextStatementNotAviableException();
return null;
}
}

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

@ -39,7 +39,7 @@ namespace DebuggerLibrary @@ -39,7 +39,7 @@ namespace DebuggerLibrary
return process;
}
}
throw new DebuggerException("Process not found");
throw new DebuggerException("Process is not in collection");
}
internal void AddProcess(Process process)

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

@ -52,7 +52,7 @@ namespace DebuggerLibrary @@ -52,7 +52,7 @@ namespace DebuggerLibrary
}
}
throw new UnableToGetPropertyException(this, "this[ICorDebugThread]", "Thread is not in collection");
throw new DebuggerException("Thread is not in collection");
}
internal void AddThread(Thread thread)

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs

@ -35,9 +35,9 @@ namespace DebuggerLibrary @@ -35,9 +35,9 @@ namespace DebuggerLibrary
public Thread CurrentThread {
get {
if (IsProcessRunning) throw new CurrentThreadNotAviableException();
if (IsProcessRunning) throw new DebuggerException("Process must not be running");
if (currentThread != null) return currentThread;
throw new CurrentThreadNotAviableException();
throw new DebuggerException("No current thread");
}
set {
currentThread = value;

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

@ -91,18 +91,16 @@ namespace DebuggerLibrary @@ -91,18 +91,16 @@ namespace DebuggerLibrary
}
}
public Variable RuntimeVariable {
get {
if (!HasBeenLoaded) throw new UnableToGetPropertyException(this, "runtimeVariable", "Thread has not started jet");
if (debugger.IsProcessRunning) throw new UnableToGetPropertyException(this, "runtimeVariable", "Process is running");
if (!HasBeenLoaded) throw new DebuggerException("Thread has not started jet");
if (debugger.IsProcessRunning) throw new DebuggerException("Process is running");
ICorDebugValue corValue;
corThread.GetObject(out corValue);
return VariableFactory.CreateVariable(debugger, corValue, "Thread" + ID);
}
}
public string Name {
get {
if (!HasBeenLoaded) return lastName;
@ -182,7 +180,7 @@ namespace DebuggerLibrary @@ -182,7 +180,7 @@ namespace DebuggerLibrary
public Function CurrentFunction {
get {
if (debugger.IsProcessRunning) throw new CurrentFunctionNotAviableException();
if (debugger.IsProcessRunning) throw new DebuggerException("Process must not be running");
return currentFunction;
}
set {

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectVariable.cs

@ -87,7 +87,7 @@ namespace DebuggerLibrary @@ -87,7 +87,7 @@ namespace DebuggerLibrary
public unsafe ObjectVariable BaseClass {
get {
if (baseClass == null) baseClass = GetBaseClass();
if (baseClass == null) throw new UnableToGetPropertyException(this, "BaseClass", "Object doesn't have a base class");
if (baseClass == null) throw new DebuggerException("Object doesn't have a base class. You may use HasBaseClass to check this.");
return baseClass;
}
}

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs

@ -54,7 +54,7 @@ namespace DebuggerLibrary @@ -54,7 +54,7 @@ namespace DebuggerLibrary
}
}
throw new UnableToGetPropertyException(this, "this[string]", "Variable \"" + variableName + "\" is not in collection");
throw new DebuggerException("Variable \"" + variableName + "\" is not in collection");
}
}

Loading…
Cancel
Save