Changeset 76fca31 in mainline for kernel/arch/amd64/src/debugger.c
- Timestamp:
- 2008-12-16T19:02:07Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5ae4443
- Parents:
- 8fe5980
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/debugger.c
r8fe5980 r76fca31 55 55 SPINLOCK_INITIALIZE(bkpoint_lock); 56 56 57 #ifdef CONFIG_KCONSOLE 58 57 59 static int cmd_print_breakpoints(cmd_arg_t *argv); 58 60 static cmd_info_t bkpts_info = { … … 100 102 }; 101 103 102 #endif 103 104 /** Print table of active breakpoints */ 105 int cmd_print_breakpoints(cmd_arg_t *argv __attribute__((unused))) 106 { 107 unsigned int i; 108 char *symbol; 109 110 #ifdef __32_BITS__ 111 printf("# Count Address In symbol\n"); 112 printf("-- ----- ---------- ---------\n"); 113 #endif 114 115 #ifdef __64_BITS__ 116 printf("# Count Address In symbol\n"); 117 printf("-- ----- ------------------ ---------\n"); 118 #endif 119 120 for (i = 0; i < BKPOINTS_MAX; i++) 121 if (breakpoints[i].address) { 122 symbol = get_symtab_entry(breakpoints[i].address); 123 124 #ifdef __32_BITS__ 125 printf("%-2u %-5d %#10zx %s\n", i, 126 breakpoints[i].counter, breakpoints[i].address, 127 symbol); 128 #endif 129 130 #ifdef __64_BITS__ 131 printf("%-2u %-5d %#18zx %s\n", i, 132 breakpoints[i].counter, breakpoints[i].address, 133 symbol); 134 #endif 135 136 } 137 return 1; 138 } 104 #endif /* CONFIG_DEBUG_AS_WATCHPOINT */ 105 #endif /* CONFIG_KCONSOLE */ 139 106 140 107 /* Setup DR register according to table */ … … 268 235 printf("Reached breakpoint %d:%lx(%s)\n", slot, getip(istate), 269 236 get_symtab_entry(getip(istate))); 270 printf("***Type 'exit' to exit kconsole.\n"); 271 atomic_set(&haltstate,1); 272 kconsole((void *) "debug"); 273 atomic_set(&haltstate,0); 237 238 #ifdef CONFIG_KCONSOLE 239 atomic_set(&haltstate, 1); 240 kconsole("debug", "Debug console ready (type 'exit' to continue)\n", false); 241 atomic_set(&haltstate, 0); 242 #endif 274 243 } 275 244 … … 300 269 } 301 270 302 #ifndef CONFIG_DEBUG_AS_WATCHPOINT 303 304 /** Remove breakpoint from table */ 305 int cmd_del_breakpoint(cmd_arg_t *argv) 306 { 307 unative_t bpno = argv->intval; 308 if (bpno > BKPOINTS_MAX) { 309 printf("Invalid breakpoint number.\n"); 310 return 0; 311 } 312 breakpoint_del(argv->intval); 313 return 1; 314 } 315 316 /** Add new breakpoint to table */ 317 static int cmd_add_breakpoint(cmd_arg_t *argv) 318 { 319 int flags; 320 int id; 321 322 if (argv == &add_argv) { 323 flags = BKPOINT_INSTR; 324 } else { /* addwatchp */ 325 flags = BKPOINT_WRITE; 326 } 327 printf("Adding breakpoint on address: %p\n", argv->intval); 328 id = breakpoint_add((void *)argv->intval, flags, -1); 329 if (id < 0) 330 printf("Add breakpoint failed.\n"); 331 else 332 printf("Added breakpoint %d.\n", id); 333 334 return 1; 335 } 336 #endif 271 337 272 338 273 static void debug_exception(int n __attribute__((unused)), istate_t *istate) … … 380 315 for (i = 0; i < BKPOINTS_MAX; i++) 381 316 breakpoints[i].address = NULL; 382 317 318 #ifdef CONFIG_KCONSOLE 383 319 cmd_initialize(&bkpts_info); 384 320 if (!cmd_register(&bkpts_info)) 385 p anic("couldnot register command %s\n", bkpts_info.name);321 printf("Cannot register command %s\n", bkpts_info.name); 386 322 387 323 #ifndef CONFIG_DEBUG_AS_WATCHPOINT 388 324 cmd_initialize(&delbkpt_info); 389 325 if (!cmd_register(&delbkpt_info)) 390 p anic("couldnot register command %s\n", delbkpt_info.name);326 printf("Cannot register command %s\n", delbkpt_info.name); 391 327 392 328 cmd_initialize(&addbkpt_info); 393 329 if (!cmd_register(&addbkpt_info)) 394 p anic("couldnot register command %s\n", addbkpt_info.name);330 printf("Cannot register command %s\n", addbkpt_info.name); 395 331 396 332 cmd_initialize(&addwatchp_info); 397 333 if (!cmd_register(&addwatchp_info)) 398 panic("could not register command %s\n", addwatchp_info.name); 399 #endif 334 printf("Cannot register command %s\n", addwatchp_info.name); 335 #endif /* CONFIG_DEBUG_AS_WATCHPOINT */ 336 #endif /* CONFIG_KCONSOLE */ 400 337 401 338 exc_register(VECTOR_DEBUG, "debugger", debug_exception); … … 405 342 } 406 343 344 #ifdef CONFIG_KCONSOLE 345 /** Print table of active breakpoints */ 346 int cmd_print_breakpoints(cmd_arg_t *argv __attribute__((unused))) 347 { 348 unsigned int i; 349 char *symbol; 350 351 #ifdef __32_BITS__ 352 printf("# Count Address In symbol\n"); 353 printf("-- ----- ---------- ---------\n"); 354 #endif 355 356 #ifdef __64_BITS__ 357 printf("# Count Address In symbol\n"); 358 printf("-- ----- ------------------ ---------\n"); 359 #endif 360 361 for (i = 0; i < BKPOINTS_MAX; i++) 362 if (breakpoints[i].address) { 363 symbol = get_symtab_entry(breakpoints[i].address); 364 365 #ifdef __32_BITS__ 366 printf("%-2u %-5d %#10zx %s\n", i, 367 breakpoints[i].counter, breakpoints[i].address, 368 symbol); 369 #endif 370 371 #ifdef __64_BITS__ 372 printf("%-2u %-5d %#18zx %s\n", i, 373 breakpoints[i].counter, breakpoints[i].address, 374 symbol); 375 #endif 376 377 } 378 return 1; 379 } 380 381 #ifndef CONFIG_DEBUG_AS_WATCHPOINT 382 383 /** Remove breakpoint from table */ 384 int cmd_del_breakpoint(cmd_arg_t *argv) 385 { 386 unative_t bpno = argv->intval; 387 if (bpno > BKPOINTS_MAX) { 388 printf("Invalid breakpoint number.\n"); 389 return 0; 390 } 391 breakpoint_del(argv->intval); 392 return 1; 393 } 394 395 /** Add new breakpoint to table */ 396 static int cmd_add_breakpoint(cmd_arg_t *argv) 397 { 398 int flags; 399 int id; 400 401 if (argv == &add_argv) { 402 flags = BKPOINT_INSTR; 403 } else { /* addwatchp */ 404 flags = BKPOINT_WRITE; 405 } 406 printf("Adding breakpoint on address: %p\n", argv->intval); 407 id = breakpoint_add((void *)argv->intval, flags, -1); 408 if (id < 0) 409 printf("Add breakpoint failed.\n"); 410 else 411 printf("Added breakpoint %d.\n", id); 412 413 return 1; 414 } 415 #endif /* CONFIG_DEBUG_AS_WATCHPOINT */ 416 #endif /* CONFIG_KCONSOLE */ 417 407 418 /** @} 408 419 */
Note:
See TracChangeset
for help on using the changeset viewer.