Improved "team" debugger command: it will no longer crash on the kernel team, it
will no longer use vm_get_kernel_aspace() (which acquired a semaphore) and it now accepts decimal team IDs as well. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14307 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+17
-13
@@ -99,8 +99,8 @@ _dump_team_info(struct team *team)
|
|||||||
dprintf("state: %d\n", team->state);
|
dprintf("state: %d\n", team->state);
|
||||||
dprintf("pending_signals: 0x%x\n", team->pending_signals);
|
dprintf("pending_signals: 0x%x\n", team->pending_signals);
|
||||||
dprintf("io_context: %p\n", team->io_context);
|
dprintf("io_context: %p\n", team->io_context);
|
||||||
// dprintf("path: '%s'\n", team->path);
|
if (team->aspace)
|
||||||
dprintf("aspace: %p (id = %ld)\n", team->aspace, team->aspace->id);
|
dprintf("aspace: %p (id = %ld)\n", team->aspace, team->aspace->id);
|
||||||
dprintf("kaspace: %p\n", team->kaspace);
|
dprintf("kaspace: %p\n", team->kaspace);
|
||||||
dprintf("main_thread: %p\n", team->main_thread);
|
dprintf("main_thread: %p\n", team->main_thread);
|
||||||
dprintf("thread_list: %p\n", team->thread_list);
|
dprintf("thread_list: %p\n", team->thread_list);
|
||||||
@@ -112,8 +112,13 @@ dump_team_info(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
struct team *team;
|
struct team *team;
|
||||||
team_id id = -1;
|
team_id id = -1;
|
||||||
unsigned long num;
|
|
||||||
struct hash_iterator i;
|
struct hash_iterator i;
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
if (argc > 2) {
|
||||||
|
kprintf("usage: team [id/address/name]\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
// just list the existing teams
|
// just list the existing teams
|
||||||
@@ -125,16 +130,11 @@ dump_team_info(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the argument looks like a hex number, treat it as such
|
id = strtoul(argv[1], NULL, 0);
|
||||||
if (strlen(argv[1]) > 2 && argv[1][0] == '0' && argv[1][1] == 'x') {
|
if (IS_KERNEL_ADDRESS(id)) {
|
||||||
num = strtoul(argv[1], NULL, 16);
|
// semi-hack
|
||||||
if (num > vm_get_kernel_aspace()->virtual_map.base) {
|
_dump_team_info((struct team *)id);
|
||||||
// XXX semi-hack
|
return 0;
|
||||||
_dump_team_info((struct team *)num);
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
id = num;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// walk through the thread list, trying to match name or id
|
// walk through the thread list, trying to match name or id
|
||||||
@@ -142,10 +142,14 @@ dump_team_info(int argc, char **argv)
|
|||||||
while ((team = hash_next(team_hash, &i)) != NULL) {
|
while ((team = hash_next(team_hash, &i)) != NULL) {
|
||||||
if ((team->name && strcmp(argv[1], team->name) == 0) || team->id == id) {
|
if ((team->name && strcmp(argv[1], team->name) == 0) || team->id == id) {
|
||||||
_dump_team_info(team);
|
_dump_team_info(team);
|
||||||
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hash_close(team_hash, &i, false);
|
hash_close(team_hash, &i, false);
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
kprintf("team \"%s\" (%ld) doesn't exist!\n", argv[1], id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user