This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
powerpc64-ibm-aix: Make appropriate ptrace calls in aix-thread.c in 64 BIT mode aix-thread.c has many ptrace calls like - 'ptrace32 (PTT_WRITE_SPRS, tid, (int *) &sprs32, 0, NULL)' in 64 bit mode this has to be changed to - 'ptrace32 (PTT_WRITE_SPRS, tid, (long long) &sprs32, 0, NULL)' There are many such changes to be made through out aix-thread.c which are seen below :- --- aix-thread.c 2013-06-13 16:00:17 +0600 +++ aix64-thread.c 2013-06-18 16:07:27 +0600 @@ -240,20 +240,20 @@ ptrace_check (int req, int id, int ret) /* Call ptracex (REQ, ID, ADDR, DATA, BUF). Return success. */ static int -ptrace64aix (int req, int id, long long addr, int data, int *buf) +ptrace64aix (int req, long long id, long long addr, int data, int *buf) { errno = 0; - return ptrace_check (req, id, ptracex (req, id, addr, data, buf)); + return ptrace_check (req, id, ptrace64 (req, id, addr, data, buf)); } /* Call ptrace (REQ, ID, ADDR, DATA, BUF). Return success. */ static int -ptrace32 (int req, int id, int *addr, int data, int *buf) +ptrace32 (int req, long long id, long long addr, int data, int *buf) { errno = 0; return ptrace_check (req, id, - ptrace (req, id, (int *) addr, data, buf)); + ptrace64 (req, id, (int *) addr, data, buf)); } /* If *PIDP is a composite process/thread id, convert it to a @@ -346,13 +346,13 @@ pdc_read_regs (pthdb_user_t user, if (arch64) { if (!ptrace64aix (PTT_READ_GPRS, tid, - (unsigned long) gprs64, 0, NULL)) + (long long) gprs64, 0, NULL)) memset (gprs64, 0, sizeof (gprs64)); memcpy (context->gpr, gprs64, sizeof(gprs64)); } else { - if (!ptrace32 (PTT_READ_GPRS, tid, gprs32, 0, NULL)) + if (!ptrace32 (PTT_READ_GPRS, (long long) tid, gprs32, 0, NULL)) memset (gprs32, 0, sizeof (gprs32)); memcpy (context->gpr, gprs32, sizeof(gprs32)); } @@ -361,7 +361,7 @@ pdc_read_regs (pthdb_user_t user, /* Floating-point registers. */ if (flags & PTHDB_FLAG_FPRS) { - if (!ptrace32 (PTT_READ_FPRS, tid, (void *) fprs, 0, NULL)) + if (!ptrace32 (PTT_READ_FPRS, tid, (long long) fprs, 0, NULL)) memset (fprs, 0, sizeof (fprs)); memcpy (context->fpr, fprs, sizeof(fprs)); } @@ -372,13 +372,13 @@ pdc_read_regs (pthdb_user_t user, if (arch64) { if (!ptrace64aix (PTT_READ_SPRS, tid, - (unsigned long) &sprs64, 0, NULL)) + (long long) &sprs64, 0, NULL)) memset (&sprs64, 0, sizeof (sprs64)); memcpy (&context->msr, &sprs64, sizeof(sprs64)); } else { - if (!ptrace32 (PTT_READ_SPRS, tid, (int *) &sprs32, 0, NULL)) + if (!ptrace32 (PTT_READ_SPRS, tid, (long long) &sprs32, 0, NULL)) memset (&sprs32, 0, sizeof (sprs32)); memcpy (&context->msr, &sprs32, sizeof(sprs32)); } @@ -411,15 +411,15 @@ pdc_write_regs (pthdb_user_t user, { if (arch64) ptrace64aix (PTT_WRITE_GPRS, tid, - (unsigned long) context->gpr, 0, NULL); + (long long) context->gpr, 0, NULL); else - ptrace32 (PTT_WRITE_GPRS, tid, (int *) context->gpr, 0, NULL); + ptrace32 (PTT_WRITE_GPRS, tid, (long long) context->gpr, 0, NULL); } /* Floating-point registers. */ if (flags & PTHDB_FLAG_FPRS) { - ptrace32 (PTT_WRITE_FPRS, tid, (int *) context->fpr, 0, NULL); + ptrace32 (PTT_WRITE_FPRS, tid, (long long) context->fpr, 0, NULL); } /* Special-purpose registers. */ @@ -428,11 +428,11 @@ pdc_write_regs (pthdb_user_t user, if (arch64) { ptrace64aix (PTT_WRITE_SPRS, tid, - (unsigned long) &context->msr, 0, NULL); + (long long) &context->msr, 0, NULL); } else { - ptrace32 (PTT_WRITE_SPRS, tid, (void *) &context->msr, 0, NULL); + ptrace32 (PTT_WRITE_SPRS, tid, (long long) &context->msr, 0, NULL); } } return 0; @@ -997,10 +997,10 @@ aix_thread_resume (struct target_ops *op tid[1] = 0; if (arch64) - ptrace64aix (PTT_CONTINUE, tid[0], 1, + ptrace64aix (PTT_CONTINUE, tid[0], (long long) 1, gdb_signal_to_host (sig), (void *) tid); else - ptrace32 (PTT_CONTINUE, tid[0], (int *) 1, + ptrace32 (PTT_CONTINUE, tid[0], (long long) 1, gdb_signal_to_host (sig), (void *) tid); } } @@ -1233,13 +1233,13 @@ fetch_regs_kernel_thread (struct regcach if (arch64) { if (!ptrace64aix (PTT_READ_GPRS, tid, - (unsigned long) gprs64, 0, NULL)) + (long long) gprs64, 0, NULL)) memset (gprs64, 0, sizeof (gprs64)); supply_gprs64 (regcache, gprs64); } else { - if (!ptrace32 (PTT_READ_GPRS, tid, gprs32, 0, NULL)) + if (!ptrace32 (PTT_READ_GPRS, tid, (long long) gprs32, 0, NULL)) memset (gprs32, 0, sizeof (gprs32)); for (i = 0; i < ppc_num_gprs; i++) supply_reg32 (regcache, tdep->ppc_gp0_regnum + i, gprs32[i]); @@ -1253,7 +1253,7 @@ fetch_regs_kernel_thread (struct regcach || (regno >= tdep->ppc_fp0_regnum && regno < tdep->ppc_fp0_regnum + ppc_num_fprs))) { - if (!ptrace32 (PTT_READ_FPRS, tid, (void *) fprs, 0, NULL)) + if (!ptrace32 (PTT_READ_FPRS, tid, (long long) fprs, 0, NULL)) memset (fprs, 0, sizeof (fprs)); supply_fprs (regcache, fprs); } @@ -1265,7 +1265,7 @@ fetch_regs_kernel_thread (struct regcach if (arch64) { if (!ptrace64aix (PTT_READ_SPRS, tid, - (unsigned long) &sprs64, 0, NULL)) + (long long) &sprs64, 0, NULL)) memset (&sprs64, 0, sizeof (sprs64)); supply_sprs64 (regcache, sprs64.pt_iar, sprs64.pt_msr, sprs64.pt_cr, sprs64.pt_lr, sprs64.pt_ctr, @@ -1275,7 +1275,7 @@ fetch_regs_kernel_thread (struct regcach { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - if (!ptrace32 (PTT_READ_SPRS, tid, (int *) &sprs32, 0, NULL)) + if (!ptrace32 (PTT_READ_SPRS, tid, (long long) &sprs32, 0, NULL)) 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, @@ -1563,16 +1563,16 @@ store_regs_kernel_thread (const struct r if (arch64) { /* Pre-fetch: some regs may not be in the cache. */ - ptrace64aix (PTT_READ_GPRS, tid, (unsigned long) gprs64, 0, NULL); + ptrace64aix (PTT_READ_GPRS, tid, (long long) gprs64, 0, NULL); fill_gprs64 (regcache, gprs64); - ptrace64aix (PTT_WRITE_GPRS, tid, (unsigned long) gprs64, 0, NULL); + ptrace64aix (PTT_WRITE_GPRS, tid, (long long) gprs64, 0, NULL); } else { /* Pre-fetch: some regs may not be in the cache. */ - ptrace32 (PTT_READ_GPRS, tid, gprs32, 0, NULL); + ptrace32 (PTT_READ_GPRS, tid, (long long) gprs32, 0, NULL); fill_gprs32 (regcache, gprs32); - ptrace32 (PTT_WRITE_GPRS, tid, gprs32, 0, NULL); + ptrace32 (PTT_WRITE_GPRS, tid, (long long) gprs32, 0, NULL); } } @@ -1584,9 +1584,9 @@ store_regs_kernel_thread (const struct r && regno < tdep->ppc_fp0_regnum + ppc_num_fprs))) { /* Pre-fetch: some regs may not be in the cache. */ - ptrace32 (PTT_READ_FPRS, tid, (void *) fprs, 0, NULL); + ptrace32 (PTT_READ_FPRS, tid, (long long) fprs, 0, NULL); fill_fprs (regcache, fprs); - ptrace32 (PTT_WRITE_FPRS, tid, (void *) fprs, 0, NULL); + ptrace32 (PTT_WRITE_FPRS, tid, (long long) fprs, 0, NULL); } /* Special-purpose registers. */ @@ -1597,12 +1597,12 @@ store_regs_kernel_thread (const struct r { /* Pre-fetch: some registers won't be in the cache. */ ptrace64aix (PTT_READ_SPRS, tid, - (unsigned long) &sprs64, 0, NULL); + (long long) &sprs64, 0, NULL); fill_sprs64 (regcache, &sprs64.pt_iar, &sprs64.pt_msr, &sprs64.pt_cr, &sprs64.pt_lr, &sprs64.pt_ctr, &sprs64.pt_xer, &sprs64.pt_fpscr); ptrace64aix (PTT_WRITE_SPRS, tid, - (unsigned long) &sprs64, 0, NULL); + (long long) &sprs64, 0, NULL); } else { @@ -1618,7 +1618,7 @@ store_regs_kernel_thread (const struct r gdb_assert (sizeof (sprs32.pt_iar) == 4); /* Pre-fetch: some registers won't be in the cache. */ - ptrace32 (PTT_READ_SPRS, tid, (int *) &sprs32, 0, NULL); + ptrace32 (PTT_READ_SPRS, tid, (long long) &sprs32, 0, NULL); fill_sprs32 (regcache, &tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, &tmp_ctr, &tmp_xer, &tmp_fpscr); @@ -1637,7 +1637,7 @@ store_regs_kernel_thread (const struct r regcache_raw_collect (regcache, tdep->ppc_mq_regnum, &sprs32.pt_mq); - ptrace32 (PTT_WRITE_SPRS, tid, (int *) &sprs32, 0, NULL); + ptrace32 (PTT_WRITE_SPRS, tid, (long long) &sprs32, 0, NULL); } } } Initially I thought of using multiple ' #ifdef BFD64 ' checks in aix-thread.c and adding these changes. But it made more sense to create a new file called aix64-thread.c from aix-thread.c after making these changes. This file will be compiled only if we are in native powerpc64-aix config. This is checked in configure. --- ChangeLog - * configure.ac (CONFIG_SRCS): Add check for powerpc64-ibm-aix native config while adding aix64-thread.c to CONFIG_SRCS. * aix64thread.c: New File (Derived from aix-thread.c) For 64 bit (BFD64) support. --- Index: ./gdb/configure.ac =================================================================== --- ./gdb.orig/configure.ac +++ ./gdb/configure.ac @@ -1767,8 +1767,13 @@ if test ${build} = ${host} -a ${host} = gdb_cv_have_aix_thread_debug=no)]) AC_MSG_RESULT($gdb_cv_have_aix_thread_debug) if test $gdb_cv_have_aix_thread_debug = yes; then - CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c" - CONFIG_OBS="${CONFIG_OBS} aix-thread.o" + if test $host_cpu = powerpc64; then + CONFIG_SRCS="${CONFIG_SRCS} aix64-thread.c" + CONFIG_OBS="${CONFIG_OBS} aix64-thread.o" + else + CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c" + CONFIG_OBS="${CONFIG_OBS} aix-thread.o" + fi LIBS="$LIBS -lpthdebug" # Older versions of AIX do not provide the declaration for --- The patch that adds aix64-thread.c which has all the modified ptrace calls is very large as it contains a new file entirely. But, the only difference between aix-thread.c and aix64-thread.c is what is mentioned above. I have attached the entire patch which creates aix64-thread.c below. (See attached file: gdb-7.6-aix64-thread.patch)
Attachment:
gdb-7.6-aix64-thread.patch
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |