From: Andrew Burgess <aburgess@redhat.com>
To: Christina Joos <christina.joos@intel.com>, gdb-patches@sourceware.org
Cc: stephan.rohr@intel.com
Subject: Re: [PATCH v2 1/1] gdb: Enable OS generated corefiles on systems with Intel AMX support.
Date: Tue, 15 Sep 2026 16:06:10 +0100 [thread overview]
Message-ID: <8733vad065.fsf@redhat.com> (raw)
In-Reply-To: <20260911163001.3365986-1-christina.joos@intel.com>
Christina Joos <christina.joos@intel.com> writes:
> This patch addresses the issue described in PR gdb/34561. On systems
> with Intel AMX support the xsave size is 11008. This xsave size is not
> handled by gdb/i387-tdep.c:i387_guess_xsave_layout and is causing
> problems for corefiles generated by the linux kernel. The problem is
> visible regardless of the AMX enablement state in the dumping process,
> so all corefiles on newer systems with AMX are broken.
>
> ~~~
> $ gdb
> GNU gdb (GDB) 19.0.50.20260814-git
> Copyright (C) 2026 Free Software Foundation, Inc.
> [...]
> (gdb) core core_main_SEGV
> [New LWP 2162880 (id 1)]
> [...]
> Core was generated by `./main'.
> Program terminated with signal SIGSEGV, Segmentation fault.
> 4 *pointer = 3;
> (gdb) p $ymm0
> $1 = void
> ~~~
>
> We should be able to print the register $ymm0 (or any other register
> belonging to a feature higher than SSE).
>
> For a live debug session we can print it:
> ~~~
> Reading symbols from main...
> (gdb) start
> Temporary breakpoint 1 at 0x1131: file main.c, line 3.
> Starting program: /tmp/main
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
>
> Temporary breakpoint 1, main () at main.c:3
> 3 int *pointer = 0;
> (gdb) p $ymm0
> $1 = {v16_bfloat16 = {0, 2.342e-38, 0 <repeats 14 times>}, v16_half = {0, 1.5199e-05, 0 <repeats 14 times>}, v8_float = {
> 2.34180515e-38, 0, 0, 0, 0, 0, 0, 0}, v4_double = {8.256666972292243e-317, 0, 0, 0}, v32_int8 = {0, 0, -1,
> 0 <repeats 29 times>}, v16_int16 = {0, 255, 0 <repeats 14 times>}, v8_int32 = {16711680, 0, 0, 0, 0, 0, 0, 0}, v4_int64 = {
> 16711680, 0, 0, 0}, v2_int128 = {16711680, 0}}
> [...]
> ~~~
>
> Note that this is not reproducible for corefiles generated by the gcore
> command, since in such corefiles the GDB target description is
> available and gdb/i387-tdep.c:i387_fallback_xsave_layout configures
> the xsave_layout based on xcr0 derived from the target description.
>
> This patch fixes this issue by handling the new xsave size in
> i387_guess_xsave_layout. It is necessary even though GDB does not
> support AMX yet, since we still pass the full xsave_size (11008)
> extracted from the corefile to i387_guess_xsave_layout.
> The patch does not fix i387_fallback_xsave_layout to configure the new
> xsave size. Configuring sizeof_xsave to 2696 is fine at this point,
> since truncating to 2696 drops only the parts GDB doesn't model yet.
>
> As a quick solution for the upcoming release and CPUs supporting
> Intel AMX this patch should be sufficient.
>
> Testing:
>
> I noticed that we don't have tests for corefiles for the features AVX,
> AVX512 and PKRU in the GDB testsuite. So this commit adds corefile tests
> for AVX, AVX512 and PKRU registers.
>
> As a result of this patch, the warning:
>
> warning: Unexpected size of section `.reg-xstate/1373786' in core file.
>
> which was causing failure in gdb.base/coredump-filter.exp and
> gdb.arch/i386-tls-regs.exp on Intel AMX systems disappears, these tests now
> pass.
>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34561
Thanks for your work on this patch.
I added a NEWS file entry for this as it felt like something that was
NEWS worthy, especially on the gdb-18-branch.
I also changed "corefile" to "core file" in the commit message and
comments.
Then I pushed this to master and gdb-18-branch.
Thanks,
Andrew
prev parent reply other threads:[~2026-09-15 15:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 16:30 Christina Joos
2026-09-15 15:06 ` Andrew Burgess [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8733vad065.fsf@redhat.com \
--to=aburgess@redhat.com \
--cc=christina.joos@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=stephan.rohr@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox