Commit 996fe061 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull kgdb updates from Daniel Thompson:
 "Changes for kgdb/kdb this cycle are dominated by a change from Sumit
  that removes as small (256K) private heap from kdb. This is change
  I've hoped for ever since I discovered how few users of this heap
  remained in the kernel, so many thanks to Sumit for hunting these
  down.

  The other change is an incremental step towards SPDX headers"

* tag 'kgdb-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/danielt/linux:
  kernel: debug: Convert to SPDX identifier
  kdb: Rename members of struct kdbtab_t
  kdb: Simplify kdb_defcmd macro logic
  kdb: Get rid of redundant kdb_register_flags()
  kdb: Rename struct defcmd_set to struct kdb_macro
  kdb: Get rid of custom debug heap allocator
parents 0bcfe68b f8416aa2
Loading
Loading
Loading
Loading
+17 −10
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@
 * Copyright (C) 2009 Jason Wessel <jason.wessel@windriver.com>
 */

#include <linux/list.h>

/* Shifted versions of the command enable bits are be used if the command
 * has no arguments (see kdb_check_flags). This allows commands, such as
 * go, to have different permissions depending upon whether it is called
@@ -64,6 +66,17 @@ typedef enum {

typedef int (*kdb_func_t)(int, const char **);

/* The KDB shell command table */
typedef struct _kdbtab {
	char    *name;			/* Command name */
	kdb_func_t func;		/* Function to execute command */
	char    *usage;			/* Usage String for this command */
	char    *help;			/* Help message for this command */
	short    minlen;		/* Minimum legal # cmd chars required */
	kdb_cmdflags_t flags;		/* Command behaviour flags */
	struct list_head list_node;	/* Command list */
} kdbtab_t;

#ifdef	CONFIG_KGDB_KDB
#include <linux/init.h>
#include <linux/sched.h>
@@ -193,19 +206,13 @@ static inline const char *kdb_walk_kallsyms(loff_t *pos)
#endif /* ! CONFIG_KALLSYMS */

/* Dynamic kdb shell command registration */
extern int kdb_register(char *, kdb_func_t, char *, char *, short);
extern int kdb_register_flags(char *, kdb_func_t, char *, char *,
			      short, kdb_cmdflags_t);
extern int kdb_unregister(char *);
extern int kdb_register(kdbtab_t *cmd);
extern void kdb_unregister(kdbtab_t *cmd);
#else /* ! CONFIG_KGDB_KDB */
static inline __printf(1, 2) int kdb_printf(const char *fmt, ...) { return 0; }
static inline void kdb_init(int level) {}
static inline int kdb_register(char *cmd, kdb_func_t func, char *usage,
			       char *help, short minlen) { return 0; }
static inline int kdb_register_flags(char *cmd, kdb_func_t func, char *usage,
				     char *help, short minlen,
				     kdb_cmdflags_t flags) { return 0; }
static inline int kdb_unregister(char *cmd) { return 0; }
static inline int kdb_register(kdbtab_t *cmd) { return 0; }
static inline void kdb_unregister(kdbtab_t *cmd) {}
#endif	/* CONFIG_KGDB_KDB */
enum {
	KDB_NOT_INITIALIZED,
+1 −4
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Kernel Debug Core
 *
@@ -22,10 +23,6 @@
 *
 * Original KGDB stub: David Grothe <dave@gcom.com>,
 * Tigran Aivazian <tigran@sco.com>
 *
 * This file is licensed under the terms of the GNU General Public License
 * version 2. This program is licensed "as is" without any warranty of any
 * kind, whether express or implied.
 */

#define pr_fmt(fmt) "KGDB: " fmt
+1 −4
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Kernel Debug Core
 *
@@ -22,10 +23,6 @@
 *
 * Original KGDB stub: David Grothe <dave@gcom.com>,
 * Tigran Aivazian <tigran@sco.com>
 *
 * This file is licensed under the terms of the GNU General Public License
 * version 2. This program is licensed "as is" without any warranty of any
 * kind, whether express or implied.
 */

#include <linux/kernel.h>
+36 −36
Original line number Diff line number Diff line
@@ -523,51 +523,51 @@ static int kdb_ss(int argc, const char **argv)
}

static kdbtab_t bptab[] = {
	{	.cmd_name = "bp",
		.cmd_func = kdb_bp,
		.cmd_usage = "[<vaddr>]",
		.cmd_help = "Set/Display breakpoints",
		.cmd_flags = KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS,
	{	.name = "bp",
		.func = kdb_bp,
		.usage = "[<vaddr>]",
		.help = "Set/Display breakpoints",
		.flags = KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS,
	},
	{	.cmd_name = "bl",
		.cmd_func = kdb_bp,
		.cmd_usage = "[<vaddr>]",
		.cmd_help = "Display breakpoints",
		.cmd_flags = KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS,
	{	.name = "bl",
		.func = kdb_bp,
		.usage = "[<vaddr>]",
		.help = "Display breakpoints",
		.flags = KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS,
	},
	{	.cmd_name = "bc",
		.cmd_func = kdb_bc,
		.cmd_usage = "<bpnum>",
		.cmd_help = "Clear Breakpoint",
		.cmd_flags = KDB_ENABLE_FLOW_CTRL,
	{	.name = "bc",
		.func = kdb_bc,
		.usage = "<bpnum>",
		.help = "Clear Breakpoint",
		.flags = KDB_ENABLE_FLOW_CTRL,
	},
	{	.cmd_name = "be",
		.cmd_func = kdb_bc,
		.cmd_usage = "<bpnum>",
		.cmd_help = "Enable Breakpoint",
		.cmd_flags = KDB_ENABLE_FLOW_CTRL,
	{	.name = "be",
		.func = kdb_bc,
		.usage = "<bpnum>",
		.help = "Enable Breakpoint",
		.flags = KDB_ENABLE_FLOW_CTRL,
	},
	{	.cmd_name = "bd",
		.cmd_func = kdb_bc,
		.cmd_usage = "<bpnum>",
		.cmd_help = "Disable Breakpoint",
		.cmd_flags = KDB_ENABLE_FLOW_CTRL,
	{	.name = "bd",
		.func = kdb_bc,
		.usage = "<bpnum>",
		.help = "Disable Breakpoint",
		.flags = KDB_ENABLE_FLOW_CTRL,
	},
	{	.cmd_name = "ss",
		.cmd_func = kdb_ss,
		.cmd_usage = "",
		.cmd_help = "Single Step",
		.cmd_minlen = 1,
		.cmd_flags = KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS,
	{	.name = "ss",
		.func = kdb_ss,
		.usage = "",
		.help = "Single Step",
		.minlen = 1,
		.flags = KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS,
	},
};

static kdbtab_t bphcmd = {
	.cmd_name = "bph",
	.cmd_func = kdb_bp,
	.cmd_usage = "[<vaddr>]",
	.cmd_help = "[datar [length]|dataw [length]]   Set hw brk",
	.cmd_flags = KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS,
	.name = "bph",
	.func = kdb_bp,
	.usage = "[<vaddr>]",
	.help = "[datar [length]|dataw [length]]   Set hw brk",
	.flags = KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS,
};

/* Initialize the breakpoint table and register	breakpoint commands. */
+0 −1
Original line number Diff line number Diff line
@@ -140,7 +140,6 @@ int kdb_stub(struct kgdb_state *ks)
	 */
	kdb_common_deinit_state();
	KDB_STATE_CLEAR(PAGER);
	kdbnearsym_cleanup();
	if (error == KDB_CMD_KGDB) {
		if (KDB_STATE(DOING_KGDB))
			KDB_STATE_CLEAR(DOING_KGDB);
Loading