This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, gdbsim] Avoid silly crash when no binary is loaded


Hi,

This patch prevents the long-standing crash scenario where we start gdbsim and "run" without any binaries. Warnings are issued, but those don't prevent the simulator from proceeding with garbage data.

Replacing those warnings with error calls seems to be the most appropriate here.

Ok?

Luis
2013-06-18  Luis Machado  <lgustavo@codesourcery.com>

	* remote-sim.c (gdbsim_create_inferior): Replace warnings with
	errors when no program is loaded.

diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index fda3735..c04ce01 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -612,9 +612,9 @@ gdbsim_create_inferior (struct target_ops *target, char *exec_file, char *args,
   char *arg_buf, **argv;
 
   if (exec_file == 0 || exec_bfd == 0)
-    warning (_("No executable file specified."));
+    error (_("No executable file specified."));
   if (!sim_data->program_loaded)
-    warning (_("No program loaded."));
+    error (_("No program loaded."));
 
   if (remote_debug)
     printf_filtered ("gdbsim_create_inferior: exec_file \"%s\", args \"%s\"\n",

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]