Recent

Author Topic: External Sigsegv  (Read 2864 times)

kleinewolf7

  • Newbie
  • Posts: 2
External Sigsegv
« on: April 06, 2019, 09:34:25 pm »
My program refuses to run (compiler gives no error, only some hints) and states 'external: sigsegv'. There are 8 units with some procedures/functions that are used in the main program. I never had a problem until a few days. I think there's a problem with 'memory use'. Do I have used too many variables?Functions & procedures? Maybe the 'structure' of the whole program is misbuilt...I'm not a programmer. What can I do to fix this? Hints for an more optimal structure?

af0815

  • Hero Member
  • *****
  • Posts: 1409
Re: External Sigsegv
« Reply #1 on: April 06, 2019, 10:24:18 pm »
The first step is to use buildmodes and activate DEBUG. With this you see more clearly

If you are not a programmer, you have to learn it  :o
« Last Edit: April 06, 2019, 10:25:51 pm by af0815 »
regards
Andreas

Thausand

  • Hero Member
  • *****
  • Posts: 526
Re: External Sigsegv
« Reply #2 on: April 06, 2019, 11:07:54 pm »
hi hello,

My program refuses to run (compiler gives no error, only some hints) and states 'external: sigsegv'.
'external: sigsegv' alway programmer error  :)

Quote
There are 8 units with some procedures/functions that are used in the main program.
Why you have 8 project file ? Unit not need .lpr / .lps. That  is confuse me and confuse Lazarus. Make unit name end ".pas" or ".pp"

Need fix first then sigv error and try see why.

Quote
Hints for an more optimal structure?
Make unit name better  :D
A docile goblin always follow HERMES.md

lainz

  • Hero Member
  • *****
  • Posts: 4742
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: External Sigsegv
« Reply #3 on: April 06, 2019, 11:31:12 pm »
That usually happens when you're trying to access an object that is not initialized (You did not call .Create), or freeing an already freed object (calling .Free many times).

Thausand

  • Hero Member
  • *****
  • Posts: 526
Re: External Sigsegv
« Reply #4 on: April 06, 2019, 11:41:57 pm »
That usually happens when you're trying to access an object that is not initialized (You did not call .Create), or freeing an already freed object (calling .Free many times).
Hi hello Lainz

Program look turbo pascal no OOP.

I not understand why not compile mode tp but do compile mode fpc. I try fp think that problem.
A docile goblin always follow HERMES.md

lainz

  • Hero Member
  • *****
  • Posts: 4742
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: External Sigsegv
« Reply #5 on: April 06, 2019, 11:47:37 pm »
Well, can be as well accessing and index of an array that's not inside the bounds.

Peter H

  • Sr. Member
  • ****
  • Posts: 272
Re: External Sigsegv
« Reply #6 on: April 07, 2019, 12:04:36 am »
The program runs, when the stack size in project options is set to 20 000 000.
It generates the exception with stacksize default or stack size 2 000 000.

This on windows 10 64 bit.

The problem seems to be in unit "hulp":

Procedure dop(el:element;h1,cl:real;as1,as1b:langs; aw:dwars;nas1,nas1b:integer;var d:matrix9);
Procedure don(el:element;h1,cl:real;as2,as2b:langs; aw:dwars;nas2,nas2b:integer;VAR d:matrix9);

The variable aw is a really large array that contains another large array in each element.

With this declaration the program runs with default stacksize:

Procedure dop(el:element;h1,cl:real;as1,as1b:langs;var aw:dwars;nas1,nas1b:integer;var d:matrix9);
Procedure don(el:element;h1,cl:real;as2,as2b:langs;var aw:dwars;nas2,nas2b:integer;VAR d:matrix9);

This is even better, it works also:
 
Procedure dop(el:element;h1,cl:real;as1,as1b:langs;const aw:dwars;nas1,nas1b:integer;var d:matrix9);
Procedure don(el:element;h1,cl:real;as2,as2b:langs;const aw:dwars;nas2,nas2b:integer;VAR d:matrix9);
 
(I am a beginner with lazarus, had some fun playing around with this and learning.)
« Last Edit: April 07, 2019, 01:09:14 am by Peter H »

kleinewolf7

  • Newbie
  • Posts: 2
Re: External Sigsegv
« Reply #7 on: April 07, 2019, 05:39:22 pm »
Thnx guys! I indeed think it's a memory-problem...I'll try it tonight Peter :-)
I'm actually a construction engineer and I use sometimes some simple pascal programs to solve some local problems. The problem is that I indeed need and use a lot of values/variables. The same procedures (dop and don) didn't gave any problems until last week,when the program grew.
I'll give it a try

ccrause

  • Hero Member
  • *****
  • Posts: 1116
Re: External Sigsegv
« Reply #8 on: April 08, 2019, 10:08:45 am »
Thnx guys! I indeed think it's a memory-problem...

Stack checking (-Ct) may help in pinpointing the problem.  Included by default if you use DEBUG mode as suggested by af0815.

Peter H

  • Sr. Member
  • ****
  • Posts: 272
Re: External Sigsegv
« Reply #9 on: April 09, 2019, 05:55:05 pm »
@kleinewolf7

I am a beginner in lazarus but not a beginner in programming. However, my professional  pascal experiences ended 30 years ago, when windows and delphi came up.
I have studied electric engineering at a time when they punched ALGOL68 code into Hollerith cards and this was not fun, you had to wait some days to get the result. A programmable electronic pocket  calculator was  fun and faster for me.
All my subsequent programming skills are learned on the job and out of pure interest.

To compile your project in lazarus 2.0 I had to rename all *.lpr files to *.pp, only eurocode2.lpr stays unchanged.

Then the project eurocode2 can be opened and compiled in lazarus.
If the program is started in debug modus, the program stops with an exception in procedure "don" and when the mouse is pointed to the argument "aw", there appears a debugger window "unable to access memory".
So easy is it in lazarus  and if you dont have it I recommend to install lazarus 2.0.

I also recommend to increase the default stacksize and to activate stackchecking, in lazarus project options this should make life easier.

I believe most programmers -included me- cannot write the program you wrote, because they dont have the necessary expert knowledge.
So good luck with this.
« Last Edit: April 09, 2019, 07:46:48 pm by Peter H »

 

TinyPortal © 2005-2018