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

SignUp Now!

WAD Strange Unexpected "features" in the Debugger

It has been a little over 1 hour since I downloaded the demo version.
I was disappointed to find that I am debugging your program instead of my batch file.

Feature #1 - Watch panel shows wrong content of batch variables
See screen shot "Watch list corruption.jpg"
Watch list corruption.jpg

This shows the batch file has just stepped into a "For /F" command while the Watch panel shows the variable "file" as having the content of the 1st iteration of the "For /F" command PLUS some extra characters. Below the Watch panel I have pasted the Environments Variables panel which shows the "file" variable actually has "casrdr80.bas" as its content. Also this panel shows the variables created by the "For /F" command. The variable "f" has the content shown in the Watch panel.

It appears the Watch panel has mis-interpreted the "file" variable as "f", and put in the content of the "f" variable in front of the remnant of name of the variable "ile"
This is compounded by the Watch window not being updated when the "file" variable has it's content changed.
See screen shot "Watch list corruption2.jpg"
Watch list corruption2.jpg

This shows the source batch file running in "single step" mode having just used the content of the "f" variable as comma separated input parameters and each parameter put into separate variables. The Debugger console window shows that the "file" variable has had "diskio.bas" assigned to it, but the Watch window does not show any change.

Feature #2 The Debugger doesn't like having the batch file in progress being stopped with the "Stop" button on the tool bar.
See screen shot "Debugger_error - batch (null).jpg"
Debugger_error - batch (null).jpg

When the "Stop" button is pressed, the TCC screen shows a continuous stream of "TCC: Unknown Command "(null)" until I change to that screen and press [Ctrl][C].
When I restart the run by pressing the "Start" button, Take Command then shows an error about an invalid label.
See screen shot "Restart Error.jpg"
Restart Error.jpg

The label name that it is complaining about is the same as the 1st of the comma separated values passed from the "For /F" command.
After I clear this error message by pressing the [OK] button, the TCC screen shows the same message prefixed with the batch file name and a number "[98]" that is probably the last line + 1 (the batch file has only 97 lines)
See screen shot "Restart Error - Debugger screen.jpg"
Restart Error - Debugger screen.jpg

When I press the "start" button a 2nd time, the batch file runs OK.

Here is the batch file I am using :-

