From: Stan Shebs Date: Sun, 25 Sep 1994 21:13:24 +0000 (+0000) Subject: * infcmd.c (do_registers_info) [INVALID_FLOAT]: Only use if X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ac57e5addaabc03bbc29c1f418a000276129836d;p=binutils-gdb.git * infcmd.c (do_registers_info) [INVALID_FLOAT]: Only use if defined. * values.c (unpack_double) [INVALID_FLOAT]: Ditto. * mips-tdep.c (mips_print_register): Don't test float validity. * config/a29k/tm-a29k.h, config/alpha/tm-alpha.h, config/arm/tm-arm.h, config/convex/tm-convex.h, config/h8300/tm-h8300.h, config/h8500/tm-h8500.h, config/i386/tm-i386v.h, config/i386/tm-sun386.h, config/i960/tm-i960.h, config/m68k/tm-m68k.h, config/m88k/tm-m88k.h, config/mips/tm-mips.h, config/ns32k/tm-merlin.h, config/ns32k/tm-nbsd.h, config/ns32k/tm-ns32km3.h, config/ns32k/tm-umax.h, config/pa/tm-hppa.h, config/pyr/tm-pyr.h, config/rs6000/tm-rs6000.h, config/sh/tm-sh.h, config/sparc/tm-sparc.h, config/z8k/tm-z8k.h (INVALID_FLOAT): Remove definition. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5e445c0a009..570a45c6fc4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,36 @@ +Sun Sep 25 12:50:17 1994 Stan Shebs (shebs@andros.cygnus.com) + + * infcmd.c (do_registers_info) [INVALID_FLOAT]: Only use if + defined. + * values.c (unpack_double) [INVALID_FLOAT]: Ditto. + * mips-tdep.c (mips_print_register): Don't test float validity. + * config/a29k/tm-a29k.h, config/alpha/tm-alpha.h, + config/arm/tm-arm.h, config/convex/tm-convex.h, + config/h8300/tm-h8300.h, config/h8500/tm-h8500.h, + config/i386/tm-i386v.h, config/i386/tm-sun386.h, + config/i960/tm-i960.h, config/m68k/tm-m68k.h, + config/m88k/tm-m88k.h, config/mips/tm-mips.h, + config/ns32k/tm-merlin.h, config/ns32k/tm-nbsd.h, + config/ns32k/tm-ns32km3.h, config/ns32k/tm-umax.h, + config/pa/tm-hppa.h, config/pyr/tm-pyr.h, + config/rs6000/tm-rs6000.h, config/sh/tm-sh.h, + config/sparc/tm-sparc.h, config/z8k/tm-z8k.h (INVALID_FLOAT): + Remove definition. + +Sun Sep 25 06:07:37 1994 Jim Kingdon (kingdon@lioth.cygnus.com) + + * TODO: Remove item about adding general multi-threaded stuff; + this is done. + Remove item about specifying arbitrary locations of stack frames + (this works on some machines). + Remove item about debugging functions without a frame pointer + (this works on some machines). + Remove item about re-writing macros which handle frame chaining and + frameless functions. They have been re-written at least once + since that item was written. + Remove item about gdb catching SIGINT when attached; this is done. + Remove item about having list_command not read symbols--why bother? + Sat Sep 24 17:40:10 1994 Stan Shebs (shebs@andros.cygnus.com) * TODO: Append contents of Projects file. diff --git a/gdb/config/a29k/tm-a29k.h b/gdb/config/a29k/tm-a29k.h index c87b572bfd0..371b4dcf26e 100644 --- a/gdb/config/a29k/tm-a29k.h +++ b/gdb/config/a29k/tm-a29k.h @@ -96,10 +96,6 @@ CORE_ADDR skip_prologue (); #define ABOUT_TO_RETURN(pc) \ ((read_memory_integer (pc, 4) & 0xff0000ff) == 0xc0000080) -/* Return 1 if P points to an invalid floating point value. */ - -#define INVALID_FLOAT(p, len) 0 /* Just a first guess; not checked */ - /* Say how long (ordinary) registers are. This is a piece of bogosity used in push_word and a few other places; REGISTER_RAW_SIZE is the real way to know how big a register is. */ diff --git a/gdb/config/h8300/tm-h8300.h b/gdb/config/h8300/tm-h8300.h index b62a931dee7..b9a2918a7d3 100644 --- a/gdb/config/h8300/tm-h8300.h +++ b/gdb/config/h8300/tm-h8300.h @@ -91,10 +91,6 @@ extern CORE_ADDR h8300_skip_prologue (); #define ABOUT_TO_RETURN(pc) ((read_memory_unsigned_integer (pc, 2) & ~0x3) == 0x4e74) -/* Return 1 if P points to an invalid floating point value. */ - -#define INVALID_FLOAT(p, len) 0 /* Just a first guess; not checked */ - /* Say how long registers are. */ #define REGISTER_SIZE 4 diff --git a/gdb/config/h8500/tm-h8500.h b/gdb/config/h8500/tm-h8500.h index 0a96b43b315..f169ad86f85 100644 --- a/gdb/config/h8500/tm-h8500.h +++ b/gdb/config/h8500/tm-h8500.h @@ -76,10 +76,6 @@ extern CORE_ADDR h8500_skip_prologue (); #define ABOUT_TO_RETURN(pc) about_to_return(pc) -/* Return 1 if P points to an invalid floating point value. */ - -#define INVALID_FLOAT(p, len) 0 /* Just a first guess; not checked */ - /* Say how long registers are. */ #define REGISTER_TYPE unsigned long diff --git a/gdb/config/i386/tm-i386v.h b/gdb/config/i386/tm-i386v.h index 49de3a07712..e86506abc5b 100644 --- a/gdb/config/i386/tm-i386v.h +++ b/gdb/config/i386/tm-i386v.h @@ -79,11 +79,6 @@ i386_skip_prologue PARAMS ((int)); #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 0xc3) -/* Return 1 if P points to an invalid floating point value. - LEN is the length in bytes -- not relevant on the 386. */ - -#define INVALID_FLOAT(p, len) (0) - /* Say how long (ordinary) registers are. This is a piece of bogosity used in push_word and a few other places; REGISTER_RAW_SIZE is the real way to know how big a register is. */ diff --git a/gdb/config/i386/tm-sun386.h b/gdb/config/i386/tm-sun386.h index a34305a3d6e..657056a286c 100644 --- a/gdb/config/i386/tm-sun386.h +++ b/gdb/config/i386/tm-sun386.h @@ -81,11 +81,6 @@ i386_skip_prologue PARAMS ((int)); #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 0xc3) -/* Return 1 if P points to an invalid floating point value. - LEN is the length in bytes -- not relevant on the 386. */ - -#define INVALID_FLOAT(p, len) (0) - /* Say how long (ordinary) registers are. This is a piece of bogosity used in push_word and a few other places; REGISTER_RAW_SIZE is the real way to know how big a register is. */ diff --git a/gdb/config/i960/tm-i960.h b/gdb/config/i960/tm-i960.h index f13795ece07..61ce5d7b879 100644 --- a/gdb/config/i960/tm-i960.h +++ b/gdb/config/i960/tm-i960.h @@ -68,11 +68,6 @@ extern CORE_ADDR saved_pc_after_call (); #define ABOUT_TO_RETURN(ip) (read_memory_integer(ip,4) == 0x0a000000) -/* Return 1 if P points to an invalid floating point value. - LEN is the length in bytes. */ - -#define INVALID_FLOAT(p, len) (0) - /* Say how long (ordinary) registers are. This is a piece of bogosity used in push_word and a few other places; REGISTER_RAW_SIZE is the real way to know how big a register is. */ diff --git a/gdb/config/m68k/tm-m68k.h b/gdb/config/m68k/tm-m68k.h index f95a5323fab..164ae959bac 100644 --- a/gdb/config/m68k/tm-m68k.h +++ b/gdb/config/m68k/tm-m68k.h @@ -91,10 +91,6 @@ extern CORE_ADDR m68k_saved_pc_after_call PARAMS ((struct frame_info *)); #define ABOUT_TO_RETURN(pc) ((read_memory_integer (pc, 2) & ~0x3) == 0x4e74) -/* Return 1 if P points to an invalid floating point value. */ - -#define INVALID_FLOAT(p, len) 0 /* Just a first guess; not checked */ - /* Say how long (ordinary) registers are. This is a piece of bogosity used in push_word and a few other places; REGISTER_RAW_SIZE is the real way to know how big a register is. */ diff --git a/gdb/config/m88k/tm-m88k.h b/gdb/config/m88k/tm-m88k.h index fbe26a52106..427bdbf2fc1 100644 --- a/gdb/config/m88k/tm-m88k.h +++ b/gdb/config/m88k/tm-m88k.h @@ -96,10 +96,6 @@ extern CORE_ADDR skip_prologue (); #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 2) == 0xF800) -/* This is taken care of in print_floating [IEEE_FLOAT]. */ - -#define INVALID_FLOAT(p,len) 0 - /* Say how long (ordinary) registers are. This is a piece of bogosity used in push_word and a few other places; REGISTER_RAW_SIZE is the real way to know how big a register is. */ diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index fa214b478ae..3deb7b6ae2f 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -83,10 +83,6 @@ extern int in_sigtramp PARAMS ((CORE_ADDR, char *)); #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 4) == 0x3e00008) -/* This is taken care of in print_floating [IEEE_FLOAT]. */ - -#define INVALID_FLOAT(p,l) 0 - /* Say how long (ordinary) registers are. This is a piece of bogosity used in push_word and a few other places; REGISTER_RAW_SIZE is the real way to know how big a register is. */ diff --git a/gdb/config/ns32k/tm-merlin.h b/gdb/config/ns32k/tm-merlin.h index ec3505cec58..6603c2203df 100644 --- a/gdb/config/ns32k/tm-merlin.h +++ b/gdb/config/ns32k/tm-merlin.h @@ -66,10 +66,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 0x12) -/* Return 1 if P points to an invalid floating point value. */ - -#define INVALID_FLOAT(p, len) 0 - /* Define this to say that the "svc" insn is followed by codes in memory saying which kind of system call it is. */ diff --git a/gdb/config/ns32k/tm-nbsd.h b/gdb/config/ns32k/tm-nbsd.h index 871a1538a4e..23d74599cc6 100644 --- a/gdb/config/ns32k/tm-nbsd.h +++ b/gdb/config/ns32k/tm-nbsd.h @@ -21,8 +21,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define START_INFERIOR_TRAPS_EXPECTED 2 /* Most definitions from umax could be used. */ -#define INVALID_FLOAT(p, s) isa_NAN(p, s) + #include "ns32k/tm-umax.h" + +/* Generic NetBSD definitions. */ + #include "tm-nbsd.h" /* Saved Pc. Get it from sigcontext if within sigtramp. */ diff --git a/gdb/config/ns32k/tm-ns32km3.h b/gdb/config/ns32k/tm-ns32km3.h index 6cf61618a2c..7928d0be2af 100644 --- a/gdb/config/ns32k/tm-ns32km3.h +++ b/gdb/config/ns32k/tm-ns32km3.h @@ -43,8 +43,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* we can do it */ #define ATTACH_DETACH 1 -#define INVALID_FLOAT(p, s) isa_NAN(p, s) - /* Address of end of stack space. * for MACH, see */ diff --git a/gdb/config/ns32k/tm-umax.h b/gdb/config/ns32k/tm-umax.h index 7847041d1a8..a515d398cc2 100644 --- a/gdb/config/ns32k/tm-umax.h +++ b/gdb/config/ns32k/tm-umax.h @@ -74,6 +74,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 0x12) +#if 0 /* Disable until fixed *correctly*. */ #ifndef INVALID_FLOAT #ifndef NaN #include @@ -86,6 +87,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ NaF (*(float *) p) : \ NaD (*(double *) p)) #endif /* INVALID_FLOAT */ +#endif /* Say how long (ordinary) registers are. This is a piece of bogosity used in push_word and a few other places; REGISTER_RAW_SIZE is the diff --git a/gdb/config/sh/tm-sh.h b/gdb/config/sh/tm-sh.h index 4dbe79e7f37..83152eb8f87 100644 --- a/gdb/config/sh/tm-sh.h +++ b/gdb/config/sh/tm-sh.h @@ -70,10 +70,6 @@ extern CORE_ADDR sh_skip_prologue (); /* Nonzero if instruction at PC is a return instruction. */ #define ABOUT_TO_RETURN(pc) (read_memory_integer(pc,2) == 0x000b) -/* Return 1 if P points to an invalid floating point value. */ - -#define INVALID_FLOAT(p, len) 0 /* Just a first guess; not checked */ - /* Say how long registers are. */ #define REGISTER_TYPE long diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index 94e40317f20..804aba10845 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -126,10 +126,6 @@ extern CORE_ADDR sparc_pc_adjust(); #define ABOUT_TO_RETURN(pc) \ ((read_memory_integer (pc, 4)|0x00040000) == 0x81c7e008) -/* Return 1 if P points to an invalid floating point value. */ - -#define INVALID_FLOAT(p, len) 0 /* Just a first guess; not checked */ - /* Say how long (ordinary) registers are. This is a piece of bogosity used in push_word and a few other places; REGISTER_RAW_SIZE is the real way to know how big a register is. */ diff --git a/gdb/config/z8k/tm-z8k.h b/gdb/config/z8k/tm-z8k.h index cf6c86af1b6..bd396526eb3 100644 --- a/gdb/config/z8k/tm-z8k.h +++ b/gdb/config/z8k/tm-z8k.h @@ -70,10 +70,6 @@ extern CORE_ADDR mz8k_skip_prologue PARAMS ((CORE_ADDR ip)); #define ABOUT_TO_RETURN(pc) about_to_return(pc) -/* Return 1 if P points to an invalid floating point value. */ - -#define INVALID_FLOAT(p, len) 0 /* Just a first guess; not checked */ - /* Say how long registers are. */ #define REGISTER_TYPE unsigned int diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index faaeb6e1929..f2cc19abf8c 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -328,7 +328,7 @@ heuristic_proc_desc(start_pc, limit_pc, next_frame) CORE_ADDR start_pc, limit_pc; FRAME next_frame; { - CORE_ADDR sp = next_frame ? next_frame->frame : read_register (SP_REGNUM); + CORE_ADDR sp = read_next_frame_reg (next_frame, SP_REGNUM); CORE_ADDR cur_pc; int frame_size; int has_frame_reg = 0; @@ -578,7 +578,7 @@ setup_arbitrary_frame (argc, argv) CORE_ADDR mips_push_arguments(nargs, args, sp, struct_return, struct_addr) int nargs; - value *args; + value_ptr *args; CORE_ADDR sp; int struct_return; CORE_ADDR struct_addr; @@ -592,8 +592,7 @@ mips_push_arguments(nargs, args, sp, struct_return, struct_addr) int fake_args = 0; for (i = 0, m_arg = mips_args; i < nargs; i++, m_arg++) { - extern value value_arg_coerce(); - value arg = value_arg_coerce (args[i]); + value_ptr arg = value_arg_coerce (args[i]); m_arg->len = TYPE_LENGTH (VALUE_TYPE (arg)); /* This entire mips-specific routine is because doubles must be aligned * on 8-byte boundaries. It still isn't quite right, because MIPS decided @@ -861,20 +860,13 @@ mips_print_register (regnum, all) printf_filtered (": "); /* If virtual format is floating, print it that way. */ - if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT - && ! INVALID_FLOAT (raw_buffer, REGISTER_VIRTUAL_SIZE(regnum))) { + if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT) val_print (REGISTER_VIRTUAL_TYPE (regnum), raw_buffer, 0, gdb_stdout, 0, 1, 0, Val_pretty_default); - } /* Else print as integer in hex. */ else - { - print_scalar_formatted (raw_buffer, - REGISTER_VIRTUAL_TYPE (regnum), - 'x', - 0, - gdb_stdout); - } + print_scalar_formatted (raw_buffer, REGISTER_VIRTUAL_TYPE (regnum), + 'x', 0, gdb_stdout); } /* Replacement for generic do_registers_info. */ @@ -966,6 +958,7 @@ mips_skip_prologue (pc, lenient) unsigned long inst; int offset; int seen_sp_adjust = 0; + int load_immediate_bytes = 0; /* Skip the typical prologue instructions. These are the stack adjustment instruction and the instructions that save registers on the stack @@ -987,6 +980,9 @@ mips_skip_prologue (pc, lenient) if ((inst & 0xffff0000) == 0x27bd0000) /* addiu $sp,$sp,offset */ seen_sp_adjust = 1; + else if (inst == 0x03a1e823 || /* subu $sp,$sp,$at */ + inst == 0x03a8e823) /* subu $sp,$sp,$t0 */ + seen_sp_adjust = 1; else if ((inst & 0xFFE00000) == 0xAFA00000 && (inst & 0x001F0000)) continue; /* sw reg,n($sp) */ /* reg != $zero */ @@ -1006,39 +1002,40 @@ mips_skip_prologue (pc, lenient) else if (inst == 0x0399e021 /* addu $gp,$gp,$t9 */ || inst == 0x033ce021) /* addu $gp,$t9,$gp */ continue; + /* The following instructions load $at or $t0 with an immediate + value in preparation for a stack adjustment via + subu $sp,$sp,[$at,$t0]. These instructions could also initialize + a local variable, so we accept them only before a stack adjustment + instruction was seen. */ + else if (!seen_sp_adjust) + { + if ((inst & 0xffff0000) == 0x3c010000 || /* lui $at,n */ + (inst & 0xffff0000) == 0x3c080000) /* lui $t0,n */ + { + load_immediate_bytes += 4; + continue; + } + else if ((inst & 0xffff0000) == 0x34210000 || /* ori $at,$at,n */ + (inst & 0xffff0000) == 0x35080000 || /* ori $t0,$t0,n */ + (inst & 0xffff0000) == 0x34010000 || /* ori $at,$zero,n */ + (inst & 0xffff0000) == 0x34080000) /* ori $t0,$zero,n */ + { + load_immediate_bytes += 4; + continue; + } + else + break; + } else - break; + break; } - return pc + offset; -/* FIXME schauer. The following code seems no longer necessary if we - always skip the typical prologue instructions. */ - -#if 0 - if (seen_sp_adjust) - return pc + offset; - - /* Well, it looks like a frameless. Let's make sure. - Note that we are not called on the current PC, - but on the function`s start PC, and I have definitely - seen optimized code that adjusts the SP quite later */ - b = block_for_pc(pc); - if (!b) return pc; - - f = lookup_symbol(MIPS_EFI_SYMBOL_NAME, b, LABEL_NAMESPACE, 0, NULL); - if (!f) return pc; - /* Ideally, I would like to use the adjusted info - from mips_frame_info(), but for all practical - purposes it will not matter (and it would require - a different definition of SKIP_PROLOGUE()) - - Actually, it would not hurt to skip the storing - of arguments on the stack as well. */ - if (((mips_extra_func_info_t)SYMBOL_VALUE(f))->pdr.frameoffset) - return pc + 4; - - return pc; -#endif + /* In a frameless function, we might have incorrectly + skipped some load immediate instructions. Undo the skipping + if the load immediate was not followed by a stack adjustment. */ + if (load_immediate_bytes && !seen_sp_adjust) + offset -= load_immediate_bytes; + return pc + offset; } #if 0 diff --git a/gdb/values.c b/gdb/values.c index 9e8eeb87ff6..81fa4e7fc07 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -675,11 +675,13 @@ unpack_double (type, valaddr, invp) *invp = 0; /* Assume valid. */ if (code == TYPE_CODE_FLT) { +#ifdef INVALID_FLOAT if (INVALID_FLOAT (valaddr, len)) { *invp = 1; return 1.234567891011121314; } +#endif return extract_floating (valaddr, len); } else if (nosign)