This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project. See the GDB home page for more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Here are some patches I needed to apply to get the gdb testsuite to work correctly on remote targets using cygmon. The basic problem was that some of the tests expected 'run' to work on a remote target and expected programs to exit with a nice message. There's also an unitialized char array in miscexprs.c --Mark Index: devo/gdb/testsuite/gdb.base/ena-dis-br.exp =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/ena-dis-br.exp,v retrieving revision 1.1 diff -p -r1.1 ena-dis-br.exp *** ena-dis-br.exp 1999/01/08 23:37:32 1.1 --- ena-dis-br.exp 1999/03/16 20:57:05 *************** *** 1,4 **** ! # Copyright (C) 1997, 1998 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify --- 1,4 ---- ! # Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify *************** if { [gdb_compile "${srcdir}/${subdir}/ *** 38,43 **** --- 38,67 ---- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } + proc rerun_to_main {} { + global gdb_prompt + + if [target_info exists use_gdb_stub] { + gdb_run_cmd + gdb_expect { + -re ".*Breakpoint .*main .*$gdb_prompt $"\ + {pass "rerun to main" ; return 0} + -re "$gdb_prompt $"\ + {fail "rerun to main" ; return 0} + timeout {fail "(timeout) rerun to main" ; return 0} + } + } else { + send_gdb "run\n" + gdb_expect { + -re "Starting program.*$gdb_prompt $"\ + {pass "rerun to main" ; return 0} + -re "$gdb_prompt $"\ + {fail "rerun to main" ; return 0} + timeout {fail "(timeout) rerun to main" ; return 0} + } + } + } + gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir *************** gdb_expect { *** 137,168 **** # Verify that we don't stop at a disabled breakpoint. # ! send_gdb "continue\n" ! gdb_expect { ! -re ".*Program exited normally.*$gdb_prompt $"\ ! {pass "no stop"} ! -re "$gdb_prompt $"\ ! {fail "no stop"} ! timeout {fail "(timeout) no stop"} ! } ! ! send_gdb "run\n" ! gdb_expect { ! -re "Starting program.*$gdb_prompt $"\ ! {pass "rerun to main"} ! -re "$gdb_prompt $"\ ! {fail "rerun to main"} ! timeout {fail "(timeout) rerun to main"} ! } ! ! send_gdb "continue\n" ! gdb_expect { ! -re ".*Program exited normally.*$gdb_prompt $"\ ! {pass "no stop at auto-disabled break marker2"} ! -re "$gdb_prompt $"\ ! {fail "no stop at auto-disabled break marker2"} ! timeout {fail "(timeout) no stop at auto-disabled break marker2"} ! } # Verify that we can set a breakpoint to be self-deleting after # the first time it triggers. --- 161,169 ---- # Verify that we don't stop at a disabled breakpoint. # ! continue_to_exit "no stop" ! rerun_to_main ! continue_to_exit "no stop at auto-disabled break marker2" # Verify that we can set a breakpoint to be self-deleting after # the first time it triggers. *************** gdb_expect { *** 320,343 **** {fail "info ignored break marker1"} timeout {fail "(timeout) info ignored break marker1"} } - - send_gdb "continue\n" - gdb_expect { - -re ".*Program exited normally.*$gdb_prompt $"\ - {pass "no stop at ignored break marker1"} - -re "$gdb_prompt $"\ - {fail "no stop at ignored break marker1"} - timeout {fail "(timeout) no stop at ignored break marker1"} - } ! send_gdb "run\n" ! gdb_expect { ! -re "Starting program.*$gdb_prompt $"\ ! {pass "rerun to main"} ! -re "$gdb_prompt $"\ ! {fail "rerun to main"} ! timeout {fail "(timeout) rerun to main"} ! } send_gdb "continue\n" gdb_expect { --- 321,329 ---- {fail "info ignored break marker1"} timeout {fail "(timeout) info ignored break marker1"} } ! continue_to_exit "no stop at ignored break marker1" ! rerun_to_main send_gdb "continue\n" gdb_expect { *************** gdb_expect { *** 385,408 **** {fail "info break marker1"} timeout {fail "(timeout) info break marker2"} } - - send_gdb "continue\n" - gdb_expect { - -re ".*Program exited normally.*$gdb_prompt $"\ - {pass "no stop at ignored & auto-deleted break marker1"} - -re "$gdb_prompt $"\ - {fail "no stop at ignored & auto-deleted break marker1"} - timeout {fail "(timeout) no stop at ignored & auto-deleted break marker1"} - } ! send_gdb "run\n" ! gdb_expect { ! -re "Starting program.*$gdb_prompt $"\ ! {pass "rerun to main"} ! -re "$gdb_prompt $"\ ! {fail "rerun to main"} ! timeout {fail "(timeout) rerun to main"} ! } send_gdb "continue\n" gdb_expect { --- 371,379 ---- {fail "info break marker1"} timeout {fail "(timeout) info break marker2"} } ! continue_to_exit "no stop at ignored & auto-deleted break marker1" ! rerun_to_main send_gdb "continue\n" gdb_expect { *************** gdb_expect { *** 444,467 **** {pass "disable break marker1"} timeout {fail "(timeout) disable break marker1"} } - - send_gdb "continue\n" - gdb_expect { - -re ".*Program exited normally.*$gdb_prompt $"\ - {pass "no stop at ignored & disabled break marker1"} - -re "$gdb_prompt $"\ - {fail "no stop at ignored & disabled break marker1"} - timeout {fail "(timeout) no stop at ignored & disabled break marker1"} - } ! send_gdb "run\n" ! gdb_expect { ! -re "Starting program.*$gdb_prompt $"\ ! {pass "rerun to main"} ! -re "$gdb_prompt $"\ ! {fail "rerun to main"} ! timeout {fail "(timeout) rerun to main"} ! } send_gdb "info break $expect_out(1,string)\n" gdb_expect { --- 415,423 ---- {pass "disable break marker1"} timeout {fail "(timeout) disable break marker1"} } ! continue_to_exit "no stop at ignored & disabled break marker1" ! rerun_to_main send_gdb "info break $expect_out(1,string)\n" gdb_expect { Index: devo/gdb/testsuite/gdb.base/ending-run.exp =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/ending-run.exp,v retrieving revision 1.1 diff -p -r1.1 ending-run.exp *** ending-run.exp 1999/01/08 23:40:55 1.1 --- ending-run.exp 1999/03/16 20:57:05 *************** *** 1,4 **** ! # Copyright (C) 1997, 1998 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 --- 1,4 ---- ! # Copyright (C) 1997, 1998, 1999 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 *************** gdb_test "b 26" ".*Breakpoint.*3.*" "" *** 61,67 **** # Expect to hit the bp at line "1", but symbolize this # as line "8". Then try to clear it--this should work. # ! gdb_test "r" ".*Breakpoint.*1.*callee.*8.*" "" gdb_test "cle" ".*Deleted breakpoints 2 1.*" "clear worked" send_gdb "i b\n" gdb_expect { --- 61,71 ---- # Expect to hit the bp at line "1", but symbolize this # as line "8". Then try to clear it--this should work. # ! if [target_info exists use_gdb_stub] { ! gdb_test "continue" ".*Breakpoint.*1.*callee.*8.*" "" ! } else { ! gdb_test "r" ".*Breakpoint.*1.*callee.*8.*" "" ! } gdb_test "cle" ".*Deleted breakpoints 2 1.*" "clear worked" send_gdb "i b\n" gdb_expect { *************** gdb_expect { *** 150,159 **** timeout { fail "hang or timeout on step at end 1" } } ! gdb_test "n" ".*Single.*Program exited.*" "step to end of run" ! set timeout $old_timeout ! gdb_test "n" ".*The program is not being run.*" "don't step after run" set exec_output [remote_exec host "ls core"] --- 154,165 ---- timeout { fail "hang or timeout on step at end 1" } } ! if ![target_info exists use_gdb_stub] { ! gdb_test "n" ".*Single.*Program exited.*" "step to end of run" ! set timeout $old_timeout ! gdb_test "n" ".*The program is not being run.*" "don't step after run" ! } set exec_output [remote_exec host "ls core"] Index: devo/gdb/testsuite/gdb.base/miscexprs.c =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/miscexprs.c,v retrieving revision 1.2 diff -p -r1.2 miscexprs.c *** miscexprs.c 1999/01/04 15:34:31 1.2 --- miscexprs.c 1999/03/16 20:57:05 *************** struct { *** 62,68 **** short s[400]; } sbig; ibig.i[100] = 5; ! cbig.c[100] = 'A'; fbig.f[100] = 11.99999; dbig.d[202] = 9.99999999; sbig.s[90] = 255; --- 62,68 ---- short s[400]; } sbig; ibig.i[100] = 5; ! cbig.c[100] = 'A'; cbig.c[0] = 0; fbig.f[100] = 11.99999; dbig.d[202] = 9.99999999; sbig.s[90] = 255; Index: devo/gdb/testsuite/gdb.base/step-test.exp =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/step-test.exp,v retrieving revision 1.3 diff -p -r1.3 step-test.exp *** step-test.exp 1999/03/09 03:55:52 1.3 --- step-test.exp 1999/03/16 20:57:05 *************** *** 1,4 **** ! # Copyright (C) 1997, 1998 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 --- 1,4 ---- ! # Copyright (C) 1997, 1998, 1999 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 *************** gdb_test "step" \ *** 148,153 **** ".*step-test.exp: arrive here 1.*" \ "large struct by value" ! gdb_test "continue" ".*Program exited normally.*" "run to finish" return 0 --- 148,153 ---- ".*step-test.exp: arrive here 1.*" \ "large struct by value" ! continue_to_exit "run to finish" return 0 Index: devo/gdb/testsuite/lib/gdb.exp =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/testsuite/lib/gdb.exp,v retrieving revision 1.135 diff -p -r1.135 gdb.exp *** gdb.exp 1999/03/09 03:55:58 1.135 --- gdb.exp 1999/03/16 20:57:06 *************** proc runto_main { } { *** 313,318 **** --- 313,372 ---- return 1 } + # + # continue_to_exit MESSAGE -- test that continuing gdb will cause program to exit. + # + # MESSAGE is the message to be incorproated into pass/fail messages. + # + # The case where the target uses stubs has to be handled specially. If a + # stub is used, we set a breakpoint at exit because we cannot rely on + # exit() behavior of a remote target. + # + # Returns: + # 1 if the test failed, + # 0 if the test passes, + # -1 if there was an internal error. + # + proc continue_to_exit { message } { + global gdb_prompt + global decimal + + if [target_info exists use_gdb_stub] { + send_gdb "break exit\n" + gdb_expect { + -re "Breakpoint (\[0-9\]*) at .*: file .*, line $decimal.\r\n$gdb_prompt $" {} + -re "Breakpoint (\[0-9\]*): file .*, line $decimal.\r\n$gdb_prompt $" {} + -re "Breakpoint (\[0-9\]*) at .*$gdb_prompt $" {} + -re "$gdb_prompt $" { fail "setting breakpoint at exit" ; return -1 } + timeout { fail "setting breakpoint at exit (timeout)" ; return -1 } + } + send_gdb "continue\n" + gdb_expect { + -re "Continuing..*Breakpoint .*exit \[(\].*=\[0-9\]+\[)\].*$gdb_prompt $"\ + {pass "$message"} + -re "$gdb_prompt $"\ + {fail "$message" ; return 1 } + timeout {fail "(timeout) $message" ; return 1 } + } + send_gdb "delete $expect_out(1,string)\n" + gdb_expect { + -re "$gdb_prompt $" {} + timeout { fail "deleting breakpoint at exit (timeout)" ; return -1 } + } + } else { + send_gdb "continue\n" + gdb_expect { + -re ".*Program exited normally.*$gdb_prompt $"\ + {pass "$message"} + -re "$gdb_prompt $"\ + {fail "$message"} + timeout {fail "(timeout) $message"} + } + } + return 0 + } + + # gdb_test COMMAND PATTERN MESSAGE -- send a command to gdb; test the result. # # COMMAND is the command to execute, send to GDB with send_gdb. If