Author Topic: in which line am i ?  (Read 7022 times)

0 Members and 1 Guest are viewing this topic.

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
in which line am i ?
« on: May 27, 2021, 05:22:46 am »
Hello ! when the program stops with an error message, it also tells you which queue the error is on. If I stop the program, it will exit the program. Is there any .log, large log file where qb records which line the program was on when I stopped it?
This would be very good if it could be read from somewhere, because in an infinite loop it would be easier to find the location of the error.

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: in which line am i ?
« Reply #1 on: May 27, 2021, 05:56:53 am »
it might be possible to hide it in the exe compiler, so that if you stop the program while pressing, for example, the shift or some "secret button", a window would say goodbye to which queue the program was on when you exited.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: in which line am i ?
« Reply #2 on: May 27, 2021, 07:05:12 am »
Write yourself a small routine to error trap your code.

ON ERROR GOTO DebugLine 'can't use GOSUB

ERROR 250 'simulated error code

END
DebugLine:
PRINT _ERRORLINE
RESUME NEXT  ‘Or END, if you want the program to close on error
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: in which line am i ?
« Reply #3 on: May 27, 2021, 08:34:48 am »
the problem is not that simple. for such cases I use it within a cycle
do ..... print # 1, X .... loop

vagy

do .... print timer, X .... loop

from these I see a value within a cycle and also whether it changes (timer)

There is a large program. The game. It runs nicely for minutes and then stops. It always triggers the same thing. But without an error message. So it doesn't break, it stops. exits ctrl + break .... so I think it's running .... . There are a lot of loops working in it and I will check back one by one, but how good it would be if you write ctrl + break somewhere, at which row, at which operation it was aborted. What’s the point of putting in the ERROR 250 if I know where I put it? On this basis I could write ERROR1, ERROR2, ERROR3 after each instruction .....
« Last Edit: May 27, 2021, 08:42:53 am by MasterGy »

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: in which line am i ?
« Reply #4 on: May 27, 2021, 11:33:36 am »
I'm not sure you understood Steve's suggestion but another thing you could do is open a console and echo the variable values you want to track. Or, you can write to a text file periodically in your loop and when the program ends you can inspect the last line and see what value the variables were when it failed.
Shuwatch!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: in which line am i ?
« Reply #5 on: May 27, 2021, 12:20:38 pm »
Yeah I like Spriggsy's suggestion, use console as 2nd window to report program data.

I had same problem in Pool program. It was hanging on breaks because of infinite loops (I thought vector code couldn't handle overlapping balls so I misdiagnosed problem), no errors are thrown so nothing to catch but the program just runs and runs and gets nowhere.

So if you print to console every time you loop some special loop ID you can see where you are getting stuck but this idea will really slow down execution so it is act of extreme desperation ;-))

What I did was printed an line ID before and after points in program and traced it down to where line x wasn't getting to line x + 1 say in top left corner of screen, you will see last line ID point that gets executed. Again slows the program execution way down and to be used only as extreme act of desperation.

Just make 2 points and move them closer and closer together until you isolate the bad section.

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: in which line am i ?
« Reply #6 on: May 27, 2021, 01:25:54 pm »
I managed to find the error.
But from that the question is still given. Because of the example, I made a BAS generation program to understand what I want :)

I'm looking for a mistake just like you. DE! What about this ?
Suppose I change one of the conditions and it does not exit the cycle.
Wouldn’t it be nice to know which line you’re on when we stop?

