]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Introduce bfd_print_error function
authorTom Tromey <tom@tromey.com>
Mon, 12 Feb 2024 21:25:03 +0000 (14:25 -0700)
committerTom Tromey <tom@tromey.com>
Mon, 12 Feb 2024 23:25:40 +0000 (16:25 -0700)
commit7417ccf08ef5f1e173d74754c54e64144672f64f
tree2d99e137dd15973c3577f8829adef8a252ababc9
parent91095bcf2820f3d77ea1e16a338e686ba6a70e9f
Introduce bfd_print_error function

gdb likes to control its own output; for example, this is important
for gdb's pager, and for logging.  While BFD provides a way to
intercept error output, via bfd_set_error_handler, it turns out to be
difficult for this function to truly generate the desired output in a
gdb-friendly way -- the error handler is expected to implement some
BFD printf format extensions.

This patch introduces a new function that an error handler can use to
format the text.  This way, gdb can set the error handler and arrange
for the output to be displayed as it likes.

* bfd.c (bfd_print_callback): Rename from print_func.  Move into
comment.
(_bfd_doprnt): Update.
(bfd_print_error): New function.
(error_handler_fprintf, error_handler_sprintf): Use
bfd_print_error.
* bfd-in2.h: Rebuild.
bfd/bfd-in2.h
bfd/bfd.c