Don't store the inferior's exit code for --return-child-result in a print routine.
authorPedro Alves <palves@redhat.com>
Thu, 27 Mar 2014 13:13:59 +0000 (13:13 +0000)
committerPedro Alves <palves@redhat.com>
Thu, 22 May 2014 11:08:09 +0000 (12:08 +0100)
A small cleanup - so we can call the print routine without affecting
--return-child-result.

gdb/
2014-05-22  Pedro Alves  <palves@redhat.com>

* infrun.c (handle_inferior_event): Store the exit code for
--return-child-result here, instead of ...
(print_exited_reason): ... here.

gdb/ChangeLog
gdb/infrun.c

index f64a48b55d56395ca358d9555d17771fb3d7b97b..4e65bdbdcaaa1b52ae4125089b38bd3778518f07 100644 (file)
@@ -1,3 +1,9 @@
+2014-05-22  Pedro Alves  <palves@redhat.com>
+
+       * infrun.c (handle_inferior_event): Store the exit code for
+       --return-child-result here, instead of ...
+       (print_exited_reason): ... here.
+
 2014-05-21  Pedro Alves  <palves@redhat.com>
 
        PR gdb/13860
index 9ec236395097abc4db138d7a19722fe6023ff63b..6d0bfd8c25842c1af0273fb19248d48bb1d603fa 100644 (file)
@@ -3524,6 +3524,9 @@ handle_inferior_event (struct execution_control_state *ecs)
          current_inferior ()->has_exit_code = 1;
          current_inferior ()->exit_code = (LONGEST) ecs->ws.value.integer;
 
+         /* Support the --return-child-result option.  */
+         return_child_result_value = ecs->ws.value.integer;
+
          print_exited_reason (ecs->ws.value.integer);
        }
       else
@@ -5971,8 +5974,6 @@ print_exited_reason (int exitstatus)
       ui_out_text (uiout, pidstr);
       ui_out_text (uiout, ") exited normally]\n");
     }
-  /* Support the --return-child-result option.  */
-  return_child_result_value = exitstatus;
 }
 
 /* Signal received, print why the inferior has stopped.  The signal table