From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21553 invoked by alias); 10 Nov 2007 00:34:27 -0000 Received: (qmail 21523 invoked by uid 440); 10 Nov 2007 00:34:27 -0000 Date: Sat, 10 Nov 2007 00:34:00 -0000 Message-ID: <20071110003427.21507.qmail@sourceware.org> From: scox@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Merge branch 'master' of ssh://sources.redhat.com/git/frysk X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 3b9805588cfd98e0f769f691365f9d55b7204a01 X-Git-Newrev: 15b8b363369e0940cf83a199162a1e4023bf22e5 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/msg00338.txt.bz2 The branch, master has been updated via 15b8b363369e0940cf83a199162a1e4023bf22e5 (commit) via 691f275a213a2eaddb4689b83fee7bfdd8d1842c (commit) via 541b4186e931dab4246e5dc99efa811c06945822 (commit) from 3b9805588cfd98e0f769f691365f9d55b7204a01 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 15b8b363369e0940cf83a199162a1e4023bf22e5 Merge: 691f275a213a2eaddb4689b83fee7bfdd8d1842c 3b9805588cfd98e0f769f691365f9d55b7204a01 Author: Stan Cox Date: Fri Nov 9 19:32:55 2007 -0500 Merge branch 'master' of ssh://sources.redhat.com/git/frysk commit 691f275a213a2eaddb4689b83fee7bfdd8d1842c Merge: 541b4186e931dab4246e5dc99efa811c06945822 8b867fb62647409597fd921ec3e0888e53976190 Author: Stan Cox Date: Fri Nov 9 18:02:57 2007 -0500 Merge branch 'master' of ssh://sources.redhat.com/git/frysk commit 541b4186e931dab4246e5dc99efa811c06945822 Author: Stan Cox Date: Fri Nov 9 18:02:09 2007 -0500 Clean up array display in anticipation of turning on TestTypeEntryValue. * gen-type-expect-tests.py (j.prologue): Throttle ptr tests for now. * gen-type-funit-tests.py (c.add): Filter quotes, new lines, member "." (main): Handle char specially. Match result formatting to fhpd * ArrayType.java (toPrint): Do multiple dimension here. Move vector handling... (toPrintVector): ...here. expectations. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/debuginfo/ChangeLog | 4 + .../frysk/debuginfo/gen-type-expect-tests.py | 14 ++-- frysk-core/frysk/pkglibdir/ChangeLog | 6 ++ frysk-core/frysk/pkglibdir/gen-type-funit-tests.py | 58 +++++++++------ frysk-core/frysk/value/ArrayType.java | 81 ++++++++++++++----- frysk-core/frysk/value/ChangeLog | 6 ++ 6 files changed, 117 insertions(+), 52 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/debuginfo/ChangeLog b/frysk-core/frysk/debuginfo/ChangeLog index 0f09d35..83e86a8 100644 --- a/frysk-core/frysk/debuginfo/ChangeLog +++ b/frysk-core/frysk/debuginfo/ChangeLog @@ -1,3 +1,7 @@ +2007-11-09 Stan Cox + + * gen-type-expect-tests.py (j.prologue): Throttle ptr tests for now. + 2007-11-09 Sami Wagiaalla * TestTypeEntry.java (testClassWithStaticMembers): New test. diff --git a/frysk-core/frysk/debuginfo/gen-type-expect-tests.py b/frysk-core/frysk/debuginfo/gen-type-expect-tests.py index 7b6f526..4d748ec 100644 --- a/frysk-core/frysk/debuginfo/gen-type-expect-tests.py +++ b/frysk-core/frysk/debuginfo/gen-type-expect-tests.py @@ -114,7 +114,6 @@ public class %s extends TestLib { System.out.println("Error: Cannot find " + expect[i].symbol); assertNotNull(varDie); varType = typeEntry.getType(varDie.getType()); - // System.out.println("Expect: " + expect[i].symbol + "\\n'" + expect[i].output + "'\\nGot:\\n'" + valueString + "'"); assertNotNull(varType); assertEquals(myName + expect[i].symbol, expect[i].output, varType.toPrint()); } @@ -128,11 +127,9 @@ public class %s extends TestLib { ByteArrayOutputStream baos = new ByteArrayOutputStream(32); PrintWriter pw = new PrintWriter(baos, true); for (int i = 0; i < expect.length; i++) { - // ??? cache address of x so &x can be checked - if (expect[i].output.indexOf("&") >= 0) - continue; - // ??? ignore char for now - if (expect[i].symbol.indexOf("char_") >= 0) + // ??? cache address of x so &x can be checked? + if (expect[i].output.indexOf("&") >= 0 + || expect[i].symbol.indexOf("ptr") >= 0) continue; DwarfDie varDie = die.getScopeVar(allDies, expect[i].symbol); if (varDie == null) @@ -143,7 +140,9 @@ public class %s extends TestLib { value.toPrint(pw, task.getMemory(), Format.NATURAL); pw.flush(); String valueString = baos.toString(); -// System.out.println("Expect: " + expect[i].symbol + "\\n'" + expect[i].output + "'\\nGot:\\n'" + valueString + "'"); + // System.out.println("Expect: " + expect[i].symbol + + // "\\n'" + expect[i].output + "'\\nGot:\\n'" + + // valueString + "'" + " " + value.getType()); assertEquals(myName + expect[i].symbol, expect[i].output, valueString); baos.reset(); } @@ -169,6 +168,7 @@ public class %s extends TestLib { def start_test(self, tool, name): print(" public void test%s () {" % (name)) +# if (tool == "value" and (name == "Enum" or name == "Struct")): if (tool == "value"): print(''' if (unresolved(5235)) diff --git a/frysk-core/frysk/pkglibdir/ChangeLog b/frysk-core/frysk/pkglibdir/ChangeLog index f4de0b2..5901a1e 100644 --- a/frysk-core/frysk/pkglibdir/ChangeLog +++ b/frysk-core/frysk/pkglibdir/ChangeLog @@ -1,3 +1,9 @@ +2007-11-09 Stan Cox + + * gen-type-funit-tests.py (c.add): Filter quotes, new lines, member "." + (main): Handle char specially. Match result formatting to fhpd + expectations. + 2007-11-05 Sami Wagiaalla * funit-cpp-scopes-class-static.cxx: Removed print statement. diff --git a/frysk-core/frysk/pkglibdir/gen-type-funit-tests.py b/frysk-core/frysk/pkglibdir/gen-type-funit-tests.py index 8a2f744..6150c40 100644 --- a/frysk-core/frysk/pkglibdir/gen-type-funit-tests.py +++ b/frysk-core/frysk/pkglibdir/gen-type-funit-tests.py @@ -21,7 +21,8 @@ class c: self.write(" = " + initial) self.c_file.write(";\n") self.c_file.write("// Name: " + var + var_suffix + "\n") - self.c_file.write("// Value: " + initial + "\n") + # Escape quotes and new lines, remove struct member "." + self.c_file.write("// Value: " + initial.replace('"','\\"').replace('\n',"\\n").replace('{.','{').replace(' .',' ') + "\n") self.c_file.write("// Type: ") type += type_arr self.c_file.write(type.replace("\n", "\n// Type: ")) @@ -79,14 +80,14 @@ for t in sys.argv: # base types we generate variables for. used to index into limits map base_types=('char','short int','int','long int','long long int','float','double') # Used for variable initialization -limits={'char' : {'min' : '41', 'max' : '176'}, +limits={'char' : {'min' : "'!'", 'max' : "'~'"}, 'short int' : {'min' : '-32767', 'max' : '32767'}, - 'int' : {'min' : '-2147483647', 'max' : '2147483647'}, - 'long int' : {'min' : '-2147483647L', 'max' : '2147483647L'}, - 'long long int' : {'min' : '-9223372036854775807LL', - 'max' : '9223372036854775807LL'}, - 'float' : {'min' : '1.175494E-38', 'max' : '3.402823E+38'}, - 'double' : {'min' : '2.225074E-308', 'max' : '1.797693E+308'} + 'int' : {'min' : '-65536', 'max' : '65536'}, + 'long int' : {'min' : '-65536', 'max' : '65536'}, + 'long long int' : {'min' : '-65536', + 'max' : '65536'}, + 'float' : {'min' : '1.1754939E-38', 'max' : '3.402823E38'}, + 'double' : {'min' : '2.225074E-308', 'max' : '1.797693E308'} } type_modifiers=('const','volatile') @@ -136,26 +137,37 @@ for t in base_types: ts = t.replace(" ","_") min = limits[t]['min'] max = limits[t]['max'] - c_file.add(t, "arr_%s" % ts, "{%s,%s}" % (min,max), " [2]") - c_file.add(t, "arr_arr_%s" % ts, "{{%s,%s},{%s,%s}}" % (min,max,min,max), " [2][2]") - c_file.add(t, "arr_arr_arr_%s" % ts, "{{{%s,%s},{%s,%s}},{{%s,%s},{%s,%s}}}" % (min,max,min,max,min,max,min,max), " [2][2][2]") - c_file.add("%s *" % t, "arr_ptr_arr_arr_%s" % ts, "{arr_arr_%s[0],arr_arr_%s[1]}" % (ts,ts), " [2]") - c_file.add("%s (*" % t, "ptr_arr_%s" % ts, "&arr_%s" % ts, ")[2]") + if (t == "char"): + char1 = min.strip("'") + char2 = max.strip("'") + c_file.add(t, "arr_%s" % ts, '"%s%s"' % (char1,char2), " [2]") + c_file.add(t, "arr_arr_%s" % ts, '{{"%s%s"},{"%s%s"}}' % (char1,char2,char1,char2), " [2][2]") + c_file.add(t, "arr_arr_arr_%s" % ts, '{{{"%s%s"},{"%s%s"}},{{"%s%s"},{"%s%s"}}}' % (char1,char2,char1,char2,char1,char2,char1,char2), " [2][2][2]") + c_file.add("%s *" % t, "arr_ptr_arr_arr_%s" % ts, "{arr_arr_%s[0],arr_arr_%s[1]}" % (ts,ts), " [2]") + c_file.add("%s (*" % t, "ptr_arr_%s" % ts, "&arr_%s" % ts, ")[2]") + else: + c_file.add(t, "arr_%s" % ts, "{%s,%s}" % (min,max), " [2]") + c_file.add(t, "arr_arr_%s" % ts, "{{%s,%s},{%s,%s}}" % (min,max,min,max), " [2][2]") + c_file.add(t, "arr_arr_arr_%s" % ts, "{{{%s,%s},{%s,%s}},{{%s,%s},{%s,%s}}}" % (min,max,min,max,min,max,min,max), " [2][2][2]") + c_file.add(t, "arr_arr_arr_arr_%s" % ts, + "{{{{%s,%s},{%s,%s},{%s,%s}},{{%s,%s},{%s,%s},{%s,%s}}},{{{%s,%s},{%s,%s},{%s,%s}},{{%s,%s},{%s,%s},{%s,%s}}},{{{%s,%s},{%s,%s},{%s,%s}},{{%s,%s},{%s,%s},{%s,%s}}}}" % (min,max,min,max,min,max,min,max,min,max,min,max,min,max,min,max,min,max,min,max,min,max,min,max,min,max,min,max,min,max,min,max,min,max,min,max), " [3][2][3][2]") + c_file.add("%s *" % t, "arr_ptr_arr_arr_%s" % ts, "{arr_arr_%s[0],arr_arr_%s[1]}" % (ts,ts), " [2]") + c_file.add("%s (*" % t, "ptr_arr_%s" % ts, "&arr_%s" % ts, ")[2]") c_file.write("\nstatic int one = 1, two = 2, three = 3, four = 4;\n") -c_file.add("struct {\n int int_var;\n}", "arr_struct", "{{1},{2}}", " [2]") -c_file.add("union {\n int int_var;\n float fl;\n}", "arr_union", "{{1},{2}}", " [2]") -c_file.add("struct {\n int int_var;\n}", "arr_arr_struct", "{{{1},{2}},{{3},{4}}}", " [2][2]") -c_file.add("union {\n int int_var;\n float float_var;\n}", "arr_arr_union", "{{{1},{2}},{{3},{4}}}", " [2][2]") +c_file.add("struct {\n int int_var;\n}", "arr_struct", "{{.int_var=1,\n},{.int_var=2,\n}}", " [2]") +c_file.add("union {\n int int_var;\n float fl;\n}", "arr_union", "{{.int_var=1,\n .fl=1.4012985E-45,\n},{.int_var=1073741824,\n .fl=2.0,\n}}", " [2]") +c_file.add("struct {\n int int_var;\n}", "arr_arr_struct", "{{{.int_var=1,\n},{.int_var=2,\n}},{{.int_var=3,\n},{.int_var=4,\n}}}", " [2][2]") +c_file.add("union {\n int int_var;\n float float_var;\n}", "arr_arr_union", "{{{.int_var=1,\n .float_var=1.4012985E-45,\n},{.int_var=2,\n .float_var=2.802597E-45,\n}},{{.int_var=3,\n .float_var=4.2038954E-45,\n},{.int_var=4,\n .float_var=5.605194E-45,\n}}}", " [2][2]") c_file.add("int *", "arr_arr_ptr", "{{&one,&two},{&three,&four}}", " [2][2]") -c_file.add("struct {\n int arr_int[2];\n}", "arr_struct_arr_int", "{{{1, 2}}, {{3, 4}}}", " [2]") -c_file.add("struct {\n struct {\n int int_var;\n } struct_a;\n}", "arr_struct_struct", "{{{1}},{{2}}}", " [2]") -c_file.add("struct {\n union {\n int int_var;\n float float_var;\n } struct_a;\n}", "arr_struct_union", "{{{1}},{{2}}}", " [2]") +c_file.add("struct {\n int arr_int[2];\n}", "arr_struct_arr_int", "{{.arr_int={1,2},\n},{.arr_int={3,4},\n}}", " [2]") +c_file.add("struct {\n struct {\n int int_var;\n } struct_a;\n}", "arr_struct_struct", "{{.struct_a={.int_var=1,\n},\n},{.struct_a={.int_var=2,\n},\n}}", " [2]") +c_file.add("struct {\n union {\n int int_var;\n float float_var;\n } struct_a;\n}", "arr_struct_union", "{{.struct_a={.int_var=1,\n .float_var=1.4012985E-45,\n},\n},{.struct_a={.int_var=2,\n .float_var=2.802597E-45,\n},\n}}", " [2]") c_file.add("struct {\n int * ptr;\n}", "arr_struct_ptr", "{{&one},{&two}}", " [2]") -c_file.add("union {\n int arr_int[2];\n float arr_float[2];\n}", "arr_union_arr_int", "{{{1, 2}}, {{3, 4}}}", " [2]") -c_file.add("union {\n struct {\n int int_var;\n } struct_a;\n}", "arr_union_struct", "{{{1}}, {{2}}}", " [2]") -c_file.add("union {\n union {\n int int_var;\n } union_a;\n}", "arr_union_union", "{{{1}}, {{2}}}", " [2]") +c_file.add("union {\n int arr_int[2];\n float arr_float[2];\n}", "arr_union_arr_int", "{{.arr_int={1,2},\n .arr_float={1.4012985E-45,2.802597E-45},\n},{.arr_int={3,4},\n .arr_float={4.2038954E-45,5.605194E-45},\n}}", " [2]") +c_file.add("union {\n struct {\n int int_var;\n } struct_a;\n}", "arr_union_struct", "{{.struct_a={.int_var=1,\n},\n},{.struct_a={.int_var=2,\n},\n}}", " [2]") +c_file.add("union {\n union {\n int int_var;\n } union_a;\n}", "arr_union_union", "{{.union_a={.int_var=1,\n},\n},{.union_a={.int_var=2,\n},\n}}", " [2]") c_file.add("union {\n int * ptr;\n}", "arr_union_ptr", "{{&one}, {&two}}", " [2]", ) # ??? fails # c_file.add("int (*", "arr_ptr_arr", "{&arr_int, &arr_int}", " [2])[2]") diff --git a/frysk-core/frysk/value/ArrayType.java b/frysk-core/frysk/value/ArrayType.java index 6eb0893..9505874 100644 --- a/frysk-core/frysk/value/ArrayType.java +++ b/frysk-core/frysk/value/ArrayType.java @@ -166,39 +166,76 @@ public class ArrayType Location loc = PieceLocation.createSimpleLoc (var1.getLocation().getAddress(), type.getSize(), taskMem); return new Value (type, loc); - } - + } + void toPrint(PrintWriter writer, Location location, ByteBuffer memory, Format format) { - if (type instanceof CharType) { - // Treat it as a character string + // XXX: Add dimension start/end instead of assuming {} + for (int i = 0; i < dimension.length - 1; i++) + writer.print("{"); + for (ArrayIterator e = new ArrayIterator(location); e.hasNext(); ) { + if (e.idx > 0) { + for (int i = 0; i < stride.length - 2; i++) + if ((e.idx % stride[i]) == 0) + writer.print("}"); + if ((e.idx % stride[stride.length - 2]) == 0) + writer.print(","); + for (int i = 0; i < stride.length - 2; i++) + if ((e.idx % stride[i]) == 0) + writer.print("{"); + } + if (! toPrintVector(writer, type, e, memory, format)) + break; + } + for (int i = 0; i < dimension.length - 1; i++) + writer.print("}"); + } + + private boolean toPrintVector(PrintWriter writer, Type type, ArrayIterator e, + ByteBuffer memory, Format format) + { + boolean isVector = dimension.length == 1; + int vectorLength = dimension[dimension.length - 1]; + boolean haveCharType; + boolean noNullByte = true; + if (type instanceof CharType) + haveCharType = true; + else + haveCharType = false; + + if (haveCharType) { + if (! isVector) + writer.print("{"); writer.print("\""); - for (ArrayIterator e = new ArrayIterator(location); - e.hasNext(); ) { - Location l = (Location)e.next(); + } + else + writer.print("{"); + + for (int i = 0; i < vectorLength; i++) { + Location l = (Location)e.next(); + if (haveCharType) { BigInteger c = ((CharType)type).getBigInteger(l); - if (c.equals(BigInteger.ZERO)) + if (c.equals(BigInteger.ZERO)) { + noNullByte = false; break; // NUL + } writer.print((char)c.longValue()); } - writer.print("\""); - } else { - for (int i = 0; i < dimension.length; i++) - writer.print("{"); - for (ArrayIterator e = new ArrayIterator(location); - e.hasNext(); ) { - if (e.idx > 0) { - if ((e.idx % dimension[dimension.length - 1]) == 0) - writer.print("},{"); - else - writer.print(","); - } - Location l = (Location)e.next(); + else { type.toPrint(writer, l, memory, format); + if (i < vectorLength - 1) + writer.print(","); } - for (int i = 0; i < dimension.length; i++) + } + + if (haveCharType) { + writer.print("\""); + if (! isVector) writer.print("}"); } + else + writer.print("}"); + return noNullByte; } public void toPrint(String s, PrintWriter writer) { diff --git a/frysk-core/frysk/value/ChangeLog b/frysk-core/frysk/value/ChangeLog index f89f379..48bf9aa 100644 --- a/frysk-core/frysk/value/ChangeLog +++ b/frysk-core/frysk/value/ChangeLog @@ -1,3 +1,9 @@ +2007-11-09 Stan Cox + + * ArrayType.java (toPrint): Do multiple dimension here. Move + vector handling... + (toPrintVector): ...here. + 2007-11-09 Teresa Thomas * TestValue.java (testIntOps): Test for logicalNegation, hooks/post-receive -- frysk system monitor/debugger