Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-05

FPC 2.2.0 / SegF in threads

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Damien Gerard

I have a program in lazarus with a thread .
When there is a SegF in this thread it exits without notifying GDB. So the error is silent even with GDB (Windows/Linux/OSX) I have to wrap it like this :

try
   ..
except
   RaiseGDBException(...)
end;

May I miss something like an option to enable, since the error is caught by the try..except statement ?

Damien Gerard "Intelligence is 10 million rules." -- Douglas Lenat

Reply by email

Luca Olivetti
to Damien Gerard
Show quoted text 14 lines
I have a program in lazarus with a thread . When there is a SegF in this thread it exits without notifying GDB. So the error is silent even with GDB (Windows/Linux/OSX) I have to wrap it like this : try .. except RaiseGDBException(...) end; May I miss something like an option to enable, since the error is caught by the try..except statement ?

I don't know about gdb, but I know that you have to be extremely careful with exceptions in a thread, since any uncaught exception will silently terminate it.

Bye

Luca

Reply by email

Damien Gerard
to Luca Olivetti
Luca Olivetti wrote 24 lines
El Thu, 15 May 2008 10:45:43 +0200 Damien Gerard escribió: > > I have a program in lazarus with a thread . > When there is a SegF in this thread it exits without notifying GDB. > So the error is silent even with GDB (Windows/Linux/OSX) > I have to wrap it like this : > > try > .. > except > RaiseGDBException(...) > end; > > May I miss something like an option to enable, since the error is > caught by the try..except statement ? I don't know about gdb, but I know that you have to be extremely careful with exceptions in a thread, since any uncaught exception will silently terminate it.

It is actually the point of my problem.
Is there any way to avoid this behavior ? Because without GDB you are not aware that a thread has just exited.

Damien Gerard "Intelligence is 10 million rules." -- Douglas Lenat

Reply by email

mm
to Damien Gerard
Damien Gerard wrote 10 lines
Le May 15, 2008 à 8:46 PM, Luca Olivetti a écrit : > I don't know about gdb, but I know that you have to be extremely careful > with exceptions in a thread, since any uncaught exception will silently > terminate it. > It is actually the point of my problem. Is there any way to avoid this behavior ? Because without GDB you are not aware that a thread has just exited.

Your program has to catch all the exceptions. I wrote a small demo for NX (see on my web site) that is called "nx_demo_thread". It is very simplistic regarding thread management but it could help you to see how this program catches the exceptions.

mm

Reply by email

Damien Gerard
to mm
mm wrote 17 lines
Damien Gerard a écrit : > Le May 15, 2008 à 8:46 PM, Luca Olivetti a écrit : >> I don't know about gdb, but I know that you have to be extremely >> careful >> with exceptions in a thread, since any uncaught exception will >> silently >> terminate it. >> > It is actually the point of my problem. > Is there any way to avoid this behavior ? Because without GDB you > are not aware that a thread has just exited. Your program has to catch all the exceptions. I wrote a small demo for NX (see on my web site) that is called "nx_demo_thread". It is very simplistic regarding thread management but it could help you to see how this program catches the exceptions.

Oki I see you use a double try statement in the execute method.

Damien Gerard "Intelligence is 10 million rules." -- Douglas Lenat

Reply by email