This type is just another way to write 'vaddr_t' and requires pulling a
ddb-specific MD header for that, can't we just use vaddr_t everywhere?
Diff below does the conversion in sys/kern and sys/ddb, ok?
Index: kern/kern_timeout.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_timeout.c,v
retrieving revision 1.61
diff -u -p -r1.61 kern_timeout.c
--- kern/kern_timeout.c 3 Nov 2019 17:01:46 -0000 1.61
+++ kern/kern_timeout.c 6 Nov 2019 14:03:58 -0000
@@ -627,7 +627,7 @@ db_show_callout_bucket(struct circq *buc
for (p = CIRCQ_FIRST(bucket); p != bucket; p = CIRCQ_FIRST(p)) {
to = timeout_from_circq(p);
- db_find_sym_and_offset((db_addr_t)to->to_func, &name, &offset);
+ db_find_sym_and_offset((vaddr_t)to->to_func, &name, &offset);
name = name ? name : "?";
if (bucket == &timeout_todo)
where = "softint";
Index: ddb/db_access.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_access.c,v
retrieving revision 1.15
diff -u -p -r1.15 db_access.c
--- ddb/db_access.c 19 Apr 2016 10:24:42 -0000 1.15
+++ ddb/db_access.c 6 Nov 2019 13:56:49 -0000
@@ -42,7 +42,7 @@
* boundaries.
*/
db_expr_t
-db_get_value(db_addr_t addr, size_t size, int is_signed)
+db_get_value(vaddr_t addr, size_t size, int is_signed)
{
char data[sizeof(db_expr_t)];
db_expr_t value, extend;
@@ -70,7 +70,7 @@ db_get_value(db_addr_t addr, size_t size
}
void
-db_put_value(db_addr_t addr, size_t size, db_expr_t value)
+db_put_value(vaddr_t addr, size_t size, db_expr_t value)
{
char data[sizeof(db_expr_t)];
int i;
Index: ddb/db_access.h
===================================================================
RCS file: /cvs/src/sys/ddb/db_access.h,v
retrieving revision 1.9
diff -u -p -r1.9 db_access.h
--- ddb/db_access.h 7 May 2018 15:52:46 -0000 1.9
+++ ddb/db_access.h 6 Nov 2019 13:57:02 -0000
@@ -33,17 +33,17 @@
/*
* Data access functions for debugger.
*/
-db_expr_t db_get_value(db_addr_t, size_t, int);
-void db_put_value(db_addr_t, size_t, db_expr_t);
+db_expr_t db_get_value(vaddr_t, size_t, int);
+void db_put_value(vaddr_t, size_t, db_expr_t);
-void db_read_bytes(db_addr_t, size_t, char *);
-void db_write_bytes(db_addr_t, size_t, char *);
+void db_read_bytes(vaddr_t, size_t, char *);
+void db_write_bytes(vaddr_t, size_t, char *);
#define DB_STACK_TRACE_MAX 19
struct db_stack_trace {
unsigned int st_count;
- db_addr_t st_pc[DB_STACK_TRACE_MAX];
+ vaddr_t st_pc[DB_STACK_TRACE_MAX];
};
void db_print_stack_trace(struct db_stack_trace *, int (*)(const char *, ...));
Index: ddb/db_break.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_break.c,v
retrieving revision 1.20
diff -u -p -r1.20 db_break.c
--- ddb/db_break.c 19 Apr 2016 12:23:25 -0000 1.20
+++ ddb/db_break.c 6 Nov 2019 13:56:54 -0000
@@ -51,8 +51,8 @@ db_breakpoint_t db_breakpoint_list = 0;
db_breakpoint_t db_breakpoint_alloc(void);
void db_breakpoint_free(db_breakpoint_t);
-void db_set_breakpoint(db_addr_t, int);
-void db_delete_breakpoint(db_addr_t);
+void db_set_breakpoint(vaddr_t, int);
+void db_delete_breakpoint(vaddr_t);
void db_list_breakpoints(void);
db_breakpoint_t
@@ -82,7 +82,7 @@ db_breakpoint_free(db_breakpoint_t bkpt)
}
void
-db_set_breakpoint(db_addr_t addr, int count)
+db_set_breakpoint(vaddr_t addr, int count)
{
db_breakpoint_t bkpt;
@@ -114,7 +114,7 @@ db_set_breakpoint(db_addr_t addr, int co
}
void
-db_delete_breakpoint(db_addr_t addr)
+db_delete_breakpoint(vaddr_t addr)
{
db_breakpoint_t bkpt;
db_breakpoint_t *prev;
@@ -135,7 +135,7 @@ db_delete_breakpoint(db_addr_t addr)
}
db_breakpoint_t
-db_find_breakpoint(db_addr_t addr)
+db_find_breakpoint(vaddr_t addr)
{
db_breakpoint_t bkpt;
@@ -182,7 +182,7 @@ db_clear_breakpoints(void)
* so the breakpoint does not have to be on the breakpoint list.
*/
db_breakpoint_t
-db_set_temp_breakpoint(db_addr_t addr)
+db_set_temp_breakpoint(vaddr_t addr)
{
db_breakpoint_t bkpt;
@@ -242,7 +242,7 @@ db_list_breakpoints(void)
void
db_delete_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
{
- db_delete_breakpoint((db_addr_t)addr);
+ db_delete_breakpoint((vaddr_t)addr);
}
/* Set breakpoint with skip count */
@@ -253,7 +253,7 @@ db_breakpoint_cmd(db_expr_t addr, int ha
if (count == -1)
count = 1;
- db_set_breakpoint((db_addr_t)addr, count);
+ db_set_breakpoint((vaddr_t)addr, count);
}
/* list breakpoints */
Index: ddb/db_break.h
===================================================================
RCS file: /cvs/src/sys/ddb/db_break.h,v
retrieving revision 1.11
diff -u -p -r1.11 db_break.h
--- ddb/db_break.h 19 Apr 2016 12:23:25 -0000 1.11
+++ ddb/db_break.h 6 Nov 2019 13:57:11 -0000
@@ -39,7 +39,7 @@
* Breakpoints.
*/
typedef struct db_breakpoint {
- db_addr_t address; /* set here */
+ vaddr_t address; /* set here */
int init_count; /* number of times to skip bkpt */
int count; /* current count */
int flags; /* flags: */
@@ -49,10 +49,10 @@ typedef struct db_breakpoint {
struct db_breakpoint *link; /* link in in-use or free chain */
} *db_breakpoint_t;
-db_breakpoint_t db_find_breakpoint(db_addr_t);
+db_breakpoint_t db_find_breakpoint(vaddr_t);
void db_set_breakpoints(void);
void db_clear_breakpoints(void);
-db_breakpoint_t db_set_temp_breakpoint(db_addr_t);
+db_breakpoint_t db_set_temp_breakpoint(vaddr_t);
void db_delete_temp_breakpoint(db_breakpoint_t);
void db_delete_cmd(db_expr_t, int, db_expr_t, char *);
void db_breakpoint_cmd(db_expr_t, int, db_expr_t, char *);
Index: ddb/db_command.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_command.c,v
retrieving revision 1.87
diff -u -p -r1.87 db_command.c
--- ddb/db_command.c 6 Nov 2019 07:30:08 -0000 1.87
+++ ddb/db_command.c 6 Nov 2019 14:00:23 -0000
@@ -71,11 +71,11 @@ label_t *db_recover;
*/
int db_ed_style = 1;
-db_addr_t db_dot; /* current location */
-db_addr_t db_last_addr; /* last explicit address typed */
-db_addr_t db_prev; /* last address examined
+vaddr_t db_dot; /* current location */
+vaddr_t db_last_addr; /* last explicit address typed */
+vaddr_t db_prev; /* last address examined
or written */
-db_addr_t db_next; /* next address to be examined
+vaddr_t db_next; /* next address to be examined
or written */
int db_cmd_search(char *, struct db_command *, struct db_command **);
@@ -269,7 +269,7 @@ db_command(struct db_command **last_cmdp
}
if (db_expression(&addr)) {
- db_dot = (db_addr_t) addr;
+ db_dot = (vaddr_t) addr;
db_last_addr = db_dot;
have_addr = 1;
}
@@ -858,7 +858,7 @@ db_show_regs(db_expr_t addr, int have_ad
db_read_variable(regp, &value);
db_printf("%-12s%s", regp->name, db_format(tmpfmt, sizeof tmpfmt,
(long)value, DB_FORMAT_N, 1, sizeof(long) * 3));
- db_find_xtrn_sym_and_offset((db_addr_t)value, &name, &offset);
+ db_find_xtrn_sym_and_offset((vaddr_t)value, &name, &offset);
if (name != 0 && offset <= db_maxoff && offset != value) {
db_printf("\t%s", name);
if (offset != 0)
@@ -877,13 +877,13 @@ db_show_regs(db_expr_t addr, int have_ad
void
db_write_cmd(db_expr_t address, int have_addr, db_expr_t count, char *modif)
{
- db_addr_t addr;
+ vaddr_t addr;
db_expr_t old_value;
db_expr_t new_value;
int size, wrote_one = 0;
char tmpfmt[28];
- addr = (db_addr_t) address;
+ addr = (vaddr_t) address;
switch (modif[0]) {
case 'b':
Index: ddb/db_command.h
===================================================================
RCS file: /cvs/src/sys/ddb/db_command.h,v
retrieving revision 1.32
diff -u -p -r1.32 db_command.h
--- ddb/db_command.h 19 Apr 2016 12:23:25 -0000 1.32
+++ ddb/db_command.h 6 Nov 2019 13:57:32 -0000
@@ -41,7 +41,7 @@ void db_command_loop(void);
void db_command(struct db_command **, struct db_command *);
void db_machine_commands_install(struct db_command *);
-extern db_addr_t db_dot, db_last_addr, db_prev, db_next;
+extern vaddr_t db_dot, db_last_addr, db_prev, db_next;
/*
* Command table
Index: ddb/db_ctf.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_ctf.c,v
retrieving revision 1.27
diff -u -p -r1.27 db_ctf.c
--- ddb/db_ctf.c 31 Aug 2018 11:57:04 -0000 1.27
+++ ddb/db_ctf.c 6 Nov 2019 14:00:45 -0000
@@ -343,7 +343,7 @@ db_ctf_type_by_index(uint16_t index)
void
db_ctf_pprint(const struct ctf_type *ctt, vaddr_t addr)
{
- db_addr_t taddr = (db_addr_t)ctt;
+ vaddr_t taddr = (vaddr_t)ctt;
const struct ctf_type *ref;
uint16_t kind;
uint32_t eob, toff;
@@ -635,7 +635,7 @@ db_ctf_show_struct(db_expr_t addr, int h
* In that case, update `dot' value.
*/
if (db_expression(&addr)) {
- db_dot = (db_addr_t)addr;
+ db_dot = (vaddr_t)addr;
db_last_addr = db_dot;
} else
addr = (db_expr_t)db_dot;
Index: ddb/db_elf.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_elf.c,v
retrieving revision 1.28
diff -u -p -r1.28 db_elf.c
--- ddb/db_elf.c 8 Sep 2017 05:36:52 -0000 1.28
+++ ddb/db_elf.c 6 Nov 2019 13:57:40 -0000
@@ -263,8 +263,7 @@ db_elf_sym_lookup(char *symstr)
* provided threshold).
*/
Elf_Sym *
-db_elf_sym_search(db_addr_t off, db_strategy_t strategy,
- db_expr_t *diffp)
+db_elf_sym_search(vaddr_t off, db_strategy_t strategy, db_expr_t *diffp)
{
db_symtab_t *stab = &db_symtab;
Elf_Sym *rsymp, *symp, *symtab_start, *symtab_end;
Index: ddb/db_examine.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_examine.c,v
retrieving revision 1.25
diff -u -p -r1.25 db_examine.c
--- ddb/db_examine.c 6 Nov 2019 07:30:08 -0000 1.25
+++ ddb/db_examine.c 6 Nov 2019 14:01:25 -0000
@@ -45,8 +45,8 @@
char db_examine_format[TOK_STRING_SIZE] = "x";
-void db_examine(db_addr_t, char *, int);
-void db_search(db_addr_t, int, db_expr_t, db_expr_t, db_expr_t);
+void db_examine(vaddr_t, char *, int);
+void db_search(vaddr_t, int, db_expr_t, db_expr_t, db_expr_t);
/*
* Examine (print) data. Syntax is:
@@ -66,11 +66,11 @@ db_examine_cmd(db_expr_t addr, int have_
if (count == -1)
count = 1;
- db_examine((db_addr_t)addr, db_examine_format, count);
+ db_examine((vaddr_t)addr, db_examine_format, count);
}
void
-db_examine(db_addr_t addr, char *fmt, int count)
+db_examine(vaddr_t addr, char *fmt, int count)
{
int i, c;
db_expr_t value;
@@ -78,7 +78,7 @@ db_examine(db_addr_t addr, char *fmt, in
int width;
int bytes;
char * fp;
- db_addr_t incr;
+ vaddr_t incr;
int dis;
char tmpfmt[28];
@@ -251,7 +251,7 @@ db_print_cmd(db_expr_t addr, int have_ad
switch (db_print_format) {
case 'a':
- db_printsym((db_addr_t)addr, DB_STGY_ANY, db_printf);
+ db_printsym((vaddr_t)addr, DB_STGY_ANY, db_printf);
break;
case 'r':
db_printf("%s", db_format(tmpfmt, sizeof tmpfmt, addr,
@@ -285,7 +285,7 @@ db_print_cmd(db_expr_t addr, int have_ad
}
void
-db_print_loc_and_inst(db_addr_t loc)
+db_print_loc_and_inst(vaddr_t loc)
{
db_printsym(loc, DB_STGY_PROC, db_printf);
db_printf(":\t");
@@ -328,7 +328,7 @@ void
db_search_cmd(db_expr_t daddr, int have_addr, db_expr_t dcount, char *modif)
{
int t;
- db_addr_t addr;
+ vaddr_t addr;
int size;
db_expr_t value;
db_expr_t mask;
@@ -362,7 +362,7 @@ db_search_cmd(db_expr_t daddr, int have_
db_flush_lex();
return;
}
- addr = (db_addr_t) value;
+ addr = (vaddr_t) value;
if (!db_expression(&value)) {
db_printf("Value missing\n");
@@ -390,7 +390,7 @@ db_search_cmd(db_expr_t daddr, int have_
}
void
-db_search(db_addr_t addr, int size, db_expr_t value, db_expr_t mask,
+db_search(vaddr_t addr, int size, db_expr_t value, db_expr_t mask,
db_expr_t count)
{
/* Negative counts means forever. */
Index: ddb/db_expr.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_expr.c,v
retrieving revision 1.15
diff -u -p -r1.15 db_expr.c
--- ddb/db_expr.c 6 Nov 2019 07:30:08 -0000 1.15
+++ ddb/db_expr.c 6 Nov 2019 13:57:52 -0000
@@ -121,7 +121,7 @@ db_unary(db_expr_t *valuep)
db_error("Syntax error\n");
/*NOTREACHED*/
}
- *valuep = db_get_value((db_addr_t)*valuep, sizeof(db_addr_t),
FALSE);
+ *valuep = db_get_value((vaddr_t)*valuep, sizeof(vaddr_t), 0);
return 1;
}
db_unread_token(t);
Index: ddb/db_extern.h
===================================================================
RCS file: /cvs/src/sys/ddb/db_extern.h,v
retrieving revision 1.20
diff -u -p -r1.20 db_extern.h
--- ddb/db_extern.h 6 Nov 2019 07:30:08 -0000 1.20
+++ ddb/db_extern.h 6 Nov 2019 13:57:48 -0000
@@ -39,7 +39,7 @@ void ddb_init(void);
void db_examine_cmd(db_expr_t, int, db_expr_t, char *);
void db_print_cmd(db_expr_t, int, db_expr_t, char *);
void db_search_cmd(db_expr_t, int, db_expr_t, char *);
-void db_print_loc_and_inst(db_addr_t);
+void db_print_loc_and_inst(vaddr_t);
size_t db_strlcpy(char *, const char *, size_t);
/* db_expr.c */
Index: ddb/db_interface.h
===================================================================
RCS file: /cvs/src/sys/ddb/db_interface.h,v
retrieving revision 1.21
diff -u -p -r1.21 db_interface.h
--- ddb/db_interface.h 6 Nov 2019 07:30:08 -0000 1.21
+++ ddb/db_interface.h 6 Nov 2019 13:57:56 -0000
@@ -37,7 +37,7 @@ void db_stack_trace_print(db_expr_t, int
int (*)(const char *, ...));
/* arch/<arch>/<arch>/db_disasm.c */
-db_addr_t db_disasm(db_addr_t, int);
+vaddr_t db_disasm(vaddr_t, int);
/* kern/kern_proc.c */
void db_kill_cmd(db_expr_t, int, db_expr_t, char *);
Index: ddb/db_run.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_run.c,v
retrieving revision 1.28
diff -u -p -r1.28 db_run.c
--- ddb/db_run.c 6 Nov 2019 07:30:08 -0000 1.28
+++ ddb/db_run.c 6 Nov 2019 14:01:48 -0000
@@ -70,7 +70,7 @@ int db_call_depth;
int
db_stop_at_pc(db_regs_t *regs, int *is_breakpoint)
{
- db_addr_t pc, old_pc;
+ vaddr_t pc, old_pc;
db_breakpoint_t bkpt;
db_clear_breakpoints();
@@ -176,7 +176,7 @@ db_stop_at_pc(db_regs_t *regs, int *is_b
void
db_restart_at_pc(db_regs_t *regs, int watchpt)
{
- db_addr_t pc = PC_REGS(regs);
+ vaddr_t pc = PC_REGS(regs);
if ((db_run_mode == STEP_COUNT) || (db_run_mode == STEP_RETURN) ||
(db_run_mode == STEP_CALLT)) {
@@ -329,9 +329,9 @@ db_continue_cmd(db_expr_t addr, int have
void
db_set_single_step(db_regs_t *regs)
{
- db_addr_t pc = PC_REGS(regs);
+ vaddr_t pc = PC_REGS(regs);
#ifndef SOFTWARE_SSTEP_EMUL
- db_addr_t brpc;
+ vaddr_t brpc;
u_int inst;
/*
Index: ddb/db_sym.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_sym.c,v
retrieving revision 1.53
diff -u -p -r1.53 db_sym.c
--- ddb/db_sym.c 30 May 2017 15:39:05 -0000 1.53
+++ ddb/db_sym.c 6 Nov 2019 13:58:17 -0000
@@ -96,7 +96,7 @@ db_eqname(char *src, char *dst, int c)
* and the difference between val and the symbol found.
*/
Elf_Sym *
-db_search_symbol(db_addr_t val, db_strategy_t strategy, db_expr_t *offp)
+db_search_symbol(vaddr_t val, db_strategy_t strategy, db_expr_t *offp)
{
unsigned int diff;
db_expr_t newdiff;
Index: ddb/db_sym.h
===================================================================
RCS file: /cvs/src/sys/ddb/db_sym.h,v
retrieving revision 1.34
diff -u -p -r1.34 db_sym.h
--- ddb/db_sym.h 6 Nov 2017 09:32:16 -0000 1.34
+++ ddb/db_sym.h 6 Nov 2019 13:58:06 -0000
@@ -68,7 +68,7 @@ int db_eqname(char *, char *, int);
Elf_Sym * db_symbol_by_name(char *, db_expr_t *);
/* find symbol value given name */
-Elf_Sym * db_search_symbol(db_addr_t, db_strategy_t, db_expr_t *);
+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 *);
@@ -86,7 +86,7 @@ void db_printsym(db_expr_t, db_strategy_
/* print closest symbol to a value */
int db_elf_sym_init(int, void *, void *, const char *);
-Elf_Sym * db_elf_sym_search(db_addr_t, db_strategy_t, db_expr_t *);
+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);
void db_elf_sym_forall(db_forall_func_t db_forall_func, void *);
Index: ddb/db_watch.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_watch.c,v
retrieving revision 1.16
diff -u -p -r1.16 db_watch.c
--- ddb/db_watch.c 19 Apr 2016 10:24:42 -0000 1.16
+++ ddb/db_watch.c 6 Nov 2019 13:58:23 -0000
@@ -83,7 +83,7 @@ db_watchpoint_free(db_watchpoint_t watch
}
void
-db_set_watchpoint(db_addr_t addr, vsize_t size)
+db_set_watchpoint(vaddr_t addr, vsize_t size)
{
db_watchpoint_t watch;
@@ -113,7 +113,7 @@ db_set_watchpoint(db_addr_t addr, vsize_
}
void
-db_delete_watchpoint(db_addr_t addr)
+db_delete_watchpoint(vaddr_t addr)
{
db_watchpoint_t watch;
db_watchpoint_t *prev;
Index: ddb/db_watch.h
===================================================================
RCS file: /cvs/src/sys/ddb/db_watch.h,v
retrieving revision 1.10
diff -u -p -r1.10 db_watch.h
--- ddb/db_watch.h 25 Jan 2016 14:30:30 -0000 1.10
+++ ddb/db_watch.h 6 Nov 2019 13:58:35 -0000
@@ -37,15 +37,15 @@
* Watchpoint.
*/
typedef struct db_watchpoint {
- db_addr_t loaddr; /* from this address */
- db_addr_t hiaddr; /* to this address */
+ vaddr_t loaddr; /* from this address */
+ vaddr_t hiaddr; /* to this address */
struct db_watchpoint *link; /* link in in-use or free chain */
} *db_watchpoint_t;
db_watchpoint_t db_watchpoint_alloc(void);
void db_watchpoint_free(db_watchpoint_t);
-void db_set_watchpoint(db_addr_t, vsize_t);
-void db_delete_watchpoint(db_addr_t);
+void db_set_watchpoint(vaddr_t, vsize_t);
+void db_delete_watchpoint(vaddr_t);
void db_list_watchpoints(void);
void db_deletewatch_cmd(db_expr_t, int, db_expr_t, char *);
void db_watchpoint_cmd(db_expr_t, int, db_expr_t, char *);