* config.sub, config.guess: Update from upstream sources.
[deliverable/binutils-gdb.git] / gdb / infrun.c
index 4e0ca9d656c1eebcd8b5a5e8731c5f5064a95234..61afab28a9245ad05b4b6a8baf3e68b127265d65 100644 (file)
@@ -1,7 +1,7 @@
 /* Target-struct-independent code to start (run) and stop an inferior
    process.
 
-   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
+   Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
    1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
    Software Foundation, Inc.
 
@@ -19,8 +19,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 #include "defs.h"
 #include "gdb_string.h"
 #include "value.h"
 #include "observer.h"
 #include "language.h"
+#include "solib.h"
+#include "main.h"
+
 #include "gdb_assert.h"
+#include "mi/mi-common.h"
 
 /* Prototypes for local functions */
 
@@ -87,6 +91,12 @@ int inferior_ignoring_leading_exec_events = 0;
    no line number information.  The normal behavior is that we step
    over such function.  */
 int step_stop_if_no_debug = 0;
+static void
+show_step_stop_if_no_debug (struct ui_file *file, int from_tty,
+                           struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("Mode of the step operation is %s.\n"), value);
+}
 
 /* In asynchronous mode, but simulating synchronous execution. */
 
@@ -108,6 +118,12 @@ static ptid_t previous_inferior_ptid;
 static int may_follow_exec = MAY_FOLLOW_EXEC;
 
 static int debug_infrun = 0;
+static void
+show_debug_infrun (struct ui_file *file, int from_tty,
+                  struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("Inferior debugging is %s.\n"), value);
+}
 
 /* If the program uses ELF-style shared libraries, then calls to
    functions in shared libraries go through stubs, which live in a
@@ -148,10 +164,6 @@ static int debug_infrun = 0;
    signalling an error, which will obscure the change in the
    inferior's state.  */
 
-#ifndef IN_SOLIB_DYNSYM_RESOLVE_CODE
-#define IN_SOLIB_DYNSYM_RESOLVE_CODE(pc) 0
-#endif
-
 /* This function returns TRUE if pc is the address of an instruction
    that lies within the dynamic linker (such as the event hook, or the
    dld itself).
@@ -241,11 +253,16 @@ static struct symbol *step_start_function;
 
 static int trap_expected;
 
-#ifdef SOLIB_ADD
 /* 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;
-#endif
+static void
+show_stop_on_solib_events (struct ui_file *file, int from_tty,
+                          struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("Stopping for shared library events is %s.\n"),
+                   value);
+}
 
 /* Nonzero means expecting a trace trap
    and should stop the inferior and return silently when it happens.  */
@@ -314,6 +331,14 @@ static const char *follow_fork_mode_kind_names[] = {
 };
 
 static const char *follow_fork_mode_string = follow_fork_mode_parent;
+static void
+show_follow_fork_mode_string (struct ui_file *file, int from_tty,
+                             struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("\
+Debugger response to a program call of fork or vfork is \"%s\".\n"),
+                   value);
+}
 \f
 
 static int
@@ -421,6 +446,8 @@ follow_exec (int pid, char *execd_pathname)
 #endif
 #ifdef SOLIB_CREATE_INFERIOR_HOOK
   SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
+#else
+  solib_create_inferior_hook ();
 #endif
 
   /* Reinsert all breakpoints.  (Those which were symbolic have
@@ -458,32 +485,30 @@ resume_cleanups (void *ignore)
 static const char schedlock_off[] = "off";
 static const char schedlock_on[] = "on";
 static const char schedlock_step[] = "step";
-static const char *scheduler_mode = schedlock_off;
 static const char *scheduler_enums[] = {
   schedlock_off,
   schedlock_on,
   schedlock_step,
   NULL
 };
+static const char *scheduler_mode = schedlock_off;
+static void
+show_scheduler_mode (struct ui_file *file, int from_tty,
+                    struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("\
+Mode for locking scheduler during execution is \"%s\".\n"),
+                   value);
+}
 
 static void
 set_schedlock_func (char *args, int from_tty, struct cmd_list_element *c)
 {
-  /* NOTE: cagney/2002-03-17: The deprecated_add_show_from_set()
-     function clones the set command passed as a parameter.  The clone
-     operation will include (BUG?) any ``set'' command callback, if
-     present.  Commands like ``info set'' call all the ``show''
-     command callbacks.  Unfortunately, for ``show'' commands cloned
-     from ``set'', this includes callbacks belonging to ``set''
-     commands.  Making this worse, this only occures if
-     deprecated_add_show_from_set() is called after add_cmd_sfunc()
-     (BUG?).  */
-  if (cmd_type (c) == set_cmd)
-    if (!target_can_lock_scheduler)
-      {
-       scheduler_mode = schedlock_off;
-       error (_("Target '%s' cannot support this command."), target_shortname);
-      }
+  if (!target_can_lock_scheduler)
+    {
+      scheduler_mode = schedlock_off;
+      error (_("Target '%s' cannot support this command."), target_shortname);
+    }
 }
 
 
