public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Application receives SIGILL
@ 2013-03-13 10:33 OBD
  2013-03-13 11:50 ` Andrew Haley
  0 siblings, 1 reply; 4+ messages in thread
From: OBD @ 2013-03-13 10:33 UTC (permalink / raw)
  To: gcc-help

Hi,

I am trying to debug an issue with the AIX build of an open source
application. The code is working for Linux and Solaris and I am not
sure if we are doing something wrong or whether it is gcc which is
doing something wrong somewhere.

The troubling code is the following:

if(dp.isClosed()) {
                        string errorMessage = "Error opening directory
" + path + ": " +
                                strerror(errno);
                        throw FileFinderException(errorMessage);
                }



Throwing of exception is causing signal SIGILL (with the error
ILL_ILLOPC) to be sent to the application. If I remove the line where
we are throwing the exception the code works perfectly. I have tried
to debug it using gdb. Here is what I observed:

#############################GDB OUTPUT START##################################
FileFinderException::FileFinderException(std::string, int, Exception*)
(this=0x20aaf848, errMsgIn=
        {static npos = <optimized out>, _M_dataplus =
{<allocator<char>> = {<new_allocator<char>> = {<No data fields>}, <No
data fields>}, _M_p = 0x20aaf884 "Error op\ening dir\ectory
/hom\e/aahir\e: P\ermission d\eni\ed"}}, severity=10, ex=0x0) at
../../src/AbsFileFinder.cpp:556
556     FileFinderException::FileFinderException(string errMsgIn, int
severity, Exception* ex) : Exception(errMsgIn, severity, ex) {
(gdb) s
Exception::Exception(std::string, int, Exception*) (this=0x20aaf848, msgIn=
        {static npos = <optimized out>, _M_dataplus =
{<allocator<char>> = {<new_allocator<char>> = {<No data fields>}, <No
data fields>}, _M_p = 0x20aaf884 "Error op\ening dir\ectory
/hom\e/aahir\e: P\ermission d\eni\ed"}}, severityIn=10, ex=0x0) at
../../../ovaldi-common/Exception.cpp:38
38      Exception::Exception(string msgIn, int severityIn, Exception* ex) {
(gdb) s
47              this->SetSeverity(severityIn);
(gdb) s
Exception::SetSeverity(int) (this=0x20aaf848, severityIn=10) at
../../../ovaldi-common/Exception.cpp:127
127             this->severity = severityIn;
(gdb) s
128     }
(gdb)
Exception::Exception(std::string, int, Exception*) (this=0x20aaf848, msgIn=
        {static npos = <optimized out>, _M_dataplus =
{<allocator<char>> = {<new_allocator<char>> = {<No data fields>}, <No
data fields>}, _M_p = 0x20aaf884 "Error op\ening dir\ectory
/hom\e/aahir\e: P\ermission d\eni\ed"}}, severityIn=10, ex=0x0) at
../../../ovaldi-common/Exception.cpp:48
48              this->SetErrorMessage(msgIn);
(gdb) s
Exception::SetErrorMessage(std::string) (this=0x20aaf848, errorMessageIn=
        {static npos = <optimized out>, _M_dataplus =
{<allocator<char>> = {<new_allocator<char>> = {<No data fields>}, <No
data fields>}, _M_p = 0x20aaf884 "Error op\ening dir\ectory
/hom\e/aahir\e: P\ermission d\eni\ed"}}) at
../../../ovaldi-common/Exception.cpp:116
116             this->errorMessage = errorMessageIn;
(gdb) s
117     }
(gdb) s
Exception::Exception(std::string, int, Exception*) (this=0x20aaf848, msgIn=
        {static npos = <optimized out>, _M_dataplus =
{<allocator<char>> = {<new_allocator<char>> = {<No data fields>}, <No
data fields>}, _M_p = 0x20aaf884 "Error op\ening dir\ectory
/hom\e/aahir\e: P\ermission d\eni\ed"}}, severityIn=10, ex=0x0) at
../../../ovaldi-common/Exception.cpp:49
49              this->SetCause(ex);
(gdb) s
Exception::SetCause(Exception*) (this=0x20aaf848, ex=0x0) at
../../../ovaldi-common/Exception.cpp:105
105             this->cause = ex;
(gdb) s
106     }
(gdb) s
Exception::Exception(std::string, int, Exception*) (this=0x20aaf848, msgIn=
        {static npos = <optimized out>, _M_dataplus =
{<allocator<char>> = {<new_allocator<char>> = {<No data fields>}, <No
data fields>}, _M_p = 0x20aaf884 "Error op\ening dir\ectory
/hom\e/aahir\e: P\ermission d\eni\ed"}}, severityIn=10, ex=0x0) at
../../../ovaldi-common/Exception.cpp:53
53      }
(gdb) s
FileFinderException::FileFinderException(std::string, int, Exception*)
(this=0x20aaf848, errMsgIn=
        {static npos = <optimized out>, _M_dataplus =
{<allocator<char>> = {<new_allocator<char>> = {<No data fields>}, <No
data fields>}, _M_p = 0x200c8294 "\020\f$\004 \f\237\024"}},
severity=10, ex=0x0) at ../../src/AbsFileFinder.cpp:558
558     }
(gdb) s

Program received signal SIGILL, Illegal instruction.
0x00000000 in ?? ()
#############################GDB OUTPUT END##################################



The relevant code follows:

#############################CODE STARTS#####################################
class FileFinderException : public Exception {
        public:
                FileFinderException(std::string errMsgIn = "", int
severity = ERROR_FATAL, Exception* ex = NULL);
                ~FileFinderException();
};

FileFinderException::FileFinderException(string errMsgIn, int
severity, Exception* ex) : Exception(errMsgIn, severity, ex) {

}

FileFinderException::~FileFinderException() {

}

class FileFinderException : public Exception {
        public:
                FileFinderException(std::string errMsgIn = "", int
severity = ERROR_FATAL, Exception* ex = NULL);
                ~FileFinderException();
};

Exception::Exception(string msgIn, int severityIn, Exception* ex) {
        this->SetSeverity(severityIn);
        this->SetErrorMessage(msgIn);
        this->SetCause(ex);
}

void Exception::SetCause(Exception* ex)
{
        this->cause = ex;
}

void Exception::SetErrorMessage(string errorMessageIn)
{
        this->errorMessage = errorMessageIn;
}

void Exception::SetSeverity(int severityIn)
{
        this->severity = severityIn;
}


#############################CODE END#####################################



Can somebody help me what is the problem over here? I don't seem to
find any issue with the code.


-OBD

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Application receives SIGILL
  2013-03-13 10:33 Application receives SIGILL OBD
@ 2013-03-13 11:50 ` Andrew Haley
       [not found]   ` <CAOSwV8nTUpMkB38GD-N-YGA=xrYXp+EFxnbTQPSohT=6s6wqWA@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Haley @ 2013-03-13 11:50 UTC (permalink / raw)
  To: OBD; +Cc: gcc-help

On 03/13/2013 10:33 AM, OBD wrote:
> 
> Can somebody help me what is the problem over here? I don't seem to
> find any issue with the code.

What is the faulting insn?

x/i $pc

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Application receives SIGILL
       [not found]   ` <CAOSwV8nTUpMkB38GD-N-YGA=xrYXp+EFxnbTQPSohT=6s6wqWA@mail.gmail.com>
