Subject: [PATCH] fix s390x stack dump
Date: Wed, 31 Jan 2007 14:51:55 -0800
From: "Kurtis D. Rader" <krader(a)us.ibm.com>
To: crash-utility(a)redhat.com
The s390x_back_trace_cmd() function treats the stack as a sequence of
32-bit words. That's obviously wrong and causes confusion because the
two halves of the 64-bit word gets dumped "backwards"; that is, at the
wrong offset. This patch fixes that. I created it against crash 4.0-3.9 but
it applies cleanly to 4.0-3.17.
diff -U3 -p --recursive crash-4.0-3.9/s390x.c crash-4.0-3.9.fixed/s390x.c
--- crash-4.0-3.9/s390x.c 2006-11-02 10:26:50.000000000 -0800
+++ crash-4.0-3.9.fixed/s390x.c 2006-11-02 18:50:57.000000000 -0800
@@ -730,9 +730,9 @@ s390x_back_trace_cmd(struct bt_info *bt)
backchain = ULONG(&stack[backchain - stack_base + bc_offset]);
/* print stack content if -f is specified */
- if((bt->flags & BT_FULL) && !BT_REFERENCE_CHECK(bt)){
+ if ((bt->flags & BT_FULL) && !BT_REFERENCE_CHECK(bt)) {
int frame_size;
- if(backchain == 0){
+ if (backchain == 0) {
frame_size = stack_base - old_backchain
+ KERNEL_STACK_SIZE;
} else {
@@ -740,14 +740,15 @@ s390x_back_trace_cmd(struct bt_info *bt)
(stack_base - old_backchain +
KERNEL_STACK_SIZE));
}
- for(j=0; j< frame_size; j+=4){
+ for (j = 0; j < frame_size; j += 8) {
if(j % 16 == 0){
- fprintf(fp,"\n%08lx: ",old_backchain+j);
+ fprintf(fp, "%s %016lx: ",
+ j ? "\n" : "",
old_backchain + j);
}
- fprintf(fp," %08lx",ULONG(&stack[old_backchain -
- stack_base + j]));
+ fprintf(fp," %016lx",
+ ULONG(&stack[old_backchain - stack_base + j]));
}
- fprintf(fp,"\n\n");
+ fprintf(fp, "\n");
}
/* Check for interrupt stackframe */
--
Kurtis D. Rader, Linux level 3 support email: krader(a)us.ibm.com
IBM Integrated Technology Services DID: +1 503-578-3714
15350 SW Koll Pkwy, MS DES1-01 service: 800-IBM-SERV
Beaverton, OR 97006-6063
http://www.ibm.com