[RFA] infcmd.c (attach_command): Assert args is not null.

Joel Brobecker brobecker@adacore.com
Mon Mar 7 10:39:00 GMT 2011


> 2011-03-04  Michael Snyder  <msnyder@vmware.com>
> 
> 	* infcmd.c (attach_command): Assert args is not null.

Again, not a specialist, so handle with care.

But this does not seem right to me. In fact, I think we may have
a real bug, but that it might not be visible (we would need a target
where the "to_attach" method accept no argument).

The other thing I noticed is that attach_command_continuation,
or rather the function that it stubs attach_command_post_wait,
does not use the "args" parameter at all.  Should we just drop
this argument altogether?

> Index: infcmd.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/infcmd.c,v
> retrieving revision 1.278
> diff -u -p -u -p -r1.278 infcmd.c
> --- infcmd.c	28 Feb 2011 23:37:07 -0000	1.278
> +++ infcmd.c	4 Mar 2011 22:56:22 -0000
> @@ -2506,6 +2506,7 @@ attach_command (char *args, int from_tty
>  	  /* sync_execution mode.  Wait for stop.  */
>  	  struct attach_command_continuation_args *a;
>  
> +	  gdb_assert (args);
>  	  a = xmalloc (sizeof (*a));
>  	  a->args = xstrdup (args);
>  	  a->from_tty = from_tty;


-- 
Joel



More information about the Gdb-patches mailing list