Skip to content

Commit 916a759

Browse files
committed
Merge tag 'kgdb-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/danielt/linux
Pull kgdb updates from Daniel Thompson: "Exclusively tidy ups this cycle. Most of them are thanks to Sumit Garg and, as it happens, the clean ups do result in a slight increase in the line count. This is due to registering kdb commands using data structures rather than function calls which, in turn, simplifies the memory management during command registration. In addition to changes to command registration we also have some dead code removal, a clearer implementation of environment variable handling and a typo fix" * tag 'kgdb-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/danielt/linux: kdb: Refactor env variables get/set code kernel: debug: Ordinary typo fixes in the file gdbstub.c kdb: Simplify kdb commands registration kdb: Remove redundant function definitions/prototypes
2 parents 6daa755 + 83fa2d1 commit 916a759

File tree

5 files changed

+381
-309
lines changed

5 files changed

+381
-309
lines changed

kernel/debug/gdbstub.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ int kgdb_hex2long(char **ptr, unsigned long *long_val)
321321
/*
322322
* Copy the binary array pointed to by buf into mem. Fix $, #, and
323323
* 0x7d escaped with 0x7d. Return -EFAULT on failure or 0 on success.
324-
* The input buf is overwitten with the result to write to mem.
324+
* The input buf is overwritten with the result to write to mem.
325325
*/
326326
static int kgdb_ebin2mem(char *buf, char *mem, int count)
327327
{
@@ -952,7 +952,7 @@ static int gdb_cmd_exception_pass(struct kgdb_state *ks)
952952
}
953953

954954
/*
955-
* This function performs all gdbserial command procesing
955+
* This function performs all gdbserial command processing
956956
*/
957957
int gdb_serial_stub(struct kgdb_state *ks)
958958
{

kernel/debug/kdb/kdb_bp.c

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,54 @@ static int kdb_ss(int argc, const char **argv)
522522
return KDB_CMD_SS;
523523
}
524524

525+
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,
531+
},
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,
537+
},
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,
543+
},
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,
549+
},
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,
555+
},
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,
562+
},
563+
};
564+
565+
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,
571+
};
572+
525573
/* Initialize the breakpoint table and register breakpoint commands. */
526574

527575
void __init kdb_initbptab(void)
@@ -537,30 +585,7 @@ void __init kdb_initbptab(void)
537585
for (i = 0, bp = kdb_breakpoints; i < KDB_MAXBPT; i++, bp++)
538586
bp->bp_free = 1;
539587

540-
kdb_register_flags("bp", kdb_bp, "[<vaddr>]",
541-
"Set/Display breakpoints", 0,
542-
KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS);
543-
kdb_register_flags("bl", kdb_bp, "[<vaddr>]",
544-
"Display breakpoints", 0,
545-
KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS);
588+
kdb_register_table(bptab, ARRAY_SIZE(bptab));
546589
if (arch_kgdb_ops.flags & KGDB_HW_BREAKPOINT)
547-
kdb_register_flags("bph", kdb_bp, "[<vaddr>]",
548-
"[datar [length]|dataw [length]] Set hw brk", 0,
549-
KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS);
550-
kdb_register_flags("bc", kdb_bc, "<bpnum>",
551-
"Clear Breakpoint", 0,
552-
KDB_ENABLE_FLOW_CTRL);
553-
kdb_register_flags("be", kdb_bc, "<bpnum>",
554-
"Enable Breakpoint", 0,
555-
KDB_ENABLE_FLOW_CTRL);
556-
kdb_register_flags("bd", kdb_bc, "<bpnum>",
557-
"Disable Breakpoint", 0,
558-
KDB_ENABLE_FLOW_CTRL);
559-
560-
kdb_register_flags("ss", kdb_ss, "",
561-
"Single Step", 1,
562-
KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS);
563-
/*
564-
* Architecture dependent initialization.
565-
*/
590+
kdb_register_table(&bphcmd, 1);
566591
}

0 commit comments

Comments
 (0)