From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2126 invoked by alias); 17 Mar 2003 18:35:55 -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 2011 invoked from network); 17 Mar 2003 18:35:54 -0000 Received: from unknown (HELO jackfruit.Stanford.EDU) (171.64.38.136) by sources.redhat.com with SMTP; 17 Mar 2003 18:35:54 -0000 Received: (from carlton@localhost) by jackfruit.Stanford.EDU (8.11.6/8.11.6) id h2HIZpV03454; Mon, 17 Mar 2003 10:35:51 -0800 X-Authentication-Warning: jackfruit.Stanford.EDU: carlton set sender to carlton@math.stanford.edu using -f To: gdb-patches@sources.redhat.com Subject: [rfa/testsuite] Add test for PR gdb/38 From: David Carlton Date: Mon, 17 Mar 2003 18:35:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-03/txt/msg00370.txt.bz2 This patch adds a KFAILed test for PR gdb/38. That PR is about watchpoints set at the same location as breakpoints, which can cause the watchpoint to get triggered late. Right now, the only testsuite case that tests this is in gdb.c++/annota2.exp, which is bad because it has nothing to do with C++, nothing to do with annotation, and because level 2 annotation is on its way out. So I'd like to get the bug recorded in a more correct location. Tested on i686-pc-linux-gnu, GCC 3.1, DWARF 2. I haven't been able to test the pass branch, because it reliably fails on this platform, but I did try to be careful with the pass regexp. OK to commit? David Carlton carlton@math.stanford.edu 2003-03-17 David Carlton * gdb.base/watchpoint.exp (test_watchpoint_and_breakpoint): New test, for PR breakpoints/38. Call test_watchpoint_and_breakpoint. * gdb.base/watchpoint.c (func3): New function. (main): Call func3. Index: watchpoint.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watchpoint.exp,v retrieving revision 1.7 diff -u -p -r1.7 watchpoint.exp --- watchpoint.exp 4 Feb 2003 22:49:19 -0000 1.7 +++ watchpoint.exp 17 Mar 2003 18:29:11 -0000 @@ -648,6 +648,27 @@ proc test_complex_watchpoint {} { } } +proc test_watchpoint_and_breakpoint {} { + global gdb_prompt + + # This is a test for PR gdb/38, which involves setting a + # watchpoint right after you've reached a breakpoint. + + if [runto func3] then { + gdb_breakpoint [gdb_get_line_number "second x assignment"] + gdb_continue_to_breakpoint "second x assignment" + gdb_test "watch x" ".*atchpoint \[0-9\]+: x" + gdb_test_multiple "next" "next after watch x" { + -re ".*atchpoint \[0-9\]+: x\r\n\r\nOld value = 0\r\nNew value = 1\r\n.*$gdb_prompt $" { + pass "next after watch x" + } + -re "\[0-9\]+\[\t \]+y = 1;\r\n$gdb_prompt $" { + kfail "gdb/38" "next after watch x" + } + } + } +} + # Start with a fresh gdb. gdb_exit @@ -799,6 +820,17 @@ if [initialize] then { timeout {fail "(timeout) access watches disallowed"} } } + + # See above. + if [istarget "mips-idt-*"] then { + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + initialize + } + + test_watchpoint_and_breakpoint } # Restore old timeout Index: watchpoint.c =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watchpoint.c,v retrieving revision 1.1.1.2 diff -u -p -r1.1.1.2 watchpoint.c --- watchpoint.c 28 Jun 1999 16:04:22 -0000 1.1.1.2 +++ watchpoint.c 17 Mar 2003 18:29:07 -0000 @@ -83,6 +83,18 @@ func2 () static_b = local_a; } +void +func3 () +{ + int x; + int y; + + x = 0; + x = 1; /* second x assignment */ + y = 1; + y = 2; +} + int func1 () { @@ -170,5 +182,8 @@ int main () recurser (2); marker6 (); + + func3 (); + return 0; }