From: Pedro Alves <palves@redhat.com>
To: Eli Zaretskii <eliz@gnu.org>, Simon Marchi <simon.marchi@polymtl.ca>
Cc: qiyaoltc@gmail.com, gdb-patches@sourceware.org
Subject: Re: [PATCH 0/5] Remove a few hurdles of compiling with clang
Date: Wed, 14 Jun 2017 10:45:00 -0000 [thread overview]
Message-ID: <940cfa4e-b3cb-f15d-93cd-62bd839ab4f0@redhat.com> (raw)
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 <simon.marchi@polymtl.ca>
>> 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 <palves@redhat.com>
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");
}
}
--
2.5.5
next prev parent reply other threads:[~2017-06-14 10:45 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-10 19:58 Simon Marchi
2017-06-10 19:58 ` [PATCH 3/5] gdb: Add -Wno-mismatched-tags Simon Marchi
2017-06-10 19:58 ` [PATCH 1/5] gdb: Pass -x c++ to the compiler Simon Marchi
2017-06-10 19:58 ` [PATCH 2/5] gdb: Use -Werror when checking for (un)supported warning flags Simon Marchi
2017-06-10 19:58 ` [PATCH 4/5] linux-low: Remove usage of "register" keyword Simon Marchi
2017-06-10 19:58 ` [PATCH 5/5] Add ATTRIBUTE_PRINTF to trace_start_error Simon Marchi
2017-06-14 19:49 ` Sergio Durigan Junior
2017-06-11 2:36 ` [PATCH 0/5] Remove a few hurdles of compiling with clang Eli Zaretskii
2017-06-12 7:56 ` Yao Qi
2017-06-12 14:36 ` Eli Zaretskii
2017-06-12 15:54 ` Simon Marchi
2017-06-12 16:23 ` Andrew Pinski
2017-06-12 16:35 ` Pedro Alves
2017-06-12 16:37 ` Andrew Pinski
2017-06-12 16:45 ` Pedro Alves
2017-06-12 16:55 ` Pedro Alves
2017-06-12 16:44 ` Simon Marchi
2017-06-12 16:55 ` Andrew Pinski
2017-06-12 17:00 ` Simon Marchi
2017-06-12 16:44 ` Eli Zaretskii
2017-06-13 9:14 ` Yao Qi
2017-06-13 10:23 ` Simon Marchi
2017-06-13 11:06 ` Pedro Alves
2017-06-13 11:08 ` Simon Marchi
2017-06-13 14:38 ` Eli Zaretskii
2017-06-13 17:07 ` Simon Marchi
2017-06-13 19:23 ` Eli Zaretskii
2017-06-13 20:17 ` Simon Marchi
2017-06-14 2:29 ` Eli Zaretskii
2017-06-14 10:45 ` Pedro Alves [this message]
2017-06-16 16:12 ` John Baldwin
2017-06-13 15:22 ` Yao Qi
2017-06-13 15:44 ` Eli Zaretskii
2017-06-14 9:07 ` Yao Qi
2017-06-19 8:07 ` Yao Qi
2017-06-13 10:44 ` Pedro Alves
2017-06-13 15:09 ` Joel Brobecker
2017-06-17 21:23 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=940cfa4e-b3cb-f15d-93cd-62bd839ab4f0@redhat.com \
--to=palves@redhat.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=qiyaoltc@gmail.com \
--cc=simon.marchi@polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox