From bc56c8fa67fd067d8082ec0813f18269bca434f1 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sat, 27 Feb 2010 01:24:37 +0000 Subject: [PATCH] sim/moxie/ * interp.c (sim_create_inferior): Fix crashes on zero PROG_BFD or ARGV. --- sim/moxie/ChangeLog | 4 ++++ sim/moxie/interp.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sim/moxie/ChangeLog b/sim/moxie/ChangeLog index c2c1c659fd4..043927d2b95 100644 --- a/sim/moxie/ChangeLog +++ b/sim/moxie/ChangeLog @@ -1,3 +1,7 @@ +2010-02-27 Jan Kratochvil + + * interp.c (sim_create_inferior): Fix crashes on zero PROG_BFD or ARGV. + 2010-02-03 Anthony Green * interp.c (sim_resume): nop is 0x0f, and 0x00 is an illegal diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c index a608416eb4a..079ef9b1fff 100644 --- a/sim/moxie/interp.c +++ b/sim/moxie/interp.c @@ -1307,11 +1307,12 @@ sim_create_inferior (sd, prog_bfd, argv, env) set_initial_gprs (); issue_messages = l; - cpu.asregs.regs[PC_REGNO] = bfd_get_start_address (prog_bfd); + if (prog_bfd != NULL) + cpu.asregs.regs[PC_REGNO] = bfd_get_start_address (prog_bfd); /* Copy args into target memory. */ avp = argv; - for (argc = 0; *avp; avp++) + for (argc = 0; avp && *avp; avp++) argc++; /* Target memory looks like this: -- 2.30.2