@@ -918,6 +943,7 @@ void handle_inferior_event (struct execution_control_state *ecs);
 
 static void step_into_function (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 *);
 static void insert_step_resume_breakpoint_at_sal (struct symtab_and_line sr_sal,
                                                  struct frame_id sr_id);
 static void stop_stepping (struct execution_control_state *ecs);
@@ -1051,7 +1077,7 @@ fetch_inferior_event (void *client_data)
 void
 init_execution_control_state (struct execution_control_state *ecs)
 {
-  /* ecs->another_trap? */
+  ecs->another_trap = 0;
   ecs->random_signal = 0;
   ecs->step_after_step_resume_breakpoint = 0;
   ecs->handling_longjmp = 0;   /* FIXME */
@@ -1077,6 +1103,12 @@ get_last_target_status (ptid_t *ptidp, struct target_waitstatus *status)
   *status = target_last_waitstatus;
 }
 
+void
+nullify_last_target_wait_ptid (void)
+{
+  target_last_wait_ptid = minus_one_ptid;
+}
+
 /* Switch thread contexts, maintaining "infrun state". */
 
 static void
@@ -1176,8 +1208,12 @@ adjust_pc_after_break (struct execution_control_state *ecs)
       /* When using hardware single-step, a SIGTRAP is reported for
          both a completed single-step and a software breakpoint.  Need
          to differentiate between the two as the latter needs
-         adjusting but the former does not.  */
-      if (currently_stepping (ecs))
+         adjusting but the former does not.
+
+         When the thread to be examined does not match the current thread
+         context we can't use currently_stepping, so assume no
+         single-stepping in this case.  */
+      if (ptid_equal (ecs->ptid, inferior_ptid) && currently_stepping (ecs))
        {
          if (prev_pc == breakpoint_pc
              && software_breakpoint_inserted_here_p (breakpoint_pc))
@@ -1208,11 +1244,10 @@ int stepped_after_stopped_by_watchpoint;
 void
 handle_inferior_event (struct execution_control_state *ecs)
 {
-  /* NOTE: cagney/2003-03-28: If you're looking at this code and
-     thinking that the variable stepped_after_stopped_by_watchpoint
-     isn't used, then you're wrong!  The macro STOPPED_BY_WATCHPOINT,
-     defined in the file "config/pa/nm-hppah.h", accesses the variable
-     indirectly.  Mutter something rude about the HP merge.  */
+  /* NOTE: bje/2005-05-02: If you're looking at this code and thinking
+     that the variable stepped_after_stopped_by_watchpoint isn't used,
+     then you're wrong!  See remote.c:remote_stopped_data_address.  */
+
   int sw_single_step_trap_p = 0;
   int stopped_by_watchpoint = -1;      /* Mark as unknown.  */
 
@@ -1376,6 +1411,12 @@ handle_inferior_event (struct execution_control_state *ecs)
       pending_follow.fork_event.parent_pid = PIDGET (ecs->ptid);
       pending_follow.fork_event.child_pid = ecs->ws.value.related_pid;
 
+      if (!ptid_equal (ecs->ptid, inferior_ptid))
+       {
+         context_switch (ecs);
+         flush_cached_frames ();
+       }
+
       stop_pc = read_pc ();
 
       stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid, 0);
@@ -1393,7 +1434,7 @@ handle_inferior_event (struct execution_control_state *ecs)
 
     case TARGET_WAITKIND_EXECD:
       if (debug_infrun)
-        fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_EXECED\n");
+        fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_EXECD\n");
       stop_signal = TARGET_SIGNAL_TRAP;
 
       /* NOTE drow/2002-12-05: This code should be pushed down into the
@@ -1434,6 +1475,12 @@ handle_inferior_event (struct execution_control_state *ecs)
       ecs->random_signal = !bpstat_explains_signal (stop_bpstat);
       inferior_ptid = ecs->saved_inferior_ptid;
 
+      if (!ptid_equal (ecs->ptid, inferior_ptid))
+       {
+         context_switch (ecs);
+         flush_cached_frames ();
+       }
+
       /* If no catchpoint triggered for this, then keep going.  */
       if (ecs->random_signal)
        {
@@ -1987,7 +2034,7 @@ process_event_stop_test:
           duration of this command.  Then, install a temporary
           breakpoint at the target of the jmp_buf. */
         if (debug_infrun)
-         fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_SET_LONGJMP_RESUME\n");
+         fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME\n");
        disable_longjmp_breakpoint ();
        remove_breakpoints ();
        breakpoints_inserted = 0;
@@ -2012,7 +2059,7 @@ process_event_stop_test:
       case BPSTAT_WHAT_CLEAR_LONGJMP_RESUME:
       case BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE:
         if (debug_infrun)
-         fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_CLEAR_LONGJMP_RESUME\n");
+         fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_CLEAR_LONGJMP_RESUME\n");
        remove_breakpoints ();
        breakpoints_inserted = 0;
        disable_longjmp_breakpoint ();
@@ -2023,7 +2070,7 @@ process_event_stop_test:
 
       case BPSTAT_WHAT_SINGLE:
         if (debug_infrun)
-         fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_SINGLE\n");
+         fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_SINGLE\n");
        if (breakpoints_inserted)
          {
            remove_breakpoints ();
@@ -2036,7 +2083,7 @@ process_event_stop_test:
 
       case BPSTAT_WHAT_STOP_NOISY:
         if (debug_infrun)
-         fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_STOP_NOISY\n");
+         fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_STOP_NOISY\n");
        stop_print_frame = 1;
 
        /* We are about to nuke the step_resume_breakpointt via the
@@ -2047,7 +2094,7 @@ process_event_stop_test:
 
       case BPSTAT_WHAT_STOP_SILENT:
         if (debug_infrun)
-         fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_STOP_SILENT\n");
+         fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_STOP_SILENT\n");
        stop_print_frame = 0;
 
        /* We are about to nuke the step_resume_breakpoin via the
@@ -2075,7 +2122,7 @@ process_event_stop_test:
           the one deleted is the one currently stopped at.  MVS  */
 
         if (debug_infrun)
-         fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_STEP_RESUME\n");
+         fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_STEP_RESUME\n");
 
        if (step_resume_breakpoint == NULL)
          {
@@ -2099,7 +2146,7 @@ process_event_stop_test:
 
       case BPSTAT_WHAT_THROUGH_SIGTRAMP:
         if (debug_infrun)
-         fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_THROUGH_SIGTRAMP\n");
+         fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_THROUGH_SIGTRAMP\n");
        /* If were waiting for a trap, hitting the step_resume_break
           doesn't count as getting it.  */
        if (trap_expected)
@@ -2108,10 +2155,9 @@ process_event_stop_test:
 
       case BPSTAT_WHAT_CHECK_SHLIBS:
       case BPSTAT_WHAT_CHECK_SHLIBS_RESUME_FROM_HOOK:
-#ifdef SOLIB_ADD
        {
           if (debug_infrun)
-           fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_CHECK_SHLIBS\n");
+           fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_CHECK_SHLIBS\n");
          /* Remove breakpoints, we eventually want to step over the
             shlib event breakpoint, and SOLIB_ADD might adjust
             breakpoint addresses via breakpoint_re_set.  */
@@ -2139,7 +2185,11 @@ process_event_stop_test:
             exec/process stratum, instead relying on the target stack
             to propagate relevant changes (stop, section table
             changed, ...) up to other layers.  */
+#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 ();
 
          /* Try to reenable shared library breakpoints, additional
@@ -2198,7 +2248,6 @@ process_event_stop_test:
              break;
            }
        }
-#endif
        break;
 
       case BPSTAT_WHAT_LAST:
@@ -2287,7 +2336,12 @@ process_event_stop_test:
      until we exit the run time loader code and reach the callee's
      address.  */
   if (step_over_calls == STEP_OVER_UNDEBUGGABLE
-      && IN_SOLIB_DYNSYM_RESOLVE_CODE (stop_pc))
+#ifdef IN_SOLIB_DYNSYM_RESOLVE_CODE
+      && IN_SOLIB_DYNSYM_RESOLVE_CODE (stop_pc)
+#else
+      && in_solib_dynsym_resolve_code (stop_pc)
+#endif
+      )
     {
       CORE_ADDR pc_after_resolver =
        gdbarch_skip_solib_resolver (current_gdbarch, stop_pc);
@@ -2326,9 +2380,17 @@ process_event_stop_test:
       return;
     }
 
-  if (frame_id_eq (frame_unwind_id (get_current_frame ()), step_frame_id))
+  /* Check for subroutine calls.  The check for the current frame
+     equalling the step ID is not necessary - the check of the
+     previous frame's ID is sufficient - but it is a common case and
+     cheaper than checking the previous frame's ID.
+
+     NOTE: frame_id_eq will never report two invalid frame IDs as
+     being equal, so to get into this block, both the current and
+     previous frame must have valid frame IDs.  */
+  if (!frame_id_eq (get_frame_id (get_current_frame ()), step_frame_id)
+      && frame_id_eq (frame_unwind_id (get_current_frame ()), step_frame_id))
     {
-      /* It's a subroutine call.  */
       CORE_ADDR real_stop_pc;
 
       if (debug_infrun)
@@ -2355,7 +2417,7 @@ process_event_stop_test:
          /* We're doing a "next", set a breakpoint at callee's return
             address (the address at which the caller will
             resume).  */
-         insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ()));
+         insert_step_resume_breakpoint_at_caller (get_current_frame ());
          keep_going (ecs);
          return;
        }
@@ -2371,7 +2433,13 @@ process_event_stop_test:
       if (real_stop_pc != 0)
        ecs->stop_func_start = real_stop_pc;
 
-      if (IN_SOLIB_DYNSYM_RESOLVE_CODE (ecs->stop_func_start))
+      if (
+#ifdef IN_SOLIB_DYNSYM_RESOLVE_CODE
+         IN_SOLIB_DYNSYM_RESOLVE_CODE (ecs->stop_func_start)
+#else
+         in_solib_dynsym_resolve_code (ecs->stop_func_start)
+#endif
+)
        {
          struct symtab_and_line sr_sal;
          init_sal (&sr_sal);
@@ -2412,7 +2480,7 @@ process_event_stop_test:
 
       /* Set a breakpoint at callee's return address (the address at
          which the caller will resume).  */
-      insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ()));
+      insert_step_resume_breakpoint_at_caller (get_current_frame ());
       keep_going (ecs);
       return;
     }
