MCPcopy Create free account
hub / github.com/F-Stack/f-stack / db_stack_trace

Function db_stack_trace

freebsd/ddb/db_command.c:797–845  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

795}
796
797static void
798db_stack_trace(db_expr_t tid, bool hastid, db_expr_t count, char *modif)
799{
800 struct thread *td;
801 db_expr_t radix;
802 pid_t pid;
803 int t;
804
805 /*
806 * We parse our own arguments. We don't like the default radix.
807 */
808 radix = db_radix;
809 db_radix = 10;
810 hastid = db_expression(&tid);
811 t = db_read_token();
812 if (t == tCOMMA) {
813 if (!db_expression(&count)) {
814 db_printf("Count missing\n");
815 db_flush_lex();
816 db_radix = radix;
817 return;
818 }
819 } else {
820 db_unread_token(t);
821 count = -1;
822 }
823 db_skip_to_eol();
824 db_radix = radix;
825
826 if (hastid) {
827 td = kdb_thr_lookup((lwpid_t)tid);
828 if (td == NULL)
829 td = kdb_thr_from_pid((pid_t)tid);
830 if (td == NULL) {
831 db_printf("Thread %d not found\n", (int)tid);
832 return;
833 }
834 } else
835 td = kdb_thread;
836 if (td->td_proc != NULL)
837 pid = td->td_proc->p_pid;
838 else
839 pid = -1;
840 db_printf("Tracing pid %d tid %ld td %p\n", pid, (long)td->td_tid, td);
841 if (td->td_proc != NULL && (td->td_proc->p_flag & P_INMEM) == 0)
842 db_printf("--- swapped out\n");
843 else
844 db_trace_thread(td, count);
845}
846
847static void
848_db_stack_trace_all(bool active_only)

Callers

nothing calls this directly

Calls 9

db_expressionFunction · 0.85
db_read_tokenFunction · 0.85
db_printfFunction · 0.85
db_flush_lexFunction · 0.85
db_unread_tokenFunction · 0.85
db_skip_to_eolFunction · 0.85
kdb_thr_lookupFunction · 0.85
kdb_thr_from_pidFunction · 0.85
db_trace_threadFunction · 0.50

Tested by

no test coverage detected