Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Matthieu Longo <matthieu.longo@arm.com>
To: <gdb-patches@sourceware.org>
Cc: Tom Tromey <tom@tromey.com>, Matthieu Longo <matthieu.longo@arm.com>
Subject: [PATCH v4 0/5] gdb: introduce file_reader_t to read procfs files
Date: Mon, 16 Nov 2026 12:09:31 +0000	[thread overview]
Message-ID: <20261116120936.425082-1-matthieu.longo@arm.com> (raw)

This series introduces target_file_reader, a helper class for reading target files, and migrates existing /proc file handling to use it. It also refactors the /proc mapping parser to operate on bounded views rather than NUL-terminated strings.

The series is organized as follows:
- Patch 1 adds extract_next_field, a helper for extracting separator-delimited views from a buffer.
- Patch 2 refactors /proc mapping parsing to use gdb::array_view<char> and extract_view_from_buffer, removing the dependency on NUL-terminated strings and strtok_r.
- Patch 3 introduces target_file_reader, which encapsulates the contents and path of a target file and provides convenient accessors and typed views.
- Patches 4 and 5 migrate existing procfs parsing to target_file_reader and remove the now-obsolete parse_smaps_data interface.

== Note ==
Patch 5 is already approved.

== Changes since v3 ==

v3: https://inbox.sourceware.org/gdb-patches/20260922135050.236941-1-matthieu.longo@arm.com/
- Moved extract_next_field to a new header gdbsupport/extract-field.h
- Addressed minor issues pointed by Tom.

Regards,
Matthieu

Matthieu Longo (5):
  gdbsupport: add extract_next_field helper
  gdb/linux: refactor /proc mapping parsing to use array_view
  gdb: introduce helper class target_file_reader
  gdb/linux-tdep: use target_file_reader for procfs parsing
  gdb/linux-tdep: remove legacy parse_smaps_data overload

 gdb/Makefile.in                         |   1 +
 gdb/amd64-linux-tdep.c                  |  12 +-
 gdb/linux-tdep.c                        | 395 ++++++++++++------------
 gdb/sparc64-tdep.c                      |  17 +-
 gdb/target.h                            | 115 +++++++
 gdb/unittests/extract-field-selftests.c |  74 +++++
 gdbsupport/extract-field.h              |  77 +++++
 7 files changed, 487 insertions(+), 204 deletions(-)
 create mode 100644 gdb/unittests/extract-field-selftests.c
 create mode 100644 gdbsupport/extract-field.h

-- 
2.56.0


             reply	other threads:[~2026-11-16 12:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 12:09 Matthieu Longo [this message]
2026-11-16 12:09 ` [PATCH v4 1/5] gdbsupport: add extract_next_field helper Matthieu Longo
2026-11-16 12:09 ` [PATCH v4 2/5] gdb/linux: refactor /proc mapping parsing to use array_view Matthieu Longo
2026-11-16 12:09 ` [PATCH v4 3/5] gdb: introduce helper class target_file_reader Matthieu Longo
2026-11-16 12:09 ` [PATCH v4 4/5] gdb/linux-tdep: use target_file_reader for procfs parsing Matthieu Longo
2026-11-16 12:09 ` [PATCH v4 5/5] gdb/linux-tdep: remove legacy parse_smaps_data overload Matthieu Longo

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=20261116120936.425082-1-matthieu.longo@arm.com \
    --to=matthieu.longo@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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