[Crash-utility] [PATCH v1 1/4] Support PPC32 Core analysis on PPC64 Host

Suzuki K. Poulose suzuki at in.ibm.com
Tue Nov 15 03:58:03 UTC 2011


This patch enables crash on PPC64 to analyze the cores generated
on a PPC32 machine. I plan to look at adding support for PPC32 Kdump
core in the following patches. Running crash on a PPC32 board is not
a good thing to do. Hence using a PPC64 machine to do the same. There
is no support for analyzing target of a different endian-ness. I will
take a look at that later, once the PPC32 crash support is completed.

Note: The gdb-7.xx.patch hard codes the CFLAGS to include -m64 option
if we are building on a ppc64 host. So, we have to build from a 'ppc'
environment(Using setarch ppc).

Signed-off-by: Suzuki K. Poulose <suzuki at in.ibm.com>
---

 configure.c |   11 ++++++++++-
 netdump.c   |    6 ++++++
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/configure.c b/configure.c
index 26378aa..138397f 100755
--- a/configure.c
+++ b/configure.c
@@ -130,11 +130,13 @@ int name_to_target(char *);
 #define TARGET_CFLAGS_ARM_ON_X86     "TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64"
 #define TARGET_CFLAGS_ARM_ON_X86_64  "TARGET_CFLAGS=-m32 -D_FILE_OFFSET_BITS=64"
 #define TARGET_CFLAGS_X86_ON_X86_64  "TARGET_CFLAGS=-m32 -D_FILE_OFFSET_BITS=64"
+#define TARGET_CFLAGS_PPC_ON_PPC64   "TARGET_CFLAGS=-m32 -D_FILE_OFFSET_BITS=64 -fPIC"
 
 #define GDB_TARGET_DEFAULT        "GDB_CONF_FLAGS="
 #define GDB_TARGET_ARM_ON_X86     "GDB_CONF_FLAGS=--target=arm-elf-linux"
 #define GDB_TARGET_ARM_ON_X86_64  "GDB_CONF_FLAGS=--target=arm-elf-linux CFLAGS=-m32"
 #define GDB_TARGET_X86_ON_X86_64  "GDB_CONF_FLAGS=--target=i686-pc-linux-gnu CFLAGS=-m32"
+#define GDB_TARGET_PPC_ON_PPC64  "GDB_CONF_FLAGS=--target=ppc-elf-linux CFLAGS=-m32"
 
 /*
  *  The original plan was to allow the use of a particular version
@@ -357,6 +359,9 @@ get_current_configuration(struct supported_gdb_version *sp)
 			 *  Build an X86 crash binary on an X86_64 host.
 			 */
 			target_data.target = X86;
+		} else if ((target_data.target == PPC64) &&
+			(name_to_target((char *)target_data.target_as_param) == PPC)) {
+			target_data.target = PPC;
 		} else if (name_to_target((char *)target_data.target_as_param) ==
 			target_data.host) {
 			if ((target_data.initial_gdb_target != UNKNOWN) &&
@@ -550,7 +555,11 @@ build_configure(struct supported_gdb_version *sp)
 		break;
 	case PPC:
 		target = TARGET_PPC;
-		target_CFLAGS = TARGET_CFLAGS_PPC;
+		if (target_data.host == PPC64) {
+			target_CFLAGS = TARGET_CFLAGS_PPC_ON_PPC64;
+			gdb_conf_flags = GDB_TARGET_PPC_ON_PPC64;
+		} else
+			target_CFLAGS = TARGET_CFLAGS_PPC;
 		break;
 	case IA64:
 		target = TARGET_IA64;
diff --git a/netdump.c b/netdump.c
index 4011f36..c0ee9ae 100644
--- a/netdump.c
+++ b/netdump.c
@@ -183,6 +183,12 @@ is_netdump(char *file, ulong source_query)
 				goto bailout;
 			break;
 
+		case EM_PPC:
+			if (machine_type_mismatch(file, "PPC", NULL,
+			    source_query))
+				goto bailout;
+			break;
+
 		default:
 			if (machine_type_mismatch(file, "(unknown)", NULL,
 			    source_query))




More information about the Crash-utility mailing list