Christian Weisgerber:

> This will allow constifying the ddb command tables in a subsequent
> step.

And here's that boring follow-up diff.


M  sys/arch/alpha/alpha/db_interface.c
M  sys/arch/amd64/amd64/db_interface.c
M  sys/arch/arm/arm/db_interface.c
M  sys/arch/arm64/arm64/db_interface.c
M  sys/arch/i386/i386/db_interface.c
M  sys/arch/m88k/m88k/db_interface.c
M  sys/arch/mips64/mips64/db_machdep.c
M  sys/arch/powerpc/ddb/db_interface.c
M  sys/arch/powerpc64/powerpc64/db_interface.c
M  sys/arch/riscv64/riscv64/db_interface.c
M  sys/arch/sh/sh/db_interface.c
M  sys/arch/sparc64/sparc64/db_interface.c
M  sys/ddb/db_command.c
M  sys/ddb/db_command.h

diff c5fcb00219e59f5bbd0cb5171af7fe5d01f0a0c3 
6e95eec92a4f984cd0aff5dd99dd725920c1f1b6
blob - 7e9ce6cc9803586260886d5c16ff2e1219cc2c77
blob + 3f5056966aa3b44d3d4cdc1113256fc05c528026
--- sys/arch/alpha/alpha/db_interface.c
+++ sys/arch/alpha/alpha/db_interface.c
@@ -85,7 +85,7 @@ db_regs_t ddb_regs;
 void   db_mach_cpu(db_expr_t, int, db_expr_t, char *);
 #endif
 
-struct db_command db_machine_command_table[] = {
+const struct db_command db_machine_command_table[] = {
 #if defined(MULTIPROCESSOR)
        { "ddbcpu",     db_mach_cpu,    0,      NULL },
 #endif
blob - b12b9c48cf147c1525c19e11fac84b35b02bc19f
blob + bd57af87e871b65736c5f4afa8c4f3f98b9bef5c
--- sys/arch/amd64/amd64/db_interface.c
+++ sys/arch/amd64/amd64/db_interface.c
@@ -394,7 +394,7 @@ x86_ipi_db(struct cpu_info *ci)
 #endif /* MULTIPROCESSOR */
 
 #if NACPI > 0
-struct db_command db_acpi_cmds[] = {
+const struct db_command db_acpi_cmds[] = {
        { "disasm",     db_acpi_disasm,         CS_OWN, NULL },
        { "showval",    db_acpi_showval,        CS_OWN, NULL },
        { "tree",       db_acpi_tree,           0,      NULL },
@@ -403,7 +403,7 @@ struct db_command db_acpi_cmds[] = {
 };
 #endif /* NACPI > 0 */
 
-struct db_command db_machine_command_table[] = {
+const struct db_command db_machine_command_table[] = {
 #ifdef MULTIPROCESSOR
        { "cpuinfo",    db_cpuinfo_cmd,         0,      0 },
        { "startcpu",   db_startproc_cmd,       0,      0 },
blob - 719da88249590509dabb734794daedc7c2a3dd61
blob + bcc0cad7ce3f7c7c180b99d7aaa43b9d6c554738
--- sys/arch/arm/arm/db_interface.c
+++ sys/arch/arm/arm/db_interface.c
@@ -340,7 +340,7 @@ db_enter(void)
        asm(".word      0xe7ffffff");
 }
 
-struct db_command db_machine_command_table[] = {
+const struct db_command db_machine_command_table[] = {
        { "frame",      db_show_frame_cmd,      0, NULL },
 #ifdef ARM32_DB_COMMANDS
        ARM32_DB_COMMANDS,
blob - 1645b49186bed36130ffd73a933e45f8f9fc5e18
blob + cb7ecd25005541d590f94cf07152154d3340ade5
--- sys/arch/arm64/arm64/db_interface.c
+++ sys/arch/arm64/arm64/db_interface.c
@@ -469,7 +469,7 @@ db_stopcpu(int cpu)
 }
 #endif
 
-struct db_command db_machine_command_table[] = {
+const struct db_command db_machine_command_table[] = {
 #ifdef MULTIPROCESSOR
        { "cpuinfo",    db_cpuinfo_cmd,         0,      NULL },
        { "startcpu",   db_startproc_cmd,       0,      NULL },
blob - 1807bc890744e4f32ef839e73e5647fd5488b901
blob + be2562e3a816dc0d8579275de6fc373458f5fb3e
--- sys/arch/i386/i386/db_interface.c
+++ sys/arch/i386/i386/db_interface.c
@@ -314,7 +314,7 @@ db_ddbproc_cmd(db_expr_t addr, int have_addr, db_expr_
 #endif /* MULTIPROCESSOR */
 
 #if NACPI > 0
-struct db_command db_acpi_cmds[] = {
+const struct db_command db_acpi_cmds[] = {
        { "disasm",     db_acpi_disasm,         CS_OWN, NULL },
        { "showval",    db_acpi_showval,        CS_OWN, NULL },
        { "tree",       db_acpi_tree,           0,      NULL },
@@ -323,7 +323,7 @@ struct db_command db_acpi_cmds[] = {
 };
 #endif /* NACPI > 0 */
 
-struct db_command db_machine_command_table[] = {
+const struct db_command db_machine_command_table[] = {
        { "sysregs",    db_sysregs_cmd,         0,      0 },
 #ifdef MULTIPROCESSOR
        { "cpuinfo",    db_cpuinfo_cmd,         0,      0 },
blob - 55d5e5ba78719c954c4d6d1f5ffa9083e941a932
blob + eab0352da587873642a701debbbc0c00e8f19052
--- sys/arch/m88k/m88k/db_interface.c
+++ sys/arch/m88k/m88k/db_interface.c
@@ -654,7 +654,7 @@ m88k_db_cpu_cmd(db_expr_t addr, int have_addr, db_expr
 /* COMMAND TABLE / INIT */
 /************************/
 
-struct db_command db_machine_command_table[] = {
+const struct db_command db_machine_command_table[] = {
 #ifdef MULTIPROCESSOR
        { "ddbcpu",     m88k_db_cpu_cmd,        0,      NULL },
 #endif
blob - 2c7d67c597c2a237420af198985aaa20781f124e
blob + b5f2651c9dccdc3281ea43496bc68a8a86a73d26
--- sys/arch/mips64/mips64/db_machdep.c
+++ sys/arch/mips64/mips64/db_machdep.c
@@ -492,7 +492,7 @@ db_dump_tlb_cmd(db_expr_t addr, int have_addr, db_expr
 }
 
 
-struct db_command db_machine_command_table[] = {
+const struct db_command db_machine_command_table[] = {
        { "tlb",        db_dump_tlb_cmd,        0,      NULL },
        { "trap",       db_trap_trace_cmd,      0,      NULL },
 #ifdef MULTIPROCESSOR
blob - 079c4056ecd8ec4a4cf499410bd6c24d3d9d569c
blob + 3ffcf6f67fad0db57c353c8ce4f8f1af4fc20d7f
--- sys/arch/powerpc/ddb/db_interface.c
+++ sys/arch/powerpc/ddb/db_interface.c
@@ -221,7 +221,7 @@ db_cpuinfo_cmd(db_expr_t addr, int have_addr, db_expr_
 }
 #endif
 
-struct db_command db_machine_command_table[] = {
+const struct db_command db_machine_command_table[] = {
 #ifdef MULTIPROCESSOR
        { "cpuinfo",    db_cpuinfo_cmd,         0,      NULL },
        { "startcpu",   db_startproc_cmd,       0,      NULL },
blob - 7c4f03640bf86fb5afea3c109554805d59806c8d
blob + 77baa1319a633d0cf8e9c483c67241ed1dd71319
--- sys/arch/powerpc64/powerpc64/db_interface.c
+++ sys/arch/powerpc64/powerpc64/db_interface.c
@@ -67,7 +67,7 @@ int db_enter_ddb(void);
 
 #endif
 
-struct db_command db_machine_command_table[] = {
+const struct db_command db_machine_command_table[] = {
 #ifdef MULTIPROCESSOR
        { "cpuinfo",    db_cpuinfo_cmd,         0,      NULL },
        { "startcpu",   db_startproc_cmd,       0,      NULL },
blob - 958d60076a78906b70a859f48f577f8c9bae72da
blob + d4703723f3ee75300374aa69d94e493cb4452ec1
--- sys/arch/riscv64/riscv64/db_interface.c
+++ sys/arch/riscv64/riscv64/db_interface.c
@@ -414,7 +414,7 @@ db_stopcpu(int cpu)
 }
 #endif
 
-struct db_command db_machine_command_table[] = {
+const struct db_command db_machine_command_table[] = {
 #ifdef MULTIPROCESSOR
        { "cpuinfo",    db_cpuinfo_cmd,         0,      NULL },
        { "startcpu",   db_startproc_cmd,       0,      NULL },
blob - 4ff8543e198e66fe4dedcab0f649939815e610fd
blob + 130fefba08a49f383ea19621ef96bc6d5ffa6770
--- sys/arch/sh/sh/db_interface.c
+++ sys/arch/sh/sh/db_interface.c
@@ -73,7 +73,7 @@ void db_frame_cmd(db_expr_t, int, db_expr_t, char *);
 void __db_print_symbol(db_expr_t);
 char *__db_procname_by_asid(int);
 
-struct db_command db_machine_command_table[] = {
+const struct db_command db_machine_command_table[] = {
        { "tlb",        db_tlbdump_cmd,         0,      NULL },
        { "cache",      db_cachedump_cmd,       0,      NULL },
        { "frame",      db_frame_cmd,           0,      NULL },
blob - ebc6e20f0a8327c2b8fc3128a030460d4ecc9e8b
blob + 792b2e1d1462a8e030c29cc7b7b91583af3fd9f0
--- sys/arch/sparc64/sparc64/db_interface.c
+++ sys/arch/sparc64/sparc64/db_interface.c
@@ -1167,7 +1167,7 @@ db_register_xir(void (*fun)(void *, int), void *arg)
 extern void db_esp(db_expr_t, int, db_expr_t, char *);
 #endif
 
-struct db_command db_machine_command_table[] = {
+const struct db_command db_machine_command_table[] = {
        { "ctx",        db_ctx_cmd,     0,      0 },
        { "dtlb",       db_dump_dtlb,   0,      0 },
        { "dtsb",       db_dump_dtsb,   0,      0 },
blob - 98c629cc808f62fcec89478bc9a2819bdb5804dc
blob + 7dcb85644b6a3d1ad61991cf086e1a58f58f5d8d
--- sys/ddb/db_command.c
+++ sys/ddb/db_command.c
@@ -79,8 +79,9 @@ vaddr_t               db_prev;        /* last address examined
 vaddr_t                db_next;        /* next address to be examined
                                   or written */
 
-int    db_cmd_search(char *, struct db_command *, struct db_command **);
-void   db_cmd_list(struct db_command *);
+int    db_cmd_search(char *, const struct db_command *,
+           const struct db_command **);
+void   db_cmd_list(const struct db_command *);
 void   db_ctf_pprint_cmd(db_expr_t, int, db_expr_t,char *);
 void   db_map_print_cmd(db_expr_t, int, db_expr_t, char *);
 void   db_buf_print_cmd(db_expr_t, int, db_expr_t, char *);
@@ -146,9 +147,10 @@ db_skip_to_eol(void)
  * Search for command prefix.
  */
 int
-db_cmd_search(char *name, struct db_command *table, struct db_command **cmdp)
+db_cmd_search(char *name, const struct db_command *table,
+    const struct db_command **cmdp)
 {
-       struct db_command       *cmd;
+       const struct db_command *cmd;
        int                     result = CMD_NONE;
 
        for (cmd = table; cmd->name != 0; cmd++) {
@@ -180,9 +182,9 @@ db_cmd_search(char *name, struct db_command *table, st
 }
 
 void
-db_cmd_list(struct db_command *table)
+db_cmd_list(const struct db_command *table)
 {
-       struct db_command *cmd;
+       const struct db_command *cmd;
 
        for (cmd = table; cmd->name != 0; cmd++) {
                db_printf("%-12s", cmd->name);
@@ -191,9 +193,10 @@ db_cmd_list(struct db_command *table)
 }
 
 void
-db_command(struct db_command **last_cmdp, struct db_command *cmd_table)
+db_command(const struct db_command **last_cmdp,
+    const struct db_command *cmd_table)
 {
-       struct db_command       *cmd;
+       const struct db_command *cmd;
        char            modif[TOK_STRING_SIZE];
        db_expr_t       addr, count;
        int             t, result, have_addr = 0;
@@ -558,7 +561,7 @@ db_bcstats_print_cmd(db_expr_t addr, int have_addr, db
  * 'show' commands
  */
 
-struct db_command db_show_all_cmds[] = {
+const struct db_command db_show_all_cmds[] = {
        { "procs",      db_show_all_procs,      0, NULL },
        { "callout",    db_show_callout,        0, NULL },
        { "pools",      db_show_all_pools,      0, NULL },
@@ -578,7 +581,7 @@ struct db_command db_show_all_cmds[] = {
        { NULL,         NULL,                   0, NULL }
 };
 
-struct db_command db_show_cmds[] = {
+const struct db_command db_show_cmds[] = {
        { "all",        NULL,                   0,      db_show_all_cmds },
        { "bcstats",    db_bcstats_print_cmd,   0,      NULL },
        { "breaks",     db_listbreak_cmd,       0,      NULL },
@@ -615,7 +618,7 @@ struct db_command db_show_cmds[] = {
        { NULL,         NULL,                   0,      NULL }
 };
 
-struct db_command db_boot_cmds[] = {
+const struct db_command db_boot_cmds[] = {
        { "sync",       db_boot_sync_cmd,       0,      0 },
        { "crash",      db_boot_crash_cmd,      0,      0 },
        { "dump",       db_boot_dump_cmd,       0,      0 },
@@ -625,7 +628,7 @@ struct db_command db_boot_cmds[] = {
        { NULL, }
 };
 
-struct db_command db_command_table[] = {
+const struct db_command db_command_table[] = {
 #ifdef DB_MACHINE_COMMANDS
   /* this must be the first entry, if it exists */
        { "machine",    NULL,                   0, db_machine_command_table },
@@ -666,7 +669,7 @@ struct db_command db_command_table[] = {
        { NULL,         NULL,                   0,              NULL }
 };
 
-struct db_command      *db_last_command = NULL;
+const struct db_command        *db_last_command = NULL;
 
 void
 db_help_cmd(db_expr_t addr, int haddr, db_expr_t count, char *modif)
blob - 41bb4e3a7027ef12efe426b8bd9bfcebaea6e47d
blob + d897a3a6b5f29c8547aae90984183d157dc9f9fd
--- sys/ddb/db_command.h
+++ sys/ddb/db_command.h
@@ -38,7 +38,7 @@ struct db_command;
 void db_error(char *);
 void db_skip_to_eol(void);
 void db_command_loop(void);
-void db_command(struct db_command **, struct db_command *);
+void db_command(const struct db_command **, const struct db_command *);
 
 extern vaddr_t db_dot, db_last_addr, db_prev, db_next;
 
@@ -54,9 +54,9 @@ struct db_command {
 #define        CS_MORE         0x2             /* standard syntax, but may 
have other
                                           words at end */
 #define        CS_SET_DOT      0x100           /* set dot after command */
-       struct db_command *more;        /* another level of command */
+       const struct db_command *more;  /* another level of command */
 };
 
 #ifdef DB_MACHINE_COMMANDS
-extern struct db_command db_machine_command_table[];
+extern const struct db_command db_machine_command_table[];
 #endif

-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to