diff options
author | Andrew Cagney <cagney@redhat.com> | 2004-03-07 19:00:43 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2004-03-07 19:00:43 +0000 |
commit | 69b4bbe45040ac3b330e1b5d9842aea9e9d4ddd2 (patch) | |
tree | 1c6cc2ae4f000b87c163b06bf60aa37e79fe69e1 /gdb/hppa-tdep.c | |
parent | 210197d29b2e85c2dfc16012831d3cc7fd6fb685 (diff) | |
download | gdb-69b4bbe45040ac3b330e1b5d9842aea9e9d4ddd2.zip gdb-69b4bbe45040ac3b330e1b5d9842aea9e9d4ddd2.tar.gz gdb-69b4bbe45040ac3b330e1b5d9842aea9e9d4ddd2.tar.bz2 |
2004-03-07 Andrew Cagney <cagney@redhat.com>
* hppa-tdep.c (pa_do_registers_info, pa_do_strcat_registers_info)
(pa_print_registers, pa_print_fp_reg, pa_strcat_registers)
(pa_strcat_fp_reg, pa_register_look_aside): Delete.
* config/pa/tm-hppa.h (DEPRECATED_DO_REGISTERS_INFO)
(pa_do_registers_info): Delete.
Diffstat (limited to 'gdb/hppa-tdep.c')
-rw-r--r-- | gdb/hppa-tdep.c | 389 |
1 files changed, 0 insertions, 389 deletions
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index c906962..a64ef9e 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -136,11 +136,6 @@ static void internalize_unwinds (struct objfile *, struct unwind_table_entry *, asection *, unsigned int, unsigned int, CORE_ADDR); -static void pa_print_registers (char *, int, int); -static void pa_strcat_registers (char *, int, int, struct ui_file *); -static void pa_register_look_aside (char *, int, long *); -static void pa_print_fp_reg (int); -static void pa_strcat_fp_reg (int, struct ui_file *, enum precision_type); static void record_text_segment_lowaddr (bfd *, asection *, void *); /* FIXME: brobecker 2002-11-07: We will likely be able to make the following functions static, once we hppa is partially multiarched. */ @@ -1257,390 +1252,6 @@ hppa_alignof (struct type *type) } } -/* Print the register regnum, or all registers if regnum is -1 */ - -void -pa_do_registers_info (int regnum, int fpregs) -{ - char *raw_regs = alloca (DEPRECATED_REGISTER_BYTES); - int i; - - /* Make a copy of gdb's save area (may cause actual - reads from the target). */ - for (i = 0; i < NUM_REGS; i++) - frame_register_read (deprecated_selected_frame, i, - raw_regs + DEPRECATED_REGISTER_BYTE (i)); - - if (regnum == -1) - pa_print_registers (raw_regs, regnum, fpregs); - else if (regnum < FP4_REGNUM) - { - long reg_val[2]; - - /* Why is the value not passed through "extract_signed_integer" - as in "pa_print_registers" below? */ - pa_register_look_aside (raw_regs, regnum, ®_val[0]); - - if (!is_pa_2) - { - printf_unfiltered ("%s %lx\n", REGISTER_NAME (regnum), reg_val[1]); - } - else - { - /* Fancy % formats to prevent leading zeros. */ - if (reg_val[0] == 0) - printf_unfiltered ("%s %lx\n", REGISTER_NAME (regnum), reg_val[1]); - else - printf_unfiltered ("%s %lx%8.8lx\n", REGISTER_NAME (regnum), - reg_val[0], reg_val[1]); - } - } - else - /* Note that real floating point values only start at - FP4_REGNUM. FP0 and up are just status and error - registers, which have integral (bit) values. */ - pa_print_fp_reg (regnum); -} - -/********** new function ********************/ -void -pa_do_strcat_registers_info (int regnum, int fpregs, struct ui_file *stream, - enum precision_type precision) -{ - char *raw_regs = alloca (DEPRECATED_REGISTER_BYTES); - int i; - - /* Make a copy of gdb's save area (may cause actual - reads from the target). */ - for (i = 0; i < NUM_REGS; i++) - frame_register_read (deprecated_selected_frame, i, - raw_regs + DEPRECATED_REGISTER_BYTE (i)); - - if (regnum == -1) - pa_strcat_registers (raw_regs, regnum, fpregs, stream); - - else if (regnum < FP4_REGNUM) - { - long reg_val[2]; - - /* Why is the value not passed through "extract_signed_integer" - as in "pa_print_registers" below? */ - pa_register_look_aside (raw_regs, regnum, ®_val[0]); - - if (!is_pa_2) - { - fprintf_unfiltered (stream, "%s %lx", REGISTER_NAME (regnum), reg_val[1]); - } - else - { - /* Fancy % formats to prevent leading zeros. */ - if (reg_val[0] == 0) - fprintf_unfiltered (stream, "%s %lx", REGISTER_NAME (regnum), - reg_val[1]); - else - fprintf_unfiltered (stream, "%s %lx%8.8lx", REGISTER_NAME (regnum), - reg_val[0], reg_val[1]); - } - } - else - /* Note that real floating point values only start at - FP4_REGNUM. FP0 and up are just status and error - registers, which have integral (bit) values. */ - pa_strcat_fp_reg (regnum, stream, precision); -} - -/* If this is a PA2.0 machine, fetch the real 64-bit register - value. Otherwise use the info from gdb's saved register area. - - Note that reg_val is really expected to be an array of longs, - with two elements. */ -static void -pa_register_look_aside (char *raw_regs, int regnum, long *raw_val) -{ - static int know_which = 0; /* False */ - - int regaddr; - unsigned int offset; - int i; - int start; - - - char buf[MAX_REGISTER_SIZE]; - long long reg_val; - - if (!know_which) - { - if (CPU_PA_RISC2_0 == sysconf (_SC_CPU_VERSION)) - { - is_pa_2 = (1 == 1); - } - - know_which = 1; /* True */ - } - - raw_val[0] = 0; - raw_val[1] = 0; - - if (!is_pa_2) - { - raw_val[1] = *(long *) (raw_regs + DEPRECATED_REGISTER_BYTE (regnum)); - return; - } - - /* Code below copied from hppah-nat.c, with fixes for wide - registers, using different area of save_state, etc. */ - if (regnum == FLAGS_REGNUM || regnum >= FP0_REGNUM || - !HAVE_STRUCT_SAVE_STATE_T || !HAVE_STRUCT_MEMBER_SS_WIDE) - { - /* Use narrow regs area of save_state and default macro. */ - offset = U_REGS_OFFSET; - regaddr = register_addr (regnum, offset); - start = 1; - } - else - { - /* Use wide regs area, and calculate registers as 8 bytes wide. - - We'd like to do this, but current version of "C" doesn't - permit "offsetof": - - offset = offsetof(save_state_t, ss_wide); - - Note that to avoid "C" doing typed pointer arithmetic, we - have to cast away the type in our offset calculation: - otherwise we get an offset of 1! */ - - /* NB: save_state_t is not available before HPUX 9. - The ss_wide field is not available previous to HPUX 10.20, - so to avoid compile-time warnings, we only compile this for - PA 2.0 processors. This control path should only be followed - if we're debugging a PA 2.0 processor, so this should not cause - problems. */ - - /* #if the following code out so that this file can still be - compiled on older HPUX boxes (< 10.20) which don't have - this structure/structure member. */ -#if HAVE_STRUCT_SAVE_STATE_T == 1 && HAVE_STRUCT_MEMBER_SS_WIDE == 1 - save_state_t temp; - - offset = ((int) &temp.ss_wide) - ((int) &temp); - regaddr = offset + regnum * 8; - start = 0; -#endif - } - - for (i = start; i < 2; i++) - { - errno = 0; - raw_val[i] = call_ptrace (PT_RUREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) regaddr, 0); - if (errno != 0) - { - /* Warning, not error, in case we are attached; sometimes the - kernel doesn't let us at the registers. */ - char *err = safe_strerror (errno); - char *msg = alloca (strlen (err) + 128); - sprintf (msg, "reading register %s: %s", REGISTER_NAME (regnum), err); - warning (msg); - goto error_exit; - } - - regaddr += sizeof (long); - } - - if (regnum == PCOQ_HEAD_REGNUM || regnum == PCOQ_TAIL_REGNUM) - raw_val[1] &= ~0x3; /* I think we're masking out space bits */ - -error_exit: - ; -} - -/* "Info all-reg" command */ - -static void -pa_print_registers (char *raw_regs, int regnum, int fpregs) -{ - int i, j; - /* Alas, we are compiled so that "long long" is 32 bits */ - long raw_val[2]; - long long_val; - int rows = 48, columns = 2; - - for (i = 0; i < rows; i++) - { - for (j = 0; j < columns; j++) - { - /* We display registers in column-major order. */ - int regnum = i + j * rows; - - /* Q: Why is the value passed through "extract_signed_integer", - while above, in "pa_do_registers_info" it isn't? - A: ? */ - pa_register_look_aside (raw_regs, regnum, &raw_val[0]); - - /* Even fancier % formats to prevent leading zeros - and still maintain the output in columns. */ - if (!is_pa_2) - { - /* Being big-endian, on this machine the low bits - (the ones we want to look at) are in the second longword. */ - long_val = extract_signed_integer (&raw_val[1], 4); - printf_filtered ("%10.10s: %8lx ", - REGISTER_NAME (regnum), long_val); - } - else - { - /* raw_val = extract_signed_integer(&raw_val, 8); */ - if (raw_val[0] == 0) - printf_filtered ("%10.10s: %8lx ", - REGISTER_NAME (regnum), raw_val[1]); - else - printf_filtered ("%10.10s: %8lx%8.8lx ", - REGISTER_NAME (regnum), - raw_val[0], raw_val[1]); - } - } - printf_unfiltered ("\n"); - } - - if (fpregs) - for (i = FP4_REGNUM; i < NUM_REGS; i++) /* FP4_REGNUM == 72 */ - pa_print_fp_reg (i); -} - -/************* new function ******************/ -static void -pa_strcat_registers (char *raw_regs, int regnum, int fpregs, - struct ui_file *stream) -{ - int i, j; - long raw_val[2]; /* Alas, we are compiled so that "long long" is 32 bits */ - long long_val; - enum precision_type precision; - - precision = unspecified_precision; - - for (i = 0; i < 18; i++) - { - for (j = 0; j < 4; j++) - { - /* Q: Why is the value passed through "extract_signed_integer", - while above, in "pa_do_registers_info" it isn't? - A: ? */ - pa_register_look_aside (raw_regs, i + (j * 18), &raw_val[0]); - - /* Even fancier % formats to prevent leading zeros - and still maintain the output in columns. */ - if (!is_pa_2) - { - /* Being big-endian, on this machine the low bits - (the ones we want to look at) are in the second longword. */ - long_val = extract_signed_integer (&raw_val[1], 4); - fprintf_filtered (stream, "%8.8s: %8lx ", - REGISTER_NAME (i + (j * 18)), long_val); - } - else - { - /* raw_val = extract_signed_integer(&raw_val, 8); */ - if (raw_val[0] == 0) - fprintf_filtered (stream, "%8.8s: %8lx ", - REGISTER_NAME (i + (j * 18)), raw_val[1]); - else - fprintf_filtered (stream, "%8.8s: %8lx%8.8lx ", - REGISTER_NAME (i + (j * 18)), raw_val[0], - raw_val[1]); - } - } - fprintf_unfiltered (stream, "\n"); - } - - if (fpregs) - for (i = FP4_REGNUM; i < NUM_REGS; i++) /* FP4_REGNUM == 72 */ - pa_strcat_fp_reg (i, stream, precision); -} - -static void -pa_print_fp_reg (int i) -{ - char raw_buffer[MAX_REGISTER_SIZE]; - char virtual_buffer[MAX_REGISTER_SIZE]; - - /* Get 32bits of data. */ - frame_register_read (deprecated_selected_frame, i, raw_buffer); - - /* Put it in the buffer. No conversions are ever necessary. */ - memcpy (virtual_buffer, raw_buffer, DEPRECATED_REGISTER_RAW_SIZE (i)); - - fputs_filtered (REGISTER_NAME (i), gdb_stdout); - print_spaces_filtered (8 - strlen (REGISTER_NAME (i)), gdb_stdout); - fputs_filtered ("(single precision) ", gdb_stdout); - - val_print (DEPRECATED_REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, gdb_stdout, 0, - 1, 0, Val_pretty_default); - printf_filtered ("\n"); - - /* If "i" is even, then this register can also be a double-precision - FP register. Dump it out as such. */ - if ((i % 2) == 0) - { - /* Get the data in raw format for the 2nd half. */ - frame_register_read (deprecated_selected_frame, i + 1, raw_buffer); - - /* Copy it into the appropriate part of the virtual buffer. */ - memcpy (virtual_buffer + DEPRECATED_REGISTER_RAW_SIZE (i), raw_buffer, - DEPRECATED_REGISTER_RAW_SIZE (i)); - - /* Dump it as a double. */ - fputs_filtered (REGISTER_NAME (i), gdb_stdout); - print_spaces_filtered (8 - strlen (REGISTER_NAME (i)), gdb_stdout); - fputs_filtered ("(double precision) ", gdb_stdout); - - val_print (builtin_type_double, virtual_buffer, 0, 0, gdb_stdout, 0, - 1, 0, Val_pretty_default); - printf_filtered ("\n"); - } -} - -/*************** new function ***********************/ -static void -pa_strcat_fp_reg (int i, struct ui_file *stream, enum precision_type precision) -{ - char raw_buffer[MAX_REGISTER_SIZE]; - char virtual_buffer[MAX_REGISTER_SIZE]; - - fputs_filtered (REGISTER_NAME (i), stream); - print_spaces_filtered (8 - strlen (REGISTER_NAME (i)), stream); - - /* Get 32bits of data. */ - frame_register_read (deprecated_selected_frame, i, raw_buffer); - - /* Put it in the buffer. No conversions are ever necessary. */ - memcpy (virtual_buffer, raw_buffer, DEPRECATED_REGISTER_RAW_SIZE (i)); - - if (precision == double_precision && (i % 2) == 0) - { - - char raw_buf[MAX_REGISTER_SIZE]; - - /* Get the data in raw format for the 2nd half. */ - frame_register_read (deprecated_selected_frame, i + 1, raw_buf); - - /* Copy it into the appropriate part of the virtual buffer. */ - memcpy (virtual_buffer + DEPRECATED_REGISTER_RAW_SIZE (i), raw_buf, - DEPRECATED_REGISTER_RAW_SIZE (i)); - - val_print (builtin_type_double, virtual_buffer, 0, 0, stream, 0, - 1, 0, Val_pretty_default); - - } - else - { - val_print (DEPRECATED_REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, stream, 0, - 1, 0, Val_pretty_default); - } - -} - /* Return one if PC is in the call path of a trampoline, else return zero. Note we return one for *any* call trampoline (long-call, arg-reloc), not |