Re: Bound program debuging

new topic     » goto parent     » topic index » view thread      » older message » newer message

George Walters wrote:
> 
> The message is understandable but the "line number" is not anything that i can
> figure out how to use. The error I was trying to find is in "main" routine
> that
> is approx 100 lines long.

Hi there,

There is a direct relationship between source line numbers in files and
the line numbers printed after a crash in v2.4 but it requires knowing
how each line is added to the total cache of lines for the exe file.
I dont know if this is possible to figure out in 2.4 or not.

I had a nasty problem the other day where the exe program would crash
before it got through all the files but it would work fine in the exw 
form.  In other words, clicking on the .exw file would run the prog
just fine, but after binding and clicking on the resulting exe file
i would get an error:
"Unknown command"
which was one of the strangest errors ive ever seen so far with Eu.
After tracing it down it 'looked' like it had something to do with
the way 'pretty_print' was working in misc.e, but i gave up (because
it was time consuming to keep binding over and over after an attempted
correction).  It was a modified version of misc.e, but only two
lines, and the error never showed up in the exw form.

At least i was able to find the error location, and it's not hard
to do but takes some patience...

The method i used was to place an "abort(0)" statement about
half way through the program, then binded with the binder, then
ran the program in its exe form.  If the program still shows the
error (unknown command) then the error occurred BEFORE the abort(0)
statement (or else it would have simply aborted).  If the program
aborts, then the error is AFTER the abort(0) statement.
The second step is to move the abort(0) statement to another location
in the file(s):
If the error is BEFORE the abort(0) statement than move the abort
to a location earlier in the program, then bind and run again.
If the error is AFTER the abort(0) then move it farther on in the
program code, then bind and run over again.
Repeat until you've narrowed it down to one line.

It's a pain but it works :)
Of course you could riddle the code with printf's that print an
increasing number (1,2,3,4,.. etc) and see what the last number
printed is before the error occurs.  That helps too.

Example:

  printf(1,"%d\n",1)
  b=c
  printf(1,"%d\n",2)
  a=b
  printf(1,"%d\n",3)


In the above, if '1' is printed and then the error occurs you know
the error is in the line "b=c", but if '1' followed by '2' is
printed you know it's in the line "a=b".
Of course '3' never gets printed until ALL the lines pass without
error.



Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

 From "Black Knight":
"I can live with losing the good fight,
 but i can not live without fighting it".

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu