- Call db_setup_paging() for traceall.

- Make it so one can't call db_setup_paging() if it has already been called
before. traceall needs this, or else the db_setup_paging() call from
db_trace_thread() will reset the printed line number, and override its
argument.
This is not perfect for traceall, because even if one presses 'q' while in
the middle of printing a backtrace it will finish printing the backtrace
before exiting, as db_trace_thread() won't be notified it should stop, but
it is hard to do better without reworking the pager interface a lot more.
This commit is contained in:
Olivier Houchard 2005-10-02 22:57:31 +00:00
parent 1db55c2528
commit da927f93bd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=150842
2 changed files with 13 additions and 5 deletions

View File

@ -684,12 +684,17 @@ db_stack_trace_all(db_expr_t dummy, boolean_t dummy2, db_expr_t dummy3,
{
struct proc *p;
struct thread *td;
int quit;
quit = 0;
db_setup_paging(db_simple_pager, &quit, db_lines_per_page);
for (p = LIST_FIRST(&allproc); p != NULL; p = LIST_NEXT(p, p_list)) {
FOREACH_THREAD_IN_PROC(p, td) {
db_printf("\nTracing command %s pid %d tid %ld td %p\n",
p->p_comm, p->p_pid, (long)td->td_tid, td);
db_trace_thread(td, -1);
if (quit)
return;
}
}
}

View File

@ -186,11 +186,14 @@ db_putchar(c, arg)
void
db_setup_paging(db_page_calloutfcn_t *callout, void *arg, int maxlines)
{
db_page_callout = callout;
db_page_callout_arg = arg;
db_maxlines = maxlines;
db_newlines = 0;
if (db_page_callout == NULL || callout == NULL || arg ==
db_page_callout_arg) {
db_page_callout = callout;
db_page_callout_arg = arg;
db_maxlines = maxlines;
db_newlines = 0;
}
}
/*