mirror of
https://github.com/openbsd/src.git
synced 2024-12-21 23:18:00 -08:00
Constify strings in symbol-related ddb interfaces, and make the iterator
callback interface a bit simpler. ok beck@ claudio@ mpi@
This commit is contained in:
parent
3a9fd06ccc
commit
949c1c4ec8
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_interface.c,v 1.29 2024/02/23 18:19:02 cheloha Exp $ */
|
||||
/* $OpenBSD: db_interface.c,v 1.30 2024/11/07 16:02:29 miod Exp $ */
|
||||
/* $NetBSD: db_interface.c,v 1.8 1999/10/12 17:08:57 jdolecek Exp $ */
|
||||
|
||||
/*
|
||||
@ -459,7 +459,7 @@ int
|
||||
db_valid_breakpoint(addr)
|
||||
vaddr_t addr;
|
||||
{
|
||||
char *name;
|
||||
const char *name;
|
||||
db_expr_t offset;
|
||||
|
||||
db_find_sym_and_offset(addr, &name, &offset);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_trace.c,v 1.23 2019/11/07 14:44:52 mpi Exp $ */
|
||||
/* $OpenBSD: db_trace.c,v 1.24 2024/11/07 16:02:29 miod Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
|
||||
@ -172,7 +172,7 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
|
||||
int i, framesize;
|
||||
vaddr_t pc, ra;
|
||||
u_int inst;
|
||||
char *name;
|
||||
const char *name;
|
||||
db_expr_t offset;
|
||||
db_regs_t *regs;
|
||||
u_long *slot[32];
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_trace.c,v 1.55 2023/04/26 16:53:58 claudio Exp $ */
|
||||
/* $OpenBSD: db_trace.c,v 1.56 2024/11/07 16:02:29 miod Exp $ */
|
||||
/* $NetBSD: db_trace.c,v 1.1 2003/04/26 18:39:27 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
@ -139,7 +139,7 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
|
||||
while (count && frame != 0) {
|
||||
int narg;
|
||||
unsigned int i;
|
||||
char * name;
|
||||
const char * name;
|
||||
db_expr_t offset;
|
||||
Elf_Sym * sym;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_trace.c,v 1.16 2024/03/12 13:32:53 kettenis Exp $ */
|
||||
/* $OpenBSD: db_trace.c,v 1.17 2024/11/07 16:02:29 miod Exp $ */
|
||||
/* $NetBSD: db_trace.c,v 1.8 2003/01/17 22:28:48 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
@ -57,7 +57,7 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
|
||||
char c, *cp = modif;
|
||||
db_expr_t offset;
|
||||
Elf_Sym * sym;
|
||||
char *name;
|
||||
const char *name;
|
||||
int kernel_only = 1;
|
||||
int trace_thread = 0;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_interface.c,v 1.50 2024/02/23 18:19:03 cheloha Exp $ */
|
||||
/* $OpenBSD: db_interface.c,v 1.51 2024/11/07 16:02:29 miod Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2003 Michael Shalayeff
|
||||
@ -231,7 +231,7 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
|
||||
register_t *fp, pc, rp, *argp;
|
||||
Elf_Sym *sym;
|
||||
db_expr_t off;
|
||||
char *name;
|
||||
const char *name;
|
||||
int nargs;
|
||||
|
||||
if (count < 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_trace.c,v 1.45 2024/06/07 10:14:29 jsg Exp $ */
|
||||
/* $OpenBSD: db_trace.c,v 1.46 2024/11/07 16:02:29 miod Exp $ */
|
||||
/* $NetBSD: db_trace.c,v 1.18 1996/05/03 19:42:01 christos Exp $ */
|
||||
|
||||
/*
|
||||
@ -155,7 +155,7 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
|
||||
lastframe = 0;
|
||||
while (count && frame != 0) {
|
||||
int narg;
|
||||
char * name;
|
||||
const char * name;
|
||||
db_expr_t offset;
|
||||
Elf_Sym *sym;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_interface.c,v 1.31 2024/10/23 07:41:44 mpi Exp $ */
|
||||
/* $OpenBSD: db_interface.c,v 1.32 2024/11/07 16:02:29 miod Exp $ */
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1993-1991 Carnegie Mellon University
|
||||
@ -173,7 +173,7 @@ m88k_db_print_frame(addr, have_addr, count, modif)
|
||||
char *modif;
|
||||
{
|
||||
struct trapframe *s = (struct trapframe *)addr;
|
||||
char *name;
|
||||
const char *name;
|
||||
db_expr_t offset;
|
||||
#ifdef M88100
|
||||
int suppress1 = 0, suppress2 = 0;
|
||||
@ -553,7 +553,7 @@ m88k_db_where(addr, have_addr, count, modif)
|
||||
db_expr_t count;
|
||||
char *modif;
|
||||
{
|
||||
char *name;
|
||||
const char *name;
|
||||
db_expr_t offset;
|
||||
vaddr_t l;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_trace.c,v 1.20 2024/06/26 01:40:49 jsg Exp $ */
|
||||
/* $OpenBSD: db_trace.c,v 1.21 2024/11/07 16:02:29 miod Exp $ */
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1993-1991 Carnegie Mellon University
|
||||
@ -481,7 +481,7 @@ stack_decode(vaddr_t addr, vaddr_t *stack, int (*pr)(const char *, ...))
|
||||
* look back in memory for a prologue pattern.
|
||||
*/
|
||||
if (proc != NULL) {
|
||||
char *names = NULL;
|
||||
const char *names = NULL;
|
||||
db_symbol_values(proc, &names, &function_addr);
|
||||
if (names == NULL)
|
||||
return 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: trap.c,v 1.173 2024/10/16 18:40:52 miod Exp $ */
|
||||
/* $OpenBSD: trap.c,v 1.174 2024/11/07 16:02:29 miod Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -1128,7 +1128,7 @@ stacktrace_subr(struct trapframe *regs, int count,
|
||||
#ifdef DDB
|
||||
db_expr_t diff;
|
||||
Elf_Sym *sym;
|
||||
char *symname;
|
||||
const char *symname;
|
||||
#endif
|
||||
|
||||
/* get initial values from the exception frame */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_disasm.c,v 1.21 2024/05/22 05:51:49 jsg Exp $ */
|
||||
/* $OpenBSD: db_disasm.c,v 1.22 2024/11/07 16:02:29 miod Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1996, 2001, 2003 Dale Rahn. All rights reserved.
|
||||
*
|
||||
@ -568,7 +568,7 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt,
|
||||
int i;
|
||||
char *pfmt = *ppfmt;
|
||||
enum opf opf;
|
||||
char *name;
|
||||
const char *name;
|
||||
db_expr_t offset;
|
||||
|
||||
/* find field */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_trace.c,v 1.20 2023/04/26 16:53:59 claudio Exp $ */
|
||||
/* $OpenBSD: db_trace.c,v 1.21 2024/11/07 16:02:29 miod Exp $ */
|
||||
/* $NetBSD: db_trace.c,v 1.15 1996/02/22 23:23:41 gwr Exp $ */
|
||||
|
||||
/*
|
||||
@ -136,7 +136,7 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
|
||||
vaddr_t lr, sp, lastsp, *db_fp_args;
|
||||
db_expr_t offset;
|
||||
Elf_Sym *sym;
|
||||
char *name;
|
||||
const char *name;
|
||||
char c, *cp = modif;
|
||||
int i, narg, trace_proc = 0;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: trap.c,v 1.134 2024/01/11 19:16:27 miod Exp $ */
|
||||
/* $OpenBSD: trap.c,v 1.135 2024/11/07 16:02:29 miod Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */
|
||||
|
||||
/*
|
||||
@ -231,7 +231,7 @@ trap(struct trapframe *frame)
|
||||
struct proc *p = curproc;
|
||||
int type = frame->exc;
|
||||
union sigval sv;
|
||||
char *name;
|
||||
const char *name;
|
||||
db_expr_t offset;
|
||||
faultbuf *fb;
|
||||
struct vm_map *map;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_disasm.c,v 1.4 2024/05/22 05:51:49 jsg Exp $ */
|
||||
/* $OpenBSD: db_disasm.c,v 1.5 2024/11/07 16:02:29 miod Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1996, 2001, 2003 Dale Rahn. All rights reserved.
|
||||
*
|
||||
@ -568,7 +568,7 @@ disasm_process_field(u_int32_t addr, instr_t instr, char **ppfmt,
|
||||
int i;
|
||||
char *pfmt = *ppfmt;
|
||||
enum opf opf;
|
||||
char *name;
|
||||
const char *name;
|
||||
db_expr_t offset;
|
||||
|
||||
/* find field */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_trace.c,v 1.9 2023/04/26 16:53:59 claudio Exp $ */
|
||||
/* $OpenBSD: db_trace.c,v 1.10 2024/11/07 16:02:29 miod Exp $ */
|
||||
/* $NetBSD: db_trace.c,v 1.15 1996/02/22 23:23:41 gwr Exp $ */
|
||||
|
||||
/*
|
||||
@ -98,7 +98,7 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
|
||||
{
|
||||
vaddr_t callpc, lr, sp, lastsp;
|
||||
db_expr_t offset;
|
||||
char *name;
|
||||
const char *name;
|
||||
char c, *cp = modif;
|
||||
Elf_Sym *sym;
|
||||
int has_frame, trace_proc = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_trace.c,v 1.6 2024/10/17 01:57:18 jsg Exp $ */
|
||||
/* $OpenBSD: db_trace.c,v 1.7 2024/11/07 16:02:29 miod Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000, 2001 Ben Harris
|
||||
@ -54,7 +54,7 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
|
||||
char c, *cp = modif;
|
||||
db_expr_t offset;
|
||||
Elf_Sym * sym;
|
||||
char *name;
|
||||
const char *name;
|
||||
int kernel_only = 1;
|
||||
|
||||
while ((c = *cp++) != 0) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_disasm.c,v 1.6 2019/11/07 16:08:07 mpi Exp $ */
|
||||
/* $OpenBSD: db_disasm.c,v 1.7 2024/11/07 16:02:29 miod Exp $ */
|
||||
/* $NetBSD: db_disasm.c,v 1.13 2006/01/21 02:09:06 uwe Exp $ */
|
||||
|
||||
/*
|
||||
@ -151,7 +151,7 @@ disasm_branch(char *buf, size_t bufsiz, const char *opstr, vaddr_t addr)
|
||||
{
|
||||
size_t len;
|
||||
db_expr_t d, value;
|
||||
char *name;
|
||||
const char *name;
|
||||
Elf_Sym *cursym;
|
||||
extern unsigned long db_lastsym;
|
||||
extern unsigned int db_maxoff;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_interface.c,v 1.15 2022/04/14 19:47:11 naddy Exp $ */
|
||||
/* $OpenBSD: db_interface.c,v 1.16 2024/11/07 16:02:29 miod Exp $ */
|
||||
/* $NetBSD: db_interface.c,v 1.37 2006/09/06 00:11:49 uwe Exp $ */
|
||||
|
||||
/*-
|
||||
@ -579,7 +579,7 @@ db_frame_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
|
||||
void
|
||||
__db_print_symbol(db_expr_t value)
|
||||
{
|
||||
char *name;
|
||||
const char *name;
|
||||
db_expr_t offset;
|
||||
|
||||
db_find_sym_and_offset((vaddr_t)value, &name, &offset);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_trace.c,v 1.10 2019/11/07 16:08:08 mpi Exp $ */
|
||||
/* $OpenBSD: db_trace.c,v 1.11 2024/11/07 16:02:29 miod Exp $ */
|
||||
/* $NetBSD: db_trace.c,v 1.19 2006/01/21 22:10:59 uwe Exp $ */
|
||||
|
||||
/*-
|
||||
@ -111,7 +111,7 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
|
||||
if ((tf->tf_ssr & PSL_MD) == 0)
|
||||
break;
|
||||
} else {
|
||||
char *name;
|
||||
const char *name;
|
||||
db_expr_t offset;
|
||||
Elf_Sym *sym;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_trace.c,v 1.27 2024/04/08 20:07:53 miod Exp $ */
|
||||
/* $OpenBSD: db_trace.c,v 1.28 2024/11/07 16:02:29 miod Exp $ */
|
||||
/* $NetBSD: db_trace.c,v 1.23 2001/07/10 06:06:16 eeh Exp $ */
|
||||
|
||||
/*
|
||||
@ -96,7 +96,7 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
|
||||
while (count--) {
|
||||
int i;
|
||||
db_expr_t offset;
|
||||
char *name;
|
||||
const char *name;
|
||||
vaddr_t pc;
|
||||
struct frame *f64;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_command.c,v 1.102 2024/09/05 08:52:27 bluhm Exp $ */
|
||||
/* $OpenBSD: db_command.c,v 1.103 2024/11/07 16:02:29 miod Exp $ */
|
||||
/* $NetBSD: db_command.c,v 1.20 1996/03/30 22:30:05 christos Exp $ */
|
||||
|
||||
/*
|
||||
@ -895,7 +895,7 @@ db_show_regs(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
|
||||
{
|
||||
struct db_variable *regp;
|
||||
db_expr_t value, offset;
|
||||
char * name;
|
||||
const char * name;
|
||||
char tmpfmt[28];
|
||||
|
||||
for (regp = db_regs; regp < db_eregs; regp++) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_ctf.c,v 1.34 2024/02/22 13:49:17 claudio Exp $ */
|
||||
/* $OpenBSD: db_ctf.c,v 1.35 2024/11/07 16:02:29 miod Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2016-2017 Martin Pieuchot
|
||||
@ -45,7 +45,7 @@ struct ddb_ctf {
|
||||
size_t rawctflen; /* raw .SUNW_ctf section size */
|
||||
const char *data; /* decompressed CTF data */
|
||||
size_t dlen; /* decompressed CTF data size */
|
||||
char *strtab; /* ELF string table */
|
||||
const char *strtab; /* ELF string table */
|
||||
uint32_t ctf_found;
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_elf.c,v 1.33 2024/09/04 07:54:52 mglocker Exp $ */
|
||||
/* $OpenBSD: db_elf.c,v 1.34 2024/11/07 16:02:29 miod Exp $ */
|
||||
/* $NetBSD: db_elf.c,v 1.13 2000/07/07 21:55:18 jhawk Exp $ */
|
||||
|
||||
/*-
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
db_symtab_t db_symtab;
|
||||
|
||||
Elf_Sym *db_elf_sym_lookup(char *);
|
||||
Elf_Sym *db_elf_sym_lookup(const char *);
|
||||
|
||||
/*
|
||||
* Find the symbol table and strings; tell ddb about them.
|
||||
@ -185,20 +185,21 @@ db_elf_sym_init(int symsize, void *symtab, void *esymtab, const char *name)
|
||||
* Internal helper function - return a pointer to the string table
|
||||
* for the current symbol table.
|
||||
*/
|
||||
char *
|
||||
const char *
|
||||
db_elf_find_strtab(db_symtab_t *stab)
|
||||
{
|
||||
Elf_Ehdr *elf = STAB_TO_EHDR(stab);
|
||||
Elf_Shdr *shp = STAB_TO_SHDR(stab, elf);
|
||||
char *shstrtab;
|
||||
const char *shstrtab;
|
||||
int i;
|
||||
|
||||
shstrtab = (char *)elf + shp[elf->e_shstrndx].sh_offset;
|
||||
shstrtab = (const char *)elf + shp[elf->e_shstrndx].sh_offset;
|
||||
for (i = 0; i < elf->e_shnum; i++) {
|
||||
if (shp[i].sh_type == SHT_SYMTAB)
|
||||
return ((char *)elf + shp[shp[i].sh_link].sh_offset);
|
||||
return ((const char *)elf +
|
||||
shp[shp[i].sh_link].sh_offset);
|
||||
if (strcmp(".strtab", shstrtab+shp[i].sh_name) == 0)
|
||||
return ((char *)elf + shp[i].sh_offset);
|
||||
return ((const char *)elf + shp[i].sh_offset);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
@ -232,11 +233,11 @@ db_elf_find_section(db_symtab_t *stab, size_t *size, const char *sname)
|
||||
* Lookup the symbol with the given name.
|
||||
*/
|
||||
Elf_Sym *
|
||||
db_elf_sym_lookup(char *symstr)
|
||||
db_elf_sym_lookup(const char *symstr)
|
||||
{
|
||||
db_symtab_t *stab = &db_symtab;
|
||||
Elf_Sym *symp, *symtab_start, *symtab_end;
|
||||
char *strtab;
|
||||
const char *strtab;
|
||||
|
||||
if (stab->private == NULL)
|
||||
return (NULL);
|
||||
@ -328,11 +329,11 @@ db_elf_sym_search(vaddr_t off, db_strategy_t strategy, db_expr_t *diffp)
|
||||
* Return the name and value for a symbol.
|
||||
*/
|
||||
void
|
||||
db_symbol_values(Elf_Sym *sym, char **namep, db_expr_t *valuep)
|
||||
db_symbol_values(Elf_Sym *sym, const char **namep, db_expr_t *valuep)
|
||||
{
|
||||
db_symtab_t *stab = &db_symtab;
|
||||
Elf_Sym *symp = (Elf_Sym *)sym;
|
||||
char *strtab;
|
||||
const char *strtab;
|
||||
|
||||
if (sym == NULL) {
|
||||
*namep = NULL;
|
||||
@ -359,7 +360,7 @@ db_symbol_values(Elf_Sym *sym, char **namep, db_expr_t *valuep)
|
||||
* if we can find the appropriate debugging symbol.
|
||||
*/
|
||||
int
|
||||
db_elf_line_at_pc(Elf_Sym *cursym, char **filename,
|
||||
db_elf_line_at_pc(Elf_Sym *cursym, const char **filename,
|
||||
int *linenum, db_expr_t off)
|
||||
{
|
||||
db_symtab_t *stab = &db_symtab;
|
||||
@ -390,7 +391,7 @@ void
|
||||
db_elf_sym_forall(db_forall_func_t db_forall_func, void *arg)
|
||||
{
|
||||
db_symtab_t *stab = &db_symtab;
|
||||
char *strtab;
|
||||
const char *strtab;
|
||||
static char suffix[2];
|
||||
Elf_Sym *symp, *symtab_start, *symtab_end;
|
||||
|
||||
@ -424,12 +425,12 @@ db_elf_sym_forall(db_forall_func_t db_forall_func, void *arg)
|
||||
suffix[0] = '\0';
|
||||
}
|
||||
(*db_forall_func)(symp,
|
||||
strtab + symp->st_name, suffix, 0, arg);
|
||||
strtab + symp->st_name, suffix, arg);
|
||||
}
|
||||
}
|
||||
|
||||
Elf_Sym *
|
||||
db_symbol_by_name(char *name, db_expr_t *valuep)
|
||||
db_symbol_by_name(const char *name, db_expr_t *valuep)
|
||||
{
|
||||
Elf_Sym *sym;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_elf.h,v 1.2 2017/05/28 11:41:52 mpi Exp $ */
|
||||
/* $OpenBSD: db_elf.h,v 1.3 2024/11/07 16:02:29 miod Exp $ */
|
||||
/* $NetBSD: db_elf.c,v 1.13 2000/07/07 21:55:18 jhawk Exp $ */
|
||||
|
||||
/*-
|
||||
@ -44,5 +44,5 @@ typedef struct {
|
||||
#define STAB_TO_EHDR(stab) ((Elf_Ehdr *)((stab)->private))
|
||||
#define STAB_TO_SHDR(stab, e) ((Elf_Shdr *)((stab)->private + (e)->e_shoff))
|
||||
|
||||
char *db_elf_find_strtab(db_symtab_t *);
|
||||
const char *db_elf_find_strtab(db_symtab_t *);
|
||||
const char *db_elf_find_section(db_symtab_t *, size_t *, const char *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_hangman.c,v 1.38 2020/10/15 03:14:00 deraadt Exp $ */
|
||||
/* $OpenBSD: db_hangman.c,v 1.39 2024/11/07 16:02:29 miod Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Theo de Raadt, Michael Shalayeff
|
||||
@ -49,7 +49,7 @@ struct _abc {
|
||||
#define ISLOWALPHA(c) ('a'<=(c) && (c)<='z')
|
||||
#define ISALPHA(c) ISLOWALPHA(TOLOWER(c))
|
||||
|
||||
void db_hang(int, char *, struct _abc *);
|
||||
void db_hang(int, const char *, struct _abc *);
|
||||
|
||||
u_long db_plays, db_guesses;
|
||||
|
||||
@ -72,10 +72,10 @@ struct db_hang_forall_arg {
|
||||
/*
|
||||
* Horrible abuse of the forall function, but we're not in a hurry.
|
||||
*/
|
||||
static void db_hang_forall(Elf_Sym *, char *, char *, int, void *);
|
||||
static void db_hang_forall(Elf_Sym *, const char *, const char *, void *);
|
||||
|
||||
static void
|
||||
db_hang_forall(Elf_Sym *sym, char *name, char *suff, int pre, void *varg)
|
||||
db_hang_forall(Elf_Sym *sym, const char *name, const char *suff, void *varg)
|
||||
{
|
||||
struct db_hang_forall_arg *arg = varg;
|
||||
|
||||
@ -83,11 +83,11 @@ db_hang_forall(Elf_Sym *sym, char *name, char *suff, int pre, void *varg)
|
||||
arg->sym = sym;
|
||||
}
|
||||
|
||||
static __inline char *
|
||||
static __inline const char *
|
||||
db_randomsym(size_t *lenp)
|
||||
{
|
||||
int nsyms;
|
||||
char *p, *q;
|
||||
const char *p, *q;
|
||||
struct db_hang_forall_arg dfa;
|
||||
|
||||
dfa.cnt = 0;
|
||||
@ -111,7 +111,7 @@ db_randomsym(size_t *lenp)
|
||||
}
|
||||
|
||||
void
|
||||
db_hang(int tries, char *word, struct _abc *sabc)
|
||||
db_hang(int tries, const char *word, struct _abc *sabc)
|
||||
{
|
||||
const char *p;
|
||||
int i;
|
||||
@ -152,7 +152,7 @@ db_hang(int tries, char *word, struct _abc *sabc)
|
||||
void
|
||||
db_hangman(db_expr_t addr, int haddr, db_expr_t count, char *modif)
|
||||
{
|
||||
char *word;
|
||||
const char *word;
|
||||
size_t tries;
|
||||
size_t len;
|
||||
struct _abc sabc[1];
|
||||
@ -179,7 +179,7 @@ db_hangman(db_expr_t addr, int haddr, db_expr_t count, char *modif)
|
||||
c = TOLOWER(c);
|
||||
|
||||
if (ISLOWALPHA(c) && ABC_ISCLR(c)) {
|
||||
char *p;
|
||||
const char *p;
|
||||
size_t n;
|
||||
|
||||
/* strchr(word,c) */
|
||||
@ -200,7 +200,7 @@ db_hangman(db_expr_t addr, int haddr, db_expr_t count, char *modif)
|
||||
continue;
|
||||
|
||||
if (!tries && skill > 2) {
|
||||
char *p = word;
|
||||
const char *p = word;
|
||||
for (; *p; p++)
|
||||
if (ISALPHA(*p))
|
||||
ABC_SETRIGHT(TOLOWER(*p));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: db_sym.c,v 1.56 2021/07/09 20:59:17 jasper Exp $ */
|
||||
/* $OpenBSD: db_sym.c,v 1.57 2024/11/07 16:02:29 miod Exp $ */
|
||||
/* $NetBSD: db_sym.c,v 1.24 2000/08/11 22:50:47 tv Exp $ */
|
||||
|
||||
/*
|
||||
@ -82,7 +82,7 @@ ddb_init(void)
|
||||
}
|
||||
|
||||
int
|
||||
db_eqname(char *src, char *dst, int c)
|
||||
db_eqname(const char *src, const char *dst, int c)
|
||||
{
|
||||
if (!strcmp(src, dst))
|
||||
return (1);
|
||||
@ -139,8 +139,8 @@ db_printsym(db_expr_t off, db_strategy_t strategy,
|
||||
int (*pr)(const char *, ...))
|
||||
{
|
||||
db_expr_t d;
|
||||
char *filename;
|
||||
char *name;
|
||||
const char *filename;
|
||||
const char *name;
|
||||
db_expr_t value;
|
||||
int linenum;
|
||||
Elf_Sym *cursym;
|
||||
|
@ -51,27 +51,26 @@ typedef int db_strategy_t; /* search strategy */
|
||||
/*
|
||||
* Internal db_forall function calling convention:
|
||||
*
|
||||
* (*db_forall_func)(stab, sym, name, suffix, prefix, arg);
|
||||
* (*db_forall_func)(sym, name, suffix, arg);
|
||||
*
|
||||
* stab is the symbol table, symbol the (opaque) symbol pointer,
|
||||
* name the name of the symbol, suffix a string representing
|
||||
* the type, prefix an initial ignorable function prefix (e.g. "_"
|
||||
* in a.out), and arg an opaque argument to be passed in.
|
||||
* symbol is the (opaque) symbol pointer, name the name of the symbol,
|
||||
* suffix a string representing the type, and arg an opaque argument to
|
||||
* be passed in.
|
||||
*/
|
||||
typedef void (db_forall_func_t)(Elf_Sym *, char *, char *, int, void *);
|
||||
typedef void (db_forall_func_t)(Elf_Sym *, const char *, const char *, void *);
|
||||
|
||||
extern unsigned int db_maxoff; /* like gdb's "max-symbolic-offset" */
|
||||
|
||||
int db_eqname(char *, char *, int);
|
||||
int db_eqname(const char *, const char *, int);
|
||||
/* strcmp, modulo leading char */
|
||||
|
||||
Elf_Sym * db_symbol_by_name(char *, db_expr_t *);
|
||||
Elf_Sym * db_symbol_by_name(const char *, db_expr_t *);
|
||||
/* find symbol value given name */
|
||||
|
||||
Elf_Sym * db_search_symbol(vaddr_t, db_strategy_t, db_expr_t *);
|
||||
/* find symbol given value */
|
||||
|
||||
void db_symbol_values(Elf_Sym *, char **, db_expr_t *);
|
||||
void db_symbol_values(Elf_Sym *, const char **, db_expr_t *);
|
||||
/* return name and value of symbol */
|
||||
|
||||
#define db_find_sym_and_offset(val,namep,offp) \
|
||||
@ -87,7 +86,7 @@ void db_printsym(db_expr_t, db_strategy_t, int (*)(const char *, ...));
|
||||
|
||||
int db_elf_sym_init(int, void *, void *, const char *);
|
||||
Elf_Sym * db_elf_sym_search(vaddr_t, db_strategy_t, db_expr_t *);
|
||||
int db_elf_line_at_pc(Elf_Sym *, char **, int *, db_expr_t);
|
||||
int db_elf_line_at_pc(Elf_Sym *, const char **, int *, db_expr_t);
|
||||
void db_elf_sym_forall(db_forall_func_t db_forall_func, void *);
|
||||
|
||||
bool db_dwarf_line_at_pc(const char *, size_t, uintptr_t,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: kern_clockintr.c,v 1.70 2024/02/25 19:15:50 cheloha Exp $ */
|
||||
/* $OpenBSD: kern_clockintr.c,v 1.71 2024/11/07 16:02:29 miod Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003 Dale Rahn <drahn@openbsd.org>
|
||||
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
|
||||
@ -653,7 +653,7 @@ void
|
||||
db_show_clockintr(const struct clockintr *cl, const char *state, u_int cpu)
|
||||
{
|
||||
struct timespec ts;
|
||||
char *name;
|
||||
const char *name;
|
||||
db_expr_t offset;
|
||||
int width = sizeof(long) * 2;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: kern_timeout.c,v 1.99 2024/08/11 00:49:34 dlg Exp $ */
|
||||
/* $OpenBSD: kern_timeout.c,v 1.100 2024/11/07 16:02:29 miod Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Thomas Nordin <nordin@openbsd.org>
|
||||
* Copyright (c) 2000-2001 Artur Grabowski <art@openbsd.org>
|
||||
@ -937,7 +937,7 @@ db_show_timeout(struct timeout *to, struct circq *bucket)
|
||||
char buf[8];
|
||||
db_expr_t offset;
|
||||
struct circq *wheel;
|
||||
char *name, *where;
|
||||
const char *name, *where;
|
||||
int width = sizeof(long) * 2;
|
||||
|
||||
db_find_sym_and_offset((vaddr_t)to->to_func, &name, &offset);
|
||||
|
Loading…
Reference in New Issue
Block a user