From: Luis <luis.machado.foss@gmail.com>
To: Matthieu Longo <matthieu.longo@arm.com>, gdb-patches@sourceware.org
Cc: Luis Machado <luis.machado@amd.com>,
Thiago Jung Bauermann <thiago.bauermann@linaro.org>,
Andrew Burgess <aburgess@redhat.com>
Subject: Re: [PATCH] gdb questions: fallback on maps still relevant today ?
Date: Wed, 1 Jul 2026 13:33:55 +0100 [thread overview]
Message-ID: <eb986b1c-ccb3-4ba3-9f7b-0d5c4d965499@gmail.com> (raw)
In-Reply-To: <20260701121706.110679-1-matthieu.longo@arm.com>
Hi,
On 01/07/2026 13:17, Matthieu Longo wrote:
> I am wondering whether the fallback on maps when reading smaps is still
> relevant nowadays. /proc/$PID/smaps has been around since 2005. I doubt
> that anyone using an older Linux kernel version out there would use the
> latest version of GDB.
> I propose to remove this fallback logic in linux_find_memory_regions_full.
That´d be fine by me. We might want to do the deprecation dance and then
drop from a future release.
>
> Additionnally, reading from smaps file is tested against NULL. Why ?
> Is there such a valid case where the result of target_fileio_read_stralloc()
> could be null, and at the same time, GDB is attached to a process, local
> or remote via gdbserver, or while reading a coredump ?
> In my understanding, all those cases ensures that the smaps file is always
> present and so, I propose to replace this check with a gdb_assert instead.
There are error cases. And this file isn´t something static on disk but
rather a dynamically-created file on request. Due to that, bad things
can happen and a read may fail.
We don´t want to assert on a temporary hiccup as it will completely kill
gdb during a debug session. If this error ever happens the user gets a
warning or error message and can take action. That isn´t the case with
assertions.
>
> Why do I care about the above ?
> I would like to wrap the reading and parsing code in a class to avoid
> the duplication of all the boiler plates in different places.
Can´t you accomplish that already regardless of whether reading smaps
fails or not?
> Please let me know your thoughts ?
I'm all for tidying things up. And I'm OK with dropping the fallback too.
next prev parent reply other threads:[~2026-07-01 12:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 12:17 Matthieu Longo
2026-07-01 12:33 ` Luis [this message]
2026-07-01 13:34 ` Matthieu Longo
2026-07-21 16:55 ` Tom Tromey
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=eb986b1c-ccb3-4ba3-9f7b-0d5c4d965499@gmail.com \
--to=luis.machado.foss@gmail.com \
--cc=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=luis.machado@amd.com \
--cc=matthieu.longo@arm.com \
--cc=thiago.bauermann@linaro.org \
/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