set drv=%~d0 &set pth=%~p0
%drv% &cd "%pth%" &cls & echo on
set /A dup_grps=0
if not exist dups_list.csv echo File Name,Path,Size,Modified,File Type,MD5,Group,Hard Links > dups_list.csv
for /f "tokens=* delims=? skip=1" %%l in ('type All_TRS80.lst') do call :chk_dup %%l
goto :eof
:chk_dup %%l
set md5=%~6
if "%md5%"=="" goto :eof
set /A dups=0
if %2=="casrdr80.bas" pause
find ",""%md5%""," "All_TRS80.lst" > dups.chk
find /c ",""%md5%""," dups.chk > dups.cnt
for /f "tokens=2 delims=:" %%m in ('type dups.cnt') do set /A dups=%%m
if %dups% LSS 2 goto :eof
set /a dups=0
find /c ",""%md5%""," dups_list.csv > dup_done.chk
for /f "tokens=2 delims=:" %%d in ('type dup_done.chk') do set /a dups=%%d
if %dups% NEQ 0 goto :eof
for /f "tokens=* delims=? skip=2 " %%f in ('type dups.chk') do call :count_dups %%f
if %dups% GTR 1 (
set /A dup_grps+=1
for /f "tokens=* delims=? skip=2" %%f in ('type dups.chk') do call :writ_dup %%f
goto :eof
set fpth=%~dp1 &set file=%2 &set fsize=%3 &set dattim=%4 %5 &set md5=%~6 &set errs=%7
echo %file%,"%fpth%","%fsize%","%dattim%","%md5%","%dup_grps%","" >> dups_list.csv
goto :eof
:count_dups %%f
set file=%~2
if not "%file:~0,3%"=="(d)" (
if not "%file:~0,3%"=="(x)" (
if not "%file:~0,3%"=="(j)" (
if not "%file:~0,3%"=="(u)" (
if not "%file:~0,3%"=="(b)" set /a dups+=1
goto :eof

and sample data to test with - put into file named All_TRS80.lst

"\TRS32\clcplus1.bas","clcplus1.bas",4424,1996-12-24 12:32:00,"8afb5d99829c66c5dfbf6a81d54d8830",""
"\TRS32\CLONE2D","CLONE2D",1563,1996-12-24 12:32:00,"1ca3aa3d1c8b18b790a1cd4b57283b19",""
"\TRS32\cmd2cas.exe","cmd2cas.exe",19970,2005-03-02 12:34:16,"630902be4f3a61350908fdadf04af97e",""
"\TRS32\cmd2cas.txt","cmd2cas.txt",685,2005-01-21 12:40:20,"380da504f12f939a836c8eefe4ccce11",""
"\TRS32\cmdfil5a.cmd","cmdfil5a.cmd",2844,1996-12-24 12:32:00,"35e9431f9e2b13ce742845080ec88e04",""
"\TRS32\Create1.bas edit screen.BMP","Create1.bas edit screen.BMP",55358,2017-07-12 19:13:28,"81eabb3f2591d9088bfe2a3c70a92176",""
"\TRS32\cresta2.hrc.WAV","cresta2.hrc.WAV",46,2017-07-12 01:51:35,"51114b37cd494fb0f84788f346e5d008",""
"\TRS32\D012DD80 PCG-80 Display.DSK","D012DD80 PCG-80 Display.DSK",1024016,2016-01-23 23:18:27,"decea4e59b9870ffc8f53e3ccdd1a3b7",""
"\TRS32\D012DD80 PCG-80 Display.hfe","D012DD80 PCG-80 Display.hfe",2008064,2016-01-24 04:50:59,"93919a0c3c02791dc854236a12b7009a",""
"\TRS32\D029DD80 Lowes HiRes.DSK","D029DD80 Lowes HiRes.DSK",1024016,2016-01-23 23:19:09,"7074b8a3da8001ebfa19edda7c78dbbc",""
"\TRS32\D029DD80 Lowes HiRes.hfe","D029DD80 Lowes HiRes.hfe",2008064,2016-01-24 04:51:25,"11164af41c36b3b90edd72a708e538a1",""
"\TRS32\D067DD80 PCG-80 Graphics.DSK","D067DD80 PCG-80 Graphics.DSK",1024016,2016-01-23 23:18:27,"decea4e59b9870ffc8f53e3ccdd1a3b7",""
"\TRS32\D067DD80 PCG-80 Graphics.hfe","D067DD80 PCG-80 Graphics.hfe",2008064,2016-01-24 04:51:42,"0a89b0de12341bc2e2f4c847faccad65",""
"\TRS32\D068DD80 PCG-80 Games.DSK","D068DD80 PCG-80 Games.DSK",1024016,2016-01-23 23:20:19,"5599860bb99819a5121e98b6e8aa27ba",""
"\TRS32\D068DD80 PCG-80 Games.hfe","D068DD80 PCG-80 Games.hfe",2008064,2016-01-24 04:52:00,"f62facbd5675ed3af31173dd41a56dce",""
"\TRS32\D074DD80 FRED Music.DSK","D074DD80 FRED Music.DSK",1024016,2016-01-23 23:21:14,"a32fce0408a1a5010bfbe35f4e2d1e15",""
"\TRS32\D074DD80 FRED Music.hfe","D074DD80 FRED Music.hfe",2008064,2016-01-24 04:52:16,"997b6762d36393ab3c067a0646ab7f8b",""
"\TRS32\dataio.esf","dataio.esf",10812,2009-07-09 09:56:38,"f33f8f86f3d8be49b1e6dfd56fac1ae6",""
"\TRS32\DataScope - cassread.bas","DataScope - cassread.bas",6699,1982-10-07 13:00:00,"2e6989b68f9a4d6ddf2a8393f6ef7bf6",""
"\TRS32\DataScope - cassread.src","DataScope - cassread.src",4608,1982-10-07 13:00:00,"37a460118966d75900445e49db27bd15",""
"\TRS32\DataScope CMD 16K.WAV","DataScope CMD 16K.WAV",485146,2014-12-30 03:37:28,"83c619693c5011406aa602e6cc70ff91",""
"\TRS32\DataScope CMD 48K.cas","DataScope CMD 48K.cas",527,2014-12-30 03:32:09,"e21b421c21bd913a6b94cf66b4d8b517",""
"\TRS32\datascope.SNP","datascope.SNP",66356,2014-12-29 21:26:32,"e4dd22272defbbc9703d6a59b60b3b14",""
"\TRS32\datascope16K.SNP","datascope16K.SNP",66397,2014-12-30 03:44:47,"289675167bb73ee9596de72ec21f91e5",""
"\TRS32\DD.CMD","DD.CMD",1914,1997-08-16 04:04:36,"a4b1def8e20539033591716d21825b9a",""
"\TRS32\dddpls14.cmd","dddpls14.cmd",5209,1996-12-24 12:32:00,"1037d57ad884b13aac3f25ef7f966f88",""
"\TRS32\DDFORM.CMD","DDFORM.CMD",2560,1997-08-16 04:04:34,"b46b31843891b25c4f345772447c1add",""
Feature #1 - Watch panel shows wrong content of batch variables
It appears the Watch panel has mis-interpreted the "file" variable as "f", and put in the content of the "f" variable in front of the remnant of name of the variable "ile".

This is one of your CMD "features". If you're running inside a FOR loop, CMD (and TCC for reasons of compatibility) look for a single character variable on the command line, and if they find something like "%file" it will be replaced with the contents of the FOR variable %f + "ile". I know it's awful, but you did say you wanted CMD compatibility ...

You can use the TCC "%[var]" syntax to force recognition of the (entire) variable name.
Feature #2 The Debugger doesn't like having the batch file in progress being stopped with the "Stop" button on the tool bar.

The "Stop" button in the IDE tells TCC to stop debugging after the current command finishes processing. The problem with doing that in your batch file is that you're usually inside a FOR statement -- and a FOR is a single command until it finishes all of its looping.

The only way the debugger could get around this would be to send a ^Break to the TCC process when you press Stop, which has the potential to cause MAJOR problems if TCC was in the middle of something like a COPY, MOVE, DEL, REN, etc.

Similar threads