public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Rewrite gdb_argv using extract_string_maybe_quoted
@ 2024-02-08 16:28 Andrew Burgess
  2024-02-08 16:28 ` [PATCH 1/4] gdb/unittests: add extract_string_maybe_quoted self tests Andrew Burgess
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Andrew Burgess @ 2024-02-08 16:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

This short series is really a refactor, though it does fix one tiny
bug in gdb_argv which can be seen in the Python API's
gdb.string_to_argv.  See patch #4 for details.

Patches #1 and #3 are purely about adding more unit tests.

Patches #2 and #4 are the real GDB changes.

This series feeds into two other projects that I'm working on, one of
which is already on the mailing list, and the other is still in
progress.

The first patch in this series:

  https://inbox.sourceware.org/gdb-patches/cover.1704809585.git.aburgess@redhat.com

is for libiberties buildargv function.  Using that function is good
(code reuse), but we already have extract_string_maybe_quoted which is
a GDB local copy of the core loop from within buildargv.  I therefore
claim that using buildargv is good, but using
extract_string_maybe_quoted is better -- the more heavily used GDB's
utility functions are, the more confident we can be that they are
correct.

The second place where this refactor will help is, I think, is with
addign support for filename command options (e.g. -option FILENAME),
in this case, when completing, we need to be able to skip over
FILENAME, which requires having a version of
extract_string_maybe_quoted that can adapt to the escaping which is
applied to FILENAME.  The extract_string_maybe_quoted changes in this
series will be helpful here.

All feedback welcome.

Thanks,
Andrew

---

Andrew Burgess (4):
  gdb/unittests: add extract_string_maybe_quoted self tests
  gdbsupport: allow for configuration of extract_string_maybe_quoted
  gdb/unittests: additional tests for gdb_argv class
  gdbsupport: rewrite gdb_argv to use extract_string_maybe_quoted

 gdb/Makefile.in                          |   2 +
 gdb/testsuite/gdb.python/py-cmd.exp      |   8 ++
 gdb/unittests/extract-string-selftests.c |  96 +++++++++++++++
 gdb/unittests/gdb_argv-selftests.c       | 134 +++++++++++++++++++++
 gdb/utils.c                              |  26 ----
 gdbsupport/buildargv.h                   |  50 +++++---
 gdbsupport/common-utils.cc               |  80 +++++++------
 gdbsupport/common-utils.h                | 144 ++++++++++++++++++++++-
 8 files changed, 464 insertions(+), 76 deletions(-)
 create mode 100644 gdb/unittests/extract-string-selftests.c
 create mode 100644 gdb/unittests/gdb_argv-selftests.c


base-commit: e58beedf2c8a1e0c78e0f57aeab3934de9416bfc
-- 
2.25.4


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

end of thread, other threads:[~2024-02-09 17:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-08 16:28 [PATCH 0/4] Rewrite gdb_argv using extract_string_maybe_quoted Andrew Burgess
2024-02-08 16:28 ` [PATCH 1/4] gdb/unittests: add extract_string_maybe_quoted self tests Andrew Burgess
2024-02-08 18:17   ` Tom Tromey
2024-02-08 16:28 ` [PATCH 2/4] gdbsupport: allow for configuration of extract_string_maybe_quoted Andrew Burgess
2024-02-08 19:05   ` Tom Tromey
2024-02-08 16:28 ` [PATCH 3/4] gdb/unittests: additional tests for gdb_argv class Andrew Burgess
2024-02-08 16:28 ` [PATCH 4/4] gdbsupport: rewrite gdb_argv to use extract_string_maybe_quoted Andrew Burgess
2024-02-08 19:08   ` Tom Tromey
2024-02-09 16:46     ` Andrew Burgess
2024-02-09 17:22       ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).