From: Fred Fish Date: Sat, 28 Jun 1997 06:03:43 +0000 (+0000) Subject: * lib/gdb.exp (setup_xfail_format): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=70742cd83193a0f11047a5158a60217cfe99dadd;p=binutils-gdb.git * lib/gdb.exp (setup_xfail_format): New function. (get_debug_format): New function to get debug format. (debug_format): New global variable to hold last value set by get_debug_format. * gdb.base/list.exp: Call get_debug_format and expect some tests to fail for DWARF 1 and COFF formats. * gdb.c++/ptype.exp: Ditto. * gdb.c++/classes.exp: Ditto. * gdb.c++/cplusfuncs.exp: Ditto. * gdb.c++/inherit.exp: Ditto. * gdb.c++/templates.exp: Ditto. * gdb.c++/virtfunc.exp: Ditto. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 8227fb42b30..05590ac9d08 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,18 @@ +Fri Jun 27 07:44:25 1997 Fred Fish + + * lib/gdb.exp (setup_xfail_format): New function. + (get_debug_format): New function to get debug format. + (debug_format): New global variable to hold last value set + by get_debug_format. + * gdb.base/list.exp: Call get_debug_format and expect some + tests to fail for DWARF 1 and COFF formats. + * gdb.c++/ptype.exp: Ditto. + * gdb.c++/classes.exp: Ditto. + * gdb.c++/cplusfuncs.exp: Ditto. + * gdb.c++/inherit.exp: Ditto. + * gdb.c++/templates.exp: Ditto. + * gdb.c++/virtfunc.exp: Ditto. + Wed Jun 25 09:08:51 1997 Bob Manson * lib/gdb.exp(default_gdb_exit): Don't give an error if the remote diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp index 88991cb01e0..f38a1ddf0b3 100644 --- a/gdb/testsuite/gdb.base/list.exp +++ b/gdb/testsuite/gdb.base/list.exp @@ -29,9 +29,6 @@ set bug_id 0 set testfile "list" set binfile ${objdir}/${subdir}/${testfile} -# There are some rather large lines in some of these source files. -set match_max 10000; - # Need to download the header to the host. remote_download host ${srcdir}/${subdir}/list0.h list0.h @@ -83,10 +80,18 @@ proc test_listsize {} { # This doesn't work for COFF targets. setup_xfail "a29k-*-udi" + if ![isnative] { + if [target_info exists gdb,start_symbol] { + set startsym [target_info gdb,start_symbol]; + } else { + set startsym "start"; + } + gdb_test "set \$pc=$startsym" "" "" + } gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*10\[ \t\]+x = 0;|2.*11\[ \t\]+foo .x\[+)\]+;)" "list default lines around main" - + # Ensure we can limit printouts to one line - + if [ set_listsize 1 ] then { setup_xfail "*-*-*" gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 1" @@ -151,12 +156,14 @@ proc test_listsize {} { proc test_list_include_file {} { global gdb_prompt - # FIXME Fails for COFF as well, I think. setup_xfail "a29k-*-udi" + setup_xfail_format "DWARF 1" + setup_xfail_format "COFF" gdb_test "list list0.h:1" "1\[ \t\]+/\[*\]+ An include file .*5\[ \t\]+foo \[(\]+x\[)\]+" "list line 1 in include file" - # FIXME Fails for COFF as well, I think. setup_xfail "a29k-*-udi" + setup_xfail_format "DWARF 1" + setup_xfail_format "COFF" gdb_test "list list0.h:100" "Line number 95 out of range; .*list0.h has 36 lines." "list message for lines past EOF" } @@ -227,6 +234,7 @@ proc test_list_function {} { # Ultrix gdb is the second case, still correct. # SunPRO cc is the third case. setup_xfail "powerpc-*-*" + setup_xfail_format "DWARF 1" gdb_test "list foo" "(3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;|2\[ \t\]+including file.*11\[ \t\]+bar \[(\]+.*\[)\]+;|1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;)" "list function in include file" } @@ -375,8 +383,9 @@ proc test_list_filename_and_function {} { # SunPRO cc is the third case. setup_xfail "rs6000-*-*" 1804 setup_xfail "powerpc-*-*" 1804 - # FIXME Fails for COFF as well, I think. setup_xfail "a29k-*-udi" + setup_xfail_format "DWARF 1" + setup_xfail_format "COFF" send_gdb "list list0.h:foo\n" gdb_expect { -re "2\[ \t\]+including file. This.*11\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { @@ -447,6 +456,7 @@ proc test_list_filename_and_function {} { gdb_test "list foobar.c:main" "No source file named foobar.c." "list filename:function; nonexistant file" + setup_xfail_format "DWARF 1" gdb_test "list list0.h:foobar" "Function \"foobar\" not defined." "list filename:function; nonexistant function" } @@ -470,7 +480,6 @@ proc test_forward_search {} { set oldtimeout $timeout set timeout [expr "$timeout + 300"] verbose "Timeout is now $timeout seconds" 2 - match_max 10000 gdb_test "search 1234" ".*1234.*" "search extremely long line (> 5000 chars)" set timeout $oldtimeout verbose "Timeout is now $timeout seconds" 2 @@ -496,6 +505,7 @@ if [target_info exists gdb_stub] { gdb_test "set width 0" "" "set width 0" test_listsize +get_debug_format if [ set_listsize 10 ] then { test_list_include_file test_list_filename_and_number diff --git a/gdb/testsuite/gdb.base/ptype.exp b/gdb/testsuite/gdb.base/ptype.exp index 78ff2cabd30..9d7fa2c7794 100644 --- a/gdb/testsuite/gdb.base/ptype.exp +++ b/gdb/testsuite/gdb.base/ptype.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1988, 1990, 1991, 1992, 1994 Free Software Foundation, Inc. +# Copyright (C) 1988, 1990, 1991, 1992, 1994, 1997 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to: # bug-gdb@prep.ai.mit.edu @@ -54,7 +54,7 @@ gdb_load ${binfile} # pre-2.4.5 versions of gcc and most non-gcc compilers). send_gdb "ptype red1\n" -expect { +gdb_expect { -re "type = enum primary1_tag \{red1, green1, blue1\}.*$gdb_prompt $"\ { # The workaround is in effect. As this is a compiler, not GDB, @@ -121,7 +121,7 @@ gdb_test "ptype enum colors" "type = enum colors \{yellow, purple, pink\}.*" "pt gdb_test "ptype boolean" "type = enum \{FALSE, TRUE\}.*" "ptype unnamed typedef'd enumeration" # And check that whatis shows the name, not "enum {...}". - +# This probably fails for all DWARF 1 cases, so assume so for now. -fnf # The problem with xlc is that the stabs look like # :t51=eFALSE:0,TRUE:1,; # boolean:t55=51 @@ -130,6 +130,7 @@ gdb_test "ptype boolean" "type = enum \{FALSE, TRUE\}.*" "ptype unnamed typedef' # as (51) doesn't have a name. Only 55 has a name. if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" } +setup_xfail_format "DWARF 1" gdb_test "whatis v_boolean" "type = boolean" \ "whatis unnamed typedef'd enum (compiler bug in IBM's xlc)" @@ -167,7 +168,7 @@ gdb_test "ptype red" "type = enum \{red, green, blue\}.*" "ptype unnamed enumera #setup_xfail "i960-*-*" 1821 #setup_xfail "mips-idt-*" "mips-sgi-*" "a29k-*-*" #send "ptype v_char\n" -#expect { +#gdb_expect { # -re "type = char.*$gdb_prompt $" { pass "ptype char" } # -re ".*$gdb_prompt $" { fail "ptype char" } # timeout { fail "(timeout) ptype char" } @@ -176,7 +177,7 @@ gdb_test "ptype red" "type = enum \{red, green, blue\}.*" "ptype unnamed enumera # #setup_xfail "mips-*-*" "a29k-*-*" #send "ptype v_signed_char\n" -#expect { +#gdb_expect { # -re "type = signed char.*$gdb_prompt $" { pass "ptype signed char" } # -re ".*$gdb_prompt $" { fail "ptype signed char" } # timeout { fail "(timeout) ptype signed char" } @@ -184,7 +185,7 @@ gdb_test "ptype red" "type = enum \{red, green, blue\}.*" "ptype unnamed enumera # # #send "ptype v_unsigned_char\n" -#expect { +#gdb_expect { # -re "type = unsigned char.*$gdb_prompt $" { pass "ptype unsigned char" } # -re ".*$gdb_prompt $" { fail "ptype unsigned char" } # timeout { fail "(timeout) ptype unsigned char" } @@ -193,7 +194,7 @@ gdb_test "ptype red" "type = enum \{red, green, blue\}.*" "ptype unnamed enumera gdb_test "ptype v_short" "type = short(| int).*" "ptype short" #send "ptype v_signed_short\n" -#expect { +#gdb_expect { # -re "type = short.*$gdb_prompt $" { pass "ptype signed short" } # -re ".*$gdb_prompt $" { fail "ptype signed short" } # timeout { fail "(timeout) ptype signed short" } @@ -201,7 +202,7 @@ gdb_test "ptype v_short" "type = short(| int).*" "ptype short" # # #send "ptype v_unsigned_short\n" -#expect { +#gdb_expect { # -re "type = unsigned short.*$gdb_prompt $" { pass "ptype unsigned short" } # -re ".*$gdb_prompt $" { fail "ptype unsigned short" } # timeout { fail "(timeout) ptype unsigned short" } @@ -211,7 +212,7 @@ gdb_test "ptype v_short" "type = short(| int).*" "ptype short" gdb_test "ptype v_int" "type = int.*" "ptype int" #send "ptype v_signed_int\n" -#expect { +#gdb_expect { # -re "type = int.*$gdb_prompt $" { pass "ptype signed int" } # -re ".*$gdb_prompt $" { fail "ptype signed int" } # timeout { fail "(timeout) ptype signed int" } @@ -219,7 +220,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # # #send "ptype v_unsigned_int\n" -#expect { +#gdb_expect { # -re "type = unsigned int.*$gdb_prompt $" { pass "ptype unsigned int" } # -re ".*$gdb_prompt $" { fail "ptype unsigned int" } # timeout { fail "(timeout) ptype unsigned int" } @@ -227,7 +228,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # # #send "ptype v_long\n" -#expect { +#gdb_expect { # -re "type = long.*$gdb_prompt $" { pass "ptype long" } # -re ".*$gdb_prompt $" { fail "ptype long" } # timeout { fail "(timeout) ptype long" } @@ -235,7 +236,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # # #send "ptype v_signed_long\n" -#expect { +#gdb_expect { # -re "type = long.*$gdb_prompt $" { pass "ptype signed long" } # -re ".*$gdb_prompt $" { fail "ptype signed long" } # timeout { fail "(timeout) ptype signed long" } @@ -243,7 +244,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # # #send "ptype v_unsigned_long\n" -#expect { +#gdb_expect { # -re "type = unsigned long.*$gdb_prompt $" { pass "ptype unsigned long" } # -re ".*$gdb_prompt $" { fail "ptype unsigned long" } # timeout { fail "(timeout) ptype unsigned long" } @@ -251,7 +252,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # # #send "ptype v_float\n" -#expect { +#gdb_expect { # -re "type = float.*$gdb_prompt $" { pass "ptype float" } # -re ".*$gdb_prompt $" { fail "ptype float" } # timeout { fail "(timeout) ptype float" } @@ -259,7 +260,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # # #send "ptype v_double\n" -#expect { +#gdb_expect { # -re "type = double.*$gdb_prompt $" { pass "ptype double" } # -re ".*$gdb_prompt $" { fail "ptype double" } # timeout { fail "(timeout) ptype double" } @@ -272,7 +273,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" #setup_xfail "i960-*-*" 1821 #setup_xfail "mips-idt-*" "mips-sgi-*" "a29k-*-*" #send "ptype v_char_array\n" -#expect { +#gdb_expect { # -re "type = char .2..*$gdb_prompt $" { pass "ptype char array" } # -re ".*$gdb_prompt $" { fail "ptype char array" } # timeout { fail "(timeout) ptype char array" } @@ -281,7 +282,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # #setup_xfail "mips-*-*" "a29k-*-*" #send "ptype v_signed_char_array\n" -#expect { +#gdb_expect { # -re "type = (|signed )char .2..*$gdb_prompt $" { pass "ptype signed char array" } # -re ".*$gdb_prompt $" { fail "ptype signed char array" } # timeout { fail "(timeout) ptype signed char array" } @@ -289,7 +290,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # # #send "ptype v_unsigned_char_array\n" -#expect { +#gdb_expect { # -re "type = unsigned char .2..*$gdb_prompt $" { pass "ptype unsigned char array" } # -re ".*$gdb_prompt $" { fail "ptype unsigned char array" } # timeout { fail "(timeout) ptype unsigned char array" } @@ -298,7 +299,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # # #send "ptype v_int_array\n" -#expect { +#gdb_expect { # -re "type = int .2..*$gdb_prompt $" { pass "ptype int array" } # -re ".*$gdb_prompt $" { fail "ptype int array" } # timeout { fail "(timeout) ptype int array" } @@ -306,7 +307,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # # #send "ptype v_signed_int_array\n" -#expect { +#gdb_expect { # -re "type = int .2..*$gdb_prompt $" { pass "ptype signed int array" } # -re ".*$gdb_prompt $" { fail "ptype signed int array" } # timeout { fail "(timeout) ptype signed int array" } @@ -314,7 +315,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # # #send "ptype v_unsigned_int_array\n" -#expect { +#gdb_expect { # -re "type = unsigned int .2..*$gdb_prompt $" { pass "ptype unsigned int array" } # -re ".*$gdb_prompt $" { fail "ptype unsigned int array" } # timeout { fail "(timeout) ptype unsigned int array" } @@ -322,7 +323,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # # #send "ptype v_long_array\n" -#expect { +#gdb_expect { # -re "type = (long|int|long int) .2..*$gdb_prompt $" { # pass "ptype long array" } # -re ".*$gdb_prompt $" { fail "ptype long array" } @@ -331,7 +332,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # # #send "ptype v_signed_long_array\n" -#expect { +#gdb_expect { # -re "type = (long|int|long int) .2..*$gdb_prompt $" { # pass "ptype signed long array" } # -re ".*$gdb_prompt $" { fail "ptype signed long array" } @@ -340,7 +341,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # # #send "ptype v_unsigned_long_array\n" -#expect { +#gdb_expect { # -re "type = unsigned long .2..*$gdb_prompt $" { pass "ptype unsigned long array" } # -re ".*$gdb_prompt $" { fail "ptype unsigned long array" } # timeout { fail "(timeout) ptype unsigned long array" } @@ -348,7 +349,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # # #send "ptype v_float_array\n" -#expect { +#gdb_expect { # -re "type = float .2..*$gdb_prompt $" { pass "ptype float array" } # -re ".*$gdb_prompt $" { fail "ptype float array" } # timeout { fail "(timeout) ptype float array" } @@ -356,7 +357,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # # #send "ptype v_double_array\n" -#expect { +#gdb_expect { # -re "type = double .2..*$gdb_prompt $" { pass "ptype double array" } # -re ".*$gdb_prompt $" { fail "ptype double array" } # timeout { fail "(timeout) ptype double array" } @@ -364,6 +365,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" } +setup_xfail_format "DWARF 1" gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # @@ -373,7 +375,7 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" #setup_xfail "i960-*-*" 1821 #setup_xfail "mips-idt-*" "mips-sgi-*" "a29k-*-*" #send "ptype v_char_pointer\n" -#expect { +#gdb_expect { # -re "type = char \*.*$gdb_prompt $" { pass "ptype char pointer" } # -re ".*$gdb_prompt $" { fail "ptype char pointer" } # timeout { fail "(timeout) ptype char pointer" } @@ -382,7 +384,7 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # #setup_xfail "mips-*-*" "a29k-*-*" #send "ptype v_signed_char_pointer\n" -#expect { +#gdb_expect { # -re "type = (|signed )char \*.*$gdb_prompt $" # { pass "ptype signed char pointer" } # -re ".*$gdb_prompt $" { fail "ptype signed char pointer" } @@ -391,7 +393,7 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # # #send "ptype v_unsigned_char_pointer\n" -#expect { +#gdb_expect { # -re "type = unsigned char \*.*$gdb_prompt $" { pass "ptype unsigned char pointer" } # -re ".*$gdb_prompt $" { fail "ptype unsigned char pointer" } # timeout { fail "(timeout) ptype unsigned char pointer" } @@ -399,7 +401,7 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # # #send "ptype v_short_pointer\n" -#expect { +#gdb_expect { # -re "type = (short|short int) \*.*$gdb_prompt $" { pass "ptype short pointer" } # -re ".*$gdb_prompt $" { fail "ptype short pointer" } # timeout { fail "(timeout) ptype short pointer" } @@ -407,7 +409,7 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # # #send "ptype v_signed_short_pointer\n" -#expect { +#gdb_expect { # -re "type = short \*.*$gdb_prompt $" { pass "ptype signed short pointer" } # -re ".*$gdb_prompt $" { fail "ptype signed short pointer" } # timeout { fail "(timeout) ptype signed short pointer" } @@ -415,7 +417,7 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # # #send "ptype v_unsigned_short_pointer\n" -#expect { +#gdb_expect { # -re "type = unsigned short \*.*$gdb_prompt $" { pass "ptype unsigned short pointer" } # -re ".*$gdb_prompt $" { fail "ptype unsigned short pointer" } # timeout { fail "(timeout) ptype unsigned short pointer" } @@ -423,7 +425,7 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # # #send "ptype v_int_pointer\n" -#expect { +#gdb_expect { # -re "type = int \*.*$gdb_prompt $" { pass "ptype int pointer" } # -re ".*$gdb_prompt $" { fail "ptype int pointer" } # timeout { fail "(timeout) ptype int pointer" } @@ -431,7 +433,7 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # # #send "ptype v_signed_int_pointer\n" -#expect { +#gdb_expect { # -re "type = int \*.*$gdb_prompt $" { pass "ptype signed int pointer" } # -re ".*$gdb_prompt $" { fail "ptype signed int pointer" } # timeout { fail "(timeout) ptype signed int pointer" } @@ -439,7 +441,7 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # # #send "ptype v_unsigned_int_pointer\n" -#expect { +#gdb_expect { # -re "type = unsigned int \*.*$gdb_prompt $" { pass "ptype unsigned int pointer" } # -re ".*$gdb_prompt $" { fail "ptype unsigned int pointer" } # timeout { fail "(timeout) ptype unsigned int pointer" } @@ -447,7 +449,7 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # # #send "ptype v_long_pointer\n" -#expect { +#gdb_expect { # -re "type = long \*.*$gdb_prompt $" { pass "ptype long pointer" } # -re ".*$gdb_prompt $" { fail "ptype long pointer" } # timeout { fail "(timeout) ptype long pointer" } @@ -455,7 +457,7 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # # #send "ptype v_signed_long_pointer\n" -#expect { +#gdb_expect { # -re "type = long \*.*$gdb_prompt $" { pass "ptype signed long pointer" } # -re ".*$gdb_prompt $" { fail "ptype signed long pointer" } # timeout { fail "(timeout) ptype signed long pointer" } @@ -463,7 +465,7 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # # #send "ptype v_unsigned_long_pointer\n" -#expect { +#gdb_expect { # -re "type = unsigned long \*.*$gdb_prompt $" { pass "ptype unsigned long pointer" } # -re ".*$gdb_prompt $" { fail "ptype unsigned long pointer" } # timeout { fail "(timeout) ptype unsigned long pointer" } @@ -471,7 +473,7 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # # #send "ptype v_float_pointer\n" -#expect { +#gdb_expect { # -re "type = float \*.*$gdb_prompt $" { pass "ptype float pointer" } # -re ".*$gdb_prompt $" { fail "ptype float pointer" } # timeout { fail "(timeout) ptype float pointer" } @@ -479,7 +481,7 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # # #send "ptype v_double_pointer\n" -#expect { +#gdb_expect { # -re "type = double \*.*$gdb_prompt $" { pass "ptype double pointer" } # -re ".*$gdb_prompt $" { fail "ptype double pointer" } # timeout { fail "(timeout) ptype double pointer" } @@ -513,6 +515,7 @@ gdb_test "ptype nested_su.inner_union_instance" "type = union inner_union \{.*\[ if [runto_main] then { + get_debug_format if [target_info exists gdb,cannot_call_functions] { setup_xfail "*-*-*" 2416 fail "This target can not call functions" diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 006533298e6..e217d380bec 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -964,3 +964,50 @@ proc gdb_init { args } { proc gdb_finish { } { gdb_exit; } + +global debug_format + +# Run the gdb command "info source" and extract the debugging format information +# from the output and save it in debug_format. + +proc get_debug_format { } { + global gdb_prompt + global verbose + global expect_out + global debug_format + + set debug_format "unknown" + send_gdb "info source\n" + gdb_expect { + -re ".*Compiled with (.*) debugging format.\r\n$gdb_prompt $" { + set debug_format $expect_out(1,string) + verbose "debug format is $debug_format" + return 1; + } + -re ".*No current source file.\r\n$gdb_prompt $" { + perror "get_debug_format used when no current source file" + return 0; + } + timeout { + perror "couldn't check debug format (timed out)." + return 0; + } + } +} + +# Like setup_xfail, but takes the name of a debug format (DWARF 1, COFF, stabs, etc). +# If that format matches the format that the current test was compiled with, then +# the next test is expected to fail for any target. Returns 1 if the next test or +# set of tests is expected to fail, 0 otherwise (or if it is unknown). Must +# have previously called get_debug_format. + +proc setup_xfail_format { format } { + global debug_format + + if [string match $debug_format $format] then { + setup_xfail "*-*-*" + return 1; + } + return 0 +} +