From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25819 invoked by alias); 18 Jun 2013 20:49:46 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 25810 invoked by uid 89); 18 Jun 2013 20:49:46 -0000 X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL autolearn=ham version=3.3.1 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 18 Jun 2013 20:49:45 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1Up2qV-0006JB-Gw from Luis_Gustavo@mentor.com for gdb-patches@sourceware.org; Tue, 18 Jun 2013 13:49:43 -0700 Received: from NA1-MAIL.mgc.mentorg.com ([147.34.98.181]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 18 Jun 2013 13:49:43 -0700 Received: from [172.30.14.165] ([172.30.14.165]) by NA1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 18 Jun 2013 13:49:42 -0700 Message-ID: <51C0C7E3.1030603@codesourcery.com> Date: Tue, 18 Jun 2013 21:09:00 -0000 From: Luis Machado Reply-To: lgustavo@codesourcery.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: "'gdb-patches@sourceware.org'" Subject: [PATCH, gdbsim] Avoid silly crash when no binary is loaded Content-Type: multipart/mixed; boundary="------------070500090007080608020003" X-Virus-Found: No X-SW-Source: 2013-06/txt/msg00464.txt.bz2 This is a multi-part message in MIME format. --------------070500090007080608020003 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 302 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 --------------070500090007080608020003 Content-Type: text/x-patch; name="sim_crash.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="sim_crash.diff" Content-length: 764 2013-06-18 Luis Machado * 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", --------------070500090007080608020003--