Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Fix bug #544935, support recursive invocations of mono_generic_trampo…
Browse files Browse the repository at this point in the history
…line().

2009-10-14  Martin Baulig  <martin@ximian.com>

	* 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().

svn path=/trunk/debugger/; revision=144053
  • Loading branch information
Martin Baulig committed Oct 13, 2009
1 parent 49def76 commit 425cbed
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 4 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
@@ -1,3 +1,11 @@
2009-10-14 Martin Baulig <martin@ximian.com>

* 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 <martin@ximian.com>

* build/mdb: Use the full pathname to invoke mono.
Expand Down
47 changes: 44 additions & 3 deletions backend/SingleSteppingEngine.cs
Expand Up @@ -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 ()
Expand All @@ -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);
Expand All @@ -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 (
Expand Down
9 changes: 8 additions & 1 deletion backend/mono/MonoThreadManager.cs
Expand Up @@ -50,7 +50,8 @@ internal enum NotificationType {
CreateAppDomain,
UnloadAppDomain,

Trampoline = 256
OldTrampoline = 256,
Trampoline = 512
}

internal enum ThreadFlags {
Expand Down Expand Up @@ -434,6 +435,7 @@ internal void InitializeThreads (Inferior inferior)
csharp_language = null;
break;

case NotificationType.OldTrampoline:
case NotificationType.Trampoline:
resume_target = false;
return false;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 425cbed

Please sign in to comment.