9 #include "jdb_module.h"
10 #include "jdb_screen.h"
11 #include "jdb_kobject.h"
12 #include "kernel_console.h"
15 #include "static_init.h"
16 #include "u_semaphore.h"
18 class Jdb_semaphore : public Jdb_kobject_handler
21 Jdb_semaphore() FIASCO_INIT;
25 Jdb_semaphore::Jdb_semaphore()
26 : Jdb_kobject_handler(U_semaphore::static_kobj_type)
28 Jdb_kobject::module()->register_handler(this);
33 Jdb_semaphore::show_kobject(Kobject_common *, int )
40 Jdb_semaphore::kobject_type() const
42 return JDB_ANSI_COLOR(yellow) "Sem" JDB_ANSI_COLOR(default);
47 Jdb_semaphore::show_kobject_short(char *buf, int max, Kobject_common *o)
49 U_semaphore *u = Kobject::dcast<U_semaphore*>(o);
50 Prio_list_elem *p = u->_queue.head();
53 return snprintf(buf, max, " no waiters");
55 int len = snprintf(buf, max, " blocked=");
58 Prio_list_elem *s = p->_s_next;
61 Thread *t = static_cast<Thread *>(Sender::cast(s));
62 len += snprintf(buf + len, max - len,
63 "%s%lx", s == p ? "" : ",", t->dbg_info()->dbg_id());
71 static Jdb_semaphore jdb_semaphore INIT_PRIORITY(JDB_MODULE_INIT_PRIO);