This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2] Add convenience variable $_exitsignal
- From: Pedro Alves <palves at redhat dot com>
- To: Sergio Durigan Junior <sergiodj at redhat dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>, Eli Zaretskii <eliz at gnu dot org>, Doug Evans <dje at google dot com>, Pedro Alves <palves at redhat dot com>
- Date: Wed, 19 Jun 2013 11:40:18 +0100
- Subject: Re: [PATCH v2] Add convenience variable $_exitsignal
- References: <m3ehbzqmsn dot fsf at redhat dot com>
On 06/18/2013 07:46 PM, Sergio Durigan Junior wrote:
> Hi,
>
> This is the second version of the patch which adds the convenience
> variable "$_exitsignal". You can look at the first version here:
>
> <http://sourceware.org/ml/gdb-patches/2013-06/msg00352.html>
>
> I have made the proposed modifications suggested by Eli, Doug and
> Pedro.
>
> Doug, please take a look at tell me what you think. Eli, I have
> rewritten the doc entry for $_exitcode in order to make it explain which
> variable is set and which is cleared depending on the situation. And
> Pedro, I've made the test more complete.
Thanks.
> OK to apply?
Hmm. This is still exposing the GDB signal numbers instead of the target's?
> diff --git a/gdb/testsuite/gdb.base/exitsignal.c b/gdb/testsuite/gdb.base/exitsignal.c
> new file mode 100644
> index 0000000..d2b479b
> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/exitsignal.c
> @@ -0,0 +1,37 @@
...
> + You should have received a copy of the GNU General Public License
> + along with this program. If not, see <http://www.gnu.org/licenses/>.
> +
> +*/
Spurious empty line.
> +
> +/* This test can be used just to generate a SIGSEGV. */
> +
> +#include <stdio.h>
This include looks unnecessary.
> +
> +int
> +main (int argc, char *argv[])
> +{
> + char *p = NULL;
> +
> +#ifdef GENSEGV
> + /* Generating a SIGSEGV. */
> + *p = 1;
> +#else
> + /* Just do a normal return. */
> + (void) p;
> + return 0;
> +#endif
> +}
The amount of shared code between GENSEGV and !GENSEGV is
so little (just boilerplate), that I'd suggest just splitting
them into two files. Then the "This test can be used just
to generate a SIGSEGV" comment at the top wouldn't be
incorrect. :-)
> +
> +# Now we test the behaviour of $_exit{code,signal} during a normal
> +# inferior execution.
> +gdb_rename_execfile $binfile ${binfile}x
Please don't rename like this. Instead generate distinct executables
from the get go. See e.g., gdb.multi/multi-arch.exp.
> +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
> + return -1
> +}
--
Pedro Alves