Author: martin
Date: 2007-01-23 16:24:00 -0500 (Tue, 23 Jan 2007)
New Revision: 71558

Modified:
   trunk/debugger/ChangeLog
   trunk/debugger/backend/ProcessServant.cs
   trunk/debugger/backend/SingleSteppingEngine.cs
   trunk/debugger/backend/ThreadManager.cs
   trunk/debugger/backend/ThreadServant.cs
   trunk/debugger/backend/arch/CoreFile.cs
Log:
2007-01-23  Martin Baulig  <[EMAIL PROTECTED]>

        * backend/SingleSteppingEngine.cs
        (SingleSteppingEngine.ProcessOperation): Queue the operation and
        start it later if we're currently thread-locked.
        (SingleSteppingEngine.ReleaseThreadLockDone): New internal method.

        * backend/ProcessServant.cs
        (ProcessServant.ReleaseGlobalThreadLock): Call ReleaseThreadLockDone()



Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog    2007-01-23 21:08:28 UTC (rev 71557)
+++ trunk/debugger/ChangeLog    2007-01-23 21:24:00 UTC (rev 71558)
@@ -1,3 +1,15 @@
+2007-01-23  Martin Baulig  <[EMAIL PROTECTED]>
+
+       * backend/SingleSteppingEngine.cs
+       (SingleSteppingEngine.ProcessOperation): Queue the operation and
+       start it later if we're currently thread-locked.
+       (SingleSteppingEngine.ReleaseThreadLockDone): New internal method.
+
+       * backend/ProcessServant.cs
+       (ProcessServant.ReleaseGlobalThreadLock): Call
+       ReleaseThreadLockDone() on each SSE after releasing the mutex to
+       start queued operations.
+
 2007-01-19  Martin Baulig  <[EMAIL PROTECTED]>
 
        * backend/SingleSteppingEngine.cs

Modified: trunk/debugger/backend/ProcessServant.cs
===================================================================
--- trunk/debugger/backend/ProcessServant.cs    2007-01-23 21:08:28 UTC (rev 
71557)
+++ trunk/debugger/backend/ProcessServant.cs    2007-01-23 21:24:00 UTC (rev 
71558)
@@ -488,6 +488,15 @@
                        thread_lock_mutex.Unlock ();
                        Report.Debug (DebugFlags.Threads,
                                      "Released global thread lock: {0}", 
caller);
+
+                       foreach (ThreadServant thread in thread_hash.Values) {
+                               if (thread == caller)
+                                       continue;
+                               thread.ReleaseThreadLockDone ();
+                       }
+
+                       Report.Debug (DebugFlags.Threads,
+                                     "Released global thread lock #1: {0}", 
caller);
                }
 
                //

Modified: trunk/debugger/backend/SingleSteppingEngine.cs
===================================================================
--- trunk/debugger/backend/SingleSteppingEngine.cs      2007-01-23 21:08:28 UTC 
(rev 71557)
+++ trunk/debugger/backend/SingleSteppingEngine.cs      2007-01-23 21:24:00 UTC 
(rev 71558)
@@ -579,7 +579,7 @@
                void StartOperation ()
                {
                        lock (this) {
-                               if (!engine_stopped) {
+                               if (!engine_stopped || (has_thread_lock && 
(pending_operation != null))) {
                                        Report.Debug (DebugFlags.Wait,
                                                      "{0} not stopped", this);
                                        throw new TargetException 
(TargetError.NotStopped);
@@ -611,8 +611,15 @@
                {
                        stop_requested = false;
 
-                       Report.Debug (DebugFlags.SSE,
-                                     "{0} starting {1}", this, operation);
+                       if (has_thread_lock) {
+                               Report.Debug (DebugFlags.SSE,
+                                             "{0} starting {1} while being 
thread-locked",
+                                             this, operation);
+                               pending_operation = operation;
+                               return operation.Result;
+                       } else
+                               Report.Debug (DebugFlags.SSE,
+                                             "{0} starting {1}", this, 
operation);
 
                        current_operation = operation;
                        ExecuteOperation (operation);
@@ -1338,7 +1345,8 @@
                internal override void AcquireThreadLock ()
                {
                        Report.Debug (DebugFlags.Threads,
-                                     "{0} acquiring thread lock", this);
+                                     "{0} acquiring thread lock: {1} {2}", 
this, engine_stopped,
+                                     current_operation);
 
                        has_thread_lock = true;
                        stopped = inferior.Stop (out stop_event);
@@ -1367,8 +1375,8 @@
                internal override void ReleaseThreadLock ()
                {
                        Report.Debug (DebugFlags.Threads,
-                                     "{0} releasing thread lock: {1} {2}",
-                                     this, stopped, stop_event);
+                                     "{0} releasing thread lock: {1} {2} {3}",
+                                     this, stopped, stop_event, 
current_operation);
 
                        has_thread_lock = false;
 
@@ -1399,6 +1407,19 @@
                        }
                }
 
+               internal override void ReleaseThreadLockDone ()
+               {
+                       if (pending_operation == null)
+                               return;
+
+                       Report.Debug (DebugFlags.Threads, "{0} starting pending 
operation {1}", this,
+                                     pending_operation);
+
+                       current_operation = pending_operation;
+                       pending_operation = null;
+                       ExecuteOperation (current_operation);
+               }
+
                void inferior_output_handler (bool is_stderr, string line)
                {
                        manager.Debugger.OnInferiorOutput (is_stderr, line);
@@ -1789,6 +1810,7 @@
                bool stopped;
                Inferior.ChildEvent stop_event;
                Operation current_operation;
+               Operation pending_operation;
 
                Inferior inferior;
                Disassembler disassembler;

Modified: trunk/debugger/backend/ThreadManager.cs
===================================================================
--- trunk/debugger/backend/ThreadManager.cs     2007-01-23 21:08:28 UTC (rev 
71557)
+++ trunk/debugger/backend/ThreadManager.cs     2007-01-23 21:24:00 UTC (rev 
71558)
@@ -314,6 +314,8 @@
                                } catch (ST.ThreadAbortException) {
                                        ;
                                } catch (Exception e) {
+                                       Report.Debug (DebugFlags.Wait,
+                                                     "ThreadManager caught 
exception: {0}", e);
                                        Console.WriteLine ("EXCEPTION: {0}", e);
                                }
 

Modified: trunk/debugger/backend/ThreadServant.cs
===================================================================
--- trunk/debugger/backend/ThreadServant.cs     2007-01-23 21:08:28 UTC (rev 
71557)
+++ trunk/debugger/backend/ThreadServant.cs     2007-01-23 21:24:00 UTC (rev 
71558)
@@ -202,6 +202,8 @@
 
                internal abstract void ReleaseThreadLock ();
 
+               internal abstract void ReleaseThreadLockDone ();
+
                public abstract string PrintObject (Style style, TargetObject 
obj, DisplayFormat format);
 
                public abstract string PrintType (Style style, TargetType type);

Modified: trunk/debugger/backend/arch/CoreFile.cs
===================================================================
--- trunk/debugger/backend/arch/CoreFile.cs     2007-01-23 21:08:28 UTC (rev 
71557)
+++ trunk/debugger/backend/arch/CoreFile.cs     2007-01-23 21:24:00 UTC (rev 
71558)
@@ -312,6 +312,11 @@
                                throw new InvalidOperationException ();
                        }
 
+                       internal override void ReleaseThreadLockDone ()
+                       {
+                               throw new InvalidOperationException ();
+                       }
+
                        //
                        // TargetMemoryAccess
                        //

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to