void
post_create_inferior (struct target_ops *target, int from_tty)
{
+ volatile struct gdb_exception ex;
+
/* Be sure we own the terminal in case write operations are performed. */
target_terminal_ours ();
don't need to. */
target_find_description ();
- /* Now that we know the register layout, retrieve current PC. */
- stop_pc = regcache_read_pc (get_current_regcache ());
+ /* Now that we know the register layout, retrieve current PC. But
+ if the PC is unavailable (e.g., we're opening a core file with
+ missing registers info), ignore it. */
+ stop_pc = 0;
+ TRY_CATCH (ex, RETURN_MASK_ERROR)
+ {
+ stop_pc = regcache_read_pc (get_current_regcache ());
+ }
+ if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
+ throw_exception (ex);
if (exec_bfd)
{