* [PUSHED][PATCH v2] gdb: Fix assignment to TYPE_CODE_FLAGS registers
@ 2026-09-01 8:56 srinath.parvathaneni
0 siblings, 0 replies; only message in thread
From: srinath.parvathaneni @ 2026-09-01 8:56 UTC (permalink / raw)
To: gdb-patches
Cc: TankutBaris.Aktemur, simark, luis.machado.foss, thiago.bauermann,
guinevere, Srinath Parvathaneni, Simon Marchi
[-- Attachment #1: Type: text/plain, Size: 975 bytes --]
Thanks Baris for your review on v1
https://patchwork.sourceware.org/project/gdb/patch/20260713091126.2914903-1-srinath.parvathaneni@arm.com/#236556
There was no specific reason for using gdb_test_multiple here,
I followed the existing tests in aarch64-fpmr.exp.
I've addressed your comments in v2 by switching the newly added
test to gdb_test and removing the unnecessary .*\r\n.* from the
regexp.
----------------
GDB reports "Invalid cast" when assigning small integer literals (32-bit) to
64-bit TYPE_CODE_FLAGS registers. For example, with the existing upstream FPMR
register, set $fpmr = 0x777777777 succeeds, whereas set $fpmr = 0x77 fails with
"Invalid cast" and this patch fixes the issue but makes changes to a generic
function value_cast in gdb/valops.c.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
---
gdb/testsuite/gdb.arch/aarch64-fpmr.exp | 4 ++++
gdb/valops.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v2-0001-gdb-Fix-assignment-to-TYPE_CODE_FLAGS-registers.patch --]
[-- Type: text/x-patch; name="v2-0001-gdb-Fix-assignment-to-TYPE_CODE_FLAGS-registers.patch", Size: 1033 bytes --]
diff --git a/gdb/testsuite/gdb.arch/aarch64-fpmr.exp b/gdb/testsuite/gdb.arch/aarch64-fpmr.exp
index 72fd977fc67..aadfb68293e 100644
--- a/gdb/testsuite/gdb.arch/aarch64-fpmr.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-fpmr.exp
@@ -97,3 +97,7 @@ gdb_test_multiple "set \$fpmr=0x3f007f4008" "" {
pass "Write to FPMR from GDB"
}
}
+
+gdb_test "set \$fpmr=0x1255C041" \
+ "\\\[ F8S1=E4M3 F8S2=E5M2 F8D=E4M3 OSM=MaxNormal OSC=MaxNormal LSCALE=85 NSCALE=18 LSCALE2=0 \\\]" \
+ "Write 32-bit value to 64-bit register FPMR"
diff --git a/gdb/valops.c b/gdb/valops.c
index c478bdc3f15..82c796bd254 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -562,7 +562,7 @@ value_cast (struct type *type, struct value *arg2)
return value_from_longest (to_type, value_as_long (arg2));
}
else if ((code1 == TYPE_CODE_INT || code1 == TYPE_CODE_ENUM
- || code1 == TYPE_CODE_RANGE)
+ || code1 == TYPE_CODE_RANGE || code1 == TYPE_CODE_FLAGS)
&& (scalar || code2 == TYPE_CODE_PTR
|| code2 == TYPE_CODE_MEMBERPTR))
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-01 8:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-01 8:56 [PUSHED][PATCH v2] gdb: Fix assignment to TYPE_CODE_FLAGS registers srinath.parvathaneni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox