mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-18 11:02:08 +00:00
Add debugger detector for Linux
This commit is contained in:
@@ -2584,7 +2584,7 @@ bool GUI_App::on_init_inner()
|
|||||||
bool debugger_attached = false;
|
bool debugger_attached = false;
|
||||||
#if defined(__WINDOWS__)
|
#if defined(__WINDOWS__)
|
||||||
debugger_attached = IsDebuggerPresent();
|
debugger_attached = IsDebuggerPresent();
|
||||||
#elif defined(__WXOSX__)
|
#elif defined(__WXOSX__) || defined(__linux__)
|
||||||
debugger_attached = is_debugger_present();
|
debugger_attached = is_debugger_present();
|
||||||
#endif
|
#endif
|
||||||
if (debugger_attached) {
|
if (debugger_attached) {
|
||||||
|
|||||||
@@ -495,5 +495,26 @@ void fit_in_display(wxTopLevelWindow& window, wxSize desired_size)
|
|||||||
window.SetSize(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
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -496,7 +496,9 @@ int get_dpi_for_window(const wxWindow *window);
|
|||||||
|
|
||||||
#ifdef __WXOSX__
|
#ifdef __WXOSX__
|
||||||
void dataview_remove_insets(wxDataViewCtrl* dv);
|
void dataview_remove_insets(wxDataViewCtrl* dv);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__WXOSX__) || defined(__linux__)
|
||||||
bool is_debugger_present();
|
bool is_debugger_present();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user