summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2007-04-27 13:17:27 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2007-04-27 13:17:27 +0000
commit60f9d77c42d9fd229c91e3d9984bb74d9b2aa433 (patch)
tree1ccfa860409cdf5d7a4ae27b0b7071f67b4918e0
parent48f6697dc5b0a503879e8a7a90c4ed05724ee60f (diff)
downloadgdb-60f9d77c42d9fd229c91e3d9984bb74d9b2aa433.tar.gz
* aix-thread.c (fill_sprs32): Change argument types to "uint32_t *".
Remove obsolete part of comment. (store_regs_user_thread): Use uint32_t temporaries when calling fill_sprs32. (store_regs_kernel_thread): Likewise. Add assertion to verify correct size of struct ptsprs members. (aix_thread_xfer_memory): Fix type of myaddr. (aix_thread_extra_thread_info): Fix compiler warning. * rs6000-nat.c (rs6000_ptrace64): Change type of buf to "void *". (fetch_register, store_register): Adapt callers.
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/aix-thread.c49
-rw-r--r--gdb/rs6000-nat.c6
3 files changed, 46 insertions, 22 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 71467c7bc10..993944406fb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,18 @@
2007-04-27 Ulrich Weigand <uweigand@de.ibm.com>
+ * aix-thread.c (fill_sprs32): Change argument types to "uint32_t *".
+ Remove obsolete part of comment.
+ (store_regs_user_thread): Use uint32_t temporaries when calling
+ fill_sprs32.
+ (store_regs_kernel_thread): Likewise. Add assertion to verify
+ correct size of struct ptsprs members.
+ (aix_thread_xfer_memory): Fix type of myaddr.
+ (aix_thread_extra_thread_info): Fix compiler warning.
+ * rs6000-nat.c (rs6000_ptrace64): Change type of buf to "void *".
+ (fetch_register, store_register): Adapt callers.
+
+2007-04-27 Ulrich Weigand <uweigand@de.ibm.com>
+
* vec.h (vec_free): Rename to vec_free_. Adapt users.
2007-04-25 Ulrich Weigand <uweigand@de.ibm.com>
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index d587c392d1f..481c1fefc69 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -1365,9 +1365,9 @@ fill_sprs64 (uint64_t *iar, uint64_t *msr, uint32_t *cr,
}
static void
-fill_sprs32 (unsigned long *iar, unsigned long *msr, unsigned long *cr,
- unsigned long *lr, unsigned long *ctr, unsigned long *xer,
- unsigned long *fpscr)
+fill_sprs32 (uint32_t *iar, uint32_t *msr, uint32_t *cr,
+ uint32_t *lr, uint32_t *ctr, uint32_t *xer,
+ uint32_t *fpscr)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
@@ -1375,12 +1375,7 @@ fill_sprs32 (unsigned long *iar, unsigned long *msr, unsigned long *cr,
same as the raw size of the PC (in the register cache). If
they're not, then either GDB has been built incorrectly, or
there's some other kind of internal error. To be really safe,
- we should check all of the sizes.
-
- If this assert() fails, the most likely reason is that GDB was
- built incorrectly. In order to make use of many of the header
- files in /usr/include/sys, GDB needs to be configured so that
- sizeof (long) == 4). */
+ we should check all of the sizes. */
gdb_assert (sizeof (*iar) == register_size (current_gdbarch, PC_REGNUM));
if (register_cached (PC_REGNUM))
@@ -1459,11 +1454,9 @@ store_regs_user_thread (pthdb_pthread_t pdtid)
else
{
/* Problem: ctx.iar etc. are 64 bits, but raw_registers are 32.
- Solution: use 32-bit temp variables. (The assert() in fill_sprs32()
- will fail if the size of an unsigned long is incorrect. If this
- happens, GDB needs to be reconfigured so that longs are 32-bits.) */
- unsigned long tmp_iar, tmp_msr, tmp_cr, tmp_lr, tmp_ctr, tmp_xer,
- tmp_fpscr;
+ Solution: use 32-bit temp variables. */
+ uint32_t tmp_iar, tmp_msr, tmp_cr, tmp_lr, tmp_ctr, tmp_xer,
+ tmp_fpscr;
fill_sprs32 (&tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, &tmp_ctr, &tmp_xer,
&tmp_fpscr);
@@ -1564,12 +1557,30 @@ store_regs_kernel_thread (int regno, pthdb_tid_t tid)
}
else
{
+ /* The contents of "struct ptspr" were declared as "unsigned
+ long" up to AIX 5.2, but are "unsigned int" since 5.3.
+ Use temporaries to work around this problem. Also, add an
+ assert here to make sure we fail if the system header files
+ use "unsigned long", and the size of that type is not what
+ the headers expect. */
+ uint32_t tmp_iar, tmp_msr, tmp_cr, tmp_lr, tmp_ctr, tmp_xer,
+ tmp_fpscr;
+
+ 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);
- fill_sprs32 (&sprs32.pt_iar, &sprs32.pt_msr, &sprs32.pt_cr,
- &sprs32.pt_lr, &sprs32.pt_ctr, &sprs32.pt_xer,
- &sprs32.pt_fpscr);
+ fill_sprs32 (&tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, &tmp_ctr,
+ &tmp_xer, &tmp_fpscr);
+
+ sprs32.pt_iar = tmp_iar;
+ sprs32.pt_msr = tmp_msr;
+ sprs32.pt_cr = tmp_cr;
+ sprs32.pt_lr = tmp_lr;
+ sprs32.pt_ctr = tmp_ctr;
+ sprs32.pt_xer = tmp_xer;
+ sprs32.pt_fpscr = tmp_fpscr;
if (tdep->ppc_mq_regnum >= 0)
if (register_cached (tdep->ppc_mq_regnum))
@@ -1608,7 +1619,7 @@ aix_thread_store_registers (int regno)
address MEMADDR if WRITE and vice versa otherwise. */
static int
-aix_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+aix_thread_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
struct mem_attrib *attrib,
struct target_ops *target)
{
@@ -1703,7 +1714,7 @@ aix_thread_extra_thread_info (struct thread_info *thread)
if (tid != PTHDB_INVALID_TID)
/* i18n: Like "thread-identifier %d, [state] running, suspended" */
- fprintf_unfiltered (buf, _("tid %d"), tid);
+ fprintf_unfiltered (buf, _("tid %d"), (int)tid);
status = pthdb_pthread_state (pd_session, pdtid, &state);
if (status != PTHDB_SUCCESS)
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index 97a53aafcff..46907ae0809 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -204,7 +204,7 @@ rs6000_ptrace32 (int req, int id, int *addr, int data, int *buf)
/* Call ptracex(REQ, ID, ADDR, DATA, BUF). */
static int
-rs6000_ptrace64 (int req, int id, long long addr, int data, int *buf)
+rs6000_ptrace64 (int req, int id, long long addr, int data, void *buf)
{
#ifdef ARCH3264
int ret = ptracex (req, id, addr, data, buf);
@@ -255,7 +255,7 @@ fetch_register (int regno)
/* PT_READ_GPR requires the buffer parameter to point to long long,
even if the register is really only 32 bits. */
long long buf;
- rs6000_ptrace64 (PT_READ_GPR, PIDGET (inferior_ptid), nr, 0, (int *)&buf);
+ rs6000_ptrace64 (PT_READ_GPR, PIDGET (inferior_ptid), nr, 0, &buf);
if (register_size (current_gdbarch, regno) == 8)
memcpy (addr, &buf, 8);
else
@@ -329,7 +329,7 @@ store_register (int regno)
memcpy (&buf, addr, 8);
else
buf = *addr;
- rs6000_ptrace64 (PT_WRITE_GPR, PIDGET (inferior_ptid), nr, 0, (int *)&buf);
+ rs6000_ptrace64 (PT_WRITE_GPR, PIDGET (inferior_ptid), nr, 0, &buf);
}
}