Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Roberts, Dennis" <Dennis.Roberts@sunquestinfo.com>
To: "'gdb-patches@sourceware.org'" <gdb-patches@sourceware.org>
Subject: [PATCH] Fix for 64-Bit Core Files on AIX
Date: Wed, 16 Apr 2008 08:12:00 -0000	[thread overview]
Message-ID: <4813EA4A50D35A44906A74A5E341D0B61A03388643@SQMAILBOX1.sunquestinfo.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 223 bytes --]

Could someone please review this patch and apply it if it passes review?

Note: the BFD modifications have already been submitted to the binutils mailing list; I just included them here for reference.

Thanks,
Dennis

[-- Attachment #2: aix-64-bit-core-files.patch --]
[-- Type: application/octet-stream, Size: 4857 bytes --]

diff -rc src.orig/bfd/ChangeLog src/bfd/ChangeLog
*** src.orig/bfd/ChangeLog	Mon Apr 14 12:58:48 2008
--- src/bfd/ChangeLog	Tue Apr 15 13:30:07 2008
***************
*** 1,3 ****
--- 1,14 ----
+ 2008-04-15  Dennis Roberts  <dennis.roberts@sunquestinfo.com>
+ 
+ 	* aix5ppc-core.c: Define macros for the default architecture and
+ 	machine for matching core files.
+ 	(xcoff64_core_p): Set the architecture and machine to the default
+ 	values defined in the macros mentioned above.
+ 	* rs6000-core.c: Define macros to determine whether or not the
+ 	core file header uses the core_dumpxx header format.
+ 	(rs6000coff_core_p): Don't match core files that use the
+ 	core_dumpxx header format.
+ 
  2008-04-14  Aurelien Jarno  <aurelien@aurel32.net>
  
  	* configure.in: Link with the PIC version of libiberty on
diff -rc src.orig/bfd/aix5ppc-core.c src/bfd/aix5ppc-core.c
*** src.orig/bfd/aix5ppc-core.c	Tue Jul  3 07:26:39 2007
--- src/bfd/aix5ppc-core.c	Tue Apr 15 13:33:11 2008
***************
*** 40,45 ****
--- 40,49 ----
  #include <sys/ldr.h>
  #include <core.h>
  
+ /* The default architecture and machine for matching core files. */
+ #define DEFAULT_ARCHITECTURE	bfd_arch_powerpc
+ #define DEFAULT_MACHINE		bfd_mach_ppc_620
+ 
  #define	core_hdr(abfd)		((struct core_dumpxx *) abfd->tdata.any)
  
  #define CHECK_FILE_OFFSET(s, v) \
***************
*** 48,53 ****
--- 52,59 ----
  const bfd_target *
  xcoff64_core_p (bfd *abfd)
  {
+   enum bfd_architecture arch;
+   unsigned long mach;
    struct core_dumpxx core, *new_core_hdr;
    struct stat statbuf;
    asection *sec;
***************
*** 217,222 ****
--- 223,233 ----
  	  sec->filepos = vminfo.vminfo_offset;
  	}
      }
+ 
+   /* Set the architecture and machine. */
+   arch = DEFAULT_ARCHITECTURE;
+   mach = DEFAULT_MACHINE;
+   bfd_default_set_arch_mach (abfd, arch, mach);
  
    return_value = (bfd_target *) abfd->xvec;	/* This is garbage for now.  */
  
diff -rc src.orig/bfd/rs6000-core.c src/bfd/rs6000-core.c
*** src.orig/bfd/rs6000-core.c	Tue Jul  3 07:26:42 2007
--- src/bfd/rs6000-core.c	Tue Apr 15 13:33:10 2008
***************
*** 136,141 ****
--- 136,154 ----
  # define CORE_NEW(c)	0
  #endif
  
+ /* Return whether CoreHdr C usese core_dumpxx structure.
+ 
+    FIXME: the core file format version number used here definitely indicates
+    that struct core_dumpxx should be used to represent the core file header,
+    but that may not be the only such format version number.  */
+ 
+ #ifdef AIX_5_CORE
+ # define CORE_DUMPXX_VERSION  267312562
+ # define CNEW_IS_CORE_DUMPXX(c)       ((c).new.c_version == CORE_DUMPXX_VERSION)
+ #else
+ # define CNEW_IS_CORE_DUMPXX(c)       0
+ #endif
+ 
  /* Return the c_stackorg field from struct core_dumpx C.  */
  
  #ifdef AIX_CORE_DUMPX_CORE
***************
*** 326,331 ****
--- 339,351 ----
      {
        if (bfd_get_error () != bfd_error_system_call)
  	bfd_set_error (bfd_error_wrong_format);
+       return NULL;
+     }
+ 
+   /* This isn't the right handler for 64-bit core files on AIX 5.x. */
+   if (CORE_NEW (core) && CNEW_IS_CORE_DUMPXX(core))
+     {
+       bfd_set_error (bfd_error_wrong_format);
        return NULL;
      }
  
diff -rc src.orig/gdb/ChangeLog src/gdb/ChangeLog
*** src.orig/gdb/ChangeLog	Mon Apr 14 12:47:28 2008
--- src/gdb/ChangeLog	Tue Apr 15 13:32:36 2008
***************
*** 1,3 ****
--- 1,8 ----
+ 2008-04-15  Dennis Roberts  <dennis.roberts@sunquestinfo.com>
+ 
+ 	* rs6000-tdep.c (rs6000_gdbarch_init): Use the BFD architecture,
+ 	rather than a hard-coded architecture, for xcoff executables.
+ 
  2008-04-14  Daniel Jacobowitz  <dan@codesourcery.com>
  
  	* Makefile.in (GNULIB_H): New.  Trigger all-lib.
diff -rc src.orig/gdb/rs6000-tdep.c src/gdb/rs6000-tdep.c
*** src.orig/gdb/rs6000-tdep.c	Wed Feb 20 07:34:43 2008
--- src/gdb/rs6000-tdep.c	Tue Apr 15 13:33:10 2008
***************
*** 3307,3324 ****
  	wordsize = 4;
      }
  
!   if (!from_xcoff_exec)
!     {
!       arch = info.bfd_arch_info->arch;
!       mach = info.bfd_arch_info->mach;
!     }
!   else
!     {
!       arch = bfd_arch_powerpc;
!       bfd_default_set_arch_mach (&abfd, arch, 0);
!       info.bfd_arch_info = bfd_get_arch_info (&abfd);
!       mach = info.bfd_arch_info->mach;
!     }
  
    /* For e500 executables, the apuinfo section is of help here.  Such
       section contains the identifier and revision number of each
--- 3307,3315 ----
  	wordsize = 4;
      }
  
!   /* Get the architecture and machine from the BFD. */
!   arch = info.bfd_arch_info->arch;
!   mach = info.bfd_arch_info->mach;
  
    /* For e500 executables, the apuinfo section is of help here.  Such
       section contains the identifier and revision number of each

             reply	other threads:[~2008-04-15 22:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-16  8:12 Roberts, Dennis [this message]
2008-04-16 21:34 ` Joel Brobecker
2008-04-16 21:55   ` Roberts, Dennis
2008-04-16 22:25     ` Joel Brobecker
2008-04-16 22:40       ` Roberts, Dennis
2008-04-17 21:16       ` Joel Brobecker
2008-04-17 21:25         ` Roberts, Dennis
2008-04-18 18:48         ` Roberts, Dennis
2008-04-19  1:26           ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4813EA4A50D35A44906A74A5E341D0B61A03388643@SQMAILBOX1.sunquestinfo.com \
    --to=dennis.roberts@sunquestinfo.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox