public override string Resolve(DebuggerSession session, SourceLocation location, string exp) { return(exp); }
static void Cleanup() { DebuggerSession currentSession; StatusBarIcon currentIcon; OperationConsole currentConsole; lock (cleanup_lock) { if (!IsDebugging) { return; } currentIcon = busyStatusIcon; currentSession = session; currentConsole = console; nextStatementLocations.Clear(); currentBacktrace = null; busyStatusIcon = null; session = null; console = null; pinnedWatches.InvalidateAll(); } UnsetDebugLayout(); currentSession.BusyStateChanged -= OnBusyStateChanged; currentSession.TargetEvent -= OnTargetEvent; currentSession.TargetStarted -= OnStarted; currentSession.BreakpointTraceHandler = null; currentSession.GetExpressionEvaluator = null; currentSession.TypeResolverHandler = null; currentSession.OutputWriter = null; currentSession.LogWriter = null; currentDebugOperation.Cleanup(); if (currentConsole != null) { cancelRegistration.Dispose(); currentConsole.Dispose(); } Runtime.RunInMainThread(delegate { HideExceptionCaughtDialog(); if (currentIcon != null) { currentIcon.Dispose(); currentIcon = null; } if (StoppedEvent != null) { StoppedEvent(null, new EventArgs()); } NotifyCallStackChanged(); NotifyCurrentFrameChanged(); NotifyLocationChanged(); }); currentSession.Dispose(); }
public abstract string Resolve(DebuggerSession session, SourceLocation location, string exp);
public override string Resolve(DebuggerSession session, SourceLocation location, string exp) { return(Resolve(session, location, exp, false)); }
static void Cleanup() { if (oldLayout != null) { string layout = oldLayout; oldLayout = null; // Dispatch asynchronously to avoid start/stop races DispatchService.GuiSyncDispatch(delegate { if (IdeApp.Workbench.CurrentLayout == "Debug") { IdeApp.Workbench.CurrentLayout = layout; } }); } currentBacktrace = null; if (!IsDebugging) { return; } if (exceptionDialog != null) { exceptionDialog.Destroy(); exceptionDialog = null; } if (busyStatusIcon != null) { busyStatusIcon.Dispose(); busyStatusIcon = null; } session.TargetEvent -= OnTargetEvent; session.TargetStarted -= OnStarted; session.OutputWriter = null; session.LogWriter = null; session.BusyStateChanged -= OnBusyStateChanged; session.TypeResolverHandler = null; session.BreakpointTraceHandler = null; session.GetExpressionEvaluator = null; console.CancelRequested -= OnCancelRequested; // Dispose the session at the end, since it may take a while. DebuggerSession oldSession = session; session = null; DispatchService.GuiDispatch(delegate { if (StoppedEvent != null) { StoppedEvent(null, new EventArgs()); } }); if (console != null) { console.Dispose(); console = null; } DispatchService.GuiDispatch(delegate { NotifyCallStackChanged(); NotifyCurrentFrameChanged(); NotifyLocationChanged(); }); if (oldSession != null) { oldSession.BusyStateChanged -= OnBusyStateChanged; oldSession.Dispose(); } }
public NRefactoryExpressionResolverVisitor(DebuggerSession session, SourceLocation location, string expression) { this.expression = expression.Replace("\n", "").Replace("\r", ""); this.session = session; this.location = location; }
public override void Setup() { base.Setup(); ds = Start("TestEvaluation"); frame = ds.ActiveThread.Backtrace.GetFrame(0); }
public DwarfSourceFile(DebuggerSession session, Module module, string filename) : base(session, module, filename) { }
public override void Dispose() { base.Dispose(); DebuggingService.StoppedEvent -= OnStop; session = null; }
internal SymbolTableManager(DebuggerSession session) { this.symbol_files = ArrayList.Synchronized(new ArrayList()); }
protected abstract void OnDebugProject(DebuggerSession session);
protected override void OnDispose() { base.OnDispose(); DebuggingService.StoppedEvent -= OnStop; session = null; }
static void Cleanup() { DebuggerSession currentSession; StatusBarIcon currentIcon; IConsole currentConsole; lock (cleanup_lock) { if (!IsDebugging) { return; } currentIcon = busyStatusIcon; currentSession = session; currentConsole = console; currentBacktrace = null; busyStatusIcon = null; session = null; console = null; } if (oldLayout != null) { string layout = oldLayout; oldLayout = null; // Dispatch synchronously to avoid start/stop races DispatchService.GuiSyncDispatch(delegate { IdeApp.Workbench.HideCommandBar("Debug"); if (IdeApp.Workbench.CurrentLayout == "Debug") { IdeApp.Workbench.CurrentLayout = layout; } }); } currentSession.BusyStateChanged -= OnBusyStateChanged; currentSession.TargetEvent -= OnTargetEvent; currentSession.TargetStarted -= OnStarted; currentSession.BreakpointTraceHandler = null; currentSession.GetExpressionEvaluator = null; currentSession.TypeResolverHandler = null; currentSession.OutputWriter = null; currentSession.LogWriter = null; if (currentConsole != null) { currentConsole.CancelRequested -= OnCancelRequested; currentConsole.Dispose(); } DispatchService.GuiDispatch(delegate { HideExceptionCaughtDialog(); if (currentIcon != null) { currentIcon.Dispose(); currentIcon = null; } if (StoppedEvent != null) { StoppedEvent(null, new EventArgs()); } NotifyCallStackChanged(); NotifyCurrentFrameChanged(); NotifyLocationChanged(); }); currentSession.Dispose(); }
protected DebuggerSession Start(string test) { TargetRuntime runtime; switch (EngineId) { case "MonoDevelop.Debugger.Win32": runtime = Runtime.SystemAssemblyService.GetTargetRuntime("MS.NET"); break; case "Mono.Debugger.Soft": runtime = Runtime.SystemAssemblyService.GetTargetRuntime("Mono"); break; default: runtime = Runtime.SystemAssemblyService.DefaultRuntime; break; } if (runtime == null) { return(null); } var cmd = new DotNetExecutionCommand(); cmd.Command = Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), "MonoDevelop.Debugger.Tests.TestApp.exe"); cmd.Arguments = test; cmd.TargetRuntime = runtime; DebuggerStartInfo si = engine.CreateDebuggerStartInfo(cmd); DebuggerSession session = engine.CreateSession(); var ops = new DebuggerSessionOptions(); ops.EvaluationOptions = EvaluationOptions.DefaultOptions; ops.EvaluationOptions.EvaluationTimeout = 100000; FilePath path = Util.TestsRootDir; path = path.ParentDirectory.Combine("src", "addins", "MonoDevelop.Debugger", "MonoDevelop.Debugger.Tests.TestApp", "Main.cs").FullPath; TextFile file = TextFile.ReadFile(path); int i = file.Text.IndexOf("void " + test, StringComparison.Ordinal); if (i == -1) { throw new Exception("Test not found: " + test); } i = file.Text.IndexOf("/*break*/", i, StringComparison.Ordinal); if (i == -1) { throw new Exception("Break marker not found: " + test); } int line, col; file.GetLineColumnFromPosition(i, out line, out col); Breakpoint bp = session.Breakpoints.Add(path, line); bp.Enabled = true; var done = new ManualResetEvent(false); session.OutputWriter = (isStderr, text) => Console.WriteLine("PROC:" + text); session.TargetHitBreakpoint += delegate { done.Set(); }; session.Run(si, ops); if (!done.WaitOne(3000)) { throw new Exception("Timeout while waiting for initial breakpoint"); } return(session); }
public void Setup() { ds = Start("TestEvaluation"); frame = ds.ActiveThread.Backtrace.GetFrame(0); }
internal SymbolTableManager(DebuggerSession session) { this.symbol_files = ArrayList.Synchronized (new ArrayList ()); }
static void Main(string[] args) { Console.Write("Enter full game path of game 'Geometry Dash': "); gdPath = Console.ReadLine(); if (!System.IO.File.Exists($"{gdPath}\\GeometryDash.exe")) { Utils.WriteLog("File 'GeometryDash.exe' does not exist!", ConsoleColor.DarkRed); Utils.PrintExit(-1); } if (System.IO.File.Exists($"{Environment.CurrentDirectory}\\GDLoader.dll")) { if (System.IO.File.Exists($"{gdPath}\\GDLoader.dll")) { System.IO.File.Delete($"{gdPath}\\GDLoader.dll"); } System.IO.File.Copy($"{Environment.CurrentDirectory}\\GDLoader.dll", $"{gdPath}\\GDLoader.dll"); } if (System.IO.Directory.Exists($"{Environment.CurrentDirectory}\\Mods")) { if (!System.IO.Directory.Exists($"{gdPath}\\Mods")) { System.IO.Directory.CreateDirectory($"{gdPath}\\Mods"); if (System.IO.File.Exists($"{Environment.CurrentDirectory}\\Mods\\ExampleAddon.dll")) { System.IO.File.Copy($"{Environment.CurrentDirectory}\\Mods\\ExampleAddon.dll", $"{gdPath}\\Mods\\ExampleAddon.dll"); } } } System.IO.File.Copy($"{gdPath}\\GeometryDash.exe", $"{gdPath}\\GeometryDash.bak", true); var peFile = new PeFile($"{gdPath}\\GeometryDash.exe"); var GDLoaderFile = new PeFile($"{gdPath}\\GDLoader.dll"); preInitOffset = GDLoaderFile.ExportedFunctions.ToList().Find(x => x.Name == "?pre_init@@YAXXZ").Address; Utils.WriteLog($"pre_init func Offset: 0x{preInitOffset:x}", ConsoleColor.Yellow); if (peFile.ImageNtHeaders != null) { peFile.ImageNtHeaders.OptionalHeader.DllCharacteristics = DllCharacteristicsType.NxCompat | DllCharacteristicsType.TerminalServerAware; } else { Utils.WriteLog("IMAGE_NT_HEADERS is null!", ConsoleColor.DarkRed); Utils.PrintExit(-1); } peFile.AddSection(".loader", 32, ScnCharacteristicsType.MemExecute | ScnCharacteristicsType.MemRead | ScnCharacteristicsType.MemWrite); loaderHdr = peFile.ImageSectionHeaders.ToList().Find(x => x.Name == ".loader"); textHdr = peFile.ImageSectionHeaders.ToList().Find(x => x.Name == ".text"); peFile.AddImport("GDLoader.dll", "?pre_init@@YAXXZ"); System.IO.File.WriteAllBytes($"{gdPath}\\GeometryDash_stage1patch.exe", peFile.RawFile.ToArray()); DebuggerSession debugSession = new DebuggerSession(); debugSession.ProcessStarted += DebugSessionOnProcessStarted; debugSession.LibraryLoaded += DebugSessionOnLibraryLoaded; debugSession.ExceptionOccurred += DebugSessionOnExceptionOccurred; debugSession.ProcessTerminated += DebugSessionOnProcessTerminated; Utils.WriteLog($"Starting debugger on file: '{gdPath}\\GeometryDash_stage1patch.exe'", ConsoleColor.DarkGray); var dbgSession = debugSession.StartProcess(new DebuggerProcessStartInfo { CommandLine = $"{gdPath}\\GeometryDash_stage1patch.exe" }); while (debugSession.IsActive) { if (foundLibrary) { dbgSession.Terminate(); dbgSession.Dispose(); break; } } debugSession.Dispose(); if (foundLibrary) { onPostDebugSuccess(); } else { Utils.WriteLog("Library not found. Exiting...", ConsoleColor.Red); Utils.PrintExit(-1); } }