Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Luis Machado <lgustavo@codesourcery.com>
To: "'gdb-patches@sourceware.org'" <gdb-patches@sourceware.org>
Subject: [PATCH, gdbsim] Avoid silly crash when no binary is loaded
Date: Tue, 18 Jun 2013 21:09:00 -0000	[thread overview]
Message-ID: <51C0C7E3.1030603@codesourcery.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 302 bytes --]

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

[-- Attachment #2: sim_crash.diff --]
[-- Type: text/x-patch, Size: 764 bytes --]

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",

             reply	other threads:[~2013-06-18 20:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-18 21:09 Luis Machado [this message]
2013-06-19 11:43 ` Pedro Alves
2013-06-19 12:20   ` Luis Machado
2013-06-19 14:53     ` Pedro Alves
2013-06-19 15:20       ` Luis Machado
2013-06-20 13:39         ` Luis Machado
2013-06-20 17:50     ` Mike Frysinger
2013-06-20 18:34       ` Pedro Alves
2013-06-20 21:33       ` Stan Shebs
2013-06-20 22:00         ` Mike Frysinger
2013-06-21 10:58           ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51C0C7E3.1030603@codesourcery.com \
    --to=lgustavo@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox