| 682 | } |
| 683 | |
| 684 | void 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 | |
| 717 | void CDebugger::ListGlobalVariables(asIScriptContext *ctx) |
| 718 | { |
nothing calls this directly
no test coverage detected