steam_helper: Stop waiting on the debugger when ptraced.

This commit is contained in:
Arkadiusz Hiler 2023-06-26 17:34:55 +03:00
parent 48670ca952
commit 37b88eb035

View file

@ -1514,6 +1514,29 @@ static DWORD WINAPI steam_drm_thread(void *arg)
return 0; return 0;
} }
BOOL is_ptraced(void)
{
char key[50];
int value;
FILE *fp = fopen("/proc/self/status", "r");
BOOL ret = FALSE;
if (!fp) return FALSE;
while (fscanf(fp, " %s %d\n", key, &value) > 0)
{
if (!strcmp("TracerPid:", key))
{
ret = (value != 0);
break;
}
}
fclose(fp);
return ret;
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
HANDLE wait_handle = INVALID_HANDLE_VALUE; HANDLE wait_handle = INVALID_HANDLE_VALUE;
@ -1557,7 +1580,7 @@ int main(int argc, char *argv[])
{ {
unsigned int sleep_count = 0; unsigned int sleep_count = 0;
WINE_TRACE("PROTON_WAIT_ATTACH is set, waiting for debugger...\n"); WINE_TRACE("PROTON_WAIT_ATTACH is set, waiting for debugger...\n");
while (!IsDebuggerPresent()) while (!IsDebuggerPresent() && !is_ptraced())
{ {
Sleep(100); Sleep(100);
++sleep_count; ++sleep_count;