Show the stack trace in the Debugger slide.
Right now it is non-interactible, but it's still useful for keeping track of the flow of execution. http://screen/4b6WMGdw6j32AGc Change-Id: I978d9b441c15674c6cae508b123579021c2ecc46 Bug: skia:12666 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484076 Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
This commit is contained in:
parent
80d2a50d4b
commit
708f28f4b1
@ -84,6 +84,7 @@ void SkSLDebuggerSlide::showDebuggerGUI() {
|
|||||||
fRefresh = true;
|
fRefresh = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->showStackTraceTable();
|
||||||
this->showVariableTable();
|
this->showVariableTable();
|
||||||
this->showCodeTable();
|
this->showCodeTable();
|
||||||
}
|
}
|
||||||
@ -134,6 +135,42 @@ void SkSLDebuggerSlide::showCodeTable() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SkSLDebuggerSlide::showStackTraceTable() {
|
||||||
|
constexpr ImGuiTableFlags kTableFlags =
|
||||||
|
ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter |
|
||||||
|
ImGuiTableFlags_BordersV | ImGuiTableFlags_NoHostExtendX;
|
||||||
|
constexpr ImGuiTableColumnFlags kColumnFlags =
|
||||||
|
ImGuiTableColumnFlags_NoReorder | ImGuiTableColumnFlags_NoHide |
|
||||||
|
ImGuiTableColumnFlags_NoSort;
|
||||||
|
|
||||||
|
std::vector<int> callStack = fPlayer.getCallStack();
|
||||||
|
|
||||||
|
ImVec2 contentRect = ImGui::GetContentRegionAvail();
|
||||||
|
ImVec2 stackViewSize = ImVec2(contentRect.x / 3.0f,
|
||||||
|
ImGui::GetTextLineHeightWithSpacing() * kNumTopRows);
|
||||||
|
if (ImGui::BeginTable("Call Stack", /*column=*/1, kTableFlags, stackViewSize)) {
|
||||||
|
ImGui::TableSetupColumn("Stack", kColumnFlags);
|
||||||
|
ImGui::TableHeadersRow();
|
||||||
|
|
||||||
|
ImGuiListClipper clipper;
|
||||||
|
clipper.Begin(callStack.size());
|
||||||
|
while (clipper.Step()) {
|
||||||
|
for (int row = clipper.DisplayStart; row < clipper.DisplayEnd; row++) {
|
||||||
|
int funcIdx = callStack.rbegin()[row];
|
||||||
|
SkASSERT(funcIdx >= 0 && (size_t)funcIdx < fTrace->fFuncInfo.size());
|
||||||
|
const SkSL::SkVMFunctionInfo& funcInfo = fTrace->fFuncInfo[funcIdx];
|
||||||
|
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableSetColumnIndex(0);
|
||||||
|
ImGui::Text("%s", funcInfo.name.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
}
|
||||||
|
|
||||||
void SkSLDebuggerSlide::showVariableTable() {
|
void SkSLDebuggerSlide::showVariableTable() {
|
||||||
constexpr ImGuiTableFlags kTableFlags =
|
constexpr ImGuiTableFlags kTableFlags =
|
||||||
ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter |
|
ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter |
|
||||||
@ -152,8 +189,7 @@ void SkSLDebuggerSlide::showVariableTable() {
|
|||||||
if (vars.empty()) {
|
if (vars.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
constexpr int kVarNumRows = 12;
|
ImVec2 varViewSize = ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * kNumTopRows);
|
||||||
ImVec2 varViewSize = ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * kVarNumRows);
|
|
||||||
if (ImGui::BeginTable("Variables", /*column=*/2, kTableFlags, varViewSize)) {
|
if (ImGui::BeginTable("Variables", /*column=*/2, kTableFlags, varViewSize)) {
|
||||||
ImGui::TableSetupColumn("Variable", kColumnFlags);
|
ImGui::TableSetupColumn("Variable", kColumnFlags);
|
||||||
ImGui::TableSetupColumn("Value", kColumnFlags);
|
ImGui::TableSetupColumn("Value", kColumnFlags);
|
||||||
|
@ -32,8 +32,11 @@ private:
|
|||||||
void showRootGUI();
|
void showRootGUI();
|
||||||
void showLoadTraceGUI();
|
void showLoadTraceGUI();
|
||||||
void showDebuggerGUI();
|
void showDebuggerGUI();
|
||||||
void showCodeTable();
|
void showStackTraceTable();
|
||||||
void showVariableTable();
|
void showVariableTable();
|
||||||
|
void showCodeTable();
|
||||||
|
|
||||||
|
static constexpr int kNumTopRows = 12;
|
||||||
|
|
||||||
sk_sp<SkSL::SkVMDebugTrace> fTrace;
|
sk_sp<SkSL::SkVMDebugTrace> fTrace;
|
||||||
SkSL::SkVMDebugTracePlayer fPlayer;
|
SkSL::SkVMDebugTracePlayer fPlayer;
|
||||||
|
Loading…
Reference in New Issue
Block a user