The crash tool failed to initialize on LoongArch64 when using
GDB 16.2 (and likely other recent GDB versions that have enhanced
LoongArch support) due to the error:
"fatal error: buffer size is not enough to fit register value".

This occurs in supply_registers() because GDB now correctly
reports the size of LoongArch LASX (256-bit) vector registers
(xr0-xr31) as 32 bytes. The `regval` buffer in `crash_target.c`
was previously fixed at 16 bytes.

This patch increases the `regval` buffer size to 32 bytes to
accommodate the largest LoongArch registers reported by GDB.
This allows crash to initialize successfully.

Signed-off-by: Ming Wang <wangmin...@loongson.cn>
---
 crash_target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crash_target.c b/crash_target.c
index 5966b7b..d93d58c 100644
--- a/crash_target.c
+++ b/crash_target.c
@@ -71,7 +71,7 @@ public:
 
 static void supply_registers(struct regcache *regcache, int regno)
 {
-  gdb_byte regval[16];
+  gdb_byte regval[32];
   struct gdbarch *arch = regcache->arch ();
   const char *regname = gdbarch_register_name(arch, regno);
   int regsize = register_size(arch, regno);
-- 
2.41.3
--
Crash-utility mailing list -- devel@lists.crash-utility.osci.io
To unsubscribe send an email to devel-le...@lists.crash-utility.osci.io
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki

Reply via email to