diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 97 | ||||
-rw-r--r-- | gdb/Makefile.in | 2 | ||||
-rw-r--r-- | gdb/config/i386/linux.mh | 2 | ||||
-rw-r--r-- | gdb/config/i386/tm-i386.h | 7 | ||||
-rw-r--r-- | gdb/corelow.c | 115 | ||||
-rw-r--r-- | gdb/gdbcore.h | 12 | ||||
-rw-r--r-- | gdb/gdbserver/low-linux.c | 261 | ||||
-rw-r--r-- | gdb/i386-linux-nat.c | 95 | ||||
-rw-r--r-- | gdb/i386v-nat.c | 85 | ||||
-rw-r--r-- | gdb/i387-tdep.c | 259 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/default.exp | 4 |
12 files changed, 508 insertions, 439 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ab232fb..43a507c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,31 @@ +1999-12-07 Jim Blandy <jimb@cygnus.com> + + Add support for SSE registers in core files. + * corelow.c (get_core_register_section): New function. + (get_core_registers): Fetch the new ".reg-xfp" sections, + in addition to the traditional ".reg" and ".reg2" sections. + Check for per-thread variants of all three. Use + get_core_register_section, instead of writing it out over and over + again. + * i386-linux-nat.c (i386_linux_fetch_core_registers): New function. + (i386_linux_nat_core_fns): New core_fns structure. We do our own + core handling now, instead of using the generic code in core-regset.c. + (_initialize_i386_linux_nat): New function, needed to register + i386_linux_nat_core_fns. + * config/i386/linux.mh (NATDEPFILES): Remove core-regset.o; + i386-linux-nat.c has its own sniffer now. + * gdbcore.h: (struct core_fns): Doc fix. + + * i386v-nat.c (i386_float_info): Definition is #if 0'd; delete it + altogether. This should use the function i387-tdep.c. + + Patch from Mark Kettenis <kettenis@gnu.org>: + + * config/i386/tm-i386.h (FLOAT_INFO): New define. + * i387-tdep.c (print_i387_value, print_i387_ext, + print_i387_status_word, print_i387_control_word, i387_float_info): + New functions, used to implement generic `info float' command. + 1999-12-06 Christopher Faylor <cgf@cygnus.com> * dcache.c (set_dcache_state): New function. @@ -55,6 +83,23 @@ Thu Dec 2 17:14:53 1999 Andrew Cagney <cagney@b1.cygnus.com> * ser-pipe.c: Include <string.h> for memset(). +1999-12-01 Jim Blandy <jimb@cygnus.com> + + * gdbtypes.c (builtin_type_v4si, builtin_type_v8qi, + builtin_type_v4hi, builtin_type_v2si): New SIMD types. + (build_gdbtypes): Initialize them. + (_initialize_gdbtypes): Gdbarch_swap them. + * gdbtypes.h (builtin_type_v4si, builtin_type_v8qi, + builtin_type_v4hi, builtin_type_v2si): Declare them. + + * findvar.c (read_register_bytes, write_register_bytes): Correctly + determine how the region the caller is writing overlaps with each + register's bytes. + + * value.h (struct value): Doc fixes. + + * valops.c (value_assign): Clarify error message. + 1999-12-01 Christopher Faylor <cgf@cygnus.com> * config/i386/tm-cygwin.h: Change tm-i386.h include back to tm-i386v.h. @@ -187,7 +232,7 @@ Mon Nov 29 11:28:21 1999 Andrew Cagney <cagney@b1.cygnus.com> * stabsread.c: Revert 1999-11-09 Jim Blandy <jimb@zwingli.cygnus.com> and 1999-11-08 Jim Blandy - <jimb@zenia.red-bean.com>. Broken on non-Linux targets. + <jimb@cygnus.com>. Broken on non-Linux targets. 1999-11-26 Elena Zannoni <ezannoni@kwikemart.cygnus.com> @@ -231,7 +276,7 @@ Wed Nov 17 17:01:06 1999 Andrew Cagney <cagney@b1.cygnus.com> * Makefile.in (i386-tdep.o): Update list of dependencies. -1999-11-22 Jim Blandy <jimb@zenia.red-bean.com> +1999-11-22 Jim Blandy <jimb@cygnus.com> * config/i386/tm-i386v.h (NUM_REGS, REGISTER_NAMES, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE, @@ -272,7 +317,7 @@ Mon Nov 22 12:02:47 1999 Andrew Cagney <cagney@b1.cygnus.com> arguments. (print_percentage): Make function void. -1999-11-21 Jim Blandy <jimb@zenia.red-bean.com> +1999-11-21 Jim Blandy <jimb@cygnus.com> Make the bcache hash table grow. * bcache.h (BCACHE_NUM_BUCKETS): Delete definition. @@ -292,7 +337,7 @@ Mon Nov 22 12:02:47 1999 Andrew Cagney <cagney@b1.cygnus.com> freeing the bcache's obstack directly. * symfile.c (reread_symbols): Same. -1999-11-20 Jim Blandy <jimb@zenia.red-bean.com> +1999-11-20 Jim Blandy <jimb@cygnus.com> * bcache.c, bcache.h: Rewritten. New version imposes less memory overhead, and has a more effective hash function, so it's probably @@ -526,7 +571,7 @@ Tue Nov 9 15:33:43 1999 Andrew Cagney <cagney@b1.cygnus.com> statement. (info_cb): Use paddr when printing addresses. -1999-11-08 Jim Blandy <jimb@zenia.red-bean.com> +1999-11-08 Jim Blandy <jimb@cygnus.com> * defs.h (ULONGEST_MAX, LONGEST_MAX): New definitions. * stabsread.c (read_huge_number): Parse and return LONGEST values. @@ -951,7 +996,7 @@ Thu Nov 4 17:36:27 1999 Andrew Cagney <cagney@b1.cygnus.com> * infcmd.c: Fix typo. -1999-10-28 Jim Blandy <jimb@zenia.red-bean.com> +1999-10-28 Jim Blandy <jimb@cygnus.com> * gdbtypes.c (init_simd_type): The upper bound to create_range_type is inclusive, not exclusive. @@ -1096,12 +1141,12 @@ Sat Oct 23 16:39:34 1999 Andrew Cagney <cagney@b1.cygnus.com> to avoid compiler warnings. (catch_fork_command_1): Ditto. -1999-10-20 Jim Blandy <jimb@cris.red-bean.com> +1999-10-20 Jim Blandy <jimb@cygnus.com> * Makefile.in (dwarf2read.o): Note that this depends on bfd/elf-bfd.h. (elf_bfd_h): New variable. -1999-10-19 Jim Blandy <jimb@zenia.red-bean.com> +1999-10-19 Jim Blandy <jimb@cygnus.com> * config/i386/tm-i386.h (REGISTER_NAMES): Change names of FPU instruction and operand pointer registers to improve consistency, @@ -1133,7 +1178,7 @@ Mon Oct 18 17:32:51 1999 Andrew Cagney <cagney@b1.cygnus.com> chunk/block write a run-time option. Check for quit_flag. Use target_write_memory_partial for downloads. -1999-10-18 Jim Blandy <jimb@zenia.red-bean.com> +1999-10-18 Jim Blandy <jimb@cygnus.com> Change Linux x86 register support to use the new tm-i386.h layout. * config/i386/tm-linux.h (HAVE_I387_REGS): #define this, so we get @@ -1247,7 +1292,7 @@ Sun Oct 17 13:58:56 1999 Andrew Cagney <cagney@b1.cygnus.com> (generic_load): Don't cast the result of bfd_get_section_name. Replace ``sect'' with ``sect_name'', use consistently. -1999-10-15 Jim Blandy <jimb@zenia.red-bean.com> +1999-10-15 Jim Blandy <jimb@cygnus.com> Add beginnings of support for SIMD register types. * gdbtypes.c (init_simd_type): New function for building @@ -1268,7 +1313,7 @@ Fri Oct 15 17:46:39 1999 Andrew Cagney <cagney@b1.cygnus.com> (_initialize_dcache): Fix description of ``set remotecache''. Cache is OFF by default. -1999-10-13 Jim Blandy <jimb@zenia.red-bean.com> +1999-10-13 Jim Blandy <jimb@cygnus.com> * valops.c (value_push): Don't forget to initialize container_len. @@ -1331,7 +1376,7 @@ Tue Oct 12 12:19:07 1999 David Taylor <taylor@texas.cygnus.com> * config/pa/tm-hppa.h (SYMBOLS_CAN_START_WITH_DOLLAR): It's not enough to #define this; you have to give it a non-zero value. -1999-10-11 Jim Blandy <jimb@zenia.red-bean.com> +1999-10-11 Jim Blandy <jimb@cygnus.com> Fix from Jim Kingdon <kingdon@redhat.com>, with tweaks to make it gdbarch- and bigendian-friendly: @@ -1958,7 +2003,7 @@ Tue Sep 28 11:08:34 1999 Jeffrey A Law (law@cygnus.com) remote.c, top.c, tracepoint.c, utils.c (async_p): Change var name to event_loop_p. -1999-09-28 Jim Blandy <jimb@cris.red-bean.com> +1999-09-28 Jim Blandy <jimb@cygnus.com> * hppa-tdep.c (skip_prologue_hard_way): Recognize ldo insns which generate pointers into the argument list. @@ -2278,7 +2323,7 @@ Fri Sep 17 19:28:17 1999 Andrew Cagney <cagney@b1.cygnus.com> * breakpoints.c (delete_command): Move declaration from here. * breakpoints.h (delete_command): To here. -1999-09-18 Jim Blandy <jimb@cris.red-bean.com> +1999-09-18 Jim Blandy <jimb@cygnus.com> * hppa-tdep.c (in_solib_call_trampoline): If we can't recognize the instruction we're at, we're not in a stub. @@ -2331,7 +2376,7 @@ Sat Sep 18 07:13:03 1999 Jeffrey A Law (law@cygnus.com) (inferior_event_handler): New function. Smarter inferior event handling. -1999-09-18 Jim Blandy <jimb@cris.red-bean.com> +1999-09-18 Jim Blandy <jimb@cygnus.com> * pa64solib.c (pa64_solib_create_inferior_hook): Remove code which tries to set __d_pid; it's not relevant to PA64 shared libraries. @@ -2358,7 +2403,7 @@ Sat Sep 18 07:13:03 1999 Jeffrey A Law (law@cygnus.com) * breakpoint.c (permanent_breakpoint_here_p): Delete. Accidentally left over from previous changes. -1999-09-17 Jim Blandy <jimb@cris.red-bean.com> +1999-09-17 Jim Blandy <jimb@cygnus.com> * config/pa/tm-hppa64.h (ARGS_GROW_DOWNWARD): Deleted. There are many more differences between the 32- and 64-bit ABI's than the @@ -2484,11 +2529,11 @@ Thu Sep 16 09:04:53 1999 Andrew Cagney <cagney@b1.cygnus.com> * remote-d10v.c: Remove. * config/d10v/d10v.mt (TDEPFILES): Remove remote-d10v.o. -1999-09-15 Jim Blandy <jimb@cris.red-bean.com> +1999-09-15 Jim Blandy <jimb@cygnus.com> * breakpoint.c (remove_breakpoint): Return zero, not nothing. -1999-09-14 Jim Blandy <jimb@cris.red-bean.com> +1999-09-14 Jim Blandy <jimb@cygnus.com> * hppa-tdep.c (frame_chain): If the unwind info says we've saved r3, don't trust it. Call get_frame_saved_regs and see if we can @@ -2509,7 +2554,7 @@ Tue Sep 14 14:34:28 1999 Andrew Cagney <cagney@b1.cygnus.com> * remote-st.c (connect_command), remote-os9k.c (connect_command): Fix. Call FD_SET et.al. with FD instead of serial_t. -1999-09-14 Jim Blandy <jimb@cris.red-bean.com> +1999-09-14 Jim Blandy <jimb@cygnus.com> * hppa-tdep.c (hppa_frame_find_saved_regs): The two possible instructions for saving the return pointer (32- and 64-bit) save @@ -2716,7 +2761,7 @@ Mon Sep 13 18:54:05 1999 Andrew Cagney <cagney@b1.cygnus.com> Mon Sep 13 17:51:28 1999 Andrew Cagney <cagney@b1.cygnus.com> - From 1999-09-12 Jim Blandy <jimb@cris.red-bean.com>: + From 1999-09-12 Jim Blandy <jimb@cygnus.com>: * gdbarch.sh (generating setters): Use sed to generate the proper indentation, not tr; tr's behavior is notoriously unportable. @@ -4236,11 +4281,11 @@ Wed Aug 4 10:42:58 1999 Fred Fish <fnf@cygnus.com> to a CORE_ADDR look like an subtraction expression. (add_symbol_file_command): Ditto. -1999-07-30 Jim Blandy <jimb@cris.red-bean.com> +1999-07-30 Jim Blandy <jimb@cygnus.com> * hppa-tdep.c (pa_print_registers): Frob register output some more. -1999-07-29 Jim Blandy <jimb@cris.red-bean.com> +1999-07-29 Jim Blandy <jimb@cygnus.com> * config/pa/nm-hppah.h (PTRACE_ARG3_TYPE): After more consideration, make this a CORE_ADDR, like WDB did. @@ -4280,7 +4325,7 @@ Wed Aug 4 10:42:58 1999 Fred Fish <fnf@cygnus.com> * hppah-nat.c (child_xfer_memory): Correctly compute mask to round address to an int boundary. -1999-07-29 Jim Blandy <jimb@savonarola.red-bean.com> +1999-07-29 Jim Blandy <jimb@cygnus.com> Change from Ian Lance Taylor <ian@zembu.com>. The i386_linux_sigtramp* functions should be moved to @@ -4303,7 +4348,7 @@ Wed Aug 4 10:42:58 1999 Fred Fish <fnf@cygnus.com> (i386_linux_sigtramp_saved_pc): Likewise. (i386_linux_sigtramp_saved_sp): Likewise. -1999-07-28 Jim Blandy <jimb@savonarola.red-bean.com> +1999-07-28 Jim Blandy <jimb@cygnus.com> * infrun.c (handle_inferior_event): Don't try to use the code for stepping over a function call to also handle stepping out of a @@ -4318,7 +4363,7 @@ Wed Aug 4 10:42:58 1999 Fred Fish <fnf@cygnus.com> from readline the same way as a multiline command. This avoids missing detecting when the user presses just 'enter'. -1999-07-28 Jim Blandy <jimb@savonarola.red-bean.com> +1999-07-28 Jim Blandy <jimb@cygnus.com> Provide more sanity checking: * infrun.c (handle_inferior_event): Before assigning a new @@ -4365,7 +4410,7 @@ Mon Jul 26 17:13:39 1999 Andrew Cagney <cagney@b1.cygnus.com> * remote.c (_initialize_remote): "remotebreak" should be a var_boolean. -1999-07-15 Jim Blandy <jimb@cris.red-bean.com> +1999-07-15 Jim Blandy <jimb@cygnus.com> Make the output from "info registers" fit withinin 80 columns. * hppa-tdep.c (pa_print_registers): Make it easy to change row and diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 9ae4746..b7e548d 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -229,7 +229,7 @@ CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE) \ ADD_FILES = $(REGEX) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) ADD_DEPS = $(REGEX1) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) -VERSION = 19991206 +VERSION = 19991207 DIST=gdb LINT=/usr/5bin/lint diff --git a/gdb/config/i386/linux.mh b/gdb/config/i386/linux.mh index 1fe1e36..8464934 100644 --- a/gdb/config/i386/linux.mh +++ b/gdb/config/i386/linux.mh @@ -5,4 +5,4 @@ XDEPFILES= ser-tcp.o NAT_FILE= nm-linux.h NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \ - core-aout.o core-regset.o i386v-nat.o i386-linux-nat.o linux-thread.o + core-aout.o i386v-nat.o i386-linux-nat.o linux-thread.o diff --git a/gdb/config/i386/tm-i386.h b/gdb/config/i386/tm-i386.h index efc3f41..5181845 100644 --- a/gdb/config/i386/tm-i386.h +++ b/gdb/config/i386/tm-i386.h @@ -259,6 +259,13 @@ extern void double_to_i387 (char *, char *); double_to_i387((char *)&val, (TO)); \ } +/* Print out the i387 floating point state. */ +#ifdef HAVE_I387_REGS +extern void i387_float_info (void); +#define FLOAT_INFO { i387_float_info (); } +#endif + + /* Store the address of the place in which to copy the structure the subroutine will return. This is called from call_function. */ diff --git a/gdb/corelow.c b/gdb/corelow.c index 9e4a0f5..d5998f4 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -373,6 +373,62 @@ core_detach (args, from_tty) printf_filtered ("No core file now.\n"); } + +/* Try to retrieve registers from a section in core_bfd, and supply + them to core_vec->core_read_registers, as the register set numbered + WHICH. + + If inferior_pid is zero, do the single-threaded thing: look for a + section named NAME. If inferior_pid is non-zero, do the + multi-threaded thing: look for a section named "NAME/PID", where + PID is the shortest ASCII decimal representation of inferior_pid. + + HUMAN_NAME is a human-readable name for the kind of registers the + NAME section contains, for use in error messages. + + If REQUIRED is non-zero, print an error if the core file doesn't + have a section by the appropriate name. Otherwise, just do nothing. */ + +static void +get_core_register_section (char *name, + int which, + char *human_name, + int required) +{ + char section_name[100]; + sec_ptr section; + bfd_size_type size; + char *contents; + + if (inferior_pid) + sprintf (section_name, "%s/%d", name, inferior_pid); + else + strcpy (section_name, name); + + section = bfd_get_section_by_name (core_bfd, section_name); + if (! section) + { + if (required) + warning ("Couldn't find %s registers in core file.\n", human_name); + return; + } + + size = bfd_section_size (core_bfd, section); + contents = alloca (size); + if (! bfd_get_section_contents (core_bfd, section, contents, + (file_ptr) 0, size)) + { + warning ("Couldn't read %s registers from `%s' section in core file.\n", + human_name, name); + return; + } + + core_vec->core_read_registers (contents, size, which, + ((CORE_ADDR) + bfd_section_vma (core_bfd, section))); +} + + /* Get the registers out of a core file. This is the machine- independent part. Fetch_core_registers is the machine-dependent part, typically implemented in the xm-file for each architecture. */ @@ -384,67 +440,20 @@ static void get_core_registers (regno) int regno; { - sec_ptr reg_sec; - unsigned size; - char *the_regs; - char secname[30]; + int status; - if (core_vec == NULL) + if (core_vec == NULL + || core_vec->core_read_registers == NULL) { fprintf_filtered (gdb_stderr, "Can't fetch registers from this type of core file\n"); return; } - /* Thread support. If inferior_pid is non-zero, then we have found a core - file with threads (or multiple processes). In that case, we need to - use the appropriate register section, else we just use `.reg'. */ + get_core_register_section (".reg", 0, "general-purpose", 1); + get_core_register_section (".reg2", 2, "floating-point", 0); + get_core_register_section (".reg-xfp", 3, "extended floating-point", 0); - /* XXX - same thing needs to be done for floating-point (.reg2) sections. */ - - if (inferior_pid) - sprintf (secname, ".reg/%d", inferior_pid); - else - strcpy (secname, ".reg"); - - reg_sec = bfd_get_section_by_name (core_bfd, secname); - if (!reg_sec) - goto cant; - size = bfd_section_size (core_bfd, reg_sec); - the_regs = alloca (size); - if (bfd_get_section_contents (core_bfd, reg_sec, the_regs, (file_ptr) 0, size) && - core_vec->core_read_registers != NULL) - { - (core_vec->core_read_registers (the_regs, size, 0, - (unsigned) bfd_section_vma (abfd, reg_sec))); - } - else - { - cant: - fprintf_filtered (gdb_stderr, - "Couldn't fetch registers from core file: %s\n", - bfd_errmsg (bfd_get_error ())); - } - - /* Now do it again for the float registers, if they exist. */ - reg_sec = bfd_get_section_by_name (core_bfd, ".reg2"); - if (reg_sec) - { - size = bfd_section_size (core_bfd, reg_sec); - the_regs = alloca (size); - if (bfd_get_section_contents (core_bfd, reg_sec, the_regs, (file_ptr) 0, size) && - core_vec->core_read_registers != NULL) - { - (core_vec->core_read_registers (the_regs, size, 2, - (unsigned) bfd_section_vma (abfd, reg_sec))); - } - else - { - fprintf_filtered (gdb_stderr, - "Couldn't fetch register set 2 from core file: %s\n", - bfd_errmsg (bfd_get_error ())); - } - } registers_fetched (); } diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h index 0db61f9..e8e3953 100644 --- a/gdb/gdbcore.h +++ b/gdb/gdbcore.h @@ -163,15 +163,21 @@ struct core_fns CORE_REG_SIZE is the size of that area. - WHICH says which set of registers we are handling (0 = int, 2 = float on - machines where they are discontiguous). + WHICH says which set of registers we are handling: + 0 --- integer registers + 2 --- floating-point registers, on machines where they are + discontiguous + 3 --- extended floating-point registers, on machines where + these are present in yet a third area. (GNU/Linux uses + this to get at the SSE registers.) REG_ADDR is the offset from u.u_ar0 to the register values relative to core_reg_sect. This is used with old-fashioned core files to locate the registers in a large upage-plus-stack ".reg" section. Original upage address X is at location core_reg_sect+x+reg_addr. */ - void (*core_read_registers) PARAMS ((char *core_reg_sect, unsigned core_reg_size, + void (*core_read_registers) PARAMS ((char *core_reg_sect, + unsigned core_reg_size, int which, CORE_ADDR reg_addr)); /* Finds the next struct core_fns. They are allocated and initialized diff --git a/gdb/gdbserver/low-linux.c b/gdb/gdbserver/low-linux.c index 3b3e287..d8ff5d5 100644 --- a/gdb/gdbserver/low-linux.c +++ b/gdb/gdbserver/low-linux.c @@ -274,267 +274,6 @@ m68k_linux_register_u_addr (blockend, regnum) { return (blockend + 4 * regmap[regnum]); } -/* start-sanitize-ia64 */ -#elif defined(IA64_GNULINUX_TARGET) -#undef NUM_FREGS -#define NUM_FREGS 0 - -#include <asm/ptrace_offsets.h> - -static int u_offsets[] = - { - /* general registers */ - -1, /* gr0 not available; i.e, it's always zero */ - PT_R1, - PT_R2, - PT_R3, - PT_R4, - PT_R5, - PT_R6, - PT_R7, - PT_R8, - PT_R9, - PT_R10, - PT_R11, - PT_R12, - PT_R13, - PT_R14, - PT_R15, - PT_R16, - PT_R17, - PT_R18, - PT_R19, - PT_R20, - PT_R21, - PT_R22, - PT_R23, - PT_R24, - PT_R25, - PT_R26, - PT_R27, - PT_R28, - PT_R29, - PT_R30, - PT_R31, - /* gr32 through gr127 not directly available via the ptrace interface */ - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - /* Floating point registers */ - -1, -1, /* f0 and f1 not available (f0 is +0.0 and f1 is +1.0) */ - PT_F2, - PT_F3, - PT_F4, - PT_F5, - PT_F6, - PT_F7, - PT_F8, - PT_F9, - PT_F10, - PT_F11, - PT_F12, - PT_F13, - PT_F14, - PT_F15, - PT_F16, - PT_F17, - PT_F18, - PT_F19, - PT_F20, - PT_F21, - PT_F22, - PT_F23, - PT_F24, - PT_F25, - PT_F26, - PT_F27, - PT_F28, - PT_F29, - PT_F30, - PT_F31, - PT_F32, - PT_F33, - PT_F34, - PT_F35, - PT_F36, - PT_F37, - PT_F38, - PT_F39, - PT_F40, - PT_F41, - PT_F42, - PT_F43, - PT_F44, - PT_F45, - PT_F46, - PT_F47, - PT_F48, - PT_F49, - PT_F50, - PT_F51, - PT_F52, - PT_F53, - PT_F54, - PT_F55, - PT_F56, - PT_F57, - PT_F58, - PT_F59, - PT_F60, - PT_F61, - PT_F62, - PT_F63, - PT_F64, - PT_F65, - PT_F66, - PT_F67, - PT_F68, - PT_F69, - PT_F70, - PT_F71, - PT_F72, - PT_F73, - PT_F74, - PT_F75, - PT_F76, - PT_F77, - PT_F78, - PT_F79, - PT_F80, - PT_F81, - PT_F82, - PT_F83, - PT_F84, - PT_F85, - PT_F86, - PT_F87, - PT_F88, - PT_F89, - PT_F90, - PT_F91, - PT_F92, - PT_F93, - PT_F94, - PT_F95, - PT_F96, - PT_F97, - PT_F98, - PT_F99, - PT_F100, - PT_F101, - PT_F102, - PT_F103, - PT_F104, - PT_F105, - PT_F106, - PT_F107, - PT_F108, - PT_F109, - PT_F110, - PT_F111, - PT_F112, - PT_F113, - PT_F114, - PT_F115, - PT_F116, - PT_F117, - PT_F118, - PT_F119, - PT_F120, - PT_F121, - PT_F122, - PT_F123, - PT_F124, - PT_F125, - PT_F126, - PT_F127, - /* predicate registers - we don't fetch these individually */ - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - /* branch registers */ - PT_B0, - PT_B1, - PT_B2, - PT_B3, - PT_B4, - PT_B5, - PT_B6, - PT_B7, - /* virtual frame pointer and virtual return address pointer */ - -1, -1, - /* other registers */ - PT_PR, - PT_CR_IIP, - PT_CR_IPSR, - /* kernel registers not visible via ptrace interface (?) */ - -1, -1, -1, -1, -1, -1, -1, -1, - /* hole */ - -1, -1, -1, -1, -1, -1, -1, -1, - PT_AR_RSC, - PT_AR_BSP, - PT_AR_BSPSTORE, - PT_AR_RNAT, - -1, - -1, /* Not available: FCR, IA32 floating control register */ - -1, -1, - -1, /* Not available: EFLAG */ - -1, /* Not available: CSD */ - -1, /* Not available: SSD */ - -1, /* Not available: CFLG */ - -1, /* Not available: FSR */ - -1, /* Not available: FIR */ - -1, /* Not available: FDR */ - -1, - PT_AR_CCV, - -1, -1, -1, - PT_AR_UNAT, - -1, -1, -1, - PT_AR_FPSR, - -1, -1, -1, - -1, /* Not available: ITC */ - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, - PT_CR_IFS, /* was PT_AR_PFS, but it seemed bogus */ - PT_AR_LC, - -1, /* Not available: EC, the Epilog Count register */ - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, - }; - -int -ia64_register_u_addr (int blockend, int regnum) -{ - int addr; - - if (regnum < 0 || regnum >= NUM_REGS) - error ("Invalid register number %d.", regnum); - - addr = u_offsets[regnum]; - if (addr == -1) - addr = 0; - - return addr; -} - -initialize_arch() -{ - return; -} -/* end-sanitize-ia64 */ #endif CORE_ADDR diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index ba1f9d2..cec0f8e 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -612,6 +612,91 @@ store_inferior_registers (regno) +/* Interpreting register set info found in core files. */ + +/* Provide registers to GDB from a core file. + + (We can't use the generic version of this function in + core-regset.c, because Linux has *three* different kinds of + register set notes. core-regset.c would have to call + supply_xfpregset, which most platforms don't have.) + + CORE_REG_SECT points to an array of bytes, which are the contents + of a `note' from a core file which BFD thinks might contain + register contents. CORE_REG_SIZE is its size. + + WHICH says which register set corelow suspects this is: + 0 --- the general register set, in gregset format + 2 --- the floating-point register set, in fpregset format + 3 --- the extended floating-point register set, in struct + user_xfpregs_struct format + + DUMMY isn't used on Linux. */ +static void +i386_linux_fetch_core_registers (char *core_reg_sect, + unsigned core_reg_size, + int which, + CORE_ADDR dummy) +{ + gregset_t gregset; + fpregset_t fpregset; + + switch (which) + { + case 0: + if (core_reg_size != sizeof (gregset)) + warning ("wrong size gregset struct in core file"); + else + { + memcpy (&gregset, core_reg_sect, sizeof (gregset)); + supply_gregset (&gregset); + } + break; + + case 2: + if (core_reg_size != sizeof (fpregset)) + warning ("wrong size fpregset struct in core file"); + else + { + memcpy (&fpregset, core_reg_sect, sizeof (fpregset)); + supply_fpregset (&fpregset); + } + break; + +#ifdef HAVE_PTRACE_GETXFPREGS + { + struct user_xfpregs_struct xfpregset; + case 3: + if (core_reg_size != sizeof (struct user_xfpregs_struct)) + warning ("wrong size user_xfpregs_struct in core file"); + else + { + memcpy (&xfpregset, core_reg_sect, sizeof (xfpregset)); + supply_xfpregset (&xfpregset); + } + break; + } +#endif + + default: + /* We've covered all the kinds of registers we know about here, + so this must be something we wouldn't know what to do with + anyway. Just ignore it. */ + break; + } +} + + +static struct core_fns i386_linux_nat_core_fns = +{ + bfd_target_elf_flavour, /* core_flavour */ + default_check_format, /* check_format */ + default_core_sniffer, /* core_sniffer */ + i386_linux_fetch_core_registers, /* core_read_registers */ + NULL /* next */ +}; + + /* Calling functions in shared libraries. */ /* Find the minimal symbol named NAME, and return both the minsym @@ -700,3 +785,13 @@ i386_linux_skip_solib_resolver (CORE_ADDR pc) return 0; } + + + +/* Module initialization. */ + +void +_initialize_i386_linux_nat () +{ + add_core_fns (&i386_linux_nat_core_fns); +} diff --git a/gdb/i386v-nat.c b/gdb/i386v-nat.c index e160385..0bf702c 100644 --- a/gdb/i386v-nat.c +++ b/gdb/i386v-nat.c @@ -307,88 +307,3 @@ i386_stopped_by_watchpoint (pid) } #endif /* TARGET_HAS_HARDWARE_WATCHPOINTS */ - -#if 0 -/* using FLOAT_INFO as is would be a problem. FLOAT_INFO is called - via a command xxx and eventually calls ptrace without ever having - traversed the target vector. This would be terribly impolite - behaviour for a sun4 hosted remote gdb. - - A fix might be to move this code into the "info registers" command. - rich@cygnus.com 15 Sept 92. */ -i386_float_info () -{ - struct user u; /* just for address computations */ - int i; - /* fpstate defined in <sys/user.h> */ - struct fpstate *fpstatep; - char buf[sizeof (struct fpstate) + 2 * sizeof (int)]; - unsigned int uaddr; - char fpvalid = 0; - unsigned int rounded_addr; - unsigned int rounded_size; - extern int corechan; - int skip; - - uaddr = (char *) &u.u_fpvalid - (char *) &u; - if (target_has_execution) - { - unsigned int data; - unsigned int mask; - - rounded_addr = uaddr & -sizeof (int); - data = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) rounded_addr, 0); - mask = 0xff << ((uaddr - rounded_addr) * 8); - - fpvalid = ((data & mask) != 0); - } -#if 0 - else - { - if (lseek (corechan, uaddr, 0) < 0) - perror ("seek on core file"); - if (myread (corechan, &fpvalid, 1) < 0) - perror ("read on core file"); - - } -#endif /* no core support yet */ - - if (fpvalid == 0) - { - printf_unfiltered ("no floating point status saved\n"); - return; - } - - uaddr = (char *) &U_FPSTATE (u) - (char *) &u; - if (target_has_execution) - { - int *ip; - - rounded_addr = uaddr & -sizeof (int); - rounded_size = (((uaddr + sizeof (struct fpstate)) - uaddr) + - sizeof (int) - 1) / sizeof (int); - skip = uaddr - rounded_addr; - - ip = (int *) buf; - for (i = 0; i < rounded_size; i++) - { - *ip++ = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) rounded_addr, 0); - rounded_addr += sizeof (int); - } - } -#if 0 - else - { - if (lseek (corechan, uaddr, 0) < 0) - perror_with_name ("seek on core file"); - if (myread (corechan, buf, sizeof (struct fpstate)) < 0) - perror_with_name ("read from core file"); - skip = 0; - } -#endif /* 0 */ - - fpstatep = (struct fpstate *) (buf + skip); - print_387_status (fpstatep->status, (struct env387 *) fpstatep->state); -} - -#endif /* never */ diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index aac013c..0bb1631 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -1,5 +1,5 @@ /* Intel 387 floating point stuff. - Copyright (C) 1988, 1989, 1991, 1998 Free Software Foundation, Inc. + Copyright (C) 1988, 1989, 1991, 1998, 1999 Free Software Foundation, Inc. This file is part of GDB. @@ -26,14 +26,12 @@ #include "gdbcore.h" #include "floatformat.h" -void i387_to_double PARAMS ((char *, char *)); -void double_to_i387 PARAMS ((char *, char *)); -static void print_387_control_bits PARAMS ((unsigned int control)); -static void print_387_status_bits PARAMS ((unsigned int status)); +/* FIXME: Eliminate the next two functions when we have the time to + change all the callers. */ -/* FIXME: Eliminate these routines when we have the time to change all - the callers. */ +void i387_to_double PARAMS ((char *from, char *to)); +void double_to_i387 PARAMS ((char *from, char *to)); void i387_to_double (from, to) @@ -51,6 +49,16 @@ double_to_i387 (from, to) floatformat_from_double (&floatformat_i387_ext, (double *) from, to); } + +/* FIXME: The functions on this page are used by the old `info float' + implementations that a few of the i386 targets provide. These + functions should be removed if all of these have been converted to + use the generic implementation based on the new register file + layout. */ + +static void print_387_control_bits PARAMS ((unsigned int control)); +static void print_387_status_bits PARAMS ((unsigned int status)); + static void print_387_control_bits (control) unsigned int control; @@ -149,6 +157,243 @@ print_387_status_word (status) puts_unfiltered ("\n"); } + +/* Implement the `info float' layout based on the register definitions + in `tm-i386.h'. */ + +/* Print the floating point number specified by RAW. */ +static void +print_i387_value (char *raw) +{ + DOUBLEST value; + + floatformat_to_doublest (&floatformat_i387_ext, raw, &value); + + /* We try to print 19 digits. The last digit may or may not contain + garbage, but we'd better print one too many. We need enough room + to print the value, 1 position for the sign, 1 for the decimal + point, 19 for the digits and 6 for the exponent adds up to 27. */ +#ifdef PRINTF_HAS_LONG_DOUBLE + printf_filtered (" %-+27.19Lg", (long double) value); +#else + printf_filtered (" %-+27.19g", (double) value); +#endif +} + +/* Print the classification for the register contents RAW. */ +static void +print_i387_ext (unsigned char *raw) +{ + int sign; + int integer; + unsigned int exponent; + unsigned long fraction[2]; + + sign = raw[9] & 0x80; + integer = raw[7] & 0x80; + exponent = (((raw[9] & 0x7f) << 8) | raw[8]); + fraction[0] = ((raw[3] << 24) | (raw[2] << 16) | (raw[1] << 8) | raw[0]); + fraction[1] = (((raw[7] & 0x7f) << 24) | (raw[6] << 16) + | (raw[5] << 8) | raw[4]); + + if (exponent == 0x7fff && integer) + { + if (fraction[0] == 0x00000000 && fraction[1] == 0x00000000) + /* Infinity. */ + printf_filtered (" %cInf", (sign ? '-' : '+')); + else if (sign && fraction[0] == 0x00000000 && fraction[1] == 0x40000000) + /* Real Indefinite (QNaN). */ + puts_unfiltered (" Real Indefinite (QNaN)"); + else if (fraction[1] & 0x40000000) + /* QNaN. */ + puts_filtered (" QNaN"); + else + /* SNaN. */ + puts_filtered (" SNaN"); + } + else if (exponent < 0x7fff && exponent > 0x0000 && integer) + /* Normal. */ + print_i387_value (raw); + else if (exponent == 0x0000) + { + /* Denormal or zero. */ + print_i387_value (raw); + + if (integer) + /* Pseudo-denormal. */ + puts_filtered (" Pseudo-denormal"); + else if (fraction[0] || fraction[1]) + /* Denormal. */ + puts_filtered (" Denormal"); + } + else + /* Unsupported. */ + puts_filtered (" Unsupported"); +} + +/* Print the status word STATUS. */ +static void +print_i387_status_word (unsigned int status) +{ + printf_filtered ("Status Word: %s", + local_hex_string_custom (status, "04")); + puts_filtered (" "); + printf_filtered (" %s", (status & 0x0001) ? "IE" : " "); + printf_filtered (" %s", (status & 0x0002) ? "DE" : " "); + printf_filtered (" %s", (status & 0x0004) ? "ZE" : " "); + printf_filtered (" %s", (status & 0x0008) ? "OE" : " "); + printf_filtered (" %s", (status & 0x0010) ? "UE" : " "); + printf_filtered (" %s", (status & 0x0020) ? "PE" : " "); + puts_filtered (" "); + printf_filtered (" %s", (status & 0x0080) ? "ES" : " "); + puts_filtered (" "); + printf_filtered (" %s", (status & 0x0080) ? "SF" : " "); + puts_filtered (" "); + printf_filtered (" %s", (status & 0x0100) ? "C0" : " "); + printf_filtered (" %s", (status & 0x0200) ? "C1" : " "); + printf_filtered (" %s", (status & 0x0400) ? "C2" : " "); + printf_filtered (" %s", (status & 0x4000) ? "C3" : " "); + + puts_filtered ("\n"); + + printf_filtered (" TOP: %d\n", ((status >> 11) & 7)); +} + +/* Print the control word CONTROL. */ +static void +print_i387_control_word (unsigned int control) +{ + printf_filtered ("Control Word: %s", + local_hex_string_custom (control, "04")); + puts_filtered (" "); + printf_filtered (" %s", (control & 0x0001) ? "IM" : " "); + printf_filtered (" %s", (control & 0x0002) ? "DM" : " "); + printf_filtered (" %s", (control & 0x0004) ? "ZM" : " "); + printf_filtered (" %s", (control & 0x0008) ? "OM" : " "); + printf_filtered (" %s", (control & 0x0010) ? "UM" : " "); + printf_filtered (" %s", (control & 0x0020) ? "PM" : " "); + + puts_filtered ("\n"); + + puts_filtered (" PC: "); + switch ((control >> 8) & 3) + { + case 0: + puts_filtered ("Single Precision (24-bits)\n"); + break; + case 1: + puts_filtered ("Reserved\n"); + break; + case 2: + puts_filtered ("Double Precision (53-bits)\n"); + break; + case 3: + puts_filtered ("Extended Precision (64-bits)\n"); + break; + } + + puts_filtered (" RC: "); + switch ((control >> 10) & 3) + { + case 0: + puts_filtered ("Round to nearest\n"); + break; + case 1: + puts_filtered ("Round down\n"); + break; + case 2: + puts_filtered ("Round up\n"); + break; + case 3: + puts_filtered ("Round toward zero\n"); + break; + } +} + +/* Print out the i387 floating poin state. */ +void +i387_float_info (void) +{ + unsigned int fctrl; + unsigned int fstat; + unsigned int ftag; + unsigned int fiseg; + unsigned int fioff; + unsigned int foseg; + unsigned int fooff; + unsigned int fop; + int fpreg; + int top; + + fctrl = read_register (FCTRL_REGNUM); + fstat = read_register (FSTAT_REGNUM); + ftag = read_register (FTAG_REGNUM); + fiseg = read_register (FCS_REGNUM); + fioff = read_register (FCOFF_REGNUM); + foseg = read_register (FDS_REGNUM); + fooff = read_register (FDOFF_REGNUM); + fop = read_register (FOP_REGNUM); + + top = ((fstat >> 11) & 7); + + for (fpreg = 7; fpreg >= 0; fpreg--) + { + unsigned char raw[FPU_REG_RAW_SIZE]; + int tag = (ftag >> (fpreg * 2)) & 3; + int i; + + printf_filtered ("%sR%d: ", fpreg == top ? "=>" : " ", fpreg); + + switch (tag) + { + case 0: + puts_filtered ("Valid "); + break; + case 1: + puts_filtered ("Zero "); + break; + case 2: + puts_filtered ("Special "); + break; + case 3: + puts_filtered ("Empty "); + break; + } + + read_register_gen ((fpreg + 8 - top) % 8 + FP0_REGNUM, raw); + + puts_filtered ("0x"); + for (i = 9; i >= 0; i--) + printf_filtered ("%02x", raw[i]); + + if (tag != 3) + print_i387_ext (raw); + + puts_filtered ("\n"); + } + + puts_filtered ("\n"); + + print_i387_status_word (fstat); + print_i387_control_word (fctrl); + printf_filtered ("Tag Word: %s\n", + local_hex_string_custom (ftag, "04")); + printf_filtered ("Instruction Pointer: %s:", + local_hex_string_custom (fiseg, "02")); + printf_filtered ("%s\n", local_hex_string_custom (fioff, "08")); + printf_filtered ("Operand Pointer: %s:", + local_hex_string_custom (foseg, "02")); + printf_filtered ("%s\n", local_hex_string_custom (fooff, "08")); + printf_filtered ("Opcode: %s\n", + local_hex_string_custom (fop ? (fop | 0xd800) : 0, "04")); +} + + +/* FIXME: The functions on this page are used to provide `long double' + support for Linux. However, the approach does not seem to be the + right one, and we are planning to solve this in a way that should + work for all i386 targets. These functions will disappear in the + near future, so please don't use them. */ #ifdef LD_I387 int i387_extract_floating (PTR addr, int len, DOUBLEST *dretptr) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 0bd354b..30308c8 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +1999-12-06 Jim Blandy <jimb@cygnus.com> + + * gdb.base/default.exp: Expect the new 'info float' command on + all i386 platforms. + + * gdb.threads/linux-dp.exp: Expand our ability to recognize + LinuxThreads libraries that don't support debugging. + Sat Dec 4 15:21:18 1999 Andrew Cagney <cagney@b1.cygnus.com> * gdb.base/remote.c: Fill the buffer with truely random data. diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index f73a6d7..6f109fe 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -304,8 +304,8 @@ if [istarget "arm-*-*"] then { gdb_test "info float" "Software FPU type.*mask:.*flags:.*" "info float" } elseif [istarget "strongarm-*-*"] then { gdb_test "info float" "Software FPU type.*mask:.*flags:.*" "info float" -} elseif [istarget "i\[3456\]86-*-linux-gnu"] then { - gdb_test "info float" "No registers." +} elseif [istarget "i\[3456\]86-*-*"] then { + gdb_test "info float" "R7:.*Status Word:.*Opcode:.*" "info float" } else { gdb_test "info float" "No floating point info available for this processor." "info float" } |