sim/arm: Prevent crash when running sim with no binary.

Message ID 52703D0D.7060304@linaro.org
State Accepted
Headers show

Commit Message

Will Newton Oct. 29, 2013, 10:56 p.m.
2013-10-30  Will Newton  <will.newton@linaro.org>

	PR gdb/15508
	* arm/wrapper.c (sim_create_inferior): Call init before
	accessing STATE.
---
 sim/arm/wrapper.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Tom Tromey Nov. 7, 2013, 3:20 p.m. | #1
>>>>> "Will" == Will Newton <will.newton@linaro.org> writes:

Will> 2013-10-30  Will Newton  <will.newton@linaro.org>

Will> 	PR gdb/15508
Will> 	* arm/wrapper.c (sim_create_inferior): Call init before
Will> 	accessing STATE.

Ok.

Tom

Patch

diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index cf10e78..b7bf400 100644
--- a/sim/arm/wrapper.c
+++ b/sim/arm/wrapper.c
@@ -243,6 +243,8 @@  sim_create_inferior (sd, abfd, argv, env)
   int mach;
   char **arg;

+  init ();
+
   if (abfd != NULL)
     {
       ARMul_SetPC (state, bfd_get_start_address (abfd));