Skip to content

API doc object oriented

Dedmen Miller edited this page Dec 30, 2018 · 5 revisions

Client->Debugger communication

struct cmd_base {
    enum {
        invalid = 0,
        getVersionInfo = 1,
        addBreakpoint = 2,
        delBreakpoint = 3,
        BPContinue = 4,//Tell's breakpoint to leave breakState
        MonitorDump = 5, //Dump's all Monitors
        setHookEnable = 6,
        getVariable = 7,
        getCurrentCode = 8, //While in breakState returns full preproced code of last Instructions script file
        getAllScriptCommands = 9,
        getAvailableVariables = 10
    } command;
}

struct cmd_getVersionInfo : cmd_base {}; //returns versionInfo(1)
struct cmd_addBreakpoint : cmd_base {

struct data {
    string filename; //full path to scriptfile. Example "\\x\\cba\\addons\\common\\fnc_currentUnit.sqf"
    number line; //line of the script
    [[optional]] string label; //a optional name for this breakpoint. Currently only used for LogCallstack action
    [[optional]] breakpoint_condition condition;
    breakpoint_action action;
};

};

struct cmd_delBreakpoint : cmd_base {
struct data {
    string filename; //full path to scriptfile. Example "\\x\\cba\\addons\\common\\fnc_currentUnit.sqf"
    number line; //line of the script
};
};

struct cmd_BPContinue : cmd_base { //returns <ContinueExecution> and might immediately after return a <halt_step>

struct data {
enum {
    continue = 0,
    stepInto = 1,
    stepOver = 2,
    stepOut = 3
} StepType;
};
};


//Dumps all Monitors to "P:\\Monitor_knownScriptFiles.json" Which should contain all known script files. This is a debug command.. A debugger debug command...
struct cmd_MonitorDump : cmd_base {};

//Enables/Disables the "hook". Was a special feature to "disable" the debugger to allow all scripts to run at full speed without the debugger interfering. Currently not used.
struct cmd_setHookEnable : cmd_base {};

struct cmd_getVariable : cmd_base { //returns <VariableReturn>
struct data {
array<string> name; //ARRAY of Strings. List of variable names to retrieve. Might also be a local variable.

bitset variableScope {
    invalid = 0,
    callstack = 1,
    local = 2,
    missionNamespace = 4,
    uiNamespace = 8,
    profileNamespace = 16,
    parsingNamespace = 32
} scope; //a bitset of scopes to check.

};

};


//This only works when currently halting. It traverses the entire callstack to find the file and returns it's content
struct cmd_getCurrentCode : cmd_base { //returns a BARE string of the content

string file; //Filename of the file.

};

//returns all script commands in the format: https://gist.github.com/dedmen/75ae1319d9a958c6492e44b734fdb609
struct cmd_getAllScriptCommands : cmd_base {}; 

struct breakpoint_condition {
enum {
code = 1
} type; //1: code
[[if type == 1]] string code; //this contains a SQF script that will be executed and should return true/false
};

struct breakpoint_action {
enum {
    ExecCode = 1,
    Halt = 2,
    LogCallstack = 3
} type;

    [[if type == 1]] string code; //this contains a SQF script that will be executed when the breakpoint is hit.
    [[if type == 3]] string basePath ; //this contains the path to a file where the log will be written to. The filename will be <basePath><label><hitcount>.json so you should end the basePath with a \.
};

Debugger->Client communication

struct cmd_base {
    enum {
    invalid = 0,
    versionInfo = 1,
    halt_breakpoint = 2,
    halt_step = 3,
    halt_error = 4,
    halt_scriptAssert = 5,
    halt_scriptHalt = 6,
    halt_placeholder = 7,
    ContinueExecution = 8,
    VariableReturn = 9, //returning from getVariable
    AvailableVariablesReturn = 10, //returning from getAvailableVariables
    } command;
}



struct cmd_versionInfo : cmd_base {

number build; //buildnumber of the debugger
string version; //versionstring of the debugger
string arch; //The string "X64" or "X86"
string gameType; //"game type" of the Arma binary. Release/performance/profiling/diag
string gameVersion; //version of the Arma binary. "1.82.144709"
struct HI { //"Hook Integrity" structure. Contains information about whether the debugger correctly initialized.
bool "SvmCon"; //HI.__scriptVMConstructor
bool "SvmSimSt"; //HI.__scriptVMSimulateStart
bool "SvmSimEn"; //HI.__scriptVMSimulateEnd
bool "InstrBP"; //HI.__instructionBreakpoint
bool "WSim"; //HI.__worldSimulate
bool "WMEVS"; //HI.__worldMissionEventStart
bool "WMEVE"; //HI.__worldMissionEventEnd
bool "ScrErr"; //HI.__onScriptError
bool "PreDef"; //HI.scriptPreprocDefine
bool "PreCon"; //HI.scriptPreprocConstr
bool "ScrAass"; //HI.scriptAssert
bool "ScrHalt"; //HI.scriptHalt
bool "Alive"; //HI.engineAlive
bool "EnMouse"; //HI.enableMouse
};

};

struct halt_base : cmd_base {

[[optional]] struct callstack { //If it doesn't exist, just assume empty

};

};


//The debugger halted because of a set breakpoint (https://gist.github.com/dedmen/747a8d2eb7c0e2a82b90c60a810a2987) 
struct cmd_halt_breakpoint : halt_base {
[[optional]] game_instruction instruction;
//This should definitely have a callstack
};

//The debugger halted because you are stepping 
struct cmd_halt_step : halt_base {
[[optional]] game_instruction instruction;
//This should definitely have a callstack
};

//The debugger halted because of a script error 
struct cmd_halt_error : halt_base {
struct error {
array<number> fileOffset; //sourceline, offset from start of file, offset from start of line
enum {
//https://github.com/dedmen/ArmaDebugEngine/blob/e0025310a2c7ca795e400ef460e9975ba3ec5268/BIDebugEngine/BIDebugEngine/RVClasses.cpp#L150
} type;

string message; //error message from the game (like in RPT)
string filename; //error file (like in RPT)
string content; //the full content of the script file
};
};


//The debugger halted because a https://community.bistudio.com/wiki/assert failed 
struct cmd_halt_scriptAssert : halt_base {

//This stuff only exists if there is no instruction. Probably a bug though, might fix someday.
struct halt {
    array<number> fileOffset; //sourceline, offset from start of file, offset from start of line
    string filename;
    string content; // the full content of the script file
};

};

/7The debugger halted because a https://community.bistudio.com/wiki/halt was executed 
struct cmd_halt_scriptHalt : cmd_halt_scriptAssert {}; //Same

//We have left the halt state and the game is now executing again.
struct cmd_ContinueExecution : cmd_base {};

//Answer to getVariable request. 
struct cmd_VariableReturn {

struct variable {
string type; //"void"/...
string name; //Name of the variable
variableScope ns; //The namespace enum. (Only if variable was found) See <variableScope> from client->debugger communication
stuff value; //if type is array then this is an array of "values". If it's string then just string. If it's code then the compact(removes empty newlines) string version of the code.
};


};


struct game_instruction {
string type;
string name;
string filename;
array<number> fileOffset; //sourceline, offset from start of file, offset from start of line
};

Clone this wiki locally