This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] Delete WFI's prev_func_start
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sat, 12 Apr 2003 14:26:16 -0400
- Subject: [commit] Delete WFI's prev_func_start
Hello,
Jeff's post on "prev_pc" tipped me off to the following.
While "prev_func_start" is carefully saved and updated, it's value is
never used.
The origin of the variable is unknown, it pre-dates Red Hat's CVS
repository. At the time it was being used but was later disabled with
the comment:
-#if 0
- /* I disabled this test because it was too complicated and slow.
- The SKIP_PROLOGUE was especially slow, because it caused
- unnecessary prologue examination on various architectures.
- The code in the #else clause has been tested on the Sparc,
- Mips, PA, and Power architectures, so it's pretty likely to
- be correct. -Stu 10/24/95 */
and was then deleted not long after that (:-^):
date: 1999/03/27 00:03:13; author: shebs; state: Exp; lines: +2 -104
* infrun.c (wait_for_inferior): Remove most #if 0 segments.
it was replaced with:
if (stop_pc == ecs->stop_func_start /* Quick test */
|| (in_prologue (stop_pc, ecs->stop_func_start) &&
!IN_SOLIB_RETURN_TRAMPOLINE (stop_pc, ecs->stop_func_name))
|| IN_SOLIB_CALL_TRAMPOLINE (stop_pc, ecs->stop_func_name)
|| ecs->stop_func_name == 0)
The attached eliminates the long dead variable.
committed,
Andrew
2003-04-12 Andrew Cagney <cagney at redhat dot com>
* gdbthread.h (save_infrun_state): Delete parameter
"prev_func_start".
(struct thread_info): Delete field "prev_func_start".
(load_infrun_state): Ditto.
* thread.c (load_infrun_state, save_infrun_state): Update.
* infrun.c (prev_func_start): Delete variable.
(context_switch, init_wait_for_inferior): Update.
(stop_stepping, keep_going): Update.
Index: gdbthread.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbthread.h,v
retrieving revision 1.7
diff -u -r1.7 gdbthread.h
--- gdbthread.h 12 Apr 2003 17:41:25 -0000 1.7
+++ gdbthread.h 12 Apr 2003 17:46:54 -0000
@@ -44,7 +44,6 @@
int num; /* Convenient handle (GDB thread id) */
/* State from wait_for_inferior */
CORE_ADDR prev_pc;
- CORE_ADDR prev_func_start;
char *prev_func_name;
struct breakpoint *step_resume_breakpoint;
struct breakpoint *through_sigtramp_breakpoint;
@@ -118,7 +117,6 @@
/* infrun context switch: save the debugger state for the given thread. */
extern void save_infrun_state (ptid_t ptid,
CORE_ADDR prev_pc,
- CORE_ADDR prev_func_start,
char *prev_func_name,
int trap_expected,
struct breakpoint *step_resume_breakpoint,
@@ -139,7 +137,6 @@
for the given thread. */
extern void load_infrun_state (ptid_t ptid,
CORE_ADDR *prev_pc,
- CORE_ADDR *prev_func_start,
char **prev_func_name,
int *trap_expected,
struct breakpoint **step_resume_breakpoint,
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.106
diff -u -r1.106 infrun.c
--- infrun.c 11 Apr 2003 18:15:38 -0000 1.106
+++ infrun.c 12 Apr 2003 17:46:57 -0000
@@ -791,7 +791,6 @@
to be preserved over calls to it and cleared when the inferior
is started. */
static CORE_ADDR prev_pc;
-static CORE_ADDR prev_func_start;
static char *prev_func_name;
@@ -830,7 +829,6 @@
{
/* These are meaningless until the first time through wait_for_inferior. */
prev_pc = 0;
- prev_func_start = 0;
prev_func_name = NULL;
#ifdef HP_OS_BUG
@@ -1118,8 +1116,7 @@
if (in_thread_list (inferior_ptid) && in_thread_list (ecs->ptid))
{ /* Perform infrun state context switch: */
/* Save infrun state for the old thread. */
- save_infrun_state (inferior_ptid, prev_pc,
- prev_func_start, prev_func_name,
+ save_infrun_state (inferior_ptid, prev_pc, prev_func_name,
trap_expected, step_resume_breakpoint,
through_sigtramp_breakpoint, step_range_start,
step_range_end, &step_frame_id,
@@ -1130,8 +1127,7 @@
ecs->current_line, ecs->current_symtab, step_sp);
/* Load infrun state for the new thread. */
- load_infrun_state (ecs->ptid, &prev_pc,
- &prev_func_start, &prev_func_name,
+ load_infrun_state (ecs->ptid, &prev_pc, &prev_func_name,
&trap_expected, &step_resume_breakpoint,
&through_sigtramp_breakpoint, &step_range_start,
&step_range_end, &step_frame_id,
@@ -2737,7 +2733,6 @@
time, just like we did above if we didn't break out of the
loop. */
prev_pc = read_pc ();
- prev_func_start = ecs->stop_func_start;
prev_func_name = ecs->stop_func_name;
}
@@ -2754,11 +2749,6 @@
{
/* Save the pc before execution, to compare with pc after stop. */
prev_pc = read_pc (); /* Might have been DECR_AFTER_BREAK */
- prev_func_start = ecs->stop_func_start; /* Ok, since if DECR_PC_AFTER
- BREAK is defined, the
- original pc would not have
- been at the start of a
- function. */
prev_func_name = ecs->stop_func_name;
if (ecs->update_step_sp)
Index: thread.c
===================================================================
RCS file: /cvs/src/src/gdb/thread.c,v
retrieving revision 1.29
diff -u -r1.29 thread.c
--- thread.c 28 Mar 2003 21:42:41 -0000 1.29
+++ thread.c 12 Apr 2003 17:46:59 -0000
@@ -292,7 +292,6 @@
void
load_infrun_state (ptid_t ptid,
CORE_ADDR *prev_pc,
- CORE_ADDR *prev_func_start,
char **prev_func_name,
int *trap_expected,
struct breakpoint **step_resume_breakpoint,
@@ -317,7 +316,6 @@
return;
*prev_pc = tp->prev_pc;
- *prev_func_start = tp->prev_func_start;
*prev_func_name = tp->prev_func_name;
*trap_expected = tp->trap_expected;
*step_resume_breakpoint = tp->step_resume_breakpoint;
@@ -342,7 +340,6 @@
void
save_infrun_state (ptid_t ptid,
CORE_ADDR prev_pc,
- CORE_ADDR prev_func_start,
char *prev_func_name,
int trap_expected,
struct breakpoint *step_resume_breakpoint,
@@ -367,7 +364,6 @@
return;
tp->prev_pc = prev_pc;
- tp->prev_func_start = prev_func_start;
tp->prev_func_name = prev_func_name;
tp->trap_expected = trap_expected;
tp->step_resume_breakpoint = step_resume_breakpoint;