Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

CMDebug 26.01.37 has problems with Alias

Sep
134
1
ist seems, itcannot run it:
1588321285719.png


Also the BDEBUGGER has a problem wile tracing read in an Aliaslist with
Alias /R MyAliasList
The cursorline moves ca. 200 lines down and cannot not be moved back, but the current command will further traced on line 35 or so ....
 
There is no difference with TCC-Syntax, see screenshot:

1588419137193.png


And I've started CMDebug in "Single Mode", there is no other instance of TCC etc. running.
How can I switch in CMDEBUG between Locals and Globals ? SetLocal ?
 
Still not reproducible here, at least not with the fragment of batch file visible in your posting. Can you put together a complete (small) batch file that demonstrates the problem?

A MEMORY command will display the current alias setting (local or global), or you can expressly set it with /G or /L, or set it in the TCMD.INI.
 
Still not reproducible here, at least not with the fragment of batch file visible in your posting. Can you put together a complete (small) batch file that demonstrates the problem?
Ok, here is it, named FRAGMENT.BTM
Code:
Echo %0
Color Bri Yel on Blu
IFF %_TCCRT == 1 THEN
  Window /POS=300,064,674,900 /SIZE=80,30000 /TOP
ENDIFF
::
Ver /R
Echo _TCCRT = %_TCCRT
Echo %_ININAME%:GlobalAliases=%@INIREAD[%_ININAME%,4NT,GlobalAliases]
Echo %_ININAME%: LocalAliases=%@INIREAD[%_ININAME%,4NT,LocalAliases]

If IsAlias cs UNALIAS CS

Alias /L CS=`Echo Colorsettings: %_fg% ON %_bg%`
Echo Alias CS:%@ALIAS[cs]
cs
MEMORY
Echo %@REPEAT[=, %@DEC[%_columns%]]
*Cls
IFF IsAlias cs THEN
  UNALIAS CS
  MEMORY
ENDIFF
Echo %@REPEAT[=, %@DEC[%_columns%]]

Echo BTW: CMDebug is "Very strict" with the `%`-Delimiter at variables ......
Echo Colorsettings Single percent: %_fg ON %_bg
Echo Colorsettings Percent quoted: %_fg% ON %_bg%
I've started CMDebug.EXE and then loading the FRAGMENT.BTM by the Open command, started Tracing by F5 and so on.

But now it comes: If I start it with
CMDebug.EXE Fragment.btm
then it will run all correct with no errors !
What happens here ?
 
An ALIAS /L (or /G) does not take any other arguments. Your alias definition is being thrown away after you're resetting the alias list to local. (This is the way ALIAS /L has behaved ever since it was introduced many years ago.)

If you change that line to:

Code:
Alias /L
Alias CS=`Echo Colorsettings: %_fg% ON %_bg%`

then it should work for you. (It does here.)

I'm also unsure why you're using the (incorrect) %_fg% CMD-style syntax.
 
I'm also unsure why you're using the (incorrect) %_fg% CMD-style syntax.
Because it works "correct".
If I start CMDebug.Exe by the shortcut, the Options shows CMD-Syntax.
If I open/load the following BTM,it switches to TCC-Syntax.:
Code:
::@Echo OFF
Echo %0
Color Bri Yel on Blu
IFF %_TCCRT == 1 THEN
  Window /POS=300,064,674,900 /SIZE=80,30000 /TOP
