Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5444769ybl; Tue, 4 Feb 2020 14:13:59 -0800 (PST) X-Google-Smtp-Source: APXvYqzds/3tPYMW9qhU2HCy20+If5KBh0DP8yYbsYV9r5eepizWhg8zEre6dydUEFrtxMpDAnZH X-Received: by 2002:a05:6808:10b:: with SMTP id b11mr868387oie.110.1580854439827; Tue, 04 Feb 2020 14:13:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580854439; cv=none; d=google.com; s=arc-20160816; b=Aq+2jHlTZwGZXksQA7XN5Zw6W599F6S7zVVhEnrBe1kdcGyXynwQGcyPZqXgnRbptk 1WU7b4XIej64HTfawImRwvHXbJwzi2sTtg1Pm+5+b0dJJh8iNX+iOEP+KUdAAbPGcRLO sZV9zsT+Dg/nm8GfMZghd8TAu1pEKdTUQlNT67/ANvinZVphNsHwMeMc7Ld6lo1PqCvZ BbqWDeIdSkucA8FVzud+vM3cVl0R0szQudAWE59i7xI/YxqI96YSTM/FMzFdJirnu5wB doGF8cAtT2GQKottQLTy54h359ur1TjBLImMJi6L4KODHp6kqftUbzaaz4R85bj0LcNq L3tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=LJphzd4Uf85jJrjWhKW7N0t3rDrhEm6RJEDIyC2Wp+M=; b=Ijq6iT3Li4b1WnOqfJSswKUC/EcKq0g69eV/7Zop0f2C9w2X1yjEjUN7vSrCh/FT93 5FEe7huWXPN9NsZZWykm/t0EYHWQh0HnlMh3WBvdxl47AfZiFnAFjVQYeEDunalymqWC a0quAc1BRL3SrK6XpYIggHt8xsdQZDN2l0mbymcGV0BZ5ek+hWA6sMQwF4X9DvXlnFNo p6llmacXFqy4q9AaaFoG8ZQL6qg5i3F2Du0sql9O15747Jqr5R3IB3dh55QHBumV5/zV GDv3EWiavs1SocrP5E2M7Ot8PfV1zlx0gCrUEzKxgjRV/3+AT4hqsg0k6UrBhDMz4hRG +0/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mvX97Tfq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x19si11764892otk.89.2020.02.04.14.13.47; Tue, 04 Feb 2020 14:13:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mvX97Tfq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727627AbgBDWMp (ORCPT + 99 others); Tue, 4 Feb 2020 17:12:45 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43186 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727612AbgBDWMp (ORCPT ); Tue, 4 Feb 2020 17:12:45 -0500 Received: by mail-pf1-f194.google.com with SMTP id s1so44330pfh.10 for ; Tue, 04 Feb 2020 14:12:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LJphzd4Uf85jJrjWhKW7N0t3rDrhEm6RJEDIyC2Wp+M=; b=mvX97Tfq4mMzpXUDFwBDvSHaJpQdGdWGprU6RSPFTeqOFWvaP9yMs0ykI/wg4BBnmn PoCAX3HBcsnBFzCr4gsesH4ApFy3w+j2kQvW20NSu3FxGvnClvuPCTxQ4T9DuW9QQyka 4Aumr3CkYWlSSuyWU+MJEH+IAaMQW4yPR5fGw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LJphzd4Uf85jJrjWhKW7N0t3rDrhEm6RJEDIyC2Wp+M=; b=FuogslKqjTSpMfPebBmxm/lud0rBesvOUqOs2mzDi1U1P83OXbn9S7Mu1mTG4hOGCW 8lw6owHzRRQ8veWyRn80eqQWWYhPOor9BtI9TZlDyLNPV45tBMnx1/2d8EK0U/weA8WH oZPb6/+s1/FHq8JtnhX56hFhkBk8m8hN8w2BbG9J7GxhUU/dezA/mkJfB5amqHKOoc3W khFAqgXbkSSEs4LKltyeKnXilszWwZZ6jMGyEHigRqnPnbZ6Qm5Ofu6f0fzQmQXr7IHc OCuR+QBpScol4EZlLW5bbtwuMXnjxsFmNg3d3rlev+qXc75JN4te12YPf0D68CsQraDO 6y8A== X-Gm-Message-State: APjAAAV00W5Xx0yeTDNhN/MF/ORlxDNIqLuHaPGeotTT6A5E+4LSyFvF Fb4YXgXTq0gXF+b5wMPboqnRFw== X-Received: by 2002:a63:ce03:: with SMTP id y3mr21880478pgf.427.1580854363613; Tue, 04 Feb 2020 14:12:43 -0800 (PST) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id q21sm25033209pff.105.2020.02.04.14.12.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2020 14:12:43 -0800 (PST) From: Douglas Anderson To: Daniel Thompson , Anatoly Pugachev Cc: sparclinux@vger.kernel.org, Douglas Anderson , Jason Wessel , Masahiro Yamada , Chuhong Yuan , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Dan Carpenter Subject: [PATCH] kdb: Fix compiling on architectures w/out DBG_MAX_REG_NUM defined Date: Tue, 4 Feb 2020 14:12:25 -0800 Message-Id: <20200204141219.1.Ief3f3a7edbbd76165901b14813e90381c290786d@changeid> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Douglas Anderson --- I don't have a sparc64 compiler but I'm pretty sure this should work. Testing appreciated. 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 static int kdb_rd(int argc, const char **argv) { int len = 0; @@ -1847,12 +1857,6 @@ static int kdb_rd(int argc, const char **argv) if (kdb_check_regs()) return 0; - /* Fallback to Linux showregs() if we don't have DBG_MAX_REG_NUM */ - if (DBG_MAX_REG_NUM <= 0) { - kdb_dumpregs(kdb_current_regs); - return 0; - } - for (i = 0; i < DBG_MAX_REG_NUM; i++) { rsize = dbg_reg_def[i].size * 2; if (rsize > 16) @@ -1896,6 +1900,7 @@ static int kdb_rd(int argc, const char **argv) return 0; } +#endif /* * kdb_rm - This function implements the 'rm' (register modify) command. -- 2.25.0.341.g760bfbb309-goog