This is the mail archive of the
mailing list for the glibc project.
[RFC PATCH 0/3] Pretty-printing for errno
- From: Zack Weinberg <zackw at panix dot com>
- To: libc-alpha at sourceware dot org, gdb at sourceware dot org
- Cc: joseph at codesourcery dot com, fweimer at redhat dot com, tom at tromey dot com, siddhesh at gotplt dot org
- Date: Thu, 22 Jun 2017 18:44:53 -0400
- Subject: [RFC PATCH 0/3] Pretty-printing for errno
- Authentication-results: sourceware.org; auth=none
My 'headers cleanups' patch series included an attempt to generalize
the Hurd's error_t to all supported host environments. It was
suggested that the job it does is maybe better suited to a GDB
pretty-printer. This patch series attempts to do that.
I say 'attempts' because it only _almost_ works, but the remaining
problems appear to be GDB bugs. The most important of these is that
if error_t is a typedef name for int,
(gdb) p (error_t) 1
will _not_ invoke the pretty-printer for error_t. Bizarrely, the same
pretty-printer _does_ get invoked when you print an _array_ of error_t
Also, GDB 7.12 and 8.0 as packaged for Debian on amd64 cannot access
thread-local variables (which I find very surprising, but there it is)
and this sometimes, but not always, interferes with access to errno.
I have written this patchset so that it can go in in advance of these
bugs being fixed in GDB -- specifically, the test for the
pretty-printer checks for both bugs and marks itself as UNSUPPORTED if
they manifest. It might make sense to wait at least for the bugs to
be fixed in GDB trunk, so we can make sure the test _does_ pass when a
fixed GDB is available; but I could also see putting it in now and
fixing it up later if necessary.
The patch series has been tested on x86-64-linux. It touches a
nontrivial amount of Hurd-specific code but has _not_ been tested
there, even in cross-compilation (I am happy to attempt this if
someone can point me at step-by-step instructions); but I did make
sure that both errnos.awk and hurd-add-errno-constants.awk do the
right thing when run manually.
Siddhesh, given the short remaining time before the freeze I would like
to ask you to quickly decide whether you think this is worth trying to
get into 2.26 or if it should wait for the next release.
Zack Weinberg (3):
Improve testing of GDB pretty-printers.
Make error_t always int; make __errno_location return an __error_t.
Add pretty-printer for errno.
Rules | 4 +
bits/errno.h | 13 +-
csu/errno-loc.c | 2 +-
csu/errno.c | 4 +-
include/errno.h | 6 +-
scripts/test_printers_common.py | 84 +++--
stdlib/Makefile | 38 ++
stdlib/errno-printer.py | 105 ++++++
stdlib/errno.h | 12 +-
stdlib/make-errno-constants.awk | 66 ++++
stdlib/test-errno-constants.py | 58 ++++
stdlib/test-errno-printer.c | 43 +++
stdlib/test-errno-printer.py | 71 ++++
sysdeps/mach/hurd/Makefile | 10 +
sysdeps/mach/hurd/bits/errno.h | 457 +++++++------------------
sysdeps/mach/hurd/dl-sysdep.c | 3 +-
sysdeps/mach/hurd/errno-loc.c | 2 +-
sysdeps/mach/hurd/errno.c | 1 -
sysdeps/mach/hurd/errnos.awk | 109 ++----
sysdeps/mach/hurd/hurd-add-errno-constants.awk | 80 +++++
20 files changed, 696 insertions(+), 472 deletions(-)
create mode 100644 stdlib/errno-printer.py
create mode 100644 stdlib/make-errno-constants.awk
create mode 100644 stdlib/test-errno-constants.py
create mode 100644 stdlib/test-errno-printer.c
create mode 100644 stdlib/test-errno-printer.py
delete mode 100644 sysdeps/mach/hurd/errno.c
create mode 100644 sysdeps/mach/hurd/hurd-add-errno-constants.awk