@ 2013-03-13 17:04     ` Andrew Haley
  2013-03-13 18:02       ` OBD
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Haley @ 2013-03-13 17:04 UTC (permalink / raw)
  To: OBD; +Cc: gcc-help

On 03/13/2013 05:01 PM, OBD wrote:
> 
> 
> On 13 March 2013 17:20, Andrew Haley <aph@redhat.com <mailto:aph@redhat.com>> wrote:
> 
>     On 03/13/2013 10:33 AM, OBD wrote:
>     >
>     > Can somebody help me what is the problem over here? I don't seem to
>     > find any issue with the code.
> 
>     What is the faulting insn?
> 
>     x/i $pc
> 
> 
> Sorry I didn't quite understand your response. Can you kindly elaborate what you are trying to say?

In GDB, at the point of the SIGILL, type:

x/i $pc

Andrew.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Application receives SIGILL
  2013-03-13 17:04     ` Andrew Haley
@ 2013-03-13 18:02       ` OBD
  0 siblings, 0 replies; 4+ messages in thread
From: OBD @ 2013-03-13 18:02 UTC (permalink / raw)
  To: Andrew Haley; +Cc: gcc-help

On 13 March 2013 22:33, Andrew Haley <aph@redhat.com> wrote:
>
> In GDB, at the point of the SIGILL, type:
>
> x/i $pc
>
> Andrew.
>

The output is:

0x0:    .long 0x0

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-13 18:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-13 10:33 Application receives SIGILL OBD
2013-03-13 11:50 ` Andrew Haley
     [not found]   ` <CAOSwV8nTUpMkB38GD-N-YGA=xrYXp+EFxnbTQPSohT=6s6wqWA@mail.gmail.com>
2013-03-13 17:04     ` Andrew Haley
2013-03-13 18:02       ` OBD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).