@@ -2449,22 +2517,28 @@ process_event_stop_test:
        }
     }
 
+  ecs->sal = find_pc_line (stop_pc, 0);
+
   /* NOTE: tausq/2004-05-24: This if block used to be done before all
      the trampoline processing logic, however, there are some trampolines 
      that have no names, so we should do trampoline handling first.  */
   if (step_over_calls == STEP_OVER_UNDEBUGGABLE
-      && ecs->stop_func_name == NULL)
+      && ecs->stop_func_name == NULL
+      && ecs->sal.line == 0)
     {
       if (debug_infrun)
         fprintf_unfiltered (gdb_stdlog, "infrun: stepped into undebuggable function\n");
 
       /* The inferior just stepped into, or returned to, an
-         undebuggable function (where there is no symbol, not even a
-         minimal symbol, corresponding to the address where the
+         undebuggable function (where there is no debugging information
+         and no line number corresponding to the address where the
          inferior stopped).  Since we want to skip this kind of code,
          we keep going until the inferior returns from this
-         function.  */
-      if (step_stop_if_no_debug)
+         function - unless the user has asked us not to (via
+         set step-mode) or we no longer know how to get back
+         to the call site.  */
+      if (step_stop_if_no_debug
+         || !frame_id_p (frame_unwind_id (get_current_frame ())))
        {
          /* If we have no line number and the step-stop-if-no-debug
             is set, we stop the step so that the user has a chance to
@@ -2478,7 +2552,7 @@ process_event_stop_test:
        {
          /* Set a breakpoint at callee's return address (the address
             at which the caller will resume).  */
-         insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ()));
+         insert_step_resume_breakpoint_at_caller (get_current_frame ());
          keep_going (ecs);
          return;
        }
