Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133101024
D7646.id19694.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D7646.id19694.diff
View Options
Index: sys/ddb/db_command.c
===================================================================
--- sys/ddb/db_command.c
+++ sys/ddb/db_command.c
@@ -72,6 +72,7 @@
static db_cmdfcn_t db_kill;
static db_cmdfcn_t db_reset;
static db_cmdfcn_t db_stack_trace;
+static db_cmdfcn_t db_stack_trace_active;
static db_cmdfcn_t db_stack_trace_all;
static db_cmdfcn_t db_watchdog;
@@ -79,6 +80,12 @@
* 'show' commands
*/
+static struct command db_show_active_cmds[] = {
+ { "trace", db_stack_trace_active, 0, NULL },
+};
+struct command_table db_show_active_table =
+ LIST_HEAD_INITIALIZER(db_show_active_table);
+
static struct command db_show_all_cmds[] = {
{ "trace", db_stack_trace_all, 0, NULL },
};
@@ -86,6 +93,7 @@
LIST_HEAD_INITIALIZER(db_show_all_table);
static struct command db_show_cmds[] = {
+ { "active", 0, 0, &db_show_active_table },
{ "all", 0, 0, &db_show_all_table },
{ "registers", db_show_regs, 0, NULL },
{ "breaks", db_listbreak_cmd, 0, NULL },
@@ -120,6 +128,8 @@
{ "match", db_trace_until_matching_cmd,0, NULL },
{ "trace", db_stack_trace, CS_OWN, NULL },
{ "t", db_stack_trace, CS_OWN, NULL },
+ /* XXX alias for active trace */
+ { "acttrace", db_stack_trace_active, 0, NULL },
/* XXX alias for all trace */
{ "alltrace", db_stack_trace_all, 0, NULL },
{ "where", db_stack_trace, CS_OWN, NULL },
@@ -195,6 +205,9 @@
db_command_register(&db_cmd_table, &db_cmds[i]);
for (i = 0; i < N(db_show_cmds); i++)
db_command_register(&db_show_table, &db_show_cmds[i]);
+ for (i = 0; i < N(db_show_active_cmds); i++)
+ db_command_register(&db_show_active_table,
+ &db_show_active_cmds[i]);
for (i = 0; i < N(db_show_all_cmds); i++)
db_command_register(&db_show_all_table, &db_show_all_cmds[i]);
#undef N
@@ -799,6 +812,35 @@
}
static void
+db_stack_trace_active(db_expr_t dummy, bool dummy2, db_expr_t dummy3,
+ char *dummy4)
+{
+ struct proc *p;
+ struct thread *td;
+ jmp_buf jb;
+ void *prev_jb;
+
+ FOREACH_PROC_IN_SYSTEM(p) {
+ prev_jb = kdb_jmpbuf(jb);
+ if (setjmp(jb) == 0) {
+ FOREACH_THREAD_IN_PROC(p, td) {
+ if (td->td_state != TDS_RUNNING)
+ continue;
+ db_printf("\nTracing command %s pid %d tid %ld"
+ " td %p (CPU %d)\n", p->p_comm, p->p_pid,
+ (long)td->td_tid, td, td->td_oncpu);
+ db_trace_thread(td, -1);
+ if (db_pager_quit) {
+ kdb_jmpbuf(prev_jb);
+ return;
+ }
+ }
+ }
+ kdb_jmpbuf(prev_jb);
+ }
+}
+
+static void
db_stack_trace_all(db_expr_t dummy, bool dummy2, db_expr_t dummy3,
char *dummy4)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 23, 11:52 PM (6 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24108350
Default Alt Text
D7646.id19694.diff (2 KB)
Attached To
Mode
D7646: ddb: Add 'show active trace' command
Attached
Detach File
Event Timeline
Log In to Comment