X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Ftestsuite%2Fgdb.base%2Fstructs.exp;h=7bbb937e6e2b67576d4d8e4750600e36ea2eb52e;hb=8b7dbdc92350e95a77548f36c2b537018ca7d52b;hp=edc8d4220e6e28930ece4a0cb270bff88e0161be;hpb=9b254dd1ce46c19dde1dde5b8d1e22e862dfacce;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp index edc8d4220e..7bbb937e6e 100644 --- a/gdb/testsuite/gdb.base/structs.exp +++ b/gdb/testsuite/gdb.base/structs.exp @@ -1,6 +1,6 @@ # This testcase is part of GDB, the GNU debugger. -# Copyright 1996, 1997, 1999, 2003, 2004, 2007, 2008 +# Copyright 1996, 1997, 1999, 2003, 2004, 2007, 2008, 2009 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -16,9 +16,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - if $tracelevel then { strace $tracelevel } @@ -39,6 +36,9 @@ set testfile "structs" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} +# Regex matching any value of `char' type like: a = 65 'A' +set anychar_re {-?[0-9]{1,3} '(.|\\([0-7]{3}|[a-z]|\\|'))'} + # Create and source the file that provides information about the # compiler used to compile the test case. @@ -51,6 +51,7 @@ if [get_compiler_info ${binfile}] { # the last TYPES field). Run the compmiled program up to "main". # Also updates the global "testfile" to reflect the most recent build. +set first 1 proc start_structs_test { types } { global testfile global srcfile @@ -59,6 +60,8 @@ proc start_structs_test { types } { global subdir global srcdir global gdb_prompt + global anychar_re + global first # Create the additional flags set flags "debug" @@ -94,6 +97,8 @@ proc start_structs_test { types } { "set print address off; ${testfile}" gdb_test "set width 0" "" \ "set width 0; ${testfile}" + gdb_test "set print elements 300" "" \ + "set print elements 300; ${testfile}" # Advance to main if { ![runto_main] } then { @@ -103,6 +108,16 @@ proc start_structs_test { types } { # Get the debug format get_debug_format + # Limit the slow $anychar_re{256} matching for better performance. + if $first { + set first 0 + + # Verify $anychar_re can match all the values of `char' type. + gdb_breakpoint [gdb_get_line_number "chartest-done"] + gdb_continue_to_breakpoint "chartest-done" ".*chartest-done.*" + gdb_test "p chartest" "= {({c = ${anychar_re}}, ){255}{c = ${anychar_re}}}" + } + # check that at the struct containing all the relevant types is correct set foo_t "type = struct struct[llength ${types}] \{" for {set n 0} {$n<[llength ${types}]} {incr n} { @@ -164,26 +179,28 @@ proc zed { n } { } proc any { n } { - return [lindex { - "{}" - "{a = \[^,\}\]*}" - "{a = \[^,\}\]*, b = \[^,\}\]*}" - "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*}" - "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*}" - "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*}" - "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*}" - "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*}" - "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*}" - "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*}" - "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*}" - "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*}" - "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*}" - "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*, m = \[^,\}\]*}" - "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*, m = \[^,\}\]*, n = \[^,\}\]*}" - "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*, m = \[^,\}\]*, n = \[^,\}\]*, o = \[^,\}\]*}" - "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*, m = \[^,\}\]*, n = \[^,\}\]*, o = \[^,\}\]*, p = \[^,\}\]*}" - "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*, m = \[^,\}\]*, n = \[^,\}\]*, o = \[^,\}\]*, p = \[^,\}\]*, q = \[^,\}\]*}" - } $n] + global anychar_re + set ac $anychar_re + return [lindex [list \ + "{}" \ + "{a = ${ac}}" \ + "{a = ${ac}, b = ${ac}}" \ + "{a = ${ac}, b = ${ac}, c = ${ac}}" \ + "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}}" \ + "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}}" \ + "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}}" \ + "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}}" \ + "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}}" \ + "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}}" \ + "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}}" \ + "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}}" \ + "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}}" \ + "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}, m = ${ac}}" \ + "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}, m = ${ac}, n = ${ac}}" \ + "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}, m = ${ac}, n = ${ac}, o = ${ac}}" \ + "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}, m = ${ac}, n = ${ac}, o = ${ac}, p = ${ac}}" \ + "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}, m = ${ac}, n = ${ac}, o = ${ac}, p = ${ac}, q = ${ac}}" \ + ] $n] } # Given N (0..25), return the corresponding alphabetic letter in lower