MCPcopy Create free account
hub / github.com/anjo76/angelscript / ListLocalVariables

Method ListLocalVariables

sdk/add_on/debugger/debugger.cpp:684–715  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

682}
683
684void CDebugger::ListLocalVariables(asIScriptContext *ctx)
685{
686 if( ctx == 0 )
687 {
688 Output("No script is running\n");
689 return;
690 }
691
692 asIScriptFunction *func = ctx->GetFunction();
693 if( !func ) return;
694
695 stringstream s;
696 for( asUINT n = 0; n < func->GetVarCount(); n++ )
697 {
698 // Skip temporary variables
699 // TODO: Should there be an option to view temporary variables too?
700 const char* name;
701 func->GetVar(n, &name);
702 if (name == 0 || strlen(name) == 0)
703 continue;
704
705 if( ctx->IsVarInScope(n) )
706 {
707 // TODO: Allow user to set if members should be expanded or not
708 // Expand members by default to 3 recursive levels only
709 int typeId;
710 ctx->GetVar(n, 0, 0, &typeId);
711 s << func->GetVarDecl(n) << " = " << ToString(ctx->GetAddressOfVar(n), typeId, 3, ctx->GetEngine()) << endl;
712 }
713 }
714 Output(s.str());
715}
716
717void CDebugger::ListGlobalVariables(asIScriptContext *ctx)
718{

Callers

nothing calls this directly

Calls 8

IsVarInScopeMethod · 0.80
GetVarDeclMethod · 0.80
GetAddressOfVarMethod · 0.80
strMethod · 0.80
GetFunctionMethod · 0.45
GetVarCountMethod · 0.45
GetVarMethod · 0.45
GetEngineMethod · 0.45

Tested by

no test coverage detected