Browse Source

fix COMException when no entry point was found.

pull/15/head
Eusebiu Marcu 15 years ago
parent
commit
1c22e596a1
  1. 33
      src/AddIns/Debugger/Debugger.Core/Process.cs

33
src/AddIns/Debugger/Debugger.Core/Process.cs

@ -639,21 +639,26 @@ namespace Debugger
{ {
if (BreakAtBeginning) { if (BreakAtBeginning) {
if (e.Item.SymReader == null) return; // No symbols if (e.Item.SymReader == null) return; // No symbols
// create a BP at entry point
uint entryPoint = e.Item.SymReader.GetUserEntryPoint();
if (entryPoint == 0) return; // no EP
var mainFunction = e.Item.CorModule.GetFunctionFromToken(entryPoint);
var corBreakpoint = mainFunction.CreateBreakpoint();
corBreakpoint.Activate(1);
// create a SD BP try {
var breakpoint = new Breakpoint(this.debugger, corBreakpoint); // create a BP at entry point
this.debugger.Breakpoints.Add(breakpoint); uint entryPoint = e.Item.SymReader.GetUserEntryPoint();
breakpoint.Hit += delegate { if (entryPoint == 0) return; // no EP
if (breakpoint != null) var mainFunction = e.Item.CorModule.GetFunctionFromToken(entryPoint);
breakpoint.Remove(); var corBreakpoint = mainFunction.CreateBreakpoint();
breakpoint = null; corBreakpoint.Activate(1);
};
// create a SD BP
var breakpoint = new Breakpoint(this.debugger, corBreakpoint);
this.debugger.Breakpoints.Add(breakpoint);
breakpoint.Hit += delegate {
if (breakpoint != null)
breakpoint.Remove();
breakpoint = null;
};
} catch {
// the app does not have an entry point - COM exception
}
BreakAtBeginning = false; BreakAtBeginning = false;
} }
} }

Loading…
Cancel
Save