ENDIFF
::
Ver /R
Echo _TCCRT = %_TCCRT
Echo %_ININAME%:GlobalAliases=%@INIREAD[%_ININAME%,4NT,GlobalAliases]
Echo %_ININAME%: LocalAliases=%@INIREAD[%_ININAME%,4NT,LocalAliases]
If IsAlias cs (UNALIAS CS & MEMORY | TAIL /N+16)
Echo Define Alias:%@EXEC[Alias /L CS=`Echo Colorsettings: %_fg% ON %_bg%`]
MEMORY | TAIL /N+16
Echo Alias CS:%@ALIAS[cs]
cs
Echo %@REPEAT[=, %@DEC[%_columns%]]
If IsAlias cs (UNALIAS CS & MEMORY | TAIL /N+16)
Alias /L
Echo Define /L-Alias:%@EXEC[Alias CS=`Echo Colorsettings: %_fg% ON %_bg%`]
MEMORY | TAIL /N+16
Echo Alias CS:%@ALIAS[cs]
cs
Echo %@REPEAT[=, %@DEC[%_columns%]]
*Cls
If IsAlias cs (UNALIAS CS & MEMORY | TAIL /N+16)
Alias /G
Echo Define /G-Alias:%@EXEC[Alias CS=`Echo Colorsettings: %_fg% ON %_bg%`]
MEMORY | TAIL /N+16
Echo Alias CS:%@ALIAS[cs]
cs
Echo %@REPEAT[=, %@DEC[%_columns%]]
::
Echo BTW: CMDebug is "Very strict" with the `%`-Delimiter at variables ......
Echo Colorsettings Single percent: %_fg ON %_bg
Echo Colorsettings Percent quoted: %_fg% ON %_bg%
If I trace/debug it, I get this results:
1588602143121.png

I can reproduce the problem - with the Alias - in IDE 26, if I start the IDE.EXE and load and debug the script.
If I start with "CMDebug.EXE Fragment.BTM" resp. "IDE.EXE Fragment.BTM" than it works all correct.

Btw, the command "CMDebug.EXE /N" gives an Error:
1588602675068.png

The system cannot find the file ...
 
Last edited:
Because it works "correct".
If I start CMDebug.Exe by the shortcut, the Options shows CMD-Syntax.
If I open/load the following BTM,it switches to TCC-Syntax.:

CMDebug is intended for people who want to debug batch files written for CMD, so it defaults to CMD syntax for .BAT and .CMD files. You can also debug .BTM files written for TCC-RT, so CMDebug switches to TCC-RT syntax for .BTM files. But if you're debugging primarily TCC, you should be using either TCC or Take Command & BDEBUGGER / IDE.

I ran your (new) batch file and it works perfectly here with CMDebug (though some of your constructs like the @EXEC[Alias ...] didn't make any sense to me). The CS alias was defined, echoed, and executed as expected.

Why are you switching back and forth between local & global aliases?

I suspect there's something about your system configuration that you haven't told me yet.

Btw, the command "CMDebug.EXE /N" gives an Error:
View attachment 2906
The system cannot find the file ...

There is no /N startup option for CMDebug. If you want to disable some things, use /I + one or more of the following:

I (no TCMD.INI)
L (no libraries)
P (no plugins)
S (no TCSTART)
X (no TCEXIT)

To disable all of them, say "CMDebug /IILPSX"

Let's get rid of all the extra cruft and get back to basics. What happens when you debug this .BTM file:

Code:
Alias CS=`Echo Colorsettings: %_fg ON %_bg`
Echo Alias CS:%@ALIAS[cs]
cs
 
Why are you switching back and forth between local & global aliases?
Only for testing, to see what happens :-)

I suspect there's something about your system configuration that you haven't told me yet.
No, I've tried to start without TCMD.INI and the result is the same.

There is no /N startup option for CMDebug. If you want to disable some things, use /I + one or more of the following:
You should urgently revise the manual !
1588662810444.png


Let's get rid of all the extra cruft and get back to basics. What happens when you debug this .BTM file:
I've started "CMDebug /IILPSX", insert Your suggestions :-), save it and debug it, switch to TCC-Syntax:
1588663889321.png

But if I start it with "CMDebug /IILPSX T.BTM" and debug it, everything works fine .....
 

Attachments

  • 1588663150560.png
    1588663150560.png
    33.3 KB · Views: 359
Last edited:
Something is off with your configuration.

