gdb/gdb-unwind-debughook-safe-f...

47 lines
1.6 KiB
Diff

commit 802214c97d1661ad337aad0d011dded44f0b5ddd
Author: Tom Tromey <tromey@redhat.com>
Date: Mon Apr 26 15:15:55 2010 -0600
Fail gracefully if the _Unwind_DebugHook argument is optimized out
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 2eea550..9a5b534 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4925,20 +4925,24 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
vsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), b, VAR_DOMAIN, NULL);
value = read_var_value (vsym, frame);
- handler = value_as_address (value);
+ /* If the value was optimized out, revert to the old behavior. */
+ if (! value_optimized_out (value))
+ {
+ handler = value_as_address (value);
- /* We're going to replace the current step-resume breakpoint
- with an exception-resume breakpoint. */
- delete_step_resume_breakpoint (tp);
+ /* We're going to replace the current step-resume breakpoint
+ with an exception-resume breakpoint. */
+ delete_step_resume_breakpoint (tp);
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog,
- "infrun: exception resume at %lx\n",
- (unsigned long) handler);
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: exception resume at %lx\n",
+ (unsigned long) handler);
- bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
- handler, bp_exception_resume);
- inferior_thread ()->step_resume_breakpoint = bp;
+ bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
+ handler, bp_exception_resume);
+ inferior_thread ()->step_resume_breakpoint = bp;
+ }
}
}