@@ -2496,8 +2570,6 @@ process_event_stop_test:
       return;
     }
 
-  ecs->sal = find_pc_line (stop_pc, 0);
-
   if (ecs->sal.line == 0)
     {
       /* We have no line number information.  That means to stop
@@ -2687,20 +2759,13 @@ insert_step_resume_breakpoint_at_sal (struct symtab_and_line sr_sal,
   if (breakpoints_inserted)
     insert_breakpoints ();
 }
-                                     
-/* Insert a "step resume breakpoint" at RETURN_FRAME.pc.  This is used
-   to skip a function (next, skip-no-debug) or signal.  It's assumed
-   that the function/signal handler being skipped eventually returns
-   to the breakpoint inserted at RETURN_FRAME.pc.
 
-   For the skip-function case, the function may have been reached by
-   either single stepping a call / return / signal-return instruction,
-   or by hitting a breakpoint.  In all cases, the RETURN_FRAME belongs
-   to the skip-function's caller.
+/* Insert a "step resume breakpoint" at RETURN_FRAME.pc.  This is used
+   to skip a potential signal handler.
 
-   For the signals case, this is called with the interrupted
-   function's frame.  The signal handler, when it returns, will resume
-   the interrupted function at RETURN_FRAME.pc.  */
+   This is called with the interrupted function's frame.  The signal
+   handler, when it returns, will resume the interrupted function at
+   RETURN_FRAME.pc.  */
 
 static void
 insert_step_resume_breakpoint_at_frame (struct frame_info *return_frame)
@@ -2715,6 +2780,38 @@ insert_step_resume_breakpoint_at_frame (struct frame_info *return_frame)
   insert_step_resume_breakpoint_at_sal (sr_sal, get_frame_id (return_frame));
 }
 
+/* Similar to insert_step_resume_breakpoint_at_frame, except
+   but a breakpoint at the previous frame's PC.  This is used to
+   skip a function after stepping into it (for "next" or if the called
+   function has no debugging information).
+
+   The current function has almost always been reached by single
+   stepping a call or return instruction.  NEXT_FRAME belongs to the
+   current function, and the breakpoint will be set at the caller's
+   resume address.
+
+   This is a separate function rather than reusing
+   insert_step_resume_breakpoint_at_frame in order to avoid
+   get_prev_frame, which may stop prematurely (see the implementation
+   of frame_unwind_id for an example).  */
+
+static void
+insert_step_resume_breakpoint_at_caller (struct frame_info *next_frame)
+{
+  struct symtab_and_line sr_sal;
+
+  /* We shouldn't have gotten here if we don't know where the call site
+     is.  */
+  gdb_assert (frame_id_p (frame_unwind_id (next_frame)));
+
+  init_sal (&sr_sal);          /* initialize to zeros */
+
+  sr_sal.pc = ADDR_BITS_REMOVE (frame_pc_unwind (next_frame));
+  sr_sal.section = find_pc_overlay (sr_sal.pc);
+
+  insert_step_resume_breakpoint_at_sal (sr_sal, frame_unwind_id (next_frame));
+}
+
 static void
 stop_stepping (struct execution_control_state *ecs)
 {
@@ -2841,7 +2938,9 @@ print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info)
          operation for n > 1 */
       if (!step_multi || !stop_step)
        if (ui_out_is_mi_like_p (uiout))
-         ui_out_field_string (uiout, "reason", "end-stepping-range");
+         ui_out_field_string
+           (uiout, "reason",
+            async_reason_lookup (EXEC_ASYNC_END_STEPPING_RANGE));
       break;
     case BREAKPOINT_HIT:
       /* We found a breakpoint. */
@@ -2851,7 +2950,9 @@ print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info)
       /* The inferior was terminated by a signal. */
       annotate_signalled ();
       if (ui_out_is_mi_like_p (uiout))
-       ui_out_field_string (uiout, "reason", "exited-signalled");
+       ui_out_field_string
+         (uiout, "reason",
+          async_reason_lookup (EXEC_ASYNC_EXITED_SIGNALLED));
       ui_out_text (uiout, "\nProgram terminated with signal ");
       annotate_signal_name ();
       ui_out_field_string (uiout, "signal-name",
@@ -2871,7 +2972,8 @@ print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info)
       if (stop_info)
        {
          if (ui_out_is_mi_like_p (uiout))
-           ui_out_field_string (uiout, "reason", "exited");
+           ui_out_field_string (uiout, "reason", 
+                                async_reason_lookup (EXEC_ASYNC_EXITED));
          ui_out_text (uiout, "\nProgram exited with code ");
          ui_out_field_fmt (uiout, "exit-code", "0%o",
                            (unsigned int) stop_info);
@@ -2880,9 +2982,13 @@ print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info)
       else
        {
          if (ui_out_is_mi_like_p (uiout))
-           ui_out_field_string (uiout, "reason", "exited-normally");
+           ui_out_field_string
+             (uiout, "reason",
+              async_reason_lookup (EXEC_ASYNC_EXITED_NORMALLY));
          ui_out_text (uiout, "\nProgram exited normally.\n");
        }
