bdebugger / ide usage confusion

Jun 25, 2013
3
0
I'm trying to use the bdebugger / ide functionality in TCC 15.01.52 x64 and I don't understand how to invoke the debugger in the current directory I'm using.

For instance, when I type 'bdebugger batch.btm' for the batch file residing in the subdirectory e:\code\, I get a dialog from the debugger that it can't find the file c:\batch.btm. Why is the debugger looking for the file in the root system drive?

Then if I manually load batch.btm in the debugger and try to step through it, it starts executing in the root system drive (C:\) as well, rather than my current working directory. Again, I don't understand this behavior.

I hope I'm missing something obvious. Any help? Thanks.
 
May 20, 2008
11,400
99
Syracuse, NY, USA
If you say 'bdebugger batch.btm' without specifying a path to the batch file, only the current directory will be searched.

With or without a path specified for the batch file, IDE.EXE's current directory, and the directory in which the batch file is run, will be the current directory of the TCC which started IDE (the TCC to which you gave the 'bdebugger' command).

In your scenario, if TCC's current directory is c:\ then IDE's current directory will be c:\, and since no path was specified IDE will look for batch.btm in c:\.
 
Jun 25, 2013
3
0
Thank you for the reply. I'm not sure I'm following. In my scenario, my code is sitting in e:\code, and my TCC current working directory on the command line is also e:\code. If I type 'bdebugger batch.btm', it looks for the file in c:\, even though my current working directory is e:\code. To your point, the file will load if I use the literal path 'bdebugger e:\code\batch.btm' but even then, the file tries to execute in c:\ when I step into the code. I don't get it... guess I haven't had enough coffee tonight.
 
Feb 26, 2013
100
0
Thank you for the reply. I'm not sure I'm following. In my scenario, my code is sitting in e:\code, and my TCC current working directory on the command line is also e:\code. If I type 'bdebugger batch.btm', it looks for the file in c:\, even though my current working directory is e:\code. To your point, the file will load if I use the literal path 'bdebugger e:\code\batch.btm' but even then, the file tries to execute in c:\ when I step into the code. I don't get it... guess I haven't had enough coffee tonight.

Do you have a TCStart BTM file? If so do you execute a change to the root directory (c:\) in that file? If so I suspect that's the cause of the problem you are seeing. You could fix it with a conditional statement in your TCstart along the lines of:

Code:
if %_bdebugger EQ 0 *cdd c:\

You might also want to look at doing something similar for pipes (%_pipe) and transient shells (%_transient) to avoid much head scratching in those situations.

Dan
 
Jun 25, 2013
3
0
Brilliant. The issue was in tcstart, as you surmised. Now that I've fixed that, everything is working as I'd expect. Thanks a million.
 
May 20, 2008
11,400
99
Syracuse, NY, USA
I just tested that and it seems like BAD behavior. Giving the BDEBUGGER command to TCC causes TCSTART.BTM to be executed even if a new instance of TCC is not being started. Maybe there's a good reason for it but I can't immediately think of one.
 
Feb 26, 2013
100
0
I just tested that and it seems like BAD behavior. Giving the BDEBUGGER command to TCC causes TCSTART.BTM to be executed even if a new instance of TCC is not being started. Maybe there's a good reason for it but I can't immediately think of one.

It's surmise and speculation on my part, but I think the debugger executes the batch file in a separate instance of TCC (probably hidden), and tcstart is executed in that instance (analogous to the situation where a pipe command starts an instance of TCC to receive the output from the pipe). Rex could give us chapter and verse on how it works, but he may not be inclined to if he considers it's JP Software's proprietary information.

Dan
 
May 20, 2008
11,400
99
Syracuse, NY, USA
I think it works more like this.

IDE.EXE is, essentially, TCC (but without a console). If started from a console, it uses the console of its parent (via AttachConsole()). If not started from a console, it makes one (with AllocateConsole()). When you run a batch file in IDE, it's IDE that's running it. It's therefore no surprise that it (IDE.EXE) executes TCSTART when it starts (since you'd want batch files to behave normally).

Changing directories in TCSTART has never been advisable. It leads (as is obvious) to unexpected and unintended results. In the 20 years (or so) that I've been hanging around JPSoft forums (once upon a time, UseNet ... sigh!), problems stemming from that practice have arose quite regularly.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
There is a long section about the issue of changing the current working directory in TCSTART in the HELP page for TCSTART. However, its heading Pipes, Transient Sessions / Processes, and TCSTART

"
 
May 20, 2008
3,515
4
Elkridge, MD, USA
The HELP topic TCSTART contains a long section on the topic of changing the CWD in TCSTART.However, its title Pipes, Transient Sessions / Processes, and TCSTART does not mention BDEBUGGER or IDE, nor - this is more important - directory changes. You need to actually read the text to find the same warning Vince and Dan mentioned above. It's probably still the best HELP for software I've seen.
 
Feb 26, 2013
100
0
I think it works more like this.

IDE.EXE is, essentially, TCC (but without a console). If started from a console, it uses the console of its parent (via AttachConsole()). If not started from a console, it makes one (with AllocateConsole()). When you run a batch file in IDE, it's IDE that's running it. It's therefore no surprise that it (IDE.EXE) executes TCSTART when it starts (since you'd want batch files to behave normally)..

That seems entirely plausible Vince, and your knowledge of the intricacies of Windows consoles is certainly much greater than mine :-)

Changing directories in TCSTART has never been advisable. It leads (as is obvious) to unexpected and unintended results. In the 20 years (or so) that I've been hanging around JPSoft forums (once upon a time, UseNet ... sigh!), problems stemming from that practice have arose quite regularly.

Yes, I recall replying to a thread a few months ago when someone had the same issue when using a pipe. However, as this thread shows, it's not always obvious when to expect tcstart to be executed, so I expect it's a topic that we'll return to again...
 
May 20, 2008
11,400
99
Syracuse, NY, USA
The HELP topic TCSTART contains a long section on the topic of changing the CWD in TCSTART.However, its title Pipes, Transient Sessions / Processes, and TCSTART does not mention BDEBUGGER or IDE, nor - this is more important - directory changes. You need to actually read the text to find the same warning Vince and Dan mentioned above. It's probably still the best HELP for software I've seen.
Yup! And changing CWDs in TCSTART would also do in any TCCHere mechanism (on which I rely heavily).
 
Similar threads
Thread starter Title Forum Replies Date
T Thanks for the assistance with IDE vs Bdebugger Support 3
Kachupp ide/bdebugger Support 17
rps IDE/BDEBUGGER ? Support 1
Peter Murschall v24 IDE/BDEBUGGER won't start Support 9
C BDEBUGGER/IDE crashing Support 1
Frank watch an array variable in ide/bdebugger Support 2
JohnQSmith IDE / BDEBUGGER Crash Support 0
JohnQSmith IDE / BDEBUGGER Font Support 4
B Bdebugger / IDE editor doesn't display called batch file Support 1
mikea BDEBUGGER/IDE questions Support 16
P BDEBUGGER/IDE does not honour VariableExclude Support 2
P bdebugger / ide issues Support 1
Peter Bratton v10 IDE / bdebugger Support 10
R bug _ypixels in BDEBUGGER Support 6
cgunhouse SETLOCAL not working in BDEBUGGER Support 9
Peter Murschall V26-Issues in the BDEBUGGER ! Support 11
R Documentation Help Nit > bdebugger View Menu Support 0
Peter Murschall BDEBUGGER "Run to Cursor" - where is it ? Support 1
R Changes to BDEBUGGER menu item keyboard shortcuts in v25 Support 2
Kachupp bdebugger Support 5
Kachupp bdebugger Support 17
Joe Caverly BDEBUGGER and CMDebug Support 2
Joe Caverly Modified Variables in CMDebug/BDebugger Support 1
C BDEBUGGER queryies Support 5
A bdebugger: why it doesnt go inside the "if" statement ? Support 3
MickeyF BDebugger crashes Support 2
jbanaszczyk Bdebugger and breakpoint Support 5
jbanaszczyk bdebugger issues Support 4
cgunhouse Fixed bdebugger with not exist batch file causes a crash Support 2
S BDEBUGGER issue Support 9
samintz Hotkeys for copy/paste do not work in BDEBUGGER Support 4
thedave BDEBUGGER vs not inconsistency Support 15
S WAD BDEBUGGER command changes window title to "TCC Prompt" Support 4
Frank How to? bdebugger / breakpoints Support 4
S WAD Invoking BDEBUGGER changes window title to "TCC Prompt" Support 7
E Ctrl-V does not always work in BDEBUGGER Support 4
S Fixed BDEBUGGER died on invalid watch request Support 4
B Bdebugger doesn't recognize breakpoint after batch file returns Support 2
samintz bdebugger issues Support 55
Peter Bratton BDEBUGGER observations Support 4
S BDEBUGGER - minor issue Support 2
O Is the bdebugger supposed to debug? Support 1
vefatica BDEBUGGER and Spy++ Support 2
mikea Using BDEBUGGER (and BREAKPOINT) Support 1
Y BDEBUGGER does not launch Support 8
B Keys in debug menu not working in bdebugger Support 1
B bdebugger doesn't load btm-file in window Support 1
B Bdebugger displays an error when typing right square bracket Support 2
S BDEBUGGER problem Support 0
Kachupp IDE watch references Support 11

Similar threads