bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Segmentation fault when using exception handling and ttystream


From: a2574
Subject: Re: Segmentation fault when using exception handling and ttystream
Date: Tue, 10 Dec 2002 01:12:26 GMT
User-agent: IMP/PHP3 Imap webMail Program 2.0.11

Mensaje citado por: David Sugar <address@hidden>:

> Generally a catch handler should catch this, but there have been 
changes > in 
> the abi which may make self thrown objects have strange behavior.  I 
woul> d 
> suggest trying setException(Thread::throwException);

I tried but it did not work. In fact, whenever you trhow any kind of 
exceptions (i.e. and int) the program crashes. And is not a \\\"Program 
Aborted\\\" message but a \\\"Segmentation Fault\\\".

I dont know what to do. I finally thought that it was a program 
related with my compiler, but I upgraded and tested code that uses 
exceptions and worked right. 

I will try to isolate the code I need, to see if it was a problem of 
the thread library or something... dont really know.

So if any of you have an idea... 

Thanks in advance (or however it is said) , Jose Fernandez.

> On Thursday 05 December 2002 07:04, address@hidden wrote:
> > Hello!
> >
> > Fisrt of all, Im not an advanced C++ programmer... not even close. 
So
> > maybe the answer is just in front of me but I havent see it yet.
> >
> > Im using commoncpp2-1.0.7. I use the serial interface for 
connecting to
> >  a device (a Laser). The problem is that when I use it without 
exceptio> n
> > handling everything goes right, but if I switch it on
> > (this->setError(true)) it makes a segmentation fault when an error
> > occurs. I traced the code and apparently (or so the debugger says) 
the
> > error is when the method Serial::error throws the object (itself)
> >
> > throw((Serial*)this)
> >
> > My code is this: (I inerhit from ttystream)
> >
> > class SerialInterface: public ost::ttystream{
> > public:
> > SerialInterface(const char *device);
> > }
> >
> > // and implementation is:
> >
> > SerialInterface::SerialInterface(const char *device){
> >     this->setError(true);
> >      try{
> >          open(device);   // The method for openning the device
> >                          // I call it with a wrong argument 
\\\\\\\"/dev/jdss> \\\\\\\"
> >      }catch (...){       // I have tried also (Serial *e) and so 
on ;(
> >          std::cout:: << getErrorNumber();
> >      }
> > }
> >
> >
> > Well, Is been two days now and Im starting to fed up... Two days 
and no
> > code written, thats not what I call productivity.. he.
> >
> > Hoping you could help me...
> >
> > PS: By the way... to install was a nightmare (as well hehe), the 
debian
> > package does not seem to work (but I guess it does not correspond 
to an> y
> > of you) and /usr/include/time.h conflicts with
> > /usr/include/cc++/cc+2/config.h its definition of nanosleep does 
not
> > throw any exception, so I changed it, but I guess this is not the
> > reason....
> >
> > By again.
> >
> > Jose.
> >
> >
> >
> >
> >
> > _______________________________________________
> > Bug-commoncpp mailing list
> > address@hidden
> > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
>
>
>
> _______________________________________________
> Bug-commoncpp mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]