public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Alcock <nick.alcock@oracle.com>
To: binutils@sourceware.org
Cc: stephen.brennan@oracle.com
Subject: [PATCH libctf 00/11] enumerator query API, plus some bugfixes
Date: Thu, 13 Jun 2024 19:54:19 +0100	[thread overview]
Message-ID: <20240613185430.85352-1-nick.alcock@oracle.com> (raw)

This series is largely the addition of new query APIs for enumerators
(proposed on this list a few weeks ago, then radically rethought by
others into a much better design), plus a bunch of fixes for bugs
found in the process.  We also improve the deduplicator to consider
enums to be conflicting types if they are distinct but have enumeration
constants in common, and adapt ctf_add_enumerator() to prohibit the
addition of such enumerators (which are invalid C anyway, so anything
trying to add them is probably buggy).

The most series of the bugs fixed at the same time is a strtab
corruption bug observed if you add enums or structure members to a dict
you opened with ctf_open(): such dicts were read-only until only a few
weeks ago, so this bug has probably been caught before it could do any
damage!

(There are also new tests for this stuff: in fact the new test for
the enumerator API trips most of these bugs itself.)

I'll push tomorrow if nobody has any comments.

Nick Alcock (11):
  libctf: strtab corruption when strings are added to ctf_open()ed dicts
  include: fix libctf ECTF_NOENUMNAM error message
  libctf: doc: fix ctf_stype_t typedef string in spec
  libctf: dedup: enums with overlapping enumerators are conflicting
  libctf: don't leak enums if ctf_add_type fails
  libctf: fix dict leak on archive-wide symbol lookup error path
  libctf: suppress spurious failure of malloc-counting tests under
    valgrind
  libctf: prohibit addition of enums with overlapping enumerator
    constants
  libctf: make the ctf_next ctn_fp non-const
  include: libctf: comment improvements
  libctf, include: new functions for looking up enumerators

 include/ctf-api.h                             |  59 +++++-
 ld/testsuite/ld-ctf/enum-3.c                  |   3 +
 ld/testsuite/ld-ctf/enum-4.c                  |   3 +
 ld/testsuite/ld-ctf/overlapping-enums-2.d     |  36 ++++
 ld/testsuite/ld-ctf/overlapping-enums.d       |  35 ++++
 libctf/config.h.in                            |   3 +
 libctf/configure                              |   2 +-
 libctf/configure.ac                           |   2 +-
 libctf/ctf-archive.c                          | 108 +++++++++++
 libctf/ctf-create.c                           |  48 ++++-
 libctf/ctf-dedup.c                            |  42 ++++-
 libctf/ctf-hash.c                             |   6 +
 libctf/ctf-impl.h                             |  28 +--
 libctf/ctf-lookup.c                           | 145 +++++++++++++++
 libctf/ctf-open.c                             | 134 ++++++++++++--
 libctf/ctf-string.c                           |   2 +
 libctf/ctf-util.c                             |  29 ++-
 libctf/doc/ctf-spec.texi                      |   2 +-
 libctf/libctf.ver                             |   7 +
 libctf/testsuite/lib/ctf-lib.exp              |   5 +
 libctf/testsuite/libctf-lookup/enum-ctf-2.c   |   6 +
 .../libctf-lookup/enumerator-iteration.c      | 168 ++++++++++++++++++
 .../libctf-lookup/enumerator-iteration.lk     |  17 ++
 .../libctf-regression/open-error-free.c       |  13 ++
 24 files changed, 849 insertions(+), 54 deletions(-)
 create mode 100644 ld/testsuite/ld-ctf/enum-3.c
 create mode 100644 ld/testsuite/ld-ctf/enum-4.c
 create mode 100644 ld/testsuite/ld-ctf/overlapping-enums-2.d
 create mode 100644 ld/testsuite/ld-ctf/overlapping-enums.d
 create mode 100644 libctf/testsuite/libctf-lookup/enum-ctf-2.c
 create mode 100644 libctf/testsuite/libctf-lookup/enumerator-iteration.c
 create mode 100644 libctf/testsuite/libctf-lookup/enumerator-iteration.lk

-- 
2.45.1.275.g567cb0950c


             reply	other threads:[~2024-06-13 18:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13 18:54 Nick Alcock [this message]
2024-06-13 18:54 ` [PATCH 01/11] libctf: strtab corruption when strings are added to ctf_open()ed dicts Nick Alcock
2024-06-13 18:54 ` [PATCH 02/11] include: fix libctf ECTF_NOENUMNAM error message Nick Alcock
2024-06-13 18:54 ` [PATCH 03/11] libctf: doc: fix ctf_stype_t typedef string in spec Nick Alcock
2024-06-13 18:54 ` [PATCH 04/11] libctf: dedup: enums with overlapping enumerators are conflicting Nick Alcock
2024-06-13 18:54 ` [PATCH 05/11] libctf: don't leak enums if ctf_add_type fails Nick Alcock
2024-06-13 18:54 ` [PATCH 06/11] libctf: fix dict leak on archive-wide symbol lookup error path Nick Alcock
2024-06-13 18:54 ` [PATCH 07/11] libctf: suppress spurious failure of malloc-counting tests under valgrind Nick Alcock
2024-06-13 18:54 ` [PATCH 08/11] libctf: prohibit addition of enums with overlapping enumerator constants Nick Alcock
2024-06-13 18:54 ` [PATCH 09/11] libctf: make the ctf_next ctn_fp non-const Nick Alcock
2024-06-13 18:54 ` [PATCH 10/11] include: libctf: comment improvements Nick Alcock
2024-06-13 18:54 ` [PATCH 11/11] libctf, include: new functions for looking up enumerators Nick Alcock
2024-06-14 17:51   ` David Faust
2024-06-17 13:43     ` Nick Alcock
2024-06-14 14:14 ` [PATCH libctf 00/11] enumerator query API, plus some bugfixes Tom Tromey
2024-06-14 17:57   ` Nick Alcock

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=20240613185430.85352-1-nick.alcock@oracle.com \
    --to=nick.alcock@oracle.com \
    --cc=binutils@sourceware.org \
    --cc=stephen.brennan@oracle.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).