From patchwork Tue Oct 8 06:50:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 34863 Received: (qmail 70450 invoked by alias); 8 Oct 2019 06:51:02 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 70440 invoked by uid 89); 8 Oct 2019 06:51:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 08 Oct 2019 06:51:01 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DE833ABA0 for ; Tue, 8 Oct 2019 06:50:58 +0000 (UTC) Date: Tue, 8 Oct 2019 08:50:57 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH][gdb/target] Fix pretty-printer for MPX bnd registers Message-ID: <20191008065056.GA2609@delia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes Hi, I'm seeing this failure: ... (gdb) print /x $bnd0 = {0x10, 0x20}^M $23 = {lbound = 0x10, ubound = 0x20}^M (gdb) FAIL: gdb.arch/i386-mpx.exp: verify size for bnd0 ... The test expects a pretty printer to be actived printing 'size 17': ... set test_string ".*\\\: size 17.*" gdb_test "print /x \$bnd0 = {0x10, 0x20}" "$test_string" "verify size for bnd0" ... but that doesn't happen. The pretty printer is for the type of the $bnd0 register, which is created here in i386_bnd_type: ... t = arch_composite_type (gdbarch, "__gdb_builtin_type_bound128", TYPE_CODE_STRUCT); append_composite_type_field (t, "lbound", bt->builtin_data_ptr); append_composite_type_field (t, "ubound", bt->builtin_data_ptr); TYPE_NAME (t) = "builtin_type_bound128"; ... And the pretty-printer is registered here in gdb/python/lib/gdb/printer/bound_registers.py: ... gdb.printing.add_builtin_pretty_printer ('mpx_bound128', '^__gdb_builtin_type_bound128', MpxBound128Printer) ... Fix the pretty printer by changing the regexp argument of add_builtin_pretty_printer to match "builtin_type_bound128", the TYPE_NAME. Tested on x86_64-linux. OK for trunk? Thanks, - Tom [gdb/target] Fix pretty-printer for MPX bnd registers gdb/ChangeLog: 2019-10-08 Tom de Vries * python/lib/gdb/printer/bound_registers.py: Use '^__gdb_builtin_type_bound128' as regexp argument for add_builtin_pretty_printer. --- gdb/python/lib/gdb/printer/bound_registers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/python/lib/gdb/printer/bound_registers.py b/gdb/python/lib/gdb/printer/bound_registers.py index f39d2200412..1e8a3ccdfb6 100644 --- a/gdb/python/lib/gdb/printer/bound_registers.py +++ b/gdb/python/lib/gdb/printer/bound_registers.py @@ -39,5 +39,5 @@ class MpxBound128Printer: return result gdb.printing.add_builtin_pretty_printer ('mpx_bound128', - '^__gdb_builtin_type_bound128', + '^builtin_type_bound128', MpxBound128Printer)