Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] [sim/moxie] Fix NULL dereferences
@ 2010-02-26 12:47 Jan Kratochvil
  2010-02-27  1:04 ` Anthony Green
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2010-02-26 12:47 UTC (permalink / raw)
  To: gdb-patches; +Cc: Anthony Green

Hi,

it looks as obvious to me but I know nothina about either sim or moxie.


Thanks,
Jan


This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=moxie-unknown-elf".
./gdb -nx -ex 'target sim' -ex r 
= crash

2010-02-26  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* interp.c (sim_create_inferior): Fix crashes on zero PROG_BFD or ARGV.

--- 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:


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-27  1:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-26 12:47 [patch] [sim/moxie] Fix NULL dereferences Jan Kratochvil
2010-02-27  1:04 ` Anthony Green
2010-02-27  1:29   ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox