Fix for the PPC64 "bt" command on both big-endian and little-endian

architectures.  Without the patch, backtraces of the active tasks
may be "empty" on little-endian machines, or show a one-liner of
the form: "#0 [c0000005f4db7a60] (null) at 501  (unreliable)" on
big-endian machines.
(anderson@redhat.com)
This commit is contained in:
Dave Anderson 2015-01-20 14:38:48 -05:00
parent a58a34e95c
commit dc4ea682a2

24
ppc64.c
View File

@ -1,7 +1,7 @@
/* ppc64.c -- core analysis suite
*
* Copyright (C) 2004-2014 David Anderson
* Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved.
* Copyright (C) 2004-2015 David Anderson
* Copyright (C) 2004-2015 Red Hat, Inc. All rights reserved.
* Copyright (C) 2004, 2006 Haren Myneni, IBM Corporation
*
* This program is free software; you can redistribute it and/or modify
@ -1902,8 +1902,8 @@ ppc64_print_regs(struct ppc64_pt_regs *regs)
int i;
/* print out the gprs... */
for(i=0; i<32; i++) {
if(!(i % 3))
for (i=0; i<32; i++) {
if (i && !(i % 3))
fprintf(fp, "\n");
fprintf(fp, " R%d:%s %016lx ", i,
@ -1944,9 +1944,8 @@ ppc64_print_eframe(char *efrm_str, struct ppc64_pt_regs *regs,
if (BT_REFERENCE_CHECK(bt))
return;
fprintf(fp, " %s [%lx] exception frame:", efrm_str, regs->trap);
fprintf(fp, " %s [%lx] exception frame:\n", efrm_str, regs->trap);
ppc64_print_regs(regs);
fprintf(fp, "\n");
}
/*
@ -2000,8 +1999,6 @@ ppc64_kdump_stack_frame(struct bt_info *bt_in, ulong *nip, ulong *ksp)
fprintf(fp, " LR [%016lx] %s\n", pt_regs->link,
closest_symbol(pt_regs->link));
fprintf(fp, "\n");
return TRUE;
}
@ -2012,7 +2009,7 @@ static int
ppc64_get_dumpfile_stack_frame(struct bt_info *bt_in, ulong *nip, ulong *ksp)
{
int panic_task;
int i, panic;
int i;
char *sym;
ulong *up;
struct bt_info bt_local, *bt;
@ -2096,10 +2093,8 @@ ppc64_get_dumpfile_stack_frame(struct bt_info *bt_in, ulong *nip, ulong *ksp)
fprintf(fp, "Could not find SP for task %0lx\n",
bt->task);
}
return TRUE;
}
panic = FALSE;
/*
* Check the process stack first. We are scanning stack for only
* panic task. Even though we have dumping CPU's regs, we will be
@ -2116,8 +2111,12 @@ retry:
if (STREQ(sym, ".netconsole_netdump") ||
STREQ(sym, ".netpoll_start_netdump") ||
STREQ(sym, ".start_disk_dump") ||
STREQ(sym, "crash_kexec") ||
STREQ(sym, "crash_fadump") ||
STREQ(sym, "crash_ipi_callback") ||
STREQ(sym, ".crash_kexec") ||
STREQ(sym, ".crash_fadump") ||
STREQ(sym, ".crash_ipi_callback") ||
STREQ(sym, ".disk_dump")) {
*nip = *up;
*ksp = bt->stackbase +
@ -2126,9 +2125,6 @@ retry:
}
}
if (panic)
return TRUE;
bt->flags &= ~(BT_HARDIRQ|BT_SOFTIRQ);
if (check_hardirq &&