proton: Add support for PROTON_REMOTE_DEBUG_CMD to allow integration with remote debugger.

CW-Bug-Id: 16785
This commit is contained in:
Jacek Caban 2021-06-24 11:54:08 +02:00 committed by Andrew Eikum
parent 6f35d1e8bd
commit 5bc6cdaa8e

20
proton
View file

@ -856,6 +856,11 @@ class Session:
else:
self.env["WINEDEBUG"] = "-all"
if "PROTON_REMOTE_DEBUG_CMD" in self.env:
self.remote_debug_cmd = self.env.get("PROTON_REMOTE_DEBUG_CMD").split(" ")
else:
self.remote_debug_cmd = None
if update_prefix_files:
g_compatdata.setup_prefix()
@ -1006,8 +1011,23 @@ class Session:
self.dump_dbg_scripts()
except OSError:
log("Unable to write debug scripts! " + str(sys.exc_info()[1]))
if self.remote_debug_cmd:
remote_debug_proc = subprocess.Popen([g_proton.wine_bin] + self.remote_debug_cmd,
env=self.env, stderr=self.log_file, stdout=self.log_file)
else:
remote_debug_proc = None
self.run_proc([g_proton.wine_bin, "steam"] + sys.argv[2:] + self.cmdlineappend)
if remote_debug_proc:
remote_debug_proc.kill()
try:
remote_debug_proc.communicate(2)
except subprocess.TimeoutExpired as e:
log("terminate remote debugger")
remote_debug_proc.terminate()
remote_debug_proc.communicate()
if __name__ == "__main__":
if not "STEAM_COMPAT_DATA_PATH" in os.environ: