Skip to content

Commit 996fe06

Browse files
committed
Merge tag 'kgdb-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/danielt/linux
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
2 parents 0bcfe68 + f8416aa commit 996fe06

10 files changed

Lines changed: 387 additions & 728 deletions

File tree

‎include/linux/kdb.h‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Copyright (C) 2009 Jason Wessel <jason.wessel@windriver.com>
1414
*/
1515

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

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

69+
/* The KDB shell command table */
70+
typedef struct _kdbtab {
71+
char *name; /* Command name */
72+
kdb_func_t func; /* Function to execute command */
73+
char *usage; /* Usage String for this command */
74+
char *help; /* Help message for this command */
75+
short minlen; /* Minimum legal # cmd chars required */
76+
kdb_cmdflags_t flags; /* Command behaviour flags */
77+
struct list_head list_node; /* Command list */
78+
} kdbtab_t;
79+
6780
#ifdef CONFIG_KGDB_KDB
6881
#include <linux/init.h>
6982
#include <linux/sched.h>
@@ -193,19 +206,13 @@ static inline const char *kdb_walk_kallsyms(loff_t *pos)
193206
#endif /* ! CONFIG_KALLSYMS */
194207

195208
/* Dynamic kdb shell command registration */
196-
extern int kdb_register(char *, kdb_func_t, char *, char *, short);
197-
extern int kdb_register_flags(char *, kdb_func_t, char *, char *,
198-
short, kdb_cmdflags_t);
199-
extern int kdb_unregister(char *);
209+
extern int kdb_register(kdbtab_t *cmd);
210+
extern void kdb_unregister(kdbtab_t *cmd);
200211
#else /* ! CONFIG_KGDB_KDB */
201212
static inline __printf(1, 2) int kdb_printf(const char *fmt, ...) { return 0; }
202213
static inline void kdb_init(int level) {}
203-
static inline int kdb_register(char *cmd, kdb_func_t func, char *usage,
204-
char *help, short minlen) { return 0; }
205-
static inline int kdb_register_flags(char *cmd, kdb_func_t func, char *usage,
206-
char *help, short minlen,
207-
kdb_cmdflags_t flags) { return 0; }
208-
static inline int kdb_unregister(char *cmd) { return 0; }
214+
static inline int kdb_register(kdbtab_t *cmd) { return 0; }
215+
static inline void kdb_unregister(kdbtab_t *cmd) {}
209216
#endif /* CONFIG_KGDB_KDB */
210217
enum {
211218
KDB_NOT_INITIALIZED,

‎kernel/debug/debug_core.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
12
/*
23
* Kernel Debug Core
34
*
@@ -22,10 +23,6 @@
2223
*
2324
* Original KGDB stub: David Grothe <dave@gcom.com>,
2425
* Tigran Aivazian <tigran@sco.com>
25-
*
26-
* This file is licensed under the terms of the GNU General Public License
27-
* version 2. This program is licensed "as is" without any warranty of any
28-
* kind, whether express or implied.
2926
*/
3027

3128
#define pr_fmt(fmt) "KGDB: " fmt

‎kernel/debug/gdbstub.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
12
/*
23
* Kernel Debug Core
34
*
@@ -22,10 +23,6 @@
2223
*
2324
* Original KGDB stub: David Grothe <dave@gcom.com>,
2425
* Tigran Aivazian <tigran@sco.com>
25-
*
26-
* This file is licensed under the terms of the GNU General Public License
27-
* version 2. This program is licensed "as is" without any warranty of any
28-
* kind, whether express or implied.
2926
*/
3027

3128
#include <linux/kernel.h>

‎kernel/debug/kdb/kdb_bp.c‎

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -523,51 +523,51 @@ static int kdb_ss(int argc, const char **argv)
523523
}
524524

525525
static kdbtab_t bptab[] = {
526-
{ .cmd_name = "bp",
527-
.cmd_func = kdb_bp,
528-
.cmd_usage = "[<vaddr>]",
529-
.cmd_help = "Set/Display breakpoints",
530-
.cmd_flags = KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS,
526+
{ .name = "bp",
527+
.func = kdb_bp,
528+
.usage = "[<vaddr>]",
529+
.help = "Set/Display breakpoints",
530+
.flags = KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS,
531531
},
532-
{ .cmd_name = "bl",
533-
.cmd_func = kdb_bp,
534-
.cmd_usage = "[<vaddr>]",
535-
.cmd_help = "Display breakpoints",
536-
.cmd_flags = KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS,
532+
{ .name = "bl",
533+
.func = kdb_bp,
534+
.usage = "[<vaddr>]",
535+
.help = "Display breakpoints",
536+
.flags = KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS,
537537
},
538-
{ .cmd_name = "bc",
539-
.cmd_func = kdb_bc,
540-
.cmd_usage = "<bpnum>",
541-
.cmd_help = "Clear Breakpoint",
542-
.cmd_flags = KDB_ENABLE_FLOW_CTRL,
538+
{ .name = "bc",
539+
.func = kdb_bc,
540+
.usage = "<bpnum>",
541+
.help = "Clear Breakpoint",
542+
.flags = KDB_ENABLE_FLOW_CTRL,
543543
},
544-
{ .cmd_name = "be",
545-
.cmd_func = kdb_bc,
546-
.cmd_usage = "<bpnum>",
547-
.cmd_help = "Enable Breakpoint",
548-
.cmd_flags = KDB_ENABLE_FLOW_CTRL,
544+
{ .name = "be",
545+
.func = kdb_bc,
546+
.usage = "<bpnum>",
547+
.help = "Enable Breakpoint",
548+
.flags = KDB_ENABLE_FLOW_CTRL,
549549
},
550-
{ .cmd_name = "bd",
551-
.cmd_func = kdb_bc,
552-
.cmd_usage = "<bpnum>",
553-
.cmd_help = "Disable Breakpoint",
554-
.cmd_flags = KDB_ENABLE_FLOW_CTRL,
550+
{ .name = "bd",
551+
.func = kdb_bc,
552+
.usage = "<bpnum>",
553+
.help = "Disable Breakpoint",
554+
.flags = KDB_ENABLE_FLOW_CTRL,
555555
},
556-
{ .cmd_name = "ss",
557-
.cmd_func = kdb_ss,
558-
.cmd_usage = "",
559-
.cmd_help = "Single Step",
560-
.cmd_minlen = 1,
561-
.cmd_flags = KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS,
556+
{ .name = "ss",
557+
.func = kdb_ss,
558+
.usage = "",
559+
.help = "Single Step",
560+
.minlen = 1,
561+
.flags = KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS,
562562
},
563563
};
564564

565565
static kdbtab_t bphcmd = {
566-
.cmd_name = "bph",
567-
.cmd_func = kdb_bp,
568-
.cmd_usage = "[<vaddr>]",
569-
.cmd_help = "[datar [length]|dataw [length]] Set hw brk",
570-
.cmd_flags = KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS,
566+
.name = "bph",
567+
.func = kdb_bp,
568+
.usage = "[<vaddr>]",
569+
.help = "[datar [length]|dataw [length]] Set hw brk",
570+
.flags = KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS,
571571
};
572572

573573
/* Initialize the breakpoint table and register breakpoint commands. */

‎kernel/debug/kdb/kdb_debugger.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ int kdb_stub(struct kgdb_state *ks)
140140
*/
141141
kdb_common_deinit_state();
142142
KDB_STATE_CLEAR(PAGER);
143-
kdbnearsym_cleanup();
144143
if (error == KDB_CMD_KGDB) {
145144
if (KDB_STATE(DOING_KGDB))
146145
KDB_STATE_CLEAR(DOING_KGDB);

0 commit comments

Comments
 (0)