From f1c47eb23810315ee8b51dc0ea0bdf7b6eb3caa9 Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Tue, 7 May 2002 00:45:46 +0000 Subject: [PATCH] 2002-05-06 Michael Snyder Enable the "needs_status_wrapper" testsuite feature. * lib/gdb.exp (gdb_wrapper_init): New procedure. (gdb_compile): Conditionally call gdb_wrapper_init. * gdb.base/a2-run.exp: Recognize output from status wrapper. * gdb.c++/method.exp: Recognize output from status wrapper. --- gdb/testsuite/ChangeLog | 8 +++++++ gdb/testsuite/gdb.base/a2-run.exp | 3 +++ gdb/testsuite/gdb.c++/method.exp | 15 ++++++++++--- gdb/testsuite/lib/gdb.exp | 35 +++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6c35655e762..ef64d4f4417 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2002-05-06 Michael Snyder + + Enable the "needs_status_wrapper" testsuite feature. + * lib/gdb.exp (gdb_wrapper_init): New procedure. + (gdb_compile): Conditionally call gdb_wrapper_init. + * gdb.base/a2-run.exp: Recognize output from status wrapper. + * gdb.c++/method.exp: Recognize output from status wrapper. + 2002-05-06 Ben Elliston From Graydon Hoare diff --git a/gdb/testsuite/gdb.base/a2-run.exp b/gdb/testsuite/gdb.base/a2-run.exp index f822f2491a5..fbc704470cb 100644 --- a/gdb/testsuite/gdb.base/a2-run.exp +++ b/gdb/testsuite/gdb.base/a2-run.exp @@ -80,6 +80,9 @@ if [istarget "*-*-vxworks*"] then { -re ".*usage: factorial .*Program exited with code 01.*$gdb_prompt $" { pass "run \"$testfile\" with no args" } + -re ".*usage: factorial .* EXIT code 1.*Program exited normally.*$gdb_prompt $" { + pass "run \"$testfile\" with no args (exit wrapper)" + } -re ".*$gdb_prompt $" { fail "run \"$testfile\" with no args" verbose "expect_out is $expect_out(buffer)" 2 diff --git a/gdb/testsuite/gdb.c++/method.exp b/gdb/testsuite/gdb.c++/method.exp index 8deafa85f38..acd51b950ce 100644 --- a/gdb/testsuite/gdb.c++/method.exp +++ b/gdb/testsuite/gdb.c++/method.exp @@ -180,6 +180,15 @@ gdb_expect { timeout { fail "(timeout) ptype A" } } -gdb_test "cont" \ - "Continuing.\r\n\r\nProgram exited normally." \ - "finish program" +send_gdb "cont\n" +gdb_expect { + -re "Continuing\r\n\r\nProgram exited normally.*$gdb_prompt $" { + pass "finish program" + } + -re "Continuing.* EXIT code 0.*Program exited normally.*$gdb_prompt $" { + pass "finish program (exit wrapper)" + } + -re ".*$gdb_prompt $" { fail "finish program" } + default:{ fail "finish program (timeout)" } +} + diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index e47659983a9..303c3c58330 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1092,8 +1092,34 @@ proc gdb_preprocess {source dest args} { return $result; } +set gdb_wrapper_initialized 0 + +proc gdb_wrapper_init { args } { + global gdb_wrapper_initialized; + global gdb_wrapper_file; + global gdb_wrapper_flags; + + if { $gdb_wrapper_initialized == 1 } { return; } + + if {[target_info exists needs_status_wrapper] && \ + [target_info needs_status_wrapper] != "0" && \ + ![info exists gdb_wrapper_file]} { + set result [build_wrapper "testglue.o"]; + if { $result != "" } { + set gdb_wrapper_file [lindex $result 0]; + set gdb_wrapper_flags [lindex $result 1]; + } else { + warning "Status wrapper failed to build." + } + } + set gdb_wrapper_initialized 1 +} + proc gdb_compile {source dest type options} { global GDB_TESTCASE_OPTIONS; + global gdb_wrapper_file; + global gdb_wrapper_flags; + global gdb_wrapper_initialized; if [target_info exists gdb_stub] { set options2 { "additional_flags=-Dusestubs" } @@ -1111,6 +1137,15 @@ proc gdb_compile {source dest type options} { verbose "options are $options" verbose "source is $source $dest $type $options" + if { $gdb_wrapper_initialized == 0 } { gdb_wrapper_init } + + if {[target_info exists needs_status_wrapper] && \ + [target_info needs_status_wrapper] != "0" && \ + [info exists gdb_wrapper_file]} { + lappend options "libs=${gdb_wrapper_file}" + lappend options "ldflags=${gdb_wrapper_flags}" + } + set result [target_compile $source $dest $type $options]; regsub "\[\r\n\]*$" "$result" "" result; regsub "^\[\r\n\]*" "$result" "" result; -- 2.30.2