[Lldb-commits] [lldb] [lldb][RPC] Upstream Python scripts (PR #138028)

Chelsea Cassanova via lldb-commits lldb-commits at lists.llvm.org
Tue May 6 11:06:30 PDT 2025


================
@@ -0,0 +1,65 @@
+#!/usr/bin/env python3
+# Usage: framework-header-version-fix.py <path/to/input-header.h> <path/to/output-header.h> MAJOR MINOR PATCH
+# This script modifies lldb-rpc-defines.h to uncomment the macro defines used for the LLDB
+# major, minor and patch values as well as populating their definitions.
+
+import argparse
+import os
+import re
+
+
+def main():
+    parser = argparse.ArgumentParser()
+    parser.add_argument("input")
+    parser.add_argument("output")
+    parser.add_argument("lldb_version_major")
+    parser.add_argument("lldb_version_minor")
+    parser.add_argument("lldb_version_patch")
+    args = parser.parse_args()
+    input_path = str(args.input)
+    output_path = str(args.output)
+    lldb_version_major = args.lldb_version_major
+    lldb_version_minor = args.lldb_version_minor
+    lldb_version_patch = args.lldb_version_patch
+
+    with open(input_path, "r") as input_file:
+        lines = input_file.readlines()
+
+    with open(output_path, "w") as output_file:
+        for line in lines:
+            # Uncomment the line that defines the LLDB major version and populate its value.
+            if re.match(r"//#define LLDB_RPC_VERSION$", line):
----------------
chelcassanova wrote:

I used `$` to make sure that the match here for `LLDB_RPC_VERSION` can't have something past the `VERSION` so I think it's possible to try using `//#define LLDB_RPC_VERSION$` as the sub match here. Either that or my regex knowledge is out of whack.

https://github.com/llvm/llvm-project/pull/138028


More information about the lldb-commits mailing list