summaryrefslogtreecommitdiffstats
path: root/lldb/scripts/Python
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/scripts/Python')
-rw-r--r--lldb/scripts/Python/append-debugger-id.py27
-rwxr-xr-xlldb/scripts/Python/build-swig-Python.sh7
2 files changed, 34 insertions, 0 deletions
diff --git a/lldb/scripts/Python/append-debugger-id.py b/lldb/scripts/Python/append-debugger-id.py
new file mode 100644
index 00000000000..ab119a86c40
--- /dev/null
+++ b/lldb/scripts/Python/append-debugger-id.py
@@ -0,0 +1,27 @@
+#
+# append-debugger-id.py
+#
+# This script adds a global variable, 'debugger_unique_id' to the lldb
+# module (which was automatically generated via running swig), and
+# initializes it to 0.
+#
+
+import sys
+
+if len (sys.argv) != 2:
+ output_name = "./lldb.py"
+else:
+ output_name = sys.argv[1] + "/lldb.py"
+
+# print "output_name is '" + output_name + "'"
+
+try:
+ f_out = open (output_name, 'a')
+except IOError:
+ print "Error: Unable to open file for appending: " + output_name
+else:
+ f_out.write ("debugger_unique_id = 0\n");
+ try:
+ f_out.close()
+ except IOError:
+ print "Error occurred while close file."
diff --git a/lldb/scripts/Python/build-swig-Python.sh b/lldb/scripts/Python/build-swig-Python.sh
index 69c40a76b12..d2ed2098a5b 100755
--- a/lldb/scripts/Python/build-swig-Python.sh
+++ b/lldb/scripts/Python/build-swig-Python.sh
@@ -127,3 +127,10 @@ fi
swig -c++ -shadow -python -I"${SRC_ROOT}/include" -I./. -outdir "${CONFIG_BUILD_DIR}" -o "${swig_output_file}" "${swig_input_file}"
+# Append global variable to lldb Python module.
+
+current_dir=`pwd`
+if [ -f "${current_dir}/append-debugger-id.py" ]
+then
+ python ${current_dir}/append-debugger-id.py ${CONFIG_BUILD_DIR}
+fi
OpenPOWER on IntegriCloud