| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: db_command.c,v 1.119 2008/09/29 10:27:53 rmind Exp $ */ | | 1 | /* $NetBSD: db_command.c,v 1.120 2008/10/03 14:52:11 rmind Exp $ */ |
2 | /* | | 2 | /* |
3 | * Mach Operating System | | 3 | * Mach Operating System |
4 | * Copyright (c) 1991,1990 Carnegie Mellon University | | 4 | * Copyright (c) 1991,1990 Carnegie Mellon University |
5 | * All Rights Reserved. | | 5 | * All Rights Reserved. |
6 | * | | 6 | * |
7 | * Permission to use, copy, modify and distribute this software and its | | 7 | * Permission to use, copy, modify and distribute this software and its |
8 | * documentation is hereby granted, provided that both the copyright | | 8 | * documentation is hereby granted, provided that both the copyright |
9 | * notice and this permission notice appear in all copies of the | | 9 | * notice and this permission notice appear in all copies of the |
10 | * software, derivative works or modified versions, and any portions | | 10 | * software, derivative works or modified versions, and any portions |
11 | * thereof, and that both notices appear in supporting documentation. | | 11 | * thereof, and that both notices appear in supporting documentation. |
12 | * | | 12 | * |
13 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | | 13 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" |
14 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | | 14 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR |
| @@ -48,27 +48,27 @@ | | | @@ -48,27 +48,27 @@ |
48 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 48 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
49 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 49 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
50 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 50 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
51 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 51 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
52 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 52 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
53 | * POSSIBILITY OF SUCH DAMAGE. | | 53 | * POSSIBILITY OF SUCH DAMAGE. |
54 | */ | | 54 | */ |
55 | | | 55 | |
56 | /* | | 56 | /* |
57 | * Command dispatcher. | | 57 | * Command dispatcher. |
58 | */ | | 58 | */ |
59 | | | 59 | |
60 | #include <sys/cdefs.h> | | 60 | #include <sys/cdefs.h> |
61 | __KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.119 2008/09/29 10:27:53 rmind Exp $"); | | 61 | __KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.120 2008/10/03 14:52:11 rmind Exp $"); |
62 | | | 62 | |
63 | #include "opt_ddb.h" | | 63 | #include "opt_ddb.h" |
64 | #include "opt_kgdb.h" | | 64 | #include "opt_kgdb.h" |
65 | #include "opt_inet.h" | | 65 | #include "opt_inet.h" |
66 | #include "opt_uvmhist.h" | | 66 | #include "opt_uvmhist.h" |
67 | #include "opt_ddbparam.h" | | 67 | #include "opt_ddbparam.h" |
68 | | | 68 | |
69 | #include <sys/param.h> | | 69 | #include <sys/param.h> |
70 | #include <sys/systm.h> | | 70 | #include <sys/systm.h> |
71 | #include <sys/reboot.h> | | 71 | #include <sys/reboot.h> |
72 | #include <sys/device.h> | | 72 | #include <sys/device.h> |
73 | #include <sys/lwp.h> | | 73 | #include <sys/lwp.h> |
74 | #include <sys/malloc.h> | | 74 | #include <sys/malloc.h> |
| @@ -1064,29 +1064,29 @@ db_help_print_cmd(db_expr_t addr, bool h | | | @@ -1064,29 +1064,29 @@ db_help_print_cmd(db_expr_t addr, bool h |
1064 | } | | 1064 | } |
1065 | | | 1065 | |
1066 | /*ARGSUSED*/ | | 1066 | /*ARGSUSED*/ |
1067 | static void | | 1067 | static void |
1068 | db_map_print_cmd(db_expr_t addr, bool have_addr, db_expr_t count, | | 1068 | db_map_print_cmd(db_expr_t addr, bool have_addr, db_expr_t count, |
1069 | const char *modif) | | 1069 | const char *modif) |
1070 | { | | 1070 | { |
1071 | bool full = false; | | 1071 | bool full = false; |
1072 | | | 1072 | |
1073 | if (modif[0] == 'f') | | 1073 | if (modif[0] == 'f') |
1074 | full = true; | | 1074 | full = true; |
1075 | | | 1075 | |
1076 | if (have_addr == false) | | 1076 | if (have_addr == false) |
1077 | addr = (db_expr_t)(intptr_t) kernel_map; | | 1077 | addr = (db_expr_t)(uintptr_t) kernel_map; |
1078 | | | 1078 | |
1079 | uvm_map_printit((struct vm_map *)(intptr_t) addr, full, db_printf); | | 1079 | uvm_map_printit((struct vm_map *)(uintptr_t) addr, full, db_printf); |
1080 | } | | 1080 | } |
1081 | | | 1081 | |
1082 | /*ARGSUSED*/ | | 1082 | /*ARGSUSED*/ |
1083 | static void | | 1083 | static void |
1084 | db_malloc_print_cmd(db_expr_t addr, bool have_addr, | | 1084 | db_malloc_print_cmd(db_expr_t addr, bool have_addr, |
1085 | db_expr_t count, const char *modif) | | 1085 | db_expr_t count, const char *modif) |
1086 | { | | 1086 | { |
1087 | | | 1087 | |
1088 | #ifdef MALLOC_DEBUG | | 1088 | #ifdef MALLOC_DEBUG |
1089 | if (!have_addr) | | 1089 | if (!have_addr) |
1090 | addr = 0; | | 1090 | addr = 0; |
1091 | | | 1091 | |
1092 | debug_malloc_printit(db_printf, (vaddr_t) addr); | | 1092 | debug_malloc_printit(db_printf, (vaddr_t) addr); |
| @@ -1095,128 +1095,128 @@ db_malloc_print_cmd(db_expr_t addr, bool | | | @@ -1095,128 +1095,128 @@ db_malloc_print_cmd(db_expr_t addr, bool |
1095 | #endif /* MALLOC_DEBUG */ | | 1095 | #endif /* MALLOC_DEBUG */ |
1096 | } | | 1096 | } |
1097 | | | 1097 | |
1098 | /*ARGSUSED*/ | | 1098 | /*ARGSUSED*/ |
1099 | static void | | 1099 | static void |
1100 | db_object_print_cmd(db_expr_t addr, bool have_addr, | | 1100 | db_object_print_cmd(db_expr_t addr, bool have_addr, |
1101 | db_expr_t count, const char *modif) | | 1101 | db_expr_t count, const char *modif) |
1102 | { | | 1102 | { |
1103 | bool full = false; | | 1103 | bool full = false; |
1104 | | | 1104 | |
1105 | if (modif[0] == 'f') | | 1105 | if (modif[0] == 'f') |
1106 | full = true; | | 1106 | full = true; |
1107 | | | 1107 | |
1108 | uvm_object_printit((struct uvm_object *)(intptr_t) addr, full, | | 1108 | uvm_object_printit((struct uvm_object *)(uintptr_t) addr, full, |
1109 | db_printf); | | 1109 | db_printf); |
1110 | } | | 1110 | } |
1111 | | | 1111 | |
1112 | /*ARGSUSED*/ | | 1112 | /*ARGSUSED*/ |
1113 | static void | | 1113 | static void |
1114 | db_page_print_cmd(db_expr_t addr, bool have_addr, | | 1114 | db_page_print_cmd(db_expr_t addr, bool have_addr, |
1115 | db_expr_t count, const char *modif) | | 1115 | db_expr_t count, const char *modif) |
1116 | { | | 1116 | { |
1117 | bool full = false; | | 1117 | bool full = false; |
1118 | | | 1118 | |
1119 | if (modif[0] == 'f') | | 1119 | if (modif[0] == 'f') |
1120 | full = true; | | 1120 | full = true; |
1121 | | | 1121 | |
1122 | uvm_page_printit((struct vm_page *)(intptr_t) addr, full, db_printf); | | 1122 | uvm_page_printit((struct vm_page *)(uintptr_t) addr, full, db_printf); |
1123 | } | | 1123 | } |
1124 | | | 1124 | |
1125 | /*ARGSUSED*/ | | 1125 | /*ARGSUSED*/ |
1126 | static void | | 1126 | static void |
1127 | db_show_all_pages(db_expr_t addr, bool have_addr, | | 1127 | db_show_all_pages(db_expr_t addr, bool have_addr, |
1128 | db_expr_t count, const char *modif) | | 1128 | db_expr_t count, const char *modif) |
1129 | { | | 1129 | { |
1130 | | | 1130 | |
1131 | uvm_page_printall(db_printf); | | 1131 | uvm_page_printall(db_printf); |
1132 | } | | 1132 | } |
1133 | | | 1133 | |
1134 | /*ARGSUSED*/ | | 1134 | /*ARGSUSED*/ |
1135 | static void | | 1135 | static void |
1136 | db_buf_print_cmd(db_expr_t addr, bool have_addr, | | 1136 | db_buf_print_cmd(db_expr_t addr, bool have_addr, |
1137 | db_expr_t count, const char *modif) | | 1137 | db_expr_t count, const char *modif) |
1138 | { | | 1138 | { |
1139 | bool full = false; | | 1139 | bool full = false; |
1140 | | | 1140 | |
1141 | if (modif[0] == 'f') | | 1141 | if (modif[0] == 'f') |
1142 | full = true; | | 1142 | full = true; |
1143 | | | 1143 | |
1144 | vfs_buf_print((struct buf *)(intptr_t) addr, full, db_printf); | | 1144 | vfs_buf_print((struct buf *)(uintptr_t) addr, full, db_printf); |
1145 | } | | 1145 | } |
1146 | | | 1146 | |
1147 | /*ARGSUSED*/ | | 1147 | /*ARGSUSED*/ |
1148 | static void | | 1148 | static void |
1149 | db_event_print_cmd(db_expr_t addr, bool have_addr, | | 1149 | db_event_print_cmd(db_expr_t addr, bool have_addr, |
1150 | db_expr_t count, const char *modif) | | 1150 | db_expr_t count, const char *modif) |
1151 | { | | 1151 | { |
1152 | bool full = false; | | 1152 | bool full = false; |
1153 | | | 1153 | |
1154 | if (modif[0] == 'f') | | 1154 | if (modif[0] == 'f') |
1155 | full = true; | | 1155 | full = true; |
1156 | | | 1156 | |
1157 | event_print(full, db_printf); | | 1157 | event_print(full, db_printf); |
1158 | } | | 1158 | } |
1159 | | | 1159 | |
1160 | /*ARGSUSED*/ | | 1160 | /*ARGSUSED*/ |
1161 | static void | | 1161 | static void |
1162 | db_vnode_print_cmd(db_expr_t addr, bool have_addr, | | 1162 | db_vnode_print_cmd(db_expr_t addr, bool have_addr, |
1163 | db_expr_t count, const char *modif) | | 1163 | db_expr_t count, const char *modif) |
1164 | { | | 1164 | { |
1165 | bool full = false; | | 1165 | bool full = false; |
1166 | | | 1166 | |
1167 | if (modif[0] == 'f') | | 1167 | if (modif[0] == 'f') |
1168 | full = true; | | 1168 | full = true; |
1169 | | | 1169 | |
1170 | vfs_vnode_print((struct vnode *)(intptr_t) addr, full, db_printf); | | 1170 | vfs_vnode_print((struct vnode *)(uintptr_t) addr, full, db_printf); |
1171 | } | | 1171 | } |
1172 | | | 1172 | |
1173 | static void | | 1173 | static void |
1174 | db_mount_print_cmd(db_expr_t addr, bool have_addr, | | 1174 | db_mount_print_cmd(db_expr_t addr, bool have_addr, |
1175 | db_expr_t count, const char *modif) | | 1175 | db_expr_t count, const char *modif) |
1176 | { | | 1176 | { |
1177 | bool full = false; | | 1177 | bool full = false; |
1178 | | | 1178 | |
1179 | if (modif[0] == 'f') | | 1179 | if (modif[0] == 'f') |
1180 | full = true; | | 1180 | full = true; |
1181 | | | 1181 | |
1182 | vfs_mount_print((struct mount *)(intptr_t) addr, full, db_printf); | | 1182 | vfs_mount_print((struct mount *)(uintptr_t) addr, full, db_printf); |
1183 | } | | 1183 | } |
1184 | | | 1184 | |
1185 | /*ARGSUSED*/ | | 1185 | /*ARGSUSED*/ |
1186 | static void | | 1186 | static void |
1187 | db_mbuf_print_cmd(db_expr_t addr, bool have_addr, | | 1187 | db_mbuf_print_cmd(db_expr_t addr, bool have_addr, |
1188 | db_expr_t count, const char *modif) | | 1188 | db_expr_t count, const char *modif) |
1189 | { | | 1189 | { |
1190 | | | 1190 | |
1191 | m_print((const struct mbuf *)(intptr_t) addr, modif, db_printf); | | 1191 | m_print((const struct mbuf *)(uintptr_t) addr, modif, db_printf); |
1192 | } | | 1192 | } |
1193 | | | 1193 | |
1194 | /*ARGSUSED*/ | | 1194 | /*ARGSUSED*/ |
1195 | static void | | 1195 | static void |
1196 | db_pool_print_cmd(db_expr_t addr, bool have_addr, | | 1196 | db_pool_print_cmd(db_expr_t addr, bool have_addr, |
1197 | db_expr_t count, const char *modif) | | 1197 | db_expr_t count, const char *modif) |
1198 | { | | 1198 | { |
1199 | | | 1199 | |
1200 | pool_printit((struct pool *)(intptr_t) addr, modif, db_printf); | | 1200 | pool_printit((struct pool *)(uintptr_t) addr, modif, db_printf); |
1201 | } | | 1201 | } |
1202 | | | 1202 | |
1203 | /*ARGSUSED*/ | | 1203 | /*ARGSUSED*/ |
1204 | static void | | 1204 | static void |
1205 | db_namecache_print_cmd(db_expr_t addr, bool have_addr, | | 1205 | db_namecache_print_cmd(db_expr_t addr, bool have_addr, |
1206 | db_expr_t count, const char *modif) | | 1206 | db_expr_t count, const char *modif) |
1207 | { | | 1207 | { |
1208 | | | 1208 | |
1209 | namecache_print((struct vnode *)(intptr_t) addr, db_printf); | | 1209 | namecache_print((struct vnode *)(uintptr_t) addr, db_printf); |
1210 | } | | 1210 | } |
1211 | | | 1211 | |
1212 | /*ARGSUSED*/ | | 1212 | /*ARGSUSED*/ |
1213 | static void | | 1213 | static void |
1214 | db_uvmexp_print_cmd(db_expr_t addr, bool have_addr, | | 1214 | db_uvmexp_print_cmd(db_expr_t addr, bool have_addr, |
1215 | db_expr_t count, const char *modif) | | 1215 | db_expr_t count, const char *modif) |
1216 | { | | 1216 | { |
1217 | | | 1217 | |
1218 | uvmexp_print(db_printf); | | 1218 | uvmexp_print(db_printf); |
1219 | } | | 1219 | } |
1220 | | | 1220 | |
1221 | #ifdef UVMHIST | | 1221 | #ifdef UVMHIST |
1222 | /*ARGSUSED*/ | | 1222 | /*ARGSUSED*/ |
| @@ -1250,27 +1250,27 @@ db_fncall(db_expr_t addr, bool have_addr | | | @@ -1250,27 +1250,27 @@ db_fncall(db_expr_t addr, bool have_addr |
1250 | db_expr_t fn_addr; | | 1250 | db_expr_t fn_addr; |
1251 | #define MAXARGS 11 | | 1251 | #define MAXARGS 11 |
1252 | db_expr_t args[MAXARGS]; | | 1252 | db_expr_t args[MAXARGS]; |
1253 | int nargs = 0; | | 1253 | int nargs = 0; |
1254 | db_expr_t retval; | | 1254 | db_expr_t retval; |
1255 | db_expr_t (*func)(db_expr_t, ...); | | 1255 | db_expr_t (*func)(db_expr_t, ...); |
1256 | int t; | | 1256 | int t; |
1257 | | | 1257 | |
1258 | if (!db_expression(&fn_addr)) { | | 1258 | if (!db_expression(&fn_addr)) { |
1259 | db_printf("Bad function\n"); | | 1259 | db_printf("Bad function\n"); |
1260 | db_flush_lex(); | | 1260 | db_flush_lex(); |
1261 | return; | | 1261 | return; |
1262 | } | | 1262 | } |
1263 | func = (db_expr_t (*)(db_expr_t, ...))(intptr_t) fn_addr; | | 1263 | func = (db_expr_t (*)(db_expr_t, ...))(uintptr_t) fn_addr; |
1264 | | | 1264 | |
1265 | t = db_read_token(); | | 1265 | t = db_read_token(); |
1266 | if (t == tLPAREN) { | | 1266 | if (t == tLPAREN) { |
1267 | if (db_expression(&args[0])) { | | 1267 | if (db_expression(&args[0])) { |
1268 | nargs++; | | 1268 | nargs++; |
1269 | while ((t = db_read_token()) == tCOMMA) { | | 1269 | while ((t = db_read_token()) == tCOMMA) { |
1270 | if (nargs == MAXARGS) { | | 1270 | if (nargs == MAXARGS) { |
1271 | db_printf("Too many arguments\n"); | | 1271 | db_printf("Too many arguments\n"); |
1272 | db_flush_lex(); | | 1272 | db_flush_lex(); |
1273 | return; | | 1273 | return; |
1274 | } | | 1274 | } |
1275 | if (!db_expression(&args[nargs])) { | | 1275 | if (!db_expression(&args[nargs])) { |
1276 | db_printf("Argument missing\n"); | | 1276 | db_printf("Argument missing\n"); |