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

Purpose

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:

Value

Required

Resulting Client-Library behavior

CS_DBG_ALL

context and connection

Takes all possible debug actions.

CS_DBG_API_ LOGCALL

context

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

CS_DBG_API_STATES

context

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

CS_DBG_ASYNC

context

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

CS_DBG_DIAG

connection

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

CS_DBG_ERROR

context

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

CS_DBG_MEM

context

Prints information relating to memory management.

CS_DBG_NETWORK

context

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

CS_DBG_PROTOCOL

connection

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.

CS_DBG_PROTOCOL_ FILE

connection

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.

CS_DBG_PROTOCOL_ STATES

connection

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

CS_DBG_SSL

connection

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:
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc32840.1570/html/ctref/X74166.htm

Environment Variables:
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc35831.1550/html/uxconfig/CHDEJCIE.htm

You can use ct_debug to code debugging:
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc32840.1570/html/ctref/X74166.htm

Related sap notes/kbas

  • No labels