gdb: sim: check return value of sim_create_inferior
authorMike Frysinger <vapier@gentoo.org>
Thu, 16 Feb 2012 18:30:43 +0000 (18:30 +0000)
committerMike Frysinger <vapier@gentoo.org>
Thu, 16 Feb 2012 18:30:43 +0000 (18:30 +0000)
The current gdbsim_create_inferior func doesn't check the return value
of sim_create_inferior which can be problematic when that func doesn't
return success.  So, if it fails, call error() and be done.

Reported-by: Richard Stuckey <richard.stuckey@arc.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
gdb/ChangeLog
gdb/remote-sim.c

index 66faf85bc42ea818fa67c1bcb59402b8c28a6465..261b54eefe74fb36d6da40db6fb271acc8f9cf9d 100644 (file)
@@ -1,3 +1,9 @@
+2012-02-16  Mike Frysinger  <vapier@gentoo.org>
+
+       PR gdb/9734:
+       * remote-sim.c (gdbsim_create_inferior): Call error() when
+       sim_create_inferior() fails.
+
 2012-02-16  Josh Matthews  <josh@joshmatthews.net>
 
        * machoread.c: Initialize nbr_syms to avoid warnings-as-errors failure.
index 2a586e5e80ee4e44d1291f7bd3e7957358351e8e..ee73cce47c5285bbe327955faa3676af9a27328c 100644 (file)
@@ -641,7 +641,10 @@ gdbsim_create_inferior (struct target_ops *target, char *exec_file, char *args,
     }
   else
     argv = NULL;
-  sim_create_inferior (sim_data->gdbsim_desc, exec_bfd, argv, env);
+
+  if (sim_create_inferior (sim_data->gdbsim_desc, exec_bfd, argv, env)
+      != SIM_RC_OK)
+    error (_("Unable to create sim inferior."));
 
   inferior_ptid = sim_data->remote_sim_ptid;
   inferior_appeared (current_inferior (), ptid_get_pid (inferior_ptid));