public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] testcases: Fix assorted problems related to powerpc
@ 2010-09-28 21:47 Luis Machado
  2010-09-28 21:48 ` Pedro Alves
  0 siblings, 1 reply; 7+ messages in thread
From: Luis Machado @ 2010-09-28 21:47 UTC (permalink / raw)
  To: gdb-patches

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  <emachado@br.ibm.com>
	    Luis Machado  <luisgpm@br.ibm.com>

	* 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]* <top(\\(int\\)|)>"
+	"\{(<(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]* <middle(\\(int\\)|)>"
+	"\{(<(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" {


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] testcases: Fix assorted problems related to powerpc
  2010-09-28 21:47 [PATCH] testcases: Fix assorted problems related to powerpc Luis Machado
@ 2010-09-28 21:48 ` Pedro Alves
  2010-09-29 15:04   ` Luis Machado
  0 siblings, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2010-09-28 21:48 UTC (permalink / raw)
  To: gdb-patches, luisgpm

On Tuesday 28 September 2010 16:57:01, Luis Machado wrote:
> 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.
> 

GDB is doing something wrong, and it's possible to make ppc pass this
testcase without any (test) changes.  I think the patch below is what
I used to test on ppc when I wrote that test
(<http://sourceware.org/ml/gdb-patches/2010-02/msg00521.html>), and
the test passed with it.

-- 
Pedro Alves

Index: src/gdb/ppc-linux-nat.c
===================================================================
--- src.orig/gdb/ppc-linux-nat.c	2010-02-22 12:27:25.000000000 -0800
+++ src/gdb/ppc-linux-nat.c	2010-02-22 12:27:29.000000000 -0800
@@ -1270,6 +1270,9 @@ store_ppc_registers (const struct regcac
     store_spe_register (regcache, tid, -1);
 }
 
+/* The cached DABR value, to install in new threads.  */
+static long saved_dabr_value;
+
 static int
 ppc_linux_check_watch_resources (int type, int cnt, int ot)
 {
@@ -1324,9 +1327,6 @@ ppc_linux_region_ok_for_hw_watchpoint (C
   return 1;
 }
 
-/* The cached DABR value, to install in new threads.  */
-static long saved_dabr_value;
-
 /* Set a watchpoint of type TYPE at address ADDR.  */
 static int
 ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw)
@@ -1352,6 +1352,11 @@ ppc_linux_insert_watchpoint (CORE_ADDR a
   }
 
   dabr_value = addr & ~(read_mode | write_mode);
+
+  gdb_assert (saved_dabr_value == 0
+	      || (saved_dabr_value & ~(read_mode | write_mode)) == dabr_value);
+
+  dabr_value |= (saved_dabr_value & (read_mode | write_mode));
   switch (rw)
     {
     case hw_read:

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] testcases: Fix assorted problems related to powerpc
  2010-09-28 21:48 ` Pedro Alves
@ 2010-09-29 15:04   ` Luis Machado
  0 siblings, 0 replies; 7+ messages in thread
From: Luis Machado @ 2010-09-29 15:04 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Thanks Pedro.

That patch does fix the problem. I'll send an updated patch without
fixes to watch-read.exp.

Luis

On Tue, 2010-09-28 at 17:08 +0100, Pedro Alves wrote:
> On Tuesday 28 September 2010 16:57:01, Luis Machado wrote:
> > 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.
> > 
> 
> GDB is doing something wrong, and it's possible to make ppc pass this
> testcase without any (test) changes.  I think the patch below is what
> I used to test on ppc when I wrote that test
> (<http://sourceware.org/ml/gdb-patches/2010-02/msg00521.html>), and
> the test passed with it.
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] testcases: Fix assorted problems related to powerpc
  2010-11-09  4:47 ` Jan Kratochvil
  2010-11-09  5:46   ` Doug Evans
@ 2010-11-27 22:09   ` Andreas Schwab
  1 sibling, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2010-11-27 22:09 UTC (permalink / raw)
  To: Jan Kratochvil
  Cc: Luis Machado, gdb-patches, Pedro Alves, Edjunior Barbosa Machado

Jan Kratochvil <jan.kratochvil@redhat.com> writes:

> --- src/gdb/testsuite/gdb.base/watchpoint.exp	2010/09/04 15:30:09	1.31
> +++ src/gdb/testsuite/gdb.base/watchpoint.exp	2010/11/09 04:44:17	1.32
> @@ -683,7 +683,13 @@
>  	    "$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-*] {

Why powerpc64?

> +	    set watchpoint_msg "Watchpoint"
> +	}
> +
> +	gdb_test "watch *global_ptr" "$watchpoint_msg \[0-9\]+: \\\*global_ptr"

That has an extra backslash.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] testcases: Fix assorted problems related to powerpc
  2010-11-09  4:47 ` Jan Kratochvil
@ 2010-11-09  5:46   ` Doug Evans
  2010-11-27 22:09   ` Andreas Schwab
  1 sibling, 0 replies; 7+ messages in thread
From: Doug Evans @ 2010-11-09  5:46 UTC (permalink / raw)
  To: Jan Kratochvil
  Cc: Luis Machado, gdb-patches, Pedro Alves, Edjunior Barbosa Machado

On Mon, Nov 8, 2010 at 8:47 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Wed, 29 Sep 2010 15:34:01 +0200, Luis Machado wrote:
>> Updated patch without the "fix" to watch-read.exp.
>
> Checked-in with the same \. -> \\. change as described in:
>        Re: [PATCH] testsuite: break-entry.exp: convert entry point for ppc64
>        http://sourceware.org/ml/gdb-patches/2010-10/msg00057.html
>
> Tested on:
>        {x86_64,x86_64-m32}-fedora14-linux-gnu
>        {ppc64,ppc64-m32}-rhel6-linux-gnu
>
>
> Thanks,
> Jan
>
>
> http://sourceware.org/ml/gdb-cvs/2010-11/msg00043.html
>
> --- src/gdb/testsuite/ChangeLog 2010/11/08 18:05:55     1.2502
> +++ src/gdb/testsuite/ChangeLog 2010/11/09 04:44:16     1.2503
> @@ -1,3 +1,13 @@
> +2010-11-09  Edjunior Machado  <emachado@br.ibm.com>
> +           Luis Machado  <luisgpm@br.ibm.com>
> +
> +       * gdb.base/maint.exp: Expect "." prefix.
> +       * gdb.base/nodebug.exp: Expect "." Likewise.
> +       * gdb.base/sepsymtab.exp: Expect "." Likewise.
> +       * gdb.base/watchpoint-cond-gone.exp: Likewise.
> +       * gdb.base/watchpoint.exp: Expect a software watch to be created for
> +       POWER server processors.
> +
>  2010-11-08  Edjunior Machado  <emachado@br.ibm.com>
>            Luis Machado  <luisgpm@br.ibm.com>
>
> --- src/gdb/testsuite/gdb.base/maint.exp        2010/09/08 17:22:26     1.48
> +++ src/gdb/testsuite/gdb.base/maint.exp        2010/11/09 04:44:17     1.49
> @@ -253,7 +253,7 @@
>            -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 "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 $" {
> --- src/gdb/testsuite/gdb.base/nodebug.exp      2010/05/25 19:34:04     1.14
> +++ src/gdb/testsuite/gdb.base/nodebug.exp      2010/11/09 04:44:17     1.15
> @@ -75,7 +75,7 @@
>
>     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]* <top(\\(int\\)|)>"
> +       "\{(<(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 {![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]* <middle(\\(int\\)|)>"
> +       "\{(<(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" \
> --- src/gdb/testsuite/gdb.base/sepsymtab.exp    2010/01/01 07:32:01     1.9
> +++ src/gdb/testsuite/gdb.base/sepsymtab.exp    2010/11/09 04:44:17     1.10
> @@ -45,7 +45,7 @@
>  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"
>     }
>  }
> --- src/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp 2010/06/01 21:29:21     1.2
> +++ src/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp 2010/11/09 04:44:17     1.3
> @@ -46,6 +46,7 @@
>
>  # 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"
> --- src/gdb/testsuite/gdb.base/watchpoint.exp   2010/09/04 15:30:09     1.31
> +++ src/gdb/testsuite/gdb.base/watchpoint.exp   2010/11/09 04:44:17     1.32
> @@ -683,7 +683,13 @@
>            "$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" {

I wonder if it would be sufficiently useful to have comments there to
explain why the \\.? is present.
It could even be factored out to something like

set ppc_prefix "\\.?"

or a function call that prepended the prefix when necessary.

It feels like an obscure target-specific detail that is going to get
scattered throughout the testsuite.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] testcases: Fix assorted problems related to powerpc
  2010-09-29 16:32 Luis Machado
@ 2010-11-09  4:47 ` Jan Kratochvil
  2010-11-09  5:46   ` Doug Evans
  2010-11-27 22:09   ` Andreas Schwab
  0 siblings, 2 replies; 7+ messages in thread
