7 #include "jdb_screen.h"
9 #include "jdb_kobject.h"
10 #include "kernel_console.h"
15 #include "thread_object.h"
16 #include "static_init.h"
20 class Jdb_obj_space : public Jdb_table, public Jdb_kobject_handler
36 bool show_kobject(Kobject *, int) { return false; }
42 operator ++ (Jdb_obj_space::Mode &m)
46 if (_m >= Jdb_obj_space::End_mode)
49 m = Jdb_obj_space::Mode(_m);
54 //char Jdb_obj_space_m::first_char;
57 Jdb_obj_space::Jdb_obj_space(Address base = 0, int level = 0)
58 : Jdb_kobject_handler(0),
64 Jdb_kobject::module()->register_handler(this);
69 Jdb_obj_space::col_width(unsigned column) const
72 return Jdb_screen::Col_head_size;
79 Jdb_obj_space::cols() const
86 Jdb_obj_space::rows() const
87 { return Obj_space::Map_max_address / (cols()-1); }
91 Jdb_obj_space::print_statline(unsigned long row, unsigned long col)
96 Kobject_iface *o = item(index(row,col), &rights);
99 Jdb::printf_statline("objs", "<Space>=mode", "%lx: -- INVALID --",
104 unsigned len = Jdb_kobject::obj_description(buf, sizeof(buf), true, o->kobject());
105 Jdb::printf_statline("objs", "<Space>=mode",
106 "%lx: %-*s", index(row,col), len, buf);
111 Jdb_obj_space::print_entry(Address entry)
114 Kobject_iface *o = item(entry, &rights);
126 case L4_fpage::WX: r = '*'; break;
127 case L4_fpage::W: r = 'w'; break;
128 case L4_fpage::X: r = 'x'; break;
130 printf("%05lx%c %-*s", o->dbg_info()->dbg_id(), r, 9, Jdb_kobject::kobject_type(o));
134 printf("%16lx", Mword(o) | rights);
142 Jdb_obj_space::draw_entry(unsigned long row, unsigned long col)
145 printf("%06lx ", index(row, 1));
147 print_entry(index(row, col));
152 Jdb_obj_space::index(unsigned long row, unsigned long col)
154 Mword e = (col-1) + (row * (cols()-1));
160 Jdb_obj_space::handle_user_keys(int c, Kobject_iface *oif)
165 Kobject *o = oif->kobject();
166 Jdb_kobject_handler *h = Jdb_kobject::module()->first_global_handler();
167 bool handled = false;
170 handled |= h->handle_key(o, c);
171 h = h->next_global();
174 h = Jdb_kobject::module()->find_handler(o);
176 handled |= h->handle_key(o, c);
184 Jdb_obj_space::key_pressed(int c, unsigned long &row, unsigned long &col)
191 if (handle_user_keys(c, item(index(row, col), &rights)))
196 case KEY_CURSOR_HOME: // return to previous or go home
207 Jdb_obj_space::handle_key(Kobject *o, int code)
212 Space *t = Kobject::dcast<Task*>(o);
215 Thread *th = Kobject::dcast<Thread_object *>(o);
216 if (!th || !th->space())
228 static Jdb_obj_space jdb_obj_space INIT_PRIORITY(JDB_MODULE_INIT_PRIO);
230 // ------------------------------------------------------------------------
231 IMPLEMENTATION [obj_space_virt]:
235 Jdb_obj_space::item(Address entry, unsigned *rights)
238 Obj_space::Capability *c = _task->obj_space()->cap_virt(entry);
242 Mword mapped = Jdb::peek((Mword*)c, _task, dummy);
247 Kobject_iface *o = (Kobject_iface*)(dummy & ~3UL);
253 // ------------------------------------------------------------------------
254 IMPLEMENTATION [obj_space_phys]:
257 Jdb_obj_space::item(Address entry, unsigned *rights)
259 Obj_space::Capability *c = _task->obj_space()->get_cap(entry);
264 Kobject_iface *o = c->obj();
265 *rights = c->rights();