Recent

Author Topic: SIGSEGV - yet another one.  (Read 9291 times)

aljones

  • New Member
  • *
  • Posts: 14
SIGSEGV - yet another one.
« on: November 26, 2018, 12:46:31 am »
I think I see the problem but don't know why it's occurring nor how to fix it.  Let's get the 'required stuff' out of the way, first.

Lazarus: 1.8.4
FPC Version: 3.0.4

Windows 10 build 17134

Code: Pascal  [Select][+][-]
  1. program project1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}{$IFDEF UseCThreads}
  7.   cthreads,
  8.   {$ENDIF}{$ENDIF}
  9.   Classes
  10.   { you can add units after this };
  11.  
  12. begin
  13.   writeln('Test');
  14.   readln;
  15. end.
  16.  

I'm new to Pascal, let's face it, I'm 70+ and bored!  I'm also a programmer who's worked in C, BASIC (god the varieties of BASIC), FORTRAN, COBOL, RPG (Ugh!!)  I've been playing with MS Visual Basic but wanted a little variety and something that would cross system boundaries (Apple, Windows, etc)

Symptoms:  Though this is a nothing program, it appear to run one time (F9) then results in "Project raised exception class 'External: SIGSEGV"
Attempting to close the open DOS windows asks if I want to terminate debugging?  So obviously the program run by the debugger hasn't ended.

To be more exact:
__F9
__Dos Box Opens
__Press Return (respond to readln)
__Exception Raised (click OK)
__Assembler appears with Binary 0 contents
__Close the DOS window

If I run it without debugging it runs and terminates successfully.

I thought I'd run through the School Free Ware course ... but I can't get past lesson one!  Any help or suggestions for an old novice would be appreciated.
//al
« Last Edit: November 26, 2018, 07:45:17 pm by aljones »

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: SIGSEGV - yet another one.
« Reply #1 on: November 26, 2018, 01:00:10 am »
I'm not at all sure whether it's because this but make sure you don't have "Win32 GUI application" marked in the project options (Menu "Project"->"Project options" and, in the options dialog, "Compiler options -> "Config and Target"; see images for reference)
« Last Edit: November 26, 2018, 01:06:56 am by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

aljones

  • New Member
  • *
  • Posts: 14
Re: SIGSEGV - yet another one.
« Reply #2 on: November 26, 2018, 01:16:58 am »
Luca, since this isn't a gui application it opens the normal DOS Window - *normally* that window will open and close so fast that you can't see it, hence the readline to force it to stay open; it should close when 'return' is pressed, but it doesn't.

That to the side, I thought to give your suggestion a try - I won't even try to list the errors that popped up then.  I'm guessing about 10, one after the other, I reverted to my initial setup if you don't mind.

My impression is that the debugger that is invoked with the F9 isn't closing when the program terminates.  But I have been known to lead myself down a rosy path more than once ...

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: SIGSEGV - yet another one.
« Reply #3 on: November 26, 2018, 01:30:40 am »
That to the side, I thought to give your suggestion a try - I won't even try to list the errors that popped up then.  I'm guessing about 10, one after the other, I reverted to my initial setup if you don't mind.

Huh ... yeah, I meant leaving the option unchecked but in the image it is checked. My bad (as we say here around: hurry is a bad adviser) :-[
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

aljones

  • New Member
  • *
  • Posts: 14
Re: SIGSEGV - yet another one.
« Reply #4 on: November 26, 2018, 05:12:22 pm »
I really didn't want to bump this but I'm at a complete loss.  SIGSECV seems to be a common enough error that I'd think there'd be a section on just that.  I've read several pages from a search and it's not a lot of help.

creaothceann

  • Full Member
  • ***
  • Posts: 117
Re: SIGSEGV - yet another one.
« Reply #5 on: November 26, 2018, 05:36:37 pm »
Try re-installing Free Pascal and Lazarus?

aljones

  • New Member
  • *
  • Posts: 14
Re: SIGSEGV - yet another one.
« Reply #6 on: November 26, 2018, 05:53:14 pm »
Tried that before my first post; cleanup any strays with ccleaner.

Next?? << sorry >>

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Re: SIGSEGV - yet another one.
« Reply #7 on: November 26, 2018, 06:00:41 pm »
Your ProjectOptions pic shows your current LCL widgetset is GTK2.
It may be broken indeed. It was the only widgetset a very long time ago but I guess nobody tested it on Windows for a while.
Please use the default WinAPI binding.
« Last Edit: November 26, 2018, 06:02:30 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

korba812

  • Sr. Member
  • ****
  • Posts: 394
Re: SIGSEGV - yet another one.
« Reply #8 on: November 26, 2018, 06:05:17 pm »
This may be anti-virus software.

Your ProjectOptions pic shows your current LCL widgetset is GTK2.
It may be broken indeed. It was the only widgetset a very long time ago but I guess nobody tested it on Windows for a while.
Please use the default WinAPI binding.
It's a picture of another user

440bx

  • Hero Member
  • *****
  • Posts: 4014
Re: SIGSEGV - yet another one.
« Reply #9 on: November 26, 2018, 06:10:26 pm »
Tried that before my first post; cleanup any strays with ccleaner.

Next?? << sorry >>
I suggest you try this and see what happens:

1. Create a new project by going to File/New
2. Select "simple program" from the dialog box
3. Don't change anything anywhere other than adding the writeln and readln into the program's body.

Do you still get a SIGDEV ?

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Re: SIGSEGV - yet another one.
« Reply #10 on: November 26, 2018, 06:10:57 pm »
It's a picture of another user
Damn right! Sorry. I am curious, does GTK2 on Windows work ok?
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

aljones

  • New Member
  • *
  • Posts: 14
Re: SIGSEGV - yet another one.
« Reply #11 on: November 26, 2018, 06:45:10 pm »
@440bx

<< laughing >> They mean 'simple' when they say simple!!

Runs one time; on the second run I get the sigsegv error.   I can close all windows except the DOS window and the main (file, edit, etc) attempting to close those result in "Stop the Debugging?"  Why would the debugger from the first iteration, I presume, still be active?  How can I control the debugger, is there some way to tell it to end when the running program (is supposed to) end?

As a comment, I noticed the the SigSegV error occurs after the command window is presented, but before the 'writeln'.

440bx

  • Hero Member
  • *****
  • Posts: 4014
Re: SIGSEGV - yet another one.
« Reply #12 on: November 26, 2018, 07:24:38 pm »
@440bx

<< laughing >> They mean 'simple' when they say simple!!
yes, they do. 

Now, I'd like you to try this:

1. have the project open as you would normally have it.
2. Press shift-F9
3. Press F9, press any key to satisfy the readln and end the program's first run
4. repeat the process starting at step 2.  That is, press shift-F9 again (not just F9 but shift-F9

Do you still get the sigsev if you press shift-F9 between executions ?

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

aljones

  • New Member
  • *
  • Posts: 14
SIGSEGV - yet another one.
« Reply #13 on: November 26, 2018, 07:40:32 pm »
<< scratch that >>

After a complete cleanup and re-install during which I realized that installing Lazarus also installs FPC my first test appeared to work.  Upon rerunning the test it again fails with SigSegV ...

@440bx you seem to be on to something<?>
build <shift f9> and run <f9> separately runs correctly.  I get the "Execution Completed" window not the error.

multiple builds don't present a problem; however attempting to run without a build presents the sigsegv.  Building between each run does not preclude the error.

SOMETHING isn't being terminated after the run .... Oddity, I closed lazarus, reopened it and reopened the test program, build -> success, run -> success, build -> success, run -> sigsegv ... I need a beer!!!

Since I'm modifying this answer:
@asbzone
1)
 PATH=C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\dotnet\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Common Files\Acronis\VirtualFile\;C:\Program Files (x86)\Common Files\Acronis\VirtualFile64\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\Common Files\Acronis\FileProtector\;C:\Program Files (x86)\Common Files\Acronis\FileProtector64\;C:\Program Files (x86)\Common Files\eBook Technologies;C:\Users\alfre\AppData\Local\Microsoft\WindowsApps;C:\Users\alfre\AppData\Local\Microsoft\WindowsApps;

(( sorry, you did ask! :) ))

2)  Yep, I can run it repeatedly without a problem by just invoking the exe.
« Last Edit: November 26, 2018, 08:09:15 pm by aljones »

ASBzone

  • Hero Member
  • *****
  • Posts: 678
  • Automation leads to relaxation...
    • Free Console Utilities for Windows (and a few for Linux) from BrainWaveCC
Re: SIGSEGV - yet another one.
« Reply #14 on: November 26, 2018, 07:41:18 pm »
@440bx

<< laughing >> They mean 'simple' when they say simple!!

Runs one time; on the second run I get the sigsegv error.   I can close all windows except the DOS window and the main (file, edit, etc) attempting to close those result in "Stop the Debugging?"  Why would the debugger from the first iteration, I presume, still be active?  How can I control the debugger, is there some way to tell it to end when the running program (is supposed to) end?

As a comment, I noticed the the SigSegV error occurs after the command window is presented, but before the 'writeln'.

@aljones, a couple of questions for you:

1. What does your PATH statement look like at present?

2. Once the app has been compiled, can you open a CMD window and run it without issue?

Regards,
-ASB: https://www.BrainWaveCC.com/

Lazarus v2.2.7-ada7a90186 / FPC v3.2.3-706-gaadb53e72c
(Windows 64-bit install w/Win32 and Linux/Arm cross-compiles via FpcUpDeluxe on both instances)

My Systems: Windows 10/11 Pro x64 (Current)

 

TinyPortal © 2005-2018