aboutsummaryrefslogtreecommitdiff
path: root/sim/moxie/interp.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-02-27 01:24:37 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-02-27 01:24:37 +0000
commitbc56c8fa67fd067d8082ec0813f18269bca434f1 (patch)
tree1780b76aa606ea7ce6d5dd5e9af4ea7e246cf0fb /sim/moxie/interp.c
parentc3e4ae2903ff58e2a9f4efc9d0d5159839c1c1ed (diff)
downloadgdb-bc56c8fa67fd067d8082ec0813f18269bca434f1.zip
gdb-bc56c8fa67fd067d8082ec0813f18269bca434f1.tar.gz
gdb-bc56c8fa67fd067d8082ec0813f18269bca434f1.tar.bz2
sim/moxie/
* interp.c (sim_create_inferior): Fix crashes on zero PROG_BFD or ARGV.
Diffstat (limited to 'sim/moxie/interp.c')
-rw-r--r--sim/moxie/interp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c
index a608416..079ef9b 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: