TURBO'd app that hangs the QL on termination...

Anything QL Software or Programming Related.
stevepoole
Super Gold Card
Posts: 712
Joined: Mon Nov 24, 2014 2:03 pm

Re: TURBO'd app that hangs the QL on termination...

Post by stevepoole »

Hi Martyn,

Do you close your windows in the reverse order to which you opened them in your FOR loop ?

Have you tried EXECUTE_A name_task ? ( ALT-SPACE to abort ?)

Steve.


martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: TURBO'd app that hangs the QL on termination...

Post by martyn_hill »

Hi Rich

Return stack and/or Maths stack - yeah - I wouldn't be surprised if one of my one customised extensions is causing trouble...

What's the best way to track-down stack issues? Will SYSMON cut it, or do I need a debugger/monitor?

Steve - I'll try closing down the CON channels and any other resources that allocate space in reverse order and see if that helps.

Thanks for the ideas!


User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: TURBO'd app that hangs the QL on termination...

Post by pjw »

martyn_hill wrote:What's the best way to track-down stack issues? Will SYSMON cut it, or do I need a debugger/monitor?
As a start you might try running your toolkit in a loop to see if it eats memory. Particularly any functions you might have written. Eg

m = free_mem
for i = 0 to 9999
x$ = MY_FUNCTION
if m <> free_mem: print "bang!": exit i
endfor i
print m - free_mem

The above is very general and basic, of course, but you get the idea.

Other tests may also reveal stack errors, such as:

print MY_FUNCTION & "x"
print "x" & MY_FUNCTION

If it passes those tests, it may be time to reach for a debugger!


Per
dont be happy. worry
- ?
User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: TURBO'd app that hangs the QL on termination...

Post by dilwyn »

I'm following this thread with interest - I'll be fascinated when this is tracked down.

I don't have any further ideas to suggest other than what people like Per have already suggested. Always amazed at how ready people on here are to try to help others, I'm sure that's what this forum is all about.

In the past when I've got bogged down with issues such as this I've ended up having to split the program into test components and build test programs to replicate suspect parts of a program. This sometimes throws up completely unexpected results in that the problem turns out to be something completely unrelated to where I thought the problem might lie. A classic was two identically named functions in different toolkits which worked sufficiently closely that the problem wasn't immediately apparent, but subtle differences in the way they worked caused havoc and it took me ages to resolve that one.

Per's comments about functions and stack issues are a great example of such a program and issues such as "stack crawl" whereby the odd byte or word errors make all sorts of chaos.

Good luck with this Martyn and do please let us know what the problem was - it does sound as though it needs documenting!


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: TURBO'd app that hangs the QL on termination...

Post by NormanDunbar »

Evening All,

I discovered some undocumented information re the Maths Stack some years ago when writing, no - debugging, DJToolkit. I documented it in my assembly language articles in QL Today . You can download my book from http://qdosmsq.dunbar-it.co.uk/download ... sembly.pdf and checkout pages 118 to 120 - sections 7.9 through 7.9 which might be of some help. Maybe.

It certainly helped when I was debugging to know what the value in A1 meant on entry to a function or procedure.


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: TURBO'd app that hangs the QL on termination...

Post by martyn_hill »

Thanks for the ideas, everyone!

I'll dive back-in to this issue after devoting some renewed effort on another of my projects (the QLUB Adapter.)

M.


martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: TURBO'd app that hangs the QL on termination...

Post by martyn_hill »

Hello again!

An update to this old issue I was facing, and never quite got to the bottom-of...

I have just deployed Wolfgang's SDC/Win driver to my Minerva-based QL and, whilst it still remains unclear the cause of the original hanging of my TURBO'd app, the issue has curiously gone away - with no further changes to the app nor the various toolkit extensions in the meantime.

I choose to remain open as to why the app would hang as it did - there was still some work to do to eliminate my extensions and their Maths stack usage from the equation, but for now at least, it would appear that the app behaves better with Wolfgang's WIN driver than it did with the (excellent!) QubIDE driver on SDC.

Thanks to everyone who gave this some thought!

M.


EmmBee
Trump Card
Posts: 240
Joined: Fri Jan 13, 2012 5:29 pm
Location: Kent

Re: TURBO'd app that hangs the QL on termination...

Post by EmmBee »

martyn_hill wrote:Hello again!

An update to this old issue I was facing, and never quite got to the bottom-of...

I have just deployed Wolfgang's SDC/Win driver to my Minerva-based QL and, whilst it still remains unclear the cause of the original hanging of my TURBO'd app, the issue has curiously gone away - with no further changes to the app nor the various toolkit extensions in the meantime.

I choose to remain open as to why the app would hang as it did - there was still some work to do to eliminate my extensions and their Maths stack usage from the equation, but for now at least, it would appear that the app behaves better with Wolfgang's WIN driver than it did with the (excellent!) QubIDE driver on SDC.

Thanks to everyone who gave this some thought!

M.
Hi all,

I am wondering whether Martyn might be interested in revisiting this old issue?
It is always interesting tracking down bugs, and I have 3 ideas ...

Idea 1. - CHARGE on QPC using TURBO_TK_CODE instead of TURBO_SMS_CODE

Idea 2. - Instead of using EX and EW, use the Turbo Commands EXECUTE and EXECUTE_W to start the program off.

Idea 3. - I have written a program that adds in tracking information to an existing Basic program.
This program was written specifically to track down such bugs such as this bug where the QL crashes. It works on a
procedure by procedure bases, and may be able to shed some light on what is going on before the crash.
The program could be run twice, once under the Interpreter, and once under Turbo, to produce 2 separate reports.
These reports could then be compared to find out whether they both did the same thing, and stopped at the same place, or whether they diverged to produce different results.
For details, see here - viewtopic.php?f=3&t=3520&p=37386&hilit=tracking#p37386

EmmBee


EmmBee
Trump Card
Posts: 240
Joined: Fri Jan 13, 2012 5:29 pm
Location: Kent

Re: TURBO'd app that hangs the QL on termination...

Post by EmmBee »

Hi Martyn,

You are welcome to try my tracking program if you wish. I’m hoping you will, it could help to verify your initial findings.

The above said, since your compiled code executes right up to the STOP, my program will probably not be able to offer any more reports.

I do have another suggestion to make. You are using a modified DIYTK TIMER ext. From memory, I seem to recall that Dilwyn wrote a modified version some years ago, but which contained a bug. With no disrespect, his published version did not work. Unless this has been fixed in the meantime, this could be the reason why your compiled program crashes on exit. I’ve searched for TIMER and have found a post of mine, 3rd January 2015. See here https://www.qlforum.co.uk/viewtopic.php ... t=10#p9440
I talk about both Turbo and QLiberator programs crashing.

The suggestion is to remove the assembler code, and instead LRESPR the Timer extension file only in your Minerva-QL’s boot file. You might also replace pauses with Turbo’s SUSPEND_TASK to cope with users typing in unwanted key presses.


Michael

EmmBee


User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: TURBO'd app that hangs the QL on termination...

Post by dilwyn »

Yes, I tried to modify the timer code by moving the definition block to the start of the code, to make it easier to work out adding a compiler directive. There were a lot of ifs and buts, such as not knowing which assembler Simon had used originally, so there was a risk of .w and .l mixups etc. I seem to remember it was when my late wife was ill so I don't think I ever had a chance to follow it up. Might also be worth looking at the keyword name lengths in case - at least one of them had a name longer than seven characters.


Post Reply