From a96591bced3b0166373c03aa47488d7101c066c3 Mon Sep 17 00:00:00 2001 From: Qiao Nuohan Date: Sun, 28 Sep 2014 16:36:54 +0800 Subject: [PATCH v3 03/21] x86_64: modify bt -E to hide offline cpus' data bt -E will search all irq stacks and exception stacks for possible exception frames. With this patch offline cpus will be hiden. The original output will be like: crash> bt -E CPU 0 IRQ STACK: (none found) CPU 1 IRQ STACK: (none found) CPU 2 IRQ STACK: (none found) CPU 3 IRQ STACK: (none found) ... CPU 2 STACKFAULT EXCEPTION STACK: (none found) CPU 2 DOUBLEFAULT EXCEPTION STACK: (none found) CPU 2 NMI EXCEPTION STACK: (none found) CPU 2 DEBUG EXCEPTION STACK: (none found) CPU 2 MCE EXCEPTION STACK: (none found) ... With data of offline cpu hiden, the output is like: crash> bt -E CPU 0 IRQ STACK: (none found) CPU 1 IRQ STACK: (none found) CPU 2 IRQ STACK: CPU 3 IRQ STACK: (none found) ... CPU 2 STACKFAULT EXCEPTION STACK: CPU 2 DOUBLEFAULT EXCEPTION STACK: CPU 2 NMI EXCEPTION STACK: CPU 2 DEBUG EXCEPTION STACK: CPU 2 MCE EXCEPTION STACK: ... Signed-off-by: Qiao Nuohan --- x86_64.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/x86_64.c b/x86_64.c index a2e4636..a076b02 100755 --- a/x86_64.c +++ b/x86_64.c @@ -2325,7 +2325,14 @@ x86_64_eframe_search(struct bt_info *bt) if (ms->stkinfo.ibase[c] == 0) break; bt->hp->esp = ms->stkinfo.ibase[c]; - fprintf(fp, "CPU %d IRQ STACK:\n", c); + fprintf(fp, "CPU %d IRQ STACK:", c); + + if (hide_offline_cpu(c)) { + fprintf(fp, " [OFFLINE]\n\n"); + continue; + } else + fprintf(fp, "\n"); + if ((cnt = x86_64_eframe_search(bt))) fprintf(fp, "\n"); else @@ -2337,8 +2344,15 @@ x86_64_eframe_search(struct bt_info *bt) if (ms->stkinfo.ebase[c][i] == 0) break; bt->hp->esp = ms->stkinfo.ebase[c][i]; - fprintf(fp, "CPU %d %s EXCEPTION STACK:\n", + fprintf(fp, "CPU %d %s EXCEPTION STACK:", c, x86_64_exception_stacks[i]); + + if (hide_offline_cpu(c)) { + fprintf(fp, " [OFFLINE]\n\n"); + continue; + } else + fprintf(fp, "\n"); + if ((cnt = x86_64_eframe_search(bt))) fprintf(fp, "\n"); else -- 1.8.5.3