Browse Source

fix COMException when no entry point was found.

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

35
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(); try {
if (entryPoint == 0) return; // no EP // create a BP at entry point
var mainFunction = e.Item.CorModule.GetFunctionFromToken(entryPoint); uint entryPoint = e.Item.SymReader.GetUserEntryPoint();
var corBreakpoint = mainFunction.CreateBreakpoint(); if (entryPoint == 0) return; // no EP
corBreakpoint.Activate(1); var mainFunction = e.Item.CorModule.GetFunctionFromToken(entryPoint);
var corBreakpoint = mainFunction.CreateBreakpoint();
// create a SD BP corBreakpoint.Activate(1);
var breakpoint = new Breakpoint(this.debugger, corBreakpoint);
this.debugger.Breakpoints.Add(breakpoint); // create a SD BP
breakpoint.Hit += delegate { var breakpoint = new Breakpoint(this.debugger, corBreakpoint);
if (breakpoint != null) this.debugger.Breakpoints.Add(breakpoint);
breakpoint.Remove(); breakpoint.Hit += delegate {
breakpoint = null; 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