Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::ScriptContextDebug Class Reference

#include <ScriptContextDebug.h>

Classes

struct  Breakpoint
 
struct  CallstackLine
 
struct  DebugValue
 

Public Types

typedef AZStd::string BreakpointId
 
typedef bool(* EnumClass) (const char *, const AZ::Uuid &, void *)
 
typedef bool(* EnumMethod) (const AZ::Uuid *, const char *, const char *, void *)
 
typedef bool(* EnumProperty) (const AZ::Uuid *, const char *, bool, bool, void *)
 
typedef bool(* EnumEBus) (const AZStd::string &, bool, bool, bool, void *)
 
typedef bool(* EnumEBusSender) (const AZStd::string &, const AZStd::string &, const AZStd::string &, const AZStd::string &category, void *)
 
typedef AZStd::function< void(ScriptContextDebug *, const Breakpoint *)> BreakpointCallback
 
typedef AZStd::function< void(ScriptContextDebug *)> ProcessDebugCmdCallback
 
typedef AZStd::function< bool(const char *, ScriptDataContext &)> EnumLocalCallback
 
typedef AZStd::vector< CallstackLine, OSStdAllocatorCallstackInfo
 

Public Member Functions

 AZ_CLASS_ALLOCATOR (ScriptContextDebug, SystemAllocator)
 
 ScriptContextDebug (ScriptContext &scriptContext, bool isEnableStackRecord=false)
 
void EnumRegisteredClasses (EnumClass enumClass, EnumMethod enumMethod, EnumProperty enumProperty, void *userData=NULL)
 
void EnumRegisteredGlobals (EnumMethod enumMethod, EnumProperty enumProperty, void *userData=NULL)
 
void EnumRegisteredEBuses (EnumEBus enumEBus, EnumEBusSender enumEBusSender, void *userData=NULL)
 
void StackTrace (char *stackOutput, size_t stackOutputSize)
 
void EnableBreakpoints (BreakpointCallback &cb)
 
void DisableBreakpoints ()
 
void AddBreakpoint (Breakpoint &bp)
 
void RemoveBreakpoint (Breakpoint &bp)
 
void ConnectHook ()
 
void DisconnectHook ()
 
void EnableDebugCmdProcess (ProcessDebugCmdCallback &cb)
 Register a callback that will be called when "ProcessDebugCommands" is called.
 
void DisableDebugCmdProcess ()
 
void ProcessDebugCommands ()
 
void EnableStackRecord ()
 Enable detailed stack recording (more detailed than the default Script one), of course this will cause a performance penalty.
 
void DisableStackRecord ()
 
void EnableCodeStackRecord ()
 Enable C++ stack recoding (this can be slow on certain platforms and configurations). It's off by default.
 
void DisableCodeStackRecord ()
 
void EnumLocals (EnumLocalCallback &cb)
 Enumerate locals variables. This can be called only from a breakpoint callback.
 
void StepInto ()
 Step into current instruction. This can be called only from a breakpoint callback and you must return from it (until in breaks again)
 
void StepOver ()
 Step over current instruction. This can be called only from a breakpoint callback and you must return from it (until in breaks again)
 
void StepOut ()
 Step out current instruction. This can be called only from a breakpoint callback and you must return from it (until in breaks again)
 
const CallstackInfoGetCallstack () const
 
bool GetValue (DebugValue &value)
 
bool SetValue (const DebugValue &value)
 

Protected Member Functions

void PushCodeCallstack (int stackSuppressCount=1, int numStackLevels=10)
 
void PopCallstack ()
 

Protected Attributes

friend ScriptContextImpl
 

Friends

void LuaHook (lua_State *, lua_Debug *)
 

Detailed Description

Debug functionality for a script context (VM). This context will be generated automatically once you enable the Debugging in the ScriptContext. Use this class to obtain registered classes, better callstacks, breakpoints, etc.

Member Function Documentation

◆ GetValue()

bool AZ::ScriptContextDebug::GetValue ( DebugValue value)

Get a DebugValue (if found) for a specific script value. You can use that information to display in debugger and edit if possible (not all types are editable). When the function is called we will check for a local variable with that name, then a global name. You can prefix with a special symbol ':' to check global only. value should have m_name set to the name we are trying to get

Returns
true if value structure was filled with information, false value can't be found.

◆ ProcessDebugCommands()

void AZ::ScriptContextDebug::ProcessDebugCommands ( )
inline

You MUST can this function from a safe context (when a script is not running) to allow the debugger to execute actions on the script. You are not required to call this, but then you will be able to debug only from within "break points" callback.

◆ SetValue()

bool AZ::ScriptContextDebug::SetValue ( const DebugValue value)

Allows you to change a value in the script context. Function will return true is the change was successful otherwise false. Not all types can be set, not all type can be changed at runtime (it depends on the script language and script binding).


The documentation for this class was generated from the following file: