diff options
author | Lluis Sanchez <lluis@novell.com> | 2009-05-04 16:07:14 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@novell.com> | 2009-05-04 16:07:14 +0400 |
commit | f8b6585f3aa9c61a587bd4548b49a0303cea6dd9 (patch) | |
tree | 09a06cf843bc84801e172e97955e46aeb7e0c224 /extras/MonoDevelop.Debugger.Mdb | |
parent | b735f737cf75247d40bfbbd5fb7268c3847a7f5b (diff) |
* Mono.Debugging.Backend.Mdb/MonoDebuggerStartInfo.cs:
* Mono.Debugging.Backend.Mdb.AspNet/MonoXspDebuggerSessionFactory.cs:
Register user modules.
* Mono.Debugging.Server.Mdb/DebuggerServer.cs:
* Mono.Debugging.Backend.Mdb/IDebuggerServer.cs:
* Mono.Debugging.Server.Mdb/MdbAdaptorFactory.cs:
* Mono.Debugging.Backend.Mdb/MonoDebuggerSession.cs: Try to detect the
mdb version only once per session.
* Mono.Debugging.Server.Mdb/MdbAdaptor.cs:
* Mono.Debugging.Server.Mdb/MdbAdaptor-2-6.cs: Properly set user
modules when initializing.
* Mono.Debugging.Backend.Mdb/MonoDebuggerSessionFactory.cs: Use the
default runtime if none is specified.
svn path=/trunk/monodevelop/; revision=133492
Diffstat (limited to 'extras/MonoDevelop.Debugger.Mdb')
12 files changed, 78 insertions, 12 deletions
diff --git a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb.AspNet/ChangeLog b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb.AspNet/ChangeLog index 4a72bb80d9..00714cf264 100644 --- a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb.AspNet/ChangeLog +++ b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb.AspNet/ChangeLog @@ -1,3 +1,7 @@ +2009-05-04 Lluis Sanchez Gual <lluis@novell.com> + + * MonoXspDebuggerSessionFactory.cs: Register user modules. + 2009-04-27 Lluis Sanchez Gual <lluis@novell.com> * Makefile: diff --git a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb.AspNet/MonoXspDebuggerSessionFactory.cs b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb.AspNet/MonoXspDebuggerSessionFactory.cs index 6859bf778e..72c0689ff0 100644 --- a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb.AspNet/MonoXspDebuggerSessionFactory.cs +++ b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb.AspNet/MonoXspDebuggerSessionFactory.cs @@ -67,6 +67,13 @@ namespace MonoDevelop.Debugger.Mdb startInfo.WorkingDirectory = cmd.BaseDirectory; startInfo.Arguments = cmd.XspParameters.GetXspParameters ().Trim (); + string binDir = Path.Combine (cmd.BaseDirectory, "bin"); + startInfo.UserModules = new List<string> (); + foreach (string file in Directory.GetFiles (binDir)) { + if (file.EndsWith (".dll") || file.EndsWith (".exe")) + startInfo.UserModules.Add (file); + } + return startInfo; } diff --git a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/ChangeLog b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/ChangeLog index 9edb1220d6..dd64c739ba 100644 --- a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/ChangeLog +++ b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/ChangeLog @@ -1,3 +1,14 @@ +2009-05-04 Lluis Sanchez Gual <lluis@novell.com> + + * IDebuggerServer.cs: + * MonoDebuggerSession.cs: Try to detect the mdb version only + once per session. + + * MonoDebuggerStartInfo.cs: Register user modules. + + * MonoDebuggerSessionFactory.cs: Use the default runtime if + none is specified. + 2009-04-27 Lluis Sanchez Gual <lluis@novell.com> * Makefile: diff --git a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/IDebuggerServer.cs b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/IDebuggerServer.cs index f9af8b3343..d2e3109179 100644 --- a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/IDebuggerServer.cs +++ b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/IDebuggerServer.cs @@ -32,7 +32,7 @@ namespace Mono.Debugging.Backend.Mdb { public interface IDebuggerServer { - void Run (MonoDebuggerStartInfo startInfo); + void Run (MonoDebuggerStartInfo startInfo, bool detectMdbVersion); void Stop (); diff --git a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/MonoDebuggerSession.cs b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/MonoDebuggerSession.cs index a9b0b0bf75..d116c7b3b7 100644 --- a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/MonoDebuggerSession.cs +++ b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/MonoDebuggerSession.cs @@ -38,6 +38,7 @@ namespace Mono.Debugging.Backend.Mdb { DebuggerController controller; bool started; + static bool detectMdbVersion = true; public void StartDebugger () { @@ -56,7 +57,10 @@ namespace Mono.Debugging.Backend.Mdb started = true; MonoDebuggerStartInfo info = (MonoDebuggerStartInfo) startInfo; controller.StartDebugger (info); - controller.DebuggerServer.Run (info); + controller.DebuggerServer.Run (info, detectMdbVersion); + + // Try to detect mdb version only once per session + detectMdbVersion = false; } protected override void OnAttachToProcess (int processId) diff --git a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/MonoDebuggerSessionFactory.cs b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/MonoDebuggerSessionFactory.cs index b4d2e63598..d2041467aa 100644 --- a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/MonoDebuggerSessionFactory.cs +++ b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/MonoDebuggerSessionFactory.cs @@ -102,11 +102,13 @@ namespace MonoDevelop.Debugger.Mdb public static bool DebuggingSupported (TargetRuntime tr) { + if (tr == null) tr = MonoDevelop.Core.Runtime.SystemAssemblyService.DefaultRuntime; return (tr is MonoTargetRuntime) && tr.GetPackage ("mono-debugger") != null; } public static MonoDebuggerStartInfo CreateDebuggerStartInfo (TargetRuntime tr) { + if (tr == null) tr = MonoDevelop.Core.Runtime.SystemAssemblyService.DefaultRuntime; MonoDebuggerStartInfo startInfo = new MonoDebuggerStartInfo (); MonoTargetRuntime mtr = (MonoTargetRuntime) tr; startInfo.ServerEnvironment = mtr.GetToolsEnvironmentVariables (); diff --git a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/MonoDebuggerStartInfo.cs b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/MonoDebuggerStartInfo.cs index b30388c7be..31f6c639e7 100644 --- a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/MonoDebuggerStartInfo.cs +++ b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Backend.Mdb/MonoDebuggerStartInfo.cs @@ -36,5 +36,6 @@ namespace Mono.Debugging.Backend.Mdb public bool IsXsp { get; set; } public string MonoPrefix { get; set; } public IDictionary<string,string> ServerEnvironment { get; set; } + public List<string> UserModules { get; set; } } } diff --git a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/ChangeLog b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/ChangeLog index 10ef0b810e..405fa662e2 100644 --- a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/ChangeLog +++ b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/ChangeLog @@ -1,3 +1,13 @@ +2009-05-04 Lluis Sanchez Gual <lluis@novell.com> + + * DebuggerServer.cs: + * MdbAdaptorFactory.cs: Try to detect the mdb version only + once per session. + + * MdbAdaptor.cs: + * MdbAdaptor-2-6.cs: Properly set user modules when + initializing. + 2009-04-27 Lluis Sanchez Gual <lluis@novell.com> * DebuggerServer.cs: Fix api change issue. diff --git a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/DebuggerServer.cs b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/DebuggerServer.cs index 43c7817915..bdfe59d960 100644 --- a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/DebuggerServer.cs +++ b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/DebuggerServer.cs @@ -57,9 +57,6 @@ namespace DebuggerServer ILease lease = mbr.GetLifetimeService() as ILease; lease.Register(this); max_frames = 100; - - mdbAdaptor = MdbAdaptorFactory.CreateAdaptor (); - Console.WriteLine ("MDB version: " + mdbAdaptor.MdbVersion); ST.Thread t = new ST.Thread ((ST.ThreadStart)EventDispatcher); t.IsBackground = true; @@ -86,11 +83,14 @@ namespace DebuggerServer #region IDebugger Members - public void Run (MonoDebuggerStartInfo startInfo) + public void Run (MonoDebuggerStartInfo startInfo, bool detectMdbVersion) { try { if (startInfo == null) throw new ArgumentNullException ("startInfo"); + + mdbAdaptor = MdbAdaptorFactory.CreateAdaptor (detectMdbVersion); + Console.WriteLine ("MDB version: " + mdbAdaptor.MdbVersion); Report.Initialize (); @@ -106,8 +106,11 @@ namespace DebuggerServer NotifyStarted (); }; - if (startInfo.IsXsp) + if (startInfo.IsXsp) { mdbAdaptor.SetupXsp (config); + config.FollowFork = false; + } + config.OpaqueFileNames = false; DebuggerOptions options = DebuggerOptions.ParseCommandLine (new string[] { startInfo.Command } ); options.WorkingDirectory = startInfo.WorkingDirectory; @@ -122,6 +125,7 @@ namespace DebuggerServer options.SetEnvironment (env.Key, env.Value); } session = new MD.DebuggerSession (config, options, "main", null); + mdbAdaptor.InitializeSession (startInfo, session); debugger.Run(session); @@ -246,7 +250,10 @@ namespace DebuggerServer if (bp != null) { MD.SourceLocation location = new MD.SourceLocation (bp.FileName, bp.Line); - ev = session.InsertBreakpoint (ThreadGroup.Global, location); + MD.SourceBreakpoint sbp = new MD.SourceBreakpoint (session, ThreadGroup.Global, location); + sbp.IsUserModule = true; + session.AddEvent (sbp); + ev = sbp; } else if (be is Catchpoint) { Catchpoint cp = (Catchpoint) be; diff --git a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/MdbAdaptor-2-6.cs b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/MdbAdaptor-2-6.cs index 3fa8a74a59..4595bf9001 100644 --- a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/MdbAdaptor-2-6.cs +++ b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/MdbAdaptor-2-6.cs @@ -9,6 +9,8 @@ this way because features implemented here depend on the installed MDB version. using System; using Mono.Debugger; +using MDB=Mono.Debugger; +using Mono.Debugging.Backend.Mdb; namespace DebuggerServer { @@ -17,7 +19,16 @@ namespace DebuggerServer public override void SetupXsp (DebuggerConfiguration config) { config.SetupXSP (); - Console.WriteLine ("XSP configured"); + config.StopOnManagedSignals = true; + } + + public override void InitializeSession (MonoDebuggerStartInfo startInfo, MDB.DebuggerSession session) + { + session.AddUserModulePath (startInfo.WorkingDirectory); + if (startInfo.UserModules != null) { + foreach (string path in startInfo.UserModules) + session.AddUserModule (path); + } } } } diff --git a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/MdbAdaptor.cs b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/MdbAdaptor.cs index 89b030abfe..fb4c572b3b 100644 --- a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/MdbAdaptor.cs +++ b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/MdbAdaptor.cs @@ -26,6 +26,7 @@ using System; using MDB=Mono.Debugger; +using Mono.Debugging.Backend.Mdb; namespace DebuggerServer { @@ -43,6 +44,10 @@ namespace DebuggerServer ThrowNotSupported ("ASP.NET debugging not supported"); } + public virtual void InitializeSession (MonoDebuggerStartInfo startInfo, MDB.DebuggerSession session) + { + } + public void ThrowNotSupported (string feature) { throw new InvalidOperationException (feature + ". You need to install a more recent Mono Debugger version."); diff --git a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/MdbAdaptorFactory.cs b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/MdbAdaptorFactory.cs index 917fdb72ab..b029bfc4ec 100644 --- a/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/MdbAdaptorFactory.cs +++ b/extras/MonoDevelop.Debugger.Mdb/Mono.Debugging.Server.Mdb/MdbAdaptorFactory.cs @@ -38,20 +38,20 @@ namespace DebuggerServer static readonly string[] supportedVersions = new string[] {"2-6"}; - public static MdbAdaptor CreateAdaptor () + public static MdbAdaptor CreateAdaptor (bool detectMdbVersion) { ProcessStartInfo pinfo = new ProcessStartInfo (); pinfo.FileName = "gmcs"; foreach (string v in supportedVersions) { - MdbAdaptor mdb = TryCreateAdaptor (pinfo, v); + MdbAdaptor mdb = TryCreateAdaptor (pinfo, v, detectMdbVersion); if (mdb != null) return mdb; } return new MdbAdaptor (); } - static MdbAdaptor TryCreateAdaptor (ProcessStartInfo pinfo, string version) + static MdbAdaptor TryCreateAdaptor (ProcessStartInfo pinfo, string version, bool detectMdbVersion) { string tmpPath = Path.GetTempPath (); tmpPath = Path.Combine (tmpPath, "monodevelop-debugger-mdb"); @@ -62,6 +62,8 @@ namespace DebuggerServer DateTime thisTime = File.GetLastWriteTime (typeof(MdbAdaptorFactory).Assembly.Location); if (!File.Exists (outFile) || File.GetLastWriteTime (outFile) < thisTime) { + if (!detectMdbVersion) + return null; Stream s = typeof(MdbAdaptorFactory).Assembly.GetManifestResourceStream ("MdbAdaptor-" + version + ".cs"); StreamReader sr = new StreamReader (s); string txt = sr.ReadToEnd (); @@ -75,6 +77,8 @@ namespace DebuggerServer args += "\"/out:" + outFile + "\" "; args += "\"/r:" + typeof(MdbAdaptorFactory).Assembly.Location + "\" "; args += "\"/r:" + typeof(Mono.Debugger.Debugger).Assembly.Location + "\" "; + args += "\"/r:" + typeof(Mono.Debugging.Client.DebuggerSession).Assembly.Location + "\" "; + args += "\"/r:" + typeof(Mono.Debugging.Backend.Mdb.IDebuggerServer).Assembly.Location + "\" "; args += "\"" + csfile + "\""; pinfo.Arguments = args; |