aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-06-24 15:17:32 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-06-24 15:17:32 +0000
commit628fe4e4a9819d823ef97acacb01c01e39d3fc50 (patch)
tree39b0748668f15eb7c410e118a5a534b3baf083da /gdb/infrun.c
parentf1421989e756090c82431b85a3766b892361182e (diff)
downloadgdb-628fe4e4a9819d823ef97acacb01c01e39d3fc50.zip
gdb-628fe4e4a9819d823ef97acacb01c01e39d3fc50.tar.gz
gdb-628fe4e4a9819d823ef97acacb01c01e39d3fc50.tar.bz2
gdb/
Fix PR 9436. * breakpoint.c (handle_jit_event): New function. (bpstat_what): Remove enum class, kc, ss, sn, sgl, slr, clr, sr, shl, jit, err, table and bs_class. New variables shlib_event, jit_event, this_action and bptype. Change bs_class assignments to this_action assignments. new unhandled bptype internal error. Move here shlib_event and jit_event handling from handle_inferior_event. * breakpoint.h (enum bpstat_what_main_action): Extend the comment. Reorder items. Remove BPSTAT_WHAT_CHECK_SHLIBS and BPSTAT_WHAT_CHECK_JIT. * inferior.h (debug_infrun, stop_on_solib_events): New declarations. * infrun.c (debug_infrun, stop_on_solib_events): Remove static. (handle_inferior_event): Reinitialize frame and gdbarch after bpstat_what call. Move BPSTAT_WHAT_CHECK_SHLIBS and BPSTAT_WHAT_CHECK_JIT handling to bpstat_what. Reinitialize even gdbarch when frame gets reinitialized. gdb/testsuite/ Test PR 9436. * gdb.base/nostdlib.exp, gdb.base/nostdlib.c: New.
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c71
1 files changed, 9 insertions, 62 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 351e1a9..0f1e42c 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -119,7 +119,7 @@ show_debug_displaced (struct ui_file *file, int from_tty,
fprintf_filtered (file, _("Displace stepping debugging is %s.\n"), value);
}
-static int debug_infrun = 0;
+int debug_infrun = 0;
static void
show_debug_infrun (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
@@ -294,7 +294,7 @@ static struct symbol *step_start_function;
/* Nonzero if we want to give control to the user when we're notified
of shared library events by the dynamic linker. */
-static int stop_on_solib_events;
+int stop_on_solib_events;
static void
show_stop_on_solib_events (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
@@ -4057,6 +4057,12 @@ process_event_stop_test:
stop_stack_dummy = what.call_dummy;
}
+ /* If we hit an internal event that triggers symbol changes, the
+ current frame will be invalidated within bpstat_what (e.g., if
+ we hit an internal solib event). Re-fetch it. */
+ frame = get_current_frame ();
+ gdbarch = get_frame_arch (frame);
+
switch (what.main_action)
{
case BPSTAT_WHAT_SET_LONGJMP_RESUME:
@@ -4161,66 +4167,6 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
}
break;
- case BPSTAT_WHAT_CHECK_SHLIBS:
- {
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_CHECK_SHLIBS\n");
-
- /* Check for any newly added shared libraries if we're
- supposed to be adding them automatically. Switch
- terminal for any messages produced by
- breakpoint_re_set. */
- target_terminal_ours_for_output ();
- /* NOTE: cagney/2003-11-25: Make certain that the target
- stack's section table is kept up-to-date. Architectures,
- (e.g., PPC64), use the section table to perform
- operations such as address => section name and hence
- require the table to contain all sections (including
- those found in shared libraries). */
-#ifdef SOLIB_ADD
- SOLIB_ADD (NULL, 0, &current_target, auto_solib_add);
-#else
- solib_add (NULL, 0, &current_target, auto_solib_add);
-#endif
- target_terminal_inferior ();
-
- /* If requested, stop when the dynamic linker notifies
- gdb of events. This allows the user to get control
- and place breakpoints in initializer routines for
- dynamically loaded objects (among other things). */
- if (stop_on_solib_events || stop_stack_dummy)
- {
- stop_stepping (ecs);
- return;
- }
- else
- {
- /* We want to step over this breakpoint, then keep going. */
- ecs->event_thread->stepping_over_breakpoint = 1;
- break;
- }
- }
- break;
-
- case BPSTAT_WHAT_CHECK_JIT:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_CHECK_JIT\n");
-
- /* Switch terminal for any messages produced by breakpoint_re_set. */
- target_terminal_ours_for_output ();
-
- jit_event_handler (gdbarch);
-
- target_terminal_inferior ();
-
- /* We want to step over this breakpoint, then keep going. */
- ecs->event_thread->stepping_over_breakpoint = 1;
-
- break;
-
- case BPSTAT_WHAT_LAST:
- /* Not a real code, but listed here to shut up gcc -Wall. */
-
case BPSTAT_WHAT_KEEP_CHECKING:
break;
}
@@ -4357,6 +4303,7 @@ infrun: not switching back to stepped thread, it has vanished\n");
the frame cache to be re-initialized, making our FRAME variable
a dangling pointer. */
frame = get_current_frame ();
+ gdbarch = get_frame_arch (frame);
/* If stepping through a line, keep going if still within it.