After adding some new global variables ...

Just starting out? Need help? Post your questions and find answers here.
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: After adding some new global variables ...

Post by Saki »

Hi, yes, after 10 minutes or an hour working with the program a crash.
Then no one for a few days.
New PB versions, test, fine, go, then two days, crash !
It was a string between several numerical procedure parameters.
All the work, everything for the trash can, if you don't find it.
But find this, almost impossible.
A similar bug, but one that kept appearing and could be located, put me on the trail.
I had to cut 20,000 lines down to almost zero, more as one time.
Officially this bug does not exist, it cannot be reproduced with mini codes.
Therefore, it usually only occurs when the codes become very large, then it becomes narrow and overwriting becomes easier to find a target.
地球上の平和
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: After adding some new global variables ...

Post by Mistrel »

Some bugs are exceptionally difficult to reproduce. I'm sure many of us have experienced this at some point.

Anyways, the debugger isn't suppose to crash at random. I'm sure there is a bug. But Fred can't fix it unless hr can reproduce it. You get to decide if you want to continue with the debugger off or put the time into submitting code that will crash for us in the same way.

You can try asking Fed or Phreak in a private message if you can send them code privately if you need to.
marc_256
Addict
Addict
Posts: 859
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: Nach dem Hinzufügen einiger neuer globaler Variablen ...

Post by marc_256 »

Saki wrote: Have you ever thought about turning on the Purifier ?
In your case it will probably not help, but you always have to try it.
So I did some tests with and without the Purifier.
Always the same problem.

This message is not the first time I have with (very) large files ...
viewtopic.php?f=28&t=74132

This is not a problem of the last versions of PB.

I did cut more than the part of my program to become before the message,
and still have the crash message in the IDE.
Strange, :evil: will continue to cut parts of my large program and see ...

marc
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: After adding some new global variables ...

Post by Saki »

Hi,
that approaches the problem I described.
Start with procedures that have strings in their parameters.
Temporarily, they can usually be easily removed for testing purposes.
Convert val() or anything else that works with strings before you pass it to a procedure, or within the procedure.

I wouldn't be surprised if you find the error then.

I myself almost never work with screen, almost always only with canvas,
so I can't tell if anything else is happening in that direction.

But it is always the best approach to start with the strings in the procedure parameters when looking for the error.

If you can confirm the string bug, that would be a blessing,
as he strikes most foul and treacherously.

@Mistrel
The bug itself is exactly described.
It's probably the primary method itself how the string is passed and it's always the same.
If there is a buffer overflow, it is localizable, no matter if a test code causes a crash or not.

Best Regards Saki
地球上の平和
marc_256
Addict
Addict
Posts: 859
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: After adding some new global variables ...

Post by marc_256 »

You are never gone believe this ...

I removed one by one parts of my program,
till the moment I could compile the program with the debugger enabled.

After that point I added one by one the removed parts to find the exact place the compiler crash appears ...

So, :evil: :evil: :evil: :evil: :evil: after added all the part ALL WORKS WELL even with the debugger enabled ?????

I can't finger point the problem at all !!!

And I even added some new stuff like this :

Image
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Nach dem Hinzufügen einiger neuer Variablen globaler ...

Post by Saki »

Yes,
it always depends on how the memory is used.
Using the example of strings, things happen when the termination of the string, that is, the two zeros are overwritten.
Then the system tries to read the "string" until two zeros are found.
If the string overwrites a variable or data, these can quickly assume an invalid value.
This get the crash.

You do very nice things on the screen.

Best Regards Saki
地球上の平和
marc_256
Addict
Addict
Posts: 859
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: After adding some new global variables ...

Post by marc_256 »

Hi Saki,

I LOVE PureBasic, the reasons see pictures below. 8)
But there are moments I have a love/hate relation with PB...
Well today is (again) one of them, :twisted:
I added:

1x Declare MyContainer()
20 Globals (word and long)
1x Structure MyStructure
1x Global Dim MyContainer.MyStructure
1x Procedure MyContainer()

Nothing want to start again.
And again the CRASH message
And if I disable the debugger, PB compiles the program and stops (quit) PB.
Without any error message at all !!! :evil:

I think you are right about the memory management of variables and strings...

thanks for the info,
marc

Image

Image
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: After adding some new global variables ...

Post by Saki »

Very nice work Marc !
Last edited by Saki on Tue Aug 25, 2020 1:57 pm, edited 1 time in total.
地球上の平和
User avatar
skywalk
Addict
Addict
Posts: 4262
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: After adding some new global variables ...

Post by skywalk »

marc_256 wrote:I LOVE PureBasic, the reasons see pictures below. 8)
But there are moments I have a love/hate relation with PB...
Well today is (again) one of them, :twisted:
I added:

1x Declare MyContainer()
20 Globals (word and long)
1x Structure MyStructure
1x Global Dim MyContainer.MyStructure
1x Procedure MyContainer()

Nothing want to start again.
And again the CRASH message
And if I disable the debugger, PB compiles the program and stops (quit) PB.
Without any error message at all !!! :evil:
You never answered if you are attempting your app entirely with source code?
Did you parse out lib functions to dll's?
I also remember a hard to track bug when I exceeded the allotted memory for a procedure.
I solved that with a global memory structure instead of defining it within the procedure.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Fred
Administrator
Administrator
Posts: 18390
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: After adding some new global variables ...

Post by Fred »

If you can reproduce it everytime, please send me a PM with your project so I can try to replicate here.
Post Reply