public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: swagiaal: Added test top-down search tests.
@ 2008-04-25 20:08 swagiaal
  0 siblings, 0 replies; only message in thread
From: swagiaal @ 2008-04-25 20:08 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  7ec5eccf2b3df6cae57c60ff14a7bbc2b6803718 (commit)
       via  af0cb6135c719b034aa6395acf2880226cdd0e68 (commit)
      from  72355250a9426adb9535df657c57434d6d7c861a (commit)

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

- Log -----------------------------------------------------------------
commit 7ec5eccf2b3df6cae57c60ff14a7bbc2b6803718
Author: Sami Wagiaalla <swagiaal@redhat.com>
Date:   Fri Apr 25 15:00:47 2008 -0400

    swagiaal: Added test top-down search tests.
    
    frysk-core/ChangeLog
    +2008-04-25  Sami Wagiaalla  <swagiaal@toner.yyz.redhat.com>
    +
    +	* Makefile.am: Added rule to link two files into one
    +	executable for test case.
    +
    
    frysk-core/frysk/debuginfo/ChangeLog
    +2008-04-25  Sami Wagiaalla  <swagiaal@redhat.com>
    +
    +	* TestObjectDeclarationSearchEngineTopDown.java: New file.
    +
    
    frysk-core/frysk/pkglibdir/ChangeLog
    +2008-04-25  Sami Wagiaalla  <swagiaal@toner.yyz.redhat.com>
    +
    +	* funit-scopes-multi-file-a.c: New file.
    +	* funit-scopes-multi-file-b.c: New file.
    +

commit af0cb6135c719b034aa6395acf2880226cdd0e68
Author: Sami Wagiaalla <swagiaal@redhat.com>
Date:   Thu Apr 24 14:09:35 2008 -0400

    swagiaal: Renamed getSymbolDie to getObject.
    
    frysk-core/frysk/debuginfo/ChangeLog
    +2008-04-24  Sami Wagiaalla  <swagiaal@redhat.com>
    +
    +	* ObjectDeclarationSearchEngine.java: renamed getSymbolDie to
    +	getObject.
    +
    
    frysk-core/frysk/hpd/ChangeLog
    +2008-04-24  Sami Wagiaalla  <swagiaal@redhat.com>
    +
    +	Renamed getSymbolDie to getObject.
    +	* BreakpointCommand.java: Updated.
    +	* ListCommand.java: Updated.
    +

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

Summary of changes:
 frysk-core/ChangeLog                               |    5 +
 frysk-core/Makefile.am                             |    8 ++
 frysk-core/frysk/debuginfo/ChangeLog               |   11 ++-
 .../debuginfo/ObjectDeclarationSearchEngine.java   |    5 +-
 .../TestObjectDeclarationSearchEngine.java         |    5 +-
 .../TestObjectDeclarationSearchEngineTopDown.java  |  115 ++++++++++++++++++++
 frysk-core/frysk/hpd/BreakpointCommand.java        |    2 +-
 frysk-core/frysk/hpd/ChangeLog                     |    6 +
 frysk-core/frysk/hpd/ListCommand.java              |    2 +-
 frysk-core/frysk/hpd/TestListCommand.java          |    2 +-
 frysk-core/frysk/pkglibdir/ChangeLog               |    5 +
 .../frysk/pkglibdir/funit-scopes-multi-file-a.c    |   19 ++++
 .../frysk/pkglibdir/funit-scopes-multi-file-b.c    |   13 +++
 13 files changed, 188 insertions(+), 10 deletions(-)
 create mode 100644 frysk-core/frysk/debuginfo/TestObjectDeclarationSearchEngineTopDown.java
 create mode 100644 frysk-core/frysk/pkglibdir/funit-scopes-multi-file-a.c
 create mode 100644 frysk-core/frysk/pkglibdir/funit-scopes-multi-file-b.c

First 500 lines of diff:
diff --git a/frysk-core/ChangeLog b/frysk-core/ChangeLog
index b0d8871..30b7c70 100644
--- a/frysk-core/ChangeLog
+++ b/frysk-core/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-25  Sami Wagiaalla  <swagiaal@toner.yyz.redhat.com>
+
+	* Makefile.am: Added rule to link two files into one
+	executable for test case.
+
 2008-04-11  Andrew Cagney  <cagney@redhat.com>
 
 	* Makefile.am (all-local) [DO_ARCH32_TEST]: Conditionally add
