[vtkusers] Problem with Segmentation Fault in Linux
Ali Akbar zarezadeh
a.zarezadeh at kermantablo.com
Wed Aug 16 05:47:05 EDT 2006
Dear Sir/Madam,
I'm developing a source code in C++ for RTU (Remote Terminal Unit). It
will gather data of IO modules of RTU and then transmit them to SCADA
center with standard communication protocol (IEC-870-5-101). In first
step, I developed it in windows in visual C++ environment. For testing
its functionality, I arranged test vectors instead of IO cards of RTU in
windows. I trigger test vector via timers in windows. Actually, it is
running well without exception. I used try catch in any thread in my
program. For example I arranged it in DI thread as follows:
// Digital Input process thread
while(Loop){
try{
GetMsgQue()->PopWait(Msg);
Msg.OpenMsg();
bFunctionCode =
(DITHREAD_EVENTS_ENUM_)Msg.GetFunCode();
switch(bFunctionCode){
case DITH_EVENT_SHOUTDOWN_: // ShutDown
message to Kill thread
Loop = FALSE_S;
DestroyThread(m_pthread_t);
break;
case DITH_EVENT_HWMCHKMSG_: // Hardware
Manager Health Check message to DI Thread
...
break;
case DITH_EVENT_PCIFREEZE_: // PCI
Freeze message
...
break;
default :
m_pApp->GetGate()->ErrorMsg("DITH, Unknown
FunCode received to DI thread!");
}
}
catch(CScadaException* e){
m_pApp->GetGate()->ErrorMsg(e->GetErrorMessage()+"!(DI_ProcessLoop)");
delete e;
}
catch(...){
m_pApp->GetGate()->ErrorMsg("Unknown exception
occurred in DI_ProcessLoop!");
}
}
Now, I'm porting it to Linux to run in embedded system (RTU). It is
going well so far but I am hitting a segmentation-fault and each time
error occurs, my application will shut off and Aborted (Segmentation
Fault) is appear on the terminal. It seems, in Windows catch(...) is a
fail safe that catches everything, but in Linux catch(...) doesn't seem
to catch anything.
My question is how to control this thing? Let's say after error occurs,
just prompt the error message and never do that action so that the app
will be ok and still running.
Best Regards
Ali
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060816/1145abe0/attachment.htm>
More information about the vtkusers
mailing list