mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
Add debugger detector for Linux
This commit is contained in:
@@ -495,5 +495,26 @@ void fit_in_display(wxTopLevelWindow& window, wxSize desired_size)
|
||||
window.SetSize(desired_size);
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
// Detect if the application is running inside a debugger.
|
||||
// https://stackoverflow.com/a/69842462/3289421
|
||||
bool is_debugger_present() {
|
||||
std::ifstream sf("/proc/self/status");
|
||||
std::string s;
|
||||
while (sf >> s)
|
||||
{
|
||||
if (s == "TracerPid:")
|
||||
{
|
||||
int pid;
|
||||
sf >> pid;
|
||||
return pid != 0;
|
||||
}
|
||||
std::getline(sf, s);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user