- 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
This commit is contained in:
parent
777f907276
commit
e487fab495
@ -213,14 +213,16 @@ db_backtrace(struct thread *td, db_addr_t frame, db_addr_t pc, int count)
|
||||
db_expr_t diff;
|
||||
db_addr_t symval;
|
||||
u_long last_ipl, tfps;
|
||||
int i;
|
||||
int i, quit;
|
||||
|
||||
if (count == -1)
|
||||
count = 1024;
|
||||
|
||||
last_ipl = ~0L;
|
||||
tf = NULL;
|
||||
while (count--) {
|
||||
quit = 0;
|
||||
db_setup_paging(db_simple_pager, &quit, DB_LINES_PER_PAGE);
|
||||
while (count-- && !quit) {
|
||||
sym = db_search_symbol(pc, DB_STGY_ANY, &diff);
|
||||
if (sym == DB_SYM_NULL)
|
||||
return (ENOENT);
|
||||
|
@ -373,14 +373,16 @@ db_backtrace(struct thread *td, struct trapframe *tf,
|
||||
long *argp;
|
||||
db_expr_t offset;
|
||||
c_db_sym_t sym;
|
||||
int narg;
|
||||
int narg, quit;
|
||||
boolean_t first;
|
||||
|
||||
if (count == -1)
|
||||
count = 1024;
|
||||
|
||||
first = TRUE;
|
||||
while (count--) {
|
||||
quit = 0;
|
||||
db_setup_paging(db_simple_pager, &quit, DB_LINES_PER_PAGE);
|
||||
while (count-- && !quit) {
|
||||
sym = db_search_symbol(pc, DB_STGY_ANY, &offset);
|
||||
db_symbol_values(sym, &name, NULL);
|
||||
|
||||
|
@ -102,7 +102,7 @@ db_stack_trace_cmd(addr, have_addr, count, modif)
|
||||
db_expr_t offset;
|
||||
boolean_t kernel_only = TRUE;
|
||||
boolean_t trace_thread = FALSE;
|
||||
int scp_offset;
|
||||
int scp_offset, quit;
|
||||
|
||||
if (kdb_frame == NULL && !have_addr)
|
||||
return;
|
||||
@ -142,7 +142,9 @@ db_stack_trace_cmd(addr, have_addr, count, modif)
|
||||
lastframe = NULL;
|
||||
scp_offset = -(get_pc_str_offset() >> 2);
|
||||
|
||||
while (count-- && frame != NULL) {
|
||||
quit = 0;
|
||||
db_setup_paging(db_simple_pager, &quit, DB_LINES_PER_PAGE);
|
||||
while (count-- && frame != NULL && !quit) {
|
||||
db_addr_t scp;
|
||||
u_int32_t savecode;
|
||||
int r;
|
||||
|
@ -379,14 +379,16 @@ db_backtrace(struct thread *td, struct trapframe *tf, struct i386_frame *frame,
|
||||
int *argp;
|
||||
db_expr_t offset;
|
||||
c_db_sym_t sym;
|
||||
int narg;
|
||||
int narg, quit;
|
||||
boolean_t first;
|
||||
|
||||
if (count == -1)
|
||||
count = 1024;
|
||||
|
||||
first = TRUE;
|
||||
while (count--) {
|
||||
quit = 0;
|
||||
db_setup_paging(db_simple_pager, &quit, DB_LINES_PER_PAGE);
|
||||
while (count-- && !quit) {
|
||||
sym = db_search_symbol(pc, DB_STGY_ANY, &offset);
|
||||
db_symbol_values(sym, &name, NULL);
|
||||
|
||||
|
@ -57,10 +57,12 @@ db_backtrace(struct thread *td, struct pcb *pcb, int count)
|
||||
db_expr_t offset;
|
||||
uint64_t bsp, cfm, ip, pfs, reg, sp;
|
||||
c_db_sym_t sym;
|
||||
int args, error, i;
|
||||
int args, error, i, quit;
|
||||
|
||||
quit = 0;
|
||||
db_setup_paging(db_simple_pager, &quit, DB_LINES_PER_PAGE);
|
||||
error = unw_create_from_pcb(&rs, pcb);
|
||||
while (!error && count--) {
|
||||
while (!error && count-- && !quit) {
|
||||
error = unw_get_cfm(&rs, &cfm);
|
||||
if (!error)
|
||||
error = unw_get_bsp(&rs, &bsp);
|
||||
|
@ -129,6 +129,7 @@ db_backtrace(struct thread *td, db_addr_t fp, int count)
|
||||
const char *symname;
|
||||
boolean_t kernel_only = TRUE;
|
||||
boolean_t full = FALSE;
|
||||
int quit;
|
||||
|
||||
#if 0
|
||||
{
|
||||
@ -148,7 +149,9 @@ db_backtrace(struct thread *td, db_addr_t fp, int count)
|
||||
|
||||
stackframe = fp;
|
||||
|
||||
for (;;) {
|
||||
quit = 0;
|
||||
db_setup_paging(db_simple_pager, &quit, DB_LINES_PER_PAGE);
|
||||
while (!quit) {
|
||||
if (stackframe < PAGE_SIZE)
|
||||
break;
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user