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

* Re: [patch] [sim/moxie] Fix NULL dereferences
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Anthony Green @ 2010-02-27  1:04 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

On 2/26/2010 7:47 AM, Jan Kratochvil wrote:
> Hi,
>
> it looks as obvious to me but I know nothina about either sim or moxie.
>    

Thanks, please apply this if you haven't already.

AG


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

* Re: [patch] [sim/moxie] Fix NULL dereferences
  2010-02-27  1:04 ` Anthony Green
@ 2010-02-27  1:29   ` Jan Kratochvil
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kratochvil @ 2010-02-27  1:29 UTC (permalink / raw)
  To: Anthony Green; +Cc: gdb-patches

On Sat, 27 Feb 2010 02:04:12 +0100, Anthony Green wrote:
> Thanks, please apply this if you haven't already.

Checked-in:
	http://sourceware.org/ml/gdb-cvs/2010-02/msg00215.html

Checked-in for gdb_7_1-branch as regression risk free:
	http://sourceware.org/ml/gdb-cvs/2010-02/msg00216.html


Thanks,
Jan


^ 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