Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Sharing a my new debugging tool


Rob @ Target Machine
 Share

Recommended Posts

After pulling my hair out trying to debug my custom subprogramming logic,

I devised a neat little tool to see what's going on, so I will share it.

 

I know of the tilde ~ method(bug4) , but I needed something different for my situation.

 

I hope this is of use to someone. It got me back up and running.

 

#

Add this switch after debug section:

 

code:

# --------------------------------------------------------------------------

# additional debug output

# --------------------------------------------------------------------------

#

showme : 0 #0 = No output, 1 = Show custom debug output

#

# --------------------------------------------------------------------------

Declare the variables and strings used to display values:

 

code:

# --------------------------------------------------------------------------

# additional debug variables

# --------------------------------------------------------------------------

fmt := " 4 sch

fmt "= " 4 sod

fmt "= " 4 sgd

fmt "= " 4 srd

fmt "= " 4 ssn

fmt "= " 4 stn

fmt "= " 4 stt

fmt "= " 4 stm

fmt "= " 4 mpn

fmt "= " 4 spn

fmt "= " 4 svp

fmt "= " 4 pgn

#

sshift " "# 30 spaces

# --------------------------------------------------------------------------

Define the postblocks:

 

code:

pshow_sub_ch

sch = subout$

sshift, "(-----------------)", e$

sshift, "subout$", *sch, e$

sshift, "(-----------------)", e$

 

pshow_me

sod = sub_op_id$

sgd = sub_grp_id$

srd = sub_ref_id$

ssn = sub_sec_no$

stn = sub_totl_no$

stt = sub_trnstyp$

stm = sub_trnmthd$

mpn = main_prg_no$

spn = sub_prg_no$

svp = sav_progno

pgn = progno$

 

sshift, "(-----------------)", e$

sshift, "subout$", *sch, e$

sshift, "sub_op_id$", *sod, e$

sshift, "sub_grp_id$", *sgd, e$

sshift, "sub_ref_id$", *srd, e$

sshift, "sub_sec_no$", *ssn, e$

sshift, "sub_totl_no$", *stn, e$

sshift, "sub_trnstyp$", *stt, e$

sshift, "sub_trnmthd$", *stm, e$

sshift, "main_prg_no$", *mpn, e$

sshift, "sub_prg_no$", *spn, e$

sshift, "sav_progno", *svp, e$

sshift, "progno$", *pgn, e$

sshift, "(-----------------)", e$

Insert argument to call "pshow_me", or "pshow_sub_ch" where you need to see values:

 

 

code:

	

pcust_call_s$ #Call to sub level

if showme<>0, pshow_me <-------------------------------- HERE

result = nwadrs(strp, sub_prg_no$)

if sub_sec_no$ <>0,

[

sub_prg_no$ = sub_prg_no$ + sav_progno

]

else,

[

sub_prg_no$ = sav_progno +1

sav_progno = sub_prg_no$

]

pbld, n$, "M98", *sub_prg_no$, e$

 

 

psub_st_s$ #Header in sub level

if showme<>0, pshow_sub_ch <---------------------------- HERE

result = nwadrs(stro, sub_prg_no$)

#sav_n2 = n

#n = seqno

spaces$ = 0

sub_ext = sub_prg_no$

" ", e$

*sub_prg_no$," (", sprogname$, sub_ext, "..SP", ")", e$

#*sub_prg_no," (", sprogname, "..SP", ")", e

spaces$ = 0

#if scomm0 <> snull, "(", *scomm0, ")", e

if scomment_holder <> snull,"(", scomment_holder, ")", e$

spaces$ = sav_spc

pbld, n$, sgabsinc, e$

 

psub_end_s$ #End in sub level

if showme<>0, pshow_sub_ch <---------------------------- HERE

n$, "M99", e$

prv_absinc$ = -1

#n = sav_n2

 

if sub_sec_no$ <>0 & sub_sec_no$ = sub_totl_no$,

[

sav_progno = sub_prg_no$

]

 

# At the merge

 

if showme<>0, "(sub files start here --------------------------------)", e$

mergesub$ #Merge tool subs or transform subs

clearsub$

if showme<>0, "(aux files start here --------------------------------)", e$

mergeaux$ #Merge depth cuts (non transform subs)

clearaux$

if showme<>0, "(ext files start here --------------------------------)", e$

mergeext$ #Merge custom drill cycle subs

clearext$

"%", e$

Note that you may need to adjust # of spaces in sshift to display correctly.

 

You can customize this for whatever values you need to see

 

Happy debugging!

 

[ 01-18-2009, 10:09 AM: Message edited by: mastercamguru ]

Link to comment
Share on other sites

Good to see that someone found it interesting.

 

I wish I thought of this method sooner. I just wanted to see the numbering logic at work, and standard debug output only shows the postblocks that are called.

 

It's nice to see the values in variables as they are being manipulated. It made things much easier for me.

Link to comment
Share on other sites

The best part is that you can "show" any variable's value that you want to see. Just add it in, and comment out anything you don't need to see.

 

I can see this being useful to figure out some HSM logic, as the Mpmaster hasn't yet mastered HSM codes. I added mr1$, mr1_flg, mr2$, last_mr1, last_mr2, and opcode$ for this purpose, but haven't gotten around to using it yet.

Link to comment
Share on other sites
  • 2 weeks later...

The new debugger is nice, breakpoints and watchlists are key to "realtime" debugging. As we have been doing this for years with only the ability to "peek" at a result or condition after the fact.

 

Step modes (step into - step from a breakpoint) would be nice though. Then breakpoints would only need to be "close to or before" the event we are watching for. Allowing for a more detailed undesrtanding of variable and parameter manipulation and code output as it is happening.

 

Another nice debug tool would be to see a window for each sub channel to see what is going where, and when, before the merge.

 

 

Anyone at Cnc Software......Step mode......for X4....please...LOL

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...