Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:34 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Debugging Woes..

Author Message
Atomizer_Zero
Senior Member

Joined: 04/07/2020
Location: United Kingdom
Posts: 134
Posted: 09:07am 28 Jul 2020
Copy link to clipboard 
Print this post

I have a rather large project in development right now for the CMM2. things are progressing OK. The one thing that I wish we had was code stepping. Even if its just a feature to print out each line of code as it hits it. I know "TRACE LIST" is pretty much that, but I find its not that useful when you're executing thousands of lines of code.

I primarily use "OPTION CONSOLE SERIAL", and use tera term to do my coding, with a vga capture into OBS, so I have the terminal on one half of my screen and the vga output on the other half. Works nicely.

At the moment, I'm printing the values of various variables in a long line, for example,
? "var1: " ;: ? var1 ;: ? "var2: " ;: ? HEX$(var2, 4)

This works well enough in most cases, but there's certain parts of my code where i'm not even sure it's being triggered, due to the nature of the program.

I will say that I do appreciate the work that has gone into making the CMM2 such a pleasure to work with. Certainly has been interesting so far, and i've learnt a lot more than I expected from using it.

One last thing, I haven't announced what this project is yet. All in due time ;)
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 09:44am 28 Jul 2020
Copy link to clipboard 
Print this post

I often put in a PRINT "We are in the xxx routine" to know that I got to where I thought I should be.
I also use MMEdit which lets me turn that sort of debugging on and off relatively easily.

Jim
VK7JH
MMedit
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 10:45am 28 Jul 2020
Copy link to clipboard 
Print this post

As an aside,

  Atomizer_Zero said  
? "var1: " ;: ? var1 ;: ? "var2: " ;: ? HEX$(var2, 4)


that is a bizarre construct and the following is I believe equivalent:
? "var1: "; var1; "var2: "; HEX$(var2, 4)


i.e. you don't need the separate Print/? statements.

Best wishes,

Tom
Edited 2020-07-28 20:45 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Atomizer_Zero
Senior Member

Joined: 04/07/2020
Location: United Kingdom
Posts: 134
Posted: 11:27am 28 Jul 2020
Copy link to clipboard 
Print this post

  TassyJim said  I often put in a PRINT "We are in the xxx routine" to know that I got to where I thought I should be.
I also use MMEdit which lets me turn that sort of debugging on and off relatively easily.

Jim


MM_Edit looks to be a great piece of software, but I'm having trouble understanding how to use it exactly.


  thwill said  As an aside,

  Atomizer_Zero said  
? "var1: " ;: ? var1 ;: ? "var2: " ;: ? HEX$(var2, 4)


that is a bizarre construct and the following is I believe equivalent:
? "var1: "; var1; "var2: "; HEX$(var2, 4)


i.e. you don't need the separate Print/? statements.

Best wishes,

Tom


Ah, fair enough.
I knew that ";" ignores newline/carriage return, and I knew that ":" meant that you could have multiple statements on one line, so I assumed i'd need ;: and then the statement, which was a print statement, hence ;:? .
Good to know, thanks!
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 11:42am 28 Jul 2020
Copy link to clipboard 
Print this post

For what it is worth you can also dispense with the semi colon between values in the PRINT argument list.  So, this will also work:
? "var1: " var1 "var2: " HEX$(var2, 4)

Geoff Graham - http://geoffg.net
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 11:48am 28 Jul 2020
Copy link to clipboard 
Print this post

  Geoffg said  For what it is worth you can also dispense with the semi colon between values in the PRINT argument list.  So, this will also work:
? "var1: " var1 "var2: " HEX$(var2, 4)


You live and learn ;-)
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Atomizer_Zero
Senior Member

Joined: 04/07/2020
Location: United Kingdom
Posts: 134
Posted: 12:01pm 28 Jul 2020
Copy link to clipboard 
Print this post

As i've said, I've learned so much by using this device. But there's certainly a MEGATON amount of things I need to learn still, which is great. Soon, i'm going to announce the project i've been working on, and then beg for help in speeding it up xD
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 12:23pm 28 Jul 2020
Copy link to clipboard 
Print this post

  Atomizer_Zero said  I have a rather large project in development right now for the CMM2. things are progressing OK. The one thing that I wish we had was code stepping. Even if its just a feature to print out each line of code as it hits it. I know "TRACE LIST" is pretty much that, but I find its not that useful when you're executing thousands of lines of code.

I primarily use "OPTION CONSOLE SERIAL", and use tera term to do my coding, with a vga capture into OBS, so I have the terminal on one half of my screen and the vga output on the other half. Works nicely.

At the moment, I'm printing the values of various variables in a long line, for example,
? "var1: " ;: ? var1 ;: ? "var2: " ;: ? HEX$(var2, 4)

This works well enough in most cases, but there's certain parts of my code where i'm not even sure it's being triggered, due to the nature of the program.


not exactly the single stepping you would like, but this is what I use when i have a particularly tricky bit of code that is playing up. Much better than TRON as you specify what the lines are called and they don't move about with the edits as you write your prog

http://www.fruitoftheshed.com/MMBasic.Program-Step-A-Fast-Flexible-Debugging-Aid.ashx
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3378
Posted: 01:53pm 28 Jul 2020
Copy link to clipboard 
Print this post

  Atomizer_Zero said   . . . I know "TRACE LIST" is pretty much that, but I find its not that useful when you're executing thousands of lines of code.


We hit on at least an aspect of this last year: re TRACE
  lizby said  I haven't tried it, but I wonder if you could do some of what you want with flags and the "TRACE LIST nn" command (the problem being that I don't know how you can capture the output of TRACE LIST so that you could send it to the SDCARD rather than just to the console--or whether a watchdog reset also resets the TRACE LIST ring buffer). Some experimenting might be in order.

Access to the TRACE LIST ring buffer would be helpful in the situation you describe, perhaps in the form of an mm.traceArray() array variable.

[ watchdog reset does reset the TRACE LIST ring buffer ]
But
  Geoffg said  There is never one line that will cause the watchdog timer to time out.  However, retaining the trace memory is a possibility and that would provide a clue as to what caused the timeout.  

I will look into it.

Any further thoughts on this?
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025