public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Suppress printing of superfluous BFD error messages
@ 2022-09-08  1:58 Kevin Buettner
  2022-09-08  1:58 ` [PATCH v3 1/2] " Kevin Buettner
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kevin Buettner @ 2022-09-08  1:58 UTC (permalink / raw)
  To: gdb-patches; +Cc: lsix, simark, Kevin Buettner

Tools which use the BFD library will output error messages of the
form "BFD: some messsage" when a problem with the file upon which it
operating is found.  E.g. an actual message (modulo some shortening
of the pathname) from the test case in this series is:

BFD: bfd-errors-lib.so: invalid string offset 1154 >= 154 for section `.dynstr'

For some problems with executable files or libraries, BFD will
attempt to output many identical messages.  The first patch in this
series adds code to GDB to suppress messages which are identical to
earlier messages that have already been printed.

(The above blurb was adapted from a comment in the test case.)

The V2 patch addresses concerns noted by Lancelot SIX:

For part 1, I've used one of Lancelot's suggestions for simplifying
the implementation of increment_bfd_error_count() in gdb_bfd.c.

Regarding the test case, Lancelot found that it failed when tested on
Ubuntu.  It turned out that attempting to run to a catchpoint whilst
using a mangled shared library was fragile.  I rewrote parts of the
test to instead use 'add-symbol-file -readnow' to load symbols from
the mangled shared object into GDB.  Also, since the main program is
no longer needed, I removed it and all references to in in the .exp
file.  Lancelot suggested several other improvements which I also put
into place.

This V3 patch addresses concerns from Simon Marchi:

In part 1, I changed the type of the associative array used to keep
track of BFD messages from 'map' to 'unordered_map', changed the
case of BFD ('bfd' -> 'BFD') in a couple of comments, and used
std::move to convert the error string to an xvalue.

The changes to part 2 include adding a 'close' along an error path,
changing the objcopy invocations to use 'catch "exec ..."' instead
of run_on_host, use of 'file size' instead of opening and reading
the file to determine its size, and the use of 'clean_restart' in
place of discrete invocations of 'gdb_start' and 'gdb_reinitialize_dir'.

Kevin Buettner (2):
  Suppress printing of superfluous BFD error messages
  BFD error message suppression test case

 gdb/gdb_bfd.c                           |  67 +++++++++
 gdb/testsuite/gdb.base/bfd-errors-lib.c |  44 ++++++
 gdb/testsuite/gdb.base/bfd-errors.exp   | 185 ++++++++++++++++++++++++
 3 files changed, 296 insertions(+)
 create mode 100644 gdb/testsuite/gdb.base/bfd-errors-lib.c
 create mode 100644 gdb/testsuite/gdb.base/bfd-errors.exp

-- 
2.37.3


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

end of thread, other threads:[~2022-09-16 23:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-08  1:58 [PATCH v3 0/2] Suppress printing of superfluous BFD error messages Kevin Buettner
2022-09-08  1:58 ` [PATCH v3 1/2] " Kevin Buettner
2022-09-08  1:58 ` [PATCH v3 2/2] BFD error message suppression test case Kevin Buettner
2022-09-16 23:32 ` [PATCH v3 0/2] Suppress printing of superfluous BFD error messages Kevin Buettner

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).