assert frames.size() == scopes.size() : "Frames don't match scopes :S";
for (int i = 0; i < frames.size(); i++) {
Frame frame = frames.get(i);
IRubyObject s = selfs.get(i);
DynamicScope scope = scopes.get(i);
RubyStackTraceElement stackElement = trace[i];
StaticScope sScope = scope.getStaticScope();
Map<String, Object> var = new HashMap<>();
String[] names = sScope.getVariables();
IRubyObject[] values = scope.getValues();
assert names.length == values.length : "Scope name and value length mismatch";
for (int j = 0; j < names.length; j++)
var.put(names[j], values[j]);
DebugFrame created = info.pushFrame(stackElement.getClassName() + "." + stackElement.getMethodName(),
stackElement.getFileName(), stackElement.getLineNumber(), s, var);
created.self.setName("self");
}
// Restore scopes and frames
while (!scopes.isEmpty()) {