/* * Kernel Debugger Architecture Independent Stack Traceback * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (c) 1999-2004 Silicon Graphics, Inc. All Rights Reserved. * Copyright (c) 2009 Wind River Systems, Inc. All Rights Reserved.
*/
/* * kdb_bt * * This function implements the 'bt' command. Print a stack * traceback. * * bt [<address-expression>] (addr-exp is for alternate stacks) * btp <pid> Kernel stack for <pid> * btt <address-expression> Kernel stack for task structure at * <address-expression> * bta [state_chars>|A] All useful processes, optionally * filtered by state * btc [<cpu>] The current process on one cpu, * default is all cpus * * bt <address-expression> refers to a address on the stack, that location * is assumed to contain a return address. * * btt <address-expression> refers to the address of a struct task. * * Inputs: * argc argument count * argv argument vector * Outputs: * None. * Returns: * zero for success, a kdb diagnostic if error * Locking: * none. * Remarks: * Backtrack works best when the code uses frame pointers. But even * without frame pointers we should get a reasonable trace. * * mds comes in handy when examining the stack to do a manual traceback or * to get a starting point for bt <address-expression>.
*/
if (kdb_getarea(ch, (unsignedlong)p) ||
kdb_getarea(ch, (unsignedlong)(p+1)-1)) return KDB_BADADDR; if (!kdb_task_state(p, mask)) return 0;
kdb_printf("Stack traceback for pid %d\n", p->pid);
kdb_ps1(p);
kdb_show_stack(p, NULL); if (btaprompt) {
kdb_printf("Enter to end, or to continue:"); do {
ch = kdb_getchar();
} while (!strchr("\r\n q", ch));
kdb_printf("\n");
if (cpu >= num_possible_cpus() || !cpu_online(cpu)) {
kdb_printf("WARNING: no process for cpu %ld\n", cpu); return;
}
/* If a CPU failed to round up we could be here */
kdb_tsk = KDB_TSK(cpu); if (!kdb_tsk) {
kdb_printf("WARNING: no task for cpu %ld\n", cpu); return;
}
kdb_bt1(kdb_tsk, "A", false);
}
int
kdb_bt(int argc, constchar **argv)
{ int diag; int btaprompt = 1; int nextarg; unsignedlong addr; long offset;
/* Prompt after each proc in bta */
kdbgetintenv("BTAPROMPT", &btaprompt);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.