From: Daniel Thompson <daniel.thompson@linaro.org>
To: Douglas Anderson <dianders@chromium.org>
Cc: Anatoly Pugachev <matorola@gmail.com>,
sparclinux@vger.kernel.org,
Jason Wessel <jason.wessel@windriver.com>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Chuhong Yuan <hslester96@gmail.com>,
kgdb-bugreport@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH] kdb: Fix compiling on architectures w/out DBG_MAX_REG_NUM defined
Date: Wed, 5 Feb 2020 17:30:42 +0000 [thread overview]
Message-ID: <20200205173042.chqij5i53mncfzar@holly.lan> (raw)
In-Reply-To: <20200204141219.1.Ief3f3a7edbbd76165901b14813e90381c290786d@changeid>
On Tue, Feb 04, 2020 at 02:12:25PM -0800, Douglas Anderson wrote:
> In commit bbfceba15f8d ("kdb: Get rid of confusing diag msg from "rd"
> if current task has no regs") I tried to clean things up by using "if"
> instead of "#ifdef". Turns out we really need "#ifdef" since not all
> architectures define some of the structures that the code is referring
> to.
>
> Let's switch to #ifdef again, but at least avoid using it inside of
> the function.
>
> Fixes: bbfceba15f8d ("kdb: Get rid of confusing diag msg from "rd" if current task has no regs")
> Reported-by: Anatoly Pugachev <matorola@gmail.com>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
Thanks for being so quick with this (especially when if I had been less
delinquent with linux-next it might have been spotted sooner).
> ---
> I don't have a sparc64 compiler but I'm pretty sure this should work.
> Testing appreciated.
I've just add sparc64 into my pre-release testing (although I have had to
turn off a bunch of additional compiler warnings in order to do so).
> kernel/debug/kdb/kdb_main.c | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
> index b22292b649c4..c84e61747267 100644
> --- a/kernel/debug/kdb/kdb_main.c
> +++ b/kernel/debug/kdb/kdb_main.c
> @@ -1833,6 +1833,16 @@ static int kdb_go(int argc, const char **argv)
> /*
> * kdb_rd - This function implements the 'rd' command.
> */
> +
> +/* Fallback to Linux showregs() if we don't have DBG_MAX_REG_NUM */
> +#if DBG_MAX_REG_NUM <= 0
> +static int kdb_rd(int argc, const char **argv)
> +{
> + if (!kdb_check_regs())
> + kdb_dumpregs(kdb_current_regs);
> + return 0;
> +}
> +#else
The original kdb_rd (and kdb_rm which still exists in this file) place
the #if inside the function and users > 0 so the common case was
covered at the top and the fallback at the bottom.
Why change style when re-introducing this code?
Daniel.
next prev parent reply other threads:[~2020-02-05 17:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-04 22:12 [PATCH] kdb: Fix compiling on architectures w/out DBG_MAX_REG_NUM defined Douglas Anderson
2020-02-05 17:30 ` Daniel Thompson [this message]
2020-02-05 18:01 ` Doug Anderson
2020-02-06 11:58 ` Daniel Thompson
2020-02-06 16:15 ` Doug Anderson
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=20200205173042.chqij5i53mncfzar@holly.lan \
--to=daniel.thompson@linaro.org \
--cc=dan.carpenter@oracle.com \
--cc=dianders@chromium.org \
--cc=hslester96@gmail.com \
--cc=jason.wessel@windriver.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=matorola@gmail.com \
--cc=sparclinux@vger.kernel.org \
--cc=yamada.masahiro@socionext.com \
/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;
as well as URLs for NNTP newsgroup(s).