From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4705 invoked by alias); 9 Aug 2012 09:01:42 -0000 Received: (qmail 4608 invoked by uid 22791); 9 Aug 2012 09:01:37 -0000 X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL,BAYES_05,KAM_STOCKTIP,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_CP,TW_GP,TW_XL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Aug 2012 09:01:18 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1SzOcH-00068z-I5 from Hafiz_Abid@mentor.com ; Thu, 09 Aug 2012 02:01:17 -0700 Received: from SVR-IES-FEM-03.mgc.mentorg.com ([137.202.0.108]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 9 Aug 2012 02:01:15 -0700 Received: from EU-MBX-03.mgc.mentorg.com ([169.254.2.57]) by SVR-IES-FEM-03.mgc.mentorg.com ([169.254.100.23]) with mapi id 14.01.0289.001; Thu, 9 Aug 2012 09:59:35 +0100 From: "Abid, Hafiz" To: swamy sangamesh , "gdb-patches@sourceware.org" Subject: RE: AIX 64bit support Date: Thu, 09 Aug 2012 09:01:00 -0000 Message-ID: References: In-Reply-To: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-08/txt/msg00284.txt.bz2 Hi Sangamesh, I dont know this code much but a few things that caught my eye. Comments in= line. > -----Original Message----- > From: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] On Behalf Of swamy sangamesh > Sent: Thursday, August 09, 2012 9:23 AM > To: gdb-patches@sourceware.org > Subject: AIX 64bit support >=20 > Hi All, >=20 > Below patches adds the support for 64-bit gdb for ppc64 running on > AIX, plus some bug fixes which are caused > by the way gcc and xlc generated binary are read. Please consider the > patches if its fine. >=20 > gdb: >=20 >=20 > * configure.tgt (powerpc64-*-aix*): Match powerpc64 running > aix. >=20 > * configure.host (powerpc64-*-aix*): Likewise. >=20 > * aix-thread.c (ptrace64aix): Added BFD64 for 64 bit support. > (ptrace32): Likewise. > (pdc_read_regs): Likewise. > (pdc_write_regs): Likewise. > (aix_thread_resume): Likewise. > (fetch_regs_kernel_thread): Likewise. > (store_regs_kernel_thread): Likewise. >=20 > * inf-ptrace.c (inf_ptrace_follow_fork): Added BFD64 for 64 bit > support. > (inf_ptrace_me): Likewise. > (inf_ptrace_post_startup_inferior): Likewise. > (inf_ptrace_attach): Likewise. > (inf_ptrace_post_attach): Likewise. > (inf_ptrace_detach): Likewise. > (inf_ptrace_kill): Likewise. > (inf_ptrace_resume): Likewise. > (inf_ptrace_wait): Likewise. > (inf_ptrace_xfer_partial): Likewise. > (inf_ptrace_fetch_register): Likewise. > (inf_ptrace_store_register): Likewise. >=20 > * rs6000-nat.c (global): Check for __ld_info64 if compiling 64- > bit gdb. > (rs6000_ptrace32): Added BFD64 for 64 bit support. > (rs6000_ptrace64): Likewise. >=20 > * xcoffread.c (read_xcoff_symtab): Make fcn_start_addr large > enough to hold 64-bit address. > Skip reading symbols starting with @FIX. > Read correct auxilliary entry if the entries are more than one > in cases like xlc generated binary. > Read the filename from CSECT entry,if we break at CSECT entry > other than first entry we need to get > the filename instead of _start_. >=20 > * config/rs6000/nm-rs6000.h: When analysing core check if ptid > is not 1. >=20 > * symtab.c (find_pc_sect_line): Read correct line table > entries, xlc compiler generates extra entry. >=20 > --- ./gdb/configure.tgt_orig 2012-07-25 15:59:30.934837815 +0530 > +++ ./gdb/configure.tgt 2012-07-31 14:16:36.761045509 +0530 > @@ -406,7 +406,7 @@ > gdb_target_obs=3D"rs6000-tdep.o ppc-sysv-tdep.o ppcobsd-tdep.o \ > corelow.o solib.o solib-svr4.o" > ;; > -powerpc-*-aix* | rs6000-*-*) > +powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*) > # Target: PowerPC running AIX > gdb_target_obs=3D"rs6000-tdep.o rs6000-aix-tdep.o xcoffread.o \ > ppc-sysv-tdep.o solib.o solib-svr4.o" > --- ./gdb/configure.host_orig 2012-07-31 13:27:34.729045416 +0530 > +++ ./gdb/configure.host 2012-07-31 13:28:55.717046154 +0530 > @@ -123,7 +123,7 @@ > gdb_host=3Dnbsd ;; > mips64*-*-openbsd*) gdb_host=3Dobsd64 ;; >=20 > -powerpc-*-aix* | rs6000-*-*) > +powerpc-*-aix* | powerpc64-*-aix* | rs6000-*-*) > gdb_host=3Daix ;; > powerpc-*-linux*) gdb_host=3Dlinux ;; > powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu) > --- ./gdb/aix-thread.c_orig 2012-08-07 17:11:21.270057686 +0530 > +++ ./gdb/aix-thread.c 2012-08-07 17:11:17.998084929 +0530 > @@ -239,23 +239,42 @@ > } >=20 > /* Call ptracex (REQ, ID, ADDR, DATA, BUF). Return success. */ > +/* For 64-bit gdb Call ptrace64 to trace 32-bit and 64-bit debugee */ >=20 > static int > +#ifdef BFD64 > +ptrace64aix (int req, long long id, long long addr, int data, int > *buf) > +{ > + errno =3D 0; > + return ptrace_check (req, id, ptrace64 (req, id, addr, data, buf)); > +} > +#else > ptrace64aix (int req, int id, long long addr, int data, int *buf) > { > errno =3D 0; > return ptrace_check (req, id, ptracex (req, id, addr, data, buf)); > } > +#endif >=20 > /* Call ptrace (REQ, ID, ADDR, DATA, BUF). Return success. */ > +/* For 64-bit gdb Call ptrace64 to trace 32-bit and 64-bit debugee */ >=20 > static int > +#ifdef BFD64 > +ptrace32 (int req, long long id, long long addr, int data, int *buf) > +{ > + errno =3D 0; > + return ptrace_check (req, id, > + ptrace64 (req, id, addr, data, buf)); > +} > +#else > ptrace32 (int req, int id, int *addr, int data, int *buf) > { > errno =3D 0; > return ptrace_check (req, id, > ptrace (req, id, (int *) addr, data, buf)); > } > +#endif >=20 > /* If *PIDP is a composite process/thread id, convert it to a > process id. */ > @@ -346,14 +365,23 @@ > { > if (arch64) > { > + #ifdef BFD64 > + if (!ptrace64aix (PTT_READ_GPRS, tid, > + (long long) gprs64, 0, NULL)) > + #else > if (!ptrace64aix (PTT_READ_GPRS, tid, > (unsigned long) gprs64, 0, NULL)) > + #endif > memset (gprs64, 0, sizeof (gprs64)); > memcpy (context->gpr, gprs64, sizeof(gprs64)); > } > else > { > + #ifdef BFD64 > + if (!ptrace32 (PTT_READ_GPRS, tid, (long long) gprs32, 0, > NULL)) > + #else > if (!ptrace32 (PTT_READ_GPRS, tid, gprs32, 0, NULL)) > + #endif If you introduce new functions which has the #ifdef checks and then call th= ose functions from here then code will be a lot cleaner in my opinion. Then= all these #ifdef checks will only be in one place. > memset (gprs32, 0, sizeof (gprs32)); > memcpy (context->gpr, gprs32, sizeof(gprs32)); > } > @@ -362,7 +390,11 @@ > /* Floating-point registers. */ > if (flags & PTHDB_FLAG_FPRS) > { > + #ifdef BFD64 > + if (!ptrace32 (PTT_READ_FPRS, tid, (long long) fprs, 0 , NULL)) > + #else > if (!ptrace32 (PTT_READ_FPRS, tid, (void *) fprs, 0, NULL)) > + #endif > memset (fprs, 0, sizeof (fprs)); > memcpy (context->fpr, fprs, sizeof(fprs)); > } > @@ -372,14 +404,23 @@ > { > if (arch64) > { > + #ifdef BFD64 > + if (!ptrace64aix (PTT_READ_SPRS, tid, > + (long long) &sprs64, 0, NULL)) > + #else > if (!ptrace64aix (PTT_READ_SPRS, tid, > (unsigned long) &sprs64, 0, NULL)) > + #endif > memset (&sprs64, 0, sizeof (sprs64)); > memcpy (&context->msr, &sprs64, sizeof(sprs64)); > } > else > { > + #ifdef BFD64 > + if (!ptrace32 (PTT_READ_SPRS, tid, (long long) &sprs32, 0, > NULL)) > + #else > if (!ptrace32 (PTT_READ_SPRS, tid, (int *) &sprs32, 0, NULL)) > + #endif > memset (&sprs32, 0, sizeof (sprs32)); > memcpy (&context->msr, &sprs32, sizeof(sprs32)); > } > @@ -411,16 +452,29 @@ > if (flags & PTHDB_FLAG_GPRS) > { > if (arch64) > + #ifdef BFD64 > + ptrace64aix (PTT_WRITE_GPRS, tid, > + (long long) context->gpr, 0, NULL); > + #else > ptrace64aix (PTT_WRITE_GPRS, tid, > (unsigned long) context->gpr, 0, NULL); > + #endif > else > + #ifdef BFD64 > + ptrace32 (PTT_WRITE_GPRS, tid, (long long) context->gpr, 0, > NULL); > + #else > ptrace32 (PTT_WRITE_GPRS, tid, (int *) context->gpr, 0, NULL); > + #endif > } >=20 > /* Floating-point registers. */ > if (flags & PTHDB_FLAG_FPRS) > { > + #ifdef BFD64 > + ptrace32 (PTT_WRITE_FPRS, tid, (long long) context->fpr, 0, > NULL); > + #else > ptrace32 (PTT_WRITE_FPRS, tid, (int *) context->fpr, 0, NULL); > + #endif > } >=20 > /* Special-purpose registers. */ > @@ -428,12 +482,21 @@ > { > if (arch64) > { > + #ifdef BFD64 > + ptrace64aix (PTT_WRITE_SPRS, tid, > + (long long) &context->msr, 0, NULL); > + #else > ptrace64aix (PTT_WRITE_SPRS, tid, > (unsigned long) &context->msr, 0, NULL); > + #endif > } > else > { > + #ifdef BFD64 > + ptrace32 (PTT_WRITE_SPRS, tid, (long long) &context->msr, 0, > NULL); > + #else > ptrace32 (PTT_WRITE_SPRS, tid, (void *) &context->msr, 0, > NULL); > + #endif > } > } > return 0; > @@ -998,11 +1061,21 @@ > tid[1] =3D 0; >=20 > if (arch64) > + #ifdef BFD64 > + ptrace64aix (PTT_CONTINUE, tid[0], (long long) 1, > + target_signal_to_host (sig), (void *) tid); > + #else > ptrace64aix (PTT_CONTINUE, tid[0], 1, > target_signal_to_host (sig), (void *) tid); > + #endif > else > + #ifdef BFD64 > + ptrace32 (PTT_CONTINUE, tid[0], (long long) 1, > + target_signal_to_host (sig), (void *) tid); > + #else > ptrace32 (PTT_CONTINUE, tid[0], (int *) 1, > target_signal_to_host (sig), (void *) tid); > + #endif > } > } >=20 > @@ -1231,14 +1304,24 @@ > { > if (arch64) > { > + #ifdef BFD64 > + if (!ptrace64aix (PTT_READ_GPRS, tid, > + (long long) gprs64, 0, NULL)) > + #else > if (!ptrace64aix (PTT_READ_GPRS, tid, > (unsigned long) gprs64, 0, NULL)) > + #endif > memset (gprs64, 0, sizeof (gprs64)); > supply_gprs64 (regcache, gprs64); > } > else > { > + #ifdef BFD64 > + if (!ptrace32 (PTT_READ_GPRS, tid, > + (long long) gprs32, 0, NULL)) > + #else > if (!ptrace32 (PTT_READ_GPRS, tid, gprs32, 0, NULL)) > + #endif > memset (gprs32, 0, sizeof (gprs32)); > for (i =3D 0; i < ppc_num_gprs; i++) > supply_reg32 (regcache, tdep->ppc_gp0_regnum + i, gprs32[i]); > @@ -1252,7 +1335,12 @@ > || (regno >=3D tdep->ppc_fp0_regnum > && regno < tdep->ppc_fp0_regnum + ppc_num_fprs))) > { > + #ifdef BFD64 > + if (!ptrace32 (PTT_READ_FPRS, tid, > + (long long) fprs, 0, NULL)) > + #else > if (!ptrace32 (PTT_READ_FPRS, tid, (void *) fprs, 0, NULL)) > + #endif > memset (fprs, 0, sizeof (fprs)); > supply_fprs (regcache, fprs); > } > @@ -1263,8 +1351,13 @@ > { > if (arch64) > { > + #ifdef BFD64 > + if (!ptrace64aix (PTT_READ_SPRS, tid, > + (long long ) &sprs64, 0, NULL)) > + #else > if (!ptrace64aix (PTT_READ_SPRS, tid, > (unsigned long) &sprs64, 0, NULL)) > + #endif > memset (&sprs64, 0, sizeof (sprs64)); > supply_sprs64 (regcache, sprs64.pt_iar, sprs64.pt_msr, > sprs64.pt_cr, sprs64.pt_lr, sprs64.pt_ctr, > @@ -1274,7 +1367,12 @@ > { > struct gdbarch_tdep *tdep =3D gdbarch_tdep (gdbarch); >=20 > + #ifdef BFD64 > + if (!ptrace32 (PTT_READ_SPRS, tid, (long long ) &sprs32, > + 0, NULL)) > + #else > if (!ptrace32 (PTT_READ_SPRS, tid, (int *) &sprs32, 0, NULL)) > + #endif > memset (&sprs32, 0, sizeof (sprs32)); > supply_sprs32 (regcache, sprs32.pt_iar, sprs32.pt_msr, > sprs32.pt_cr, > sprs32.pt_lr, sprs32.pt_ctr, sprs32.pt_xer, > @@ -1561,16 +1659,32 @@ > if (arch64) > { > /* Pre-fetch: some regs may not be in the cache. */ > + #ifdef BFD64 > + ptrace64aix (PTT_READ_GPRS, tid, (long long) gprs64, 0, > NULL); > + #else > ptrace64aix (PTT_READ_GPRS, tid, (unsigned long) gprs64, 0, > NULL); > + #endif > fill_gprs64 (regcache, gprs64); > + #ifdef BFD64 > + ptrace64aix (PTT_WRITE_GPRS, tid, (long long) gprs64, 0, > NULL); > + #else > ptrace64aix (PTT_WRITE_GPRS, tid, (unsigned long) gprs64, 0, > NULL); > + #endif > } > else > { > /* Pre-fetch: some regs may not be in the cache. */ > + #ifdef BFD64 > + ptrace32 (PTT_READ_GPRS, tid, (long long) gprs32, 0, NULL); > + #else > ptrace32 (PTT_READ_GPRS, tid, gprs32, 0, NULL); > + #endif > fill_gprs32 (regcache, gprs32); > + #ifdef BFD64 > + ptrace32 (PTT_WRITE_GPRS, tid, (long long) gprs32, 0, NULL); > + #else > ptrace32 (PTT_WRITE_GPRS, tid, gprs32, 0, NULL); > + #endif > } > } >=20 > @@ -1582,9 +1696,17 @@ > && regno < tdep->ppc_fp0_regnum + ppc_num_fprs))) > { > /* Pre-fetch: some regs may not be in the cache. */ > + #ifdef BFD64 > + ptrace32 (PTT_READ_FPRS, tid, (long long) fprs, 0, NULL); > + #else > ptrace32 (PTT_READ_FPRS, tid, (void *) fprs, 0, NULL); > + #endif > fill_fprs (regcache, fprs); > + #ifdef BFD64 > + ptrace32 (PTT_WRITE_FPRS, tid, (long long) fprs, 0, NULL); > + #else > ptrace32 (PTT_WRITE_FPRS, tid, (void *) fprs, 0, NULL); > + #endif > } >=20 > /* Special-purpose registers. */ > @@ -1594,13 +1716,23 @@ > if (arch64) > { > /* Pre-fetch: some registers won't be in the cache. */ > + #ifdef BFD64 > + ptrace64aix (PTT_READ_SPRS, tid, > + (long long) &sprs64, 0, NULL); > + #else > ptrace64aix (PTT_READ_SPRS, tid, > (unsigned long) &sprs64, 0, NULL); > + #endif > fill_sprs64 (regcache, &sprs64.pt_iar, &sprs64.pt_msr, > &sprs64.pt_cr, &sprs64.pt_lr, &sprs64.pt_ctr, > &sprs64.pt_xer, &sprs64.pt_fpscr); > + #ifdef BFD64 > + ptrace64aix (PTT_WRITE_SPRS, tid, > + (long long ) &sprs64, 0, NULL); > + #else > ptrace64aix (PTT_WRITE_SPRS, tid, > (unsigned long) &sprs64, 0, NULL); > + #endif > } > else > { > @@ -1616,7 +1748,12 @@ > gdb_assert (sizeof (sprs32.pt_iar) =3D=3D 4); >=20 > /* Pre-fetch: some registers won't be in the cache. */ > + #ifdef BFD64 > + ptrace32 (PTT_READ_SPRS, tid, > + (long long) &sprs32, 0, NULL); > + #else > ptrace32 (PTT_READ_SPRS, tid, (int *) &sprs32, 0, NULL); > + #endif >=20 > fill_sprs32 (regcache, &tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, > &tmp_ctr, &tmp_xer, &tmp_fpscr); > @@ -1635,7 +1772,11 @@ > regcache_raw_collect (regcache, tdep->ppc_mq_regnum, > &sprs32.pt_mq); >=20 > + #ifdef BFD64 > + ptrace32 (PTT_WRITE_SPRS, tid, (long long) &sprs32, 0, NULL); > + #else > ptrace32 (PTT_WRITE_SPRS, tid, (int *) &sprs32, 0, NULL); > + #endif > } > } > } > --- ./gdb/inf-ptrace.c_orig 2012-07-25 21:07:04.273078850 +0530 > +++ ./gdb/inf-ptrace.c 2012-08-02 00:35:56.425443341 +0530 > @@ -49,8 +49,13 @@ >=20 > pid =3D ptid_get_pid (inferior_ptid); >=20 > + #ifdef BFD64 > + if (ptrace64 (PT_GET_PROCESS_STATE, (long long) pid, > + (long long) &pe, sizeof pe) =3D=3D -1) > + #else > if (ptrace (PT_GET_PROCESS_STATE, pid, > (PTRACE_TYPE_ARG3)&pe, sizeof pe) =3D=3D -1) > + #endif > perror_with_name (("ptrace")); >=20 > gdb_assert (pe.pe_report_event =3D=3D PTRACE_FORK); > @@ -74,7 +79,13 @@ > it. */ > remove_breakpoints (); >=20 > + #ifdef BFD64 > + if (ptrace64 (PT_DETACH, (long long) pid, > + (long long) 1, 0) =3D=3D -1) > + #else > if (ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3)1, 0) =3D=3D -1) > + #endif > + > perror_with_name (("ptrace")); >=20 > /* Switch inferior_ptid out of the parent's way. */ > @@ -90,7 +101,12 @@ > /* Breakpoints have already been detached from the child by > infrun.c. */ >=20 > + #ifdef BFD64 > + if (ptrace64 (PT_DETACH, (long long) fpid, > + (long long) 1, 0) =3D=3D -1) > + #else > if (ptrace (PT_DETACH, fpid, (PTRACE_TYPE_ARG3)1, 0) =3D=3D -1) > + #endif > perror_with_name (("ptrace")); > } >=20 > @@ -106,7 +122,11 @@ > inf_ptrace_me (void) > { > /* "Trace me, Dr. Memory!" */ > + #ifdef BFD64 > + ptrace64 (PT_TRACE_ME, (long long) 0, (long long) 0, 0, 0); > + #else > ptrace (PT_TRACE_ME, 0, (PTRACE_TYPE_ARG3)0, 0); > + #endif > } >=20 > /* Start a new inferior Unix child process. EXEC_FILE is the file to > @@ -159,8 +179,13 @@ > /* Set the initial event mask. */ > memset (&pe, 0, sizeof pe); > pe.pe_set_event |=3D PTRACE_FORK; > + #ifdef BFD64 > + if (ptrace64 (PT_SET_EVENT_MASK, (long long) ptid_get_pid (pid), > + (long long) &pe, sizeof pe, 0) =3D=3D -1) > + #else > if (ptrace (PT_SET_EVENT_MASK, ptid_get_pid (pid), > (PTRACE_TYPE_ARG3)&pe, sizeof pe) =3D=3D -1) > + #endif > perror_with_name (("ptrace")); > } >=20 > @@ -229,7 +254,11 @@ >=20 > #ifdef PT_ATTACH > errno =3D 0; > + #ifdef BFD64 > + ptrace64 (PT_ATTACH, (long long) pid, (long long) 0, 0, 0); > + #else > ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3)0, 0); > + #endif > if (errno !=3D 0) > perror_with_name (("ptrace")); > #else > @@ -259,8 +288,13 @@ > /* Set the initial event mask. */ > memset (&pe, 0, sizeof pe); > pe.pe_set_event |=3D PTRACE_FORK; > + #ifdef BFD64 > + if (ptrace64 (PT_SET_EVENT_MASK, (long long) pid, > + (long long) &pe, sizeof pe, 0) =3D=3D -1) > + #else > if (ptrace (PT_SET_EVENT_MASK, pid, > (PTRACE_TYPE_ARG3)&pe, sizeof pe) =3D=3D -1) > + #endif > perror_with_name (("ptrace")); > } >=20 > @@ -293,7 +327,11 @@ > previously attached to the inferior. It *might* work if we > started the process ourselves. */ > errno =3D 0; > + #ifdef BFD64 > + ptrace64 (PT_DETACH, (long long) pid, (long long) 1, sig, 0); > + #else > ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3)1, sig); > + #endif > if (errno !=3D 0) > perror_with_name (("ptrace")); > #else > @@ -318,7 +356,11 @@ > if (pid =3D=3D 0) > return; >=20 > + #ifdef BFD64 > + ptrace64 (PT_KILL, (long long) pid, (long long) 0, 0, 0); > + #else > ptrace (PT_KILL, pid, (PTRACE_TYPE_ARG3)0, 0); > + #endif > waitpid (pid, &status, 0); >=20 > target_mourn_inferior (); > @@ -372,7 +414,12 @@ > where it was. If GDB wanted it to start some other way, we have > already written a new program counter value to the child. */ > errno =3D 0; > + #ifdef BFD64 > + ptrace64 (request, (long long) pid, (long long) 1, > + target_signal_to_host (signal), 0); > + #else > ptrace (request, pid, (PTRACE_TYPE_ARG3)1, target_signal_to_host > (signal)); > + #endif > if (errno !=3D 0) > perror_with_name (("ptrace")); > } > @@ -425,8 +472,13 @@ > ptrace_state_t pe; > pid_t fpid; >=20 > + #ifdef BFD64 > + if (ptrace64 (PT_GET_PROCESS_STATE, (long long) pid, > + (long long) &pe, sizeof pe, 0) =3D=3D -1) > + #else > if (ptrace (PT_GET_PROCESS_STATE, pid, > (PTRACE_TYPE_ARG3)&pe, sizeof pe) =3D=3D -1) > + #endif > perror_with_name (("ptrace")); >=20 > switch (pe.pe_report_event) > @@ -440,8 +492,13 @@ > if (fpid =3D=3D -1) > perror_with_name (("waitpid")); >=20 > + #ifdef BFD64 > + if (ptrace64 (PT_GET_PROCESS_STATE, (long long) fpid, > + (long long) &pe, sizeof pe, 0) =3D=3D -1) > + #else > if (ptrace (PT_GET_PROCESS_STATE, fpid, > (PTRACE_TYPE_ARG3)&pe, sizeof pe) =3D=3D -1) > + #endif > perror_with_name (("ptrace")); >=20 > gdb_assert (pe.pe_report_event =3D=3D PTRACE_FORK); > @@ -495,7 +552,11 @@ > piod.piod_len =3D len; >=20 > errno =3D 0; > + #ifdef BFD64 > + if (ptrace64 (PT_IO, (long long) pid, (long long) &piod, 0, 0) > =3D=3D 0) > + #else > if (ptrace (PT_IO, pid, (caddr_t)&piod, 0) =3D=3D 0) > + #endif > /* Return the actual number of bytes read or written. */ > return piod.piod_len; > /* If the PT_IO request is somehow not supported, fallback on > @@ -536,9 +597,14 @@ > || (offset + partial_len > < rounded_offset + sizeof (PTRACE_TYPE_RET))) > /* Need part of initial word -- fetch it. */ > + #ifdef BFD64 > + buffer.word =3D ptrace64 (PT_READ_I, (long long) pid, > + (long long) rounded_offset, 0, > 0); > + #else > buffer.word =3D ptrace (PT_READ_I, pid, > (PTRACE_TYPE_ARG3)(uintptr_t) > rounded_offset, 0); > + #endif >=20 > /* Copy data to be written over corresponding part of > buffer. */ > @@ -546,17 +612,28 @@ > writebuf, partial_len); >=20 > errno =3D 0; > + #ifdef BFD64 > + ptrace64 (PT_WRITE_D, (long long) pid, > + (long long) rounded_offset, buffer.word, 0); > + #else > ptrace (PT_WRITE_D, pid, > (PTRACE_TYPE_ARG3)(uintptr_t)rounded_offset, > buffer.word); > + #endif > if (errno) > { > /* Using the appropriate one (I or D) is necessary for > Gould NP1, at least. */ > errno =3D 0; > + #ifdef BFD64 > + ptrace64 (PT_WRITE_I, (long long) pid, > + (long long) rounded_offset, > + buffer.word, 0); > + #else > ptrace (PT_WRITE_I, pid, > (PTRACE_TYPE_ARG3)(uintptr_t)rounded_offset, > buffer.word); > + #endif > if (errno) > return 0; > } > @@ -565,9 +642,15 @@ > if (readbuf) > { > errno =3D 0; > + #ifdef BFD64 > + buffer.word =3D ptrace64 (PT_READ_I, (long long) pid, > + (long long) rounded_offset, > + 0, 0); > + #else > buffer.word =3D ptrace (PT_READ_I, pid, > (PTRACE_TYPE_ARG3)(uintptr_t)rounded_offset, > 0); > + #endif > if (errno) > return 0; > /* Copy appropriate bytes out of the buffer. */ > @@ -687,7 +770,11 @@ > for (i =3D 0; i < size / sizeof (PTRACE_TYPE_RET); i++) > { > errno =3D 0; > + #ifdef BFD64 > + buf[i] =3D ptrace64 (PT_READ_U, (long long) pid, (long long) addr, > 0, 0); > + #else > buf[i] =3D ptrace (PT_READ_U, pid, > (PTRACE_TYPE_ARG3)(uintptr_t)addr, 0); > + #endif > if (errno !=3D 0) > error (_("Couldn't read register %s (#%d): %s."), > gdbarch_register_name (gdbarch, regnum), > @@ -746,7 +833,11 @@ > for (i =3D 0; i < size / sizeof (PTRACE_TYPE_RET); i++) > { > errno =3D 0; > + #ifdef BFD64 > + ptrace64 (PT_WRITE_U, (long long) pid, (long long) addr, buf[i], > 0); > + #else > ptrace (PT_WRITE_U, pid, (PTRACE_TYPE_ARG3)(uintptr_t)addr, > buf[i]); > + #endif > if (errno !=3D 0) > error (_("Couldn't write register %s (#%d): %s."), > gdbarch_register_name (gdbarch, regnum), > --- ./gdb/rs6000-nat.c_orig 2012-07-25 21:07:40.838080241 +0530 > +++ ./gdb/rs6000-nat.c 2012-07-27 11:27:27.560170366 +0530 > @@ -66,7 +66,7 @@ > /* In 32-bit compilation mode (which is the only mode from which > ptrace() > works on 4.3), __ld_info32 is #defined as equivalent to ld_info. > */ >=20 > -#ifdef __ld_info32 > +#if defined (__ld_info32) || defined (__ld_info64) > # define ARCH3264 > #endif >=20 > @@ -181,7 +181,11 @@ > static int > rs6000_ptrace32 (int req, int id, int *addr, int data, int *buf) > { > + #ifdef BFD64 > + int ret =3D ptrace64 (req, (long long) id, (long long) addr, data, > buf); > + #else > int ret =3D ptrace (req, id, (int *)addr, data, buf); > + #endif > #if 0 > printf ("rs6000_ptrace32 (%d, %d, 0x%x, %08x, 0x%x) =3D 0x%x\n", > req, id, (unsigned int)addr, data, (unsigned int)buf, ret); > @@ -195,7 +199,11 @@ > rs6000_ptrace64 (int req, int id, long long addr, int data, void *buf) > { > #ifdef ARCH3264 > + #ifdef BFD64 > + int ret =3D ptrace64 (req, (long long) id, addr, data, (int *)buf); > + #else > int ret =3D ptracex (req, id, addr, data, buf); > + #endif > #else > int ret =3D 0; > #endif > --- ./gdb/xcoffread.c_orig 2012-08-07 17:36:42.378057756 +0530 > +++ ./gdb/xcoffread.c 2012-08-07 17:36:48.702060320 +0530 > @@ -956,7 +956,7 @@ > unsigned int max_symnum; > int just_started =3D 1; > int depth =3D 0; > - int fcn_start_addr =3D 0; > + file_ptr fcn_start_addr =3D 0; >=20 > struct coff_symbol fcn_stab_saved =3D { 0 }; >=20 > @@ -1061,7 +1061,7 @@ > } >=20 > /* if symbol name starts with ".$" or "$", ignore it. */ > - if (cs->c_name[0] =3D=3D '$' > + if (cs->c_name[0] =3D=3D '$' || (!strncmp(cs->c_name, "@FIX", 4)) > || (cs->c_name[1] =3D=3D '$' && cs->c_name[0] =3D=3D '.')) Now that you have changed the if condition, please also update the comments= before it. > continue; >=20 > @@ -1081,8 +1081,7 @@ > /* Done with all files, everything from here on is globals. */ > } >=20 > - if ((cs->c_sclass =3D=3D C_EXT || cs->c_sclass =3D=3D C_HIDEXT) > - && cs->c_naux =3D=3D 1) > + if (cs->c_sclass =3D=3D C_EXT || cs->c_sclass =3D=3D C_HIDEXT) > { > /* Dealing with a symbol with a csect entry. */ >=20 > @@ -1093,8 +1092,16 @@ > #define CSECT_SCLAS(PP) (CSECT(PP).x_smclas) >=20 > /* Convert the auxent to something we can access. */ > - bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs- > >c_sclass, > - 0, cs->c_naux, &main_aux); > + /* xcoff can have more than 1 auxent */ > + if (cs->c_naux > 1) > + bfd_coff_swap_aux_in (abfd, > + raw_auxptr + ((coff_data > (abfd)->local_symesz) * (cs->c_naux - 1)), > + cs->c_type, cs->c_sclass, > cs->c_naux - 1, cs->c_naux, &main_aux); > + else if (cs->c_naux =3D=3D 1) > + bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs- > >c_sclass, > + 0, cs->c_naux, &main_aux); > + else > + ; >=20 > switch (CSECT_SMTYP (&main_aux)) > { > @@ -1123,43 +1130,44 @@ > approach does not work! GCC (and I think xlc) > seem > to put all the code in the unnamed program csect. > */ >=20 > - if (last_csect_name) > - { > - complete_symtab (filestring, file_start_addr); > - cur_src_end_addr =3D file_end_addr; > - end_symtab (file_end_addr, objfile, > - SECT_OFF_TEXT (objfile)); > - end_stabs (); > - start_stabs (); > - /* Give all csects for this source file the same > - name. */ > - start_symtab (filestring, NULL, (CORE_ADDR) 0); > - record_debugformat (debugfmt); > - } > - > - /* If this is the very first csect seen, > - basically `__start'. */ > - if (just_started) > - { > - first_object_file_end > - =3D cs->c_value + CSECT_LEN (&main_aux); > - just_started =3D 0; > - } > - > - file_start_addr =3D > - cs->c_value + ANOFFSET (objfile->section_offsets, > - SECT_OFF_TEXT (objfile)); > - file_end_addr =3D file_start_addr + CSECT_LEN > (&main_aux); > - > - if (cs->c_name && (cs->c_name[0] =3D=3D '.' > - || cs->c_name[0] =3D=3D '@')) > - { > - last_csect_name =3D cs->c_name; > - last_csect_val =3D cs->c_value; > - last_csect_sec =3D secnum_to_section (cs->c_secnum, > - objfile); > - } > - } > + if (just_started) > + { > + first_object_file_end > + =3D cs->c_value + CSECT_LEN (&main_aux); > + just_started =3D 0; > + } > + > + file_start_addr =3D > + cs->c_value + ANOFFSET (objfile- > >section_offsets, > + SECT_OFF_TEXT > (objfile)); > + file_end_addr =3D file_start_addr + CSECT_LEN > (&main_aux); > + > + if (cs->c_name && (cs->c_name[0] =3D=3D '.' > + || cs->c_name[0] =3D=3D '@')) > + { > + last_csect_name =3D cs->c_name; > + last_csect_val =3D cs->c_value; > + last_csect_sec =3D secnum_to_section (cs- > >c_secnum, > + > objfile); > + } > + if (last_csect_name) > + { > + filestring =3D pst->filename; > + complete_symtab (filestring, > file_start_addr); > + cur_src_end_addr =3D file_end_addr; > + end_symtab (file_end_addr, objfile, > + SECT_OFF_TEXT (objfile)); > + end_stabs (); > + start_stabs (); > + /* Give all csects for this source file the > same > + name. */ > + start_symtab (filestring, (char *)NULL, > (CORE_ADDR) 0); > + record_debugformat (debugfmt); > + } > + /* If this is the very first csect seen, > + basically `__start'. */ > + } > + > continue; >=20 > /* All other symbols are put into the minimal symbol > --- ./gdb/config/rs6000/nm-rs6000.h_orig 2012-08-07 17:48:46.181058139 > +0530 > +++ ./gdb/config/rs6000/nm-rs6000.h 2012-08-07 17:47:18.749096013 +0530 > @@ -30,7 +30,7 @@ > and figure out where the shared libraries have got to. */ >=20 > #define SOLIB_ADD(a, b, c, d) \ > - if (PIDGET (inferior_ptid)) \ > + if (PIDGET (inferior_ptid) !=3D 1) \ > /* Attach to process. */ \ > xcoff_relocate_symtab (PIDGET (inferior_ptid)); \ > else \ > --- ./gdb/symtab.c_orig 2012-08-07 17:52:15.181060405 +0530 > +++ ./gdb/symtab.c 2012-08-07 17:53:04.653058722 +0530 > @@ -2072,6 +2072,9 @@ > { > /* Leave prev pointing to the linetable entry for the last line > that started at or before PC. */ > + if ((item->pc > pc) && !i) /* for xlc one less entry for > line table */ > + prev =3D item; /* point item as prev */ > + > if (item->pc > pc) > break; >=20 >=20 > bfd: >=20 > * configure (powerpc64-*-aix[5-9].*): Match powerpc64 running > aix for core file support >=20 > * rs6000-core.c: Check for __ld_info64 if compiling 64-bit gdb. > Added BFD64 check if we are using old core file format for 32- > bit gdb. > Set sizeof CORE_COMMONSZ appropriately in case of either new > or old core file format. > (read_hdr): Added BFD64 check for 64-bit support. > (rs6000coff_core_p): Likewise. > (rs6000coff_core_file_matches_executable_p): Likewise. > (rs6000coff_core_file_failing_command): Likewise. > (rs6000coff_core_file_failing_command): Likewise. >=20 >=20 > --- ./bfd/configure_orig 2011-11-11 12:01:31.188995290 +0530 > +++ ./bfd/configure 2012-07-25 16:07:39.010735665 +0530 > @@ -13973,7 +13973,7 @@ > rs6000-*-lynx*) > COREFILE=3Dlynx-core.lo > ;; > - rs6000-*-aix[5-9].* | powerpc-*-aix[5-9].*) > + rs6000-*-aix[5-9].* | powerpc-*-aix[5-9].* | powerpc64-*-aix[5-9].*) > COREFILE=3Drs6000-core.lo > COREFLAG=3D"$COREFLAG -DAIX_5_CORE -DAIX_CORE_DUMPX_CORE" > ;; > @@ -14011,6 +14011,7 @@ > rs6000-*-*) COREFILE=3Drs6000-core.lo ;; > powerpc-*-aix4*) COREFILE=3Drs6000-core.lo ;; > powerpc-*-aix*) COREFILE=3Drs6000-core.lo ;; > + powerpc64-*-aix) COREFILE=3Drs6000-core.lo ;; > powerpc-*-beos*) ;; > powerpc-*-freebsd* | powerpc-*-kfreebsd*-gnu) > COREFILE=3D'' ;; > --- ./bfd/rs6000-core.c_orig 2011-11-10 19:02:59.093607185 +0530 > +++ ./bfd/rs6000-core.c 2012-07-27 12:32:11.960181190 +0530 > @@ -94,7 +94,7 @@ > /* Union of 32-bit and 64-bit versions of ld_info. */ >=20 > typedef union { > -#ifdef __ld_info32 > +#if defined (__ld_info32) || defined (__ld_info64) > struct __ld_info32 l32; > struct __ld_info64 l64; > #else > @@ -111,8 +111,10 @@ > #else > struct core_dump new_dump; /* for simpler coding */ > #endif > +#ifndef BFD64 /* use old only if gdb is 32-bit */ > struct core_dump old; /* old AIX 4.2- core dump, still > used on > 4.3+ with appropriate SMIT config */ > +#endif > } CoreHdr; >=20 > /* Union of old and new vm_info structures. */ > @@ -124,14 +126,20 @@ > #else > struct vm_info new_dump; > #endif > +#ifndef BFD64 > struct vm_info old; > +#endif > } VmInfo; > #endif >=20 > /* Return whether CoreHdr C is in new or old format. */ >=20 > #ifdef AIX_CORE_DUMPX_CORE > -# define CORE_NEW(c) (!(c).old.c_entries) > + #ifndef BFD64 > + # define CORE_NEW(c) (!(c).old.c_entries) > + #else > + # define CORE_NEW(c) (!(c).new_dump.c_entries) > + #endif > #else > # define CORE_NEW(c) 0 > #endif > @@ -260,8 +268,13 @@ >=20 > /* Size of the leading portion that old and new core dump structures > have in > common. */ > -#define CORE_COMMONSZ ((int) &((struct core_dump *) 0)->c_entries \ > - + sizeof (((struct core_dump *) 0)->c_entries)) > +#ifdef AIX_CORE_DUMPX_CORE > +#define CORE_COMMONSZ ((long) &((struct core_dumpx *) 0)->c_entries \ > + + sizeof (((struct core_dumpx *) 0)- > >c_entries)) > +#else > +#define CORE_COMMONSZ ((int) &((struct core_dump *) 0)->c_entries \ > + + sizeof (((struct core_dump *) 0)->c_entries) > +#endif >=20 > /* Define prototypes for certain functions, to avoid a compiler > warning > saying that they are missing. */ > @@ -292,8 +305,10 @@ > /* Read the trailing portion of the structure. */ > if (CORE_NEW (*core)) > size =3D sizeof (core->new_dump); > + #ifndef BFD64 > else > size =3D sizeof (core->old); > + #endif > size -=3D CORE_COMMONSZ; > return bfd_bread ((char *) core + CORE_COMMONSZ, size, abfd) =3D=3D > size; > } > @@ -358,6 +373,7 @@ > c_stackend =3D CNEW_STACKORG (core.new_dump) + c_size; > c_lsize =3D CNEW_LSIZE (core.new_dump); > c_loader =3D CNEW_LOADER (core.new_dump); > + #ifndef BFD64 > proc64 =3D CNEW_PROC64 (core.new_dump); > } > else > @@ -368,6 +384,7 @@ > c_stackend =3D COLD_STACKEND; > c_lsize =3D 0x7ffffff; > c_loader =3D (file_ptr) (ptr_to_uint) COLD_LOADER (core.old); > + #endif > proc64 =3D 0; > } >=20 > @@ -381,11 +398,13 @@ > c_regsize =3D sizeof (CNEW_MSTSAVE (core.new_dump)); > c_regptr =3D &CNEW_MSTSAVE (core.new_dump); > } > + #ifndef BFD64 > else > { > c_regsize =3D sizeof (COLD_MSTSAVE (core.old)); > c_regptr =3D &COLD_MSTSAVE (core.old); > } > + #endif > c_regoff =3D (char *) c_regptr - (char *) &core; >=20 > if (bfd_stat (abfd, &statbuf) < 0) > @@ -435,7 +454,11 @@ > } >=20 > /* Sanity check on the c_tab field. */ > + #ifndef BFD64 > if (!CORE_NEW (core) && (c_loader < (file_ptr) sizeof core.old || > + #else > + if (!CORE_NEW (core) && (c_loader < (file_ptr) sizeof core.new_dump > || > + #endif > c_loader >=3D statbuf.st_size || > c_loader >=3D c_stack)) > { > @@ -449,7 +472,11 @@ > bfd_get_filename (abfd)); >=20 > /* Allocate core file header. */ > + #ifndef BFD64 > size =3D CORE_NEW (core) ? sizeof (core.new_dump) : sizeof (core.old); > + #else > + size =3D sizeof (core.new_dump); > + #endif > tmpptr =3D (char *) bfd_zalloc (abfd, (bfd_size_type) size); > if (!tmpptr) > return NULL; > @@ -542,6 +569,7 @@ > c_vmregions =3D core.new_dump.c_vmregions; > c_vmm =3D (file_ptr) core.new_dump.c_vmm; > } > + #ifndef BFD64 > else > { > c_datasize =3D core.old.c_datasize; > @@ -549,6 +577,7 @@ > c_vmregions =3D core.old.c_vmregions; > c_vmm =3D (file_ptr) (ptr_to_uint) core.old.c_vmm; > } > + #endif >=20 > /* .data section from executable. */ > if (c_datasize) > @@ -615,7 +644,11 @@ > file_ptr vminfo_offset; > bfd_vma vminfo_addr; >=20 > + #ifndef BFD64 > size =3D CORE_NEW (core) ? sizeof (vminfo.new_dump) : sizeof > (vminfo.old); > + #else > + size =3D sizeof (vminfo.new_dump); > + #endif > if (bfd_bread (&vminfo, size, abfd) !=3D size) > goto fail; >=20 > @@ -625,12 +658,14 @@ > vminfo_size =3D vminfo.new_dump.vminfo_size; > vminfo_offset =3D vminfo.new_dump.vminfo_offset; > } > + #ifndef BFD64 > else > { > vminfo_addr =3D (bfd_vma) (long) vminfo.old.vminfo_addr; > vminfo_size =3D vminfo.old.vminfo_size; > vminfo_offset =3D vminfo.old.vminfo_offset; > } > + #endif >=20 > if (vminfo_offset) > if (!make_bfd_asection (abfd, ".vmdata", > @@ -670,8 +705,10 @@ >=20 > if (CORE_NEW (core)) > c_loader =3D CNEW_LOADER (core.new_dump); > + #ifndef BFD64 > else > c_loader =3D (file_ptr) (ptr_to_uint) COLD_LOADER (core.old); > + #endif >=20 > if (CORE_NEW (core) && CNEW_PROC64 (core.new_dump)) > size =3D (int) ((LdInfo *) 0)->l64.ldinfo_filename; > @@ -734,8 +771,12 @@ > rs6000coff_core_file_failing_command (bfd *abfd) > { > CoreHdr *core =3D core_hdr (abfd); > + #ifndef BFD64 > char *com =3D CORE_NEW (*core) ? > CNEW_COMM (core->new_dump) : COLD_COMM (core->old); > + #else > + char *com =3D CNEW_COMM (core->new_dump); > + #endif >=20 > if (*com) > return com; > @@ -747,7 +788,11 @@ > rs6000coff_core_file_failing_signal (bfd *abfd) > { > CoreHdr *core =3D core_hdr (abfd); > + #ifndef BFD64 > return CORE_NEW (*core) ? core->new_dump.c_signo : core- > >old.c_signo; > + #else > + return core->new_dump.c_signo; > + #endif > } >=20 > #endif /* AIX_CORE */ >=20 > -- > Thanks & Regards, > Sangamesh Regards, Abid