sim/moxie/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sat, 27 Feb 2010 01:24:37 +0000 (01:24 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sat, 27 Feb 2010 01:24:37 +0000 (01:24 +0000)
* interp.c (sim_create_inferior): Fix crashes on zero PROG_BFD or ARGV.

sim/moxie/ChangeLog
sim/moxie/interp.c

index c2c1c659fd42ead5575dd4b4c5b7f440cd3c6e55..043927d2b95bf9f5d381d04c4dea321f0affd568 100644 (file)
@@ -1,3 +1,7 @@
+2010-02-27  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * interp.c (sim_create_inferior): Fix crashes on zero PROG_BFD or ARGV.
+
 2010-02-03  Anthony Green  <green@moxielogic.com>
 
        * interp.c (sim_resume): nop is 0x0f, and 0x00 is an illegal
index a608416eb4adc73e59efb4c4a4017c0ee34d1565..079ef9b1fff5b264d3ad6f02add780e49b63daee 100644 (file)
@@ -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:
This page took 0.02464 seconds and 4 git commands to generate.