Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Is there no way to get precise line of error?

Author
Message
Cybermind
Valued Member
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 16th Mar 2013 12:34
Hi, I am having a great deal of trouble finding the lines with errors as the IDE useually high lights wrong lines when an error occurs. Is there really no way to get the right line in question?? As my code gets bigger it gets harder to find the lines withouth help :-(

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 16th Mar 2013 13:19
I do not know; I prefer to use the Indigo IDE.

Cybermind
Valued Member
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 16th Mar 2013 13:30 Edited at: 16th Mar 2013 13:44
Does it have precise error line marking?

EDIT: I tried Indigo now and it does not highlight any line at all :-(

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 16th Mar 2013 13:54
when the dbp app crashes, it shows ya the line of the error.
if thats not the help you are looking for, its time for debuggin!
the way i do that, i use "exit prompt" so, when the dbp crashes, you get "exit prompt"
see how it works over the syntax help

Advanced Updater for your games!
Cybermind
Valued Member
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 16th Mar 2013 14:21
Thank you Sergey K, that tip seems very usefull, I just tried it and it outputs what I want. Too bad that the program clogged up elsewhere and I had to hit alt+F4 I am having a great deal of trouble whit a part of my program that I tried to simplify, I ended up with making things worse

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 16th Mar 2013 15:34
You seem to have your situation sorted; but anyhow, in Indigo you tell it what line you want to go to using; go to line (the one in the menu) and it takes you to the correct line 99% of the time.

Post up your code here, maybe we can help.

ShellfishGames
13
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 16th Mar 2013 16:30
I'm using the "new" official editor (Synergy I guess) and there are no problems with line numbers. When a runtime error occurs the editor jumps to the line that caused it (sometimes it's like 1 line off, but that's not really a problem).

With the old editor the line numbers were wrong when I used select-endselect somewhere in my code. I can't remember the exact relation, but I think each comment line inside a select-block resulted in an offset of one for all lines behind this select-block... or something like that. Not sure if that was a bug of the editor itself or the compiled exes just returned wrong line numbers though.

And if everything else fails, you can just insert empty lines at different places to find out where exactly the error occurs. This might be a nasty work around, but at least it works. So if you think the error is caused by one function:



and the exe reports an error in line X, you can try to reproduce the same error with the code being altered as follows:




If the error is still reported to be in line X it has to be before this function, if the line number has changed to X+1, X+2 or X+3, cmd1()/cmd2()/cmd3() caused it and if the line number is bigger than X+3 the error was caused somewhere behind this function.

To be honest I worked with this system of debugging (or rather of finding the actual line of code where the error occurs...) for several years since I was too lazy to use another IDE.

Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 16th Mar 2013 18:17
Good info

Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 16th Mar 2013 19:06
If I recall correctly, the reported line number is indeed the correct line... in the FullSourceDump.dba file you can find in your temp folder.
There is some precompilation that happens before the code is compiled; most notably all source files are concatenated and that obviously will result in wrong line numbers as "line 3762" might in fact refer to line 328 in the fifth included file.
Some other things are probably done as well such as replacing constant names with their values; this might trim the constant declarations from the source dump. Likewise comments might be removed. I think the old editor did not really pay attention to all this, the new ones might but they are still oftentimes off by a bit so there might be something they're not considering when estimating the "real" line number and file (in the original source).
Anyway, by opening your FullSourceDump file you can easily find the offending line.


"Why do programmers get Halloween and Christmas mixed up?"
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 16th Mar 2013 20:31
Quote: "by opening your FullSourceDump file you can easily find the offending line."


Rudolpho, that reminds me... sometimes checking the error line in the project or the dump file does not help. The compiler error message is not always true. Sometimes the error is not at the line in question. Sometimes the entire error message is false; unrelated to the real problem.

Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 16th Mar 2013 21:57
Well, I'm talking about compile-time errors. Runtime errors can probably be much harder to track down; a sprite call might fail because the image hasn't been loaded etc. Those issues are hard to track down to specific lines regardless of compilers and IDEs :p


"Why do programmers get Halloween and Christmas mixed up?"
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 16th Mar 2013 23:23
Indeed you were. An example of a compile time error that gives you the wrong line: 'Could not close nest at line X' or 'Unexpected/expected endif at line Y'.

This can occur when a function has not been closed.

Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 16th Mar 2013 23:26
Haha, good point.
The first one is pretty obvious that as it doesn't know where the function ends, it can't give you the proper line where it "should" end. The other one should be able to give a proper line I'd think and if it doesn't well... alright, then something's truly fishy with the line reporting


"Why do programmers get Halloween and Christmas mixed up?"
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 17th Mar 2013 13:11
Quote: "EDIT: I tried Indigo now and it does not highlight any line at all :-("


Actually this should not be the case, compile time errors are highlighted automatically in Indigo.

Cybermind
Valued Member
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 18th Mar 2013 13:01
Chris Tate: Thanks, I will try that in Indigo My code is way to big to be posted here, that part of the code is about 4.600 lines long :-P

ShellfishGames: I tried Synergy yesterday and I think it did the same :-P

Chris Tate (again) and Rudolpho: It is not compile time errors I am having trouble with, it is runtime errors :-P I did not think about the difference when I posted I have located the first error now and it seems that the code is not clogging up anymore (At some point a turn based battle in the game would just stop when a zombie tried to heal it self (are zombies able to heal them self at all??))

I normally use CodeSurge IDE btw

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...

Login to post a reply

Server time is: 2026-07-07 09:51:42
Your offset time is: 2026-07-07 09:51:42