[RFC,04/13] gdb: Use NT_X86_CPUID in x86 FreeBSD architectures to read XSAVE layouts

Message ID 20231009183617.24862-5-jhb@FreeBSD.org
State New
Headers
Series Proposal for a new NT_X86_CPUID core dump note |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed

Commit Message

John Baldwin Oct. 9, 2023, 6:36 p.m. UTC
  If this core dump note is present, use it to determine the layout of
XSAVE register set notes.
---
 gdb/i386-linux-tdep.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Simon Marchi Oct. 12, 2023, 4:28 a.m. UTC | #1
On 2023-10-09 14:36, John Baldwin wrote:
> If this core dump note is present, use it to determine the layout of
> XSAVE register set notes.

s/FreeBSD/Linux in the subject of the commit.

Simon
  
John Baldwin Oct. 17, 2023, 12:07 a.m. UTC | #2
On 10/11/23 9:28 PM, Simon Marchi wrote:
> 
> 
> On 2023-10-09 14:36, John Baldwin wrote:
>> If this core dump note is present, use it to determine the layout of
>> XSAVE register set notes.
> 
> s/FreeBSD/Linux in the subject of the commit.

Oops, fixed.
  

Patch

diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 7ff7c155e2c..57d00a424d9 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -663,7 +663,8 @@  i386_linux_core_read_xsave_info (bfd *abfd, x86_xsave_layout &layout)
 
   uint64_t xcr0 = bfd_get_64 (abfd, contents);
 
-  if (!i387_guess_xsave_layout (xcr0, size, layout))
+  if (!i387_read_xsave_layout_from_core (abfd, xcr0, size, layout)
+      && !i387_guess_xsave_layout (xcr0, size, layout))
     return 0;
 
   return xcr0;