This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] sim: common: add basic model assert
- From: Michael Frysinger <vapier at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 21 Jun 2015 17:56:52 -0000
- Subject: [binutils-gdb] sim: common: add basic model assert
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ccd4b2953bb039e91b301a616c5f7c6f542b6b10
commit ccd4b2953bb039e91b301a616c5f7c6f542b6b10
Author: Mike Frysinger <vapier@gentoo.org>
Date: Sat Jun 20 15:21:26 2015 +0545
sim: common: add basic model assert
If the configured in default doesn't match a known value, throw an
assertion failure rather than segfaulting deeper down.
Diff:
---
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 <vapier@gentoo.org>
+ * sim-model.c (sim_model_init): Assert model is not NULL.
+
+2015-06-21 Mike Frysinger <vapier@gentoo.org>
+
* 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);
}