Version 0 of Debug tcl core with MS VC10 Express

Updated 2014-02-26 17:09:43 by oehhar

Written by HaO for rmax to debug win socket code. Thanks to him to do that !!!

Build

Tested on Vista 32 bit and MS VC10 Express with SP1.

TCL source code must be in a path without spaces, here in 'c:\test\tcl8.6.1'.

Open a dos prompt and type:

C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat
cd c:\test\tcl8.6.1\win
nmake -f Makefile.vc release OPTS=symbols

For me, tclsh86tg.exe is build in 'C:\test\tcl8.6.1\win\Debug_VC10'.

Setup Debugger

I am sorry, I have the german version, english translation is always given but might be wrong.

First, we need a dummy project:

  • Start MS-VC10 Express IDE
  • Menü File->New->Projekt (Datei->Neu->Project)
  • Choose "Win32-Konsolenanwendung" ("Win32-Console application")
  • Enter a Name behind "Name": tclsh86 (as you like)
  • Enter a path in "Ort" ("Location"). I use "C:\test\vc10"
  • Uncheck "Verzeichnis für Lösung erstellen" (Create folder for solution)
  • Press "Ok"
  • The Welcome page appears. Press "Continue >".
  • The "Application options" page appears ("Anwendungseinstellungen")
  • Choose "Leeres Projekt" ("Empty Project")
  • Press button "Fertig stellen" ("Terminate")

Now, set the just build exe as debug program. To do so:

  • In the Subwindow "Projektmappen-Explorer" (Project explorer) (Press Ctrl-Alt-L to show or not show)
  • Right click on the bold text "tclsg86"
  • In the open Menu choose the last point "Einstellungen" ("Settings")
  • In the left part of the property dialog, choose "Debuggen" suboption of "Konfigurationseigenschaften" ("Debug" in "Config properties")
  • In the right side, take the row "Befehl" ("Command"). The default value is "$(TargetPath)".
  • Set this value to the full path the the tclsh executable. In my case, this is: C:\test\tcl8.6.1\win\Debug_VC10\tclsh86tg.exe
  • Press ok

Breakpoint

Now you may add a source file, where you want to set a breakpoint.

  • In the Subwindow "Projektmappen-Explorer" (Project explorer) (Press Ctrl-Alt-L to show or not show)
  • Right click on the folder symbol with "Quelldateien" (Source files)
  • In the appearing menu, choose "Hinzufügen" (Add)
  • In the submenu, choose "Vorhandenes Element" (Existing Element)
  • Alternatively for the last steps, one may press Shift-Alt-A
  • A file explorer starts. Choose a tcl file from the source tree you just compiled you want to set the breakpoint. In my case, this is: c:\test\tcl8.6.1\win\winSock.c
  • The file appears in the file list. Open it with a double click.
  • Navigate to the line with the wished breakpoint. In my case, this is "CreateSocket" inm line 1119
  • Press F9 to add a breakpoint. A red bullet shows the location

Start debugging

  • Press F5 to start debugging
  • A box may ask if the project should be rebuild - say no.
  • In my case, the wish console starts. Now you may enter commands to get to the breakpoint:
set f [socket localhost 100]
  • We hit the breakpoint and the console freezes.
  • Now, all possibilities are available to debug, like stepping etc. Just look in the menu "Debug".