This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [RFA] testsuite/gdb.c++/ref-types.exp: use runto


Michael Elizabeth Chastain wrote:
> 
> This is Sunday Project Patch #5.
> 
> gdb.c++/ref-types.exp has several places with control logic like this:
> 
>   send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
> 
>       send_gdb "cont\n"
>       gdb_expect {
>           -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
>               send_gdb "up\n"
>               gdb_expect {
>                   -re ".*main.*$gdb_prompt $" {
>                     pass "up from marker1"
>                 }
>                   -re ".*$gdb_prompt $" {
>                     fail "up from marker1"
>                 }
>                   timeout { fail "up from marker1 (timeout)" }
>               }
>           }
>           -re "$gdb_prompt $" { fail "continue to marker1"  }
>           timeout { fail "(timeout) continue to marker1"  }
>       }
> 
> With FSF g++ v3, I am getting output like this:
> 
>   Breakpoint 2, marker1() () at /vittone/fsf/2001-02-21/source-src/gdb/testsuite/gdb.c++/ref-types.cc:6
>   6     }
>   (gdb) FAIL: gdb.c++/ref-types.exp: continue to marker1
> 
> So the test script never issues the "up" command, the test script goes
> off the rails, and every test FAILs.
> 
> The "marker1() ()" output is a v3 bug and I have filed PR gdb/34 about it.
> 
> This patch changes the test script to:
> 
>   if ![runto 'marker1'] then {
>       perror "couldn't run to marker1"
>       continue
>   }
> 
>   gdb_test "up" ".*main.*" "up from marker1"
> 
> ... which is shorter and cleaner anyways.  This enables the test script
> to run its real tests, which proceed to PASS.  This fixes 60 FAILs,
> leaving no FAILs for this test script.
> 
> Testing: tested on Red Hat Linux 6.2 native, Red Hat Linux 7.0 native,
> and Solaris 2.6 native with g++ v2 and g++ v3.
> 
> OK to apply?
> 

Yes.

But I wonder if we should not call gdb_start_again() the first time
around instead of having the code duplicated.  It is exactly the same
thing.


This file was really messed.  Thanks for the fix.

Fernando


> Michael
> 
> ===
> 
> 2001-02-24  Michael Chastain  <chastain@redhat.com>
> 
>         * gdb.c++/ref-types.exp: Change handwritten code to library
>         function 'runto'.
> 
> ===
> 
> Index: gdb/testsuite/gdb.c++/ref-types.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/ref-types.exp,v
> retrieving revision 1.3
> diff -c -3 -p -r1.3 ref-types.exp
> *** gdb/testsuite/gdb.c++/ref-types.exp 2000/12/05 23:57:36     1.3
> --- gdb/testsuite/gdb.c++/ref-types.exp 2001/02/24 05:49:52
> *************** if ![runto_main] then {
> *** 54,123 ****
>       continue
>   }
> 
> ! send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
> !
> !     send_gdb "cont\n"
> !     gdb_expect {
> !         -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
> !             send_gdb "up\n"
> !             gdb_expect {
> !                 -re ".*main.*$gdb_prompt $" {
> !                   pass "up from marker1"
> !               }
> !                 -re ".*$gdb_prompt $" {
> !                   fail "up from marker1"
> !               }
> !                 timeout { fail "up from marker1 (timeout)" }
> !             }
> !         }
> !         -re "$gdb_prompt $" { fail "continue to marker1"  }
> !         timeout { fail "(timeout) continue to marker1"  }
> !     }
> !
> !
> ! proc gdb_start_again {} {
> ! global srcdir
> ! global subdir
> ! global binfile
> ! global gdb_prompt
> ! global decimal
> !
> ! gdb_start
> ! gdb_reinitialize_dir $srcdir/$subdir
> ! gdb_load ${binfile}
> !
> ! source ${binfile}.ci
> !
> ! #
> ! # set it up at a breakpoint so we can play with the variable values
> ! #
> ! if ![runto_main] then {
> !     perror "couldn't run to breakpoint"
>       continue
>   }
> 
> ! send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
> 
> !     send_gdb "cont\n"
> !     gdb_expect {
> !         -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
> !             send_gdb "up\n"
> !             gdb_expect {
> !                 -re ".*main.*$gdb_prompt $" {
> !                   pass "up from marker1"
> !               }
> !                 -re ".*$gdb_prompt $" {
> !                   fail "up from marker1"
> !               }
> !                 timeout { fail "up from marker1 (timeout)" }
> !             }
> !         }
> !         -re "$gdb_prompt $" { fail "continue to marker1"  }
> !         timeout { fail "(timeout) continue to marker1"  }
>       }
> - }
> 
> 
> 
> 
> 
> --- 54,94 ----
>       continue
>   }
> 
> ! if ![runto 'marker1'] then {
> !     perror "couldn't run to marker1"
>       continue
>   }
> 
> ! gdb_test "up" ".*main.*" "up from marker1 1"
> 
> ! proc gdb_start_again {} {
> !     global srcdir
> !     global subdir
> !     global binfile
> !     global gdb_prompt
> !     global decimal
> !
> !     gdb_start
> !     gdb_reinitialize_dir $srcdir/$subdir
> !     gdb_load ${binfile}
> !
> !     source ${binfile}.ci
> !
> !     #
> !     # set it up at a breakpoint so we can play with the variable values
> !     #
> !     if ![runto_main] then {
> !       perror "couldn't run to breakpoint"
> !       continue
>       }
> 
> +     if ![runto 'marker1'] then {
> +       perror "couldn't run to marker1"
> +       continue
> +     }
> 
> +     gdb_test "up" ".*main.*" "up from marker1 2"
> + }
> 
> 
> 
> *************** gdb_expect {
> *** 289,315 ****
>       timeout           { fail "(timeout) print value of ras\[3\]" }
>     }
> 
> -
> - send_gdb "break f\n" ; gdb_expect -re ".*$gdb_prompt $"
> 
> !     send_gdb "cont\n"
> !     gdb_expect {
> !         -re "Break.* f \\(\\) at .*:$decimal.*$gdb_prompt $" {
> !             send_gdb "up\n"
> !             gdb_expect {
> !                 -re ".*main2.*$gdb_prompt $" {
> !                   pass "up from f"
> !               }
> !                 -re ".*$gdb_prompt $" {
> !                   fail "up from f"
> !               }
> !                 timeout { fail "up from f (timeout)" }
> !             }
> !         }
> !         -re "$gdb_prompt $" { fail "continue to f"  }
> !         timeout { fail "(timeout) continue to f"  }
> !     }
> 
> 
>   send_gdb "print C\n"
>   gdb_expect {
> --- 260,272 ----
>       timeout           { fail "(timeout) print value of ras\[3\]" }
>     }
> 
> 
> ! if ![runto 'f'] then {
> !     perror "couldn't run to f"
> !     continue
> ! }
> 
> + gdb_test "up" ".main2.*" "up from f"
> 
>   send_gdb "print C\n"
>   gdb_expect {

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]