* * *

Author Topic: Error: Project raised exception class 'External:SIGSEGV'.  (Read 152579 times)

Ortis

  • Newbie
  • Posts: 2
Re: Error: Project raised exception class 'External:SIGSEGV'.
« Reply #15 on: November 06, 2009, 06:00:03 pm »
Thank you all, I'll try to disable debugger. However it is very sad to program without debugger.

I have full administrative rights. Teach your students either .net or java.

The error I had was purely the debugger. Run without debug and it works perfectly... Then again how am I supposed to debug my code without a debugged?? Delphi 2009...

If I could choose, I would teach them Python. I do not like Java and .NET much more. But my own preferencies are not gotton into a mind. I have students, those already know Pascal and nothing else. And I have teaching plan, where Object Pascal is mentioned. So I am to use lazarus or Delphi.

EMTR

  • New member
  • *
  • Posts: 20
Re: Error: Project raised exception class 'External:SIGSEGV'.
« Reply #16 on: November 06, 2009, 07:20:54 pm »
@Picstart - The debugger is the problem I think. If I compile my dll outside lazarus - ie from the command line using FPC and then try to run it from my application then it all works - I debugged it the slow way by outputting a stringlist of all the events to a file then trawling back through the file... Interestingly all the data debugged just fine - exactly as expected - I had only made minor changes. When used with the application it was made for it works like a charm. But load up the debugger and back comes the sigsegv. It debugs fine until it exits the external call, ie, until it trys to return to the calling application.

Hope that helps.
« Last Edit: November 06, 2009, 07:25:50 pm by EMTR »

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2482
Re: Error: Project raised exception class 'External:SIGSEGV'.
« Reply #17 on: November 06, 2009, 07:54:39 pm »
@Ortis:
what is the problem with the debugger ? it's not clear from your message. In what case you get an error ?
It should work on XP SP3 too.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

creatxr

  • New member
  • *
  • Posts: 10
Re: Error: Project raised exception class 'External:SIGSEGV'.
« Reply #18 on: November 09, 2009, 11:20:55 pm »
I meet this problem also today.
I remember that it worked well yesterday.
But today, I just created a new project and run, it raised this exception.
It has no problem while compile, it raised when it runs.
So I uninstalled and reinstalled it.
But it is useless.
------------------------
environment:
e:\lazarus
windows xp
« Last Edit: November 09, 2009, 11:52:09 pm by creatxr »

EMTR

  • New member
  • *
  • Posts: 20
Re: Error: Project raised exception class 'External:SIGSEGV'.
« Reply #19 on: November 12, 2009, 04:08:30 pm »
OOOOK - I've just been dragged back into this project at the office.

Background...

I have a Delphi 2009 Exe.

I have a Lazarus DLL compiled with FPC.

I need to compile the dll using fpc. Its basically some rules that a customer provides and then the exe compiles its own dll and loads it. Its more complex than that but thats the essence of it. If I build everything in Delphi (DLL and EXE) then it all works :) Hurray! If I build everything in Lazarus (DLL and test harness exe) it all works :) Hurray!

If I go back to building my EXE in Delphi 2009 and the DLL in Lazarus I get 'External Sigsegv'... I think its doing the equivalent of an Access Violation somewhere but I can't see it... I'm currently working on solving the problem on the assumption that its some problem with Unicode / AnsiString / String and PChar. I can't debug it - Lazarus refuses to step into the dll when I specify the application as the host otherwise I might actually get somewhere... Not sure if this snippet of info will help or not...?

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1889
Re: Error: Project raised exception class 'External:SIGSEGV'.
« Reply #20 on: November 12, 2009, 04:52:13 pm »
Afaik, you have to interface the DLL in this case as if you would call it from C.
So no String only PChar etc.

EMTR

  • New member
  • *
  • Posts: 20
Re: Error: Project raised exception class 'External:SIGSEGV'.
« Reply #21 on: November 12, 2009, 07:38:19 pm »
@Theo
?? Interface the dll?! I'm using the stdcall convention?

@Everyone
I have a strange problem though I've spent the afternoon narrowing down my problem. Consider the scenario...

I call the DLL using this code from Delphi (2009)... (This Delphi code is the exe)

Code: [Select]
function xyz(LibFileName : string) : IDataList;
var
  lCreateDataList: function: IDataList; stdcall;
begin
  FDLLHandle := LoadLibrary(PChar(LibFileName));
  { Check DLL loaded... }
  lCreateDataList := GetProcAddress(FDLLHandle, 'GetDataList');
  Result := lCreateDataList; 
end;

The DLL is built in Lazarus and I get into the DLL and all the way out of the DLL successfully - I think. So Lazarus has passed an IDataList back (appears to do this correctly), but on inspection the Pointer is different. It actually passes back an interface with a different pointer - This doesnt cause me a problem until I perform my next call from the Delphi exe..

Code: [Select]
function getItems(index : integer) : DataItem;
begin
  Result := IDataList.GetItems(0);
end;

Now I get back to the lazarus dll and it gets the correct offset because I load up the correct debug symbols and get into the "GetItems(index)" method... but on an Object that doesnt exist. I perform an operation on the object and get a SigSegV...

What have I done wrong?!

Everything works IF I build the exe via lazarus and the dll via lazarus.
Everything works IF I build the exe via Delphi 2009 and the dll via Delphi 2009.

As soon as I build the exe in Delphi 2009 and the DLL in lazarus it falls apart.

I need to exe in Delphi and DLL in Lazarus due to licensing and partners using lazarus etc so for them to extend our app, but we need to maintain the exe in Delphi 2009 just building both using the same compiler isn't an option....


Any thoughts? There's some problem with the pointer that I get when it crosses the Delphi / Lazarus boundary but I just can't figure out where I've gone wrong....

EMTR

  • New member
  • *
  • Posts: 20
Re: Error: Project raised exception class 'External:SIGSEGV'.
« Reply #22 on: November 12, 2009, 08:04:33 pm »
Nearly 4,000 views on this thread.... that can't be right...

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1889
Re: Error: Project raised exception class 'External:SIGSEGV'.
« Reply #23 on: November 13, 2009, 11:23:13 am »
@Theo
?? Interface the dll?! I'm using the stdcall convention?

No, I meant that I for one would not assume that you can exchange data types from Delphi to Lazarus without problems.
I really don't know for sure (things are changing in FPC) but I would write the interface part as if I'd talk to C (maybe COM/OLE types would work too).
You'd better ask in the freepascal mailing list.

EMTR

  • New member
  • *
  • Posts: 20
Re: Error: Project raised exception class 'External:SIGSEGV'.
« Reply #24 on: November 13, 2009, 12:07:03 pm »
Will do - Cheers. My next step is to build a simple DLL to just return an object via the interface see if I can figure it out from there.

Thanks for the help.

d9k

  • Newbie
  • Posts: 1
Re: Error: Project raised exception class 'External:SIGSEGV'.
« Reply #25 on: November 20, 2009, 03:07:05 am »
OK, so I solved this problem. I am COMODO Internet Security user too.
Firstly I have downloaded Mark Russinvoch's program AutoRuns http://technet.microsoft.com/ru-ru/sysinternals/bb963902.aspx
, then I openned it, followed to AppInit tab and disabled guard32.dll.
Then I openned Comodo window, on Defense+ tab I clicked "My protected files", then "Groups..." button, found guard32.dll in "Comodo files/folders", have deleted it from list.

After it still on the "Defence+" tab I openned "My own safe files" item, and added lazarus.exe and /mingw/bin/gdb.exe from Lazarus folder.

On "advanced" tab at left I add them too to the "Computer Security Policy" as "Installer or updater" (max permissions).

Finally, I rebooted and gdb debugger began to work properly! :3
« Last Edit: November 20, 2009, 03:10:25 am by d9k »

Troodon

  • Sr. Member
  • ****
  • Posts: 484
Re: Error: Project raised exception class 'External:SIGSEGV'.
« Reply #26 on: November 20, 2009, 03:18:58 am »
Teach your students either .net or java.

You can't be serious posting that to the Lazarus forum.
Lazarus/FPC on Linux

cdbc

  • Full Member
  • ***
  • Posts: 230
    • http://www.cdbc.dk
Re: Error: Project raised exception class 'External:SIGSEGV'.
« Reply #27 on: November 20, 2009, 04:15:25 am »
@EMTR - Hi
Quote
There's some problem with the pointer that I get when it crosses the Delphi / Lazarus boundary

1) Do you share memorymanager between host and lib?
2) If so, have you solved the differences between laz/fpc TMemoryManager and delphi TMemMgrEx.

Due to reference-counting I don't think you can export/use interfaces without sharing memory.
Maybe a solution would be to use an extra shared memmanager library, between to two?!?

HTH
Regards Benny
If it ain't broke, don't fix it ;)

arcan

  • Newbie
  • Posts: 1
Re: Error: Project raised exception class 'External:SIGSEGV'.
« Reply #28 on: December 09, 2009, 09:56:59 pm »
Hiya i ain't that great but maybee this is helpfull:

i got an old project in 9.24, today i downloaded 9.28 and while compiling that old project i got this error: Project raised exception class 'External:SIGSEGV'.
After reading here i uninstalled comodo, but that didn't help.

i browsed in the code and found out where it runs stuck on:
it fails with the first memo1 line:

procedure debugtxt(s: string);
begin
  Debug_form.Memo1.Clear ;
  Debug_form.Memo1.Append('1') ;
//  Debug_form.Memo1.Lines.Append(TimeToStr(Time) + ': ' + s);
  sob_tabellen_code.Frm_Tabellen.StatusBar1.Panels[1].Text:= s ;
end;                    

And it runs smooth with:
(alternated with and without 5 times and it was 5/5)

procedure debugtxt(s: string);
begin
//  Debug_form.Memo1.Clear ;
//  Debug_form.Memo1.Append('1') ;
//  Debug_form.Memo1.Lines.Append(TimeToStr(Time) + ': ' + s);
    sob_tabellen_code.Frm_Tabellen.StatusBar1.Panels[1].Text:= s ;
end;        

but then my memo field will remain empty, anyone got a clue what to do in order to fix it?
in the old lazarus i never had a problem with this btw.

I run under Windows Vista 64bit with FPC 2.2.4

Edit:
After making an other memo field it error's all the time, even after i deleted it.            
« Last Edit: December 09, 2009, 10:12:49 pm by arcan »

picstart

  • Full Member
  • ***
  • Posts: 236
Re: Error: Project raised exception class 'External:SIGSEGV'.
« Reply #29 on: December 11, 2009, 04:05:15 pm »
For me only lazarus 26.2 has been capable of reliable debugging. As a newcomer I always write a hello world program on any new IDE before proceeding. Now I have to admit I would have rejected lazarus entirely as being unreliable if I had started with 28.2 since it generates SigSEGV with win2k every time I run it no matter the code. Since 26.2 was stable and did not generate SIGSEV errors I was able to move many delphi projects over to lazarus. IMHO lazarus should be able to run a form with a button that when pressed populates a label with "hello world". Hello world should work on every platform that lazarus claims to support.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus