Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [committed][gdb/testsuite] Make gdb.arch/amd64-gs_base.exp unsupported for i386
@ 2020-12-04 12:38 Tom de Vries
  2020-12-04 18:57 ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2020-12-04 12:38 UTC (permalink / raw)
  To: gdb-patches

Hi,

With target board unix/-m32 I run into:
...
(gdb) print /x $fs_base^M
$1 = void^M
(gdb) FAIL: gdb.arch/amd64-gs_base.exp: print fs_base
...

The problem is that the fs_base register is not supported for i386.

Fix this by making the test unsupported if fs_base/gs_base don't show up in
info register sys output.

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Make gdb.arch/amd64-gs_base.exp unsupported for i386

gdb/testsuite/ChangeLog:

2020-12-03  Tom de Vries  <tdevries@suse.de>

	PR testsuite/26990
	* gdb.arch/amd64-gs_base.exp: Handle -m32 where fs_base and gs_base
	are unsupported.

---
 gdb/testsuite/gdb.arch/amd64-gs_base.exp | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.arch/amd64-gs_base.exp b/gdb/testsuite/gdb.arch/amd64-gs_base.exp
index 3e14031d2d..d29043bb79 100644
--- a/gdb/testsuite/gdb.arch/amd64-gs_base.exp
+++ b/gdb/testsuite/gdb.arch/amd64-gs_base.exp
@@ -30,6 +30,31 @@ if ![runto_main] {
     return -1
 }
 
+# Test the presence of fs_base and gs_base on the system
+# register group and values.
+#
+set ws "\[\t \]+"
+set info_reg_out [multi_line "info register sys" \
+          "fs_base${ws}$hex${ws}$decimal"\
+          "gs_base${ws}$hex${ws}$decimal"\
+          "orig_rax${ws}$hex${ws}\[-\]$decimal" ]
+set info_reg_out_m32 [multi_line "info register sys" \
+          "orig_eax${ws}$hex${ws}\[-\]$decimal" ]
+
+set supported 0
+gdb_test_multiple "info register sys" "" {
+    -re -wrap $info_reg_out {
+	set supported 1
+    }
+    -re -wrap $info_reg_out_m32 {
+    }
+}
+
+if { ! $supported } {
+    unsupported "target does not support fs_base and gs_base"
+    return -1
+}
+
 gdb_test "print /x \$fs_base" "= $hex" "print fs_base"
 gdb_test "print /x \$gs_base" "= $hex" "print gs_base"
 
@@ -39,7 +64,6 @@ gdb_test "print \$gs_base = 3" "= 3" "set gs_base"
 # Test the presence of fs_base and gs_base on the system
 # register group and values.
 #
-set ws "\[\t \]+"
 set info_reg_out [multi_line "info register sys" \
           "fs_base${ws}0x2${ws}2"\
           "gs_base${ws}0x3${ws}3"\

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

* Re: [committed][gdb/testsuite] Make gdb.arch/amd64-gs_base.exp unsupported for i386
  2020-12-04 12:38 [committed][gdb/testsuite] Make gdb.arch/amd64-gs_base.exp unsupported for i386 Tom de Vries
@ 2020-12-04 18:57 ` Pedro Alves
  2020-12-08  8:20   ` Tom de Vries
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2020-12-04 18:57 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches

On 12/4/20 12:38 PM, Tom de Vries wrote:
> Hi,
> 
> With target board unix/-m32 I run into:
> ...
> (gdb) print /x $fs_base^M
> $1 = void^M
> (gdb) FAIL: gdb.arch/amd64-gs_base.exp: print fs_base
> ...
> 
> The problem is that the fs_base register is not supported for i386.
> 
> Fix this by making the test unsupported if fs_base/gs_base don't show up in
> info register sys output.


Why not check is_amd64_regs_target instead?

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

* Re: [committed][gdb/testsuite] Make gdb.arch/amd64-gs_base.exp unsupported for i386
  2020-12-04 18:57 ` Pedro Alves
@ 2020-12-08  8:20   ` Tom de Vries
  0 siblings, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2020-12-08  8:20 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 577 bytes --]

