Skip to content

Debugging

ScaleTrade trading servers are protected against hacking, therefore debugging plugins directly on production servers is not possible.\ For debugging, a special developer version of the server is used.\ If you need such a server, please contact technical support.

Features of the Developer Server

  • The server does not write users.db and trades.db files to disk.\
  • The test trading account can connect only with Trader (master password) and Investor (investor password).

Running the Debug Server

  1. Place the developer server binary (sttrader.dev) into the working directory of the test trading server with an active license.\

  2. Start the server in console mode with the command:

    ./sttrader.dev --console
    

    or run it under systemd for background operation.

Configuring the Plugin Project for Debugging

Before starting debugging, make sure that the C++ project is configured so that build output is copied directly into the\ <server_installation_folder>/plugins/ directory after compilation.\ The plugin should run inside the console application sttrader.dev.

  1. In CMakeLists.txt or your build system, configure the output path:

    set_target_properties(${PROJECT_NAME} PROPERTIES
        LIBRARY_OUTPUT_DIRECTORY "${SERVER_INSTALL_DIR}/plugins"
    )
    

    This ensures the resulting shared library is copied as:

    <server_install_directory>/plugins/lib<plugin_name>.so
    
  2. For debugging, configure your IDE (CLion, VS Code, or QtCreator):

    • Executable: <server_install_folder>/ScaleTrade.dev\
    • Arguments: --console\
    • Working directory: <server_install_folder>

Save and apply the configuration.

Crash Diagnostics

ScaleTrade servers may crash due to third-party plugins.\ All platform components include a built-in crash diagnostic system, however crash reports do not contain detailed information about external plugins.

For more precise analysis, it is recommended to use ScaleTrade Debug Info.\ When building a project, the utility embeds a small encrypted block with function descriptions into the binary, which can later be used to analyze crashes.

An example of crash-triggering code in a test plugin can be found in the developer documentation.