Page tree
Skip to end of metadata
Go to start of metadata


When debugging code using ctlib, you can enable debugging without the need to modify and relink.

Overview - When running into errors, one way to delve deeper into the issue is using the debug libraries. 
There are multiple debug flag options that can be set through the ct-lib debugger.
Here are the list of flags:



Resulting Client-Library behavior


context and connection

Takes all possible debug actions.



Prints out information each time the application calls a Client-Library routine, including the routine name and the parameter values.



Prints information relating to Client-Library function-level state transitions.



Prints function trace information each time an asynchronous function starts or completes.



Prints message text whenever a Client-Library or server message is generated.



Prints trace information whenever a Client-Library error occurs. This allows a programmer to determine exactly where an error is occurring.



Prints information relating to memory management.



Prints information relating to Client-Library’s network interactions.



This ct_debug parameter may be set without devlib libraries. The parameter captures information exchanged with a server in protocol-specific (for example, TDS) format. This information is not human-readable.



This ct_debug parameter may be set without devlib libraries. If the parameter is not set on connection, mktemp is called, generating a unique file name to dump the protocol packets into. The prefix string passed to mktemp is capture. The resulting protocol file is decodable by Ribo.



Prints information relating to Client-Library protocol-level state transitions.



Allows a CT-Library application to write SSL-related diagnostics and error codes to standard output (stdout) or to a log file. This flag can be used in isql. CS_DBG_SSL can also be used with normal (non-debug) libraries.

Depending on the flag you wish to set you may be required to use the devlib libraries.
You can do this without recompiling as well, if you are linked dynamically.
The devlib and lib libraries are located in the same location.

To have your application use the devlib libraries simply mv the lib folder to libbak and cp devlib to lib.

cd $SYBASE/OCS-15_0
mv lib libbak
cp devlib lib

There are two ways to enable debugging for ctlibrary.
1. Environment variables

2. ocs.cfg file

Environment Variables

Ctlib  tracing environment variables was a new feature in SDK 15.0 ESD#17.
When debugging an applicatino you can use the Environment variables:
SYBOCS_DEBUG_FLAGS - add the flags you wish to use seperated by a comma

SYBOCS_DEBUG_LOGFILE - add the filename you want the debug output to go. If this isn't set, the output is sent to stdout.

ocs.cfg file

Instead of using the environment variables you can set this in the ocs.cfg config file.
This file specifices flags for a specific application name.
You can use this to set multiple options, such as, enabling security mechanism, kerberos.
In this case, we want to set 2 parameters:
CS_DBG_FILE - file name for the debug output to be redirected into

CS_DEBUG - possible debug flags

You can relocate the ocs.cfg file by using an environment variable:
SYBOCS_CFG -    set the location and filename for the ocs.cfg file
                             default location is $SYBASE/OCS-15_0/config/ocs.cfg

Note: When enabling the ocs.cfg file, you must have the application name set.
Any application that picks up the ocs.cfg file and doesn't have an application name entry will fail.

Related Content

Related Document

Debug flags:

Environment Variables:

You can use ct_debug to code debugging:

Related sap notes/kbas

  • No labels