summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2012-10-26 18:48:42 +0000
committerPedro Alves <palves@redhat.com>2012-10-26 18:48:42 +0000
commit01d04876ef93141d981285bafc903f66ab8e63ab (patch)
tree66b05d91034425ab491009a6925acd0bba7b3892 /gdb
parent5e448a3dd1172ef068256dbccad2574af8d5b666 (diff)
downloadgdb-01d04876ef93141d981285bafc903f66ab8e63ab.tar.gz
2012-10-26 Pedro Alves <palves@redhat.com>
* infrun.c (handle_inferior_event) <TARGET_WAITKIND_SIGNALLED>: Remove comment.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/infrun.c51
2 files changed, 30 insertions, 27 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e717353f996..fb6c9902919 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2012-10-26 Pedro Alves <palves@redhat.com>
+ * infrun.c (handle_inferior_event): Merge handling of
+ TARGET_WAITKIND_EXITED and TARGET_WAITKIND_SIGNALLED into a single
+ switch case.
+
+2012-10-26 Pedro Alves <palves@redhat.com>
+
* infrun.c (handle_inferior_event) <TARGET_WAITKIND_SIGNALLED>:
Remove comment.
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 54794867260..d79c6bd1b3e 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3370,23 +3370,38 @@ handle_inferior_event (struct execution_control_state *ecs)
return;
case TARGET_WAITKIND_EXITED:
+ case TARGET_WAITKIND_SIGNALLED:
if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_EXITED\n");
+ {
+ if (ecs->ws.kind == TARGET_WAITKIND_EXITED)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: TARGET_WAITKIND_EXITED\n");
+ else
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: TARGET_WAITKIND_SIGNALLED\n");
+ }
+
inferior_ptid = ecs->ptid;
set_current_inferior (find_inferior_pid (ptid_get_pid (ecs->ptid)));
set_current_program_space (current_inferior ()->pspace);
handle_vfork_child_exec_or_exit (0);
target_terminal_ours (); /* Must do this before mourn anyway. */
- print_exited_reason (ecs->ws.value.integer);
- /* Record the exit code in the convenience variable $_exitcode, so
- that the user can inspect this again later. */
- set_internalvar_integer (lookup_internalvar ("_exitcode"),
- (LONGEST) ecs->ws.value.integer);
+ if (ecs->ws.kind == TARGET_WAITKIND_EXITED)
+ {
+ /* Record the exit code in the convenience variable $_exitcode, so
+ that the user can inspect this again later. */
+ set_internalvar_integer (lookup_internalvar ("_exitcode"),
+ (LONGEST) ecs->ws.value.integer);
+
+ /* Also record this in the inferior itself. */
+ current_inferior ()->has_exit_code = 1;
+ current_inferior ()->exit_code = (LONGEST) ecs->ws.value.integer;
- /* Also record this in the inferior itself. */
- current_inferior ()->has_exit_code = 1;
- current_inferior ()->exit_code = (LONGEST) ecs->ws.value.integer;
+ print_exited_reason (ecs->ws.value.integer);
+ }
+ else
+ print_signal_exited_reason (ecs->ws.value.sig);
gdb_flush (gdb_stdout);
target_mourn_inferior ();
@@ -3396,24 +3411,6 @@ handle_inferior_event (struct execution_control_state *ecs)
stop_stepping (ecs);
return;
- case TARGET_WAITKIND_SIGNALLED:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_SIGNALLED\n");
- inferior_ptid = ecs->ptid;
- set_current_inferior (find_inferior_pid (ptid_get_pid (ecs->ptid)));
- set_current_program_space (current_inferior ()->pspace);
- handle_vfork_child_exec_or_exit (0);
- stop_print_frame = 0;
- target_terminal_ours (); /* Must do this before mourn anyway. */
-
- target_mourn_inferior ();
-
- print_signal_exited_reason (ecs->ws.value.sig);
- singlestep_breakpoints_inserted_p = 0;
- cancel_single_step_breakpoints ();
- stop_stepping (ecs);
- return;
-
/* The following are the only cases in which we keep going;
the above cases end in a continue or goto. */
case TARGET_WAITKIND_FORKED: