Skip to content

Commit

Permalink
Fix function hooking from callstack report (#4836)
Browse files Browse the repository at this point in the history
It is possible for `selected_process->full_path()` to differ from
`capture_process->full_path()`. This happens if a process modifies its
own name for example. When that happens, we can't hook functions from
the callstack report data views. Remove the overcautious check, pids
are sufficient.
  • Loading branch information
pierricgimmig authored Jul 19, 2023
1 parent a4e41b5 commit 04a9a1f
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/OrbitGl/OrbitApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1448,25 +1448,13 @@ void OrbitApp::ToggleCapture() {
}

bool OrbitApp::IsCaptureConnected(const CaptureData& capture) const {
// This function is used to determine if a capture is in a connected state. Lets imagine a user
// selects a process and takes a capture. Then the process of the capture is the same as the
// selected one and that means they are connected. If the user than selects a different process,
// the capture is not connected anymore. Orbit can be in a similar "capture connected" state, when
// the user connects to an instance, selects a process and then loads an instance from file that
// was taken shortly before of the same process.
// TODO(b/163303287): It might be the case in the future that captures loaded from file are always
// opened in a new window (compare b/163303287). Then this function is probably not necessary
// anymore. Otherwise, this function should probably be more sophisticated and also compare the
// build-id of the selected process (main module) and the process of the capture.

const ProcessData* selected_process = GetTargetProcess();
if (selected_process == nullptr) return false;

const ProcessData* capture_process = capture.process();
ORBIT_CHECK(capture_process != nullptr);

return selected_process->pid() == capture_process->pid() &&
selected_process->full_path() == capture_process->full_path();
return selected_process->pid() == capture_process->pid();
}

bool OrbitApp::IsDevMode() { return absl::GetFlag(FLAGS_devmode); }
Expand Down

0 comments on commit 04a9a1f

Please sign in to comment.