From 15edf5253b529490f705971833a475269fa6b3b3 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Fri, 30 Dec 1994 01:47:27 +0000 Subject: [PATCH] * hppa-tdep.c (pa_print_registers): Extract register values stored in big endian format on big and little endian hosts. --- gdb/ChangeLog | 3 +++ gdb/hppa-tdep.c | 44 ++++++++++++++++++++++++++++++++------------ 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f346b1097d2..f4f5c697bec 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,8 @@ Thu Dec 29 18:18:31 1994 Rob Savoye + * hppa-tdep.c (pa_print_registers): Extract register values stored + in big endian format on big and little endian hosts. + * array-rom.c: Support for Array Tech LSI33k based RAID disk controller board. * configure.in: Recognize "mips*-*-ecoff*" rather than diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index fb08ba88cb4..e780d488ec4 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -55,6 +55,24 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "symfile.h" #include "objfiles.h" +#define SWAP_TARGET_AND_HOST(buffer,len) \ + do \ + { \ + if (TARGET_BYTE_ORDER != HOST_BYTE_ORDER) \ + { \ + char tmp; \ + char *p = (char *)(buffer); \ + char *q = ((char *)(buffer)) + len - 1; \ + for (; p < q; p++, q--) \ + { \ + tmp = *q; \ + *q = *p; \ + *p = tmp; \ + } \ + } \ + } \ + while (0) + static int restore_pc_queue PARAMS ((struct frame_saved_regs *)); static int hppa_alignof PARAMS ((struct type *)); @@ -1562,8 +1580,9 @@ target_read_pc (pid) { int flags = read_register (FLAGS_REGNUM); - if (flags & 2) + if (flags & 2) { return read_register (31) & ~0x3; + } return read_register (PC_REGNUM) & ~0x3; } @@ -1647,19 +1666,20 @@ pa_print_registers (raw_regs, regnum, fpregs) int regnum; int fpregs; { - int i; + int i,j; + long val; for (i = 0; i < 18; i++) - printf_unfiltered ("%8.8s: %8x %8.8s: %8x %8.8s: %8x %8.8s: %8x\n", - reg_names[i], - *(int *)(raw_regs + REGISTER_BYTE (i)), - reg_names[i + 18], - *(int *)(raw_regs + REGISTER_BYTE (i + 18)), - reg_names[i + 36], - *(int *)(raw_regs + REGISTER_BYTE (i + 36)), - reg_names[i + 54], - *(int *)(raw_regs + REGISTER_BYTE (i + 54))); - + { + for (j = 0; j < 4; j++) + { + val = *(int *)(raw_regs + REGISTER_BYTE (i+(j*18))); + SWAP_TARGET_AND_HOST (&val, 4); + printf_unfiltered ("%8.8s: %8x ", reg_names[i+(j*18)], val); + } + printf_unfiltered ("\n"); + } + if (fpregs) for (i = 72; i < NUM_REGS; i++) pa_print_fp_reg (i); -- 2.30.2