Replaced all dprintf() calls from the kernel debugger with kprintf() calls.

(there might be some more left, but it's not urgent or fatal)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13884 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-08-02 16:28:20 +00:00
parent 8b45467cd0
commit 8fef8adb6e
4 changed files with 77 additions and 77 deletions
+17 -17
View File
@@ -64,28 +64,28 @@ stack_trace(int argc, char **argv)
else else
frameStack = &gBootFrameStack; frameStack = &gBootFrameStack;
} else { } else {
dprintf("not supported\n"); kprintf("not supported\n");
return 0; return 0;
} }
for (i = 0; i < frameStack->index; i++) { for (i = 0; i < frameStack->index; i++) {
dprintf("iframe %p (end = %p)\n", kprintf("iframe %p (end = %p)\n",
frameStack->frames[i], frameStack->frames[i] + 1); frameStack->frames[i], frameStack->frames[i] + 1);
} }
// We don't have a thread pointer early in the boot process // We don't have a thread pointer early in the boot process
if (thread != NULL) { if (thread != NULL) {
dprintf("stack trace for thread 0x%lx \"%s\"\n", thread->id, thread->name); kprintf("stack trace for thread 0x%lx \"%s\"\n", thread->id, thread->name);
dprintf(" kernel stack: %p to %p\n", kprintf(" kernel stack: %p to %p\n",
(void *)thread->kernel_stack_base, (void *)(thread->kernel_stack_base + KERNEL_STACK_SIZE)); (void *)thread->kernel_stack_base, (void *)(thread->kernel_stack_base + KERNEL_STACK_SIZE));
if (thread->user_stack_base != 0) { if (thread->user_stack_base != 0) {
dprintf(" user stack: %p to %p\n", (void *)thread->user_stack_base, kprintf(" user stack: %p to %p\n", (void *)thread->user_stack_base,
(void *)(thread->user_stack_base + thread->user_stack_size)); (void *)(thread->user_stack_base + thread->user_stack_size));
} }
} }
dprintf("frame caller <image>:function + offset\n"); kprintf("frame caller <image>:function + offset\n");
read_ebp(ebp); read_ebp(ebp);
for (;;) { for (;;) {
@@ -101,18 +101,18 @@ stack_trace(int argc, char **argv)
if (isIFrame) { if (isIFrame) {
struct iframe *frame = (struct iframe *)(ebp + 8); struct iframe *frame = (struct iframe *)(ebp + 8);
dprintf("iframe at %p\n", frame); kprintf("iframe at %p\n", frame);
dprintf(" eax 0x%-9x ebx 0x%-9x ecx 0x%-9x edx 0x%x\n", kprintf(" eax 0x%-9x ebx 0x%-9x ecx 0x%-9x edx 0x%x\n",
frame->eax, frame->ebx, frame->ecx, frame->edx); frame->eax, frame->ebx, frame->ecx, frame->edx);
dprintf(" esi 0x%-9x edi 0x%-9x ebp 0x%-9x esp 0x%x\n", kprintf(" esi 0x%-9x edi 0x%-9x ebp 0x%-9x esp 0x%x\n",
frame->esi, frame->edi, frame->ebp, frame->esp); frame->esi, frame->edi, frame->ebp, frame->esp);
dprintf(" eip 0x%-9x eflags 0x%-9x", frame->eip, frame->flags); kprintf(" eip 0x%-9x eflags 0x%-9x", frame->eip, frame->flags);
if ((frame->error_code & 0x4) != 0) { if ((frame->error_code & 0x4) != 0) {
// from user space // from user space
dprintf("user esp 0x%x", frame->user_esp); kprintf("user esp 0x%x", frame->user_esp);
} }
dprintf("\n"); kprintf("\n");
dprintf(" vector: 0x%x, error code: 0x%x\n", frame->vector, frame->error_code); kprintf(" vector: 0x%x, error code: 0x%x\n", frame->vector, frame->error_code);
ebp = frame->ebp; ebp = frame->ebp;
} else { } else {
addr_t eip = ((struct stack_frame *)ebp)->return_address; addr_t eip = ((struct stack_frame *)ebp)->return_address;
@@ -128,20 +128,20 @@ stack_trace(int argc, char **argv)
if (elf_lookup_symbol_address(eip, &baseAddress, &symbol, if (elf_lookup_symbol_address(eip, &baseAddress, &symbol,
&image, &exactMatch) == B_OK) { &image, &exactMatch) == B_OK) {
if (symbol != NULL) { if (symbol != NULL) {
dprintf("%08lx (+%4ld) %08lx <%s>:%s + 0x%04lx%s\n", ebp, diff, eip, kprintf("%08lx (+%4ld) %08lx <%s>:%s + 0x%04lx%s\n", ebp, diff, eip,
image, symbol, eip - baseAddress, exactMatch ? "" : " (nearest)"); image, symbol, eip - baseAddress, exactMatch ? "" : " (nearest)");
} else { } else {
dprintf("%08lx (+%4ld) %08lx <%s@%p>:unknown + 0x%04lx\n", ebp, diff, eip, kprintf("%08lx (+%4ld) %08lx <%s@%p>:unknown + 0x%04lx\n", ebp, diff, eip,
image, (void *)baseAddress, eip - baseAddress); image, (void *)baseAddress, eip - baseAddress);
} }
} else } else
dprintf("%08lx %08lx\n", ebp, eip); kprintf("%08lx %08lx\n", ebp, eip);
ebp = nextEbp; ebp = nextEbp;
} }
if (already_visited(previousLocations, &last, &num, ebp)) { if (already_visited(previousLocations, &last, &num, ebp)) {
dprintf("circular stack frame: %p!\n", (void *)ebp); kprintf("circular stack frame: %p!\n", (void *)ebp);
break; break;
} }
if (ebp == 0) if (ebp == 0)
+39 -39
View File
@@ -148,17 +148,17 @@ dump_address_info(int argc, char **argv)
addr_t address, baseAddress; addr_t address, baseAddress;
if (argc < 2) { if (argc < 2) {
dprintf("not enough arguments\n"); kprintf("not enough arguments\n");
return 0; return 0;
} }
address = strtoul(argv[1], NULL, 16); address = strtoul(argv[1], NULL, 16);
if (elf_lookup_symbol_address(address, &baseAddress, &symbol, &imageName, &exactMatch) == B_OK) { if (elf_lookup_symbol_address(address, &baseAddress, &symbol, &imageName, &exactMatch) == B_OK) {
dprintf("%p = %s + 0x%lx (%s)%s\n", (void *)address, symbol, address - baseAddress, kprintf("%p = %s + 0x%lx (%s)%s\n", (void *)address, symbol, address - baseAddress,
imageName, exactMatch ? "" : " (nearest)"); imageName, exactMatch ? "" : " (nearest)");
} else } else
dprintf("There is no image loaded at this address!\n"); kprintf("There is no image loaded at this address!\n");
return 0; return 0;
} }
@@ -281,11 +281,11 @@ dump_symbols(int argc, char **argv)
hash_close(sImagesHash, &iterator, false); hash_close(sImagesHash, &iterator, false);
if (image == NULL) if (image == NULL)
dprintf("No image covers 0x%lx in the kernel!\n", num); kprintf("No image covers 0x%lx in the kernel!\n", num);
} else { } else {
image = hash_lookup(sImagesHash, (void *)num); image = hash_lookup(sImagesHash, (void *)num);
if (image == NULL) if (image == NULL)
dprintf("image 0x%lx doesn't exist in the kernel!\n", num); kprintf("image 0x%lx doesn't exist in the kernel!\n", num);
} }
} else { } else {
// look for image by name // look for image by name
@@ -297,10 +297,10 @@ dump_symbols(int argc, char **argv)
hash_close(sImagesHash, &iterator, false); hash_close(sImagesHash, &iterator, false);
if (image == NULL) if (image == NULL)
dprintf("No image \"%s\" found in kernel!\n", argv[1]); kprintf("No image \"%s\" found in kernel!\n", argv[1]);
} }
} else { } else {
dprintf("usage: %s image_name/image_id/address_in_image\n", argv[0]); kprintf("usage: %s image_name/image_id/address_in_image\n", argv[0]);
return 0; return 0;
} }
@@ -309,7 +309,7 @@ dump_symbols(int argc, char **argv)
// dump symbols // dump symbols
dprintf("Symbols of image %ld \"%s\":\nAddress Type Size Name\n", image->id, image->name); kprintf("Symbols of image %ld \"%s\":\nAddress Type Size Name\n", image->id, image->name);
if (image->num_debug_symbols > 0) { if (image->num_debug_symbols > 0) {
// search extended debug symbol table (contains static symbols) // search extended debug symbol table (contains static symbols)
@@ -320,7 +320,7 @@ dump_symbols(int argc, char **argv)
|| symbol->st_size >= image->text_region.size + image->data_region.size) || symbol->st_size >= image->text_region.size + image->data_region.size)
continue; continue;
dprintf("%08lx %s/%s %5ld %s\n", symbol->st_value + image->text_region.delta, kprintf("%08lx %s/%s %5ld %s\n", symbol->st_value + image->text_region.delta,
get_symbol_type_string(symbol), get_symbol_bind_string(symbol), symbol->st_size, get_symbol_type_string(symbol), get_symbol_bind_string(symbol), symbol->st_size,
image->debug_string_table + symbol->st_name); image->debug_string_table + symbol->st_name);
} }
@@ -336,7 +336,7 @@ dump_symbols(int argc, char **argv)
|| symbol->st_size >= image->text_region.size + image->data_region.size) || symbol->st_size >= image->text_region.size + image->data_region.size)
continue; continue;
dprintf("%08lx %s/%s %5ld %s\n", symbol->st_value + image->text_region.delta, kprintf("%08lx %s/%s %5ld %s\n", symbol->st_value + image->text_region.delta,
get_symbol_type_string(symbol), get_symbol_bind_string(symbol), get_symbol_type_string(symbol), get_symbol_bind_string(symbol),
symbol->st_size, SYMNAME(image, symbol)); symbol->st_size, SYMNAME(image, symbol));
} }
@@ -350,34 +350,34 @@ dump_symbols(int argc, char **argv)
static void static void
dump_elf_region(struct elf_region *region, const char *name) dump_elf_region(struct elf_region *region, const char *name)
{ {
dprintf(" %s.id 0x%lx\n", name, region->id); kprintf(" %s.id 0x%lx\n", name, region->id);
dprintf(" %s.start 0x%lx\n", name, region->start); kprintf(" %s.start 0x%lx\n", name, region->start);
dprintf(" %s.size 0x%lx\n", name, region->size); kprintf(" %s.size 0x%lx\n", name, region->size);
dprintf(" %s.delta %ld\n", name, region->delta); kprintf(" %s.delta %ld\n", name, region->delta);
} }
static void static void
dump_image_info(struct elf_image_info *image) dump_image_info(struct elf_image_info *image)
{ {
dprintf("elf_image_info at %p:\n", image); kprintf("elf_image_info at %p:\n", image);
dprintf(" next %p\n", image->next); kprintf(" next %p\n", image->next);
dprintf(" id 0x%lx\n", image->id); kprintf(" id 0x%lx\n", image->id);
dump_elf_region(&image->text_region, "text"); dump_elf_region(&image->text_region, "text");
dump_elf_region(&image->data_region, "data"); dump_elf_region(&image->data_region, "data");
dprintf(" dynamic_ptr 0x%lx\n", image->dynamic_ptr); kprintf(" dynamic_ptr 0x%lx\n", image->dynamic_ptr);
dprintf(" needed %p\n", image->needed); kprintf(" needed %p\n", image->needed);
dprintf(" symhash %p\n", image->symhash); kprintf(" symhash %p\n", image->symhash);
dprintf(" syms %p\n", image->syms); kprintf(" syms %p\n", image->syms);
dprintf(" strtab %p\n", image->strtab); kprintf(" strtab %p\n", image->strtab);
dprintf(" rel %p\n", image->rel); kprintf(" rel %p\n", image->rel);
dprintf(" rel_len 0x%x\n", image->rel_len); kprintf(" rel_len 0x%x\n", image->rel_len);
dprintf(" rela %p\n", image->rela); kprintf(" rela %p\n", image->rela);
dprintf(" rela_len 0x%x\n", image->rela_len); kprintf(" rela_len 0x%x\n", image->rela_len);
dprintf(" pltrel %p\n", image->pltrel); kprintf(" pltrel %p\n", image->pltrel);
dprintf(" pltrel_len 0x%x\n", image->pltrel_len); kprintf(" pltrel_len 0x%x\n", image->pltrel_len);
dprintf(" debug_symbols %p (%ld)\n", image->debug_symbols, image->num_debug_symbols); kprintf(" debug_symbols %p (%ld)\n", image->debug_symbols, image->num_debug_symbols);
} }
@@ -397,19 +397,19 @@ dump_image(int argc, char **argv)
} else { } else {
image = hash_lookup(sImagesHash, (void *)num); image = hash_lookup(sImagesHash, (void *)num);
if (image == NULL) if (image == NULL)
dprintf("image 0x%lx doesn't exist in the kernel!\n", num); kprintf("image 0x%lx doesn't exist in the kernel!\n", num);
else else
dump_image_info(image); dump_image_info(image);
} }
return 0; return 0;
} }
dprintf("loaded kernel images:\n"); kprintf("loaded kernel images:\n");
hash_open(sImagesHash, &iterator); hash_open(sImagesHash, &iterator);
while ((image = hash_next(sImagesHash, &iterator)) != NULL) { while ((image = hash_next(sImagesHash, &iterator)) != NULL) {
dprintf("%p (%ld) %s\n", image, image->id, image->name); kprintf("%p (%ld) %s\n", image, image->id, image->name);
} }
hash_close(sImagesHash, &iterator, false); hash_close(sImagesHash, &iterator, false);
@@ -423,14 +423,14 @@ static
void dump_symbol(struct elf_image_info *image, struct Elf32_Sym *sym) void dump_symbol(struct elf_image_info *image, struct Elf32_Sym *sym)
{ {
dprintf("symbol at %p, in image %p\n", sym, image); kprintf("symbol at %p, in image %p\n", sym, image);
dprintf(" name index %d, '%s'\n", sym->st_name, SYMNAME(image, sym)); kprintf(" name index %d, '%s'\n", sym->st_name, SYMNAME(image, sym));
dprintf(" st_value 0x%x\n", sym->st_value); kprintf(" st_value 0x%x\n", sym->st_value);
dprintf(" st_size %d\n", sym->st_size); kprintf(" st_size %d\n", sym->st_size);
dprintf(" st_info 0x%x\n", sym->st_info); kprintf(" st_info 0x%x\n", sym->st_info);
dprintf(" st_other 0x%x\n", sym->st_other); kprintf(" st_other 0x%x\n", sym->st_other);
dprintf(" st_shndx %d\n", sym->st_shndx); kprintf(" st_shndx %d\n", sym->st_shndx);
} }
#endif #endif
+10 -10
View File
@@ -222,7 +222,7 @@ dump_port_list(int argc, char **argv)
for (i = 0; i < sMaxPorts; i++) { for (i = 0; i < sMaxPorts; i++) {
if (sPorts[i].id >= 0) if (sPorts[i].id >= 0)
dprintf("%p\tid: 0x%lx\t\tname: '%s'\n", &sPorts[i], sPorts[i].id, sPorts[i].name); kprintf("%p\tid: 0x%lx\t\tname: '%s'\n", &sPorts[i], sPorts[i].id, sPorts[i].name);
} }
return 0; return 0;
} }
@@ -233,15 +233,15 @@ _dump_port_info(struct port_entry *port)
{ {
int32 count; int32 count;
dprintf("PORT: %p\n", port); kprintf("PORT: %p\n", port);
dprintf(" name: \"%s\"\n", port->name); kprintf(" name: \"%s\"\n", port->name);
dprintf(" owner: %#lx\n", port->owner); kprintf(" owner: %#lx\n", port->owner);
dprintf(" capacity: %ld\n", port->capacity); kprintf(" capacity: %ld\n", port->capacity);
get_sem_count(port->read_sem, &count); get_sem_count(port->read_sem, &count);
dprintf(" read sem count: %ld\n", count); kprintf(" read sem count: %ld\n", count);
get_sem_count(port->write_sem, &count); get_sem_count(port->write_sem, &count);
dprintf(" write sem count: %ld\n", count); kprintf(" write sem count: %ld\n", count);
dprintf(" total count: %ld\n", port->total_count); kprintf(" total count: %ld\n", port->total_count);
} }
@@ -251,7 +251,7 @@ dump_port_info(int argc, char **argv)
int i; int i;
if (argc < 2) { if (argc < 2) {
dprintf("usage: port [id|name|address]\n"); kprintf("usage: port [id|name|address]\n");
return 0; return 0;
} }
@@ -267,7 +267,7 @@ dump_port_info(int argc, char **argv)
} else { } else {
unsigned slot = num % sMaxPorts; unsigned slot = num % sMaxPorts;
if (sPorts[slot].id != (int)num) { if (sPorts[slot].id != (int)num) {
dprintf("port 0x%lx doesn't exist!\n", num); kprintf("port 0x%lx doesn't exist!\n", num);
return 0; return 0;
} }
_dump_port_info(&sPorts[slot]); _dump_port_info(&sPorts[slot]);
+11 -11
View File
@@ -86,7 +86,7 @@ dump_sem_list(int argc, char **argv)
for (i = 0; i < sMaxSems; i++) { for (i = 0; i < sMaxSems; i++) {
if (sSems[i].id >= 0) if (sSems[i].id >= 0)
dprintf("%p\tid: 0x%lx\t\tname: '%s'\n", &sSems[i], sSems[i].id, kprintf("%p\tid: 0x%lx\t\tname: '%s'\n", &sSems[i], sSems[i].id,
sSems[i].u.used.name); sSems[i].u.used.name);
} }
return 0; return 0;
@@ -96,17 +96,17 @@ dump_sem_list(int argc, char **argv)
static void static void
dump_sem(struct sem_entry *sem) dump_sem(struct sem_entry *sem)
{ {
dprintf("SEM: %p\n", sem); kprintf("SEM: %p\n", sem);
dprintf("id: %ld\n", sem->id); kprintf("id: %ld\n", sem->id);
if (sem->id >= 0) { if (sem->id >= 0) {
dprintf("name: '%s'\n", sem->u.used.name); kprintf("name: '%s'\n", sem->u.used.name);
dprintf("owner: 0x%lx\n", sem->u.used.owner); kprintf("owner: 0x%lx\n", sem->u.used.owner);
dprintf("count: 0x%x\n", sem->u.used.count); kprintf("count: 0x%x\n", sem->u.used.count);
dprintf("queue: head %p tail %p\n", sem->u.used.queue.head, kprintf("queue: head %p tail %p\n", sem->u.used.queue.head,
sem->u.used.queue.tail); sem->u.used.queue.tail);
} else { } else {
dprintf("next: %p\n", sem->u.unused.next); kprintf("next: %p\n", sem->u.unused.next);
dprintf("next_id: %ld\n", sem->u.unused.next_id); kprintf("next_id: %ld\n", sem->u.unused.next_id);
} }
} }
@@ -117,7 +117,7 @@ dump_sem_info(int argc, char **argv)
int i; int i;
if (argc < 2) { if (argc < 2) {
dprintf("sem: not enough arguments\n"); kprintf("sem: not enough arguments\n");
return 0; return 0;
} }
@@ -132,7 +132,7 @@ dump_sem_info(int argc, char **argv)
} else { } else {
unsigned slot = num % sMaxSems; unsigned slot = num % sMaxSems;
if (sSems[slot].id != (int)num) { if (sSems[slot].id != (int)num) {
dprintf("sem 0x%lx doesn't exist!\n", num); kprintf("sem 0x%lx doesn't exist!\n", num);
return 0; return 0;
} }
dump_sem(&sSems[slot]); dump_sem(&sSems[slot]);