How to debug machine code PROCs/FNs with Computer One Monitor (C1MON)?
How to debug machine code PROCs/FNs with Computer One Monitor (C1MON)?
I think I have already debugged machine code extensions with Computer One Monitor but can't remember how I did it. I've set the job ID in C1MON to a Minverva MultiBASIC with C1MONs job command and then called the extension (in this case a function) with print funcname (it's a function without parameters) but C1MON doesn't stop at the breakpoint I have set.
http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX

-
- Font of All Knowledge
- Posts: 4705
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: How to debug machine code PROCs/FNs with Computer One Monitor (C1MON)?
Hi Peter,
I use QMON to step through code.
Also the debugger in Qemulator is worth looking at.
I use QMON to step through code.
Also the debugger in Qemulator is worth looking at.
Regards,
Derek
Derek
Re: How to debug machine code PROCs/FNs with Computer One Monitor (C1MON)?
How and where did you set the breakpoint? The jobID is relatively irrelevant - Most monitors don't check what job is currently running when the code is running onto a breakpoint - You must have loaded the code to some address - also remember, the first part of an S*basic extension is a table, not code - setting a breakpoint there doesn't help - you must find the offset of he actual code that is called when the extension functions are used, then set the breakpoint there. The listing file (if your assembler produces one) helps to find the offset from the load address.ql_freak wrote: Sun May 04, 2025 5:55 pm I think I have already debugged machine code extensions with Computer One Monitor but can't remember how I did it. I've set the job ID in C1MON to a Minverva MultiBASIC with C1MONs job command and then called the extension (in this case a function) with print funcname (it's a function without parameters) but C1MON doesn't stop at the breakpoint I have set.
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: How to debug machine code PROCs/FNs with Computer One Monitor (C1MON)?
I have finally found the solution:
Load your extension (ideally in a MultiBASIC) with cde=RESPR(size):LBYTES 'filename_cde',cde:CALL cde:JOBS:PRINT HEX$(cde,32)
Switch into C1Mon and enter the command jobs (use a channel with a large window, in my config it is #3)
Find the MultiBASIC job id by comparing with the SuperBASIC JOBS output.
Then enter in C1mon:
job <jobid>
(job 0 for normal SuperBASIC)
Then set a breakpoint (you may dump the memory starting at cde, which we have printed in hex) in the code you have LBYTESed above and in C1MON finally enter:
go
Now you can call the machine code extension from SuperBASIC (e.g. a=REF_GETLNLO%) and C1Mon will stop at the break point (the BASIC job is suspended in this case). Now you can examine the registers, trace, ... finally enter go again so that the code return to BASIC (it should then react normally).
Edith (2025-05-12 Mon): "...shouldn't then..." in last paragraph -> "...should then..."
Load your extension (ideally in a MultiBASIC) with cde=RESPR(size):LBYTES 'filename_cde',cde:CALL cde:JOBS:PRINT HEX$(cde,32)
Switch into C1Mon and enter the command jobs (use a channel with a large window, in my config it is #3)
Find the MultiBASIC job id by comparing with the SuperBASIC JOBS output.
Then enter in C1mon:
job <jobid>
(job 0 for normal SuperBASIC)
Then set a breakpoint (you may dump the memory starting at cde, which we have printed in hex) in the code you have LBYTESed above and in C1MON finally enter:
go
Now you can call the machine code extension from SuperBASIC (e.g. a=REF_GETLNLO%) and C1Mon will stop at the break point (the BASIC job is suspended in this case). Now you can examine the registers, trace, ... finally enter go again so that the code return to BASIC (it should then react normally).
Edith (2025-05-12 Mon): "...shouldn't then..." in last paragraph -> "...should then..."
http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX
