Sign in Join

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

Mailing lists / lazarus / 2008-05

External: SIGSEGV

14 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

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

Unknown author

Hi,

I have tried to google for "External: SIGSEGV" exception, but nothing what came up helped.

Is there any detailed explanation about when this exception occurs?

In my program it pops up when reading an unassigned (nil) object property:

  MyObject2_Var:= MyObject1.MyObject2;   (MyObject1.MyObject2 is nil)

The strange thing is that the assignment is in a try ... except block, and the debugger does not stop at the breakpoints in the exception handling part.

I am totally clueless.

Thanks for reading

- Leslie -

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20080527/555a6238/attachment.html

Reply by email

Bogusław Brandys
to Unknown author: I have tried to google for "External: SIGSEGV" exception, but nothing what came up helped.
Show quoted text 11 lines
Hi, I have tried to google for "External: SIGSEGV" exception, but nothing what came up helped.

It's from gdb debugger . Search for "SIGSEV gdb" and I'm sure you will find much more.

Show quoted text 16 lines
Is there any detailed explanation about when this exception occurs? In my program it pops up when reading an unassigned (nil) object property: MyObject2_Var:= MyObject1.MyObject2; (MyObject1.MyObject2 is nil) The strange thing is that the assignment is in a try ... except block, and the debugger does not stop at the breakpoints in the exception handling part.

It may be a bug in gdb ..I don't know, but if debugger is trying to access some memory which MyObject2_Var is pointing to and it's not accessible then....

I am totally clueless.

Me too sometimes. Debugging with Lazarus under windows really need a total rebuild with native debugger, but it looks like hopeless wish now...

Regards
Boguslaw

Show quoted text 16 lines
Thanks for reading - Leslie - ------------------------------------------------------------------------ _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Michael Van Canneyt
to Jon Foster: An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazaru…
Jon Foster wrote
SIGSEGV (otherwise known as a segfault) is a *nix signal indicating that the an illegal address was accessed. Normally it can't be caught with a try...except. You have to muck about with signals to catch it with try ... except.

This is not correct.
The RTL catches this signal and converts this to an exception, if you use the sysutils unit.

Michael.

Reply by email

Mattias Gaertner
to Unknown author: I have tried to google for "External: SIGSEGV" exception, but nothing what came up helped.
Show quoted text 17 lines
Hi, [...] I have tried to google for "External: SIGSEGV" exception, but nothing what came up helped. [...] Is there any detailed explanation about when this exception occurs? [...] In my program it pops up when reading an unassigned (nil) object property: [...] MyObject2_Var:= MyObject1.MyObject2; (MyObject1.MyObject2 is nil) [...] The strange thing is that the assignment is in a try ... except block, and the debugger does not stop at the breakpoints in the exception handling part. [...] I am totally clueless.

Maybe posting some more code will help to find an answer.

Mattias

Reply by email

Bogusław Brandys
to Michael Van Canneyt: This is not correct. The RTL catches this signal and converts this to an exception, if…
Michael Van Canneyt wrote 16 lines
On Tue, 27 May 2008, Jon Foster wrote: > SIGSEGV (otherwise known as a segfault) is a *nix signal indicating that the an illegal address was > accessed. Normally it can't be caught with a try...except. You have to muck about with signals to catch it > with try ... except. This is not correct. The RTL catches this signal and converts this to an exception, if you use the sysutils unit. Michael. _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
My advice: test program outside of the Lazarus IDE.If it crashes then
it's not an IDE, but I suspect it's all about gdb.

Regards
Boguslaw

Reply by email

Unknown author
to Bogusław Brandys: My advice: test program outside of the Lazarus IDE.If it crashes then it's not an IDE,…

Thanks to All of You who have tried to help!.

I have located the problem and found a solution, but was not able to reproduce it yet in a separate test app.

The structure of the code looked like this:

MyObj = class;
private
   Obj1: TOtherObj;
   Obj2: TOtherObj;

. . .

end;
procedure T_Main.Button1Click(Sender: TObject);
begin
   with Obj1 do begin
       SomeProcedure(Obj2);
   end;
end;
The exception occurred while reading "Obj2";

The problem completely disappeared after removing the "with ..." block, which was actually unnecessary junk code since no Obj1 property or method was used in that block.

I am not sure, but Obj1 and Ojb2 being of the same type, and Obj1 not being used may have had something to do with it. Just guessing. :)

I will try to make a bug report, when I will be able to reproduce the bug.

Thanks for your help again!

- Leslie -

Earlier message 39 lines
----- Original Message ----- From: "Boguslaw Brandys" To: "General mailing list" Sent: Tuesday, May 27, 2008 9:15 PM Subject: Re: [Lazarus] External: SIGSEGV > Michael Van Canneyt wrote: >> >> On Tue, 27 May 2008, Jon Foster wrote: >> >>> SIGSEGV (otherwise known as a segfault) is a *nix signal indicating that >>> the an illegal address was >>> accessed. Normally it can't be caught with a try...except. You have to >>> muck about with signals to catch it >>> with try ... except. >> >> This is not correct. >> The RTL catches this signal and converts this to an exception, if you use >> the sysutils unit. >> >> Michael. >> _______________________________________________ >> Lazarus mailing list >> >> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus >> > > My advice: test program outside of the Lazarus IDE.If it crashes then > it's not an IDE, but I suspect it's all about gdb. > > > Regards > Boguslaw > _______________________________________________ > Lazarus mailing list > > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus >

Reply by email

Unknown author

For some reason the linespacing was doubled after pasting the text of the e-mail (from Word) through the clipboard.

The structure of the code looked like this:

 T_Main = class(TForm);
...
private
   Obj1: TOtherObj;
   Obj2: TOtherObj;
. . .
end;
procedure T_Main.Button1Click(Sender: TObject);
begin
   with Obj1 do
   begin
       SomeProcedure(Obj2);
   end;
end;
Earlier message 121 lines
----- Original Message ----- From: To: "General mailing list" Sent: Wednesday, May 28, 2008 5:32 PM Subject: Re: [Lazarus] External: SIGSEGV > Thanks to All of You who have tried to help!. > > > > I have located the problem and found a solution, but was not able to > reproduce it yet in a separate test app. > > > > > > The structure of the code looked like this: > > > > MyObj = class; > > private > > Obj1: TOtherObj; > > Obj2: TOtherObj; > > . . . > > end; > > > > procedure T_Main.Button1Click(Sender: TObject); > > begin > > with Obj1 do begin > > SomeProcedure(Obj2); > > end; > > end; > > > > The exception occurred while reading "Obj2"; > > > > The problem completely disappeared after removing the "with ..." block, > which was actually unnecessary junk code since no Obj1 property or method > was used in that block. > > > > > > I am not sure, but Obj1 and Ojb2 being of the same type, and Obj1 not > being used may have had something to do with it. Just guessing. :) > > > > I will try to make a bug report, when I will be able to reproduce the bug. > > > > Thanks for your help again! > > > > - Leslie - > > > > > > ----- Original Message ----- > From: "Boguslaw Brandys" > To: "General mailing list" > Sent: Tuesday, May 27, 2008 9:15 PM > Subject: Re: [Lazarus] External: SIGSEGV > > >> Michael Van Canneyt wrote: >>> >>> On Tue, 27 May 2008, Jon Foster wrote: >>> >>>> SIGSEGV (otherwise known as a segfault) is a *nix signal indicating >>>> that the an illegal address was >>>> accessed. Normally it can't be caught with a try...except. You have to >>>> muck about with signals to catch it >>>> with try ... except. >>> >>> This is not correct. >>> The RTL catches this signal and converts this to an exception, if you >>> use the sysutils unit. >>> >>> Michael. >>> _______________________________________________ >>> Lazarus mailing list >>> >>> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus >>> >> >> My advice: test program outside of the Lazarus IDE.If it crashes then >> it's not an IDE, but I suspect it's all about gdb. >> >> >> Regards >> Boguslaw >> _______________________________________________ >> Lazarus mailing list >> >> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus >> >

Reply by email

Bogusław Brandys
to Unknown author: Thanks to All of You who have tried to help!. I have located the problem and found a…
Show quoted text 71 lines
Thanks to All of You who have tried to help!. I have located the problem and found a solution, but was not able to reproduce it yet in a separate test app. The structure of the code looked like this: MyObj = class; private Obj1: TOtherObj; Obj2: TOtherObj; . . . end; procedure T_Main.Button1Click(Sender: TObject); begin with Obj1 do begin SomeProcedure(Obj2); end; end; The exception occurred while reading "Obj2"; The problem completely disappeared after removing the "with ..." block, which was actually unnecessary junk code since no Obj1 property or method was used in that block. I am not sure, but Obj1 and Ojb2 being of the same type, and Obj1 not being used may have had something to do with it. Just guessing. :) I will try to make a bug report, when I will be able to reproduce the bug. Thanks for your help again! - Leslie -

Did you tried to compile program and run outside of the IDE ? Still crashing ?

Boguslaw

Reply by email

Unknown author
to Bogusław Brandys
Did you tried to compile program and run outside of the IDE ? Still crashing ?

Yes. The same exception every time.

My guess is that the compiler used the object in the "with" line instead of the the object it should have used within the block. The referenced property in the first object was unassigned, so the SigSegv exeption would be appropriate there.

- Leslie -

Show quoted text 5 lines
_______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Mattias Gaertner
to Unknown author
Show quoted text 11 lines
> Did you tried to compile program and run outside of the IDE ? Still > crashing ? Yes. The same exception every time. My guess is that the compiler used the object in the "with" line instead of the the object it should have used within the block. The referenced property in the first object was unassigned, so the SigSegv exeption would be appropriate there.

Have you tried the fpc 2.3.1?

Mattias

Reply by email