MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / GetStackVariables

Function GetStackVariables

src/hx/Debugger.cpp:1049–1091  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1047}
1048
1049static ::Array<Dynamic> GetStackVariables(int threadNumber,
1050 int stackFrameNumber,
1051 bool unsafe,
1052 Dynamic markThreadNotStopped)
1053{
1054 ::Array<Dynamic> ret = Array_obj<Dynamic>::__new();
1055
1056 gMutex.lock();
1057
1058 std::list<DebuggerContext *>::iterator iter = gList.begin();
1059 while (iter != gList.end()) {
1060 DebuggerContext *ctx = *iter++;
1061 if (ctx->mThreadNumber == threadNumber) {
1062 if ((ctx->mStatus == DBG_STATUS_RUNNING) && !unsafe) {
1063 ret->push(markThreadNotStopped);
1064 gMutex.unlock();
1065 return ret;
1066 }
1067 StackContext *stack = ctx->mStackContext;
1068 // Some kind of error signalling here would be nice I guess
1069 if (stack->mStackFrames.size() <= stackFrameNumber) {
1070 break;
1071 }
1072 StackVariable *variable =
1073 stack->mStackFrames[stackFrameNumber]->variables;
1074 while (variable) {
1075 ret->push(String(variable->mHaxeName));
1076 variable = variable->mNext;
1077 }
1078
1079 #ifdef HXCPP_STACK_SCRIPTABLE
1080 StackFrame *scriptFrame = stack->mStackFrames[stackFrameNumber];
1081 if (scriptFrame)
1082 __hxcpp_dbg_getScriptableVariables(scriptFrame, ret);
1083 #endif
1084 break;
1085 }
1086 }
1087
1088 gMutex.unlock();
1089
1090 return ret;
1091}
1092
1093static Dynamic GetVariableValue(int threadNumber, int stackFrameNumber,
1094 String name, bool unsafe,

Callers 1

Calls 5

__newFunction · 0.85
StringClass · 0.50
pushMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected