This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [4/7] infrun cleanup: ecs->stop_func_* and new_thread_event
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Sun, 7 Dec 2008 01:19:01 +0100 (CET)
- Subject: [rfc] [4/7] infrun cleanup: ecs->stop_func_* and new_thread_event
Hello,
this patch removes the ecs->stop_func_start, ecs->stop_func_end,
ecs->stop_func_name, and ecs->new_thread_event members and replaces
them by local variables in handle_inferior_event.
They are never used outside of this function (except for stop_func_start
and stop_func_end in handle_step_into_function; they are now passed as
additional arguments into that function).
Bye,
Ulrich
ChangeLog:
* infrun.c (struct execution_control_state): Remove new_thread_event,
stop_func_start, stop_func_end, and stop_func_name.
(handle_step_into_function): Add STOP_FUNC_START and STOP_FUNC_END
arguments; use them instead of ecs members.
(handle_inferior_event): Use local variables instead of ecs members.
Update call to handle_step_into_function.
Index: gdb-head/gdb/infrun.c
===================================================================
--- gdb-head.orig/gdb/infrun.c
+++ gdb-head/gdb/infrun.c
@@ -1571,16 +1571,13 @@ struct execution_control_state
struct thread_info *event_thread;
struct target_waitstatus ws;
- CORE_ADDR stop_func_start;
- CORE_ADDR stop_func_end;
- char *stop_func_name;
- int new_thread_event;
int wait_some_more;
};
static void handle_inferior_event (struct execution_control_state *ecs);
-static void handle_step_into_function (struct execution_control_state *ecs);
+static void handle_step_into_function (struct execution_control_state *ecs,
+ CORE_ADDR, CORE_ADDR);
static void handle_step_into_function_backward (struct execution_control_state *ecs);
static void insert_step_resume_breakpoint_at_frame (struct frame_info *step_frame);
static void insert_step_resume_breakpoint_at_caller (struct frame_info *);
@@ -2066,6 +2063,10 @@ handle_inferior_event (struct execution_
int stepped_after_stopped_by_watchpoint = 0;
struct symtab_and_line stop_pc_sal;
enum stop_kind stop_soon;
+ CORE_ADDR stop_func_start;
+ CORE_ADDR stop_func_end;
+ char *stop_func_name;
+ int new_thread_event;
if (ecs->ws.kind != TARGET_WAITKIND_EXITED
&& ecs->ws.kind != TARGET_WAITKIND_SIGNALLED
@@ -2088,12 +2089,12 @@ handle_inferior_event (struct execution_
/* If it's a new process, add it to the thread database */
- ecs->new_thread_event = (!ptid_equal (ecs->ptid, inferior_ptid)
- && !ptid_equal (ecs->ptid, minus_one_ptid)
- && !in_thread_list (ecs->ptid));
+ new_thread_event = (!ptid_equal (ecs->ptid, inferior_ptid)
+ && !ptid_equal (ecs->ptid, minus_one_ptid)
+ && !in_thread_list (ecs->ptid));
if (ecs->ws.kind != TARGET_WAITKIND_EXITED
- && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED && ecs->new_thread_event)
+ && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED && new_thread_event)
add_thread (ecs->ptid);
ecs->event_thread = find_thread_pid (ecs->ptid);
@@ -2385,7 +2386,7 @@ handle_inferior_event (struct execution_
return;
}
- if (ecs->new_thread_event)
+ if (new_thread_event)
{
if (non_stop)
/* Non-stop assumes that the target handles adding new threads
@@ -2708,14 +2709,14 @@ targets should add new threads to the th
return;
}
- ecs->stop_func_start = 0;
- ecs->stop_func_end = 0;
- ecs->stop_func_name = 0;
+ stop_func_start = 0;
+ stop_func_end = 0;
+ stop_func_name = 0;
/* Don't care about return value; stop_func_start and stop_func_name
will both be 0 if it doesn't work. */
- find_pc_partial_function (stop_pc, &ecs->stop_func_name,
- &ecs->stop_func_start, &ecs->stop_func_end);
- ecs->stop_func_start
+ find_pc_partial_function (stop_pc, &stop_func_name,
+ &stop_func_start, &stop_func_end);
+ stop_func_start
+= gdbarch_deprecated_function_start_offset (current_gdbarch);
ecs->event_thread->stepping_over_breakpoint = 0;
bpstat_clear (&ecs->event_thread->stop_bpstat);
@@ -3091,7 +3092,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
keep_going (ecs);
return;
}
- if (stop_pc == ecs->stop_func_start
+ if (stop_pc == stop_func_start
&& execution_direction == EXEC_REVERSE)
{
/* We are stepping over a function call in reverse, and
@@ -3274,7 +3275,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
(unless it's the function entry point, in which case
keep going back to the call point). */
if (stop_pc == ecs->event_thread->step_range_start
- && stop_pc != ecs->stop_func_start
+ && stop_pc != stop_func_start
&& execution_direction == EXEC_REVERSE)
{
ecs->event_thread->stop_step = 1;
@@ -3355,7 +3356,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
if ((ecs->event_thread->step_over_calls == STEP_OVER_NONE)
|| ((ecs->event_thread->step_range_end == 1)
&& in_prologue (ecs->event_thread->prev_pc,
- ecs->stop_func_start)))
+ stop_func_start)))
{
/* I presume that step_over_calls is only 0 when we're
supposed to be stepping at the assembly language level
@@ -3386,7 +3387,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
{
struct symtab_and_line sr_sal;
- if (ecs->stop_func_start == 0
+ if (stop_func_start == 0
&& in_solib_dynsym_resolve_code (stop_pc))
{
/* Stepped into runtime loader dynamic symbol
@@ -3402,7 +3403,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
}
/* Normal (staticly linked) function call return. */
init_sal (&sr_sal);
- sr_sal.pc = ecs->stop_func_start;
+ sr_sal.pc = stop_func_start;
insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
}
else
@@ -3422,13 +3423,13 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
real_stop_pc = gdbarch_skip_trampoline_code
(current_gdbarch, get_current_frame (), stop_pc);
if (real_stop_pc != 0)
- ecs->stop_func_start = real_stop_pc;
+ stop_func_start = real_stop_pc;
if (real_stop_pc != 0 && in_solib_dynsym_resolve_code (real_stop_pc))
{
struct symtab_and_line sr_sal;
init_sal (&sr_sal);
- sr_sal.pc = ecs->stop_func_start;
+ sr_sal.pc = stop_func_start;
insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
keep_going (ecs);
@@ -3444,13 +3445,13 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
{
struct symtab_and_line tmp_sal;
- tmp_sal = find_pc_line (ecs->stop_func_start, 0);
+ tmp_sal = find_pc_line (stop_func_start, 0);
if (tmp_sal.line != 0)
{
if (execution_direction == EXEC_REVERSE)
handle_step_into_function_backward (ecs);
else
- handle_step_into_function (ecs);
+ handle_step_into_function (ecs, stop_func_start, stop_func_end);
return;
}
}
@@ -3473,7 +3474,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
From there we can step once and be back in the caller. */
struct symtab_and_line sr_sal;
init_sal (&sr_sal);
- sr_sal.pc = ecs->stop_func_start;
+ sr_sal.pc = stop_func_start;
insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
}
else
@@ -3488,7 +3489,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
/* If we're in the return path from a shared library trampoline,
we want to proceed through the trampoline when stepping. */
if (gdbarch_in_solib_return_trampoline (current_gdbarch,
- stop_pc, ecs->stop_func_name))
+ stop_pc, stop_func_name))
{
/* Determine where this trampoline returns. */
CORE_ADDR real_stop_pc;
@@ -3526,7 +3527,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
the trampoline processing logic, however, there are some trampolines
that have no names, so we should do trampoline handling first. */
if (ecs->event_thread->step_over_calls == STEP_OVER_UNDEBUGGABLE
- && ecs->stop_func_name == NULL
+ && stop_func_name == NULL
&& stop_pc_sal.line == 0)
{
if (debug_infrun)
@@ -3650,17 +3651,17 @@ currently_stepping (struct thread_info *
it. */
static void
-handle_step_into_function (struct execution_control_state *ecs)
+handle_step_into_function (struct execution_control_state *ecs,
+ CORE_ADDR stop_func_start, CORE_ADDR stop_func_end)
{
struct symtab *s;
struct symtab_and_line stop_func_sal, sr_sal;
s = find_pc_symtab (stop_pc);
if (s && s->language != language_asm)
- ecs->stop_func_start = gdbarch_skip_prologue (current_gdbarch,
- ecs->stop_func_start);
+ stop_func_start = gdbarch_skip_prologue (current_gdbarch, stop_func_start);
- stop_func_sal = find_pc_line (ecs->stop_func_start, 0);
+ stop_func_sal = find_pc_line (stop_func_start, 0);
/* Use the step_resume_break to step until the end of the prologue,
even if that involves jumps (as it seems to on the vax under
4.2). */
@@ -3668,14 +3669,14 @@ handle_step_into_function (struct execut
the end of that source line (if it is still within the function).
Otherwise, just go to end of prologue. */
if (stop_func_sal.end
- && stop_func_sal.pc != ecs->stop_func_start
- && stop_func_sal.end < ecs->stop_func_end)
- ecs->stop_func_start = stop_func_sal.end;
+ && stop_func_sal.pc != stop_func_start
+ && stop_func_sal.end < stop_func_end)
+ stop_func_start = stop_func_sal.end;
/* Architectures which require breakpoint adjustment might not be able
to place a breakpoint at the computed address. If so, the test
- ``ecs->stop_func_start == stop_pc'' will never succeed. Adjust
- ecs->stop_func_start to an address at which a breakpoint may be
+ ``stop_func_start == stop_pc'' will never succeed. Adjust
+ stop_func_start to an address at which a breakpoint may be
legitimately placed.
Note: kevinb/2004-01-19: On FR-V, if this adjustment is not
@@ -3690,12 +3691,11 @@ handle_step_into_function (struct execut
if (gdbarch_adjust_breakpoint_address_p (current_gdbarch))
{
- ecs->stop_func_start
- = gdbarch_adjust_breakpoint_address (current_gdbarch,
- ecs->stop_func_start);
+ stop_func_start
+ = gdbarch_adjust_breakpoint_address (current_gdbarch, stop_func_start);
}
- if (ecs->stop_func_start == stop_pc)
+ if (stop_func_start == stop_pc)
{
/* We are already there: stop now. */
ecs->event_thread->stop_step = 1;
@@ -3707,8 +3707,8 @@ handle_step_into_function (struct execut
{
/* Put the step-breakpoint there and go until there. */
init_sal (&sr_sal); /* initialize to zeroes */
- sr_sal.pc = ecs->stop_func_start;
- sr_sal.section = find_pc_overlay (ecs->stop_func_start);
+ sr_sal.pc = stop_func_start;
+ sr_sal.section = find_pc_overlay (stop_func_start);
/* Do not specify what the fp should be when we stop since on
some machines the prologue is where the new fp value is
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com