Code: QB64: [Select]
  1. DO: x0 = x0 + 1
  2.     DO: x1 = x1 + 1
  3.         DO: x2 = x2 + 1
  4.             DO: x3 = x3 + 1
  5.                 DO: x4 = x4 + 1
  6.                     DO: x5 = x5 + 1
  7.                         DO: x6 = x6 + 1
  8.                             DO: x7 = x7 + 1
  9.                                 DO: x8 = x8 + 1
  10.                                     DO: x9 = x9 + 1
  11.                                         DO: x10 = x10 + 1
  12.                                             DO: x11 = x11 + 1
  13.                                                 DO: x12 = x12 + 1
  14.                                                     DO: x13 = x13 + 1
  15.                                                         DO: x14 = x14 + 1
  16.                                                             DO: x15 = x15 + 1
  17.                                                                 DO: x16 = x16 + 1
  18.                                                                     DO: x17 = x17 + 1
  19.                                                                         DO: x18 = x18 + 1
  20.                                                                             DO: x19 = x19 + 1
  21.                                                                                 DO: x20 = x20 + 1
  22.                                                                                     DO: x21 = x21 + 1
  23.                                                                                         DO: x22 = x22 + 1
  24.                                                                                             DO: x23 = x23 + 1
  25.                                                                                                 DO: x24 = x24 + 1
  26.                                                                                                     DO: x25 = x25 + 1
  27.                                                                                                         DO: x26 = x26 + 1
  28.                                                                                                             DO: x27 = x27 + 1
  29.                                                                                                                 DO: x28 = x28 + 1
  30.                                                                                                                     DO: x29 = x29 + 1
  31.                                                                                                                         DO: x30 = x30 + 1
  32.                                                                                                                             DO: x31 = x31 + 1
  33.                                                                                                                                 DO: x32 = x32 + 1
  34.                                                                                                                                     DO: x33 = x33 + 1
  35.                                                                                                                                         DO: x34 = x34 + 1
  36.                                                                                                                                             DO: x35 = x35 + 1
  37.                                                                                                                                                 DO: x36 = x36 + 1
  38.                                                                                                                                                     DO: x37 = x37 + 1
  39.                                                                                                                                                         DO: x38 = x38 + 1
  40.                                                                                                                                                             DO: x39 = x39 + 1
  41.                                                                                                                                                                 DO: x40 = x40 + 1
  42.                                                                                                                                                                     DO: x41 = x41 + 1
  43.                                                                                                                                                                         DO: x42 = x42 + 1
  44.                                                                                                                                                                             DO: x43 = x43 + 1
  45.                                                                                                                                                                                 DO: x44 = x44 + 1
  46.                                                                                                                                                                                     DO: x45 = x45 + 1
  47.                                                                                                                                                                                         DO: x46 = x46 + 1
  48.                                                                                                                                                                                             DO: x47 = x47 + 1
  49.                                                                                                                                                                                                 DO: x48 = x48 + 1
  50.                                                                                                                                                                                                     DO: x49 = x49 + 1
  51.                                                                                                                                                                                                         DO: x50 = x50 + 1
  52.                                                                                                                                                                                                             DO: x51 = x51 + 1
  53.                                                                                                                                                                                                                 DO: x52 = x52 + 1
  54.                                                                                                                                                                                                                     DO: x53 = x53 + 1
  55.                                                                                                                                                                                                                         DO: x54 = x54 + 1
  56.                                                                                                                                                                                                                             DO: x55 = x55 + 1
  57.                                                                                                                                                                                                                                 DO: x56 = x56 + 1
  58.                                                                                                                                                                                                                                     DO: x57 = x57 + 1
  59.                                                                                                                                                                                                                                         DO: x58 = x58 + 1
  60.                                                                                                                                                                                                                                             DO: x59 = x59 + 1
  61.                                                                                                                                                                                                                                                 DO: x60 = x60 + 1
  62.                                                                                                                                                                                                                                                     DO: x61 = x61 + 1
  63.                                                                                                                                                                                                                                                         DO: x62 = x62 + 1
  64.                                                                                                                                                                                                                                                             DO: x63 = x63 + 1
  65.                                                                                                                                                                                                                                                                 DO: x64 = x64 + 1
  66.                                                                                                                                                                                                                                                                     DO: x65 = x65 + 1
  67.                                                                                                                                                                                                                                                                         DO: x66 = x66 + 1
  68.                                                                                                                                                                                                                                                                             DO: x67 = x67 + 1
  69.                                                                                                                                                                                                                                                                                 DO: x68 = x68 + 1
  70.                                                                                                                                                                                                                                                                                     DO: x69 = x69 + 1
  71.                                                                                                                                                                                                                                                                                         DO: x70 = x70 + 1
  72.                                                                                                                                                                                                                                                                                             DO: x71 = x71 + 1
  73.                                                                                                                                                                                                                                                                                                 DO: x72 = x72 + 1
  74.                                                                                                                                                                                                                                                                                                     DO: x73 = x73 + 1
  75.                                                                                                                                                                                                                                                                                                         DO: x74 = x74 + 1
  76.                                                                                                                                                                                                                                                                                                             DO: x75 = x75 + 1
  77.                                                                                                                                                                                                                                                                                                                 DO: x76 = x76 + 1
  78.                                                                                                                                                                                                                                                                                                                     DO: x77 = x77 + 1
  79.                                                                                                                                                                                                                                                                                                                         DO: x78 = x78 + 1
  80.                                                                                                                                                                                                                                                                                                                             DO: x79 = x79 + 1
  81.                                                                                                                                                                                                                                                                                                                                 DO: x80 = x80 + 1
  82.                                                                                                                                                                                                                                                                                                                                     DO: x81 = x81 + 1
  83.                                                                                                                                                                                                                                                                                                                                         DO: x82 = x82 + 1
  84.                                                                                                                                                                                                                                                                                                                                             DO: x83 = x83 + 1
  85.                                                                                                                                                                                                                                                                                                                                                 DO: x84 = x84 + 1
  86.                                                                                                                                                                                                                                                                                                                                                     DO: x85 = x85 + 1
  87.                                                                                                                                                                                                                                                                                                                                                         DO: x86 = x86 + 1
  88.                                                                                                                                                                                                                                                                                                                                                             DO: x87 = x87 + 1
  89.                                                                                                                                                                                                                                                                                                                                                                 DO: x88 = x88 + 1
  90.                                                                                                                                                                                                                                                                                                                                                                     DO: x89 = x89 + 1
  91.                                                                                                                                                                                                                                                                                                                                                                         DO: x90 = x90 + 1
  92.                                                                                                                                                                                                                                                                                                                                                                             DO: x91 = x91 + 1
  93.                                                                                                                                                                                                                                                                                                                                                                                 DO: x92 = x92 + 1
  94.                                                                                                                                                                                                                                                                                                                                                                                     DO: x93 = x93 + 1
  95.                                                                                                                                                                                                                                                                                                                                                                                         DO: x94 = x94 + 1
  96.                                                                                                                                                                                                                                                                                                                                                                                             DO: x95 = x95 + 1
  97.                                                                                                                                                                                                                                                                                                                                                                                                 DO: x96 = x96 + 1
  98.                                                                                                                                                                                                                                                                                                                                                                                                     DO: x97 = x97 + 1
  99.                                                                                                                                                                                                                                                                                                                                                                                                         DO: x98 = x98 + 1
  100.                                                                                                                                                                                                                                                                                                                                                                                                             DO: x99 = x99 + 1
  101.                                                                                                                                                                                                                                                                                                                                                                                                             LOOP WHILE x99 < 10
  102.                                                                                                                                                                                                                                                                                                                                                                                                         LOOP WHILE x98 < 10
  103.                                                                                                                                                                                                                                                                                                                                                                                                     LOOP WHILE x97 < 10
  104.                                                                                                                                                                                                                                                                                                                                                                                                 LOOP WHILE x96 < 10
  105.                                                                                                                                                                                                                                                                                                                                                                                             LOOP WHILE x95 < 10
  106.                                                                                                                                                                                                                                                                                                                                                                                         LOOP WHILE x94 < 10
  107.                                                                                                                                                                                                                                                                                                                                                                                     LOOP WHILE x93 < 10
  108.                                                                                                                                                                                                                                                                                                                                                                                 LOOP WHILE x92 < 10
  109.                                                                                                                                                                                                                                                                                                                                                                             LOOP WHILE x91 < 10
  110.                                                                                                                                                                                                                                                                                                                                                                         LOOP WHILE x90 < 10
  111.                                                                                                                                                                                                                                                                                                                                                                     LOOP WHILE x89 < 10
  112.                                                                                                                                                                                                                                                                                                                                                                 LOOP WHILE x88 < 10
  113.                                                                                                                                                                                                                                                                                                                                                             LOOP WHILE x87 < 10
  114.                                                                                                                                                                                                                                                                                                                                                         LOOP WHILE x86 < 10
  115.                                                                                                                                                                                                                                                                                                                                                     LOOP WHILE x85 < 10
  116.                                                                                                                                                                                                                                                                                                                                                 LOOP WHILE x84 < 10
  117.                                                                                                                                                                                                                                                                                                                                             LOOP WHILE x83 < 10
  118.                                                                                                                                                                                                                                                                                                                                         LOOP WHILE x82 < 10
  119.                                                                                                                                                                                                                                                                                                                                     LOOP WHILE x81 < 10
  120.                                                                                                                                                                                                                                                                                                                                 LOOP WHILE x80 < 10
  121.                                                                                                                                                                                                                                                                                                                             LOOP WHILE x79 < 10
  122.                                                                                                                                                                                                                                                                                                                         LOOP WHILE x78 < 10
  123.                                                                                                                                                                                                                                                                                                                     LOOP WHILE x77 < 10
  124.                                                                                                                                                                                                                                                                                                                 LOOP WHILE x76 < 10
  125.                                                                                                                                                                                                                                                                                                             LOOP WHILE x75 < 10
  126.                                                                                                                                                                                                                                                                                                         LOOP WHILE x74 < 10
  127.                                                                                                                                                                                                                                                                                                     LOOP WHILE x73 < 10
  128.                                                                                                                                                                                                                                                                                                 LOOP WHILE x72 < 10
  129.                                                                                                                                                                                                                                                                                             LOOP WHILE x71 < 10
  130.                                                                                                                                                                                                                                                                                         LOOP WHILE x70 < 10
  131.                                                                                                                                                                                                                                                                                     LOOP WHILE x69 < 10
  132.                                                                                                                                                                                                                                                                                 LOOP WHILE x68 < 10
  133.                                                                                                                                                                                                                                                                             LOOP WHILE x67 < 10
  134.                                                                                                                                                                                                                                                                         LOOP WHILE x66 < 10
  135.                                                                                                                                                                                                                                                                     LOOP WHILE x65 < 10
  136.                                                                                                                                                                                                                                                                 LOOP WHILE x64 < 10
  137.                                                                                                                                                                                                                                                             LOOP WHILE x63 < 10
  138.                                                                                                                                                                                                                                                         LOOP WHILE x62 < 10
  139.                                                                                                                                                                                                                                                     LOOP WHILE x61 < 10
  140.                                                                                                                                                                                                                                                 LOOP WHILE x60 < 10
  141.                                                                                                                                                                                                                                             LOOP WHILE x59 < 10
  142.                                                                                                                                                                                                                                         LOOP WHILE x58 < 10
  143.                                                                                                                                                                                                                                     LOOP WHILE x57 < 10
  144.                                                                                                                                                                                                                                 LOOP WHILE x56 < 10
  145.                                                                                                                                                                                                                             LOOP WHILE x55 < 10
  146.                                                                                                                                                                                                                         LOOP WHILE x54 < 10
  147.                                                                                                                                                                                                                     LOOP WHILE x53 < 10
  148.                                                                                                                                                                                                                 LOOP WHILE x52 < 10
  149.                                                                                                                                                                                                             LOOP WHILE x51 < 10
  150.                                                                                                                                                                                                         LOOP WHILE x50 < 10
  151.                                                                                                                                                                                                     LOOP WHILE x49 < 10
  152.                                                                                                                                                                                                 LOOP WHILE x48 < 10
  153.                                                                                                                                                                                             LOOP WHILE x47 < 10
  154.                                                                                                                                                                                         LOOP WHILE x46 < 10
  155.                                                                                                                                                                                     LOOP WHILE x45 < 10
  156.                                                                                                                                                                                 LOOP WHILE x44 < 10
  157.                                                                                                                                                                             LOOP WHILE x43 < 10
  158.                                                                                                                                                                         LOOP WHILE x42 < 10
  159.                                                                                                                                                                     LOOP WHILE x41 < 10
  160.                                                                                                                                                                 LOOP WHILE x40 < 10
  161.                                                                                                                                                             LOOP WHILE x39 < 10
  162.                                                                                                                                                         LOOP WHILE x38 < 10
  163.                                                                                                                                                     LOOP WHILE x37 < 10
  164.                                                                                                                                                 LOOP WHILE x36 < 10
  165.                                                                                                                                             LOOP WHILE x35 < 10
  166.                                                                                                                                         LOOP WHILE x34 < 10
  167.                                                                                                                                     LOOP WHILE x33 < 10
  168.                                                                                                                                 LOOP WHILE x32 < 10
  169.                                                                                                                             LOOP WHILE x31 < 10
  170.                                                                                                                         LOOP WHILE x30 < 10
  171.                                                                                                                     LOOP WHILE x29 < 10
  172.                                                                                                                 LOOP WHILE x28 < 10
  173.                                                                                                             LOOP WHILE x27 < 10
  174.                                                                                                         LOOP WHILE x26 < 10
  175.                                                                                                     LOOP WHILE x25 < 10
  176.                                                                                                 LOOP WHILE x24 < 10
  177.                                                                                             LOOP WHILE x23 < 10
  178.                                                                                         LOOP WHILE x22 < 10
  179.                                                                                     LOOP WHILE x21 < 10
  180.                                                                                 LOOP WHILE x20 < 10
  181.                                                                             LOOP WHILE x19 < 10
  182.                                                                         LOOP WHILE x18 < 10
  183.                                                                     LOOP WHILE x17 < 10
  184.                                                                 LOOP WHILE x16 < 10
  185.                                                             LOOP WHILE x15 < 10
  186.                                                         LOOP WHILE x14 < 10
  187.                                                     LOOP WHILE x13 < 10
  188.                                                 LOOP WHILE x12 < 10
  189.                                             LOOP WHILE x11 < 10
  190.                                         LOOP WHILE x10 < 10
  191.                                     LOOP WHILE x9 < 10
  192.                                 LOOP WHILE x8 < 10
  193.                             LOOP WHILE x7 < 10
  194.                         LOOP WHILE x6 < 10
  195.                     LOOP WHILE x5 < 10
  196.                 LOOP WHILE x4 < 10
  197.             LOOP WHILE x3 < 10
  198.         LOOP WHILE x2 < 10
  199.     LOOP WHILE x1 < 10
  200. LOOP WHILE x0 < 10

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: in which line am i ?
« Reply #7 on: May 27, 2021, 01:28:54 pm »
don't avoid the question! if I stop the program and get which queue you went to, it’s a huge help in many cases!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: in which line am i ?
« Reply #8 on: May 27, 2021, 01:34:20 pm »
Good grief that looks like way too much
Shuwatch!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: in which line am i ?
« Reply #9 on: May 27, 2021, 01:37:25 pm »
Here, as I was saying above -- just write your own error handler:

