This patch moves the register dumping code to a routine, so that
it may be reused.

Signed-off-by: Suzuki K. Poulose <[email protected]>
---

 ppc.c |   62 ++++++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/ppc.c b/ppc.c
index 1ec8e70..869b066 100755
--- a/ppc.c
+++ b/ppc.c
@@ -880,6 +880,43 @@ ppc_print_stack_entry(int frame,
 }
 
 /*
+ * Print the register set for ppc32
+ */
+
+static void
+ppc_print_regs(struct ppc_pt_regs *regs)
+{
+       int i;
+
+       /* print out the gprs... */
+       for(i=0; i<32; i++) {
+               if(!(i % 4))
+                       fprintf(fp, "\n");
+
+               fprintf(fp, "R%d:%s %08lx   ", i,
+                       ((i < 10) ? " " : ""), regs->gpr[i]);
+       }
+
+       fprintf(fp, "\n");
+
+       /* print out the rest of the registers */
+       fprintf(fp, "NIP: %08lx   ", regs->nip);
+       fprintf(fp, "MSR: %08lx   ", regs->msr);
+       fprintf(fp, "OR3: %08lx   ", regs->orig_gpr3);
+       fprintf(fp, "CTR: %08lx\n", regs->ctr);
+
+       fprintf(fp, "LR:  %08lx   ", regs->link);
+       fprintf(fp, "XER: %08lx   ", regs->xer);
+       fprintf(fp, "CCR: %08lx   ", regs->ccr);
+       fprintf(fp, "MQ:  %08lx\n", regs->mq);
+       fprintf(fp, "DAR: %08lx ", regs->dar);
+       fprintf(fp, "DSISR: %08lx ", regs->dsisr);
+       fprintf(fp, "       Syscall Result: %08lx\n", regs->result);
+
+       fprintf(fp, "\n");
+}
+
+/*
  *  Print exception frame information for PowerPC
  */
 static void
@@ -939,31 +976,8 @@ ppc_exception_frame(ulong addr, struct bt_info *bt, struct 
gnu_request *req)
        }
 
        fprintf(fp, " [%lx] exception frame:", regs.trap);
+       ppc_print_regs(&regs);
 
-       /* print out the gprs... */
-       for(i=0; i<32; i++) {
-               if(!(i % 4))
-                       fprintf(fp, "\n");
-
-               fprintf(fp, "R%d:%s %08lx   ", i,
-                       ((i < 10) ? " " : ""), regs.gpr[i]);
-       }
-
-       fprintf(fp, "\n");
-
-       /* print out the rest of the registers */
-       fprintf(fp, "NIP: %08lx   ", regs.nip);
-       fprintf(fp, "MSR: %08lx   ", regs.msr);
-       fprintf(fp, "OR3: %08lx   ", regs.orig_gpr3);
-       fprintf(fp, "CTR: %08lx\n", regs.ctr);
-
-       fprintf(fp, "LR:  %08lx   ", regs.link);
-       fprintf(fp, "XER: %08lx   ", regs.xer);
-       fprintf(fp, "CCR: %08lx   ", regs.ccr);
-       fprintf(fp, "MQ:  %08lx\n", regs.mq);
-       fprintf(fp, "DAR: %08lx ", regs.dar);
-       fprintf(fp, "DSISR: %08lx ", regs.dsisr);
-       fprintf(fp, "       Syscall Result: %08lx\n", regs.result);
 }
 
 /*

--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to