Gentoo Archives: gentoo-commits

From: "Peter Alfredsen (loki_val)" <loki_val@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-util/monodevelop-debugger-mdb/files: monodevelop-debugger-mdb-2.0-mono-2.4.2.patch
Date: Thu, 18 Jun 2009 17:25:09
Message-Id: E1MHLMJ-0006er-IK@stork.gentoo.org
1 loki_val 09/06/18 17:25:07
2
3 Added: monodevelop-debugger-mdb-2.0-mono-2.4.2.patch
4 Log:
5 Fix compilation with mono-debugger-2.4.2, bug 273488.
6 (Portage version: 2.2_rc33/cvs/Linux x86_64)
7
8 Revision Changes Path
9 1.1 dev-util/monodevelop-debugger-mdb/files/monodevelop-debugger-mdb-2.0-mono-2.4.2.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-util/monodevelop-debugger-mdb/files/monodevelop-debugger-mdb-2.0-mono-2.4.2.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-util/monodevelop-debugger-mdb/files/monodevelop-debugger-mdb-2.0-mono-2.4.2.patch?rev=1.1&content-type=text/plain
13
14 Index: monodevelop-debugger-mdb-2.0-mono-2.4.2.patch
15 ===================================================================
16 Index: Mono.Debugging.Server.Mdb/DebuggerServer.cs
17 ===================================================================
18 --- Mono.Debugging.Server.Mdb/DebuggerServer.cs (revision 136420)
19 +++ Mono.Debugging.Server.Mdb/DebuggerServer.cs (revision 136421)
20 @@ -39,6 +39,7 @@
21 Dictionary<int, ST.WaitCallback> breakUpdates = new Dictionary<int,ST.WaitCallback> ();
22 bool breakUpdateEventsQueued;
23
24 + MdbAdaptor mdbAdaptor;
25 AsyncEvaluationTracker asyncEvaluationTracker;
26 RuntimeInvokeManager invokeManager;
27
28 @@ -51,6 +52,7 @@
29 public DebuggerServer (IDebuggerController dc)
30 {
31 this.controller = dc;
32 +
33 MarshalByRefObject mbr = (MarshalByRefObject)controller;
34 ILease lease = mbr.GetLifetimeService() as ILease;
35 lease.Register(this);
36 @@ -79,8 +81,18 @@
37 }
38 }
39
40 + public MdbAdaptor MdbAdaptor {
41 + get { return mdbAdaptor; }
42 + }
43 +
44 #region IDebugger Members
45
46 + public string InitializeMdb (string mdbVersion)
47 + {
48 + mdbAdaptor = MdbAdaptorFactory.CreateAdaptor (mdbVersion);
49 + return mdbAdaptor.MdbVersion;
50 + }
51 +
52 public void Run (DL.DebuggerStartInfo startInfo)
53 {
54 try {
55 @@ -91,6 +103,7 @@
56
57 DebuggerConfiguration config = new DebuggerConfiguration ();
58 config.LoadConfiguration ();
59 + mdbAdaptor.InitializeConfiguration (config);
60 debugger = new MD.Debugger (config);
61
62 debugger.ModuleLoadedEvent += OnModuleLoadedEvent;
63 Index: Mono.Debugging.Server.Mdb/MdbAdaptor.cs
64 ===================================================================
65 --- Mono.Debugging.Server.Mdb/MdbAdaptor.cs (revision 0)
66 +++ Mono.Debugging.Server.Mdb/MdbAdaptor.cs (revision 136421)
67 @@ -0,0 +1,62 @@
68 +//
69 +// MdbAdaptor.cs
70 +//
71 +// Author:
72 +// Lluis Sanchez Gual <lluis@××××××.com>
73 +//
74 +// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
75 +//
76 +// Permission is hereby granted, free of charge, to any person obtaining a copy
77 +// of this software and associated documentation files (the "Software"), to deal
78 +// in the Software without restriction, including without limitation the rights
79 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
80 +// copies of the Software, and to permit persons to whom the Software is
81 +// furnished to do so, subject to the following conditions:
82 +//
83 +// The above copyright notice and this permission notice shall be included in
84 +// all copies or substantial portions of the Software.
85 +//
86 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
87 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
88 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
89 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
90 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
91 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
92 +// THE SOFTWARE.
93 +
94 +using System;
95 +using MDB=Mono.Debugger;
96 +using Mono.Debugging.Backend.Mdb;
97 +
98 +namespace DebuggerServer
99 +{
100 + public abstract class MdbAdaptor
101 + {
102 + public MdbAdaptor ()
103 + {
104 + MdbVersion = "2.0";
105 + }
106 +
107 + public string MdbVersion { get; internal set; }
108 +
109 + public virtual void SetupXsp (MDB.DebuggerConfiguration config)
110 + {
111 + ThrowNotSupported ("ASP.NET debugging not supported");
112 + }
113 +
114 + public virtual void InitializeBreakpoint (MDB.SourceBreakpoint bp)
115 + {
116 + }
117 +
118 + public virtual void InitializeConfiguration (MDB.DebuggerConfiguration config)
119 + {
120 + }
121 +
122 + public abstract void AbortThread (MDB.Thread thread, MDB.RuntimeInvokeResult result);
123 +
124 + public void ThrowNotSupported (string feature)
125 + {
126 + throw new InvalidOperationException (feature + ". You need to install a more recent Mono Debugger version.");
127 + }
128 + }
129 +}
130 Index: Mono.Debugging.Server.Mdb/Makefile
131 ===================================================================
132 --- Mono.Debugging.Server.Mdb/Makefile (revision 136420)
133 +++ Mono.Debugging.Server.Mdb/Makefile (revision 136421)
134 @@ -59,6 +59,8 @@
135 ICollectionAdaptor.cs \
136 IndexerValueReference.cs \
137 LiteralValueReference.cs \
138 + MdbAdaptor.cs \
139 + MdbAdaptorFactory.cs \
140 NamespaceValueReference.cs \
141 NRefactoryEvaluator.cs \
142 NullValueReference.cs \
143 @@ -77,7 +79,9 @@
144
145 DATA_FILES =
146
147 -RESOURCES =
148 +RESOURCES = \
149 + MdbAdaptor-2-0.cs \
150 + MdbAdaptor-2-4-2.cs
151
152 EXTRAS = \
153 ChangeLog
154 Index: Mono.Debugging.Server.Mdb/MdbAdaptor-2-4-2.cs
155 ===================================================================
156 --- Mono.Debugging.Server.Mdb/MdbAdaptor-2-4-2.cs (revision 0)
157 +++ Mono.Debugging.Server.Mdb/MdbAdaptor-2-4-2.cs (revision 136421)
158 @@ -0,0 +1,51 @@
159 +//
160 +// MdbAdaptor22.cs
161 +//
162 +// Author:
163 +// Lluis Sanchez Gual <lluis@××××××.com>
164 +//
165 +// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
166 +//
167 +// Permission is hereby granted, free of charge, to any person obtaining a copy
168 +// of this software and associated documentation files (the "Software"), to deal
169 +// in the Software without restriction, including without limitation the rights
170 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
171 +// copies of the Software, and to permit persons to whom the Software is
172 +// furnished to do so, subject to the following conditions:
173 +//
174 +// The above copyright notice and this permission notice shall be included in
175 +// all copies or substantial portions of the Software.
176 +//
177 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
178 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
179 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
180 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
181 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
182 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
183 +// THE SOFTWARE.
184 +
185 +using System;
186 +using Mono.Debugger;
187 +
188 +namespace DebuggerServer
189 +{
190 + public class MdbAdaptor_2_4_2: MdbAdaptor
191 + {
192 + public override void SetupXsp (DebuggerConfiguration config)
193 + {
194 + config.SetupXSP ();
195 + config.StopOnManagedSignals = true;
196 + }
197 +
198 + public override void InitializeConfiguration (Mono.Debugger.DebuggerConfiguration config)
199 + {
200 + base.InitializeConfiguration (config);
201 + config.RedirectOutput = true;
202 + }
203 +
204 + public override void AbortThread (Mono.Debugger.Thread thread, Mono.Debugger.RuntimeInvokeResult result)
205 + {
206 + result.Abort ();
207 + }
208 + }
209 +}
210 Index: Mono.Debugging.Server.Mdb/ChangeLog
211 ===================================================================
212 --- Mono.Debugging.Server.Mdb/ChangeLog (revision 136420)
213 +++ Mono.Debugging.Server.Mdb/ChangeLog (revision 136421)
214 @@ -1,3 +1,16 @@
215 +2009-06-18 Lluis Sanchez Gual <lluis@××××××.com>
216 +
217 + * Makefile:
218 + * MdbAdaptor.cs:
219 + * MdbAdaptor-2-0.cs:
220 + * DebuggerServer.cs:
221 + * MdbAdaptor-2-4-2.cs:
222 + * MdbAdaptorFactory.cs:
223 + * RuntimeInvokeManager.cs:
224 + * Mono.Debugging.Server.Mdb.csproj: Added support for mono
225 + 2.4.2. Since the api changed, access to the changed methods
226 + has to be done through a dynamically compiled adapter.
227 +
228 2009-02-20 Lluis Sanchez Gual <lluis@××××××.com>
229
230 * Mono.Debugging.Server.Mdb.csproj: Updated references.
231 Index: Mono.Debugging.Server.Mdb/RuntimeInvokeManager.cs
232 ===================================================================
233 --- Mono.Debugging.Server.Mdb/RuntimeInvokeManager.cs (revision 136420)
234 +++ Mono.Debugging.Server.Mdb/RuntimeInvokeManager.cs (revision 136421)
235 @@ -52,9 +52,7 @@
236 lock (operationsToCancel) {
237 if (!aborted) {
238 aborted = true;
239 - res.Abort ();
240 - res.CompletedEvent.WaitOne ();
241 - ctx.Thread.AbortInvocation ();
242 + Server.Instance.MdbAdaptor.AbortThread (ctx.Thread, res);
243 WaitToStop (ctx.Thread);
244 }
245 }
246 @@ -73,9 +71,7 @@
247 }
248 else
249 aborted = true;
250 - res.Abort ();
251 - res.CompletedEvent.WaitOne ();
252 - ctx.Thread.AbortInvocation ();
253 + Server.Instance.MdbAdaptor.AbortThread (ctx.Thread, res);
254 WaitToStop (ctx.Thread);
255 throw new TimeOutException ();
256 }
257 Index: Mono.Debugging.Server.Mdb/MdbAdaptorFactory.cs
258 ===================================================================
259 --- Mono.Debugging.Server.Mdb/MdbAdaptorFactory.cs (revision 0)
260 +++ Mono.Debugging.Server.Mdb/MdbAdaptorFactory.cs (revision 136421)
261 @@ -0,0 +1,128 @@
262 +//
263 +// MdbAdaptorFactory.cs
264 +//
265 +// Author:
266 +// Lluis Sanchez Gual <lluis@××××××.com>
267 +//
268 +// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
269 +//
270 +// Permission is hereby granted, free of charge, to any person obtaining a copy
271 +// of this software and associated documentation files (the "Software"), to deal
272 +// in the Software without restriction, including without limitation the rights
273 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
274 +// copies of the Software, and to permit persons to whom the Software is
275 +// furnished to do so, subject to the following conditions:
276 +//
277 +// The above copyright notice and this permission notice shall be included in
278 +// all copies or substantial portions of the Software.
279 +//
280 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
281 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
282 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
283 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
284 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
285 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
286 +// THE SOFTWARE.
287 +
288 +using System;
289 +using System.Reflection;
290 +using System.Diagnostics;
291 +using System.IO;
292 +
293 +namespace DebuggerServer
294 +{
295 + public static class MdbAdaptorFactory
296 + {
297 + // Bump this version number if any change is in MdbAdaptor or subclases
298 + const int ApiVersion = 2;
299 +
300 + static readonly string[] supportedVersions = new string[] {"2-4-2", "2-0"};
301 +
302 + public static MdbAdaptor CreateAdaptor (string mdbVersion)
303 + {
304 + ProcessStartInfo pinfo = new ProcessStartInfo ();
305 + pinfo.FileName = "gmcs";
306 +
307 + if (mdbVersion != null) {
308 + MdbAdaptor mdb = TryCreateAdaptor (pinfo, mdbVersion);
309 + if (mdb == null)
310 + throw new InvalidOperationException ("Unsupported MDB version");
311 + return mdb;
312 + }
313 +
314 + foreach (string v in supportedVersions) {
315 + MdbAdaptor mdb = TryCreateAdaptor (pinfo, v);
316 + if (mdb != null)
317 + return mdb;
318 + }
319 + throw new InvalidOperationException ("Unsupported MDB version");
320 + }
321 +
322 + static MdbAdaptor TryCreateAdaptor (ProcessStartInfo pinfo, string versions)
323 + {
324 + string[] versionsArray = versions.Split ('|');
325 + string version = versionsArray [0];
326 +
327 + string tmpPath = Path.GetTempPath ();
328 + tmpPath = Path.Combine (tmpPath, "monodevelop-debugger-mdb");
329 + if (!Directory.Exists (tmpPath))
330 + Directory.CreateDirectory (tmpPath);
331 +
332 + string outFile = Path.Combine (tmpPath, "adaptor-" + ApiVersion + "--" + version + ".dll");
333 +
334 + string[] refAssemblies = new string [] {
335 + typeof(MdbAdaptorFactory).Assembly.Location,
336 + typeof(Mono.Debugger.Debugger).Assembly.Location,
337 + typeof(Mono.Debugging.Client.DebuggerSession).Assembly.Location,
338 + typeof(Mono.Debugging.Backend.Mdb.IDebuggerServer).Assembly.Location
339 + };
340 +
341 + DateTime refsTime = DateTime.MinValue;
342 + foreach (string rasm in refAssemblies) {
343 + DateTime t = File.GetLastWriteTime (rasm);
344 + if (t > refsTime)
345 + refsTime = t;
346 + }
347 +
348 + if (!File.Exists (outFile) || File.GetLastWriteTime (outFile) < refsTime) {
349 + string args = "/t:library ";
350 + args += "\"/out:" + outFile + "\" ";
351 + foreach (string rasm in refAssemblies)
352 + args += "\"/r:" + rasm + "\" ";
353 +
354 + // Write the source code for all required classes
355 + foreach (string ver in versionsArray) {
356 + Stream s = typeof(MdbAdaptorFactory).Assembly.GetManifestResourceStream ("MdbAdaptor-" + ver + ".cs");
357 + StreamReader sr = new StreamReader (s);
358 + string txt = sr.ReadToEnd ();
359 + sr.Close ();
360 + s.Close ();
361 +
362 + string csfile = Path.Combine (tmpPath, "adaptor-" + ver + ".cs");
363 + File.WriteAllText (csfile, txt);
364 + args += "\"" + csfile + "\" ";
365 + }
366 +
367 + pinfo.Arguments = args;
368 + Process proc = Process.Start (pinfo);
369 + proc.WaitForExit ();
370 + if (proc.ExitCode != 0)
371 + return null;
372 + Console.WriteLine ("Generated: " + outFile);
373 + }
374 +
375 + Assembly asm = Assembly.LoadFrom (outFile);
376 + Type at = asm.GetType ("DebuggerServer.MdbAdaptor_" + version.Replace ('-','_'));
377 + if (at != null) {
378 + try {
379 + MdbAdaptor a = (MdbAdaptor) Activator.CreateInstance (at);
380 + a.MdbVersion = version;
381 + return a;
382 + } catch {
383 + // MDB version not really supported
384 + }
385 + }
386 + return null;
387 + }
388 + }
389 +}
390 Index: Mono.Debugging.Server.Mdb/MdbAdaptor-2-0.cs
391 ===================================================================
392 --- Mono.Debugging.Server.Mdb/MdbAdaptor-2-0.cs (revision 0)
393 +++ Mono.Debugging.Server.Mdb/MdbAdaptor-2-0.cs (revision 136421)
394 @@ -0,0 +1,40 @@
395 +//
396 +// MdbAdaptor_2_0.cs
397 +//
398 +// Author:
399 +// Lluis Sanchez Gual <lluis@××××××.com>
400 +//
401 +// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
402 +//
403 +// Permission is hereby granted, free of charge, to any person obtaining a copy
404 +// of this software and associated documentation files (the "Software"), to deal
405 +// in the Software without restriction, including without limitation the rights
406 +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
407 +// copies of the Software, and to permit persons to whom the Software is
408 +// furnished to do so, subject to the following conditions:
409 +//
410 +// The above copyright notice and this permission notice shall be included in
411 +// all copies or substantial portions of the Software.
412 +//
413 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
414 +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
415 +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
416 +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
417 +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
418 +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
419 +// THE SOFTWARE.
420 +
421 +using System;
422 +
423 +namespace DebuggerServer
424 +{
425 + public class MdbAdaptor_2_0: MdbAdaptor
426 + {
427 + public override void AbortThread (Mono.Debugger.Thread thread, Mono.Debugger.RuntimeInvokeResult result)
428 + {
429 + result.Abort ();
430 + result.CompletedEvent.WaitOne ();
431 + thread.AbortInvocation ();
432 + }
433 + }
434 +}
435 Index: Mono.Debugging.Backend.Mdb/MonoDebuggerSession.cs
436 ===================================================================
437 --- Mono.Debugging.Backend.Mdb/MonoDebuggerSession.cs (revision 136420)
438 +++ Mono.Debugging.Backend.Mdb/MonoDebuggerSession.cs (revision 136421)
439 @@ -37,11 +37,13 @@
440 public class MonoDebuggerSession: DebuggerSession
441 {
442 DebuggerController controller;
443 + static string detectedMdbVersion;
444
445 public void StartDebugger ()
446 {
447 controller = new DebuggerController (this, Frontend);
448 controller.StartDebugger ();
449 + InitMdbVersion ();
450 }
451
452 public override void Dispose ()
453 @@ -54,6 +56,12 @@
454 {
455 controller.DebuggerServer.Run (startInfo);
456 }
457 +
458 + void InitMdbVersion ()
459 + {
460 + // Cache detected mdb versions, so version detection is done only once
461 + detectedMdbVersion = controller.DebuggerServer.InitializeMdb (detectedMdbVersion);
462 + }
463
464 protected override void OnAttachToProcess (int processId)
465 {
466 Index: Mono.Debugging.Backend.Mdb/ChangeLog
467 ===================================================================
468 --- Mono.Debugging.Backend.Mdb/ChangeLog (revision 136420)
469 +++ Mono.Debugging.Backend.Mdb/ChangeLog (revision 136421)
470 @@ -1,3 +1,10 @@
471 +2009-06-18 Lluis Sanchez Gual <lluis@××××××.com>
472 +
473 + * IDebuggerServer.cs:
474 + * MonoDebuggerSession.cs: Added support for mono 2.4.2. Since
475 + the api changed, access to the changed methods has to be
476 + done through a dynamically compiled adapter.
477 +
478 2009-03-05 Lluis Sanchez Gual <lluis@××××××.com>
479
480 * AssemblyInfo.cs:
481 Index: Mono.Debugging.Backend.Mdb/IDebuggerServer.cs
482 ===================================================================
483 --- Mono.Debugging.Backend.Mdb/IDebuggerServer.cs (revision 136420)
484 +++ Mono.Debugging.Backend.Mdb/IDebuggerServer.cs (revision 136421)
485 @@ -32,6 +32,8 @@
486 {
487 public interface IDebuggerServer
488 {
489 + string InitializeMdb (string mdbVersion);
490 +
491 void Run (DebuggerStartInfo startInfo);
492
493 void Stop ();