From patchwork Sun Jun 21 17:56:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 7278 Received: (qmail 64073 invoked by alias); 21 Jun 2015 17:56:46 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 64027 invoked by uid 89); 21 Jun 2015 17:56:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: smtp.gentoo.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sun, 21 Jun 2015 17:56:44 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 9C89F340B7A for ; Sun, 21 Jun 2015 17:56:42 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: common: add basic model assert Date: Sun, 21 Jun 2015 13:56:41 -0400 Message-Id: <1434909401-6417-1-git-send-email-vapier@gentoo.org> X-IsSubscribed: yes If the configured in default doesn't match a known value, throw an assertion failure rather than segfaulting deeper down. Committed. --- sim/common/ChangeLog | 4 ++++ sim/common/sim-model.c | 1 + 2 files changed, 5 insertions(+) diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 30a121c..722ad98 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,5 +1,9 @@ 2015-06-21 Mike Frysinger + * sim-model.c (sim_model_init): Assert model is not NULL. + +2015-06-21 Mike Frysinger + * sim-types.h: Move SIM_TYPES_H define to top of file. Include stdint.h. Replace all signed/unsigned typedefs with int#_t and uint#_t. diff --git a/sim/common/sim-model.c b/sim/common/sim-model.c index a33bd2a..db5f323 100644 --- a/sim/common/sim-model.c +++ b/sim/common/sim-model.c @@ -204,6 +204,7 @@ sim_model_init (SIM_DESC sd) { /* Set the default model. */ const MODEL *model = sim_model_lookup (WITH_DEFAULT_MODEL); + SIM_ASSERT (model != NULL); sim_model_set (sd, NULL, model); }