First, you should be getting the color values displayed with your %_fg and %_bg variables (i.e., something like "bri whi ON bla"). The fact that you're not indicates you probably have "CMDVariables=Yes" in your TCMD.INI. (And which you probably shouldn't be using if you're developing TCC or TCC-RT batch files -- at least if you expect to run them on any other system.) You should also check whether you have "CMDBatch=Yes" set, as that will force CMD mode & disable the TCC commands & extensions.

Second, look for a "BatchAliases=No" in your TCMD.INI file. If that is set, CMDebug / TCC will not try to expand any aliases in batch files (which is what you're seeing).
 
Something is off with your configuration.

First, you should be getting the color values displayed with your %_fg and %_bg variables (i.e., something like "bri whi ON bla"). The fact that you're not indicates you probably have "CMDVariables=Yes" in your TCMD.INI. (And which you probably shouldn't be using if you're developing TCC or TCC-RT batch files -- at least if you expect to run them on any other system.) You should also check whether you have "CMDBatch=Yes" set, as that will force CMD mode & disable the TCC commands & extensions.

Second, look for a "BatchAliases=No" in your TCMD.INI file. If that is set, CMDebug / TCC will not try to expand any aliases in batch files (which is what you're seeing).
1) I've created an empty TCMD.INI and placed it in the CMDebug directory beneath the CMDebug.exe
2) I've hidden my regulary TCMD.INI in the %LOCALAPPDATA%-Directory by renaming it.
3) In the (now masked) TCMD.INI there are only these entrys with CMD and Batch:
BatchAliases=Yes​
BatchEcho=No​
CMDExtensions=No​
4) As I told You before,I started CMDebug with "CMDebug /IILPSX",
and these give us the results above.
Only if I run CMDebug with
cmdebug.exe /IILPSX T.BTM or cmdebug.exe T.BTM
then it works correct.
 
The only thing that makes any sense is that *something* in your system is turning batch aliases off.

Try putting a:

echo BatchAliases = %@option[BatchAliases]

before your alias.

Or try:

option //BatchAliases=Yes

before your alias.

And, if you put just a plain "ALIAS" following your alias definition, does it display the alias list (including the CS alias)?
 
Ok:
1588786759807.png


It seems to me, that CMDebug is in "CMD-Mode", because I must quote variables in %-s and for
example the "*CLS" leads to an error (the CLS allone is working).
 
I can reproduce something like this with IDE.EXE. From TCC, "BDEBUGGER" ... from IDE's file menu, open AA.BTM (or use the MRU list).

1588789688883.png


Options menu says TCC syntax and stepping through it gives

1588789790259.png


Now use the menu to switch to CMD syntax (opening the menu again confirms the change). Step through the BTM ...

1588789907036.png


Now use the menu to switch back to TCC syntax and step through the BTM ... it's different ... no alias right after an apparently successful ALIAS command!

1588790136549.png



NOTE!: It's rather difficult to conduct that experiment because (as discussed in a thread a few weeks back) IDE.EXE often crashes when I press "Start debugging".
 
And, as for Peter, when the file looks like this

1588791152492.png


and I have switched syntax TCC -> CMD -> TCC. I get

1588791210226.png


The alias list is there but the syntax switcheroo seems to have left searching the aliases list disabled.
 
Your lines 3 & 5 should be "%@option[BatchAliases]". You're missing the @.
Arrgghhh :
1588793804247.png

What does it show under the Options menu? TCC Syntax or CMD Syntax?
As I wrote before and as Vince described, CMDebug starts with CMD-Option, if I load / open a BTM it switches to TCC-Syntax.
 
I meant while you were actively debugging the BTM file - does it still show TCC Syntax?
Yes, I checked this several times during debugging :-)

Try it with 26.01.38 (already uploaded) and let me know if it works for you.
Yep, this one works without the problems before ! And I saw that you updated the manual :smile:
Now keep looking for bugs and flaws :cool:
 

Similar threads

Back
Top