From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5637 invoked by alias); 29 Nov 2007 22:35:30 -0000 Received: (qmail 5611 invoked by uid 440); 29 Nov 2007 22:35:30 -0000 Date: Thu, 29 Nov 2007 22:35:00 -0000 Message-ID: <20071129223530.5596.qmail@sourceware.org> From: scox@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Begin using gen-type-expect-tests.py for c++ testing. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: e65e53aed86595298619ffb9d6a221da423e74cf X-Git-Newrev: 5cc85271b84eb2fd9816e0a169e285cb8f200987 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: 2007-q4/txt/msg00498.txt.bz2 The branch, master has been updated via 5cc85271b84eb2fd9816e0a169e285cb8f200987 (commit) via 71feb4ff647040f5bd9b44f0b13df1d4cae6fb68 (commit) from e65e53aed86595298619ffb9d6a221da423e74cf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 5cc85271b84eb2fd9816e0a169e285cb8f200987 Author: Stan Cox Date: Thu Nov 29 13:55:55 2007 -0500 Begin using gen-type-expect-tests.py for c++ testing. * funit-class.cxx: Add comments for gen-type-expect-test.py. commit 71feb4ff647040f5bd9b44f0b13df1d4cae6fb68 Author: Stan Cox Date: Thu Nov 29 07:50:06 2007 -0500 Begin using gen-type-expect-tests.py for c++ testing. * TypeEntry.java (getType): Add REFERENCE_TYPE_ and SUBROUTINE_TYPE_. * gen-type-expect-tests.py (main): Improve multiple input file handling. * TestTypeEntryType.java-sh: Add funit-class.cxx. * TestTypeEntryValue.java-sh: Likewise. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/debuginfo/ChangeLog | 9 ++- .../frysk/debuginfo/TestTypeEntryType.java-sh | 2 +- .../frysk/debuginfo/TestTypeEntryValue.java-sh | 2 +- frysk-core/frysk/debuginfo/TypeEntry.java | 17 +++-- .../frysk/debuginfo/gen-type-expect-tests.py | 11 ++- frysk-core/frysk/pkglibdir/ChangeLog | 4 + frysk-core/frysk/pkglibdir/funit-class.cxx | 92 +++++++++++++++---- 7 files changed, 104 insertions(+), 33 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/debuginfo/ChangeLog b/frysk-core/frysk/debuginfo/ChangeLog index 86b763b..905d003 100644 --- a/frysk-core/frysk/debuginfo/ChangeLog +++ b/frysk-core/frysk/debuginfo/ChangeLog @@ -1,3 +1,10 @@ +2007-11-29 Stan Cox + + * TypeEntry.java (getType): Add REFERENCE_TYPE_ and SUBROUTINE_TYPE_. + * gen-type-expect-tests.py (main): Improve multiple input file handling. + * TestTypeEntryType.java-sh: Add funit-class.cxx. + * TestTypeEntryValue.java-sh: Likewise. + 2007-11-29 Teresa Thomas * PieceLocation.java (pieceOf): Modify exception messages. @@ -14,7 +21,7 @@ 2007-11-29 Sami Wagiaalla - * LocationExpression.java (LocationExpression): Removed ops from + * LocationExpression.java (LocationExpression): Removed ops from constructor. * TestLocationExpression.java: Updated. * TestAddress.java: Updated. diff --git a/frysk-core/frysk/debuginfo/TestTypeEntryType.java-sh b/frysk-core/frysk/debuginfo/TestTypeEntryType.java-sh index 1eb6d63..9911fad 100644 --- a/frysk-core/frysk/debuginfo/TestTypeEntryType.java-sh +++ b/frysk-core/frysk/debuginfo/TestTypeEntryType.java-sh @@ -1,5 +1,5 @@ #!/bin/sh -python $(dirname $0)/gen-type-expect-tests.py -type frysk/pkglibdir/funit-type-entry.c +python $(dirname $0)/gen-type-expect-tests.py -type frysk/pkglibdir/funit-type-entry.c $(dirname $0)/../pkglibdir/funit-class.cxx diff --git a/frysk-core/frysk/debuginfo/TestTypeEntryValue.java-sh b/frysk-core/frysk/debuginfo/TestTypeEntryValue.java-sh index ad26efd..de20fbe 100644 --- a/frysk-core/frysk/debuginfo/TestTypeEntryValue.java-sh +++ b/frysk-core/frysk/debuginfo/TestTypeEntryValue.java-sh @@ -1,3 +1,3 @@ #!/bin/sh -python $(dirname $0)/gen-type-expect-tests.py -value frysk/pkglibdir/funit-type-entry.c +python $(dirname $0)/gen-type-expect-tests.py -value frysk/pkglibdir/funit-type-entry.c $(dirname $0)/../pkglibdir/funit-class.cxx diff --git a/frysk-core/frysk/debuginfo/TypeEntry.java b/frysk-core/frysk/debuginfo/TypeEntry.java index d1b5861..5aac115 100644 --- a/frysk-core/frysk/debuginfo/TypeEntry.java +++ b/frysk-core/frysk/debuginfo/TypeEntry.java @@ -48,6 +48,7 @@ import frysk.value.EnumType; import frysk.value.FunctionType; import frysk.value.GccStructOrClassType; import frysk.value.PointerType; +import frysk.value.ReferenceType; import frysk.value.SignedType; import frysk.value.StandardTypes; import frysk.value.Type; @@ -298,6 +299,7 @@ public class TypeEntry return (null); switch (varDie.getTag().hashCode()) { + case DwTag.SUBROUTINE_TYPE_: case DwTag.SUBPROGRAM_: { Type type = null; if (varDie.getUltimateType() != null) { @@ -353,10 +355,9 @@ public class TypeEntry Type returnType = null; switch (type.getTag().hashCode()) { - case DwTag.TYPEDEF_: { + case DwTag.TYPEDEF_: returnType = new TypeDef(type.getName(), getType (type.getType())); break; - } case DwTag.POINTER_TYPE_: { Type ptrTarget = getType(type.getType()); if (ptrTarget == null) @@ -365,6 +366,9 @@ public class TypeEntry ptrTarget); break; } + case DwTag.REFERENCE_TYPE_: + returnType = new ReferenceType(getType(type.getType())); + break; case DwTag.ARRAY_TYPE_: { DwarfDie subrange = type.getChild(); returnType = getArrayType(type.getType(), subrange); @@ -394,14 +398,15 @@ public class TypeEntry returnType = enumType; break; } - case DwTag.VOLATILE_TYPE_: { + case DwTag.VOLATILE_TYPE_: returnType = new VolatileType(getType(type.getType())); break; - } - case DwTag.CONST_TYPE_: { + case DwTag.CONST_TYPE_: returnType = new ConstType(getType(type.getType())); break; - } + case DwTag.SUBROUTINE_TYPE_: + returnType = getSubprogramValue(type).getType(); + break; case DwTag.BASE_TYPE_: switch (type.getAttrConstant(DwAt.ENCODING)) { case DwAte.SIGNED_: diff --git a/frysk-core/frysk/debuginfo/gen-type-expect-tests.py b/frysk-core/frysk/debuginfo/gen-type-expect-tests.py index 7a8db24..ef2690f 100644 --- a/frysk-core/frysk/debuginfo/gen-type-expect-tests.py +++ b/frysk-core/frysk/debuginfo/gen-type-expect-tests.py @@ -128,7 +128,8 @@ public class %s extends TestLib { for (int i = 0; i < expect.length; i++) { // ??? cache address of x so &x can be checked? if (expect[i].output.indexOf("&") >= 0 - || expect[i].symbol.indexOf("ptr") >= 0) + || expect[i].symbol.indexOf("ptr") >= 0 + || expect[i].output.length() == 0) continue; DwarfDie varDie = die.getScopeVar(allDies, expect[i].symbol); if (varDie == null) @@ -186,7 +187,7 @@ public class %s extends TestLib { print('\t new Expect("%s","%s"),' % (name, value)) def end_test(self, executable, name): - tokens = executable.split(".") + tokens = os.path.abspath(executable).split(".") print(''' }; @@ -255,6 +256,7 @@ if (tool == ""): current_file += 1 d_file = open_file(current_file) +filename = sys.argv[current_file] j_file = j() j_file.open(tool) j_file.prologue() @@ -282,7 +284,8 @@ while (True): # Collect test info if (tokens[1] == "Test:"): if (test != "Types"): - j_file.end_test(sys.argv[current_file], test) + j_file.end_test(filename, test) + filename = sys.argv[current_file] test = line[line.find(tokens[1]) + len(tokens[1]) + 1:].rstrip() j_file.start_test(tool, test) elif (tokens[1] == "Name:"): @@ -296,5 +299,5 @@ while (True): except IndexError: True -j_file.end_test(sys.argv[current_file-1], test) +j_file.end_test(filename, test) j_file.epilogue(debug) diff --git a/frysk-core/frysk/pkglibdir/ChangeLog b/frysk-core/frysk/pkglibdir/ChangeLog index 3e9b2b6..0c70fe5 100644 --- a/frysk-core/frysk/pkglibdir/ChangeLog +++ b/frysk-core/frysk/pkglibdir/ChangeLog @@ -1,3 +1,7 @@ +2007-11-29 Stan Cox + + * funit-class.cxx: Add comments for gen-type-expect-test.py. + 2007-11-29 Andrew Cagney * funit-regs.S (main): Jump to the known symbol "crash". diff --git a/frysk-core/frysk/pkglibdir/funit-class.cxx b/frysk-core/frysk/pkglibdir/funit-class.cxx index a84e125..4378ab6 100644 --- a/frysk-core/frysk/pkglibdir/funit-class.cxx +++ b/frysk-core/frysk/pkglibdir/funit-class.cxx @@ -6,23 +6,14 @@ static void crash (){ a[0] = 0; } -static int assign_ (int) __attribute__ ((noinline)); -int -assign_ (int a) -{ - return 2; -} - class Base1 { public: Base1 (const char *m):msg (m) { - // std::cout << "Base1::Base1(" << msg << ")" << std::endl; } ~Base1 () { - // std::cout << "Base1::~Base1(" << msg << ")" << std::endl; } const char *msg; }; @@ -32,11 +23,9 @@ class Base2 public: Base2 (const char *m):msg (m) { - // std::cout << "Base2::Base2(" << msg << ")" << std::endl; } ~Base2 () { - // std::cout << "Base2::~Base2(" << msg << ")" << std::endl; } const char *msg; }; @@ -46,11 +35,9 @@ class Type : public Base1, public Base2 public: Type(const char *m, const char *n, const char *o) : Base1(m), Base2(n), note(o) { - // std::cout << "Type::Type(" << note << ")" << std::endl; } ~Type() { - // std::cout << "Type::~Type(" << note << ")" << std::endl; } private: const char *note; @@ -78,26 +65,91 @@ public: private: template TYPE do_this_impl(TYPE t) { - // std::cout << t << std::endl; return t; } }; -static Type mb("static", "main", "mb"); -static Type new_base = Type ("new base", "main", "new_base"); -static Derived xyz; +// Test: class +// Name: mb +// Type: class Type { +// Type: public: +// Type: struct Base1 { +// Type: const char * msg; +// Type: void Base1 (const char * ); +// Type: void ~Base1 (); +// Type: } ; +// Type: struct Base2 { +// Type: const char * msg; +// Type: void Base2 (const char * ); +// Type: void ~Base2 (); +// Type: } ; +// Type: private: +// Type: const char * note; +// Type: void Type (const char * ,const char * ,const char * ); +// Type: void ~Type (); +// Type: } + +Type mb("static", "main", "mb"); + +// Name: new_base +// Type: class Type { +// Type: public: +// Type: struct Base1 { +// Type: const char * msg; +// Type: void Base1 (const char * ); +// Type: void ~Base1 (); +// Type: } ; +// Type: struct Base2 { +// Type: const char * msg; +// Type: void Base2 (const char * ); +// Type: void ~Base2 (); +// Type: } ; +// Type: private: +// Type: const char * note; +// Type: void Type (const char * ,const char * ,const char * ); +// Type: void ~Type (); +// Type: } + +Type new_base = Type ("new base", "main", "new_base"); + +// Name: xyz +// Type: class Derived { +// Type: public: +// Type: struct Base3 { +// Type: int () * * _vptr.Base3; +// Type: void Base3 (void * const & ); +// Type: void Base3 (); +// Type: char do_this (char ); +// Type: short int do_this (short int ); +// Type: int do_this (int ); +// Type: float do_this (float ); +// Type: void ~Base3 (); +// Type: } ; +// Type: void Derived (void * const & ); +// Type: void Derived (); +// Type: char do_this (char ); +// Type: short int do_this (short int ); +// Type: int do_this (int ); +// Type: float do_this (float ); +// Type: void ~Derived (); +// Type: private: +// Type: char do_this_impl (char ); +// Type: short int do_this_impl (short int ); +// Type: int do_this_impl (int ); +// Type: float do_this_impl (float ); +// Type: } + +Derived xyz; static void func () __attribute__ ((noinline)); void func () { - // std::cout << "main" << std::endl; xyz.do_this ((char)'1'); xyz.do_this ((short)2); xyz.do_this ((int)3); xyz.do_this ((float) 4.1); - int x = xyz.do_this ((int)1); - x = assign_(x); + xyz.do_this ((int)1); crash(); } hooks/post-receive -- frysk system monitor/debugger