| 795 | } |
| 796 | |
| 797 | static void |
| 798 | db_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 | |
| 847 | static void |
| 848 | _db_stack_trace_all(bool active_only) |
nothing calls this directly
no test coverage detected