From: Jan Kratochvil @ 2010-11-09  4:47 UTC (permalink / raw)
  To: Luis Machado; +Cc: gdb-patches, Pedro Alves, Edjunior Barbosa Machado

On Wed, 29 Sep 2010 15:34:01 +0200, Luis Machado wrote:
> Updated patch without the "fix" to watch-read.exp.

Checked-in with the same \. -> \\. change as described in:
	Re: [PATCH] testsuite: break-entry.exp: convert entry point for ppc64
	http://sourceware.org/ml/gdb-patches/2010-10/msg00057.html

Tested on:
	{x86_64,x86_64-m32}-fedora14-linux-gnu
	{ppc64,ppc64-m32}-rhel6-linux-gnu


Thanks,
Jan


http://sourceware.org/ml/gdb-cvs/2010-11/msg00043.html

--- src/gdb/testsuite/ChangeLog	2010/11/08 18:05:55	1.2502
+++ src/gdb/testsuite/ChangeLog	2010/11/09 04:44:16	1.2503
@@ -1,3 +1,13 @@
+2010-11-09  Edjunior Machado  <emachado@br.ibm.com>
+	    Luis Machado  <luisgpm@br.ibm.com>
+
+	* gdb.base/maint.exp: Expect "." prefix.
+	* gdb.base/nodebug.exp: Expect "." Likewise.
+	* gdb.base/sepsymtab.exp: Expect "." Likewise.
+	* gdb.base/watchpoint-cond-gone.exp: Likewise.
+	* gdb.base/watchpoint.exp: Expect a software watch to be created for
+	POWER server processors.
+
 2010-11-08  Edjunior Machado  <emachado@br.ibm.com>
 	    Luis Machado  <luisgpm@br.ibm.com>
 
--- src/gdb/testsuite/gdb.base/maint.exp	2010/09/08 17:22:26	1.48
+++ src/gdb/testsuite/gdb.base/maint.exp	2010/11/09 04:44:17	1.49
@@ -253,7 +253,7 @@
 	    -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 "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 $" {
--- src/gdb/testsuite/gdb.base/nodebug.exp	2010/05/25 19:34:04	1.14
+++ src/gdb/testsuite/gdb.base/nodebug.exp	2010/11/09 04:44:17	1.15
@@ -75,7 +75,7 @@
     
     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]* <top(\\(int\\)|)>"
+	"\{(<(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 {![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]* <middle(\\(int\\)|)>"
+	"\{(<(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" \
--- src/gdb/testsuite/gdb.base/sepsymtab.exp	2010/01/01 07:32:01	1.9
+++ src/gdb/testsuite/gdb.base/sepsymtab.exp	2010/11/09 04:44:17	1.10
@@ -45,7 +45,7 @@
 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"
     }
 }
--- src/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp	2010/06/01 21:29:21	1.2
+++ src/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp	2010/11/09 04:44:17	1.3
@@ -46,6 +46,7 @@
 
 # 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"
--- src/gdb/testsuite/gdb.base/watchpoint.exp	2010/09/04 15:30:09	1.31
+++ src/gdb/testsuite/gdb.base/watchpoint.exp	2010/11/09 04:44:17	1.32
@@ -683,7 +683,13 @@
 	    "$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" {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] testcases: Fix assorted problems related to powerpc
@ 2010-09-29 16:32 Luis Machado
  2010-11-09  4:47 ` Jan Kratochvil
  0 siblings, 1 reply; 7+ messages in thread
From: Luis Machado @ 2010-09-29 16:32 UTC (permalink / raw)
  To: gdb-patches; +Cc: Pedro Alves

Updated patch without the "fix" to watch-read.exp.


2010-09-29  Edjunior Machado  <emachado@br.ibm.com>
	    Luis Machado  <luisgpm@br.ibm.com>

	* 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/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]* <top(\\(int\\)|)>"
+	"\{(<(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]* <middle(\\(int\\)|)>"
+	"\{(<(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/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" {



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-11-27 22:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-28 21:47 [PATCH] testcases: Fix assorted problems related to powerpc Luis Machado
2010-09-28 21:48 ` Pedro Alves
2010-09-29 15:04   ` Luis Machado
2010-09-29 16:32 Luis Machado
2010-11-09  4:47 ` Jan Kratochvil
2010-11-09  5:46   ` Doug Evans
2010-11-27 22:09   ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).