summaryrefslogtreecommitdiff
path: root/sys/ddb
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-07-06 19:05:59 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-07-06 19:05:59 +0000
commitee0b8b4c3e2e3376ebaa0037becf937eddb45025 (patch)
treef116133b7b298712ae300bc57dcffde56f4d7a34 /sys/ddb
parent0b8bbf9148d97517c81469fe223bebc0999c653e (diff)
Make sure we alter ddb variables as ints, not longs; only matters on 64 bit
platforms.
Diffstat (limited to 'sys/ddb')
-rw-r--r--sys/ddb/db_variables.c26
-rw-r--r--sys/ddb/db_variables.h15
2 files changed, 27 insertions, 14 deletions
diff --git a/sys/ddb/db_variables.c b/sys/ddb/db_variables.c
index f5fd5725fba..ab7303495a7 100644
--- a/sys/ddb/db_variables.c
+++ b/sys/ddb/db_variables.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_variables.c,v 1.11 2006/07/06 18:14:48 miod Exp $ */
+/* $OpenBSD: db_variables.c,v 1.12 2006/07/06 19:05:58 miod Exp $ */
/* $NetBSD: db_variables.c,v 1.8 1996/02/05 01:57:19 christos Exp $ */
/*
@@ -42,12 +42,12 @@
#include <ddb/db_var.h>
struct db_variable db_vars[] = {
- { "radix", (long *)&db_radix, FCN_NULL },
- { "maxoff", (long *)&db_maxoff, FCN_NULL },
- { "maxwidth", (long *)&db_max_width, FCN_NULL },
- { "tabstops", (long *)&db_tab_stop_width, FCN_NULL },
- { "lines", (long *)&db_max_line, FCN_NULL },
- { "log", (long *)&db_log, FCN_NULL }
+ { "radix", (long *)&db_radix, db_var_rw_int },
+ { "maxoff", (long *)&db_maxoff, db_var_rw_int },
+ { "maxwidth", (long *)&db_max_width, db_var_rw_int },
+ { "tabstops", (long *)&db_tab_stop_width, db_var_rw_int },
+ { "lines", (long *)&db_max_line, db_var_rw_int },
+ { "log", (long *)&db_log, db_var_rw_int }
};
struct db_variable *db_evars = db_vars + sizeof(db_vars)/sizeof(db_vars[0]);
@@ -159,3 +159,15 @@ db_set_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
db_write_variable(vp, &value);
}
+
+int
+db_var_rw_int(struct db_variable *var, db_expr_t *expr, int mode)
+{
+
+ if (mode == DB_VAR_SET)
+ *var->valuep = *(int *)expr;
+ else
+ *expr = *(int *)var->valuep;
+ return (0);
+}
+
diff --git a/sys/ddb/db_variables.h b/sys/ddb/db_variables.h
index 3c5450d0dd2..92426c3da0b 100644
--- a/sys/ddb/db_variables.h
+++ b/sys/ddb/db_variables.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_variables.h,v 1.6 2002/03/14 01:26:51 millert Exp $ */
+/* $OpenBSD: db_variables.h,v 1.7 2006/07/06 19:05:58 miod Exp $ */
/* $NetBSD: db_variables.h,v 1.5 1996/02/05 01:57:21 christos Exp $ */
/*
@@ -51,11 +51,12 @@ extern struct db_variable *db_evars;
extern struct db_variable db_regs[]; /* machine registers */
extern struct db_variable *db_eregs;
-int db_find_variable(struct db_variable **);
-int db_get_variable(db_expr_t *);
-int db_set_variable(db_expr_t);
-void db_read_variable(struct db_variable *, db_expr_t *);
-void db_write_variable(struct db_variable *, db_expr_t *);
-void db_set_cmd(db_expr_t, int, db_expr_t, char *);
+int db_find_variable(struct db_variable **);
+int db_get_variable(db_expr_t *);
+int db_set_variable(db_expr_t);
+void db_read_variable(struct db_variable *, db_expr_t *);
+void db_write_variable(struct db_variable *, db_expr_t *);
+void db_set_cmd(db_expr_t, int, db_expr_t, char *);
+int db_var_rw_int(struct db_variable *, db_expr_t *, int);
#endif /* _DB_VARIABLES_H_ */