static int dump_int_load(int argc, char** argv) { static const char* typeNames[] = { "exception", "irq", "local irq", "syscall", "ici", "unknown" }; for (int i = 0; i < NUM_IO_VECTORS; i++) { if (!B_SPINLOCK_IS_LOCKED(&sVectors[i].vector_lock) && sVectors[i].handler_list == NULL && sVectors[i].enable_count == 0) continue; kprintf("int %3d, type %s, enabled %" B_PRId32 ", load %" B_PRId32 "%%", i, typeNames[min_c(sVectors[i].type, INTERRUPT_TYPE_UNKNOWN)], sVectors[i].enable_count, sVectors[i].assigned_cpu != NULL ? sVectors[i].assigned_cpu->load / 10 : 0); if (sVectors[i].type == INTERRUPT_TYPE_IRQ) { ASSERT(sVectors[i].assigned_cpu != NULL); if (sVectors[i].assigned_cpu->cpu != -1) kprintf(", cpu %" B_PRId32, sVectors[i].assigned_cpu->cpu); else kprintf(", cpu -"); } if (B_SPINLOCK_IS_LOCKED(&sVectors[i].vector_lock)) kprintf(", ACTIVE"); kprintf("\n"); } return 0; }
static int dump_int_statistics(int argc, char **argv) { int i; for (i = 0; i < NUM_IO_VECTORS; i++) { struct io_handler *io; if (!B_SPINLOCK_IS_LOCKED(&sVectors[i].vector_lock) && sVectors[i].enable_count == 0 && sVectors[i].handled_count == 0 && sVectors[i].unhandled_count == 0 && sVectors[i].handler_list == NULL) continue; kprintf("int %3d, enabled %ld, handled %8lld, unhandled %8lld%s%s\n", i, sVectors[i].enable_count, sVectors[i].handled_count, sVectors[i].unhandled_count, B_SPINLOCK_IS_LOCKED(&sVectors[i].vector_lock) ? ", ACTIVE" : "", sVectors[i].handler_list == NULL ? ", no handler" : ""); for (io = sVectors[i].handler_list; io != NULL; io = io->next) { const char *symbol, *imageName; bool exactMatch; status_t error = elf_debug_lookup_symbol_address((addr_t)io->func, NULL, &symbol, &imageName, &exactMatch); if (error == B_OK && exactMatch) { if (strchr(imageName, '/') != NULL) imageName = strrchr(imageName, '/') + 1; int length = 4 + strlen(imageName); kprintf(" %s:%-*s (%p)", imageName, 45 - length, symbol, io->func); } else kprintf("\t\t\t\t\t func %p", io->func); kprintf(", data %p, handled ", io->data); if (io->no_handled_info) kprintf("<unknown>\n"); else kprintf("%8lld\n", io->handled_count); } kprintf("\n"); } return 0; }
int dump_spinlock(int argc, char** argv) { if (argc != 2) { print_debugger_command_usage(argv[0]); return 0; } uint64 address; if (!evaluate_debug_expression(argv[1], &address, false)) return 0; spinlock* lock = (spinlock*)(addr_t)address; kprintf("spinlock %p:\n", lock); bool locked = B_SPINLOCK_IS_LOCKED(lock); if (locked) { kprintf(" locked from %p\n", find_lock_caller(lock)); } else kprintf(" not locked\n"); return 0; }