* [PATCH 0/2] Fix gdb.arch/amd64-gs_base.exp test on FreeBSD
@ 2023-02-17 20:02 John Baldwin
2023-02-17 20:02 ` [PATCH 1/2] gdb.arch/amd64-gs_base.exp: Support non-Linux John Baldwin
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: John Baldwin @ 2023-02-17 20:02 UTC (permalink / raw)
To: gdb-patches
The gdb.arch/amd64-gs_base.exp test was failing on FreeBSD as it had
some Linux-specific assumptions. While looking at this I also found
that Linux/amd64 treats the fs_base and gs_base as "system" registers,
but FreeBSD did not. I originally started by moving the logic from
Linux/amd64 for these registers into i386_register_reggroup_p so it
would be consistent across all OS ABIs, but I think it would be better
to treat these registers as general registers instead which is what
patch 2 does.
John Baldwin (2):
gdb.arch/amd64-gs_base.exp: Support non-Linux.
amd64-linux-tdep: Don't treat fs_base and gs_base as system registers.
gdb/amd64-linux-tdep.c | 4 +---
gdb/testsuite/gdb.arch/amd64-gs_base.exp | 10 ++++------
2 files changed, 5 insertions(+), 9 deletions(-)
--
2.38.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] gdb.arch/amd64-gs_base.exp: Support non-Linux.
2023-02-17 20:02 [PATCH 0/2] Fix gdb.arch/amd64-gs_base.exp test on FreeBSD John Baldwin
@ 2023-02-17 20:02 ` John Baldwin
2023-02-17 20:02 ` [PATCH 2/2] amd64-linux-tdep: Don't treat fs_base and gs_base as system registers John Baldwin
2023-03-03 17:58 ` [PING] [PATCH 0/2] Fix gdb.arch/amd64-gs_base.exp test on FreeBSD John Baldwin
2 siblings, 0 replies; 5+ messages in thread
From: John Baldwin @ 2023-02-17 20:02 UTC (permalink / raw)
To: gdb-patches
The orig_rax pseudo-register is Linux-specific and isn't relevant to
this test. The fs_base and gs_base registers are also not treated as
system registers in other OS ABIs. This allows the test to pass on
FreeBSD.
---
gdb/testsuite/gdb.arch/amd64-gs_base.exp | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/gdb/testsuite/gdb.arch/amd64-gs_base.exp b/gdb/testsuite/gdb.arch/amd64-gs_base.exp
index a60e1dbe7f4..083c7c9fe1f 100644
--- a/gdb/testsuite/gdb.arch/amd64-gs_base.exp
+++ b/gdb/testsuite/gdb.arch/amd64-gs_base.exp
@@ -32,14 +32,12 @@ gdb_test "print /x \$gs_base" "= $hex" "print gs_base"
gdb_test "print \$fs_base = 2" "= 2" "set fs_base"
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.
+# Test the fs_base and gs_base values.
#
set ws "\[\t \]+"
-set info_reg_out [multi_line "info register sys" \
+set info_reg_out [multi_line "info register fs_base gs_base" \
"fs_base${ws}0x2${ws}2"\
- "gs_base${ws}0x3${ws}3"\
- "orig_rax${ws}$hex${ws}\[-\]$decimal" ]
+ "gs_base${ws}0x3${ws}3" ]
-gdb_test "info register sys" $info_reg_out\
+gdb_test "info register fs_base gs_base" $info_reg_out\
"info registers fs_base and gs_base with value"
--
2.38.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] amd64-linux-tdep: Don't treat fs_base and gs_base as system registers.
2023-02-17 20:02 [PATCH 0/2] Fix gdb.arch/amd64-gs_base.exp test on FreeBSD John Baldwin
2023-02-17 20:02 ` [PATCH 1/2] gdb.arch/amd64-gs_base.exp: Support non-Linux John Baldwin
@ 2023-02-17 20:02 ` John Baldwin
2023-03-03 17:58 ` [PING] [PATCH 0/2] Fix gdb.arch/amd64-gs_base.exp test on FreeBSD John Baldwin
2 siblings, 0 replies; 5+ messages in thread
From: John Baldwin @ 2023-02-17 20:02 UTC (permalink / raw)
To: gdb-patches
These registers can be changed directly in userspace, and similar
registers to support TLS on other architectures (tpidr* on ARM and
AArch64, tp on RISC-V) are treated as general purpose registers.
---
gdb/amd64-linux-tdep.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index e9181649ec8..cbbac1a0c64 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -281,9 +281,7 @@ static int
amd64_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
const struct reggroup *group)
{
- if (regnum == AMD64_LINUX_ORIG_RAX_REGNUM
- || regnum == AMD64_FSBASE_REGNUM
- || regnum == AMD64_GSBASE_REGNUM)
+ if (regnum == AMD64_LINUX_ORIG_RAX_REGNUM)
return (group == system_reggroup
|| group == save_reggroup
|| group == restore_reggroup);
--
2.38.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PING] [PATCH 0/2] Fix gdb.arch/amd64-gs_base.exp test on FreeBSD
2023-02-17 20:02 [PATCH 0/2] Fix gdb.arch/amd64-gs_base.exp test on FreeBSD John Baldwin
2023-02-17 20:02 ` [PATCH 1/2] gdb.arch/amd64-gs_base.exp: Support non-Linux John Baldwin
2023-02-17 20:02 ` [PATCH 2/2] amd64-linux-tdep: Don't treat fs_base and gs_base as system registers John Baldwin
@ 2023-03-03 17:58 ` John Baldwin
2023-03-03 19:04 ` Tom Tromey
2 siblings, 1 reply; 5+ messages in thread
From: John Baldwin @ 2023-03-03 17:58 UTC (permalink / raw)
To: gdb-patches
On 2/17/23 12:02 PM, John Baldwin wrote:
> The gdb.arch/amd64-gs_base.exp test was failing on FreeBSD as it had
> some Linux-specific assumptions. While looking at this I also found
> that Linux/amd64 treats the fs_base and gs_base as "system" registers,
> but FreeBSD did not. I originally started by moving the logic from
> Linux/amd64 for these registers into i386_register_reggroup_p so it
> would be consistent across all OS ABIs, but I think it would be better
> to treat these registers as general registers instead which is what
> patch 2 does.
>
> John Baldwin (2):
> gdb.arch/amd64-gs_base.exp: Support non-Linux.
> amd64-linux-tdep: Don't treat fs_base and gs_base as system registers.
>
> gdb/amd64-linux-tdep.c | 4 +---
> gdb/testsuite/gdb.arch/amd64-gs_base.exp | 10 ++++------
> 2 files changed, 5 insertions(+), 9 deletions(-)
Ping.
--
John Baldwin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PING] [PATCH 0/2] Fix gdb.arch/amd64-gs_base.exp test on FreeBSD
2023-03-03 17:58 ` [PING] [PATCH 0/2] Fix gdb.arch/amd64-gs_base.exp test on FreeBSD John Baldwin
@ 2023-03-03 19:04 ` Tom Tromey
0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2023-03-03 19:04 UTC (permalink / raw)
To: John Baldwin; +Cc: gdb-patches
>>>>> "John" == John Baldwin <jhb@FreeBSD.org> writes:
John> On 2/17/23 12:02 PM, John Baldwin wrote:
>> The gdb.arch/amd64-gs_base.exp test was failing on FreeBSD as it had
>> some Linux-specific assumptions. While looking at this I also found
>> that Linux/amd64 treats the fs_base and gs_base as "system" registers,
>> but FreeBSD did not. I originally started by moving the logic from
>> Linux/amd64 for these registers into i386_register_reggroup_p so it
>> would be consistent across all OS ABIs, but I think it would be better
>> to treat these registers as general registers instead which is what
>> patch 2 does.
>> John Baldwin (2):
>> gdb.arch/amd64-gs_base.exp: Support non-Linux.
>> amd64-linux-tdep: Don't treat fs_base and gs_base as system registers.
>> gdb/amd64-linux-tdep.c | 4 +---
>> gdb/testsuite/gdb.arch/amd64-gs_base.exp | 10 ++++------
>> 2 files changed, 5 insertions(+), 9 deletions(-)
John> Ping.
These make sense to me. Thank you.
Reviewed-By: Tom Tromey <tom@tromey.com>
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-03-03 19:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-17 20:02 [PATCH 0/2] Fix gdb.arch/amd64-gs_base.exp test on FreeBSD John Baldwin
2023-02-17 20:02 ` [PATCH 1/2] gdb.arch/amd64-gs_base.exp: Support non-Linux John Baldwin
2023-02-17 20:02 ` [PATCH 2/2] amd64-linux-tdep: Don't treat fs_base and gs_base as system registers John Baldwin
2023-03-03 17:58 ` [PING] [PATCH 0/2] Fix gdb.arch/amd64-gs_base.exp test on FreeBSD John Baldwin
2023-03-03 19:04 ` Tom Tromey
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).