This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch/rfc] Eliminate dummy frames before/after text end
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 19 Jan 2003 23:53:49 -0500
- Subject: [patch/rfc] Eliminate dummy frames before/after text end
Bit like tugging at a loose thread. Started out by deleting the
deprecated function with the smallest count only I found that all the
attached broke off!
I'll commit in a few days once the rebuilding has finished.
Andrew
2003-01-19 Andrew Cagney <ac131313@redhat.com>
* 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.
Index: blockframe.c
===================================================================
RCS file: /cvs/src/src/gdb/blockframe.c,v
retrieving revision 1.60
diff -u -r1.60 blockframe.c
--- blockframe.c 5 Jan 2003 01:39:54 -0000 1.60
+++ blockframe.c 20 Jan 2003 04:31:40 -0000
@@ -611,24 +611,6 @@
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
Index: exec.c
===================================================================
RCS file: /cvs/src/src/gdb/exec.c,v
retrieving revision 1.27
diff -u -r1.27 exec.c
--- exec.c 18 Jan 2003 15:55:52 -0000 1.27
+++ exec.c 20 Jan 2003 04:31:49 -0000
@@ -90,7 +90,6 @@
#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 @@
/* 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)
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.179
diff -u -r1.179 gdbarch.c
--- gdbarch.c 19 Jan 2003 23:27:27 -0000 1.179
+++ gdbarch.c 20 Jan 2003 04:32:18 -0000
@@ -986,7 +986,7 @@
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);
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.191
diff -u -r1.191 gdbarch.sh
--- gdbarch.sh 19 Jan 2003 23:27:28 -0000 1.191
+++ gdbarch.sh 20 Jan 2003 04:32:45 -0000
@@ -502,7 +502,7 @@
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
Index: inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.41
diff -u -r1.41 inferior.h
--- inferior.h 14 Jan 2003 00:49:04 -0000 1.41
+++ inferior.h 20 Jan 2003 04:32:54 -0000
@@ -418,8 +418,6 @@
/* 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)
@@ -476,24 +474,6 @@
/* 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
Index: sh-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sh-tdep.c,v
retrieving revision 1.93
diff -u -r1.93 sh-tdep.c
--- sh-tdep.c 8 Jan 2003 19:45:23 -0000 1.93
+++ sh-tdep.c 20 Jan 2003 04:34:19 -0000
@@ -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"
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.87
diff -u -r1.87 valops.c
--- valops.c 19 Jan 2003 17:39:16 -0000 1.87
+++ valops.c 20 Jan 2003 04:35:53 -0000
@@ -1398,37 +1398,6 @@
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;