[fpc-pascal] Stack trace different for Windows and Linux

2017-01-23 Thread Terry Mead

Gentlemen,
I'm a new poster to the mail list.  I have a problem logging call stack 
trace info following an exception.

The following simple program generates a divide by zero error.

PROGRAM Test;
VAR i, j, k : Integer;
PROCEDURE test1;
   BEGIN
 i := i - 1;
 k := j DIV i;
   END; {test}

PROCEDURE test2;
   BEGIN
 test1;
   END; {taskProc}

BEGIN
  i := 1; j := 1;
  test2;
END.

When compiled and run under Windows it generates the stack trace:
Runtime error 200 at $00401404
  $00401404  TEST1,  line 6 of test.pas
  $00401428  TEST2,  line 11 of test.pas
  $00401451  main,  line 16 of test.pas
  $004077D1

Which is what you would expect.  When compiled and run on an ARM 
processor under Linux (Debian Jessie) it generates the stack trace:

Runtime error 200 at $000101AC
  $000101AC  TEST2,  line 11 of test.pas
  $000101E0  main,  line 16 of test.pas
  $00010118

Ie. it does not contain the reference to the actual line which caused 
the problem.  The first entry is to the return address of the faulting 
procedure.


The same compile options are used for both and include the -gl option.  
FPC version is 2.6.4.


Anyone have any idea why this happens or more usefully how the Linux 
result can be fixed ?


Thanks,
Terry






---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Stack trace different for Windows and Linux

2017-01-24 Thread Terry Mead
Jonas - -O- option didn't do any different but I did bite the bullet and 
upgrade to 3.0 which does solve the problem.

Thanks.


On 25/01/2017 6:54 AM, Jonas Maebe wrote:

On 23/01/17 10:17, Terry Mead wrote:

When compiled and run under Windows it generates the stack trace:
Runtime error 200 at $00401404
  $00401404  TEST1,  line 6 of test.pas
  $00401428  TEST2,  line 11 of test.pas
  $00401451  main,  line 16 of test.pas
  $004077D1

Which is what you would expect.  When compiled and run on an ARM
processor under Linux (Debian Jessie) it generates the stack trace:
Runtime error 200 at $000101AC
  $000101AC  TEST2,  line 11 of test.pas
  $000101E0  main,  line 16 of test.pas
  $00010118

Ie. it does not contain the reference to the actual line which caused
the problem.  The first entry is to the return address of the faulting
procedure.

The same compile options are used for both and include the -gl option.
FPC version is 2.6.4.


Did you also compile both with -O-? That said, ARM is a lot better 
tested in FPC 3.0 than in 2.6.4, so you may want to try upgrading to 
that version in case -O- doesn't help.



Jonas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal





---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Multiple thread heaps

2018-06-16 Thread Terry Mead
If the default memory manager for FP creates a heap for each thread, 
what happens if an object is created in one thread and freed by another ?
Also, do calls to New () allocate space on the thread heap or just 
allocated by the OS ?




---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Multiple thread heaps

2018-06-17 Thread Terry Mead
It is not a problem it just makes it a bit tricky tracking memory usage 
because of the delay between releasing the memory and it the reported 
heap usage decreasing.  I haven't had a good look at the source but 
maybe there is some way to take these pending releases into account.

Thanks for your input.

On 18/06/2018 3:36 AM, Florian Klämpfl wrote:

Am 17.06.2018 um 16:40 schrieb Fabio Luis Girardi:



Em Dom, 17 de jun de 2018 05:48, Florian Klämpfl 
mailto:flor...@freepascal.org>> escreveu:




    No. It is added to the "wait for free" queue of the thread which 
initially allocated it.




So, excluding the performance penalty, this is not a problem?


Why should it be a problem?

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal




---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal