]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/jdb/jdb_thread.cpp
Inital import
[l4.git] / kernel / fiasco / src / jdb / jdb_thread.cpp
1 INTERFACE:
2
3 #include "thread.h"
4
5 class Jdb_thread
6 {
7 };
8
9 IMPLEMENTATION:
10
11 #include "irq.h"
12 #include "jdb_kobject.h"
13 #include "thread_state.h"
14 #include "vlog.h"
15
16 #include <cstdio>
17
18 PUBLIC static
19 void
20 Jdb_thread::print_snd_partner(Thread *t, int task_format = 0)
21 {
22   if (t->state() & Thread_send_in_progress)
23     Jdb_kobject::print_uid(t->lookup(static_cast<Thread*>(t->receiver())), task_format);
24   else
25     // receiver() not valid
26     putstr("       ");
27 }
28
29 PUBLIC static
30 void
31 Jdb_thread::print_partner(Thread *t, int task_format = 0)
32 {
33   Thread *p;
34   Kobject *o;
35
36   if (!(t->state() & (Thread_receiving | Thread_busy)))
37     {
38       printf("%*s ", task_format, " ");
39       return;
40     }
41
42   if (!t->partner())
43     {
44       printf("%*s ", task_format, "-");
45       return;
46     }
47
48   // the Thread* cast is not good because we actually need to have a dynamic
49   // cast but we don't have this here in this environment. Luckily the cast
50   // works...
51   if (Kobject::is_kobj(p = static_cast<Thread*>(t->partner())))
52     {
53       char flag = ' ';
54       printf("%*.lx%c", task_format, p->dbg_id(), flag);
55     }
56   else if ((o = Kobject::pointer_to_obj(t->partner())))
57     printf("%*.lx*", task_format, o->dbg_id());
58   else
59     printf("\033[31;1m%p\033[m ", t->partner());
60 }