threads and frames
This commit is contained in:
@@ -11,6 +11,8 @@ void Window::draw(const Frontend &frontend)
|
||||
using enum WindowType;
|
||||
|
||||
case regs: std::get<RegWindow>(this->data).draw(frontend); break;
|
||||
case threads: std::get<ThreadWindow>(this->data).draw(frontend); break;
|
||||
case frames: std::get<FrameWindow>(this->data).draw(frontend); break;
|
||||
default: printf("Unhandled window draw: %u\n", this->type); exit(1);
|
||||
}
|
||||
}
|
||||
@@ -24,9 +26,27 @@ Window Window::create_regs(size_t id)
|
||||
.data = RegWindow{.id = id_str, .open = true}};
|
||||
}
|
||||
|
||||
Window Window::create_threads(size_t id)
|
||||
{
|
||||
auto id_str = std::string{"Threads##"};
|
||||
id_str.append(std::to_string(id));
|
||||
|
||||
return Window{.type = WindowType::threads,
|
||||
.data = ThreadWindow{.id = id_str, .open = true}};
|
||||
}
|
||||
|
||||
Window Window::create_frames(size_t id)
|
||||
{
|
||||
auto id_str = std::string{"Frames##"};
|
||||
id_str.append(std::to_string(id));
|
||||
|
||||
return Window{.type = WindowType::frames,
|
||||
.data = FrameWindow{.id = id_str, .open = true}};
|
||||
}
|
||||
|
||||
void RegWindow::draw(const Frontend &frontend)
|
||||
{
|
||||
ImGui::SetNextWindowDockID(frontend.dock_id, ImGuiCond_Appearing);
|
||||
//ImGui::SetNextWindowDockID(frontend.dock_id, ImGuiCond_Appearing);
|
||||
if (!ImGui::Begin(this->id.c_str()))
|
||||
{
|
||||
return;
|
||||
@@ -97,5 +117,112 @@ void RegWindow::draw(const Frontend &frontend)
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void ThreadWindow::draw(const Frontend &frontend)
|
||||
{
|
||||
//ImGui::SetNextWindowDockID(frontend.dock_id, ImGuiCond_Appearing);
|
||||
if (!ImGui::Begin(this->id.c_str()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!frontend.target)
|
||||
{
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ImGui::BeginTable("table", 3,
|
||||
ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg))
|
||||
{
|
||||
ImGui::TableSetupColumn("ID");
|
||||
ImGui::TableSetupColumn("Name");
|
||||
ImGui::TableSetupColumn("Location");
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
const auto &threads = frontend.target->threads;
|
||||
char buf[32];
|
||||
for (size_t idx = 0; idx < threads.size(); ++idx)
|
||||
{
|
||||
const auto &thread = threads[idx];
|
||||
if (!thread)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
|
||||
std::snprintf(buf, sizeof(buf), "%lu", thread->id);
|
||||
ImGui::Text(buf);
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::Text(thread->name.c_str());
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
if (thread->cur_display_fn != "")
|
||||
{
|
||||
ImGui::Text(thread->cur_display_fn.c_str());
|
||||
} else
|
||||
{
|
||||
std::snprintf(buf, sizeof(buf), "%lX", thread->ip);
|
||||
ImGui::Text(buf);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void FrameWindow::draw(const Frontend &frontend)
|
||||
{
|
||||
//ImGui::SetNextWindowDockID(frontend.dock_id, ImGuiCond_Appearing);
|
||||
if (!ImGui::Begin(this->id.c_str()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!frontend.target)
|
||||
{
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ImGui::BeginTable("table", 1,
|
||||
ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg))
|
||||
{
|
||||
ImGui::TableSetupColumn("Location");
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
const auto &frames = frontend.target->frames;
|
||||
char buf[32];
|
||||
for (size_t idx = 0; idx < frames.size(); ++idx)
|
||||
{
|
||||
const auto &frame = frames[idx];
|
||||
if (!frame)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
|
||||
if (frame->display_name != "")
|
||||
{
|
||||
ImGui::Text(frame->display_name.c_str());
|
||||
} else
|
||||
{
|
||||
std::snprintf(buf, sizeof(buf), "%lX", frame->ip);
|
||||
ImGui::Text(buf);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
Reference in New Issue
Block a user