void ResolvePendingCatchpoint(Catchpoint cp, TypeMirror type) { BreakInfo bi = GetBreakInfo(cp); InsertCatchpoint(cp, bi, type); SetBreakEventStatus(cp, true); }
void InsertBreakpoint(Breakpoint bp, BreakInfo bi) { bi.Req = vm.SetBreakpoint(bi.Location.Method, bi.Location.ILOffset); bi.Req.Enabled = bi.Enabled; breakpoints [bi.Req] = bi; OnBreakpointBound(bp, (BreakpointEventRequest)bi.Req); }
void InsertCatchpoint(Catchpoint cp, BreakInfo bi, TypeMirror excType) { var request = bi.Req = vm.CreateExceptionRequest(excType, true, true); request.Count = cp.HitCount; bi.Req.Enabled = bi.Enabled; }
void ResolvePendingBreakpoint(Breakpoint bp, Location l) { BreakInfo bi = GetBreakInfo(bp); if (bi != null) { bi.Location = l; InsertBreakpoint(bp, bi); SetBreakEventStatus(bp, true); } }
protected override void OnRemoveBreakEvent(object handle) { if (exited) { return; } BreakInfo bi = (BreakInfo)handle; if (bi.Req != null) { bi.Req.Enabled = false; RemoveQueuedEvents(bi.Req); } pending_bes.Remove(bi.BreakEvent); }
protected override void OnEnableBreakEvent(object handle, bool enable) { if (exited) { return; } BreakInfo bi = (BreakInfo)handle; bi.Enabled = enable; if (bi.Req != null) { bi.Req.Enabled = enable; if (!enable) { RemoveQueuedEvents(bi.Req); } } }
protected override object OnInsertBreakEvent(BreakEvent be, bool activate) { if (exited) { return(null); } BreakInfo bi = new BreakInfo(); bi.Enabled = activate; bi.BreakEvent = be; if (be is Breakpoint) { Breakpoint bp = (Breakpoint)be; bi.Location = FindLocation(bp.FileName, bp.Line); if (bi.Location != null) { InsertBreakpoint(bp, bi); } else { pending_bes.Add(bp); SetBreakEventStatus(be, false); } } else if (be is Catchpoint) { var cp = (Catchpoint)be; TypeMirror type; if (types.TryGetValue(cp.ExceptionName, out type)) { InsertCatchpoint(cp, bi, type); } else { pending_bes.Add(be); SetBreakEventStatus(be, false); } } return(bi); }
void InsertBreakpoint (Breakpoint bp, BreakInfo bi) { EventRequest request; request = vm.SetBreakpoint (bi.Location.Method, bi.Location.ILOffset); request.Enabled = bp.Enabled; bi.Requests.Add (request); breakpoints[request] = bi; if (bi.Location.LineNumber != bp.Line) bi.AdjustBreakpointLocation (bi.Location.LineNumber); }
protected override BreakEventInfo OnInsertBreakEvent (BreakEvent ev) { if (exited) return null; var bi = new BreakInfo (); if (ev is FunctionBreakpoint) { var fb = (FunctionBreakpoint) ev; bool generic; bi.Location = FindLocationByFunction (fb.FunctionName, fb.ParamTypes, fb.Line, out generic); if (bi.Location != null) { fb.SetResolvedFileName (bi.Location.SourceFile); bi.FileName = fb.FileName; InsertBreakpoint (fb, bi); bi.SetStatus (BreakEventStatus.Bound, null); // Note: if the type or method is generic, there may be more instances so don't assume we are done resolving the breakpoint if (generic) pending_bes.Add (bi); } else { int dot = fb.FunctionName.LastIndexOf ('.'); if (dot != -1) bi.TypeName = fb.FunctionName.Substring (0, dot); pending_bes.Add (bi); bi.SetStatus (BreakEventStatus.NotBound, null); } } else if (ev is Breakpoint) { var bp = (Breakpoint) ev; bool insideLoadedRange; bool generic; bi.Location = FindLocationByFile (bp.FileName, bp.Line, out generic, out insideLoadedRange); bi.FileName = bp.FileName; if (bi.Location != null) { InsertBreakpoint (bp, bi); bi.SetStatus (BreakEventStatus.Bound, null); // Note: if the type or method is generic, there may be more instances so don't assume we are done resolving the breakpoint if (generic) pending_bes.Add (bi); } else { pending_bes.Add (bi); if (insideLoadedRange) bi.SetStatus (BreakEventStatus.Invalid, null); else bi.SetStatus (BreakEventStatus.NotBound, null); } } else if (ev is Catchpoint) { var cp = (Catchpoint) ev; TypeMirror type; if (!types.TryGetValue (cp.ExceptionName, out type)) { // // Same as in FindLocationByFile (), fetch types matching the type name if (vm.Version.AtLeast (2, 9)) { foreach (TypeMirror t in vm.GetTypes (cp.ExceptionName, false)) ProcessType (t); } } if (types.TryGetValue (cp.ExceptionName, out type)) { InsertCatchpoint (cp, bi, type); bi.SetStatus (BreakEventStatus.Bound, null); } else { bi.TypeName = cp.ExceptionName; pending_bes.Add (bi); bi.SetStatus (BreakEventStatus.NotBound, null); } } /* * TypeLoad events lead to too much wire traffic + suspend/resume work, so * filter them using the file names used by pending breakpoints. */ if (vm.Version.AtLeast (2, 9)) { var sourceFileList = pending_bes.Where (b => b.FileName != null).Select (b => b.FileName).ToArray (); if (sourceFileList.Length > 0) { //HACK: explicitly try lowercased drivename on windows, since csc (when not hosted in VS) lowercases //the drivename in the pdb files that get converted to mdbs as-is //FIXME: we should really do a case-insensitive request on Win/Mac, when sdb supports that if (IsWindows) { int originalCount = sourceFileList.Length; Array.Resize (ref sourceFileList, originalCount * 2); for (int i = 0; i < originalCount; i++) { string n = sourceFileList[i]; sourceFileList[originalCount + i] = char.ToLower (n[0]) + n.Substring (1); } } if (typeLoadReq == null) { typeLoadReq = vm.CreateTypeLoadRequest (); } typeLoadReq.Enabled = false; typeLoadReq.SourceFileFilter = sourceFileList; typeLoadReq.Enabled = true; } var typeNameList = pending_bes.Where (b => b.TypeName != null).Select (b => b.TypeName).ToArray (); if (typeNameList.Length > 0) { // Use a separate request since the filters are ANDed together if (typeLoadTypeNameReq == null) { typeLoadTypeNameReq = vm.CreateTypeLoadRequest (); } typeLoadTypeNameReq.Enabled = false; typeLoadTypeNameReq.TypeNameFilter = typeNameList; typeLoadTypeNameReq.Enabled = true; } } return bi; }
void ResolvePendingCatchpoint (BreakInfo bi, TypeMirror type) { InsertCatchpoint ((Catchpoint) bi.BreakEvent, bi, type); bi.SetStatus (BreakEventStatus.Bound, null); }
void ResolvePendingBreakpoint (BreakInfo bi, Location l) { bi.Location = l; InsertBreakpoint ((Breakpoint) bi.BreakEvent, bi); bi.SetStatus (BreakEventStatus.Bound, null); }
void InsertBreakpoint (Breakpoint bp, BreakInfo bi) { bi.Req = vm.SetBreakpoint (bi.Location.Method, bi.Location.ILOffset); bi.Req.Enabled = bi.BreakEvent.Enabled; breakpoints [bi.Req] = bi; if (bi.Location.LineNumber != bp.Line) bi.AdjustBreakpointLocation (bi.Location.LineNumber); }
static bool BreakpointMatchesAssembly (EventRequest breakpointRequest, BreakInfo breakpointInfo, string location) { return (breakpointRequest.Enabled && ( string.IsNullOrEmpty (breakpointInfo.AssemblyLocation) || breakpointInfo.AssemblyLocation.Equals(location, StringComparison.OrdinalIgnoreCase) )); }
void InsertBreakpoint (Breakpoint bp, BreakInfo bi) { bi.Req = vm.SetBreakpoint (bi.Location.Method, bi.Location.ILOffset); bi.Req.Enabled = bi.Enabled; breakpoints [bi.Req] = bi; OnBreakpointBound (bp, (BreakpointEventRequest) bi.Req); }
protected override BreakEventInfo OnInsertBreakEvent (BreakEvent ev) { if (exited) return null; var bi = new BreakInfo (); if (ev is Breakpoint) { var bp = (Breakpoint) ev; bool inisideLoadedRange; bi.FileName = bp.FileName; bi.Location = FindLocation (bp.FileName, bp.Line, out inisideLoadedRange); if (bi.Location != null) { InsertBreakpoint (bp, bi); bi.SetStatus (BreakEventStatus.Bound, null); } else { pending_bes.Add (bi); if (inisideLoadedRange) bi.SetStatus (BreakEventStatus.Invalid, null); else bi.SetStatus (BreakEventStatus.NotBound, null); } } else if (ev is Catchpoint) { var cp = (Catchpoint) ev; TypeMirror type; if (!types.TryGetValue (cp.ExceptionName, out type)) { // // Same as in FindLocation (), fetch types matching the type name if (vm.Version.AtLeast (2, 9)) { foreach (TypeMirror t in vm.GetTypes (cp.ExceptionName, false)) ProcessType (t); } } if (types.TryGetValue (cp.ExceptionName, out type)) { InsertCatchpoint (cp, bi, type); bi.SetStatus (BreakEventStatus.Bound, null); } else { bi.ExceptionName = cp.ExceptionName; pending_bes.Add (bi); bi.SetStatus (BreakEventStatus.NotBound, null); } } /* * TypeLoad events lead to too much wire traffic + suspend/resume work, so * filter them using the file names used by pending breakpoints. */ if (vm.Version.AtLeast (2, 9)) { var sourceFileList = pending_bes.Where (b => b.FileName != null).Select (b => b.FileName).ToArray (); if (sourceFileList.Length > 0) { if (typeLoadReq == null) { typeLoadReq = vm.CreateTypeLoadRequest (); } typeLoadReq.Enabled = false; typeLoadReq.SourceFileFilter = sourceFileList; typeLoadReq.Enabled = true; } var typeNameList = pending_bes.Where (b => b.ExceptionName != null).Select (b => b.ExceptionName).ToArray (); if (typeNameList.Length > 0) { // Use a separate request since the filters are ANDed together if (typeLoadTypeNameReq == null) { typeLoadTypeNameReq = vm.CreateTypeLoadRequest (); } typeLoadTypeNameReq.Enabled = false; typeLoadTypeNameReq.TypeNameFilter = typeNameList; typeLoadTypeNameReq.Enabled = true; } } return bi; }
void InsertCatchpoint (Catchpoint cp, BreakInfo bi, TypeMirror excType) { EventRequest request; request = vm.CreateExceptionRequest (excType, true, true); request.Count = cp.HitCount; // Note: need to set HitCount *before* enabling request.Enabled = cp.Enabled; bi.Requests.Add (request); }
protected override object OnInsertBreakEvent (BreakEvent be, bool activate) { if (exited) return null; BreakInfo bi = new BreakInfo (); bi.Enabled = activate; bi.BreakEvent = be; if (be is Breakpoint) { Breakpoint bp = (Breakpoint) be; bi.Location = FindLocation (bp.FileName, bp.Line); if (bi.Location != null) InsertBreakpoint (bp, bi); else { pending_bes.Add (bp); SetBreakEventStatus (be, false, null); } } else if (be is Catchpoint) { var cp = (Catchpoint) be; TypeMirror type; if (types.TryGetValue (cp.ExceptionName, out type)) { InsertCatchpoint (cp, bi, type); } else { pending_bes.Add (be); SetBreakEventStatus (be, false, null); } } return bi; }
protected override BreakEventInfo OnInsertBreakEvent (BreakEvent ev) { if (exited) return null; BreakInfo bi = new BreakInfo (); if (ev is Breakpoint) { Breakpoint bp = (Breakpoint) ev; bool inisideLoadedRange; bi.Location = FindLocation (bp.FileName, bp.Line, out inisideLoadedRange); if (bi.Location != null) { InsertBreakpoint (bp, bi); bi.SetStatus (BreakEventStatus.Bound, null); } else { pending_bes.Add (bi); if (inisideLoadedRange) bi.SetStatus (BreakEventStatus.Invalid, null); else bi.SetStatus (BreakEventStatus.NotBound, null); } } else if (ev is Catchpoint) { var cp = (Catchpoint) ev; TypeMirror type; if (types.TryGetValue (cp.ExceptionName, out type)) { InsertCatchpoint (cp, bi, type); bi.SetStatus (BreakEventStatus.Bound, null); } else { pending_bes.Add (bi); bi.SetStatus (BreakEventStatus.NotBound, null); } } return bi; }
void InsertCatchpoint (Catchpoint cp, BreakInfo bi, TypeMirror excType) { var request = bi.Req = vm.CreateExceptionRequest (excType, true, true); request.Count = cp.HitCount; bi.Req.Enabled = bi.Enabled; }
void InsertBreakpoint (Breakpoint bp, BreakInfo bi) { bi.Req = vm.SetBreakpoint (bi.Location.Method, bi.Location.ILOffset); bi.Req.Enabled = bi.Enabled; breakpoints [bi.Req] = bi; }