diff --git a/frysk-core/Makefile.am b/frysk-core/Makefile.am
index b3990c1..713b2ca 100644
--- a/frysk-core/Makefile.am
+++ b/frysk-core/Makefile.am
@@ -322,3 +322,11 @@ frysk/pkgdatadir/test-core-x86:
 pkglib_PROGRAMS += frysk/pkglibdir/FunitSimpleInterfaceTest
 frysk/pkglibdir/FunitSimpleInterfaceTest:
 	gcj -o $@ -g --main=FunitSimpleInterfaceTest $(srcdir)/frysk/pkglibdir/FunitSimpleInterfaceTest.java $(srcdir)/frysk/pkglibdir/FunitSimpleInterface.java
+
+
+# The following links two files into one executable
+frysk_pkglibdir_funit_scopes_multi_file_a_LINK = $(LINK) $(srcdir)/frysk/pkglibdir/funit-scopes-multi-file-b.c  -DNO_MAIN
+frysk_pkglibdir_funit_scopes_multi_file_b_LINK = $(LINK) $(srcdir)/frysk/pkglibdir/funit-scopes-multi-file-b.c  -DNO_MAIN
+
+
+
diff --git a/frysk-core/frysk/debuginfo/ChangeLog b/frysk-core/frysk/debuginfo/ChangeLog
index bcea5dc..8223710 100644
--- a/frysk-core/frysk/debuginfo/ChangeLog
+++ b/frysk-core/frysk/debuginfo/ChangeLog
@@ -1,4 +1,13 @@
-2008-04-24  Stan Cox  <scox@redhat.com>
+2008-04-25  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	* TestObjectDeclarationSearchEngineTopDown.java: New file.
+
+2008-04-24  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	* ObjectDeclarationSearchEngine.java: renamed getSymbolDie to
+	getObject.
+
+2008-04-24  Sami Wagiaalla  <swagiaal@redhat.com>
 
 	*  package.html: New file.
 
