From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74530 invoked by alias); 22 Jun 2017 22:45:05 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 74250 invoked by uid 89); 22 Jun 2017 22:45:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-12.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=quantities, packaged, H*Ad:U*tom, HContent-Transfer-Encoding:8bit X-Spam-User: qpsmtpd, 2 recipients X-HELO: mailbackend.panix.com Received: from mailbackend.panix.com (HELO mailbackend.panix.com) (166.84.1.89) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Jun 2017 22:44:59 +0000 Received: from panix3.panix.com (panix3.panix.com [166.84.1.3]) by mailbackend.panix.com (Postfix) with ESMTP id 8886010FDA; Thu, 22 Jun 2017 18:44:56 -0400 (EDT) Received: by panix3.panix.com (Postfix, from userid 18676) id 277962EB50; Thu, 22 Jun 2017 18:44:56 -0400 (EDT) From: Zack Weinberg To: libc-alpha@sourceware.org, gdb@sourceware.org Cc: joseph@codesourcery.com, fweimer@redhat.com, tom@tromey.com, siddhesh@gotplt.org Subject: [RFC PATCH 0/3] Pretty-printing for errno Date: Thu, 22 Jun 2017 22:45:00 -0000 Message-Id: <20170622224456.1358-1-zackw@panix.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SW-Source: 2017-06/txt/msg00020.txt.bz2 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 quantities. 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. zw 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 -- 2.11.0