From patchwork Wed Jun 14 10:45:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 21005 Received: (qmail 41953 invoked by alias); 14 Jun 2017 10:45:44 -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 41557 invoked by uid 89); 14 Jun 2017 10:45:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=cared X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 14 Jun 2017 10:45:04 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CA6818046F; Wed, 14 Jun 2017 10:45:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CA6818046F Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com CA6818046F Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 965A89340C; Wed, 14 Jun 2017 10:45:05 +0000 (UTC) Subject: Re: [PATCH 0/5] Remove a few hurdles of compiling with clang To: Eli Zaretskii , Simon Marchi References: <1497124689-11842-1-git-send-email-simon.marchi@ericsson.com> <83tw3n5jyk.fsf@gnu.org> <86tw3labb0.fsf@gmail.com> <83a85d5l4n.fsf@gnu.org> <93eb64489ac9d53665a144ddf5a966d5@polymtl.ca> <83wp8h40lo.fsf@gnu.org> <8660g0dzau.fsf@gmail.com> <83k24g3qcx.fsf@gnu.org> <83a85b4rrs.fsf@gnu.org> <5c75dd67a82d99cfe0befdfe777abcc9@polymtl.ca> <831sqn4801.fsf@gnu.org> Cc: qiyaoltc@gmail.com, gdb-patches@sourceware.org From: Pedro Alves Message-ID: <940cfa4e-b3cb-f15d-93cd-62bd839ab4f0@redhat.com> Date: Wed, 14 Jun 2017 11:45:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <831sqn4801.fsf@gnu.org> On 06/14/2017 03:29 AM, Eli Zaretskii wrote: >> Date: Tue, 13 Jun 2017 22:17:15 +0200 >> From: Simon Marchi >> Cc: qiyaoltc@gmail.com, gdb-patches@sourceware.org >> >> On 2017-06-13 21:22, Eli Zaretskii wrote: >>> See, I don't consider the proposed solution to be elegant, because it >>> tweaks a perfectly valid code to placate a stupid compiler warning. >> >> It replaces perfectly valid code with some other perfectly valid code. > > Which is not used anywhere else, right? > >> We can always add comments like >> >> /* Don't use ALL_DEBUG_ADDRESS_REGISTERS here to silence Clang's >> -Wfor-loop-analysis warning. */ > > That's the least we should do, IMO. I'd vote for saying instead: /* Don't use ALL_DEBUG_ADDRESS_REGISTERS here because we want to skip over two registers at a time. */ Or better even, just don't skip two registers at a time? The code is manually printing two columns on each iteration. How about the patchlet below instead? I'd call it a clean up on its own right. Note this output is only shown with "maint set show-debug-regs on". So with this, if someone cared for saving vertical space of the debug output (I don't), this could be easily tweaked to adjust the number of debug regs per line printed depending on screen width, for example. Doing that with the current scheme of printing more than one register with a single format string wouldn't work that well. From 2cfc65a311798c519ae393f474302f634aa2595d Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 14 Jun 2017 11:25:19 +0100 Subject: [PATCH] dregs --- gdb/nat/x86-dregs.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gdb/nat/x86-dregs.c b/gdb/nat/x86-dregs.c index 8c8adfa..7fd2d56 100644 --- a/gdb/nat/x86-dregs.c +++ b/gdb/nat/x86-dregs.c @@ -198,15 +198,14 @@ x86_show_dr (struct x86_debug_reg_state *state, phex (state->dr_status_mirror, 8)); ALL_DEBUG_ADDRESS_REGISTERS (i) { - debug_printf ("\ -\tDR%d: addr=0x%s, ref.count=%d DR%d: addr=0x%s, ref.count=%d\n", + debug_printf ("\tDR%d: addr=0x%s, ref.count=%d", i, phex (state->dr_mirror[i], x86_get_debug_register_length ()), - state->dr_ref_count[i], - i + 1, phex (state->dr_mirror[i + 1], - x86_get_debug_register_length ()), - state->dr_ref_count[i + 1]); - i++; + state->dr_ref_count[i]); + + /* Print two debug registers per line. */ + if ((i - DR_FIRSTADDR) % 2) + debug_printf ("\n"); } }