About StripTDS

Applies to TestComplete 15.10, last modified on December 15, 2021

This topic provides an overview of the StripTDS utility, explains how it works and describes its command line and exit codes.

StripTDS - Overview

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. Thus, it enables you to create release builds of Delphi applications with external debug information. The utility is shipped with TestComplete and can be found in the <TestComplete>\Bin folder.

By default, Delphi Applications expose their run-time type information (RTTI), that is, published properties, to TestComplete. The higher level of “openness” can be reached by compiling the application with debug information included. In this case, the TestComplete Debug Info Agent™ will read this information and provide access to public, protected and private elements of the application under test.

The Delphi compiler uses the TD32 format of debug information, which is compiled directly in the executable modules and libraries. This means, that to be able to perform white-box testing of a Delphi application with the Debug Info Agent™ assistance, you need to build a special debug version of the application. The StripTDS utility frees you from this limitation. It lets you strip debug information from compiled modules and save it to external TDS files. In this way, you can create release builds of Delphi applications with debug information kept in separate files.

We recommend that you run the StripTDS utility as a part of the application’s build process. For example, if you use CodeGear Delphi 2007 or 2009 or Embarcadero Delphi 2010 or XE, you could invoke StripTDS from the post-build event of your project.

The .tds files generated by StripTDS must reside in the same folders that the appropriate modules of the application under test. However, there is no need to distribute them with your application.

How StripTDS Modifies Binary Modules

The StripTDS utility modifies tested modules. Many TestComplete customers are afraid to ship these modules to their end-users since they are not aware what change the utility does. Don't be afraid. StripTDS changes binary modules by removing debug information from them, it does not change binary code. Let’s see how this is done.

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]

module

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.

TDS_file

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\TestComplete 15\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\TestComplete 15\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\TestComplete 15\Bin\StripTDS.exe" /r /w C:\MyApp\*.exe;C:\MyApp\*.dll

StripTDS Exit Codes

StripTDS uses the following exit codes:

Code Description
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.

See Also

Testing Delphi Applications
Testing Delphi Applications - Overview
Debug Info Agent™

Highlight search results