summaryrefslogtreecommitdiff
path: root/ddb/db_print.c
diff options
context:
space:
mode:
Diffstat (limited to 'ddb/db_print.c')
-rw-r--r--ddb/db_print.c119
1 files changed, 64 insertions, 55 deletions
diff --git a/ddb/db_print.c b/ddb/db_print.c
index 832faf57..f08dd6ce 100644
--- a/ddb/db_print.c
+++ b/ddb/db_print.c
@@ -39,6 +39,9 @@
#include <kern/task.h>
#include <kern/thread.h>
#include <kern/queue.h>
+#include <kern/sched.h>
+#include <kern/processor.h>
+#include <kern/smp.h>
#include <ipc/ipc_port.h>
#include <ipc/ipc_space.h>
@@ -127,10 +130,10 @@ db_show_regs(
#define db_thread_fp_used(thread) FALSE
#endif
-char *
-db_thread_stat(thread, status)
- const thread_t thread;
- char *status;
+static char *
+db_thread_stat(
+ const thread_t thread,
+ char *status)
{
char *p = status;
@@ -219,10 +222,11 @@ db_print_thread(
}
} else {
if (flag & OPTION_INDENT)
- db_printf(" %3d (%0*X) ", thread_id,
- 2*sizeof(vm_offset_t), thread);
- else
- db_printf("(%0*X) ", 2*sizeof(vm_offset_t), thread);
+ db_printf(" %3d ", thread_id);
+ if (thread->name[0] &&
+ strncmp (thread->name, thread->task->name, THREAD_NAME_SIZE))
+ db_printf("%s ", thread->name);
+ db_printf("(%0*X) ", 2*sizeof(vm_offset_t), thread);
char status[8];
db_printf("%s", db_thread_stat(thread, status));
if (thread->state & TH_SWAPPED) {
@@ -244,7 +248,7 @@ db_print_thread(
}
}
-void
+static void
db_print_task(
task_t task,
int task_id,
@@ -329,13 +333,41 @@ db_show_all_tasks(db_expr_t addr,
}
}
+static void showrq(run_queue_t rq)
+{
+ db_printf("count(%d) low(%d)\n", rq->count, rq->low);
+}
+
+/*ARGSUSED*/
+void
+db_show_all_runqs(
+ db_expr_t addr,
+ boolean_t have_addr,
+ db_expr_t count,
+ const char * modif)
+{
+ int i = 0;
+ processor_set_t pset;
+
+ queue_iterate(&all_psets, pset, processor_set_t, all_psets) {
+ db_printf("Processor set #%d runq:\t", i);
+ showrq(&pset->runq);
+ i++;
+ }
+ for (i = 0; i < smp_get_numcpus(); i++) {
+ db_printf("Processor #%d runq:\t", i);
+ showrq(&cpu_to_processor(i)->runq);
+ }
+ db_printf("Stuck threads:\t%d", stuck_count);
+}
+
/*ARGSUSED*/
void
-db_show_all_threads(addr, have_addr, count, modif)
- db_expr_t addr;
- boolean_t have_addr;
- db_expr_t count;
- const char * modif;
+db_show_all_threads(
+ db_expr_t addr,
+ boolean_t have_addr,
+ db_expr_t count,
+ const char * modif)
{
task_t task;
int task_id;
@@ -384,11 +416,11 @@ db_task_from_space(
/*ARGSUSED*/
void
-db_show_one_thread(addr, have_addr, count, modif)
- db_expr_t addr;
- boolean_t have_addr;
- db_expr_t count;
- const char * modif;
+db_show_one_thread(
+ db_expr_t addr,
+ boolean_t have_addr,
+ db_expr_t count,
+ const char * modif)
{
int flag;
int thread_id;
@@ -432,11 +464,11 @@ db_show_one_thread(addr, have_addr, count, modif)
/*ARGSUSED*/
void
-db_show_one_task(addr, have_addr, count, modif)
- db_expr_t addr;
- boolean_t have_addr;
- db_expr_t count;
- const char * modif;
+db_show_one_task(
+ db_expr_t addr,
+ boolean_t have_addr,
+ db_expr_t count,
+ const char * modif)
{
int flag;
int task_id;
@@ -466,10 +498,8 @@ db_show_one_task(addr, have_addr, count, modif)
db_print_task(task, task_id, flag);
}
-int
-db_port_iterate(thread, func)
- const thread_t thread;
- void (*func)();
+static int
+db_port_iterate(const thread_t thread, void (*func)(int, const ipc_port_t, unsigned, int))
{
ipc_entry_t entry;
int n = 0;
@@ -482,29 +512,8 @@ db_port_iterate(thread, func)
return(n);
}
-ipc_port_t
-db_lookup_port(
- thread_t thread,
- int id)
-{
- ipc_entry_t entry;
-
- if (thread == THREAD_NULL)
- return(0);
- if (id < 0)
- return(0);
- entry = ipc_entry_lookup(thread->task->itk_space, (mach_port_t) id);
- if (entry && entry->ie_bits & MACH_PORT_TYPE_PORT_RIGHTS)
- return((ipc_port_t)entry->ie_object);
- return(0);
-}
-
static void
-db_print_port_id(id, port, bits, n)
- int id;
- const ipc_port_t port;
- unsigned bits;
- int n;
+db_print_port_id(int id, const ipc_port_t port, unsigned bits, int n)
{
if (n != 0 && n % 3 == 0)
db_printf("\n");
@@ -530,11 +539,11 @@ db_print_port_id_long(
/* ARGSUSED */
void
-db_show_port_id(addr, have_addr, count, modif)
- db_expr_t addr;
- boolean_t have_addr;
- db_expr_t count;
- const char * modif;
+db_show_port_id(
+ db_expr_t addr,
+ boolean_t have_addr,
+ db_expr_t count,
+ const char * modif)
{
thread_t thread;