[PATCH v2 2/4] [ppc] Support for compressed KDUMP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch introduces support for analysing compressed KDUMP
cores for PPC32.


Signed-off-by: Suzuki K. Poulose <suzuki@xxxxxxxxxx>
---

 diskdump.c |   38 +++++++++++++++++++++++++++++++++++++-
 ppc.c      |    7 +++++++
 2 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/diskdump.c b/diskdump.c
index 9f4b228..dc4baf3 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -367,6 +367,9 @@ restart:
 	else if (STRNEQ(header->utsname.machine, "ia64") &&
 	    machine_type_mismatch(file, "IA64", NULL, 0))
 		goto err;
+	else if (STRNEQ(header->utsname.machine, "ppc") &&
+	    machine_type_mismatch(file, "PPC", NULL, 0))
+		goto err;
 	else if (STRNEQ(header->utsname.machine, "ppc64") &&
 	    machine_type_mismatch(file, "PPC64", NULL, 0))
 		goto err;
@@ -496,6 +499,8 @@ restart:
 		dd->machine_type = EM_X86_64;
 	else if (machine_type("IA64"))
 		dd->machine_type = EM_IA_64;
+	else if (machine_type("PPC"))
+		dd->machine_type = EM_PPC;
 	else if (machine_type("PPC64"))
 		dd->machine_type = EM_PPC64;
 	else if (machine_type("S390X"))
@@ -937,6 +942,31 @@ extern void get_netdump_regs_x86(struct bt_info *, ulong *, ulong *);
 extern void get_netdump_regs_x86_64(struct bt_info *, ulong *, ulong *);
 
 static void
+get_diskdump_regs_ppc(struct bt_info *bt, ulong *eip, ulong *esp)
+{
+	Elf32_Nhdr *note;
+	int len;
+
+	if (KDUMP_CMPRS_VALID() &&
+		(bt->task == tt->panic_task || 
+		(is_task_active(bt->task) && dd->num_prstatus_notes > 1))) {
+		note  = (Elf32_Nhdr*) dd->nt_prstatus_percpu[bt->tc->processor];
+		if (!note)
+			error(FATAL,
+				    "cannot determine NT_PRSTATUS ELF note "
+				    "for %s task: %lx\n",
+					(bt->task == tt->panic_task) ?
+					"panic" : "active", bt->task);
+		len = sizeof(Elf32_Nhdr);
+		len = roundup(len + note->n_namesz, 4);
+		 bt->machdep = (void *)((char *)note + len +
+			MEMBER_OFFSET("elf_prstatus", "pr_reg"));
+	}
+
+	machdep->get_stack_frame(bt, eip, esp);
+}
+
+static void
 get_diskdump_regs_ppc64(struct bt_info *bt, ulong *eip, ulong *esp)
 {
 	if ((bt->task == tt->panic_task) && DISKDUMP_VALID())
@@ -977,6 +1007,10 @@ get_diskdump_regs(struct bt_info *bt, ulong *eip, ulong *esp)
 		machdep->get_stack_frame(bt, eip, esp);
 		break;
 
+	case EM_PPC:
+		return get_diskdump_regs_ppc(bt, eip, esp);
+		break;
+
 	case EM_PPC64:
 		return get_diskdump_regs_ppc64(bt, eip, esp);
 		break;
@@ -1142,7 +1176,7 @@ dump_nt_prstatus_offset(FILE *fp)
 						(tot == 0) ? "" : "                      ",
 						(ulong)(offset + tot));
 
-			} else if (machine_type("X86")) {
+			} else if (machine_type("X86") || machine_type("PPC")) {
 				note32 = (void *)dd->notes_buf + tot;
 				len = sizeof(Elf32_Nhdr);
 				len = roundup(len + note32->n_namesz, 4);
@@ -1202,6 +1236,8 @@ __diskdump_memory_dump(FILE *fp)
 		fprintf(fp, "(EM_X86_64)\n"); break;
 	case EM_IA_64:
 		fprintf(fp, "(EM_IA_64)\n"); break;
+	case EM_PPC:
+		fprintf(fp, "(EM_PPC)\n"); break;
 	case EM_PPC64:
 		fprintf(fp, "(EM_PPC64)\n"); break;
 	case EM_S390:
diff --git a/ppc.c b/ppc.c
index 2a10fac..78c9178 100755
--- a/ppc.c
+++ b/ppc.c
@@ -67,6 +67,9 @@ static void ppc_display_machine_stats(void);
 static void ppc_dump_line_number(ulong);
 static struct line_number_hook ppc_line_number_hooks[];
 
+/* Defined in diskdump.c */
+extern void process_elf32_notes(void *, ulong);
+
 /*
  *  Do all necessary machine-specific setup here.  This is called twice,
  *  before and after GDB has been initialized.
@@ -79,6 +82,10 @@ ppc_init(int when)
 
 	switch (when)
 	{
+	case SETUP_ENV:
+		machdep->process_elf_notes = process_elf32_notes;
+		break;
+
 	case PRE_SYMTAB:
 		machdep->verify_symbol = ppc_verify_symbol;
                 if (pc->flags & KERNEL_DEBUG_QUERY)

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility


[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux