diff --git a/ChangeLog b/ChangeLog index 9fd8b5f0..0ded1920 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-10-14 Martin Baulig + + * backend/SingleSteppingEngine.cs + (SSE.OperationMonoTrampoline): Fix bug #544935; the runtime now + supports a new trampoline notification which also gives us the + address of the callsite, so we can detect recursive invocations of + mono_generic_trampoline(). + 2009-10-08 Martin Baulig * build/mdb: Use the full pathname to invoke mono. diff --git a/backend/SingleSteppingEngine.cs b/backend/SingleSteppingEngine.cs index 865dab53..ce3fe886 100644 --- a/backend/SingleSteppingEngine.cs +++ b/backend/SingleSteppingEngine.cs @@ -4424,10 +4424,26 @@ protected class OperationMonoTrampoline : Operation get { return true; } } + /* + * On October 13th, 2009 a new notification was added to the debugger to fix + * https://bugzilla.novell.com/show_bug.cgi?id=544935. + * + * This new notification also gives us the address of the callsite, so we can + * identify recursive calls to mono_generic_trampoline(). + * + * The runtime versions are 80.2 for 2.4.x and 81.4 for trunk. + * + */ + protected override void DoExecute () { - sse.enable_extended_notification (NotificationType.Trampoline); - sse.do_continue (); + if (sse.MonoDebuggerInfo.HasNewTrampolineNotification ()) { + sse.enable_extended_notification (NotificationType.Trampoline); + sse.do_continue (CallSite.Address + CallSite.InstructionSize); + } else { + sse.enable_extended_notification (NotificationType.OldTrampoline); + sse.do_continue (); + } } public override bool ResumeOperation () @@ -4438,7 +4454,12 @@ public override bool ResumeOperation () protected void TrampolineCompiled (TargetAddress mono_method, TargetAddress code) { - sse.disable_extended_notification (NotificationType.Trampoline); + if (sse.MonoDebuggerInfo.HasNewTrampolineNotification ()) { + sse.disable_extended_notification (NotificationType.Trampoline); + sse.remove_temporary_breakpoint (); + } else { + sse.disable_extended_notification (NotificationType.OldTrampoline); + } Report.Debug (DebugFlags.SSE, "{0} compiled trampoline: {1} {2} {3}", sse, mono_method, code, TrampolineHandler != null); @@ -4460,6 +4481,26 @@ protected void TrampolineCompiled (TargetAddress mono_method, TargetAddress code { if ((cevent.Type == Inferior.ChildEventType.CHILD_NOTIFICATION) && ((NotificationType) cevent.Argument == NotificationType.Trampoline)) { + TargetAddress info = new TargetAddress ( + inferior.AddressDomain, cevent.Data1); + + TargetReader reader = new TargetReader (inferior.ReadMemory (info, 3 * inferior.TargetAddressSize)); + TargetAddress trampoline = reader.ReadAddress (); + TargetAddress method = reader.ReadAddress (); + TargetAddress code = reader.ReadAddress (); + + if ((trampoline.IsNull) || (trampoline != CallSite.Address + CallSite.InstructionSize)) { + args = null; + sse.do_continue (); + return EventResult.Running; + } + + args = null; + compiled = true; + TrampolineCompiled (method, code); + return EventResult.Running; + } else if ((cevent.Type == Inferior.ChildEventType.CHILD_NOTIFICATION) && + ((NotificationType) cevent.Argument == NotificationType.OldTrampoline)) { TargetAddress method = new TargetAddress ( inferior.AddressDomain, cevent.Data1); TargetAddress code = new TargetAddress ( diff --git a/backend/mono/MonoThreadManager.cs b/backend/mono/MonoThreadManager.cs index fdfaf9f5..b2712730 100644 --- a/backend/mono/MonoThreadManager.cs +++ b/backend/mono/MonoThreadManager.cs @@ -50,7 +50,8 @@ internal enum NotificationType { CreateAppDomain, UnloadAppDomain, - Trampoline = 256 + OldTrampoline = 256, + Trampoline = 512 } internal enum ThreadFlags { @@ -434,6 +435,7 @@ internal void InitializeThreads (Inferior inferior) csharp_language = null; break; + case NotificationType.OldTrampoline: case NotificationType.Trampoline: resume_target = false; return false; @@ -576,6 +578,11 @@ public bool CheckRuntimeVersion (int major, int minor) return MinorVersion >= minor; } + public bool HasNewTrampolineNotification () + { + return CheckRuntimeVersion (80, 2) || CheckRuntimeVersion (81, 4); + } + protected MonoDebuggerInfo (TargetMemoryAccess memory, TargetReader reader) { reader.Offset = 8;