This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] infcmd.c (attach_command): Assert args is not null.
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Michael Snyder <msnyder at vmware dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Mon, 7 Mar 2011 14:24:04 +0400
- Subject: Re: [RFA] infcmd.c (attach_command): Assert args is not null.
- References: <4D716EEE.406@vmware.com>
> 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