From 73c1f219a3acce0f4763fa968de7e74525b4313d Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Tue, 21 Jan 2003 19:43:48 +0000 Subject: [PATCH] 2003-01-21 Andrew Cagney * exec.c (text_start): Delete global variable. (exec_file_attach): Make text_start local to the function. * inferior.h (BEFORE_TEXT_END, AFTER_TEXT_END): Delete macros. * valops.c (hand_function_call): Delete code that handles BEFORE_TEXT_END and AFTER_TEXT_END. * gdbarch.sh (CALL_DUMMY_LENGTH): Test call_dummy_length instead of CALL_DUMMY_LOCATION. * gdbarch.c: Regenerate. * inferior.h (deprecated_pc_in_call_dummy_before_text_end) (deprecated_pc_in_call_dummy_after_text_end): Delete declaration. * blockframe.c (deprecated_pc_in_call_dummy_before_text_end) (deprecated_pc_in_call_dummy_after_text_end): Delete functions. (text_end): Delete extern declaration. --- gdb/ChangeLog | 16 ++++++++++++++++ gdb/blockframe.c | 18 ------------------ gdb/exec.c | 3 +-- gdb/gdbarch.c | 2 +- gdb/gdbarch.sh | 2 +- gdb/inferior.h | 20 -------------------- gdb/sh-tdep.c | 2 +- gdb/valops.c | 31 ------------------------------- 8 files changed, 20 insertions(+), 74 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f2df4caa3f..33b9a09bcd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,19 @@ +2003-01-21 Andrew Cagney + + * exec.c (text_start): Delete global variable. + (exec_file_attach): Make text_start local to the function. + * inferior.h (BEFORE_TEXT_END, AFTER_TEXT_END): Delete macros. + * valops.c (hand_function_call): Delete code that handles + BEFORE_TEXT_END and AFTER_TEXT_END. + * gdbarch.sh (CALL_DUMMY_LENGTH): Test call_dummy_length instead + of CALL_DUMMY_LOCATION. + * gdbarch.c: Regenerate. + * inferior.h (deprecated_pc_in_call_dummy_before_text_end) + (deprecated_pc_in_call_dummy_after_text_end): Delete declaration. + * blockframe.c (deprecated_pc_in_call_dummy_before_text_end) + (deprecated_pc_in_call_dummy_after_text_end): Delete functions. + (text_end): Delete extern declaration. + 2003-01-21 Andrew Cagney * frame.h (FRAME_OBSTACK_ZALLOC): Define. diff --git a/gdb/blockframe.c b/gdb/blockframe.c index df94e85913..d5ed002593 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -607,24 +607,6 @@ block_innermost_frame (struct block *block) below is for infrun.c, which may give the macro a pc without that subtracted out. */ -extern CORE_ADDR text_end; - -int -deprecated_pc_in_call_dummy_before_text_end (CORE_ADDR pc, CORE_ADDR sp, - CORE_ADDR frame_address) -{ - return ((pc) >= text_end - CALL_DUMMY_LENGTH - && (pc) <= text_end + DECR_PC_AFTER_BREAK); -} - -int -deprecated_pc_in_call_dummy_after_text_end (CORE_ADDR pc, CORE_ADDR sp, - CORE_ADDR frame_address) -{ - return ((pc) >= text_end - && (pc) <= text_end + CALL_DUMMY_LENGTH + DECR_PC_AFTER_BREAK); -} - /* Is the PC in a call dummy? SP and FRAME_ADDRESS are the bottom and top of the stack frame which we are checking, where "bottom" and "top" refer to some section of memory which contains the code for diff --git a/gdb/exec.c b/gdb/exec.c index 036df003bf..0bde096c7c 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -90,7 +90,6 @@ int write_files = 0; #ifndef NEED_TEXT_START_END #define NEED_TEXT_START_END (0) #endif -CORE_ADDR text_start = 0; CORE_ADDR text_end = 0; struct vmap *vmap; @@ -279,7 +278,7 @@ exec_file_attach (char *filename, int from_tty) /* FIXME: The comment above does not match the code. The code checks for sections with are either code *or* readonly. */ - text_start = ~(CORE_ADDR) 0; + CORE_ADDR text_start = ~(CORE_ADDR) 0; text_end = (CORE_ADDR) 0; for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++) if (bfd_get_section_flags (p->bfd, p->the_bfd_section) diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index bd19793ff1..81efdad4d1 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -986,7 +986,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: CALL_DUMMY_LENGTH # %s\n", XSTRING (CALL_DUMMY_LENGTH)); - if (CALL_DUMMY_LOCATION == BEFORE_TEXT_END || CALL_DUMMY_LOCATION == AFTER_TEXT_END) + if (gdbarch->call_dummy_length >= 0) fprintf_unfiltered (file, "gdbarch_dump: CALL_DUMMY_LENGTH = %d\n", CALL_DUMMY_LENGTH); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index fd9ddd5260..87cc01f712 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -502,7 +502,7 @@ f:2:CALL_DUMMY_ADDRESS:CORE_ADDR:call_dummy_address:void:::0:0::gdbarch->call_du v:2:CALL_DUMMY_START_OFFSET:CORE_ADDR:call_dummy_start_offset::::0:-1:::0x%08lx v:2:CALL_DUMMY_BREAKPOINT_OFFSET:CORE_ADDR:call_dummy_breakpoint_offset::::0:-1::gdbarch->call_dummy_breakpoint_offset_p && gdbarch->call_dummy_breakpoint_offset == -1:0x%08lx::CALL_DUMMY_BREAKPOINT_OFFSET_P v:1:CALL_DUMMY_BREAKPOINT_OFFSET_P:int:call_dummy_breakpoint_offset_p::::0:-1 -v:2:CALL_DUMMY_LENGTH:int:call_dummy_length::::0:-1:::::CALL_DUMMY_LOCATION == BEFORE_TEXT_END || CALL_DUMMY_LOCATION == AFTER_TEXT_END +v:2:CALL_DUMMY_LENGTH:int:call_dummy_length::::0:-1:::::gdbarch->call_dummy_length >= 0 # NOTE: cagney/2002-11-24: This function with predicate has a valid # (callable) initial value. As a consequence, even when the predicate # is false, the corresponding function works. This simplifies the diff --git a/gdb/inferior.h b/gdb/inferior.h index 67c1170054..4616a1f3da 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -418,8 +418,6 @@ extern int attach_flag; /* Possible values for CALL_DUMMY_LOCATION. */ #define ON_STACK 1 -#define BEFORE_TEXT_END 2 -#define AFTER_TEXT_END 3 #define AT_ENTRY_POINT 4 #if !defined (CALL_DUMMY_ADDRESS) @@ -477,24 +475,6 @@ extern int attach_flag; /* Are we in a call dummy? */ -/* NOTE: cagney/2002-11-24: Targets need to both switch to generic - dummy frames, and use generic_pc_in_call_dummy(). The generic - version should be able to handle all cases since that code works by - saving the address of the dummy's breakpoint (where ever it is). */ - -extern int deprecated_pc_in_call_dummy_before_text_end (CORE_ADDR pc, - CORE_ADDR sp, - CORE_ADDR frame_address); - -/* NOTE: cagney/2002-11-24: Targets need to both switch to generic - dummy frames, and use generic_pc_in_call_dummy(). The generic - version should be able to handle all cases since that code works by - saving the address of the dummy's breakpoint (where ever it is). */ - -extern int deprecated_pc_in_call_dummy_after_text_end (CORE_ADDR pc, - CORE_ADDR sp, - CORE_ADDR frame_address); - /* NOTE: cagney/2002-11-24: Targets need to both switch to generic dummy frames, and use generic_pc_in_call_dummy(). The generic version should be able to handle all cases since that code works by diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 08281badd0..fc1049b025 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -33,7 +33,7 @@ #include "gdbcore.h" #include "value.h" #include "dis-asm.h" -#include "inferior.h" /* for BEFORE_TEXT_END etc. */ +#include "inferior.h" #include "gdb_string.h" #include "arch-utils.h" #include "floatformat.h" diff --git a/gdb/valops.c b/gdb/valops.c index d1a18774f9..c4876346ae 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1398,37 +1398,6 @@ hand_function_call (struct value *function, int nargs, struct value **args) generic_save_call_dummy_addr (start_sp, start_sp + sizeof_dummy1); } - if (CALL_DUMMY_LOCATION == BEFORE_TEXT_END) - { - /* Convex Unix prohibits executing in the stack segment. */ - /* Hope there is empty room at the top of the text segment. */ - extern CORE_ADDR text_end; - static int checked = 0; - if (!checked) - for (start_sp = text_end - sizeof_dummy1; start_sp < text_end; ++start_sp) - if (read_memory_integer (start_sp, 1) != 0) - error ("text segment full -- no place to put call"); - checked = 1; - sp = old_sp; - real_pc = text_end - sizeof_dummy1; - write_memory (real_pc, (char *) dummy1, sizeof_dummy1); - if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) - generic_save_call_dummy_addr (real_pc, real_pc + sizeof_dummy1); - } - - if (CALL_DUMMY_LOCATION == AFTER_TEXT_END) - { - extern CORE_ADDR text_end; - int errcode; - sp = old_sp; - real_pc = text_end; - errcode = target_write_memory (real_pc, (char *) dummy1, sizeof_dummy1); - if (errcode != 0) - error ("Cannot write text segment -- call_function failed"); - if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) - generic_save_call_dummy_addr (real_pc, real_pc + sizeof_dummy1); - } - if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT) { real_pc = funaddr;