Author: martin
Date: 2007-01-17 12:28:20 -0500 (Wed, 17 Jan 2007)
New Revision: 71218
Modified:
trunk/debugger/ChangeLog
trunk/debugger/classes/Backtrace.cs
Log:
2007-01-17 Martin Baulig <[EMAIL PROTECTED]>
* classes/Backtrace.cs
(Backtrace.GetBacktrace): Make this internal and take a
`ThreadServant'.
(Backtrace.TryUnwind): Likewise.
(Backtrace.TryUnwind): If we're in unmanaged code and don't have
any source info, use the LMF to get back to managed land.
Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog 2007-01-17 17:26:28 UTC (rev 71217)
+++ trunk/debugger/ChangeLog 2007-01-17 17:28:20 UTC (rev 71218)
@@ -1,5 +1,14 @@
2007-01-17 Martin Baulig <[EMAIL PROTECTED]>
+ * classes/Backtrace.cs
+ (Backtrace.GetBacktrace): Make this internal and take a
+ `ThreadServant'.
+ (Backtrace.TryUnwind): Likewise.
+ (Backtrace.TryUnwind): If we're in unmanaged code and don't have
+ any source info, use the LMF to get back to managed land.
+
+2007-01-17 Martin Baulig <[EMAIL PROTECTED]>
+
* backend/arch/Architecture.cs
(Architecture.GetLMF): New internal method.
Modified: trunk/debugger/classes/Backtrace.cs
===================================================================
--- trunk/debugger/classes/Backtrace.cs 2007-01-17 17:26:28 UTC (rev 71217)
+++ trunk/debugger/classes/Backtrace.cs 2007-01-17 17:28:20 UTC (rev 71218)
@@ -4,6 +4,8 @@
using System.Collections;
using System.Runtime.InteropServices;
+using Mono.Debugger.Backends;
+
namespace Mono.Debugger
{
public class Backtrace : DebuggerMarshalByRefObject
@@ -51,16 +53,19 @@
}
}
- public void GetBacktrace (TargetMemoryAccess target,
TargetAddress until,
- int max_frames)
+ internal void GetBacktrace (ThreadServant target, TargetAddress
until,
+ int max_frames)
{
+ if (target.Process.IsManaged &&
target.LMFAddress.IsNull)
+ throw new Exception ("FUCK");
+
while (TryUnwind (target, until)) {
if ((max_frames != -1) && (frames.Count >
max_frames))
break;
}
}
- public bool TryUnwind (TargetMemoryAccess target, TargetAddress
until)
+ internal bool TryUnwind (ThreadServant target, TargetAddress
until)
{
StackFrame new_frame = null;
try {
@@ -68,9 +73,21 @@
} catch (TargetException) {
}
- if (new_frame == null)
- return false;
+ if ((new_frame == null) || (new_frame.SourceAddress ==
null)) {
+ try {
+ if (!last_frame.Language.IsManaged &&
!target.LMFAddress.IsNull)
+ new_frame =
target.Architecture.GetLMF (target.Client);
+ } catch (TargetException) {
+ }
+ 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