From: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>
To: Eli Zaretskii <eliz@gnu.org>,
"simon.marchi@polymtl.ca" <simon.marchi@polymtl.ca>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH v2] gdb/corelow: mark bytes unavailable when reading from unavailable mapping
Date: Mon, 2 Mar 2026 15:49:18 +0000 [thread overview]
Message-ID: <DM4PR11MB7303D17CE8F986AC4AF85033C47EA@DM4PR11MB7303.namprd11.prod.outlook.com> (raw)
In-Reply-To: <864imyz8r4.fsf@gnu.org>
On Monday, March 2, 2026 2:01 PM, Eli Zaretskii wrote:
> > From: simon.marchi@polymtl.ca
> > Cc: Simon Marchi <simon.marchi@efficios.com>
> > Date: Sun, 1 Mar 2026 22:23:05 -0500
> >
> > From: Simon Marchi <simon.marchi@efficios.com>
> >
> > New in v2: adjust some more tests, thanks to the Linaro CI for pointing
> > this out.
> >
> > The main motivation for this change is to nicely support "lightweight"
> > core files on ROCm (more on this below), but I think that the change
> > also makes sense for regular core files.
> >
> > When handling a file mappings from a core file, the core target
> > attempts to open the referenced file. If successful, the mappings from
> > this file end up in the m_core_file_mappings vector. Otherwise, they
> > end up in the m_core_unavailable_mappings vector.
> >
> > When trying to read from an address within an unavailable mapping,
> > unless the executable target beneath is able to fulfill the request, the
> > core target returns an error (TARGET_XFER_E_IO). This is from
> > gdb.base/corefile.exp before the patch:
> >
> > (gdb) PASS: gdb.base/corefile.exp: accessing mmapped data in core file with
> coremmap.data removed
> > x/8bd buf2ro
> > 0x7f095a517000: Cannot access memory at address 0x7f095a517000
> >
> > I think that this would be a good use case for the "unavailable" status.
> > We know the memory was there at runtime, it's just not available during
> > post-mortem debugging. That is the definition of "unavailable". After
> > changing core_target::xfer_partial to report the bytes as unavailable,
> > which this patch does, the same test now shows:
> >
> > (gdb) PASS: gdb.base/corefile.exp: accessing mmapped data in core file with
> coremmap.data removed
> > x/8bd buf2ro
> > 0x7f0250f52000: <unavailable> <unavailable> <unavailable> <unavailable>
> <unavailable> <unavailable> <unavailable> <unavailable>
> >
> > I would say that the output of the x command isn't great, but that is
> > just a presentation issue.
> >
> > The original motivation for me to do this change is that we are working
> > on lightweight GPU core dump support in ROCm. By default, the ROC
> > runtime will dump all the memory allocated in the context of the
> > crashing wave. This can result in absurdly big core dumps. With
> > lightweight core dumps, the runtime only dumps a certain subset of the
> > information that is considered essential. When trying to read a value
> > from a segment of memory that was not dumped, I believe that it is
> > natural to use the "unavailable" status. That is handled by this patch.
> >
> > In the following example, `d` is a kernel parameter of type `int *`.
> > Its value was collected in the core dump, but the memory it points to,
> > allocated with hipMalloc, was not. Before:
> >
> > (gdb) p data
> > $1 = (int *) 0x78bf26e00000
> > (gdb) p data[5]
> > ❌️ Cannot access memory at address 0x78bf26e00014
> >
> > After:
> >
> > (gdb) p data
> > $1 = (int *) 0x78bf26e00000
> > (gdb) p data[5]
> > $2 = <unavailable>
>
> I wonder whether <unavailable> is really better here. You don't
> explain why "cannot access memory" needs improvement -- can you tell
> what is wrong with that?
Does the patch enable partial printing of structs?
Suppose there is a struct with a field 'x' whose value is available (e.g. its a
constant, or was promoted to a register, etc.) and another field 'y' that is
located in unavailable memory. Would we get something like
$1 = {x = 42, y = <unavailable>}
instead of a complete "Cannot access memory" error? If that's the case,
it could be considered an improvement, even though it does not explain
why the value is unavailable.
-Baris
Intel Deutschland GmbH
Registered Address: Dornacher Straße 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.de
Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: Munich
Commercial Register: Amtsgericht München HRB 186928
next prev parent reply other threads:[~2026-03-02 15:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-28 2:20 [PATCH] " Simon Marchi
2026-03-02 3:23 ` [PATCH v2] " simon.marchi
2026-03-02 13:00 ` Eli Zaretskii
2026-03-02 15:49 ` Aktemur, Tankut Baris [this message]
2026-03-02 20:01 ` Simon Marchi
2026-03-02 19:54 ` Simon Marchi
2026-03-04 16:38 ` Tom Tromey
2026-03-04 16:36 ` Tom Tromey
2026-03-09 18:37 ` Simon Marchi
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=DM4PR11MB7303D17CE8F986AC4AF85033C47EA@DM4PR11MB7303.namprd11.prod.outlook.com \
--to=tankut.baris.aktemur@intel.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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