Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hans-Peter Nilsson <hans-peter.nilsson@axis.com>
To: vapier@gentoo.org
Cc: gdb-patches@sourceware.org
Subject: Re: Please fix regressions from your sim changes
Date: Tue, 20 Mar 2012 05:55:00 -0000	[thread overview]
Message-ID: <201203200554.q2K5sRwJ007822@ignucius.se.axis.com> (raw)
In-Reply-To: <201203192230.21867.vapier@gentoo.org> (message from Mike	Frysinger on Tue, 20 Mar 2012 03:30:20 +0100)

> From: Mike Frysinger <vapier@gentoo.org>
> Date: Tue, 20 Mar 2012 03:30:20 +0100

> you can see the commit in question clearly doesn't remove the msg:
> --- a/sim/common/nrun.c
> +++ b/sim/common/nrun.c
> -	fprintf (stderr, "program stopped with signal %d.\n", sigrc);
> +	fprintf (stderr, "program stopped with signal %d (%s).\n", sigrc,
> +		strsignal (sigrc));

When paying attention, I see nrun.c:1.16 is missing an #include
to declare it.  See below.

> maybe strsignal() is crashing ?

Yes:
chimera-7:hp:/tmp/hpautotest-sim/cris-elf/sim/testsuite: /tmp/hpautotest-sim/cris-elf/sim/cris/run     addqpc.ms.x
General register read of PC is not implemented.
zsh: segmentation fault  /tmp/hpautotest-sim/cris-elf/sim/cris/run addqpc.ms.x

And in the build-log I see:
gcc -DHAVE_CONFIG_H   -DWITH_DEFAULT_MODEL='"crisv32"'  -DPROFILE=1 -DWITH_PROFILE=-1   -DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT   -DWITH_ENVIRONMENT=ALL_ENVIRONMENT  -DWITH_HW=0 -DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN     -DWITH_SCACHE=16384   -Wimplicit -Wreturn-type -Wcomment -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith -Wuninitialized       -I. -I/tmp/r/sim/cris -I../common -I/tmp/r/sim/cris/../common -I../../include -I/tmp/r/sim/cris/../../include -I../../bfd -I/tmp/r/sim/cris/../../bfd -I../../opcodes -I/tmp/r/sim/cris/../../opcodes  -g -O2 -c -o nrun.o -MT nrun.o -MMD -MP -MF .deps/nrun.Tpo /tmp/r/sim/cris/../common/nrun.c
/tmp/r/sim/cris/../common/nrun.c: In function 'main':
/tmp/r/sim/cris/../common/nrun.c:206: warning: implicit declaration of function 'strsignal'
/tmp/r/sim/cris/../common/nrun.c:206: warning: format '%s' expects type 'char *', but argument 4 has type 'int'

Don't you see that warning?
Are you on a ILP32 host such as i686-linux-gnu, i.e.
sizeof (char *) == sizeof(int)?

It seems nowhere is there an include of string.h (just
pre-existing signal.h), see strerror(3). (TFM, not SIGQUIT :)
What was missing from your patch introducing the strsignal call,
is *not* the single obvious #define and #include.

Instead, to #define _GNU_SOURCE in the Right Way AFAIK, there
should be an AC_GNU_SOURCE (missing) in a configure.* used by
all src/sim/* (common/configure.ac AFAICT), and an #include
"cconfig.h" in nrun.c followed later by the mantra:

#ifdef HAVE_STRING_H
#include <string.h>
#else
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#endif

Or shorter, see run.c for how nrun.c needs to be.

And right, it's time to add -Wall -Werror to the sim compilation
options...

BTW, your testsuite fixes are both approved and obvious.

brgds, H-P


  reply	other threads:[~2012-03-20  5:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19  6:29 Hans-Peter Nilsson
2012-03-19 17:23 ` Mike Frysinger
2012-03-19 23:51   ` Hans-Peter Nilsson
2012-03-20  2:30     ` Mike Frysinger
2012-03-20  5:55       ` Hans-Peter Nilsson [this message]
2012-03-20 16:16         ` Mike Frysinger
2012-03-20 16:30           ` Hans-Peter Nilsson
2012-03-23  4:23             ` Mike Frysinger
2012-03-21  4:49   ` Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201203200554.q2K5sRwJ007822@ignucius.se.axis.com \
    --to=hans-peter.nilsson@axis.com \
    --cc=gdb-patches@sourceware.org \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox