* [patch] Explicit test for bug #6029 and use outer frame address for return in TaskTracer again
@ 2008-04-14 12:00 Mark Wielaard
0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2008-04-14 12:00 UTC (permalink / raw)
To: frysk; +Cc: Petr Machata
[-- 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
+ }
+ }
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-04-12 22:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-14 12:00 [patch] Explicit test for bug #6029 and use outer frame address for return in TaskTracer again Mark Wielaard
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).