aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Benson <gary@redhat.com>2011-07-19 12:24:34 +0000
committerGary Benson <gary@redhat.com>2011-07-19 12:24:34 +0000
commit7e324e482fe55600d1fff227944f6b4b98fbb96f (patch)
treef609d884cf11e0b4e1abdbdb0b795a27cab499ee
parentc8057f624ee9f59763786eafef50a25ab5f8e544 (diff)
downloadgdb-7e324e482fe55600d1fff227944f6b4b98fbb96f.zip
gdb-7e324e482fe55600d1fff227944f6b4b98fbb96f.tar.gz
gdb-7e324e482fe55600d1fff227944f6b4b98fbb96f.tar.bz2
gdb/
* infrun.c (struct execution_control_state): New member stop_func_filled_in. (clear_stop_func, fill_in_stop_func): New functions. (handle_inferior_event): Call clear_stop_func rather than manipulating the execution control state directly. Call fill_in_stop_func lazily as required rather than directly calling find_pc_partial_function in all cases.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/infrun.c47
2 files changed, 48 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 44cc9d4..4e6f35f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+2011-07-19 Gary Benson <gbenson@redhat.com>
+
+ * infrun.c (struct execution_control_state): New member
+ stop_func_filled_in.
+ (clear_stop_func, fill_in_stop_func): New functions.
+ (handle_inferior_event): Call clear_stop_func rather than
+ manipulating the execution control state directly.
+ Call fill_in_stop_func lazily as required rather than
+ directly calling find_pc_partial_function in all cases.
+
2011-07-18 Tom Tromey <tromey@redhat.com>
* dwarf2read.c (read_subrange_type): Use attr_form_is_block when
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 2b4525e..91e0fc2 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2326,6 +2326,7 @@ struct execution_control_state
struct target_waitstatus ws;
int random_signal;
+ int stop_func_filled_in;
CORE_ADDR stop_func_start;
CORE_ADDR stop_func_end;
char *stop_func_name;
@@ -3080,6 +3081,36 @@ handle_syscall_event (struct execution_control_state *ecs)
return 1;
}
+/* Clear the supplied execution_control_state's stop_func_* fields. */
+
+static void
+clear_stop_func (struct execution_control_state *ecs)
+{
+ ecs->stop_func_filled_in = 0;
+ ecs->stop_func_start = 0;
+ ecs->stop_func_end = 0;
+ ecs->stop_func_name = NULL;
+}
+
+/* Lazily fill in the execution_control_state's stop_func_* fields. */
+
+static void
+fill_in_stop_func (struct gdbarch *gdbarch,
+ struct execution_control_state *ecs)
+{
+ if (!ecs->stop_func_filled_in)
+ {
+ /* 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
+ += gdbarch_deprecated_function_start_offset (gdbarch);
+
+ ecs->stop_func_filled_in = 1;
+ }
+}
+
/* Given an execution control state that has been freshly filled in
by an event from the inferior, figure out what it means and take
appropriate action. */
@@ -3925,15 +3956,7 @@ handle_inferior_event (struct execution_control_state *ecs)
return;
}
- ecs->stop_func_start = 0;
- ecs->stop_func_end = 0;
- ecs->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
- += gdbarch_deprecated_function_start_offset (gdbarch);
+ clear_stop_func (ecs);
ecs->event_thread->stepping_over_breakpoint = 0;
bpstat_clear (&ecs->event_thread->control.stop_bpstat);
ecs->event_thread->control.stop_step = 0;
@@ -4377,6 +4400,7 @@ process_event_stop_test:
keep_going (ecs);
return;
}
+ fill_in_stop_func (gdbarch, ecs);
if (stop_pc == ecs->stop_func_start
&& execution_direction == EXEC_REVERSE)
{
@@ -4568,6 +4592,7 @@ process_event_stop_test:
a dangling pointer. */
frame = get_current_frame ();
gdbarch = get_frame_arch (frame);
+ fill_in_stop_func (gdbarch, ecs);
/* If stepping through a line, keep going if still within it.
@@ -5128,6 +5153,8 @@ handle_step_into_function (struct gdbarch *gdbarch,
struct symtab *s;
struct symtab_and_line stop_func_sal, sr_sal;
+ fill_in_stop_func (gdbarch, ecs);
+
s = find_pc_symtab (stop_pc);
if (s && s->language != language_asm)
ecs->stop_func_start = gdbarch_skip_prologue (gdbarch,
@@ -5207,6 +5234,8 @@ handle_step_into_function_backward (struct gdbarch *gdbarch,
struct symtab *s;
struct symtab_and_line stop_func_sal;
+ fill_in_stop_func (gdbarch, ecs);
+
s = find_pc_symtab (stop_pc);
if (s && s->language != language_asm)
ecs->stop_func_start = gdbarch_skip_prologue (gdbarch,