Code: QB64: [Select]
  1. ON ERROR GOTO DebugLine 'can't use GOSUB
  2.  
  3.  
  4. DO: x0 = x0 + 1
  5.     DO: x1 = x1 + 1
  6.         DO: x2 = x2 + 1
  7.             DO: x3 = x3 + 1
  8.                 DO: x4 = x4 + 1
  9.                     DO: x5 = x5 + 1
  10.                         DO: x6 = x6 + 1
  11.                             DO: x7 = x7 + 1
  12.                                 DO: x8 = x8 + 1
  13.                                     DO: x9 = x9 + 1
  14.                                         DO: x10 = x10 + 1
  15.                                             DO: x11 = x11 + 1
  16.                                                 DO: x12 = x12 + 1
  17.                                                     DO: x13 = x13 + 1
  18.                                                         DO: x14 = x14 + 1
  19.                                                             DO: x15 = x15 + 1
  20.                                                                 DO: x16 = x16 + 1
  21.                                                                     DO: x17 = x17 + 1
  22.                                                                         DO: x18 = x18 + 1
  23.                                                                             DO: x19 = x19 + 1
  24.                                                                                 DO: x20 = x20 + 1
  25.                                                                                     DO: x21 = x21 + 1
  26.                                                                                         DO: x22 = x22 + 1
  27.                                                                                             DO: x23 = x23 + 1
  28.                                                                                                 DO: x24 = x24 + 1
  29.                                                                                                     DO: x25 = x25 + 1
  30.                                                                                                         DO: x26 = x26 + 1
  31.                                                                                                             DO: x27 = x27 + 1
  32.                                                                                                                 DO: x28 = x28 + 1
  33.                                                                                                                     DO: x29 = x29 + 1
  34.                                                                                                                         DO: x30 = x30 + 1
  35.                                                                                                                             DO: x31 = x31 + 1
  36.                                                                                                                                 DO: x32 = x32 + 1
  37.                                                                                                                                     DO: x33 = x33 + 1
  38.                                                                                                                                         DO: x34 = x34 + 1
  39.                                                                                                                                             DO: x35 = x35 + 1
  40.                                                                                                                                                 DO: x36 = x36 + 1
  41.                                                                                                                                                     DO: x37 = x37 + 1
  42.                                                                                                                                                         DO: x38 = x38 + 1
  43.                                                                                                                                                             DO: x39 = x39 + 1
  44.                                                                                                                                                                 DO: x40 = x40 + 1
  45.                                                                                                                                                                     DO: x41 = x41 + 1
  46.                                                                                                                                                                         DO: x42 = x42 + 1
  47.                                                                                                                                                                             DO: x43 = x43 + 1
  48.                                                                                                                                                                                 DO: x44 = x44 + 1
  49.                                                                                                                                                                                     DO: x45 = x45 + 1
  50.                                                                                                                                                                                         DO: x46 = x46 + 1
  51.                                                                                                                                                                                             DO: x47 = x47 + 1
  52.                                                                                                                                                                                                 DO: x48 = x48 + 1
  53.                                                                                                                                                                                                     DO: x49 = x49 + 1
  54.                                                                                                                                                                                                         DO: x50 = x50 + 1
  55.                                                                                                                                                                                                             DO: x51 = x51 + 1
  56.                                                                                                                                                                                                                 DO: x52 = x52 + 1
  57.                                                                                                                                                                                                                     DO: x53 = x53 + 1
  58.                                                                                                                                                                                                                         DO: x54 = x54 + 1
  59.                                                                                                                                                                                                                             DO: x55 = x55 + 1
  60.                                                                                                                                                                                                                                 DO: x56 = x56 + 1
  61.                                                                                                                                                                                                                                     DO: x57 = x57 + 1
  62.                                                                                                                                                                                                                                         DO: x58 = x58 + 1
  63.                                                                                                                                                                                                                                             DO: x59 = x59 + 1
  64.                                                                                                                                                                                                                                                 DO: x60 = x60 + 1
  65.                                                                                                                                                                                                                                                     DO: x61 = x61 + 1
  66.                                                                                                                                                                                                                                                         DO: x62 = x62 + 1
  67.                                                                                                                                                                                                                                                             DO: x63 = x63 + 1
  68.                                                                                                                                                                                                                                                                 DO: x64 = x64 + 1
  69.                                                                                                                                                                                                                                                                     DO: x65 = x65 + 1
  70.                                                                                                                                                                                                                                                                         DO: x66 = x66 + 1
  71.                                                                                                                                                                                                                                                                             DO: x67 = x67 + 1
  72.                                                                                                                                                                                                                                                                                 DO: x68 = x68 + 1
  73.                                                                                                                                                                                                                                                                                     DO: x69 = x69 + 1
  74.                                                                                                                                                                                                                                                                                         DO: x70 = x70 + 1
  75.                                                                                                                                                                                                                                                                                             DO: x71 = x71 + 1
  76.                                                                                                                                                                                                                                                                                                 DO: x72 = x72 + 1
  77.                                                                                                                                                                                                                                                                                                     DO: x73 = x73 + 1
  78.                                                                                                                                                                                                                                                                                                         DO: x74 = x74 + 1
  79.                                                                                                                                                                                                                                                                                                             DO: x75 = x75 + 1
  80.                                                                                                                                                                                                                                                                                                                 DO: x76 = x76 + 1
  81.                                                                                                                                                                                                                                                                                                                     DO: x77 = x77 + 1
  82.                                                                                                                                                                                                                                                                                                                         DO: x78 = x78 + 1
  83.                                                                                                                                                                                                                                                                                                                             DO: x79 = x79 + 1
  84.                                                                                                                                                                                                                                                                                                                                 DO: x80 = x80 + 1
  85.                                                                                                                                                                                                                                                                                                                                     DO: x81 = x81 + 1
  86.                                                                                                                                                                                                                                                                                                                                         DO: x82 = x82 + 1
  87.                                                                                                                                                                                                                                                                                                                                             DO: x83 = x83 + 1
  88.                                                                                                                                                                                                                                                                                                                                                 DO: x84 = x84 + 1
  89.                                                                                                                                                                                                                                                                                                                                                     DO: x85 = x85 + 1
  90.                                                                                                                                                                                                                                                                                                                                                         DO: x86 = x86 + 1
  91.                                                                                                                                                                                                                                                                                                                                                             DO: x87 = x87 + 1
  92.                                                                                                                                                                                                                                                                                                                                                                 DO: x88 = x88 + 1
  93.                                                                                                                                                                                                                                                                                                                                                                     DO: x89 = x89 + 1
  94.                                                                                                                                                                                                                                                                                                                                                                         DO: x90 = x90 + 1
  95.                                                                                                                                                                                                                                                                                                                                                                             DO: x91 = x91 + 1
  96.                                                                                                                                                                                                                                                                                                                                                                                 DO: x92 = x92 + 1
  97.                                                                                                                                                                                                                                                                                                                                                                                     DO: x93 = x93 + 1
  98.                                                                                                                                                                                                                                                                                                                                                                                         DO: x94 = x94 + 1
  99.                                                                                                                                                                                                                                                                                                                                                                                             DO: x95 = x95 + 1
  100.                                                                                                                                                                                                                                                                                                                                                                                                 DO: x96 = x96 + 1
  101.                                                                                                                                                                                                                                                                                                                                                                                                     DO: x97 = x97 + 1
  102.                                                                                                                                                                                                                                                                                                                                                                                                         DO: x98 = x98 + 1
  103.                                                                                                                                                                                                                                                                                                                                                                                                             DO: x99 = x99 + 1
  104.                                                                                                                                                                                                                                                                                                                                                                                                             LOOP WHILE x99 < 10
  105.                                                                                                                                                                                                                                                                                                                                                                                                         LOOP WHILE x98 < 10
  106.                                                                                                                                                                                                                                                                                                                                                                                                     LOOP WHILE x97 < 10
  107.                                                                                                                                                                                                                                                                                                                                                                                                 LOOP WHILE x96 < 10
  108.                                                                                                                                                                                                                                                                                                                                                                                             LOOP WHILE x95 < 10
  109.                                                                                                                                                                                                                                                                                                                                                                                         LOOP WHILE x94 < 10
  110.                                                                                                                                                                                                                                                                                                                                                                                     LOOP WHILE x93 < 10
  111.                                                                                                                                                                                                                                                                                                                                                                                 LOOP WHILE x92 < 10
  112.                                                                                                                                                                                                                                                                                                                                                                             LOOP WHILE x91 < 10
  113.                                                                                                                                                                                                                                                                                                                                                                         LOOP WHILE x90 < 10
  114.                                                                                                                                                                                                                                                                                                                                                                     LOOP WHILE x89 < 10
  115.                                                                                                                                                                                                                                                                                                                                                                     ERROR 5 'genereate an error on this  line on purpose
  116.                                                                                                                                                                                                                                                                                                                                                                 LOOP WHILE x88 < 10
  117.                                                                                                                                                                                                                                                                                                                                                             LOOP WHILE x87 < 10
  118.                                                                                                                                                                                                                                                                                                                                                         LOOP WHILE x86 < 10
  119.                                                                                                                                                                                                                                                                                                                                                     LOOP WHILE x85 < 10
  120.                                                                                                                                                                                                                                                                                                                                                 LOOP WHILE x84 < 10
  121.                                                                                                                                                                                                                                                                                                                                             LOOP WHILE x83 < 10
  122.                                                                                                                                                                                                                                                                                                                                         LOOP WHILE x82 < 10
  123.                                                                                                                                                                                                                                                                                                                                     LOOP WHILE x81 < 10
  124.                                                                                                                                                                                                                                                                                                                                 LOOP WHILE x80 < 10
  125.                                                                                                                                                                                                                                                                                                                             LOOP WHILE x79 < 10
  126.                                                                                                                                                                                                                                                                                                                         LOOP WHILE x78 < 10
  127.                                                                                                                                                                                                                                                                                                                     LOOP WHILE x77 < 10
  128.                                                                                                                                                                                                                                                                                                                 LOOP WHILE x76 < 10
  129.                                                                                                                                                                                                                                                                                                             LOOP WHILE x75 < 10
  130.                                                                                                                                                                                                                                                                                                         LOOP WHILE x74 < 10
  131.                                                                                                                                                                                                                                                                                                     LOOP WHILE x73 < 10
  132.                                                                                                                                                                                                                                                                                                 LOOP WHILE x72 < 10
  133.                                                                                                                                                                                                                                                                                             LOOP WHILE x71 < 10
  134.                                                                                                                                                                                                                                                                                         LOOP WHILE x70 < 10
  135.                                                                                                                                                                                                                                                                                     LOOP WHILE x69 < 10
  136.                                                                                                                                                                                                                                                                                 LOOP WHILE x68 < 10
  137.                                                                                                                                                                                                                                                                             LOOP WHILE x67 < 10
  138.                                                                                                                                                                                                                                                                         LOOP WHILE x66 < 10
  139.                                                                                                                                                                                                                                                                     LOOP WHILE x65 < 10
  140.                                                                                                                                                                                                                                                                 LOOP WHILE x64 < 10
  141.                                                                                                                                                                                                                                                             LOOP WHILE x63 < 10
  142.                                                                                                                                                                                                                                                         LOOP WHILE x62 < 10
  143.                                                                                                                                                                                                                                                     LOOP WHILE x61 < 10
  144.                                                                                                                                                                                                                                                 LOOP WHILE x60 < 10
  145.                                                                                                                                                                                                                                             LOOP WHILE x59 < 10
  146.                                                                                                                                                                                                                                         LOOP WHILE x58 < 10
  147.                                                                                                                                                                                                                                     LOOP WHILE x57 < 10
  148.                                                                                                                                                                                                                                 LOOP WHILE x56 < 10
  149.                                                                                                                                                                                                                             LOOP WHILE x55 < 10
  150.                                                                                                                                                                                                                         LOOP WHILE x54 < 10
  151.                                                                                                                                                                                                                     LOOP WHILE x53 < 10
  152.                                                                                                                                                                                                                 LOOP WHILE x52 < 10
  153.                                                                                                                                                                                                             LOOP WHILE x51 < 10
  154.                                                                                                                                                                                                         LOOP WHILE x50 < 10
  155.                                                                                                                                                                                                     LOOP WHILE x49 < 10
  156.                                                                                                                                                                                                 LOOP WHILE x48 < 10
  157.                                                                                                                                                                                             LOOP WHILE x47 < 10
  158.                                                                                                                                                                                         LOOP WHILE x46 < 10
  159.                                                                                                                                                                                     LOOP WHILE x45 < 10
  160.                                                                                                                                                                                 LOOP WHILE x44 < 10
  161.                                                                                                                                                                             LOOP WHILE x43 < 10
  162.                                                                                                                                                                         LOOP WHILE x42 < 10
  163.                                                                                                                                                                     LOOP WHILE x41 < 10
  164.                                                                                                                                                                 LOOP WHILE x40 < 10
  165.                                                                                                                                                             LOOP WHILE x39 < 10
  166.                                                                                                                                                         LOOP WHILE x38 < 10
  167.                                                                                                                                                     LOOP WHILE x37 < 10
  168.                                                                                                                                                 LOOP WHILE x36 < 10
  169.                                                                                                                                             LOOP WHILE x35 < 10
  170.                                                                                                                                         LOOP WHILE x34 < 10
  171.                                                                                                                                     LOOP WHILE x33 < 10
  172.                                                                                                                                 LOOP WHILE x32 < 10
  173.                                                                                                                             LOOP WHILE x31 < 10
  174.                                                                                                                         LOOP WHILE x30 < 10
  175.                                                                                                                     LOOP WHILE x29 < 10
  176.                                                                                                                 LOOP WHILE x28 < 10
  177.                                                                                                             LOOP WHILE x27 < 10
  178.                                                                                                         LOOP WHILE x26 < 10
  179.                                                                                                     LOOP WHILE x25 < 10
  180.                                                                                                 LOOP WHILE x24 < 10
  181.                                                                                             LOOP WHILE x23 < 10
  182.                                                                                         LOOP WHILE x22 < 10
  183.                                                                                     LOOP WHILE x21 < 10
  184.                                                                                 LOOP WHILE x20 < 10
  185.                                                                             LOOP WHILE x19 < 10
  186.                                                                         LOOP WHILE x18 < 10
  187.                                                                     LOOP WHILE x17 < 10
  188.                                                                 LOOP WHILE x16 < 10
  189.                                                             LOOP WHILE x15 < 10
  190.                                                         LOOP WHILE x14 < 10
  191.                                                     LOOP WHILE x13 < 10
  192.                                                 LOOP WHILE x12 < 10
  193.                                             LOOP WHILE x11 < 10
  194.                                         LOOP WHILE x10 < 10
  195.                                     LOOP WHILE x9 < 10
  196.                                 LOOP WHILE x8 < 10
  197.                             LOOP WHILE x7 < 10
  198.                         LOOP WHILE x6 < 10
  199.                     LOOP WHILE x5 < 10
  200.                 LOOP WHILE x4 < 10
  201.             LOOP WHILE x3 < 10
  202.         LOOP WHILE x2 < 10
  203.     LOOP WHILE x1 < 10
  204. LOOP WHILE x0 < 10
  205.  
  206.  
  207. DebugLine:
  208. PRINT "Your program has generated an error -- ERROR #"; ERR; "on line #"; _ERRORLINE
  209. PRINT "Would you like to save this information to disk?"
  210.     a$ = UCASE$(INKEY$)
  211.     _LIMIT 10
  212. LOOP UNTIL a$ = "Y" OR a$ = "N"
  213. IF a$ = "Y" THEN
  214.     OPEN "temp.txt" FOR OUTPUT AS #1
  215.     PRINT #1, "Your program has generated an error -- ERROR #"; ERR; "on line #"; _ERRORLINE
  216.  

