Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
lite-c debugging #182529
02/07/08 09:25
02/07/08 09:25
Joined: May 2002
Posts: 7,441
ventilator Offline OP
Senior Expert
ventilator  Offline OP
Senior Expert

Joined: May 2002
Posts: 7,441
it's really annoying that lite-c takes down SED when it crashes during debugging. constantly having to restart SED and opening the project again is a pain. can this be fixed in the future?

there also is a SED bug when stepping through the code. if you have multiple files open then it always stays in the same file for highlighting the lines (of course the wrong lines get highlighted then). the user has to check and change the file manually all the time.

it also would be great if lite-c didn't just display a crash message with some hex numbers when crashing but something more helpful. i haven't used c-script in a while but if i remember correctly it displayed more helpful messages when something like a invalid pointer caused a crash.

Re: lite-c debugging [Re: ventilator] #182530
02/07/08 10:11
02/07/08 10:11
Joined: Aug 2005
Posts: 1,012
germany, dresden
ulf Offline
Serious User
ulf  Offline
Serious User

Joined: Aug 2005
Posts: 1,012
germany, dresden
i can add here, that when you open lots of files in sed (10-15) at once and start your project lots of times ~50-100 testruns, you get longer compile times over time. for example usually the code takes ~0.5sec it increases up to 2.5sec and the game becomes very laggy/unplayable.
then after closing and restarting sed everything returns to normal.
this happend 3 times now.

Re: lite-c debugging [Re: ulf] #182531
02/07/08 11:48
02/07/08 11:48
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
I will look into this, and also check if we can safeguard SED better against engine crashes. In debug mode the engine is treated as a DLL, and a DLL crash always lets the main program crash also. There is no easy mechanism to prevent this on the SED side. The engine itself is heavily protected against crashes by the usual reasons, but it can still crash under some circumstances, for instance when calling a wrong address. We'll continue to improve that.

Re: lite-c debugging [Re: jcl] #182532
02/20/08 10:42
02/20/08 10:42
Joined: Feb 2007
Posts: 50
I
iuselitec Offline
Junior Member
iuselitec  Offline
Junior Member
I

Joined: Feb 2007
Posts: 50
this has to be improved! debugging currently is a huge pain. how about something like a stack trace when a crash happens?

and imagine visual c++ would quit all the time if your code crashes.

Re: lite-c debugging [Re: iuselitec] #182533
02/21/08 11:43
02/21/08 11:43
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Lite-C is extremely stable and almost never crashes. Even when you implement a crash bug in your code, lite-C normally just gives an error message that tells you which function is in trouble. It won't crash.

However, there are 3 known cases where lite-C can indeed crash:

- Calling an empty function prototype. This won't cause a crash anymore with 7.08.
- Loading a damaged image, model or sound file.
- Overwriting arbitrary data memory.

In the two latter cases, crashes can't be prevented - any program will crash under those circumstances. But this should be rare. So if you experience a reproducible crash in any other than the 3 mentioned cases, tell me and I'll fix that.

Re: lite-c debugging [Re: jcl] #182534
02/21/08 11:51
02/21/08 11:51
Joined: May 2002
Posts: 7,441
ventilator Offline OP
Senior Expert
ventilator  Offline OP
Senior Expert

Joined: May 2002
Posts: 7,441
i don't mind the crash in the two cases you mentioned (except that SED quits) but it would be great to have some assistance in finding the line where it happened.

Re: lite-c debugging [Re: jcl] #182535
02/21/08 11:54
02/21/08 11:54
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
Dereferencing an empty or otherwise invalid pointer also crashes without error message.

Re: lite-c debugging [Re: ventilator] #182536
02/21/08 11:57
02/21/08 11:57
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Ventilator: I know, but this is not possible in lite-C code because lite-C functions look like normal compiled C functions. They don't carry a function name and a crash line vector in C-Script. This is the price for the higher optimization of lite-C code. But we'll try to find a way to give a more detailed crash message when the program is run in debug mode.

Excessus: You mean something like "free(1);"? This should not cause a crash.

Re: lite-c debugging [Re: jcl] #182537
02/21/08 12:14
02/21/08 12:14
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
No, I mean using the "*" operator to dereference an invalid pointer:
int* p; // Not initialized
int a;
a = *p;

This will ofcourse also crash in normal C/C++, but it would be nice (especially for beginners), if there was a helpfull error message here, atleast indicating what kind of error was made. Like in C-script I remember getting invalid pointer errors for example when you use "player" when it isn't pointing to anything yet:
Code:

function main()
{
if(player.x == 10)
{

}
}


Crashes in Lite-C. In C-Script, I get "Empty pointer in main: (player.x == 10)

There are many other things that don't necessarily cause crashes, but still had more usefull error messages in C-script. For example array out of bounds:
Code:

var a[10];
var b;
function main()
{
b = a[11];
}


Didn't crash in my test program, but is certainly an error. In C-Script I get: "Invalid array index in main: b = a[11];". I understand that detecting this with variable indices requires storing the array length somewhere, so this can get complicated.

I think it's worth to sacrifice some performance benefits for ease of use. If you want performance, you can use C++.

Besides improving the debuging, I think it's important to educate the users more.. I've seen people use "var*" throughout their application where they meant "var", just because the manual mentions that every struct in Lite-C gets a * after it's type declaration... This actually seemed to work because var* can just store numbers as long as you don't use them as pointers. But this shows that many people don't know what a struct or a pointer is. So they're bound to make mistakes.

Re: lite-c debugging [Re: Excessus] #182538
02/21/08 12:26
02/21/08 12:26
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Faulty plugins can also lead to a complete crash... but I guesss there's not much that can be done to prevent this...

Page 1 of 2 1 2

Moderated by  aztec, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1