[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180801144425.GB6022@kermit-br-ibm-com>
Date: Wed, 1 Aug 2018 11:44:25 -0300
From: Murilo Opsfelder Araujo <muriloo@...ux.ibm.com>
To: Segher Boessenkool <segher@...nel.crashing.org>
Cc: Joe Perches <joe@...ches.com>,
Christophe LEROY <christophe.leroy@....fr>,
linux-kernel@...r.kernel.org, Michael Neuling <mikey@...ling.org>,
Simon Guo <wei.guo.simon@...il.com>,
Nicholas Piggin <npiggin@...il.com>,
Paul Mackerras <paulus@...ba.org>,
"Eric W . Biederman" <ebiederm@...ssion.com>,
Andrew Donnellan <andrew.donnellan@....ibm.com>,
"Alastair D'Silva" <alastair@...ilva.org>,
Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>,
linuxppc-dev@...ts.ozlabs.org, Cyril Bur <cyrilbur@...il.com>,
"Tobin C . Harding" <me@...in.cc>
Subject: Re: [PATCH v3 5/9] powerpc/traps: Print signal name for unhandled
signals
Hi, Segher.
On Wed, Aug 01, 2018 at 02:49:03AM -0500, Segher Boessenkool wrote:
> On Wed, Aug 01, 2018 at 12:03:50AM -0700, Joe Perches wrote:
> > On Wed, 2018-08-01 at 08:37 +0200, Christophe LEROY wrote:
> > > Le 31/07/2018 à 16:50, Murilo Opsfelder Araujo a écrit :
> > > I would suggest to instead use a function like this:
> > >
> > > static const char *signame(int signr)
> > > {
> > > if (signr == SIGBUS)
> > > return "bus error";
> > > if (signr == SIGFPE)
> > > return "floating point exception";
> > > if (signr == SIGILL)
> > > return "illegal instruction";
> > > if (signr == SIGILL)
> > > return "segfault";
> > > if (signr == SIGTRAP)
> > > return "unhandled trap";
> > > return "unknown signal";
> > > }
> >
> > trivia:
> >
> > Unless the if tests are ordered most to least likely,
> > perhaps it would be better to use a switch/case and
> > let the compiler decide.
>
> That would also show there are two entries for SIGILL (here and in the
> original patch), one of them very wrong.
Good catch. I'll take care of that in my next respin.
> Check the table with psignal or something?
Nice suggestion. Thanks!
Cheers
Murilo
Powered by blists - more mailing lists