Skip to content

Commit

Permalink
fix step-over while viewed_index different than stopped file_index
Browse files Browse the repository at this point in the history
  • Loading branch information
yigithanyigit committed Aug 1, 2024
1 parent dc9ed45 commit 69aa82a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,17 +531,29 @@ static void draw_control_bar(lldb::SBDebugger& debugger, LLDBCommandLine& cmdlin
ImGui::SameLine();
if (ImGui::Button("step over")) {
const uint32_t nthreads = process->GetNumThreads();
/*
if (ui.viewed_thread_index < nthreads) {
lldb::SBThread th = process->GetThreadAtIndex(ui.viewed_thread_index);
th.StepOver();
}
*/
if (ui.stopped_thread_index < nthreads) {
lldb::SBThread th = process->GetThreadAtIndex(ui.stopped_thread_index);
th.StepOver();
}
}
if (ImGui::Button("step into")) {
const uint32_t nthreads = process->GetNumThreads();
/*
if (ui.viewed_thread_index < nthreads) {
lldb::SBThread th = process->GetThreadAtIndex(ui.viewed_thread_index);
th.StepInto();
}
*/
if (ui.stopped_thread_index < nthreads) {
lldb::SBThread th = process->GetThreadAtIndex(ui.stopped_thread_index);
th.StepInto();
}
}
ImGui::SameLine();
if (ImGui::Button("step instr.")) {
Expand Down Expand Up @@ -746,7 +758,7 @@ static void draw_console(Application& app)
ImGui::EndChild();
}

static void draw_threads(UserInterface& ui, std::optional<lldb::SBProcess> process,
static void draw_threads(UserInterface& ui, std::optional<lldb::SBProcess> process,
float stack_height)
{
ImGui::BeginChild(
Expand Down Expand Up @@ -1241,6 +1253,7 @@ static void handle_lldb_events(lldb::SBDebugger& debugger, lldb::SBListener& lis

const auto [filepath, linum] = resolve_breakpoint(location);
manually_open_and_or_focus_file(ui, open_files, filepath.c_str(), linum);
ui.stopped_thread_index = i;
//file_viewer.set_highlight_line(linum);
break;
}
Expand Down
2 changes: 2 additions & 0 deletions src/Application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ struct UserInterface {
uint32_t viewed_frame_index = 0;
uint32_t viewed_breakpoint_index = 0;

uint32_t stopped_thread_index = 0;

float window_width = -1.f; // in pixels
float window_height = -1.f; // in pixels
float dpi_scale = 1.f;
Expand Down

0 comments on commit 69aa82a

Please sign in to comment.