Json output format - Manual - Structured Text Debugger - The SIMATIC Debugger. Enables debugging source code on the PLC and is needed to run the debugger extension. - Debugger (sdb),tool

Structured Text Debugger CLI Tool (sdb)

Portfolio
SIMATIC AX
Product
Structured Text Debugger
Software version
1.3.6
Edition
11/2024
Language
English (original)
Package Name
@ax/sdb

The sdb is also capable of communicating in a 'json' format. This can be enabled during connection by passing the parameter --output json:

Connect

apax sdb --targetIP 192.168.0.1 --password aSecurePassword --certificate ./cert.cer --output json

All the information handed back by the sdb is the same as the information in the human-readable format. A successful connection looks like this:

{"Info":"Name: PLC1516","ClassType":"UserInfoDto"}
{"Info":"MLFB: 6ES7 516-3AP03-0AB0","ClassType":"UserInfoDto"}

Retrieve values

A logpoint is added in the same way as before. The following line adds a logpoint at line 16 in the file 'func.st':

watch add ./src/funcProgram/func.st:16 in;const;temp;out;MyFunction

The result will look like this:

{"ScopeName":"MyFunction","FileName":"./src/funcProgram/func.st","ScopeStartLine":2,"ScopeEndLine":20,"State":"Installed","TriggerConditions":{"CallPathTrigger":{"CallPaths":[],"ClassType":"CallPathTriggerDto"},"ClassType":"TriggerConditionsDto"},"LogpointInstalls":[{"FileName":"./src/funcProgram/func.st","LineNumber":16,"Id":1,"State":"Installed","ClassType":"LogpointInstallDto"}],"ClassType":"WatchInstallResultDto"}
{"ScopeName":"MyFunction","FileName":"./src/funcProgram/func.st","ScopeStartLine":2,"ScopeEndLine":20,"TriggerConditions":{"CallPathTrigger":{"CallPaths":[],"ClassType":"CallPathTriggerDto"},"ClassType":"TriggerConditionsDto"},"LogPoints":[{"FileName":"./src/funcProgram/func.st","LineNumber":16,"Id":1,"Age":0,"State":"Installed","Variables":[{"Name":"in","ErrorCode":"NoError","Symbols":[{"SymbolName":"in","TypeName":"INT","ErrorCode":"NoError","Value":"4","ChildSymbols":[],"ClassType":"SymbolDto"}],"ClassType":"VariableDto"},{"Name":"const","ErrorCode":"UnknownSymbol","Symbols":[],"ClassType":"VariableDto"},{"Name":"temp","ErrorCode":"NoError","Symbols":[{"SymbolName":"temp","TypeName":"INT","ErrorCode":"NoError","Value":"0","ChildSymbols":[],"ClassType":"SymbolDto"}],"ClassType":"VariableDto"},{"Name":"out","ErrorCode":"NoError","Symbols":[{"SymbolName":"out","TypeName":"INT","ErrorCode":"NoError","Value":"0","ChildSymbols":[],"ClassType":"SymbolDto"}],"ClassType":"VariableDto"},{"Name":"MyFunction","ErrorCode":"NoError","Symbols":[{"SymbolName":"MyFunction","TypeName":"INT","ErrorCode":"NoError","Value":"0","ChildSymbols":[],"ClassType":"SymbolDto"}],"ClassType":"VariableDto"}],"ClassType":"LogpointDto"}],"ClassType":"WatchResultDto"}

The logpoint can be uninstalled using the watch remove command:

watch remove 1

The response is:

{
    "ScopeName": "MyFunction",
    "FileName": "./src/funcProgram/func.st",
    "ScopeStartLine": 2,
    "ScopeEndLine": 20,
    "State": "Uninstalled",
    "TriggerConditions": {
        "CallPathTrigger": {
            "CallPaths": [],
            "ClassType": "CallPathTriggerDto"
        },
        "ClassType": "TriggerConditionsDto"
    },
    "LogpointInstalls": [
        {
            "FileName": "./src/funcProgram/func.st",
            "LineNumber": 16,
            "Id": 1,
            "State": "Removed",
            "ClassType": "LogpointInstallDto"
        }
    ],
    "ClassType": "WatchInstallResultDto"
}