From 5bc6cdaa8eb69fad8b0ddf7bef114bfe8ffae010 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 24 Jun 2021 11:54:08 +0200 Subject: [PATCH] proton: Add support for PROTON_REMOTE_DEBUG_CMD to allow integration with remote debugger. CW-Bug-Id: 16785 --- proton | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/proton b/proton index cf8a781f..d5bd004a 100755 --- a/proton +++ b/proton @@ -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: