From: Andrew Cagney Date: Thu, 26 Nov 1998 11:13:01 +0000 (+0000) Subject: CARP: Delete ABOUT_TO_RETURN across all targets. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=679ce7310245be5d095510574825f4616f6075d8;p=binutils-gdb.git CARP: Delete ABOUT_TO_RETURN across all targets. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 98f321a33ac..82f0a23be7e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,27 @@ +Thu Nov 26 11:19:15 1998 Andrew Cagney + + * config/alpha/tm-alpha.h (ABOUT_TO_RETURN): Replace macro. + * alpha-tdep.c (alpha_about_to_return): With new function. + (heuristic_proc_start): Update. + * config/mips/tm-mips.h (ABOUT_TO_RETURN), mips-tdep.c + (heuristic_proc_start, mips_about_to_return): Ditto. + * config/ns32k/tm-merlin.h (ABOUT_TO_RETURN), + config/ns32k/tm-umax.h (ABOUT_TO_RETURN), ns32k-tdep.c + (ns32k_about_to_return, ns32k_get_enter_addr): Ditto. + + * config/z8k/tm-z8k.h, config/w65/tm-w65.h, config/vax/tm-vax.h, + config/tahoe/tm-tahoe.h, config/sparc/tm-sparc.h, + config/sh/tm-sh.h, config/rs6000/tm-rs6000.h, config/pyr/tm-pyr.h, + config/pa/tm-hppa.h, config/m88k/tm-m88k.h, config/m68k/tm-m68k.h, + config/i960/tm-i960.h, config/i386/tm-i386.h, + config/h8500/tm-h8500.h, config/h8300/tm-h8300.h, + config/gould/tm-pn.h, config/gould/tm-np1.h, + config/convex/tm-convex.h, config/arm/tm-arm.h, + config/arc/tm-arc.h, config/a29k/tm-a29k.h: Delete macro + ABOUT_TO_RETURN. + * config/w65/tm-w65.h (RTL, RTS): Delete macros. + * h8500-tdep.c (about_to_return): Delete function. + Thu Nov 26 11:19:15 1998 Andrew Cagney * rs6000-tdep.c (rs6000_breakpoint_from_pc): Change big_breakpoint @@ -36,8 +60,12 @@ Wed Nov 25 00:13:06 1998 Andrew Cagney Wed Nov 25 20:37:00 1998 Andrew Cagney + * rs6000-tdep.c (rs6000_breakpoint_from_pc): Change big_breakpoint + and little_breakpoint to char[] from char*. * mem-break.c (memory_insert_breakpoint, memory_remove_breakpoint): Pass address of bplen. + * remote-array.c (array_insert_breakpoint): Change bp_addr to + CORE_ADDR type. start-sanitize-vr4xxx 1998-11-24 Gavin Romig-Koch diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index d64ab49bf6c..2382be14534 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -399,6 +399,18 @@ alpha_saved_pc_after_call (frame) static struct alpha_extra_func_info temp_proc_desc; static struct frame_saved_regs temp_saved_regs; +/* Nonzero if instruction at PC is a return instruction. "ret + $zero,($ra),1" on alpha. */ + +static int +alpha_about_to_return (pc) + CORE_ADDR pc; +{ + return read_memory_integer (pc, 4) == 0x6bfa8001; +} + + + /* This fencepost looks highly suspicious to me. Removing it also seems suspicious as it could affect remote debugging across serial lines. */ @@ -449,8 +461,8 @@ Otherwise, you told GDB there was a function where there isn't one, or\n\ return 0; } - else if (ABOUT_TO_RETURN(start_pc)) - break; + else if (alpha_about_to_return (start_pc)) + break; start_pc += 4; /* skip return */ return start_pc; diff --git a/gdb/config/a29k/tm-a29k.h b/gdb/config/a29k/tm-a29k.h index f999134359b..66f54bfb6a0 100644 --- a/gdb/config/a29k/tm-a29k.h +++ b/gdb/config/a29k/tm-a29k.h @@ -84,12 +84,6 @@ CORE_ADDR skip_prologue (); #define DECR_PC_AFTER_BREAK 0 -/* Nonzero if instruction at PC is a return instruction. - On the a29k, this is a "jmpi l0" instruction. */ - -#define ABOUT_TO_RETURN(pc) \ - ((read_memory_integer (pc, 4) & 0xff0000ff) == 0xc0000080) - /* 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/alpha/tm-alpha.h b/gdb/config/alpha/tm-alpha.h index 7cb21a460dd..8aaefb43d59 100644 --- a/gdb/config/alpha/tm-alpha.h +++ b/gdb/config/alpha/tm-alpha.h @@ -25,6 +25,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "coff/sym.h" /* Needed for PDR below. */ #include "coff/symconst.h" +#ifdef __STDC__ +struct frame_info; +struct type; +struct value; +struct symbol; +#endif + #if !defined (TARGET_BYTE_ORDER) #define TARGET_BYTE_ORDER LITTLE_ENDIAN #endif @@ -61,9 +68,6 @@ extern CORE_ADDR alpha_skip_prologue PARAMS ((CORE_ADDR addr, int lenient)); some instructions. */ #define SAVED_PC_AFTER_CALL(frame) alpha_saved_pc_after_call(frame) -#ifdef __STDC__ -struct frame_info; -#endif extern CORE_ADDR alpha_saved_pc_after_call PARAMS ((struct frame_info *)); @@ -85,11 +89,6 @@ alpha_saved_pc_after_call PARAMS ((struct frame_info *)); #define DECR_PC_AFTER_BREAK 4 #endif -/* Nonzero if instruction at PC is a return instruction. - "ret $zero,($ra),1" on alpha. */ - -#define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 4) == 0x6bfa8001) - /* 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. */ @@ -184,9 +183,6 @@ alpha_saved_pc_after_call PARAMS ((struct frame_info *)); #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM, TYPE, FROM, TO) \ alpha_register_convert_to_virtual (REGNUM, TYPE, FROM, TO) -#ifdef __STDC__ -struct type; -#endif extern void alpha_register_convert_to_virtual PARAMS ((int, struct type *, char *, char *)); @@ -316,10 +312,7 @@ extern void alpha_find_saved_regs PARAMS ((struct frame_info *)); /* Things needed for making the inferior call functions. */ #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ - sp = alpha_push_arguments(nargs, args, sp, struct_return, struct_addr) -#ifdef __STDC__ -struct value; -#endif + sp = alpha_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)) extern CORE_ADDR alpha_push_arguments PARAMS ((int, struct value **, CORE_ADDR, int, CORE_ADDR)); @@ -384,6 +377,7 @@ extern CORE_ADDR alpha_call_dummy_address PARAMS ((void)); alpha_extra_func_info_t's off of this. */ #define MIPS_EFI_SYMBOL_NAME "__GDB_EFI_INFO__" +extern void ecoff_relocate_efi PARAMS ((struct symbol *, CORE_ADDR)); /* Specific information about a procedure. This overlays the ALPHA's PDR records, diff --git a/gdb/config/arc/tm-arc.h b/gdb/config/arc/tm-arc.h index e4b693b3e24..aebdc583bb1 100644 --- a/gdb/config/arc/tm-arc.h +++ b/gdb/config/arc/tm-arc.h @@ -83,13 +83,6 @@ extern CORE_ADDR skip_prologue PARAMS ((CORE_ADDR, int)); #define INNER_THAN < -/* Nonzero if instruction at pc is a return instruction. - This is the "j [blink]" insn (with or without conditionals or delay - slots). */ - -#define ABOUT_TO_RETURN(pc) \ - ((read_memory_integer(pc, 4) & 0xffffff80) == 0x380f8000) - /* 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/arm/tm-arm.h b/gdb/config/arm/tm-arm.h index 202a815c05b..907773faa7c 100644 --- a/gdb/config/arm/tm-arm.h +++ b/gdb/config/arm/tm-arm.h @@ -79,23 +79,11 @@ extern CORE_ADDR arm_saved_pc_after_call PARAMS ((struct frame_info *)); #define INNER_THAN < -/* Sequence of bytes for breakpoint instruction. */ - /* !!!! if we're using RDP, then we're inserting breakpoints and storing their handles instread of what was in memory. It is nice that this is the same size as a handle - otherwise remote-rdp will have to change. */ -#define ARM_LE_BREAKPOINT {0x00,0x00,0x18,0xef} /* BKPT_SWI from */ -#define ARM_BE_BREAKPOINT {0xef,0x18,0x00,0x00} /* BKPT_SWI from */ -#define THUMB_LE_BREAKPOINT {0x18,0xdf} /* swi 24 */ -#define THUMB_BE_BREAKPOINT {0xdf,0x18} /* swi 24 */ - -/* The following has been superseded by BREAKPOINT_FOR_PC, but - is defined merely to keep mem-break.c happy. */ -#define LITTLE_BREAKPOINT ARM_LE_BREAKPOINT -#define BIG_BREAKPOINT ARM_BE_BREAKPOINT - /* BREAKPOINT_FROM_PC uses the program counter value to determine whether a 16- or 32-bit breakpoint should be used. It returns a pointer to a string of bytes that encode a breakpoint instruction, stores @@ -103,7 +91,7 @@ extern CORE_ADDR arm_saved_pc_after_call PARAMS ((struct frame_info *)); point to the actual memory location where the breakpoint should be inserted. */ -unsigned char * arm_breakpoint_from_pc PARAMS ((CORE_ADDR * pcptr, int * lenptr)); +extern breakpoint_from_pc_fn arm_breakpoint_from_pc; #define BREAKPOINT_FROM_PC(pcptr, lenptr) arm_breakpoint_from_pc (pcptr, lenptr) /* Amount PC must be decremented by after a breakpoint. @@ -112,12 +100,6 @@ unsigned char * arm_breakpoint_from_pc PARAMS ((CORE_ADDR * pcptr, int * lenptr) #define DECR_PC_AFTER_BREAK 0 -/* Nonzero if instruction at PC is a return instruction. */ - -#define ABOUT_TO_RETURN(pc) \ - ((read_memory_integer(pc, 4) & 0x0fffffff == 0x01b0f00e) || \ - (read_memory_integer(pc, 4) & 0x0ffff800 == 0x09eba800)) - /* code to execute to print interesting information about the * floating point processor (if any) * No need to define if there is nothing to do. diff --git a/gdb/config/h8300/tm-h8300.h b/gdb/config/h8300/tm-h8300.h index 13dd04507bd..dac5acbad71 100644 --- a/gdb/config/h8300/tm-h8300.h +++ b/gdb/config/h8300/tm-h8300.h @@ -92,12 +92,6 @@ extern CORE_ADDR h8300_skip_prologue (); #define DECR_PC_AFTER_BREAK 0 -/* Nonzero if instruction at PC is a return instruction. */ -/* Allow any of the return instructions, including a trapv and a return - from interupt. */ - -#define ABOUT_TO_RETURN(pc) ((read_memory_unsigned_integer (pc, 2) & ~0x3) == 0x4e74) - /* 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 6e76e65a15e..51b2d4cbb63 100644 --- a/gdb/config/h8500/tm-h8500.h +++ b/gdb/config/h8500/tm-h8500.h @@ -68,12 +68,6 @@ extern CORE_ADDR saved_pc_after_call PARAMS ((void)); #define DECR_PC_AFTER_BREAK 0 -#if 0 /* never used */ -/* Nonzero if instruction at PC is a return instruction. */ - -#define ABOUT_TO_RETURN(pc) about_to_return(pc) -#endif - /* Say how long registers are. */ #define REGISTER_TYPE unsigned long diff --git a/gdb/config/i386/tm-i386.h b/gdb/config/i386/tm-i386.h index 0bf3109cdab..7e92ac16a10 100644 --- a/gdb/config/i386/tm-i386.h +++ b/gdb/config/i386/tm-i386.h @@ -70,10 +70,6 @@ extern int i386_skip_prologue PARAMS ((int)); #define DECR_PC_AFTER_BREAK 1 -/* Nonzero if instruction at PC is a return instruction. */ - -#define ABOUT_TO_RETURN(pc) (read_memory_integer ((pc), 1) == 0xc3) - /* 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 11ae4a4c107..c80f7f3737e 100644 --- a/gdb/config/i960/tm-i960.h +++ b/gdb/config/i960/tm-i960.h @@ -64,10 +64,6 @@ extern CORE_ADDR saved_pc_after_call (); #define INNER_THAN > -/* Nonzero if instruction at ip is a return instruction. */ - -#define ABOUT_TO_RETURN(ip) (read_memory_integer(ip,4) == 0x0a000000) - /* 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 1e7e8e21a50..74d4eea0b35 100644 --- a/gdb/config/m68k/tm-m68k.h +++ b/gdb/config/m68k/tm-m68k.h @@ -91,12 +91,6 @@ extern void m68k_find_saved_regs PARAMS ((struct frame_info *, struct frame_save #define DECR_PC_AFTER_BREAK 2 #endif -/* Nonzero if instruction at PC is a return instruction. */ -/* Allow any of the return instructions, including a trapv and a return - from interupt. */ - -#define ABOUT_TO_RETURN(pc) ((read_memory_integer (pc, 2) & ~0x3) == 0x4e74) - /* 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 3c0acd94e46..b6776dc3398 100644 --- a/gdb/config/m88k/tm-m88k.h +++ b/gdb/config/m88k/tm-m88k.h @@ -91,11 +91,6 @@ extern CORE_ADDR skip_prologue (); #define DECR_PC_AFTER_BREAK 0 -/* Nonzero if instruction at PC is a return instruction. */ -/* 'jmp r1' or 'jmp.n r1' is used to return from a subroutine. */ - -#define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 2) == 0xF800) - /* 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 922d218da28..5ca8fa48b1b 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -139,11 +139,6 @@ extern breakpoint_from_pc_fn mips_breakpoint_from_pc; #define DECR_PC_AFTER_BREAK 0 -/* Nonzero if instruction at PC is a return instruction. "j ra" on mips. */ - -int mips_about_to_return PARAMS ((CORE_ADDR pc)); -#define ABOUT_TO_RETURN(pc) mips_about_to_return (pc) - /* 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 f951c281f74..4c9cedfb7cf 100644 --- a/gdb/config/ns32k/tm-merlin.h +++ b/gdb/config/ns32k/tm-merlin.h @@ -62,10 +62,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define DECR_PC_AFTER_BREAK 0 -/* Nonzero if instruction at PC is a return instruction. */ - -#define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 0x12) - /* 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-umax.h b/gdb/config/ns32k/tm-umax.h index e7860a9c050..fdb3cfe4fba 100644 --- a/gdb/config/ns32k/tm-umax.h +++ b/gdb/config/ns32k/tm-umax.h @@ -70,10 +70,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define DECR_PC_AFTER_BREAK 0 -/* Nonzero if instruction at PC is a return instruction. */ - -#define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 0x12) - #if 0 /* Disable until fixed *correctly*. */ #ifndef INVALID_FLOAT #ifndef NaN diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h index 1e8872205c2..5c4566e7b94 100644 --- a/gdb/config/pa/tm-hppa.h +++ b/gdb/config/pa/tm-hppa.h @@ -63,7 +63,8 @@ struct inferior_status; #define REG_STRUCT_HAS_ADDR(gcc_p,type) \ (TYPE_LENGTH (type) > 8) -#define USE_STRUCT_CONVENTION(gcc_p,type) (TYPE_LENGTH (type) > 8) +extern use_struct_convention_fn hppa_use_struct_convention; +#define USE_STRUCT_CONVENTION(gcc_p,type) hppa_use_struct_convention (gcc_p,type) /* Offset from address of function to start of its code. Zero on most machines. */ @@ -116,10 +117,6 @@ extern CORE_ADDR saved_pc_after_call PARAMS ((struct frame_info *)); #define DECR_PC_AFTER_BREAK 0 -/* return instruction is bv r0(rp) or bv,n r0(rp)*/ - -#define ABOUT_TO_RETURN(pc) ((read_memory_integer (pc, 4) | 0x2) == 0xE840C002) - /* 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. */ @@ -361,7 +358,8 @@ extern int frame_chain_valid PARAMS ((CORE_ADDR, struct frame_info *)); (FRAMELESS) = frameless_function_invocation(FI) extern int frameless_function_invocation PARAMS ((struct frame_info *)); -#define FRAME_SAVED_PC(FRAME) frame_saved_pc (FRAME) +extern CORE_ADDR hppa_frame_saved_pc PARAMS ((struct frame_info *frame)); +#define FRAME_SAVED_PC(FRAME) hppa_frame_saved_pc (FRAME) #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) @@ -535,8 +533,14 @@ extern CORE_ADDR hppa_fix_call_dummy PARAMS ((char *, CORE_ADDR, CORE_ADDR, int, struct value **, struct type *, int)); +/* Stack must be aligned on 32-bit boundaries when synthesizing + function calls. We still need STACK_ALIGN, PUSH_ARGUMENTS does + not do all the work. */ + +#define STACK_ALIGN(ADDR) (((ADDR) + 7) & -8) + #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ - sp = hppa_push_arguments(nargs, args, sp, struct_return, struct_addr) + sp = hppa_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)) extern CORE_ADDR hppa_push_arguments PARAMS ((int, struct value **, CORE_ADDR, int, CORE_ADDR)); @@ -666,5 +670,3 @@ extern int hpread_adjust_stack_address PARAMS ((CORE_ADDR)); probably much more common. (FIXME). */ #define COERCE_FLOAT_TO_DOUBLE (current_language -> la_language == language_c) - -#define STACK_ALIGN(ADDR) (((ADDR) + 7) & -8) diff --git a/gdb/config/rs6000/tm-rs6000.h b/gdb/config/rs6000/tm-rs6000.h index 9891b7f9723..7ae9329eeef 100644 --- a/gdb/config/rs6000/tm-rs6000.h +++ b/gdb/config/rs6000/tm-rs6000.h @@ -1,5 +1,5 @@ /* Parameters for target execution on an RS6000, for GDB, the GNU debugger. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994 + Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. Contributed by IBM Corporation. @@ -151,34 +151,20 @@ extern void aix_process_linenos PARAMS ((void)); #define INNER_THAN < -#if 0 -/* No, we shouldn't use this. push_arguments() should leave stack in a - proper alignment! */ -/* Stack has strict alignment. */ - -#define STACK_ALIGN(ADDR) (((ADDR)+7)&-8) -#endif - -/* This is how argumets pushed onto stack or passed in registers. */ +/* This is how arguments pushed onto stack or passed in registers. + Stack must be aligned on 64-bit boundaries when synthesizing + function calls. We don't need STACK_ALIGN, PUSH_ARGUMENTS will + handle it. */ #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ - sp = push_arguments(nargs, args, sp, struct_return, struct_addr) + sp = push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)) extern CORE_ADDR push_arguments PARAMS ((int, struct value **, CORE_ADDR, int, CORE_ADDR)); -/* Sequence of bytes for breakpoint instruction. */ - -#define BIG_BREAKPOINT { 0x7d, 0x82, 0x10, 0x08 } -#define LITTLE_BREAKPOINT { 0x08, 0x10, 0x82, 0x7d } - -#if TARGET_BYTE_ORDER == BIG_ENDIAN -#define BREAKPOINT BIG_BREAKPOINT - -#else -#if TARGET_BYTE_ORDER == LITTLE_ENDIAN -#define BREAKPOINT LITTLE_BREAKPOINT -#endif -#endif +/* BREAKPOINT_FROM_PC uses the program counter value to determine the + breakpoint that should be used */ +extern breakpoint_from_pc_fn rs6000_breakpoint_from_pc; +#define BREAKPOINT_FROM_PC(pcptr, lenptr) rs6000_breakpoint_from_pc (pcptr, lenptr) /* Amount PC must be decremented by after a breakpoint. This is often the number of bytes in BREAKPOINT @@ -186,13 +172,6 @@ extern CORE_ADDR push_arguments PARAMS ((int, struct value **, CORE_ADDR, #define DECR_PC_AFTER_BREAK 0 -/* Nonzero if instruction at PC is a return instruction. */ -/* Allow any of the return instructions, including a trapv and a return - from interrupt. */ - -#define ABOUT_TO_RETURN(pc) \ - ((read_memory_integer (pc, 4) & 0xfe8007ff) == 0x4e800020) - /* 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. */ @@ -441,6 +420,7 @@ extern int frameless_function_invocation PARAMS((struct frame_info *)); frame. The following constants were determined by experimentation on AIX 3.2. */ #define SIG_FRAME_PC_OFFSET 96 +#define SIG_FRAME_LR_OFFSET 108 #define SIG_FRAME_FP_OFFSET 284 /* Default offset from SP where the LR is stored */ @@ -601,26 +581,42 @@ extern void pop_frame PARAMS ((void)); #define CALL_DUMMY_START_OFFSET 16 -/* Insert the specified number of args and function address - into a call sequence of the above form stored at DUMMYNAME. */ - -#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, using_gcc) \ - fix_call_dummy(dummyname, pc, fun, nargs, (int)type) -extern void fix_call_dummy PARAMS ((char *, CORE_ADDR, CORE_ADDR, int, int)); - -/* Usually a function pointer's representation is simply the address of - the function. On the RS/6000 however, a function pointer is represented - by a pointer to a TOC entry. This TOC entry contains three words, - the first word is the address of the function, the second word is the - TOC pointer (r2), and the third word is the static chain value. - Throughout GDB it is currently assumed that a function pointer contains - the address of the function, which is not easy to fix. - In addition, the conversion of a function address to a function - pointer would require allocation of a TOC entry in the inferior's - memory space, with all its drawbacks. - To be able to call C++ virtual methods in the inferior (which are called - via function pointers), find_function_addr uses this macro to - get the function address from a function pointer. */ +/* Insert the specified number of args and function address into a + call sequence of the above form stored at DUMMYNAME. */ + +#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ + rs6000_fix_call_dummy (dummyname, pc, fun, nargs, args, type, gcc_p) +extern void rs6000_fix_call_dummy PARAMS ((char *, CORE_ADDR, CORE_ADDR, + int, struct value **, + struct type *, int)); + +/* Hook in rs6000-tdep.c for determining the TOC address when + calling functions in the inferior. */ +extern CORE_ADDR (*find_toc_address_hook) PARAMS ((CORE_ADDR)); + +/* xcoffread.c provides a function to determine the TOC offset + for a given object file. + It is used under native AIX configurations for determining the + TOC address when calling functions in the inferior. */ +#ifdef __STDC__ +struct objfile; +#endif +extern CORE_ADDR get_toc_offset PARAMS ((struct objfile *)); + +/* Usually a function pointer's representation is simply the address + of the function. On the RS/6000 however, a function pointer is + represented by a pointer to a TOC entry. This TOC entry contains + three words, the first word is the address of the function, the + second word is the TOC pointer (r2), and the third word is the + static chain value. Throughout GDB it is currently assumed that a + function pointer contains the address of the function, which is not + easy to fix. In addition, the conversion of a function address to + a function pointer would require allocation of a TOC entry in the + inferior's memory space, with all its drawbacks. To be able to + call C++ virtual methods in the inferior (which are called via + function pointers), find_function_addr uses this macro to get the + function address from a function pointer. */ + #define CONVERT_FROM_FUNC_PTR_ADDR(ADDR) \ (is_magic_function_pointer (ADDR) ? read_memory_integer (ADDR, 4) : (ADDR)) extern int is_magic_function_pointer PARAMS ((CORE_ADDR)); diff --git a/gdb/config/sh/tm-sh.h b/gdb/config/sh/tm-sh.h index 82108f3f331..cc39ed3b5a8 100644 --- a/gdb/config/sh/tm-sh.h +++ b/gdb/config/sh/tm-sh.h @@ -74,9 +74,6 @@ extern CORE_ADDR sh_skip_prologue (); define this before including this file. */ #define DECR_PC_AFTER_BREAK 0 -/* Nonzero if instruction at PC is a return instruction. */ -#define ABOUT_TO_RETURN(pc) (read_memory_integer(pc,2) == 0x000b) - /* 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 273a218932b..fc978f74e4a 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -127,14 +127,6 @@ extern CORE_ADDR sparc_pc_adjust PARAMS ((CORE_ADDR)); #define DECR_PC_AFTER_BREAK 0 -/* Nonzero if instruction at PC is a return instruction. */ -/* For SPARC, this is either a "jmpl %o7+8,%g0" or "jmpl %i7+8,%g0". - - Note: this does not work for functions returning structures under SunOS. - v9 does not have such critters though. */ -#define ABOUT_TO_RETURN(pc) \ - ((read_memory_integer (pc, 4)|0x00040000) == 0x81c7e008) - /* 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/vax/tm-vax.h b/gdb/config/vax/tm-vax.h index 7e9774d3c50..c36f527bd3b 100644 --- a/gdb/config/vax/tm-vax.h +++ b/gdb/config/vax/tm-vax.h @@ -80,10 +80,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define DECR_PC_AFTER_BREAK 0 -/* Nonzero if instruction at PC is a return instruction. */ - -#define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 04) - /* Return 1 if P points to an invalid floating point value. LEN is the length in bytes -- not relevant on the Vax. */ diff --git a/gdb/config/w65/tm-w65.h b/gdb/config/w65/tm-w65.h index d63007a8113..458bfabbddf 100644 --- a/gdb/config/w65/tm-w65.h +++ b/gdb/config/w65/tm-w65.h @@ -66,14 +66,6 @@ extern CORE_ADDR w65_skip_prologue (); define this before including this file. */ #define DECR_PC_AFTER_BREAK 0 -/* Nonzero if instruction at PC is a return instruction. */ - -#define ABOUT_TO_RETURN(pc) \ - (read_memory_integer(pc,1) == RTL || read_memory_integer(pc,1) == RTS) - -#define RTL 0x6b -#define RTS 0x60 - /* Return 1 if P points to an invalid floating point value. */ #define INVALID_FLOAT(p, len) 0 /* Just a first guess; not checked */ diff --git a/gdb/config/z8k/tm-z8k.h b/gdb/config/z8k/tm-z8k.h index 0970737f030..3ef38ca6655 100644 --- a/gdb/config/z8k/tm-z8k.h +++ b/gdb/config/z8k/tm-z8k.h @@ -64,12 +64,6 @@ extern CORE_ADDR mz8k_skip_prologue PARAMS ((CORE_ADDR ip)); #define DECR_PC_AFTER_BREAK 0 -/* Nonzero if instruction at PC is a return instruction. */ -/* Allow any of the return instructions, including a trapv and a return - from interupt. */ - -#define ABOUT_TO_RETURN(pc) about_to_return(pc) - /* Say how long registers are. */ #define REGISTER_TYPE unsigned int diff --git a/gdb/h8500-tdep.c b/gdb/h8500-tdep.c index 38a4859d0d3..e66bcc3dbf6 100644 --- a/gdb/h8500-tdep.c +++ b/gdb/h8500-tdep.c @@ -395,38 +395,6 @@ saved_pc_after_call () return x; } -#if 0 /* never called */ -/* Nonzero if instruction at PC is a return instruction. */ - -int -about_to_return (pc) - CORE_ADDR pc; -{ - int b1 = read_memory_integer (pc, 1); - - switch (b1) - { - case 0x14: /* rtd #8 */ - case 0x1c: /* rtd #16 */ - case 0x19: /* rts */ - case 0x1a: /* rte */ - return 1; - case 0x11: - { - int b2 = read_memory_integer (pc + 1, 1); - switch (b2) - { - case 0x18: /* prts */ - case 0x14: /* prtd #8 */ - case 0x16: /* prtd #16 */ - return 1; - } - } - } - return 0; -} -#endif - void h8500_set_pointer_size (newsize) int newsize; diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index 395bf9bb75c..3edb7f5d5d9 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -76,6 +76,17 @@ ns32k_localcount (enter_pc) return localcount; } + +/* Nonzero if instruction at PC is a return instruction. */ + +static int +ns32k_about_to_return (pc) + CORE_ADDR pc; +{ + return (read_memory_integer (pc, 1) == 0x12); +} + + /* * Get the address of the enter opcode for the function * containing PC, if there is an enter for the function, @@ -94,7 +105,7 @@ ns32k_get_enter_addr (pc) if (pc == 0) return 0; - if (ABOUT_TO_RETURN (pc)) + if (ns32k_about_to_return (pc)) return 1; /* after exit */ enter_addr = get_pc_function_start (pc);