From 7139a80c40690c5187a6ebe01aae15bf26c8b205 Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Tue, 29 Dec 2009 23:13:29 +0000 Subject: [PATCH] Debugger now supports debugging IronRuby applications. Modules pad now displays the module name instead of the module filename for dynamic modules. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@5355 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/Pads/LoadedModulesPad.cs | 11 ++++++++++- .../Project/Src/Service/WindowsDebugger.cs | 12 +++++++++++- .../Debugger.Core/Project/Src/Control/Process.cs | 10 +++++++++- .../Project/Src/Debugger/SourcecodeSegment.cs | 10 ++++++++++ 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LoadedModulesPad.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LoadedModulesPad.cs index 3155472bb8..1af4e09cad 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LoadedModulesPad.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LoadedModulesPad.cs @@ -150,7 +150,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads item.SubItems.Clear(); item.SubItems.AddRange( new string[] { - module.Filename, + GetModuleFileNameOrName(module), String.Format("{0:X8}", module.BaseAdress), module.DirectoryName, module.OrderOfLoading.ToString(), @@ -162,6 +162,15 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads ); item.SubItems.RemoveAt(0); } + + string GetModuleFileNameOrName(Module module) + { + string fileName = module.Filename; + if (String.IsNullOrEmpty(fileName)) { + return module.CorModule.Name; + } + return module.Filename; + } void RemoveModule(Module module) { diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs index 6217a29867..3ecf804439 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs @@ -722,11 +722,21 @@ namespace ICSharpCode.SharpDevelop.Services if (debuggedProcess != null) { SourcecodeSegment nextStatement = debuggedProcess.NextStatement; if (nextStatement != null) { - DebuggerService.JumpToCurrentLine(nextStatement.Filename, nextStatement.StartLine, nextStatement.StartColumn, nextStatement.EndLine, nextStatement.EndColumn); + string fileName = GetFileName(nextStatement); + DebuggerService.JumpToCurrentLine(fileName, nextStatement.StartLine, nextStatement.StartColumn, nextStatement.EndLine, nextStatement.EndColumn); } } } + string GetFileName(SourcecodeSegment segment) + { + string fileName = debuggedProcess.NextStatement.Filename; + if (!Path.IsPathRooted(fileName)) { + fileName = Path.Combine(debuggedProcess.WorkingDirectory, fileName); + } + return fileName; + } + StopAttachedProcessDialogResult ShowStopAttachedProcessDialog() { string caption = StringParser.Parse("${res:XML.MainMenu.DebugMenu.Stop}"); diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process.cs index 2552f3014e..57958c1a02 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process.cs @@ -18,6 +18,8 @@ namespace Debugger ICorDebugProcess corProcess; ManagedCallback callbackInterface; + string workingDirectory = String.Empty; + #region IExpirable bool hasExited = false; @@ -59,6 +61,10 @@ namespace Debugger } } + public string WorkingDirectory { + get { return workingDirectory; } + } + internal ManagedCallback CallbackInterface { get { return callbackInterface; @@ -111,7 +117,9 @@ namespace Debugger CorDebugCreateProcessFlags.DEBUG_NO_SPECIAL_OPTIONS // debuggingFlags ); - return new Process(debugger, outProcess); + Process process = new Process(debugger, outProcess); + process.workingDirectory = workingDirectory; + return process; } public string DebuggeeVersion { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/SourcecodeSegment.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/SourcecodeSegment.cs index 40040f2e64..e3c4c7a8cd 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/SourcecodeSegment.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/SourcecodeSegment.cs @@ -91,6 +91,16 @@ namespace Debugger foreach(ISymUnmanagedDocument symDoc in symDocs) { if (symDoc.URL.ToLower() == filename) return symDoc; } + if (module.IsDynamic) { + foreach(ISymUnmanagedDocument symDoc in symDocs) { + string url = symDoc.URL.ToLower(); + if (!String.IsNullOrEmpty(url) && !Path.IsPathRooted(url)) { + string workingDir = Path.GetFullPath(module.Process.WorkingDirectory).ToLower(); + url = Path.GetFullPath(Path.Combine(workingDir, url)); + } + if (url == filename) return symDoc; + } + } return null; // Not found }