* [obv] testsuite: gdb.trace/*: Use is_lp64_target
@ 2011-08-26 9:26 Jan Kratochvil
2011-08-26 13:48 ` H.J. Lu
0 siblings, 1 reply; 13+ messages in thread
From: Jan Kratochvil @ 2011-08-26 9:26 UTC (permalink / raw)
To: gdb-patches
Hi,
checked in as obvious.
There are always these FAILs in all the cases, I did not investigate them more.
FAIL: gdb.trace/unavailable.exp: unavailable arguments: print &argc
FAIL: gdb.trace/unavailable.exp: unavailable arguments: print &argi
FAIL: gdb.trace/unavailable.exp: unavailable arguments: print &argf
FAIL: gdb.trace/unavailable.exp: unavailable arguments: print &argd
FAIL: gdb.trace/unavailable.exp: unavailable arguments: print &argarray
Tested on {x86_64,x86_64-m32,i686}-fedora16pre-linux-gnu.
Thanks,
Jan
http://sourceware.org/ml/gdb-cvs/2011-08/msg00111.html
--- src/gdb/testsuite/ChangeLog 2011/08/18 16:19:00 1.2837
+++ src/gdb/testsuite/ChangeLog 2011/08/26 09:20:43 1.2838
@@ -1,3 +1,11 @@
+2011-08-26 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.trace/backtrace.exp: Use is_lp64_target to check 64bit target.
+ * gdb.trace/collection.exp: Likewise.
+ * gdb.trace/report.exp: Likewise.
+ * gdb.trace/unavailable.exp: Likewise.
+ * gdb.trace/while-dyn.exp: Likewise.
+
2011-08-18 Keith Seitz <keiths@redhat.com>
PR c++/12266
--- src/gdb/testsuite/gdb.trace/backtrace.exp 2011/01/01 15:33:50 1.18
+++ src/gdb/testsuite/gdb.trace/backtrace.exp 2011/08/26 09:20:44 1.19
@@ -150,10 +150,10 @@
"$tdp4" \
"collect \$regs, \$args, \$locs" "^$"
-if [istarget "x86_64-*"] then {
+if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
set fpreg "\$rbp"
set spreg "\$rsp"
-} elseif [istarget "i?86-*"] then {
+} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
set fpreg "\$ebp"
set spreg "\$esp"
} else {
--- src/gdb/testsuite/gdb.trace/collection.exp 2011/02/16 18:07:58 1.24
+++ src/gdb/testsuite/gdb.trace/collection.exp 2011/08/26 09:20:44 1.25
@@ -45,11 +45,11 @@
set ws "\[\r\n\t \]+"
set cr "\[\r\n\]+"
-if [istarget "x86_64-*"] then {
+if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
set fpreg "rbp"
set spreg "rsp"
set pcreg "rip"
-} elseif [istarget "i?86-*"] then {
+} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
set fpreg "ebp"
set spreg "esp"
set pcreg "eip"
--- src/gdb/testsuite/gdb.trace/report.exp 2011/03/07 20:25:57 1.19
+++ src/gdb/testsuite/gdb.trace/report.exp 2011/08/26 09:20:44 1.20
@@ -159,11 +159,11 @@
"$tdp4" \
"collect \$locs" "^$"
-if [istarget "x86_64-*"] then {
+if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
set fpreg "rbp"
set spreg "rsp"
set pcreg "rip"
-} elseif [istarget "i?86-*"] then {
+} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
set fpreg "ebp"
set spreg "esp"
set pcreg "eip"
--- src/gdb/testsuite/gdb.trace/unavailable.exp 2011/08/05 15:17:59 1.9
+++ src/gdb/testsuite/gdb.trace/unavailable.exp 2011/08/26 09:20:44 1.10
@@ -30,11 +30,11 @@
set ws "\[\r\n\t \]+"
set cr "\[\r\n\]+"
-if [istarget "x86_64-*"] then {
+if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
set fpreg "rbp"
set spreg "rsp"
set pcreg "rip"
-} elseif [istarget "i?86-*"] then {
+} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
set fpreg "ebp"
set spreg "esp"
set pcreg "eip"
@@ -295,12 +295,12 @@
# Test reading uncollected pseudo-registers. The set of which
# depends on target.
- if [istarget "x86_64-*"] then {
+ if {$pcreg == "rip"} then {
# Check the raw register first.
test_register_unavailable "\$rax"
test_register_unavailable "\$eax"
test_register_unavailable "\$ax"
- } elseif [istarget "i?86-*"] then {
+ } elseif {$pcreg == "eip"} then {
# Check the raw register first.
test_register_unavailable "\$eax"
test_register_unavailable "\$ax"
--- src/gdb/testsuite/gdb.trace/while-dyn.exp 2011/01/01 15:33:50 1.18
+++ src/gdb/testsuite/gdb.trace/while-dyn.exp 2011/08/26 09:20:44 1.19
@@ -52,9 +52,9 @@
# test while-stepping dynamically (live target)
#
-if [istarget "x86_64-*"] then {
+if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
set fpreg "\$rbp"
-} elseif [istarget "i?86-*"] then {
+} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
set fpreg "\$ebp"
} else {
set fpreg "\$fp"
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [obv] testsuite: gdb.trace/*: Use is_lp64_target
2011-08-26 9:26 [obv] testsuite: gdb.trace/*: Use is_lp64_target Jan Kratochvil
@ 2011-08-26 13:48 ` H.J. Lu
2011-08-26 15:37 ` Jan Kratochvil
2011-08-28 20:07 ` [patch] testsuite: Fix x32, introduce is_amd64_regs_target [Re: [obv] testsuite: gdb.trace/*: Use is_lp64_target] Jan Kratochvil
0 siblings, 2 replies; 13+ messages in thread
From: H.J. Lu @ 2011-08-26 13:48 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
On Fri, Aug 26, 2011 at 2:25 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> Hi,
>
> checked in as obvious.
>
> There are always these FAILs in all the cases, I did not investigate them more.
> FAIL: gdb.trace/unavailable.exp: unavailable arguments: print &argc
> FAIL: gdb.trace/unavailable.exp: unavailable arguments: print &argi
> FAIL: gdb.trace/unavailable.exp: unavailable arguments: print &argf
> FAIL: gdb.trace/unavailable.exp: unavailable arguments: print &argd
> FAIL: gdb.trace/unavailable.exp: unavailable arguments: print &argarray
>
> Tested on {x86_64,x86_64-m32,i686}-fedora16pre-linux-gnu.
>
>
> Thanks,
> Jan
>
>
> http://sourceware.org/ml/gdb-cvs/2011-08/msg00111.html
>
> --- src/gdb/testsuite/ChangeLog 2011/08/18 16:19:00 1.2837
> +++ src/gdb/testsuite/ChangeLog 2011/08/26 09:20:43 1.2838
> @@ -1,3 +1,11 @@
> +2011-08-26 Jan Kratochvil <jan.kratochvil@redhat.com>
> +
> + * gdb.trace/backtrace.exp: Use is_lp64_target to check 64bit target.
> + * gdb.trace/collection.exp: Likewise.
> + * gdb.trace/report.exp: Likewise.
> + * gdb.trace/unavailable.exp: Likewise.
> + * gdb.trace/while-dyn.exp: Likewise.
> +
> 2011-08-18 Keith Seitz <keiths@redhat.com>
>
> PR c++/12266
> --- src/gdb/testsuite/gdb.trace/backtrace.exp 2011/01/01 15:33:50 1.18
> +++ src/gdb/testsuite/gdb.trace/backtrace.exp 2011/08/26 09:20:44 1.19
> @@ -150,10 +150,10 @@
> "$tdp4" \
> "collect \$regs, \$args, \$locs" "^$"
>
> -if [istarget "x86_64-*"] then {
> +if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
> set fpreg "\$rbp"
> set spreg "\$rsp"
> -} elseif [istarget "i?86-*"] then {
> +} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
> set fpreg "\$ebp"
> set spreg "\$esp"
> } else {
> --- src/gdb/testsuite/gdb.trace/collection.exp 2011/02/16 18:07:58 1.24
> +++ src/gdb/testsuite/gdb.trace/collection.exp 2011/08/26 09:20:44 1.25
> @@ -45,11 +45,11 @@
> set ws "\[\r\n\t \]+"
> set cr "\[\r\n\]+"
>
> -if [istarget "x86_64-*"] then {
> +if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
> set fpreg "rbp"
> set spreg "rsp"
> set pcreg "rip"
> -} elseif [istarget "i?86-*"] then {
> +} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
> set fpreg "ebp"
> set spreg "esp"
> set pcreg "eip"
> --- src/gdb/testsuite/gdb.trace/report.exp 2011/03/07 20:25:57 1.19
> +++ src/gdb/testsuite/gdb.trace/report.exp 2011/08/26 09:20:44 1.20
> @@ -159,11 +159,11 @@
> "$tdp4" \
> "collect \$locs" "^$"
>
> -if [istarget "x86_64-*"] then {
> +if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
> set fpreg "rbp"
> set spreg "rsp"
> set pcreg "rip"
> -} elseif [istarget "i?86-*"] then {
> +} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
> set fpreg "ebp"
> set spreg "esp"
> set pcreg "eip"
> --- src/gdb/testsuite/gdb.trace/unavailable.exp 2011/08/05 15:17:59 1.9
> +++ src/gdb/testsuite/gdb.trace/unavailable.exp 2011/08/26 09:20:44 1.10
> @@ -30,11 +30,11 @@
> set ws "\[\r\n\t \]+"
> set cr "\[\r\n\]+"
>
> -if [istarget "x86_64-*"] then {
> +if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
> set fpreg "rbp"
> set spreg "rsp"
> set pcreg "rip"
> -} elseif [istarget "i?86-*"] then {
> +} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
> set fpreg "ebp"
> set spreg "esp"
> set pcreg "eip"
> @@ -295,12 +295,12 @@
>
> # Test reading uncollected pseudo-registers. The set of which
> # depends on target.
> - if [istarget "x86_64-*"] then {
> + if {$pcreg == "rip"} then {
> # Check the raw register first.
> test_register_unavailable "\$rax"
> test_register_unavailable "\$eax"
> test_register_unavailable "\$ax"
> - } elseif [istarget "i?86-*"] then {
> + } elseif {$pcreg == "eip"} then {
> # Check the raw register first.
> test_register_unavailable "\$eax"
> test_register_unavailable "\$ax"
> --- src/gdb/testsuite/gdb.trace/while-dyn.exp 2011/01/01 15:33:50 1.18
> +++ src/gdb/testsuite/gdb.trace/while-dyn.exp 2011/08/26 09:20:44 1.19
> @@ -52,9 +52,9 @@
> # test while-stepping dynamically (live target)
> #
>
> -if [istarget "x86_64-*"] then {
> +if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
> set fpreg "\$rbp"
> -} elseif [istarget "i?86-*"] then {
> +} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
> set fpreg "\$ebp"
> } else {
> set fpreg "\$fp"
>
That is wrong for x32. X32 isn't LP64, but has 64bit registers.
--
H.J.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [obv] testsuite: gdb.trace/*: Use is_lp64_target
2011-08-26 13:48 ` H.J. Lu
@ 2011-08-26 15:37 ` Jan Kratochvil
2011-08-26 15:59 ` H.J. Lu
2011-08-28 20:07 ` [patch] testsuite: Fix x32, introduce is_amd64_regs_target [Re: [obv] testsuite: gdb.trace/*: Use is_lp64_target] Jan Kratochvil
1 sibling, 1 reply; 13+ messages in thread
From: Jan Kratochvil @ 2011-08-26 15:37 UTC (permalink / raw)
To: H.J. Lu; +Cc: gdb-patches
On Fri, 26 Aug 2011 15:48:33 +0200, H.J. Lu wrote:
> On Fri, Aug 26, 2011 at 2:25 AM, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> > -if [istarget "x86_64-*"] then {
> > +if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
> > Â Â set fpreg "\$rbp"
> > -} elseif [istarget "i?86-*"] then {
> > +} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
> > Â Â set fpreg "\$ebp"
> > Â } else {
> > Â Â set fpreg "\$fp"
> >
>
> That is wrong for x32. X32 isn't LP64, but has 64bit registers.
I agree. I tried to fix all the [is_lp64_target] vs. ![is_ilp32_target] cases
for x86* in the testsuite but I am not sure how x32* behaves, do you have
some qemu/kvm image with x32* toolchain? I could not fina any on:
http://sites.google.com/site/x32abi/
Thanks,
Jan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [obv] testsuite: gdb.trace/*: Use is_lp64_target
2011-08-26 15:37 ` Jan Kratochvil
@ 2011-08-26 15:59 ` H.J. Lu
0 siblings, 0 replies; 13+ messages in thread
From: H.J. Lu @ 2011-08-26 15:59 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
On Fri, Aug 26, 2011 at 8:37 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Fri, 26 Aug 2011 15:48:33 +0200, H.J. Lu wrote:
>> On Fri, Aug 26, 2011 at 2:25 AM, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
>> > -if [istarget "x86_64-*"] then {
>> > +if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
>> > set fpreg "\$rbp"
>> > -} elseif [istarget "i?86-*"] then {
>> > +} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
>> > set fpreg "\$ebp"
>> > } else {
>> > set fpreg "\$fp"
>> >
>>
>> That is wrong for x32. X32 isn't LP64, but has 64bit registers.
>
> I agree. I tried to fix all the [is_lp64_target] vs. ![is_ilp32_target] cases
> for x86* in the testsuite but I am not sure how x32* behaves, do you have
> some qemu/kvm image with x32* toolchain? I could not fina any on:
> http://sites.google.com/site/x32abi/
>
If you use Fedora 15, you can add x32 yum repository:
http://www.kernel.org/pub/linux/libs/glibc/hjl/x32/fedora/15/x86_64/
and install x32 kernel/glibc rpms. Then you can enable x32 on
GCC trunk.
BTW, I will upload x32 GCC binary for Fedora 15 to
http://www.kernel.org/pub/linux/libs/glibc/hjl/x32/fedora/15/gcc/
It may take a while.
Thanks.
--
H.J.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [patch] testsuite: Fix x32, introduce is_amd64_regs_target [Re: [obv] testsuite: gdb.trace/*: Use is_lp64_target]
2011-08-26 13:48 ` H.J. Lu
2011-08-26 15:37 ` Jan Kratochvil
@ 2011-08-28 20:07 ` Jan Kratochvil
2011-08-28 21:06 ` Mark Kettenis
2011-08-28 21:19 ` [patch] testsuite: Fix x32, introduce is_amd64_regs_target [Re: [obv] testsuite: gdb.trace/*: Use is_lp64_target] Jan Kratochvil
1 sibling, 2 replies; 13+ messages in thread
From: Jan Kratochvil @ 2011-08-28 20:07 UTC (permalink / raw)
To: H.J. Lu; +Cc: gdb-patches
On Fri, 26 Aug 2011 15:48:33 +0200, H.J. Lu wrote:
> That is wrong for x32. X32 isn't LP64, but has 64bit registers.
x32 uses triple x86_64-x32-linux* which matches x86_64-*-*.
x32 was already broken as [is_x86_like_target] expects i386 instructions and
registers:
is_lp64_target=0
is_ilp32_target=1
is_x86_like_target=1
Fixed testsuite now reports for x32:
is_lp64_target=0
is_ilp32_target=1
is_x86_like_target=0
is_amd64_regs_target=1
For normal -m64 the behavior is not changed:
is_lp64_target=1
is_ilp32_target=0
is_x86_like_target=0
is_amd64_regs_target=1
and neither changed for -m32:
is_lp64_target=0
is_ilp32_target=1
is_x86_like_target=1
is_amd64_regs_target=0
Still even after these fixes I see various problems of x32 GDB but that is sure
outside of the scope of this patch.
I will check it in if no comments appear. No regressions on
{x86_64,x86_64-m32,i686}-fedora16pre-linux-gnu.
Thanks,
Jan
gdb/testsuite/
2011-08-28 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix compatibility with x32 arch.
* testsuite/gdb.dwarf2/typeddwarf.exp: Check also is_lp64_target.
* testsuite/gdb.trace/backtrace.exp: Use is_amd64_regs_target and
is_x86_like_target.
* testsuite/gdb.trace/collection.exp: Likewise.
* testsuite/gdb.trace/report.exp: Likewise.
* testsuite/gdb.trace/unavailable.exp: Likewise.
* testsuite/gdb.trace/while-dyn.exp: Likewise.
* testsuite/lib/gdb.exp (is_amd64_regs_target): New function.
(is_x86_like_target): Check also is_amd64_regs_target.
--- a/gdb/testsuite/gdb.dwarf2/typeddwarf.exp
+++ b/gdb/testsuite/gdb.dwarf2/typeddwarf.exp
@@ -22,10 +22,10 @@ if ![dwarf2_support] {
return 0
}
-# This test can only be run on x86 and amd64 targets.
+# This test can only be run on x86 and amd64 targets (and not x32).
if { [is_x86_like_target] } {
set sfile ${test}.S
-} elseif {[istarget "x86_64-*-*"]} {
+} elseif {[istarget "x86_64-*-*"] && [is_lp64_target]} {
set sfile ${test}-amd64.S
} else {
return 0
--- a/gdb/testsuite/gdb.trace/backtrace.exp
+++ b/gdb/testsuite/gdb.trace/backtrace.exp
@@ -150,10 +150,10 @@ gdb_trace_setactions "8.6: setup TP to collect regs, args, and locals" \
"$tdp4" \
"collect \$regs, \$args, \$locs" "^$"
-if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
+if [is_amd64_regs_target] {
set fpreg "\$rbp"
set spreg "\$rsp"
-} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
+} elseif [is_x86_like_target] {
set fpreg "\$ebp"
set spreg "\$esp"
} else {
--- a/gdb/testsuite/gdb.trace/collection.exp
+++ b/gdb/testsuite/gdb.trace/collection.exp
@@ -45,11 +45,11 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
set ws "\[\r\n\t \]+"
set cr "\[\r\n\]+"
-if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
+if [is_amd64_regs_target] {
set fpreg "rbp"
set spreg "rsp"
set pcreg "rip"
-} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
+} elseif [is_x86_like_target] {
set fpreg "ebp"
set spreg "esp"
set pcreg "eip"
--- a/gdb/testsuite/gdb.trace/report.exp
+++ b/gdb/testsuite/gdb.trace/report.exp
@@ -159,11 +159,11 @@ gdb_trace_setactions "9.x: setup TP to collect locals" \
"$tdp4" \
"collect \$locs" "^$"
-if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
+if [is_amd64_regs_target] {
set fpreg "rbp"
set spreg "rsp"
set pcreg "rip"
-} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
+} elseif [is_x86_like_target] {
set fpreg "ebp"
set spreg "esp"
set pcreg "eip"
--- a/gdb/testsuite/gdb.trace/unavailable.exp
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
@@ -30,11 +30,11 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
set ws "\[\r\n\t \]+"
set cr "\[\r\n\]+"
-if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
+if [is_amd64_regs_target] {
set fpreg "rbp"
set spreg "rsp"
set pcreg "rip"
-} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
+} elseif [is_x86_like_target] {
set fpreg "ebp"
set spreg "esp"
set pcreg "eip"
@@ -295,12 +295,12 @@ proc gdb_unavailable_registers_test { } {
# Test reading uncollected pseudo-registers. The set of which
# depends on target.
- if {$pcreg == "rip"} then {
+ if [is_amd64_regs_target] {
# Check the raw register first.
test_register_unavailable "\$rax"
test_register_unavailable "\$eax"
test_register_unavailable "\$ax"
- } elseif {$pcreg == "eip"} then {
+ } elseif [is_x86_like_target] {
# Check the raw register first.
test_register_unavailable "\$eax"
test_register_unavailable "\$ax"
--- a/gdb/testsuite/gdb.trace/while-dyn.exp
+++ b/gdb/testsuite/gdb.trace/while-dyn.exp
@@ -52,9 +52,9 @@ if { ![gdb_target_supports_trace] } then {
# test while-stepping dynamically (live target)
#
-if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
+if [is_amd64_regs_target] {
set fpreg "\$rbp"
-} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
+} elseif [is_x86_like_target] {
set fpreg "\$ebp"
} else {
set fpreg "\$fp"
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1604,6 +1604,50 @@ proc is_lp64_target {} {
return [set is_lp64_target_saved($board) 1]
}
+# Return 1 if target has x86_64 registers - either amd64 or x32.
+# x32 target triple is x86_64-x32-* which is a subset of x86_64-*-*.
+# This cannot be decided simply from looking at the target string,
+# as it might depend on externally passed compiler options like -mx32.
+proc is_amd64_regs_target {} {
+ global is_amd64_regs_target_saved
+
+ if {![istarget "x86_64-*-*"]} {
+ return 0
+ }
+
+ # Use the cached value, if it exists. Cache value per "board" to handle
+ # runs with multiple options (e.g. unix/{-m32,-64}) correctly.
+ set me "is_amd64_regs_target"
+ set board [target_info name]
+ if [info exists is_amd64_regs_target_saved($board)] {
+ verbose "$me: returning saved $is_amd64_regs_target_saved($board)" 2
+ return $is_amd64_regs_target_saved($board)
+ }
+
+ set src reg64[pid].s
+ set obj reg64[pid].o
+
+ set f [open $src "w"]
+ foreach reg \
+ {rax rbx rcx rdx rsi rdi rbp rsp r8 r9 r10 r11 r12 r13 r14 r15} {
+ puts $f "\tincq %$reg"
+ }
+ close $f
+
+ verbose "$me: compiling testfile $src" 2
+ set lines [gdb_compile $src $obj object {quiet}]
+ file delete $src
+ file delete $obj
+
+ if ![string match "" $lines] then {
+ verbose "$me: testfile compilation failed, returning 0" 2
+ return [set is_amd64_regs_target_saved($board) 0]
+ }
+
+ verbose "$me: returning 1" 2
+ return [set is_amd64_regs_target_saved($board) 1]
+}
+
# Return 1 if this target is an x86 or x86-64 with -m32.
proc is_x86_like_target {} {
if {[istarget i?86-*]} {
@@ -1612,7 +1656,7 @@ proc is_x86_like_target {} {
if {![istarget "x86_64-*-*"]} {
return 0
}
- return [is_ilp32_target]
+ return [expr [is_ilp32_target] && ![is_amd64_regs_target]]
}
# Return 1 if displaced stepping is supported on target, otherwise, return 0.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch] testsuite: Fix x32, introduce is_amd64_regs_target [Re: [obv] testsuite: gdb.trace/*: Use is_lp64_target]
2011-08-28 20:07 ` [patch] testsuite: Fix x32, introduce is_amd64_regs_target [Re: [obv] testsuite: gdb.trace/*: Use is_lp64_target] Jan Kratochvil
@ 2011-08-28 21:06 ` Mark Kettenis
2011-09-08 15:38 ` [patch] testsuite: Fix x32, introduce is_amd64_regs_target Jan Kratochvil
2011-08-28 21:19 ` [patch] testsuite: Fix x32, introduce is_amd64_regs_target [Re: [obv] testsuite: gdb.trace/*: Use is_lp64_target] Jan Kratochvil
1 sibling, 1 reply; 13+ messages in thread
From: Mark Kettenis @ 2011-08-28 21:06 UTC (permalink / raw)
To: jan.kratochvil; +Cc: hjl.tools, gdb-patches
> Date: Sun, 28 Aug 2011 22:06:40 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
>
> On Fri, 26 Aug 2011 15:48:33 +0200, H.J. Lu wrote:
> > That is wrong for x32. X32 isn't LP64, but has 64bit registers.
>
> x32 uses triple x86_64-x32-linux* which matches x86_64-*-*.
Uh, that's wrong. The middle part if the target triplet is supposed
to be the hardware vendor. For i386/amd64 this is pretty much
meaningles, but attaching a new meaning to it would be a mistake.
Fortunately, your diff doesn't really depend on this. But I think you
should adjust the comments in the code.
> gdb/testsuite/
> 2011-08-28 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> Fix compatibility with x32 arch.
> * testsuite/gdb.dwarf2/typeddwarf.exp: Check also is_lp64_target.
> * testsuite/gdb.trace/backtrace.exp: Use is_amd64_regs_target and
> is_x86_like_target.
> * testsuite/gdb.trace/collection.exp: Likewise.
> * testsuite/gdb.trace/report.exp: Likewise.
> * testsuite/gdb.trace/unavailable.exp: Likewise.
> * testsuite/gdb.trace/while-dyn.exp: Likewise.
> * testsuite/lib/gdb.exp (is_amd64_regs_target): New function.
> (is_x86_like_target): Check also is_amd64_regs_target.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch] testsuite: Fix x32, introduce is_amd64_regs_target [Re: [obv] testsuite: gdb.trace/*: Use is_lp64_target]
2011-08-28 20:07 ` [patch] testsuite: Fix x32, introduce is_amd64_regs_target [Re: [obv] testsuite: gdb.trace/*: Use is_lp64_target] Jan Kratochvil
2011-08-28 21:06 ` Mark Kettenis
@ 2011-08-28 21:19 ` Jan Kratochvil
1 sibling, 0 replies; 13+ messages in thread
From: Jan Kratochvil @ 2011-08-28 21:19 UTC (permalink / raw)
To: H.J. Lu; +Cc: gdb-patches
On Sun, 28 Aug 2011 22:06:40 +0200, Jan Kratochvil wrote:
> Still even after these fixes I see various problems of x32 GDB but that is sure
> outside of the scope of this patch.
That may not be true, I did not check there is:
https://sites.google.com/site/x32abi/
* GDB support is on hjl/x32 branch at
http://git.kernel.org/?p=devel/gdb/hjl/x86.git;a=summary
Jan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch] testsuite: Fix x32, introduce is_amd64_regs_target
2011-08-28 21:06 ` Mark Kettenis
@ 2011-09-08 15:38 ` Jan Kratochvil
2011-09-08 15:57 ` Pedro Alves
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Jan Kratochvil @ 2011-09-08 15:38 UTC (permalink / raw)
To: Mark Kettenis; +Cc: hjl.tools, gdb-patches
On Sun, 28 Aug 2011 23:05:34 +0200, Mark Kettenis wrote:
> > From: Jan Kratochvil <jan.kratochvil@redhat.com>
> > x32 uses triple x86_64-x32-linux* which matches x86_64-*-*.
>
> Uh, that's wrong. The middle part if the target triplet is supposed
> to be the hardware vendor. For i386/amd64 this is pretty much
> meaningles, but attaching a new meaning to it would be a mistake.
>
> Fortunately, your diff doesn't really depend on this. But I think you
> should adjust the comments in the code.
The triple x86_64-x32-linux* is a reality in binutils, gcc etc., I believe if
it should be changed GDB is not the place to start such change.
And the comments should reflect the reality.
OK to check it in as is?
Thanks,
Jan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch] testsuite: Fix x32, introduce is_amd64_regs_target
2011-09-08 15:38 ` [patch] testsuite: Fix x32, introduce is_amd64_regs_target Jan Kratochvil
@ 2011-09-08 15:57 ` Pedro Alves
2011-09-08 17:47 ` Jan Kratochvil
2011-09-08 16:01 ` Mark Kettenis
2011-09-08 17:16 ` H.J. Lu
2 siblings, 1 reply; 13+ messages in thread
From: Pedro Alves @ 2011-09-08 15:57 UTC (permalink / raw)
To: gdb-patches; +Cc: Jan Kratochvil, Mark Kettenis, hjl.tools
On Thursday 08 September 2011 16:34:54, Jan Kratochvil wrote:
> On Sun, 28 Aug 2011 23:05:34 +0200, Mark Kettenis wrote:
> > > From: Jan Kratochvil <jan.kratochvil@redhat.com>
> > > x32 uses triple x86_64-x32-linux* which matches x86_64-*-*.
> >
> > Uh, that's wrong. The middle part if the target triplet is supposed
> > to be the hardware vendor. For i386/amd64 this is pretty much
> > meaningles, but attaching a new meaning to it would be a mistake.
> >
> > Fortunately, your diff doesn't really depend on this. But I think you
> > should adjust the comments in the code.
>
> The triple x86_64-x32-linux* is a reality in binutils, gcc etc., I believe if
> it should be changed GDB is not the place to start such change.
I don't believe that triplet was ever accepted. At least I don't see it
in mainline src/ anywhere. GDB trunk itself doesn't support x32 yet. If
there were bits that depended on the triplet, they'd be appropriate on
the x32 branch instead, not in trunk yet.
> And the comments should reflect the reality.
>
> OK to check it in as is?
>
>
> Thanks,
> Jan
>
--
Pedro Alves
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch] testsuite: Fix x32, introduce is_amd64_regs_target
2011-09-08 15:38 ` [patch] testsuite: Fix x32, introduce is_amd64_regs_target Jan Kratochvil
2011-09-08 15:57 ` Pedro Alves
@ 2011-09-08 16:01 ` Mark Kettenis
2011-09-08 17:16 ` H.J. Lu
2 siblings, 0 replies; 13+ messages in thread
From: Mark Kettenis @ 2011-09-08 16:01 UTC (permalink / raw)
To: jan.kratochvil; +Cc: hjl.tools, gdb-patches
> Date: Thu, 8 Sep 2011 17:34:54 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
>
> On Sun, 28 Aug 2011 23:05:34 +0200, Mark Kettenis wrote:
> > > From: Jan Kratochvil <jan.kratochvil@redhat.com>
> > > x32 uses triple x86_64-x32-linux* which matches x86_64-*-*.
> >
> > Uh, that's wrong. The middle part if the target triplet is supposed
> > to be the hardware vendor. For i386/amd64 this is pretty much
> > meaningles, but attaching a new meaning to it would be a mistake.
> >
> > Fortunately, your diff doesn't really depend on this. But I think you
> > should adjust the comments in the code.
>
> The triple x86_64-x32-linux* is a reality in binutils, gcc etc.,
Where? Neither the config.guess/config.sub in the gcc svn repo, nor
the one in the src cvs repo will ever return such a triplet.
> And the comments should reflect the reality.
Not my reality.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch] testsuite: Fix x32, introduce is_amd64_regs_target
2011-09-08 15:38 ` [patch] testsuite: Fix x32, introduce is_amd64_regs_target Jan Kratochvil
2011-09-08 15:57 ` Pedro Alves
2011-09-08 16:01 ` Mark Kettenis
@ 2011-09-08 17:16 ` H.J. Lu
2 siblings, 0 replies; 13+ messages in thread
From: H.J. Lu @ 2011-09-08 17:16 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Mark Kettenis, gdb-patches
On Thu, Sep 8, 2011 at 8:34 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Sun, 28 Aug 2011 23:05:34 +0200, Mark Kettenis wrote:
>> > From: Jan Kratochvil <jan.kratochvil@redhat.com>
>> > x32 uses triple x86_64-x32-linux* which matches x86_64-*-*.
>>
>> Uh, that's wrong. The middle part if the target triplet is supposed
>> to be the hardware vendor. For i386/amd64 this is pretty much
>> meaningles, but attaching a new meaning to it would be a mistake.
>>
>> Fortunately, your diff doesn't really depend on this. But I think you
>> should adjust the comments in the code.
>
> The triple x86_64-x32-linux* is a reality in binutils, gcc etc., I believe if
> it should be changed GDB is not the place to start such change.
>
> And the comments should reflect the reality.
>
> OK to check it in as is?
>
I am using x86_64-x32-linux* for x32. Instead, I
am using x86_64-*-linux* with sizeof (long) == 4.
--
H.J.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch] testsuite: Fix x32, introduce is_amd64_regs_target
2011-09-08 15:57 ` Pedro Alves
@ 2011-09-08 17:47 ` Jan Kratochvil
2011-09-08 18:22 ` Mark Kettenis
0 siblings, 1 reply; 13+ messages in thread
From: Jan Kratochvil @ 2011-09-08 17:47 UTC (permalink / raw)
To: Pedro Alves, Mark Kettenis, H.J. Lu; +Cc: gdb-patches
On Thu, 08 Sep 2011 17:53:34 +0200, Pedro Alves wrote:
> I don't believe that triplet was ever accepted.
+
On Thu, 08 Sep 2011 17:57:04 +0200, Mark Kettenis wrote:
> Where? Neither the config.guess/config.sub in the gcc svn repo, nor
> the one in the src cvs repo will ever return such a triplet.
OK, I Googled some posted patches and assumed it is the reality, I agree there
isn't x32 vendor in the FSF repositories.
On Thu, 08 Sep 2011 18:01:41 +0200, H.J. Lu wrote:
> I am using x86_64-x32-linux* for x32. Instead, I
> am using x86_64-*-linux* with sizeof (long) == 4.
Updated the comment to:
+# Return 1 if target has x86_64 registers - either amd64 or x32.
+# x32 target identifies as x86_64-*-linux*, therefore it cannot be determined
+# just from the target string.
+proc is_amd64_regs_target {} {
Checked in.
Thanks,
Jan
http://sourceware.org/ml/gdb-cvs/2011-09/msg00048.html
--- src/gdb/testsuite/ChangeLog 2011/09/08 15:38:15 1.2848
+++ src/gdb/testsuite/ChangeLog 2011/09/08 17:40:52 1.2849
@@ -1,5 +1,18 @@
2011-09-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Fix compatibility with x32 arch.
+ * testsuite/gdb.dwarf2/typeddwarf.exp: Check also is_lp64_target.
+ * testsuite/gdb.trace/backtrace.exp: Use is_amd64_regs_target and
+ is_x86_like_target.
+ * testsuite/gdb.trace/collection.exp: Likewise.
+ * testsuite/gdb.trace/report.exp: Likewise.
+ * testsuite/gdb.trace/unavailable.exp: Likewise.
+ * testsuite/gdb.trace/while-dyn.exp: Likewise.
+ * testsuite/lib/gdb.exp (is_amd64_regs_target): New function.
+ (is_x86_like_target): Check also is_amd64_regs_target.
+
+2011-09-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+
PR breakpoints/12435
* gdb.arch/amd64-prologue-xmm.c: New file.
* gdb.arch/amd64-prologue-xmm.exp: New file.
--- src/gdb/testsuite/gdb.dwarf2/typeddwarf.exp 2011/07/22 15:31:52 1.3
+++ src/gdb/testsuite/gdb.dwarf2/typeddwarf.exp 2011/09/08 17:40:53 1.4
@@ -22,10 +22,10 @@
return 0
}
-# This test can only be run on x86 and amd64 targets.
+# This test can only be run on x86 and amd64 targets (and not x32).
if { [is_x86_like_target] } {
set sfile ${test}.S
-} elseif {[istarget "x86_64-*-*"]} {
+} elseif {[istarget "x86_64-*-*"] && [is_lp64_target]} {
set sfile ${test}-amd64.S
} else {
return 0
--- src/gdb/testsuite/gdb.trace/backtrace.exp 2011/08/26 09:20:44 1.19
+++ src/gdb/testsuite/gdb.trace/backtrace.exp 2011/09/08 17:40:53 1.20
@@ -150,10 +150,10 @@
"$tdp4" \
"collect \$regs, \$args, \$locs" "^$"
-if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
+if [is_amd64_regs_target] {
set fpreg "\$rbp"
set spreg "\$rsp"
-} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
+} elseif [is_x86_like_target] {
set fpreg "\$ebp"
set spreg "\$esp"
} else {
--- src/gdb/testsuite/gdb.trace/collection.exp 2011/08/26 09:20:44 1.25
+++ src/gdb/testsuite/gdb.trace/collection.exp 2011/09/08 17:40:53 1.26
@@ -45,11 +45,11 @@
set ws "\[\r\n\t \]+"
set cr "\[\r\n\]+"
-if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
+if [is_amd64_regs_target] {
set fpreg "rbp"
set spreg "rsp"
set pcreg "rip"
-} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
+} elseif [is_x86_like_target] {
set fpreg "ebp"
set spreg "esp"
set pcreg "eip"
--- src/gdb/testsuite/gdb.trace/report.exp 2011/08/26 09:20:44 1.20
+++ src/gdb/testsuite/gdb.trace/report.exp 2011/09/08 17:40:53 1.21
@@ -159,11 +159,11 @@
"$tdp4" \
"collect \$locs" "^$"
-if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
+if [is_amd64_regs_target] {
set fpreg "rbp"
set spreg "rsp"
set pcreg "rip"
-} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
+} elseif [is_x86_like_target] {
set fpreg "ebp"
set spreg "esp"
set pcreg "eip"
--- src/gdb/testsuite/gdb.trace/unavailable.exp 2011/08/26 09:20:44 1.10
+++ src/gdb/testsuite/gdb.trace/unavailable.exp 2011/09/08 17:40:54 1.11
@@ -30,11 +30,11 @@
set ws "\[\r\n\t \]+"
set cr "\[\r\n\]+"
-if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
+if [is_amd64_regs_target] {
set fpreg "rbp"
set spreg "rsp"
set pcreg "rip"
-} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
+} elseif [is_x86_like_target] {
set fpreg "ebp"
set spreg "esp"
set pcreg "eip"
@@ -295,12 +295,12 @@
# Test reading uncollected pseudo-registers. The set of which
# depends on target.
- if {$pcreg == "rip"} then {
+ if [is_amd64_regs_target] {
# Check the raw register first.
test_register_unavailable "\$rax"
test_register_unavailable "\$eax"
test_register_unavailable "\$ax"
- } elseif {$pcreg == "eip"} then {
+ } elseif [is_x86_like_target] {
# Check the raw register first.
test_register_unavailable "\$eax"
test_register_unavailable "\$ax"
--- src/gdb/testsuite/gdb.trace/while-dyn.exp 2011/08/26 09:20:44 1.19
+++ src/gdb/testsuite/gdb.trace/while-dyn.exp 2011/09/08 17:40:54 1.20
@@ -52,9 +52,9 @@
# test while-stepping dynamically (live target)
#
-if {([istarget "x86_64-*"] || [istarget "i?86-*"]) && [is_lp64_target]} then {
+if [is_amd64_regs_target] {
set fpreg "\$rbp"
-} elseif {[istarget "x86_64-*"] || [istarget "i?86-*"]} then {
+} elseif [is_x86_like_target] {
set fpreg "\$ebp"
} else {
set fpreg "\$fp"
--- src/gdb/testsuite/lib/gdb.exp 2011/07/15 14:11:22 1.184
+++ src/gdb/testsuite/lib/gdb.exp 2011/09/08 17:40:54 1.185
@@ -1604,6 +1604,49 @@
return [set is_lp64_target_saved($board) 1]
}
+# Return 1 if target has x86_64 registers - either amd64 or x32.
+# x32 target identifies as x86_64-*-linux*, therefore it cannot be determined
+# just from the target string.
+proc is_amd64_regs_target {} {
+ global is_amd64_regs_target_saved
+
+ if {![istarget "x86_64-*-*"]} {
+ return 0
+ }
+
+ # Use the cached value, if it exists. Cache value per "board" to handle
+ # runs with multiple options (e.g. unix/{-m32,-64}) correctly.
+ set me "is_amd64_regs_target"
+ set board [target_info name]
+ if [info exists is_amd64_regs_target_saved($board)] {
+ verbose "$me: returning saved $is_amd64_regs_target_saved($board)" 2
+ return $is_amd64_regs_target_saved($board)
+ }
+
+ set src reg64[pid].s
+ set obj reg64[pid].o
+
+ set f [open $src "w"]
+ foreach reg \
+ {rax rbx rcx rdx rsi rdi rbp rsp r8 r9 r10 r11 r12 r13 r14 r15} {
+ puts $f "\tincq %$reg"
+ }
+ close $f
+
+ verbose "$me: compiling testfile $src" 2
+ set lines [gdb_compile $src $obj object {quiet}]
+ file delete $src
+ file delete $obj
+
+ if ![string match "" $lines] then {
+ verbose "$me: testfile compilation failed, returning 0" 2
+ return [set is_amd64_regs_target_saved($board) 0]
+ }
+
+ verbose "$me: returning 1" 2
+ return [set is_amd64_regs_target_saved($board) 1]
+}
+
# Return 1 if this target is an x86 or x86-64 with -m32.
proc is_x86_like_target {} {
if {[istarget i?86-*]} {
@@ -1612,7 +1655,7 @@
if {![istarget "x86_64-*-*"]} {
return 0
}
- return [is_ilp32_target]
+ return [expr [is_ilp32_target] && ![is_amd64_regs_target]]
}
# Return 1 if displaced stepping is supported on target, otherwise, return 0.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch] testsuite: Fix x32, introduce is_amd64_regs_target
2011-09-08 17:47 ` Jan Kratochvil
@ 2011-09-08 18:22 ` Mark Kettenis
0 siblings, 0 replies; 13+ messages in thread
From: Mark Kettenis @ 2011-09-08 18:22 UTC (permalink / raw)
To: jan.kratochvil; +Cc: pedro, hjl.tools, gdb-patches
> Date: Thu, 8 Sep 2011 19:43:32 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
>
> On Thu, 08 Sep 2011 17:53:34 +0200, Pedro Alves wrote:
> > I don't believe that triplet was ever accepted.
> +
> On Thu, 08 Sep 2011 17:57:04 +0200, Mark Kettenis wrote:
> > Where? Neither the config.guess/config.sub in the gcc svn repo, nor
> > the one in the src cvs repo will ever return such a triplet.
>
> OK, I Googled some posted patches and assumed it is the reality, I agree there
> isn't x32 vendor in the FSF repositories.
>
> On Thu, 08 Sep 2011 18:01:41 +0200, H.J. Lu wrote:
> > I am using x86_64-x32-linux* for x32. Instead, I
> > am using x86_64-*-linux* with sizeof (long) == 4.
>
> Updated the comment to:
> +# Return 1 if target has x86_64 registers - either amd64 or x32.
> +# x32 target identifies as x86_64-*-linux*, therefore it cannot be determined
> +# just from the target string.
> +proc is_amd64_regs_target {} {
>
> Checked in.
Thanks!
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2011-09-08 17:47 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-26 9:26 [obv] testsuite: gdb.trace/*: Use is_lp64_target Jan Kratochvil
2011-08-26 13:48 ` H.J. Lu
2011-08-26 15:37 ` Jan Kratochvil
2011-08-26 15:59 ` H.J. Lu
2011-08-28 20:07 ` [patch] testsuite: Fix x32, introduce is_amd64_regs_target [Re: [obv] testsuite: gdb.trace/*: Use is_lp64_target] Jan Kratochvil
2011-08-28 21:06 ` Mark Kettenis
2011-09-08 15:38 ` [patch] testsuite: Fix x32, introduce is_amd64_regs_target Jan Kratochvil
2011-09-08 15:57 ` Pedro Alves
2011-09-08 17:47 ` Jan Kratochvil
2011-09-08 18:22 ` Mark Kettenis
2011-09-08 16:01 ` Mark Kettenis
2011-09-08 17:16 ` H.J. Lu
2011-08-28 21:19 ` [patch] testsuite: Fix x32, introduce is_amd64_regs_target [Re: [obv] testsuite: gdb.trace/*: Use is_lp64_target] Jan Kratochvil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox