From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22102 invoked by alias); 25 Apr 2008 20:08:41 -0000 Received: (qmail 22072 invoked by uid 9561); 25 Apr 2008 20:08:40 -0000 Date: Fri, 25 Apr 2008 20:08:00 -0000 Message-ID: <20080425200840.22057.qmail@sourceware.org> From: swagiaal@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: swagiaal: Added test top-down search tests. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 72355250a9426adb9535df657c57434d6d7c861a X-Git-Newrev: 7ec5eccf2b3df6cae57c60ff14a7bbc2b6803718 Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2008-q2/txt/msg00158.txt.bz2 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 Date: Fri Apr 25 15:00:47 2008 -0400 swagiaal: Added test top-down search tests. frysk-core/ChangeLog +2008-04-25 Sami Wagiaalla + + * Makefile.am: Added rule to link two files into one + executable for test case. + frysk-core/frysk/debuginfo/ChangeLog +2008-04-25 Sami Wagiaalla + + * TestObjectDeclarationSearchEngineTopDown.java: New file. + frysk-core/frysk/pkglibdir/ChangeLog +2008-04-25 Sami Wagiaalla + + * funit-scopes-multi-file-a.c: New file. + * funit-scopes-multi-file-b.c: New file. + commit af0cb6135c719b034aa6395acf2880226cdd0e68 Author: Sami Wagiaalla Date: Thu Apr 24 14:09:35 2008 -0400 swagiaal: Renamed getSymbolDie to getObject. frysk-core/frysk/debuginfo/ChangeLog +2008-04-24 Sami Wagiaalla + + * ObjectDeclarationSearchEngine.java: renamed getSymbolDie to + getObject. + frysk-core/frysk/hpd/ChangeLog +2008-04-24 Sami Wagiaalla + + 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 + + * Makefile.am: Added rule to link two files into one + executable for test case. + 2008-04-11 Andrew Cagney * 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 +2008-04-25 Sami Wagiaalla + + * TestObjectDeclarationSearchEngineTopDown.java: New file. + +2008-04-24 Sami Wagiaalla + + * ObjectDeclarationSearchEngine.java: renamed getSymbolDie to + getObject. + +2008-04-24 Sami Wagiaalla * 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 + + Renamed getSymbolDie to getObject. + * BreakpointCommand.java: Updated. + * ListCommand.java: Updated. + 2008-04-23 Teresa Thomas * 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 + + * funit-scopes-multi-file-a.c: New file. + * funit-scopes-multi-file-b.c: New file. + 2008-04-17 Mark Wielaard * 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 + +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 + +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