I used your example and tossed a simulated error in there at some random point, and this seems to do the job for me on finding it easily enough.  Are you certain something like this won't work for your needs?
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: in which line am i ?
« Reply #10 on: May 27, 2021, 01:48:16 pm »
But @SMcNeill  you need an error thrown! In an infinite loop no errors get thrown. Am I missing something?

I say either:
1: print out all x(i) (and why not use an array MasterGy?) in console window and see which one isn't going anywhere

or
2: print loop id number before and after the loop(s) and narrow down the problem loop.

print (to console?) enter loop IdX
do(s)
  print enter loop IdY
  do(s)

  loops
  print exit  loop IdY
loop(s)
print exit loop IdX

for nested loops start in deepest nest and work your way out until you don't get an exit message.
« Last Edit: May 27, 2021, 02:01:16 pm by bplus »

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: in which line am i ?
« Reply #11 on: May 27, 2021, 01:49:19 pm »
SMcNeil, and if the infinite cycle does not occur at 89? we are there. then in the worst case I have to place "error 5" in 100 places and try again? Instead of "error 5" we can also do "print" HERE I AM ".... this does not solve the infinite loop error finding.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: in which line am i ?
« Reply #12 on: May 27, 2021, 01:50:02 pm »
If you're talking about storing the line number for when you decide to manually close a program, you'd want to use _EXIT and ON TIMER to create a custom exit loop, along with a variable to store the line numbers you want to track.

