ddb: constify command tables

ok jca@
This commit is contained in:
naddy 2022-04-14 19:47:10 +00:00
parent 6c525197b4
commit 3fe80b7fb1
14 changed files with 47 additions and 44 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: db_interface.c,v 1.27 2022/04/12 19:44:31 naddy Exp $ */
/* $OpenBSD: db_interface.c,v 1.28 2022/04/14 19:47:10 naddy Exp $ */
/* $NetBSD: db_interface.c,v 1.8 1999/10/12 17:08:57 jdolecek Exp $ */
/*
@ -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

View File

@ -1,4 +1,4 @@
/* $OpenBSD: db_interface.c,v 1.38 2022/04/12 19:44:31 naddy Exp $ */
/* $OpenBSD: db_interface.c,v 1.39 2022/04/14 19:47:10 naddy Exp $ */
/* $NetBSD: db_interface.c,v 1.1 2003/04/26 18:39:27 fvdl Exp $ */
/*
@ -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 },

View File

@ -1,4 +1,4 @@
/* $OpenBSD: db_interface.c,v 1.18 2022/04/12 19:44:31 naddy Exp $ */
/* $OpenBSD: db_interface.c,v 1.19 2022/04/14 19:47:10 naddy Exp $ */
/* $NetBSD: db_interface.c,v 1.34 2003/10/26 23:11:15 chris Exp $ */
/*
@ -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,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: db_interface.c,v 1.11 2022/04/12 19:44:31 naddy Exp $ */
/* $OpenBSD: db_interface.c,v 1.12 2022/04/14 19:47:11 naddy Exp $ */
/* $NetBSD: db_interface.c,v 1.34 2003/10/26 23:11:15 chris Exp $ */
/*
@ -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 },

View File

@ -1,4 +1,4 @@
/* $OpenBSD: db_interface.c,v 1.43 2022/04/12 19:44:31 naddy Exp $ */
/* $OpenBSD: db_interface.c,v 1.44 2022/04/14 19:47:11 naddy Exp $ */
/* $NetBSD: db_interface.c,v 1.22 1996/05/03 19:42:00 christos Exp $ */
/*
@ -314,7 +314,7 @@ db_ddbproc_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
#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 },

View File

@ -1,4 +1,4 @@
/* $OpenBSD: db_interface.c,v 1.27 2022/04/12 19:44:31 naddy Exp $ */
/* $OpenBSD: db_interface.c,v 1.28 2022/04/14 19:47:11 naddy Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@ -654,7 +654,7 @@ m88k_db_cpu_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
/* 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

View File

@ -1,4 +1,4 @@
/* $OpenBSD: db_machdep.c,v 1.58 2022/04/12 19:44:32 naddy Exp $ */
/* $OpenBSD: db_machdep.c,v 1.59 2022/04/14 19:47:11 naddy Exp $ */
/*
* Copyright (c) 1998-2003 Opsycon AB (www.opsycon.se)
@ -492,7 +492,7 @@ db_dump_tlb_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *m)
}
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

View File

@ -1,4 +1,4 @@
/* $OpenBSD: db_interface.c,v 1.9 2022/04/12 19:44:32 naddy Exp $ */
/* $OpenBSD: db_interface.c,v 1.10 2022/04/14 19:47:11 naddy Exp $ */
/* $NetBSD: db_interface.c,v 1.12 2001/07/22 11:29:46 wiz Exp $ */
/*
@ -221,7 +221,7 @@ db_cpuinfo_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
}
#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 },

View File

@ -1,4 +1,4 @@
/* $OpenBSD: db_interface.c,v 1.5 2022/04/12 19:44:32 naddy Exp $ */
/* $OpenBSD: db_interface.c,v 1.6 2022/04/14 19:47:11 naddy Exp $ */
/* $NetBSD: db_interface.c,v 1.12 2001/07/22 11:29:46 wiz Exp $ */
/*
@ -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 },

View File

@ -1,4 +1,4 @@
/* $OpenBSD: db_interface.c,v 1.7 2022/04/12 19:44:32 naddy Exp $ */
/* $OpenBSD: db_interface.c,v 1.8 2022/04/14 19:47:11 naddy Exp $ */
/*
* Copyright (c) 1996 Scott K. Stevens
@ -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 },

View File

@ -1,4 +1,4 @@
/* $OpenBSD: db_interface.c,v 1.14 2022/04/12 19:44:32 naddy Exp $ */
/* $OpenBSD: db_interface.c,v 1.15 2022/04/14 19:47:11 naddy Exp $ */
/* $NetBSD: db_interface.c,v 1.37 2006/09/06 00:11:49 uwe Exp $ */
/*-
@ -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 },

View File

@ -1,4 +1,4 @@
/* $OpenBSD: db_interface.c,v 1.57 2022/04/12 19:44:32 naddy Exp $ */
/* $OpenBSD: db_interface.c,v 1.58 2022/04/14 19:47:12 naddy Exp $ */
/* $NetBSD: db_interface.c,v 1.61 2001/07/31 06:55:47 eeh Exp $ */
/*
@ -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 },

View File

@ -1,4 +1,4 @@
/* $OpenBSD: db_command.c,v 1.93 2022/04/12 19:44:32 naddy Exp $ */
/* $OpenBSD: db_command.c,v 1.94 2022/04/14 19:47:12 naddy Exp $ */
/* $NetBSD: db_command.c,v 1.20 1996/03/30 22:30:05 christos Exp $ */
/*
@ -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, struct db_command **cmdp)
}
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_expr_t count, char *modif
* '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)

View File

@ -1,4 +1,4 @@
/* $OpenBSD: db_command.h,v 1.34 2022/04/12 19:44:32 naddy Exp $ */
/* $OpenBSD: db_command.h,v 1.35 2022/04/14 19:47:12 naddy Exp $ */
/* $NetBSD: db_command.h,v 1.8 1996/02/05 01:56:55 christos Exp $ */
/*
@ -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