From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22979 invoked by alias); 10 Sep 2004 01:03:13 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 22972 invoked from network); 10 Sep 2004 01:03:10 -0000 Received: from unknown (HELO smtp6.mindspring.com) (207.69.200.110) by sourceware.org with SMTP; 10 Sep 2004 01:03:10 -0000 Received: from user-119a90a.biz.mindspring.com ([66.149.36.10] helo=berman.michael-chastain.com) by smtp6.mindspring.com with esmtp (Exim 3.33 #1) id 1C5Zoe-0000ph-00; Thu, 09 Sep 2004 21:03:04 -0400 Received: from mindspring.com (localhost [127.0.0.1]) by berman.michael-chastain.com (Postfix) with SMTP id 5668C4B102; Thu, 9 Sep 2004 21:03:23 -0400 (EDT) Date: Fri, 10 Sep 2004 01:03:00 -0000 From: Michael Chastain To: gdb-patches@sources.redhat.com Subject: [patch/testsuite] revert return-type of gdb_file_cmd, gdb_load Cc: manjo@austin.ibm.com, jimb@redhat.com, cagney@gnu.org Message-ID: <4140FD5A.nail2UI11H9ND@mindspring.com> User-Agent: nail 10.8 6/28/04 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2004-09/txt/msg00159.txt.bz2 I hope this is the end of the mess, but if it's not, just let me know! This patch reverts the recent change to the return value of gdb_file_cmd. Instead of using a structured return value, I just stick the secondary information into a global variable. Global variable. Bleagh. But "bleagh" beats "oh shit, I broke eight other implementations of gdb_load in config/*.exp and I can't test all of them". Tested on native i686-pc-linux-gnu, gcc 2.95.3 3.3.4 3.4.1, dwarf-2 and stabs+, with tcl 8.4.6, expect 5.41, dejagnu 1.4.4. I also tested gdb.gdb/*.exp with a stripped gdb to check for the proper "untested" results. I am committing this now. === 2004-09-09 Michael Chastain * lib/gdb.exp (gdb_file_cmd): Revert the return value to previous simple convention. Use a global variable to store information about what was found. (gdb_run_cmd) Adapt to reverted return value. * gdb.base/remote.exp: Adapt to reverted return value. * gdb.gdb/complaints.exp: Likewise. * gdb.gdb/observer.exp: Likewise. * gdb.gdb/selftest.exp: Likewise. * gdb.gdb/xfullpath.exp: Likewise. Index: gdb.base/remote.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/remote.exp,v retrieving revision 1.4 diff -c -3 -p -r1.4 remote.exp *** gdb.base/remote.exp 28 Aug 2004 23:55:48 -0000 1.4 --- gdb.base/remote.exp 9 Sep 2004 21:25:13 -0000 *************** proc gdb_load_timed {executable download *** 119,125 **** set load_begin_time [clock clicks] set result [gdb_load $executable] set load_end_time [clock clicks] ! if { [lindex $result 0] != "" } then { fail "$test - loading executable" return } --- 119,125 ---- set load_begin_time [clock clicks] set result [gdb_load $executable] set load_end_time [clock clicks] ! if { $result != 0 } then { fail "$test - loading executable" return } Index: gdb.gdb/complaints.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.gdb/complaints.exp,v retrieving revision 1.4 diff -c -3 -p -r1.4 complaints.exp *** gdb.gdb/complaints.exp 1 Sep 2004 19:55:00 -0000 1.4 --- gdb.gdb/complaints.exp 9 Sep 2004 21:25:13 -0000 *************** proc setup_test { executable } { *** 49,65 **** set timeout 600 verbose "Timeout is now $timeout seconds" 2 set result [gdb_load $executable] set timeout $oldtimeout verbose "Timeout is now $timeout seconds" 2 ! if { [lindex $result 0] != "" } then { return -1 - } else { - if { [lsearch -exact [lrange $result 1 end] "nodebug"] >= 0 } then { - untested "No debug information, skipping testcase." - return -1 - } } # Set a breakpoint at main --- 49,68 ---- set timeout 600 verbose "Timeout is now $timeout seconds" 2 + global gdb_file_cmd_debug_info + set gdb_file_cmd_debug_info "unset" + set result [gdb_load $executable] set timeout $oldtimeout verbose "Timeout is now $timeout seconds" 2 ! if { $result != 0 } then { ! return -1 ! } ! ! if { gdb_file_cmd_debug_info != "debug" } then { ! untested "No debug information, skipping testcase." return -1 } # Set a breakpoint at main Index: gdb.gdb/observer.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.gdb/observer.exp,v retrieving revision 1.6 diff -c -3 -p -r1.6 observer.exp *** gdb.gdb/observer.exp 1 Sep 2004 19:55:00 -0000 1.6 --- gdb.gdb/observer.exp 9 Sep 2004 21:25:13 -0000 *************** proc setup_test { executable } { *** 47,63 **** set timeout 600 verbose "Timeout is now $timeout seconds" 2 set result [gdb_load $executable] set timeout $oldtimeout verbose "Timeout is now $timeout seconds" 2 ! if { [lindex $result 0] != "" } then { return -1 - } else { - if { [lsearch -exact [lrange $result 1 end] "nodebug"] >= 0 } then { - untested "No debug information, skipping testcase." - return -1 - } } # Set a breakpoint at main --- 47,66 ---- set timeout 600 verbose "Timeout is now $timeout seconds" 2 + global gdb_file_cmd_debug_info + set gdb_file_cmd_debug_info "unset" + set result [gdb_load $executable] set timeout $oldtimeout verbose "Timeout is now $timeout seconds" 2 ! if { $result != 0 } then { ! return -1 ! } ! ! if { gdb_file_cmd_debug_info != "debug" } then { ! untested "No debug information, skipping testcase." return -1 } # Set a breakpoint at main Index: gdb.gdb/selftest.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.gdb/selftest.exp,v retrieving revision 1.5 diff -c -3 -p -r1.5 selftest.exp *** gdb.gdb/selftest.exp 1 Sep 2004 19:55:00 -0000 1.5 --- gdb.gdb/selftest.exp 9 Sep 2004 21:25:13 -0000 *************** proc test_with_self { executable } { *** 241,257 **** set timeout 600 verbose "Timeout is now $timeout seconds" 2 set result [gdb_load $executable] set timeout $oldtimeout verbose "Timeout is now $timeout seconds" 2 ! if { [lindex $result 0] != "" } then { return -1 - } else { - if { [lsearch -exact [lrange $result 1 end] "nodebug"] >= 0 } then { - untested "No debug information, skipping testcase." - return -1 - } } # disassemble yourself --- 241,260 ---- set timeout 600 verbose "Timeout is now $timeout seconds" 2 + global gdb_file_cmd_debug_info + set gdb_file_cmd_debug_info "unset" + set result [gdb_load $executable] set timeout $oldtimeout verbose "Timeout is now $timeout seconds" 2 ! if { $result != 0 } then { ! return -1 ! } ! ! if { gdb_file_cmd_debug_info != "debug" } then { ! untested "No debug information, skipping testcase." return -1 } # disassemble yourself Index: gdb.gdb/xfullpath.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.gdb/xfullpath.exp,v retrieving revision 1.4 diff -c -3 -p -r1.4 xfullpath.exp *** gdb.gdb/xfullpath.exp 1 Sep 2004 19:55:00 -0000 1.4 --- gdb.gdb/xfullpath.exp 9 Sep 2004 21:25:13 -0000 *************** proc setup_test { executable } { *** 48,64 **** set timeout 600 verbose "Timeout is now $timeout seconds" 2 set result [gdb_load $executable] set timeout $oldtimeout verbose "Timeout is now $timeout seconds" 2 ! if { [lindex $result 0] != "" } then { return -1 - } else { - if { [lsearch -exact [lrange $result 1 end] "nodebug"] >= 0 } then { - untested "No debug information, skipping testcase." - return -1 - } } # Set a breakpoint at main --- 48,67 ---- set timeout 600 verbose "Timeout is now $timeout seconds" 2 + global gdb_file_cmd_debug_info + set gdb_file_cmd_debug_info "unset" + set result [gdb_load $executable] set timeout $oldtimeout verbose "Timeout is now $timeout seconds" 2 ! if { $result != 0 } then { ! return -1 ! } ! ! if { gdb_file_cmd_debug_info != "debug" } then { ! untested "No debug information, skipping testcase." return -1 } # Set a breakpoint at main Index: lib/gdb.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v retrieving revision 1.57 diff -c -3 -p -r1.57 gdb.exp *** lib/gdb.exp 28 Aug 2004 23:55:48 -0000 1.57 --- lib/gdb.exp 9 Sep 2004 21:25:14 -0000 *************** proc gdb_run_cmd {args} { *** 180,187 **** if [target_info exists gdb,do_reload_on_run] { # Specifying no file, defaults to the executable # currently being debugged. ! set status [gdb_load ""] ! if { [lindex $status 0] != "" } { return; } send_gdb "continue\n"; --- 180,186 ---- if [target_info exists gdb,do_reload_on_run] { # Specifying no file, defaults to the executable # currently being debugged. ! if { [gdb_load ""] != 0 } { return; } send_gdb "continue\n"; *************** proc gdb_run_cmd {args} { *** 226,233 **** send_gdb "y\n" } -re "The program is not being run.*$gdb_prompt $" { ! set status [gdb_load ""] ! if { [lindex $status 0] != ""] } { return; } send_gdb "jump *$start\n"; --- 225,231 ---- send_gdb "y\n" } -re "The program is not being run.*$gdb_prompt $" { ! if { [gdb_load ""] != 0 } { return; } send_gdb "jump *$start\n"; *************** proc gdb_run_cmd {args} { *** 249,256 **** } if [target_info exists gdb,do_reload_on_run] { ! set status [gdb_load ""] ! if { [lindex $status 0] != "" } { return; } } --- 247,253 ---- } if [target_info exists gdb,do_reload_on_run] { ! if { [gdb_load ""] != 0 } { return; } } *************** proc default_gdb_exit {} { *** 957,992 **** } # Load a file into the debugger. ! # The return value is a list with the following information: # ! # { message word ... } ! # ! # MESSAGE has the following values: ! # ! # "" file was loaded successfully ! # "..." file was not loaded successfully. ! # A perror has been generated with MESSAGE. # ! # If the MESSAGE is "", then there is an optional set of words. ! # The words may be: # ! # nodebug this file does not contain debug information # ! # TODO: gdb.base/sepdebug.exp and gdb.stabs/weird.exp might ! # be able to use this if they can get more information ! # in the return value. proc gdb_file_cmd { arg } { global gdb_prompt global verbose global GDB if [is_remote host] { set arg [remote_download host $arg] if { $arg == "" } { ! set message "download failed" ! perror $message ! return { $message } } } --- 954,990 ---- } # Load a file into the debugger. ! # The return value is 0 for success, -1 for failure. # ! # This procedure also set the global variable GDB_FILE_CMD_DEBUG_INFO ! # to one of these values: # ! # debug file was loaded successfully and has debug information ! # nodebug file was loaded successfully and has no debug information ! # fail file was not loaded # ! # I tried returning this information as part of the return value, ! # but ran into a mess because of the many re-implementations of ! # gdb_load in config/*.exp. # ! # TODO: gdb.base/sepdebug.exp and gdb.stabs/weird.exp might be able to use ! # this if they can get more information set. proc gdb_file_cmd { arg } { global gdb_prompt global verbose global GDB + # Set whether debug info was found. + # Default to "fail". + global gdb_file_cmd_debug_info + set gdb_file_cmd_debug_info "fail" + if [is_remote host] { set arg [remote_download host $arg] if { $arg == "" } { ! perror "download failed" ! return -1 } } *************** proc gdb_file_cmd { arg } { *** 994,1008 **** gdb_expect 120 { -re "Reading symbols from.*no debugging symbols found.*done.*$gdb_prompt $" { verbose "\t\tLoaded $arg into the $GDB with no debugging symbols" ! return { "" nodebug } } -re "Reading symbols from.*done.*$gdb_prompt $" { verbose "\t\tLoaded $arg into the $GDB" ! return { "" } } -re "A program is being debugged already.*Kill it.*y or n. $" { send_gdb "y\n" ! verbose "\t\tKilling previous program being debugged" exp_continue } -re "Load new symbol table from \".*\".*y or n. $" { --- 992,1008 ---- gdb_expect 120 { -re "Reading symbols from.*no debugging symbols found.*done.*$gdb_prompt $" { verbose "\t\tLoaded $arg into the $GDB with no debugging symbols" ! set gdb_file_cmd_debug_info "nodebug" ! return 0 } -re "Reading symbols from.*done.*$gdb_prompt $" { verbose "\t\tLoaded $arg into the $GDB" ! set gdb_file_cmd_debug_info "debug" ! return 0 } -re "A program is being debugged already.*Kill it.*y or n. $" { send_gdb "y\n" ! verbose "\t\tKilling previous program being debugged" exp_continue } -re "Load new symbol table from \".*\".*y or n. $" { *************** proc gdb_file_cmd { arg } { *** 1010,1046 **** gdb_expect 120 { -re "Reading symbols from.*done.*$gdb_prompt $" { verbose "\t\tLoaded $arg with new symbol table into $GDB" ! return { "" } } timeout { ! set message "(timeout) Couldn't load $arg, other program already loaded." ! perror $message ! return { $message } } } } -re "No such file or directory.*$gdb_prompt $" { ! set message "($arg) No such file or directory" ! perror $message ! return { $message } } -re "$gdb_prompt $" { ! set message "couldn't load $arg into $GDB." ! perror $message ! return { $message } } timeout { ! set message "couldn't load $arg into $GDB (timed out)." ! perror $message ! return { $message } } eof { # This is an attempt to detect a core dump, but seems not to # work. Perhaps we need to match .* followed by eof, in which # gdb_expect does not seem to have a way to do that. ! set message "couldn't load $arg into $GDB (end of file)." ! perror $message ! return { $message } } } } --- 1010,1042 ---- gdb_expect 120 { -re "Reading symbols from.*done.*$gdb_prompt $" { verbose "\t\tLoaded $arg with new symbol table into $GDB" ! set gdb_file_cmd_debug_info "debug" ! return 0 } timeout { ! perror "(timeout) Couldn't load $arg, other program already loaded." ! return -1 } } } -re "No such file or directory.*$gdb_prompt $" { ! perror "($arg) No such file or directory" ! return -1 } -re "$gdb_prompt $" { ! perror "couldn't load $arg into $GDB." ! return -1 } timeout { ! perror "couldn't load $arg into $GDB (timed out)." ! return -1 } eof { # This is an attempt to detect a core dump, but seems not to # work. Perhaps we need to match .* followed by eof, in which # gdb_expect does not seem to have a way to do that. ! perror "couldn't load $arg into $GDB (end of file)." ! return -1 } } } *************** proc gdb_exit { } { *** 1655,1660 **** --- 1651,1657 ---- # # gdb_load -- load a file into the debugger. + # Many files in config/*.exp override this procedure. # proc gdb_load { arg } { return [gdb_file_cmd $arg]