Caroline Tice | 558be58 | 2010-06-30 16:22:25 +0000 | [diff] [blame] | 1 | # |
| 2 | # append-debugger-id.py |
| 3 | # |
| 4 | # This script adds a global variable, 'debugger_unique_id' to the lldb |
| 5 | # module (which was automatically generated via running swig), and |
| 6 | # initializes it to 0. |
| 7 | # |
Johnny Chen | 6b6f5ba | 2010-10-14 16:36:49 +0000 | [diff] [blame^] | 8 | # It also calls SBDebugger.Initialize() to initialize the lldb debugger |
| 9 | # subsystem. |
| 10 | # |
Caroline Tice | 558be58 | 2010-06-30 16:22:25 +0000 | [diff] [blame] | 11 | |
| 12 | import sys |
| 13 | |
| 14 | if len (sys.argv) != 2: |
| 15 | output_name = "./lldb.py" |
| 16 | else: |
| 17 | output_name = sys.argv[1] + "/lldb.py" |
| 18 | |
| 19 | # print "output_name is '" + output_name + "'" |
| 20 | |
| 21 | try: |
| 22 | f_out = open (output_name, 'a') |
| 23 | except IOError: |
| 24 | print "Error: Unable to open file for appending: " + output_name |
| 25 | else: |
| 26 | f_out.write ("debugger_unique_id = 0\n"); |
Johnny Chen | 6b6f5ba | 2010-10-14 16:36:49 +0000 | [diff] [blame^] | 27 | f_out.write ("SBDebugger.Initialize()\n"); |
Caroline Tice | 558be58 | 2010-06-30 16:22:25 +0000 | [diff] [blame] | 28 | try: |
| 29 | f_out.close() |
| 30 | except IOError: |
| 31 | print "Error occurred while close file." |