Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH v3 0/8] gdb: introduce file_reader_t to read procfs files
@ 2026-09-22 13:50 Matthieu Longo
  2026-09-22 13:50 ` [PATCH v3 1/8] gdb support: add gdb::ranges::replace algorithm Matthieu Longo
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Matthieu Longo @ 2026-09-22 13:50 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess, Tom Tromey, Matthieu Longo

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 gdb::ranges::replace, a C++17-compatible replacement for std::ranges::replace.
- Patches 2 and 3 contain small cleanups identified during review: removing redundant struct prefixes and styling /proc filenames in warning messages.
- Patch 4 adds extract_next_field, a helper for extracting separator-delimited views from a buffer.
- Patch 5 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 6 introduces target_file_reader, which encapsulates the contents and path of a target file and provides convenient accessors and typed views.
- Patches 7 and 8 migrate existing procfs parsing to target_file_reader and remove the now-obsolete parse_smaps_data interface.

== Review status ==
Most of the patches have been already reviewed once by Andrew Burgess in v2, and others reviewers in v1.
However, for clarity:
- Patches 2 and 3 are new but based on comments from Andrew Burgess in v2.
- Patch 5 contains new or substantially changed code and require more attention. This rework was triggered by the discovery of a bug in patch 4/6 in v2.


== Changes since v2 ==

v2: https://inbox.sourceware.org/gdb-patches/20260825100912.514232-1-matthieu.longo@arm.com/
- Renamed extract_view_from_buffer to extract_next_field, and add unit tests in selftests.
- Refactored /proc mapping parsing to operate on gdb::array_view<char> instead of NUL-terminated strings. read_mapping now parses bounded ranges and diagnoses malformed mapping fields.
- Split the cleanup removing redundant struct prefixes from smaps_data, as suggested by Christina Joos and Andrew Burgess.
- Added filename styling to /proc warning messages, as suggested by Andrew Burgess.


This series depends on: https://inbox.sourceware.org/gdb-patches/20260917201755.589524-1-simon.marchi@efficios.com/

Regards,
Matthieu


Matthieu Longo (8):
  gdb support: add gdb::ranges::replace algorithm
  gdb/linux: remove redundant struct prefixes from smaps_data
  gdb/linux: style filenames in /proc warning messages
  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                       | 406 +++++++++++++------------
 gdb/sparc64-tdep.c                     |  17 +-
 gdb/target.h                           | 116 +++++++
 gdb/unittests/common-utils-selftests.c |  32 ++
 gdb/unittests/ranges-selftests.c       |  63 ++++
 gdbsupport/common-utils.h              |  50 +++
 gdbsupport/ranges.h                    |  39 +++
 9 files changed, 530 insertions(+), 206 deletions(-)
 create mode 100644 gdb/unittests/ranges-selftests.c
 create mode 100644 gdbsupport/ranges.h

-- 
2.55.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-09-22 14:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-22 13:50 [PATCH v3 0/8] gdb: introduce file_reader_t to read procfs files Matthieu Longo
2026-09-22 13:50 ` [PATCH v3 1/8] gdb support: add gdb::ranges::replace algorithm Matthieu Longo
2026-09-22 13:50 ` [PATCH v3 2/8] gdb/linux: remove redundant struct prefixes from smaps_data Matthieu Longo
2026-09-22 13:50 ` [PATCH v3 3/8] gdb/linux: style filenames in /proc warning messages Matthieu Longo
2026-09-22 13:50 ` [PATCH v3 4/8] gdbsupport: add extract_next_field helper Matthieu Longo
2026-09-22 13:50 ` [PATCH v3 5/8] gdb/linux: refactor /proc mapping parsing to use array_view Matthieu Longo
2026-09-22 13:50 ` [PATCH v3 6/8] gdb: introduce helper class target_file_reader Matthieu Longo
2026-09-22 13:50 ` [PATCH v3 7/8] gdb/linux-tdep: use target_file_reader for procfs parsing Matthieu Longo
2026-09-22 13:50 ` [PATCH v3 8/8] gdb/linux-tdep: remove legacy parse_smaps_data overload Matthieu Longo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox