From d8d35f133dc910ce4c9cbf3328b3254548b346d2 Mon Sep 17 00:00:00 2001 From: bgbsww Date: Thu, 26 Sep 2024 11:36:35 -0400 Subject: [PATCH] Contribute helper files for CLion debugging --- contrib/clion/GetCLionDebugPort.FCMacro | 12 ++++++++++++ contrib/clion/attach_pydevd.py.patch | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 contrib/clion/GetCLionDebugPort.FCMacro create mode 100644 contrib/clion/attach_pydevd.py.patch diff --git a/contrib/clion/GetCLionDebugPort.FCMacro b/contrib/clion/GetCLionDebugPort.FCMacro new file mode 100644 index 0000000000..9689afd84f --- /dev/null +++ b/contrib/clion/GetCLionDebugPort.FCMacro @@ -0,0 +1,12 @@ +import pydevd +from multiprocessing.connection import Listener + +print("CLion debugger macro running. Starting listener to get port") +listen = Listener(('localhost', 39998), backlog=1) +link = listen.accept() +port = link.recv() +link.close() +listen.close() +print("Port", port, "received, starting debugger. Check CLion to see if a breakpoint has been hit and continue") +pydevd.settrace(port=port) +print("Debugger operating, leaving macro.") \ No newline at end of file diff --git a/contrib/clion/attach_pydevd.py.patch b/contrib/clion/attach_pydevd.py.patch new file mode 100644 index 0000000000..cc5dc173b4 --- /dev/null +++ b/contrib/clion/attach_pydevd.py.patch @@ -0,0 +1,18 @@ +--- attach_pydevd.py.orig 2024-09-26 10:36:47.131066345 -0400 ++++ attach_pydevd.py 2024-09-26 10:16:48.687714133 -0400 +@@ -48,6 +48,15 @@ + import add_code_to_python_process + show_debug_info_on_target_process = 0 + ++ print("attach_pydevd is trying to relay the port",setup['port']) ++ try: ++ from multiprocessing.connection import Client ++ link = Client(('localhost',39998)) ++ link.send(setup['port']) ++ link.close() ++ except ConnectionError as ce: ++ pass ++ + pydevd_dirname = os.path.dirname(os.path.dirname(__file__)) + + if sys.platform == 'win32':