int kdb_bt(int argc, const char **argv) { int diag; int argcount = 5; int btaprompt = 1; int nextarg; unsigned long addr; long offset; kdbgetintenv("BTARGS", &argcount); /* Arguments to print */ kdbgetintenv("BTAPROMPT", &btaprompt); /* Prompt after each proc in bta */ if (strcmp(argv[0], "bta") == 0) { struct task_struct *g, *p; unsigned long cpu; unsigned long mask = kdb_task_state_string(argc ? argv[1] : NULL); if (argc == 0) kdb_ps_suppressed(); /* Run the active tasks first */ for (cpu = 0; cpu < NR_CPUS; ++cpu) { if (!cpu_online(cpu)) continue; p = kdb_curr_task(cpu); if (kdb_bt1(p, mask, argcount, btaprompt)) return 0; } /* Now the inactive tasks */ kdb_do_each_thread(g, p) { if (task_curr(p)) continue; if (kdb_bt1(p, mask, argcount, btaprompt)) return 0; } kdb_while_each_thread(g, p); } else if (strcmp(argv[0], "btp") == 0) {
static int kdbm_vm(int argc, const char **argv) { unsigned long addr; long offset = 0; int nextarg; int diag; int verbose_flg = 0; if (argc == 2) { if (strcmp(argv[1], "-v") != 0) { return KDB_ARGCOUNT; } verbose_flg = 1; } else if (argc != 1) { return KDB_ARGCOUNT; } if (strcmp(argv[0], "vmp") == 0) { struct task_struct *g, *tp; struct vm_area_struct *vp; pid_t pid; if ((diag = kdbgetularg(argv[argc], (unsigned long *) &pid))) return diag; kdb_do_each_thread(g, tp) { if (tp->pid == pid) { if (tp->mm != NULL) { if (verbose_flg) kdb_printf ("vm_area_struct "); kdb_printf ("vm_start vm_end vm_flags\n"); vp = tp->mm->mmap; while (vp != NULL) { kdbm_print_vmp(vp, verbose_flg); vp = vp->vm_next; } } return 0; } } kdb_while_each_thread(g, tp); kdb_printf("No process with pid == %d found\n", pid); } else {