From: Matthieu Longo <matthieu.longo@arm.com>
To: Luis <luis.machado.foss@gmail.com>, gdb-patches@sourceware.org
Cc: Thiago Jung Bauermann <thiago.bauermann@linaro.org>,
Andrew Burgess <aburgess@redhat.com>,
Luis Machado <luis.machado@amd.com>
Subject: Re: [PATCH] gdb questions: fallback on maps still relevant today ?
Date: Wed, 1 Jul 2026 14:34:49 +0100 [thread overview]
Message-ID: <a4c42d44-91ff-461a-acec-d03cff68e850@arm.com> (raw)
In-Reply-To: <eb986b1c-ccb3-4ba3-9f7b-0d5c4d965499@gmail.com>
On 01/07/2026 13:33, Luis wrote:
> 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.
>
What do you mean by "deprecation dance" ?
What would the steps be to get rid of this fallback ?
>> 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.
>
Ok
>>
>> 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?
>
I can. I was wondering whether it was possible to tidy things up before adding wrappers.
Matthieu
next prev parent reply other threads:[~2026-07-01 13:36 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
2026-07-01 13:34 ` Matthieu Longo [this message]
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=a4c42d44-91ff-461a-acec-d03cff68e850@arm.com \
--to=matthieu.longo@arm.com \
--cc=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=luis.machado.foss@gmail.com \
--cc=luis.machado@amd.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