Code: QB64: [Select]
  1.  
  2. t1 = FREETIMER
  3. ON TIMER(t1, 0.1) CheckExit
  4. TIMER(t1) ON
  5.  
  6. ln = 1: DO
  7.     ln = 2: DO
  8.         ln = 3: DO
  9.             ln = 4: DO
  10.             ln = 5: LOOP
  11.         ln = 6: LOOP
  12.     ln = 7: LOOP
  13. ln = 8: LOOP
  14.  
  15. SUB CheckExit
  16.     IF _EXIT THEN
  17.         PRINT "You manually exited the program on line #"; ln
  18.         SLEEP
  19.         END
  20.     END IF
  21.  

All endless loops.  This would normally lock a program up forever more, but you can use the nice big red X in the top right corner to exit and end the program at any time -- and when you do so, it'll tell you the line that it was on when you exited the program..

https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: in which line am i ?
« Reply #13 on: May 27, 2021, 01:52:54 pm »
yes Bplus, do you understand what I mean!

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: in which line am i ?
« Reply #14 on: May 27, 2021, 02:01:46 pm »
Wow ! i like this _EXIT command, i didn't know it before! De! you still avoided the question! You made 5 cycles and identified each one. I intentionally showed 100 cycles. then I put an ID in front of all a hundred? If I did, it would be enough to print the ID with an "on key".