diff options
author | jhb <jhb@FreeBSD.org> | 2004-09-20 19:05:32 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2004-09-20 19:05:32 +0000 |
commit | e487fab4953bbf1f92413af17326300aa1bb2e0f (patch) | |
tree | b2136a0a4b646b54ea0fa359879a4c4a13989501 /sys/sparc64 | |
parent | 777f9072761c10509e408574842552f1b8779331 (diff) | |
download | FreeBSD-src-e487fab4953bbf1f92413af17326300aa1bb2e0f.zip FreeBSD-src-e487fab4953bbf1f92413af17326300aa1bb2e0f.tar.gz |
- Add support for "paging" in stack trace output. That is, when you do
a stack trace from ddb, the output will pause with a '--More--' prompt
every 18 lines. If you hit Enter, it will print another line and prompt
again. If you hit space it will output another page and then prompt.
If you hit 'q' or 'x' it will abort the rest of the stack trace.
- Fix the sparc64 userland stack trace to honor the total count of lines
to print. This is useful if your trace happens to walk back onto
0xdeadc0de and gets stuck in an endless loop.
MFC after: 1 month
Tested on: i386, alpha, sparc64
Diffstat (limited to 'sys/sparc64')
-rw-r--r-- | sys/sparc64/sparc64/db_trace.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/sparc64/sparc64/db_trace.c b/sys/sparc64/sparc64/db_trace.c index b5fdec9..acb4b5a 100644 --- a/sys/sparc64/sparc64/db_trace.c +++ b/sys/sparc64/sparc64/db_trace.c @@ -96,7 +96,7 @@ db_frame(struct db_variable *vp, db_expr_t *valuep, int op) * User stack trace (debugging aid). */ static void -db_utrace(struct thread *td, struct trapframe *tf) +db_utrace(struct thread *td, struct trapframe *tf, int count, int *quitp) { struct pcb *pcb; db_addr_t sp, rsp, o7, pc; @@ -108,7 +108,7 @@ db_utrace(struct thread *td, struct trapframe *tf) FALSE); pc = db_get_value((db_addr_t)&tf->tf_tpc, sizeof(tf->tf_tpc), FALSE); db_printf("user trace: trap %%o7=%#lx\n", o7); - while (sp != 0) { + while (count-- && sp != 0 && !*quitp) { db_printf("pc %#lx, sp %#lx\n", pc, sp); /* First, check whether the frame is in the pcb. */ found = 0; @@ -134,7 +134,7 @@ db_utrace(struct thread *td, struct trapframe *tf) } static int -db_print_trap(struct thread *td, struct trapframe *tf) +db_print_trap(struct thread *td, struct trapframe *tf, int count, int *quitp) { struct proc *p; const char *symname; @@ -212,7 +212,7 @@ db_print_trap(struct thread *td, struct trapframe *tf) db_printf("userland() at "); db_printsym(tpc, DB_STGY_PROC); db_printf("\n"); - db_utrace(td, tf); + db_utrace(td, tf, count, quitp); } return (user); } @@ -229,6 +229,7 @@ db_backtrace(struct thread *td, struct frame *fp, int count) db_addr_t pc; int trap; int user; + int quit; if (count == -1) count = 1024; @@ -236,7 +237,9 @@ db_backtrace(struct thread *td, struct frame *fp, int count) trap = 0; user = 0; npc = 0; - while (count-- && !user) { + quit = 0; + db_setup_paging(db_simple_pager, &quit, DB_LINES_PER_PAGE); + while (count-- && !user && !quit) { pc = (db_addr_t)db_get_value((db_addr_t)&fp->fr_pc, sizeof(fp->fr_pc), FALSE); if (trap) { @@ -260,7 +263,7 @@ db_backtrace(struct thread *td, struct frame *fp, int count) tf = (struct trapframe *)(fp + 1); npc = db_get_value((db_addr_t)&tf->tf_tpc, sizeof(tf->tf_tpc), FALSE); - user = db_print_trap(td, tf); + user = db_print_trap(td, tf, count, &quit); trap = 1; } else { db_printf("%s() at ", name); |