Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
No replies
SystemAdmin
SystemAdmin
6902 Posts
ACCEPTED ANSWER

Pinned topic Application recieves SIGILL

‏2013-03-04T06:04:25Z |
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 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.