Author: martin
Date: 2007-10-01 20:00:04 -0400 (Mon, 01 Oct 2007)
New Revision: 86729

Modified:
   trunk/debugger/ChangeLog
   trunk/debugger/backend/SingleSteppingEngine.cs
   trunk/debugger/classes/Backtrace.cs
Log:
2007-10-02  Martin Baulig  <[EMAIL PROTECTED]>

        * backend/SingleSteppingEngine.cs
        (SingleSteppingEngine.Return): Create our own, local backtrace
        instead of using `current_backtrace'; limit the maximum number of
        frames to 2 since that's all we need here.

        * classes/Backtrace.cs
        (Backtrace.TryUnwind): Add sanity check to avoid 'loops'.



Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog    2007-10-01 23:30:57 UTC (rev 86728)
+++ trunk/debugger/ChangeLog    2007-10-02 00:00:04 UTC (rev 86729)
@@ -1,3 +1,13 @@
+2007-10-02  Martin Baulig  <[EMAIL PROTECTED]>
+
+       * backend/SingleSteppingEngine.cs
+       (SingleSteppingEngine.Return): Create our own, local backtrace
+       instead of using `current_backtrace'; limit the maximum number of
+       frames to 2 since that's all we need here.
+
+       * classes/Backtrace.cs
+       (Backtrace.TryUnwind): Add sanity check to avoid 'loops'.
+
 2007-09-28  Martin Baulig  <[EMAIL PROTECTED]>
 
        * backend/MonoThreadManager.cs

Modified: trunk/debugger/backend/SingleSteppingEngine.cs
===================================================================
--- trunk/debugger/backend/SingleSteppingEngine.cs      2007-10-01 23:30:57 UTC 
(rev 86728)
+++ trunk/debugger/backend/SingleSteppingEngine.cs      2007-10-02 00:00:04 UTC 
(rev 86729)
@@ -1578,13 +1578,24 @@
                public override CommandResult Return (bool run_finally)
                {
                        return (CommandResult) SendCommand (delegate {
-                               GetBacktrace (Backtrace.Mode.Native, -1);
-                               if (current_backtrace == null)
+                               if (!engine_stopped) {
+                                       Report.Debug (DebugFlags.Wait,
+                                                     "{0} not stopped", this);
+                                       throw new TargetException 
(TargetError.NotStopped);
+                               }
+
+                               if (current_frame == null)
                                        throw new TargetException 
(TargetError.NoStack);
-                               if (current_backtrace.Count < 2)
+
+                               process.UpdateSymbolTable (inferior);
+
+                               Backtrace bt = new Backtrace (current_frame);
+                               bt.GetBacktrace (this, Backtrace.Mode.Native, 
TargetAddress.Null, 2);
+
+                               if (bt.Count < 2)
                                        throw new TargetException 
(TargetError.NoStack);
 
-                               StackFrame parent_frame = 
current_backtrace.Frames [1];
+                               StackFrame parent_frame = bt.Frames [1];
                                if (parent_frame == null)
                                        return null;
 

Modified: trunk/debugger/classes/Backtrace.cs
===================================================================
--- trunk/debugger/classes/Backtrace.cs 2007-10-01 23:30:57 UTC (rev 86728)
+++ trunk/debugger/classes/Backtrace.cs 2007-10-02 00:00:04 UTC (rev 86729)
@@ -151,6 +151,10 @@
                        if (new_frame == null)
                                return false;
 
+                       // Sanity check; don't loop.
+                       if (new_frame.StackPointer <= last_frame.StackPointer)
+                               return false;
+
                        if (!until.IsNull && (new_frame.StackPointer >= until))
                                return false;
 

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

Reply via email to