|
|
|
@ -259,5 +259,34 @@ std::string GenScopeTreeDebugInfo(Scope* root) {
|
|
|
|
|
return os.str();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string GenParentScopeTreeDebugInfo(Scope* leaf) {
|
|
|
|
|
std::stringstream os;
|
|
|
|
|
|
|
|
|
|
if (!leaf) return "";
|
|
|
|
|
|
|
|
|
|
// level traversal
|
|
|
|
|
std::vector<const Scope*> scopes;
|
|
|
|
|
const Scope* current_scope = leaf;
|
|
|
|
|
|
|
|
|
|
while (current_scope != nullptr) {
|
|
|
|
|
scopes.push_back(current_scope);
|
|
|
|
|
current_scope = current_scope->parent();
|
|
|
|
|
// end of a level
|
|
|
|
|
os << "\n------------------------------------------\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
os << "\nDetails:\n\n";
|
|
|
|
|
|
|
|
|
|
for (auto* q : scopes) {
|
|
|
|
|
os << "====\n";
|
|
|
|
|
os << q << ":\n";
|
|
|
|
|
for (auto& var : q->LocalVarNames()) {
|
|
|
|
|
os << " - " << var << "\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return os.str();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace framework
|
|
|
|
|
} // namespace paddle
|
|
|
|
|