public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: pmachata@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: Add test for #6029
Date: Fri, 04 Apr 2008 10:38:00 -0000	[thread overview]
Message-ID: <20080404103849.22955.qmail@sourceware.org> (raw)

The branch, master has been updated
       via  1e6a205bbcbe119523df8e4a569a9aa3c9aa29b3 (commit)
      from  64375b7902ee26d196612782462de03dba6175c7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 1e6a205bbcbe119523df8e4a569a9aa3c9aa29b3
Author: Petr Machata <pmachata@redhat.com>
Date:   Fri Apr 4 12:38:38 2008 +0200

    Add test for #6029

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/stack/ChangeLog      |    4 ++
 frysk-core/frysk/stack/TestFrame.java |   94 +++++++++++++++++++++++++++++++--
 2 files changed, 94 insertions(+), 4 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/stack/ChangeLog b/frysk-core/frysk/stack/ChangeLog
index f0d9d75..eafad79 100644
--- a/frysk-core/frysk/stack/ChangeLog
+++ b/frysk-core/frysk/stack/ChangeLog
@@ -1,3 +1,7 @@
+2008-04-03  Petr Machata  <pmachata@redhat.com>
+
+	* TestFrame.java (testBogusAddressPrevFrame): New test.
+
 2008-04-02  Mark Wielaard  <mwielaard@redhat.com>
 
 	* TestLibFunctionStepFrame.java: Remove comment about
diff --git a/frysk-core/frysk/stack/TestFrame.java b/frysk-core/frysk/stack/TestFrame.java
index 3912ae1..327e1a6 100644
--- a/frysk-core/frysk/stack/TestFrame.java
+++ b/frysk-core/frysk/stack/TestFrame.java
@@ -39,13 +39,26 @@
 
 package frysk.stack;
 
-import frysk.rsl.Log;
+import java.util.Iterator;
+import java.util.List;
+
+//import frysk.proc.Proc;
+import frysk.config.Config;
 import frysk.proc.Action;
 import frysk.proc.Manager;
 import frysk.proc.Task;
 import frysk.proc.TaskObserver;
-import frysk.testbed.TestLib;
+import frysk.rsl.Log;
+import frysk.symtab.DwflSymbol;
+import frysk.symtab.SymbolFactory;
+import frysk.testbed.DaemonBlockedAtEntry;
 import frysk.testbed.SlaveOffspring;
+import frysk.testbed.StopEventLoopWhenProcTerminated;
+import frysk.testbed.TestLib;
+
+import lib.dwfl.Dwfl;
+import lib.dwfl.DwflModule;
+import lib.dwfl.ElfException;
 
 public class TestFrame extends TestLib {
     private static final Log fine = Log.fine(TestFrame.class);
@@ -79,7 +92,7 @@ public class TestFrame extends TestLib {
       Manager.eventLoop.requestStop();
     }
   }
-    
+
   public Frame backtrace(Task task, BlockingObserver blocker)
   {
     task.requestAddInstructionObserver(blocker);
@@ -127,5 +140,78 @@ public class TestFrame extends TestLib {
     assertNotSame("Frames should be different", frame, otherFrame);
     
   }
-  
+
+
+    class Info {
+	private Task task;
+	public Info(Task task) {
+	    this.task = task;
+	}
+
+	private DwflModule getModuleForFile(String path) {
+	    Dwfl dwfl = frysk.dwfl.DwflCache.getDwfl(task);
+	    DwflModule[] modules = dwfl.getModulesForce();
+	    for (int i = 0; i < modules.length; ++i) {
+		String name = modules[i].getName();
+		if (name.equals(path))
+		    return modules[i];
+	    }
+	    return null;
+	}
+
+	public long getFunctionEntryAddress(String func) throws ElfException
+	{
+	    String path = task.getProc().getExeFile().getSysRootedPath();
+	    DwflModule module = getModuleForFile(path);
+	    List symbols = SymbolFactory.getSymbols(module);
+	    for (Iterator it = symbols.iterator(); it.hasNext();) {
+		DwflSymbol symbol = (DwflSymbol)it.next();
+		if (symbol.getName().equals(func))
+		    return symbol.getAddress();
+	    }
+	    return 0;
+	}
+    }
+
+    public void testBogusAddressPrevFrame() throws ElfException {
+	if (unresolved(6029))
+	    return;
+    	class CodeObserver1 implements TaskObserver.Code
+	{
+	    public boolean hit = false;
+
+	    public Action updateHit (Task task, long address) {
+		hit = true;
+		long addr = StackFactory.createFrame(task).getOuter().getAddress();
+		assertTrue("Return adress makes sense",
+			    addr < -1 || addr > 4096);
+		Manager.eventLoop.requestStop();
+		return Action.BLOCK;
+	    }
+
+	    public void addFailed (Object observable, Throwable w) { }
+	    public void addedTo (Object observable) {
+		Manager.eventLoop.requestStop();
+	    }
+	    public void deletedFrom (Object observable) {
+		Manager.eventLoop.requestStop();
+	    }
+	}
+
+	String[] cmd = {Config.getPkgLibFile("funit-empty-functions-nodebug").getPath()};
+	DaemonBlockedAtEntry child = new DaemonBlockedAtEntry(cmd);
+	Task task = child.getMainTask();
+	Info info = new Info(task);
+
+	long address = info.getFunctionEntryAddress("__libc_csu_init");
+	CodeObserver1 code = new CodeObserver1();
+	task.requestAddCodeObserver(code, address);
+	assertRunUntilStop("add breakpoint observer");
+
+	new StopEventLoopWhenProcTerminated(child);
+	child.requestRemoveBlock();
+	assertFalse(code.hit);
+	assertRunUntilStop("wait for hit");
+	assertTrue(code.hit);
+    }
 }


hooks/post-receive
--
frysk system monitor/debugger


                 reply	other threads:[~2008-04-04 10:38 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=20080404103849.22955.qmail@sourceware.org \
    --to=pmachata@sourceware.org \
    --cc=frysk-cvs@sourceware.org \
    --cc=frysk@sourceware.org \
    /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).