diff --git a/frysk-core/frysk/debuginfo/ObjectDeclarationSearchEngine.java b/frysk-core/frysk/debuginfo/ObjectDeclarationSearchEngine.java
index 5eaa273..0f172e7 100644
--- a/frysk-core/frysk/debuginfo/ObjectDeclarationSearchEngine.java
+++ b/frysk-core/frysk/debuginfo/ObjectDeclarationSearchEngine.java
@@ -92,10 +92,9 @@ public class ObjectDeclarationSearchEngine implements ExprSymTab{
      * should be modified to
      * - use frysk search ({@link ObjectDeclarationSearchEngine})
      * - handle # syntax
-     * - return ObjectDeclaration
      * ...   
      */
-    public ObjectDeclaration getSymbolDie(String name) {
+    public ObjectDeclaration getObject(String name) {
 	
 	ObjectDeclaration result;
 	
@@ -106,7 +105,7 @@ public class ObjectDeclarationSearchEngine implements ExprSymTab{
 	TypeFactory typeFactory = new TypeFactory(task.getISA());
 	
 	if (resultDie == null)
-	    throw new RuntimeException("symbol " + name + " not found.");
+	    throw new ObjectDeclarationNotFoundException(name);
 	
 	
 	try {
diff --git a/frysk-core/frysk/debuginfo/TestObjectDeclarationSearchEngine.java b/frysk-core/frysk/debuginfo/TestObjectDeclarationSearchEngine.java
index a198550..1fbbd24 100644
--- a/frysk-core/frysk/debuginfo/TestObjectDeclarationSearchEngine.java
+++ b/frysk-core/frysk/debuginfo/TestObjectDeclarationSearchEngine.java
@@ -245,7 +245,6 @@ public class TestObjectDeclarationSearchEngine extends TestLib{
 	} catch (ObjectDeclarationNotFoundException e) {
 	    // exception was thrown
 	}
-	
-	
-}
+
+    }
 }
diff --git a/frysk-core/frysk/debuginfo/TestObjectDeclarationSearchEngineTopDown.java b/frysk-core/frysk/debuginfo/TestObjectDeclarationSearchEngineTopDown.java
new file mode 100644
index 0000000..7ac0c05
--- /dev/null
+++ b/frysk-core/frysk/debuginfo/TestObjectDeclarationSearchEngineTopDown.java
@@ -0,0 +1,115 @@
+// This file is part of the program FRYSK.
+//
+// Copyright 2007, 2008, Red Hat Inc.
+//
+// FRYSK is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// FRYSK is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with FRYSK; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+// 
+// In addition, as a special exception, Red Hat, Inc. gives You the
+// additional right to link the code of FRYSK with code not covered
+// under the GNU General Public License ("Non-GPL Code") and to
+// distribute linked combinations including the two, subject to the
+// limitations in this paragraph. Non-GPL Code permitted under this
+// exception must only link to the code of FRYSK through those well
+// defined interfaces identified in the file named EXCEPTION found in
+// the source code files (the "Approved Interfaces"). The files of
+// Non-GPL Code may instantiate templates or use macros or inline
+// functions from the Approved Interfaces without causing the
+// resulting work to be covered by the GNU General Public
+// License. Only Red Hat, Inc. may make changes or additions to the
+// list of Approved Interfaces. You must obey the GNU General Public
+// License in all respects for all of the FRYSK code and other code
+// used in conjunction with FRYSK except the Non-GPL Code covered by
+// this exception. If you modify this file, you may extend this
+// exception to your version of the file, but you are not obligated to
+// do so. If you do not wish to provide this exception without
+// modification, you must delete this exception statement from your
+// version and license this file solely under the GPL without
+// exception.
+
+package frysk.debuginfo;
+
+import java.io.File;
+
+import frysk.config.Prefix;
+import frysk.proc.Task;
+import frysk.scopes.Variable;
+import frysk.testbed.DaemonBlockedAtSignal;
+import frysk.testbed.TestLib;
+import frysk.testbed.TestfileTokenScanner;
+import frysk.value.ObjectDeclaration;
+
+/**
+ * These tests test the top-down search which of the search engine. Top down
+ * search does not require a scope, and is simply a flat search of the
+ * debuginfo.
+ */
+public class TestObjectDeclarationSearchEngineTopDown extends TestLib {
+
+    ObjectDeclarationSearchEngine objectDeclarationSearchEngine;
+
+    private File getSrc(String name) {
+	return Prefix.sourceFile("frysk-core/frysk/pkglibdir/" + name);
+    }
+
+    public void testGetObject() {
+	String objectName = "first";
+	String objectToken = objectName;
+	String fileName = "funit-c-scopes";
+	File srcPath = getSrc(fileName + ".c");
+
+	verifyObjectFound(objectName, objectToken, fileName, srcPath);
+    }
+    
+    public void testGetObjectHashFileHashSymbol() {
+	if (unresolved(6459)) {
+	    return;
+	}
+	String objectName = "#funit-scopes-multi-file-b.c#first";
+	String objectToken = "*this*";
+	String fileName = "funit-scopes-multi-file-a";
+	File srcPath = getSrc("funit-scopes-multi-file-b.c");
+
+	verifyObjectFound(objectName, objectToken, fileName, srcPath);
+    }
+    
+    
+    private void verifyObjectFound(String objectName, String objectToken,
+	    String fileName, File srcPath) {
+
+	TestfileTokenScanner scanner = new TestfileTokenScanner(srcPath);
+	int objectLine = scanner.findTokenLine(objectToken);
+	
+	Task task = (new DaemonBlockedAtSignal(fileName)).getMainTask();
+	DebugInfoFrame frame = DebugInfoStackFactory
+		.createVirtualStackTrace(task);
+	objectDeclarationSearchEngine = new ObjectDeclarationSearchEngine(frame);
+	ObjectDeclaration objectDeclaration = (ObjectDeclaration) objectDeclarationSearchEngine
+		.getObject(objectName);
+
+	assertNotNull("Variable found", objectDeclaration);
+	assertEquals("Correct name", objectName, objectDeclaration.getName());
+	assertEquals("Found the correct variable on the correct line ",
+		objectLine, objectDeclaration.getSourceLocation().getLine());
+
+	// Negative test:
+	try {
+	    objectDeclaration = (Variable) objectDeclarationSearchEngine
+		    .getObject("NOT" + objectName);
+	    assertTrue("Exception was not thrown", false);
+	} catch (ObjectDeclarationNotFoundException e) {
+	    // exception was thrown
+	}
+    }
+
+}
diff --git a/frysk-core/frysk/hpd/BreakpointCommand.java b/frysk-core/frysk/hpd/BreakpointCommand.java
index efe1ee0..dad847b 100644
--- a/frysk-core/frysk/hpd/BreakpointCommand.java
+++ b/frysk-core/frysk/hpd/BreakpointCommand.java
@@ -147,7 +147,7 @@ class BreakpointCommand extends ParameterizedCommand {
 		if (declarationSearchEngine != null) {
 		    ObjectDeclaration die;
 		    try {
-			die = declarationSearchEngine.getSymbolDie(breakpt);
+			die = declarationSearchEngine.getObject(breakpt);
 		    } catch (RuntimeException e) {
 			// Symbol not yet visible.
 			die = null;
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index 8ba0b50..852ec6c 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-24  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	Renamed getSymbolDie to getObject.
+	* BreakpointCommand.java: Updated.
+	* ListCommand.java: Updated.
+
 2008-04-23  Teresa Thomas  <tthomas@redhat.com>
 
 	* TestBreakpoints.java (testBreakWithStepping): New.
diff --git a/frysk-core/frysk/hpd/ListCommand.java b/frysk-core/frysk/hpd/ListCommand.java
index 5e54527..372bbf5 100644
--- a/frysk-core/frysk/hpd/ListCommand.java
+++ b/frysk-core/frysk/hpd/ListCommand.java
@@ -213,7 +213,7 @@ class ListCommand extends ParameterizedCommand {
 	ObjectDeclarationSearchEngine declarationSearchEngine = new ObjectDeclarationSearchEngine(frame);
 
 	try {
-	    function = (Function) declarationSearchEngine.getSymbolDie(cmdParm);
+	    function = (Function) declarationSearchEngine.getObject(cmdParm);
 	} catch (ObjectDeclarationNotFoundException e) {
 	    function  = null;
 	}catch (ClassCastException e) {
diff --git a/frysk-core/frysk/hpd/TestListCommand.java b/frysk-core/frysk/hpd/TestListCommand.java
index 5b9e337..bf44966 100644
--- a/frysk-core/frysk/hpd/TestListCommand.java
+++ b/frysk-core/frysk/hpd/TestListCommand.java
@@ -245,7 +245,7 @@ public class TestListCommand extends TestLib {
         e.send("go\n");
         e.expect("go.*\n" + prompt + "Breakpoint");
 	e.sendCommandExpectPrompt("list x", ".*function x not found.*"); 
-	e.sendCommandExpectPrompt("list xyz", ".*symbol xyz not found.*");
+	e.sendCommandExpectPrompt("list xyz", ".*xyz not found.*");
 	e.send("quit\n");
 	e.expect("quit.*\nQuitting...");
         e.close();
diff --git a/frysk-core/frysk/pkglibdir/ChangeLog b/frysk-core/frysk/pkglibdir/ChangeLog
index e3c0fcb..7cda937 100644
--- a/frysk-core/frysk/pkglibdir/ChangeLog
+++ b/frysk-core/frysk/pkglibdir/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-25  Sami Wagiaalla  <swagiaal@toner.yyz.redhat.com>
+
+	* funit-scopes-multi-file-a.c: New file.
+	* funit-scopes-multi-file-b.c: New file.
+
 2008-04-17  Mark Wielaard  <mwielaard@redhat.com>
 
 	* funit-rt-sigraise.c (handler): Make sure entry marker is really on
diff --git a/frysk-core/frysk/pkglibdir/funit-scopes-multi-file-a.c b/frysk-core/frysk/pkglibdir/funit-scopes-multi-file-a.c
new file mode 100644
index 0000000..dd471ee
--- /dev/null
+++ b/frysk-core/frysk/pkglibdir/funit-scopes-multi-file-a.c
@@ -0,0 +1,19 @@
+#include <stdlib.h>
+
+static inline void second(){
+  int* a = 0;
+  a[0] = 0;
+}
+
+
+
+
+static void first(){
+  second();
+}
+
+int main(){
+  first();
+  return 0;
+}
+
diff --git a/frysk-core/frysk/pkglibdir/funit-scopes-multi-file-b.c b/frysk-core/frysk/pkglibdir/funit-scopes-multi-file-b.c
new file mode 100644
index 0000000..ba1756e
--- /dev/null
+++ b/frysk-core/frysk/pkglibdir/funit-scopes-multi-file-b.c
@@ -0,0 +1,13 @@
+#include <stdlib.h>
+
+static inline void second(){
+  int* a = 0;
+  a[0] = 0;
+}
+
+static void first(){// *this* one should be found
+  second();
+  first();
+}
+
+


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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-04-25 20:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-25 20:08 [SCM] master: swagiaal: Added test top-down search tests swagiaal

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