public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: frysk <frysk@sourceware.org>
Cc: Petr Machata <pmachata@redhat.com>
Subject: [patch] Explicit test for bug #6029 and use outer frame address 	for return in TaskTracer again
Date: Mon, 14 Apr 2008 12:00:00 -0000	[thread overview]
Message-ID: <1208039047.16022.4.camel@localhost.localdomain> (raw)

[-- Attachment #1: Type: text/plain, Size: 650 bytes --]

Hi,

This adds an explicit test for bug #6029 (fixed yesterday) and ftrace
TaskTracer now user the outer frame address again for getting the return
address instead of its own method. This should give the code a bit more
exposure.

frysk-core/frysk/stack/ChangeLog
2008-04-12  Mark Wielaard  <mwielaard@redhat.com>

    * TestFrame.java (testInnerFrameAddress): New test for bug #6029.

frysk-core/frysk/ftrace/ChangeLog
2008-04-16  Mark Wielaard  <mwielaard@redhat.com>

    * TaskTracer.java (getReturnAddress): Fetch the return address
    through outer frame address again.

No regressions on x86 and x86_64 fedora 8.

Committed and pushed,

Mark

[-- Attachment #2: 6029-extra.patch --]
[-- Type: text/x-patch, Size: 2721 bytes --]

diff --git a/frysk-core/frysk/ftrace/TaskTracer.java b/frysk-core/frysk/ftrace/TaskTracer.java
index 6aa71dc..b2625dc 100644
--- a/frysk-core/frysk/ftrace/TaskTracer.java
+++ b/frysk-core/frysk/ftrace/TaskTracer.java
@@ -56,6 +56,7 @@ import frysk.rt.PLTBreakpoint;
 import frysk.rt.SourceBreakpoint;
 import frysk.rt.SourceBreakpointObserver;
 import frysk.rt.SymbolBreakpoint;
+import frysk.stack.StackFactory;
 import frysk.symtab.DwflSymbol;
 import frysk.symtab.PLTEntry;
 
@@ -234,8 +235,7 @@ class TaskTracer
 
 	private long getReturnAddress(Task task) {
 	    try {
-		//return StackFactory.createFrame(task).getOuter().getAddress();
-		return arch.getReturnAddress(task);
+		return StackFactory.createFrame(task).getOuter().getAddress();
 	    } catch (java.lang.NullPointerException npe) {
 		return 0;
 	    }
diff --git a/frysk-core/frysk/stack/TestFrame.java b/frysk-core/frysk/stack/TestFrame.java
index c647efa..acfa56a 100644
--- a/frysk-core/frysk/stack/TestFrame.java
+++ b/frysk-core/frysk/stack/TestFrame.java
@@ -211,4 +211,58 @@ public class TestFrame extends TestLib {
 	assertRunUntilStop("wait for hit");
 	assertTrue(code.hit);
     }
+
+    /**
+     * Explicit test for bug #6029. Make sure that when generating
+     * backtrace in the updateHit() method the address is correct.
+     */
+    public void testInnerFrameAddress() throws ElfException
+    {
+      String[] cmd =
+	{ Config.getPkgLibFile("funit-hello").getPath(), "world" };
+      DaemonBlockedAtEntry child = new DaemonBlockedAtEntry(cmd);
+      Task task = child.getMainTask();
+      Info info = new Info(task);
+      
+      long address = info.getFunctionEntryAddress("print");
+      CodeObserver code = new CodeObserver();
+      task.requestAddCodeObserver(code, address);
+      assertRunUntilStop("add breakpoint observer");
+      
+      child.requestRemoveBlock();
+      assertFalse(code.hit);
+      assertRunUntilStop("wait for hit");
+      assertTrue(code.hit);
+    }
+
+  static class CodeObserver implements TaskObserver.Code
+  {
+    public boolean hit = false;
+    
+    public Action updateHit (Task task, long hitAddress)
+    {
+      hit = true;
+      long frameAddress = StackFactory.createFrame(task).getAddress();
+      assertEquals("Hit and Frame address", hitAddress, frameAddress);
+
+      Manager.eventLoop.requestStop();
+      return Action.BLOCK;
+    }
+    
+    public void addFailed (Object observable, Throwable w)
+    {
+      // Whoa
+      w.printStackTrace();
+    }
+    
+    public void addedTo (Object observable)
+    {
+      Manager.eventLoop.requestStop();
+    }
+
+    public void deletedFrom (Object observable)
+    {
+      // We never delete
+    }
+  }
 }

                 reply	other threads:[~2008-04-12 22:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1208039047.16022.4.camel@localhost.localdomain \
    --to=mark@klomp.org \
    --cc=frysk@sourceware.org \
    --cc=pmachata@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).