+      /* Support the --return-child-result option.  */
+      return_child_result_value = stop_info;
       break;
     case SIGNAL_RECEIVED:
       /* Signal received. The signal table tells us to print about
@@ -2891,7 +2997,8 @@ print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info)
       ui_out_text (uiout, "\nProgram received signal ");
       annotate_signal_name ();
       if (ui_out_is_mi_like_p (uiout))
-       ui_out_field_string (uiout, "reason", "signal-received");
+       ui_out_field_string
+         (uiout, "reason", async_reason_lookup (EXEC_ASYNC_SIGNAL_RECEIVED));
       ui_out_field_string (uiout, "signal-name",
                           target_signal_to_name (stop_info));
       annotate_signal_name_end ();
@@ -2986,6 +3093,12 @@ Further execution is probably impossible.\n"));
 
   target_terminal_ours ();
 
+  /* Set the current source location.  This will also happen if we
+     display the frame below, but the current SAL will be incorrect
+     during a user hook-stop function.  */
+  if (target_has_stack && !stop_stack_dummy)
+    set_current_sal_from_frame (get_current_frame (), 1);
+
   /* Look up the hook_stop and run it (CLI internally handles problem
      of stop_command's pre-hook not existing).  */
   if (stop_command)
@@ -3845,7 +3958,7 @@ Set inferior debugging."), _("\
 Show inferior debugging."), _("\
 When non-zero, inferior specific debugging is enabled."),
                            NULL,
-                           NULL, /* FIXME: i18n: */
+                           show_debug_infrun,
                            &setdebuglist, &showdebuglist);
 
   numsigs = (int) TARGET_SIGNAL_LAST;
@@ -3895,7 +4008,6 @@ When non-zero, inferior specific debugging is enabled."),
   signal_stop[TARGET_SIGNAL_CANCEL] = 0;
   signal_print[TARGET_SIGNAL_CANCEL] = 0;
 
-#ifdef SOLIB_ADD
   add_setshow_zinteger_cmd ("stop-on-solib-events", class_support,
                            &stop_on_solib_events, _("\
 Set stopping for shared library events."), _("\
@@ -3904,9 +4016,8 @@ If nonzero, gdb will give control to the user when the dynamic linker\n\
 notifies gdb of shared library events.  The most common event of interest\n\
 to the user would be loading/unloading of a new library."),
                            NULL,
-                           NULL, /* FIXME: i18n: */
+                           show_stop_on_solib_events,
                            &setlist, &showlist);
-#endif
 
   add_setshow_enum_cmd ("follow-fork-mode", class_run,
                        follow_fork_mode_kind_names,
@@ -3919,7 +4030,7 @@ A fork or vfork creates a new process.  follow-fork-mode can be:\n\
 The unfollowed process will continue to run.\n\
 By default, the debugger will follow the parent process."),
                        NULL,
-                       NULL, /* FIXME: i18n: */
+                       show_follow_fork_mode_string,
                        &setlist, &showlist);
 
   add_setshow_enum_cmd ("scheduler-locking", class_run, 
@@ -3932,7 +4043,7 @@ step == scheduler locked during every single-step operation.\n\
        In this mode, no other thread may run during a step command.\n\
        Other threads may run while stepping over a function call ('next')."), 
                        set_schedlock_func,     /* traps on target vector */
-                       NULL, /* FIXME: i18n: */
+                       show_scheduler_mode,
                        &setlist, &showlist);
 
   add_setshow_boolean_cmd ("step-mode", class_run, &step_stop_if_no_debug, _("\
@@ -3942,7 +4053,7 @@ When set, doing a step over a function without debug line information\n\
 will stop at the first instruction of that function. Otherwise, the\n\
 function is skipped and the step command stops at a different source line."),
                           NULL,
-                          NULL, /* FIXME: i18n: */
+                          show_step_stop_if_no_debug,
                           &setlist, &showlist);
 
   /* ptid initializations */
This page took 0.033125 seconds and 4 git commands to generate.