StripTDS is a simple command-line utility that strips TD32 debug information from executables and libraries created with the Delphi compiler and saves it in separate TDS files. You can use the utility to create release builds of Delphi applications with external debug information.
The utility is shipped with TestLeft and is located in the <TestLeft>\Bin folder.
The Delphi compiler uses the TD32 format of debug information. The compiler embeds debug information directly into executable modules and libraries. The StripTDS utility allows you to extract debug information from compiled modules and save it to external TDS files. To do this, run the StripTDS utility as part of the application build process. For example, you can invoke StripTDS from the post-build event of your project.
You place the .tds files that the utility generates in the same folder where the tested application’s modules reside. There is no need to distribute them with your application.
How StripTDS Modifies Binary Modules
The StripTDS utility removes debug information from application modules. It does not change binary code.
Each executable module - EXE, DLL or any other binary module (PE file in Windows terminology) - consists of sections. The sections contain various information and are used for various purposes. Some of the sections contain binary code generated by the compiler, this code is executed when the section is loaded in memory. Some other sections contain data (like string constants or integer values) that are used by the binary code. One more section type holds helper information and is used for helper purposes.
Delphi compiler generates debug information in TD32 format and stores it to special sections within the resulting PE file. Delphi places debug information into the sections that are located at the end of the file. StripTDS reads debug information from these sections and saves it into a separate .tds file. Then it removes the debug information sections from the PE module and corrects the module’s headers so that they contain the appropriate info.
That is, StripTDS only works with sections that store debug info. It does not touch the code and data sections, so your application will work the way it was programmed.
StripTDS Command Line
The command line of the StripTDS utility is as follows:
StripTDS.exe [-r] [-w] module [TDS_file]
The name of the compiled module that contains TD32 debug information to be stripped off. If you need to process several modules, use wildcards (* and ?) to specify a mask. For example, the *.exe mask matches all EXE files. To match all files, use the * mask.
This argument is only used if module holds a single file name. It specifies the name of the TDS file to which the extracted debug information should be saved. The destination folder for the TDS file must exist on the disk.
If you do not specify this parameter, the debug information will be saved to a file with the same name as module but with the .tds extension.
This argument is ignored if module specifies a file mask or the -r argument is used.
You can specify both absolute file paths (starting with the drive letter) and paths that are relative to the current working folder (not necessarily the StripTDS folder). Using absolute paths is recommended.
If a file path includes spaces, it must be enclosed in quotes, for example, "C:\My App\MyApp.exe".
-r (or /r)
If this argument is specified, StripTDS will process the files specified by the module argument as well as the appropriate files in all subfolders of the folder that contains the module file(s).
-w (or /w)
If this argument is specified, StripTDS will overwrite existing TDS file(s).
Here are some examples of running the StripTDS utility:
The following command removes the debug information from the C:\MyApp\MyApp.exe file and saves it to the TDS file of the same name. If the TDS file already exists, it is overwritten:"C:\Program Files\SmartBear\TestLeft 4\Bin\StripTDS.exe" /w C:\MyApp\MyApp.exe
The following command removes the debug information from the C:\MyApp\MyApp.exe file and saves it to the C:\DebugInfo\MyApp\MyApp.tds file. If the TDS file already exists, it is left unchanged:"C:\Program Files\SmartBear\TestLeft 4\Bin\StripTDS.exe" C:\MyApp\MyApp.exe C:\DebugInfo\MyApp\MyApp.tds
The following command removes the debug information from all EXE and DLL files in the C:\MyApp folder and all its subfolders and saves it to the TDS files of the same name in the appropriate folders. Existing TDS files are overwritten:"C:\Program Files\SmartBear\TestLeft 4\Bin\StripTDS.exe" /r /w C:\MyApp\*.exe;C:\MyApp\*.dll
StripTDS Exit Codes
StripTDS uses the following exit codes:
|0||The debug information was stripped off successfully.|
|Non-zero||An error occurred during debug information extraction. For example, the specified module does not contain TD32 debug information or contains invalid or unknown debug information.|