From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13783 invoked by alias); 28 Sep 2010 15:57:17 -0000 Received: (qmail 13773 invoked by uid 22791); 28 Sep 2010 15:57:15 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e24smtp02.br.ibm.com (HELO e24smtp02.br.ibm.com) (32.104.18.86) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Sep 2010 15:57:07 +0000 Received: from mailhub1.br.ibm.com (mailhub1.br.ibm.com [9.18.232.109]) by e24smtp02.br.ibm.com (8.14.4/8.13.1) with ESMTP id o8SG1sXt000337 for ; Tue, 28 Sep 2010 13:01:54 -0300 Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.8.31.91]) by mailhub1.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o8SG36D2778412 for ; Tue, 28 Sep 2010 13:03:06 -0300 Received: from d24av01.br.ibm.com (loopback [127.0.0.1]) by d24av01.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o8SFuqu8012317 for ; Tue, 28 Sep 2010 12:56:52 -0300 Received: from [9.8.14.73] ([9.8.14.73]) by d24av01.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o8SFupjt012310 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 28 Sep 2010 12:56:52 -0300 Subject: [PATCH] testcases: Fix assorted problems related to powerpc From: Luis Machado Reply-To: luisgpm@linux.vnet.ibm.com To: gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" Date: Tue, 28 Sep 2010 21:47:00 -0000 Message-ID: <1285689421.12736.138.camel@gargoyle> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-09/txt/msg00473.txt.bz2 Hi, This patch fixes a few scenarios where the testcases don't expect the "." prefix that appears in ppc64's symbols. These testcases (maint.exp, nodebug.exp, sepsymtab.exp and watchpoint-cond-gone.exp) were modified to expect it. gdb.base/watchpoint.exp assumes we always have 2 HW watchpoints available, and that assumption doesn't work for POWER server processors where we only have a single HW watchpoint available. This testcase takes a different path for POWER and expects a software watchpoint to be created instead. gdb.base/watch-read.exp tries to create both a HW write watchpoint and a HW read watchpoint, but since POWER server processors only support a single HW watchpoint, this doesn't work right. It's strange, though, that GDB actually creates two HW watches for ppc, but the last one overrides the read/write flags of the previous one and thus we miss triggers. I've used an awatch instead, though i'd have to check if GDB is doing something wrong and if we could make this testcase pass without any changes. The results with AWATCH are pretty much the same as with RWATCH + WATCH. Ok? 2010-09-28 Edjunior Machado Luis Machado * testsuite/gdb.base/maint.exp: Expect "." prefix. * testsuite/gdb.base/nodebug.exp: Expect "." Likewise. * testsuite/gdb.base/sepsymtab.exp: Expect "." Likewise. * testsuite/gdb.base/watchpoint-cond-gone.exp: Likewise. * testsuite/gdb.base/watch-read.exp: Use "awatch" for ppc instead of "watch" + "rwatch". * testsuite/gdb.base/watchpoint.exp: Expect a software watch to be created for POWER server processors. Index: gdb/testsuite/gdb.base/maint.exp =================================================================== --- gdb.orig/testsuite/gdb.base/maint.exp +++ gdb/testsuite/gdb.base/maint.exp @@ -253,7 +253,7 @@ gdb_expect { -re "msymbols_output\r\n$gdb_prompt $" { send_gdb "shell grep factorial msymbols_output\n" gdb_expect { - -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex factorial.*$gdb_prompt $" { + -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \.?factorial.*$gdb_prompt $" { pass "maint print msymbols" } -re ".*$gdb_prompt $" { fail "maint print msymbols" } @@ -280,7 +280,7 @@ gdb_test_multiple "maint print msymbols gdb_test_multiple "shell ls msymbols_output2" "maint print msymbols" { -re "msymbols_output2\r\n$gdb_prompt $" { gdb_test_multiple "shell grep factorial msymbols_output2" "maint print msymbols" { - -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex factorial.*$gdb_prompt $" { + -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \.?factorial.*$gdb_prompt $" { pass "maint print msymbols" } -re ".*$gdb_prompt $" { Index: gdb/testsuite/gdb.base/nodebug.exp =================================================================== --- gdb.orig/testsuite/gdb.base/nodebug.exp +++ gdb/testsuite/gdb.base/nodebug.exp @@ -75,7 +75,7 @@ if [runto inner] then { if {![test_compiler_info "gcc-*"]} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" } gdb_test "p top" \ - "\{(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))\} \[0-9a-fx]* " + "\{(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))\} \[0-9a-fx]* <\.?top(\\(int\\)|)>" if {![test_compiler_info "gcc-*"]} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" } gdb_test "whatis top" \ "(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))" @@ -85,7 +85,7 @@ if [runto inner] then { if {![test_compiler_info "gcc-*"]} then { setup_xfail "mips-sgi-irix5*" } setup_xfail "mips-sgi-irix6*" gdb_test "p middle" \ - "\{(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))\} \[0-9a-fx]* " + "\{(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))\} \[0-9a-fx]* <\.?middle(\\(int\\)|)>" if {![test_compiler_info "gcc-*"]} then { setup_xfail "mips-sgi-irix5*" } setup_xfail "mips-sgi-irix6*" gdb_test "whatis middle" \ Index: gdb/testsuite/gdb.base/sepsymtab.exp =================================================================== --- gdb.orig/testsuite/gdb.base/sepsymtab.exp +++ gdb/testsuite/gdb.base/sepsymtab.exp @@ -45,7 +45,7 @@ gdb_load ${binfile} set command "info sym main" set command_regex [string_to_regexp $command] gdb_test_multiple "$command" "$command" { - -re "^${command_regex}\[\r\n\]+main in section \[^\r\n\]+\[\r\n\]+$gdb_prompt \$" { + -re "^${command_regex}\[\r\n\]+\.?main in section \[^\r\n\]+\[\r\n\]+$gdb_prompt \$" { pass "$command" } } Index: gdb/testsuite/gdb.base/watch-read.exp =================================================================== --- gdb.orig/testsuite/gdb.base/watch-read.exp +++ gdb/testsuite/gdb.base/watch-read.exp @@ -78,7 +78,18 @@ gdb_test "continue" \ # watchpoint (leaving the read watchpoint) and continue. Only the # write watchpoint should be reported as triggering. -gdb_test "watch global" \ +# PPC Server has only a single HW watchpoint register, therefore we can't +# create both a HW read watchpoint and a HW write watchpoint. Even if GDB +# allows this, the watchpoint that was created last will override the mode of +# the first watchpoint. We use a access watchpoint instead. +if [istarget powerpc64-*] { + delete_breakpoints + set watch_command "awatch" +} else { + set watch_command "watch" +} + +gdb_test "$watch_command global" \ "atchpoint .*: global" \ "set write watchpoint on global variable" @@ -86,24 +97,52 @@ gdb_test "continue" \ "atchpoint .*: global.*Old value = 1.*New value = 2.*" \ "write watchpoint triggers" -set exp "" -set exp "${exp}2.*read watchpoint.*keep y.*global.*breakpoint already hit 2 times.*" -set exp "${exp}3.*watchpoint.*keep y.*global.*breakpoint already hit 1 time.*" -gdb_test "info watchpoints" \ - "$exp" \ - "only write watchpoint triggers when value changes" - -# The program is now stopped at the write line. Continuing should -# stop at the read line, and only the read watchpoint should be -# reported as triggering. - -gdb_test "continue" \ - "read watchpoint .*: global.*Value = 2.*in main.*$srcfile:$read_line.*" \ - "read watchpoint triggers when value doesn't change, trapping reads and writes" - -set exp "" -set exp "${exp}2.*read watchpoint.*keep y.*global.*breakpoint already hit 3 times.*" -set exp "${exp}3.*watchpoint.*keep y.*global.*breakpoint already hit 1 time.*" -gdb_test "info watchpoints" \ - "$exp" \ - "only read watchpoint triggers when value doesn't change" +# For the same reason as above, handle the PPC Server case separately. +if [istarget powerpc64-*] { + gdb_test "continue" \ + "atchpoint .*: global..*Value = 2.*" \ + "read watchpoint triggers" + + gdb_test "continue" \ + "atchpoint .*: global..*Old value = 2.*New value = 3.*" \ + "write watchpoint triggers" + + gdb_test "continue" \ + "atchpoint .*: global..*Value = 3.*" \ + "read watchpoint triggers" + + gdb_test "continue" \ + "atchpoint .*: global..*Old value = 3.*New value = 4.*" \ + "write watchpoint triggers" + +} else { + + set exp "" + set exp "${exp}2.*read watchpoint.*keep y.*global.*breakpoint already +hit 2 times.*" + set exp "${exp}3.*watchpoint.*keep y.*global.*breakpoint already +hit 1 time.*" + + gdb_test "info watchpoints" \ + "$exp" \ + "only write watchpoint triggers when value changes" + + # The program is now stopped at the write line. Continuing should + # stop at the read line, and only the read watchpoint should be + # reported as triggering. + + gdb_test "continue" \ + "read watchpoint .*: global.*Value = 2.*in main.*$srcfile:$read_line.*" \ + "read watchpoint triggers when value doesn't change, trapping reads +and writes" + + set exp "" + set exp "${exp}2.*read watchpoint.*keep y.*global.*breakpoint already +hit 3 times.*" + set exp "${exp}3.*watchpoint.*keep y.*global.*breakpoint already +hit 1 time.*" + + gdb_test "info watchpoints" \ + "$exp" \ + "only read watchpoint triggers when value doesn't change" +} Index: gdb/testsuite/gdb.base/watchpoint-cond-gone.exp =================================================================== --- gdb.orig/testsuite/gdb.base/watchpoint-cond-gone.exp +++ gdb/testsuite/gdb.base/watchpoint-cond-gone.exp @@ -46,6 +46,7 @@ gdb_test "watch c if c == 30" "atchpoint # We may stay either in the function itself or only at the first instruction of # its caller depending on the epilogue unwinder (or valid epilogue CFI) presence. + gdb_test "finish" \ - "Watchpoint .* deleted because the program has left the block in.*which its expression is valid..*in (jumper|func).*" \ + "Watchpoint .* deleted because the program has left the block in.*which its expression is valid..*in (\.?jumper|func).*" \ "Catch the no longer valid watchpoint" Index: gdb/testsuite/gdb.base/watchpoint.exp =================================================================== --- gdb.orig/testsuite/gdb.base/watchpoint.exp +++ gdb/testsuite/gdb.base/watchpoint.exp @@ -683,7 +683,13 @@ proc test_inaccessible_watchpoint {} { "$watchpoint_msg \[0-9\]+: \\*\\(int \\*\\) 0" delete_breakpoints - gdb_test "watch *global_ptr" "$watchpoint_msg \[0-9\]+: \\*global_ptr" + # This step requires two HW watchpoints. Since PPC Server only has + # a single one, it will use a SW watchpoint in this case. + if [istarget powerpc64-*] { + set watchpoint_msg "Watchpoint" + } + + gdb_test "watch *global_ptr" "$watchpoint_msg \[0-9\]+: \\\*global_ptr" gdb_test "set \$global_ptr_breakpoint_number = \$bpnum" "" gdb_test "next" ".*global_ptr = buf.*" "global_ptr next" gdb_test_multiple "next" "next over ptr init" {