On 12/4/20 7:57 PM, Pedro Alves wrote:
> On 12/4/20 12:38 PM, Tom de Vries wrote:
>> Hi,
>>
>> With target board unix/-m32 I run into:
>> ...
>> (gdb) print /x $fs_base^M
>> $1 = void^M
>> (gdb) FAIL: gdb.arch/amd64-gs_base.exp: print fs_base
>> ...
>>
>> The problem is that the fs_base register is not supported for i386.
>>
>> Fix this by making the test unsupported if fs_base/gs_base don't show up in
>> info register sys output.
> 
> 
> Why not check is_amd64_regs_target instead?
> 

Agreed, that's simpler.

Fixed in attached patch, will commit shortly.

Thanks,
- Tom

[-- Attachment #2: 0011-gdb-testsuite-Simplify-gdb.arch-amd64-gs_base.exp.patch --]
[-- Type: text/x-patch, Size: 2168 bytes --]

[gdb/testsuite] Simplify gdb.arch/amd64-gs_base.exp

Redo fix committed in commit 67748e0f66 "[gdb/testsuite] Make
gdb.arch/amd64-gs_base.exp unsupported for i386" using is_amd64_regs_target.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-12-08  Tom de Vries  <tdevries@suse.de>

	* gdb.arch/amd64-gs_base.exp: Undo commit 67748e0f66, reimplement
	using is_amd64_regs_target.

---
 gdb/testsuite/gdb.arch/amd64-gs_base.exp | 28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/amd64-gs_base.exp b/gdb/testsuite/gdb.arch/amd64-gs_base.exp
index d29043bb79..a5cf98d2cc 100644
--- a/gdb/testsuite/gdb.arch/amd64-gs_base.exp
+++ b/gdb/testsuite/gdb.arch/amd64-gs_base.exp
@@ -15,7 +15,7 @@
 
 standard_testfile
 
-if { ![istarget "x86_64-*linux*"] } then {
+if { ![is_amd64_regs_target] } then {
     verbose "Untested x86_64 fs_base and gs_base tests."
     return
 }
@@ -30,31 +30,6 @@ if ![runto_main] {
     return -1
 }
 
-# Test the presence of fs_base and gs_base on the system
-# register group and values.
-#
-set ws "\[\t \]+"
-set info_reg_out [multi_line "info register sys" \
-          "fs_base${ws}$hex${ws}$decimal"\
-          "gs_base${ws}$hex${ws}$decimal"\
-          "orig_rax${ws}$hex${ws}\[-\]$decimal" ]
-set info_reg_out_m32 [multi_line "info register sys" \
-          "orig_eax${ws}$hex${ws}\[-\]$decimal" ]
-
-set supported 0
-gdb_test_multiple "info register sys" "" {
-    -re -wrap $info_reg_out {
-	set supported 1
-    }
-    -re -wrap $info_reg_out_m32 {
-    }
-}
-
-if { ! $supported } {
-    unsupported "target does not support fs_base and gs_base"
-    return -1
-}
-
 gdb_test "print /x \$fs_base" "= $hex" "print fs_base"
 gdb_test "print /x \$gs_base" "= $hex" "print gs_base"
 
@@ -64,6 +39,7 @@ gdb_test "print \$gs_base = 3" "= 3" "set gs_base"
 # Test the presence of fs_base and gs_base on the system
 # register group and values.
 #
+set ws "\[\t \]+"
 set info_reg_out [multi_line "info register sys" \
           "fs_base${ws}0x2${ws}2"\
           "gs_base${ws}0x3${ws}3"\

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

end of thread, other threads:[~2020-12-08  8:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-04 12:38 [committed][gdb/testsuite] Make gdb.arch/amd64-gs_base.exp unsupported for i386 Tom de Vries
2020-12-04 18:57 ` Pedro Alves
2020-12-08  8:20   ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox