Recent

Author Topic: Incorrect Proc being called ???  (Read 3749 times)

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Incorrect Proc being called ???
« Reply #30 on: September 27, 2022, 04:46:24 pm »
Yeah, it's not actually an error. It's just a notification.
In Delphi you could have a similar dialog but it will only surface when the is an actual leak.
With heaptrc it always gives you a dialog.
The 0 unfreed shows you there are no leaks.

(Maybe there is a hack to not show the dialog when there is no leak but I'm not sure)
Thanks for the reassurance rvk  -  that was my suspicion.

Maybe the message 'Tittle' could be changed ?  That ought to be a simple enough task to inhibit confusion.
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Incorrect Proc being called ???
« Reply #31 on: September 27, 2022, 05:25:38 pm »
I don't think I have ever 'passed an array as a parameter'  -  I would be hard pressed to even describe what that actually meant :)

Passing a non-dynamic array as a parameter without a var/const/out prefix. That would put it on the stack, where underrun would mess up a return address or frame pointer etc.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Incorrect Proc being called ???
« Reply #32 on: September 28, 2022, 04:12:41 pm »
!!!!!  I'm now getting somewhat disturbed by what's happening in Laz 2.2  !!!!!

Opening my project this morning simply by double clicking the Laz 2.2 Icon - it opened a version prior to the conversion to dynamic arrays !!!!  I found this out because I had another 'Out of Bounds' Error :(   

When I closed the project yesterday I KNOW that the code was the version that had the dynamic arrays  %)

Due to the 'Backup' folder I was able to find the version which did have the mods and by clearing out the project folder and restoring the 4 files  (PAS, LFM, LPI & LPS) I was able to get back to where I was yesterday.

Now I could start the process of tracing why some of the historic figures were not being correctly filled (or so I thought).  In fact I came unstuck very quickly. Naturally once I've set up the screen position and the various basic house-keeping of reading the date (which also sets 'CurrWeek'), assigning the file names etc. I have to read the existing data (or create it. if it's a first time run) and the first process in that is to calculate the current Year, Quarter, Month & Week, all of which are simple assignments - viz:
Code: Pascal  [Select][+][-]
  1. 2895    Hist_Y := CurrWeek + 99;
  2. 2896    Hist_Q := CurrWeek - 13;
  3. 2897    Hist_M := CurrWeek - 4;
  4. 2898    Hist_W := CurrWeek - 1;
Hist_Y is assigned correctly but pressing [F7] or [F8] on line 2896 doesn't move the focus down to line 2897  -  it jumps to a totally different proc. at line 2843 - not to the start, but to the second line.
Code: Pascal  [Select][+][-]
  1. 2836  procedure ReadHistGasRates;
  2.   Var
  3.     i,p : byte;
  4.     S,
  5.     S1  : String;
  6.   begin
  7.     OpenCSVFile('Hist Gas Rates');
  8. 2843    Gas_Rate.StandCharge := 0
  9. [...]
Which is a proc which is only called when I'm initializing the data from historic .CSV Files

So I'm back to the original problem  %)

I'm not getting RangeCheck errors so it cannot be data over-writing code (however tenuous that might have been as a cause).

????
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: Incorrect Proc being called ???
« Reply #33 on: September 28, 2022, 04:45:19 pm »
I'm not getting RangeCheck errors so it cannot be data over-writing code (however tenuous that might have been as a cause).
The I/O and Range error checking are not full proof.
When doing "bad" things, they could still slip passed the error checking.

Seeing that you still have weird jumping in your code, there is definitely still something wrong.
Without any code we can't tell you exactly where and what.

(You did check the I/O, Range, overflow and Stack checking is still on in the project options?)

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Incorrect Proc being called ???
« Reply #34 on: September 28, 2022, 05:00:18 pm »
I'm not getting RangeCheck errors so it cannot be data over-writing code (however tenuous that might have been as a cause).
The I/O and Range error checking are not fool [sic] proof.
When doing "bad" things, they could still slip passed the error checking.

Seeing that you still have weird jumping in your code, there is definitely still something wrong.
Without any code we can't tell you exactly where and what.

(You did check the I/O, Range, overflow and Stack checking is still on in the project options?)
I hadn't actually checked, but yes, they are all still in place  -   a good 'shout' though.

Agreed that there must still be something amiss ("bad" things  %) )  but as yet I can't think which part of my code might help remote diagnostic.

FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: Incorrect Proc being called ???
« Reply #35 on: September 28, 2022, 05:04:01 pm »
Agreed that there must still be something amiss ("bad" things  %) )  but as yet I can't think which part of my code might help remote diagnostic.
Best (apart from placing some code here) is stripping the code.
Start removing (after backup of course) parts of code that you are certain don't matter.
Test.
When the problem is still there continue stripping.
When the problem is gone, evaluate the code you have just taken out, and maybe continue stipping other code.

If you end up with small enough code (and don't know what the problem is), you could create a small project which reproduces the problem and you can place it here to be evaluated.

(Normally you will find the error yourself in step 1 to 4)

dseligo

  • Hero Member
  • *****
  • Posts: 1194
Re: Incorrect Proc being called ???
« Reply #36 on: September 28, 2022, 05:17:25 pm »
!!!!!  I'm now getting somewhat disturbed by what's happening in Laz 2.2  !!!!!

Opening my project this morning simply by double clicking the Laz 2.2 Icon - it opened a version prior to the conversion to dynamic arrays !!!!  I found this out because I had another 'Out of Bounds' Error :(   

When I closed the project yesterday I KNOW that the code was the version that had the dynamic arrays  %)

This is certainly not related to bugs in your program. I think there is something wrong with your Lazarus installation.
Did you take my advice on installing 2nd copy of Lazarus (reply #17)?

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Incorrect Proc being called ???
« Reply #37 on: September 30, 2022, 10:59:23 pm »
After quite a bit of testing and adjustment to get a fully operational program compiled under Laz 1.6 - and succeding - I tried again under my installation of Laz 2.2.0.

I wanted to make sure that all the data (tariffs etc.) was up to date just in case a 'rogue' un-initialized value might be causing the problem.

It's somewhat disturbing to report that the 'jump' still happened  :(    -   from this I considered that dseligo is most likely to be correct with regard to the cause being some issue with Laz 2.2.0.

To confirm this - without compromising the copy of Laz 2.2.0 which works for at least 5 recent new projects - I decided to install a completely new copy on a separate PC  - Win 10 rather than Win 7  but still 64bit - before doing so, I copied the project source & all data to the new PC.

The fresh installation is Laz 2.2.4 (being the latest) and, after adding the extra units, I opened the project which compiled without problem and stepping through did not cause the 'jump' - hooray!!

Now I have a suplimentary question.   -  It seems sensible to just reinstall Laz on my main PC but should I just over-write the Laz 2.2.0 version or would it be better to delete it first. It might seem a simple matter but the fact that I have the new(ish) programs which don't have any problem running when compiled under the existing Laz 2.2.0 installation makes me cautious.

FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

dseligo

  • Hero Member
  • *****
  • Posts: 1194
Re: Incorrect Proc being called ???
« Reply #38 on: October 01, 2022, 09:29:01 am »
Now I have a suplimentary question.   -  It seems sensible to just reinstall Laz on my main PC but should I just over-write the Laz 2.2.0 version or would it be better to delete it first. It might seem a simple matter but the fact that I have the new(ish) programs which don't have any problem running when compiled under the existing Laz 2.2.0 installation makes me cautious.

If you have enough space, I suggest you install a separate copy (I find that easiest to do with fpcupdeluxe).

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Incorrect Proc being called ???
« Reply #39 on: October 02, 2022, 02:48:56 am »
Now I have a suplimentary question.
If you have enough space, I suggest you install a separate copy (I find that easiest to do with fpcupdeluxe).
I'm sure I can find enough space but having tried to install fpcupdelexe on three occasion without success I'll just use the installation file I downloaded for the Win 10 PC and hope that I don't get into the same mess that I did when installing 2.2   %)

FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

dseligo

  • Hero Member
  • *****
  • Posts: 1194
Re: Incorrect Proc being called ???
« Reply #40 on: October 02, 2022, 03:35:29 am »
Now I have a suplimentary question.
If you have enough space, I suggest you install a separate copy (I find that easiest to do with fpcupdeluxe).
I'm sure I can find enough space but having tried to install fpcupdelexe on three occasion without success I'll just use the installation file I downloaded for the Win 10 PC and hope that I don't get into the same mess that I did when installing 2.2   %)

Be sure to check 'secondary installation' when installing Lazarus.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Incorrect Proc being called ???
« Reply #41 on: October 02, 2022, 08:34:34 am »
Another thing that's always worth considering: if Lazarus is confused, it might not be opening the right .lpi file. So we've got (a) the Lazarus (and FPC) binaries, (b) the IDE's per-user state and (c) the project itself.

If in doubt, it might be worth using passing the IDE the name of the correct .lpi at startup (I presume that Windows has /some/ equivalent of unix shell sessions). And it's also worth considering that replacing (a) won't necessarily set everything in (b) back to a safe default.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Incorrect Proc being called ???
« Reply #42 on: October 02, 2022, 06:35:21 pm »
Be sure to check 'secondary installation' when installing Lazarus.
That's a good 'heads up' and was already on my radar, thanks.

I haven't bitten the bullet yet,   'Life' is getting in the way  (actually death  :(   - of friends)
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Incorrect Proc being called ???
« Reply #43 on: October 02, 2022, 06:40:33 pm »
Another thing that's always worth considering: if Lazarus is confused, it might not be opening the right .lpi file. So we've got (a) the Lazarus (and FPC) binaries, (b) the IDE's per-user state and (c) the project itself.

If in doubt, it might be worth using passing the IDE the name of the correct .lpi at startup (I presume that Windows has /some/ equivalent of unix shell sessions). And it's also worth considering that replacing (a) won't necessarily set everything in (b) back to a safe default.

MarkMLl
Another good point Mark, but throughout this saga I have made a point of selecting the .LPI file and pasting that to the specific version of Lazarus (Drag'n'drop on the icon) rather than opening Lazarus first. I have now also set Laz to not open the last project automatically.
« Last Edit: October 03, 2022, 10:17:46 am by J-G »
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

dseligo

  • Hero Member
  • *****
  • Posts: 1194
Re: Incorrect Proc being called ???
« Reply #44 on: October 02, 2022, 11:22:47 pm »
(actually death  :(   - of friends)

My condolences

 

TinyPortal © 2005-2018