OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2008 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2008 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Usage: strip_save_dsym <whatever-arguments-you-would-pass-to-strip> | 7 # Usage: strip_save_dsym <whatever-arguments-you-would-pass-to-strip> |
8 # | 8 # |
9 # strip_save_dsym is a wrapper around the standard strip utility. Given an | 9 # strip_save_dsym is a wrapper around the standard strip utility. Given an |
10 # input Mach-O file, strip_save_dsym will save a copy of the file in a "fake" | 10 # input Mach-O file, strip_save_dsym will save a copy of the file in a "fake" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 state = 0 | 114 state = 0 |
115 elif state == 2: | 115 elif state == 2: |
116 if re.match("^ cmdsize 24$", otool_line): | 116 if re.match("^ cmdsize 24$", otool_line): |
117 state = 3 | 117 state = 3 |
118 else: | 118 else: |
119 state = 6 | 119 state = 6 |
120 elif state == 3: | 120 elif state == 3: |
121 # The UUID display format changed in the version of otool shipping | 121 # The UUID display format changed in the version of otool shipping |
122 # with the Xcode 3.2.2 prerelease. The new format is traditional: | 122 # with the Xcode 3.2.2 prerelease. The new format is traditional: |
123 # uuid 4D7135B2-9C56-C5F5-5F49-A994258E0955 | 123 # uuid 4D7135B2-9C56-C5F5-5F49-A994258E0955 |
| 124 # and with Xcode 3.2.6, then line is indented one more space: |
| 125 # uuid 4D7135B2-9C56-C5F5-5F49-A994258E0955 |
124 # The old format, from cctools-750 and older's otool, breaks the UUID | 126 # The old format, from cctools-750 and older's otool, breaks the UUID |
125 # up into a sequence of bytes: | 127 # up into a sequence of bytes: |
126 # uuid 0x4d 0x71 0x35 0xb2 0x9c 0x56 0xc5 0xf5 | 128 # uuid 0x4d 0x71 0x35 0xb2 0x9c 0x56 0xc5 0xf5 |
127 # 0x5f 0x49 0xa9 0x94 0x25 0x8e 0x09 0x55 | 129 # 0x5f 0x49 0xa9 0x94 0x25 0x8e 0x09 0x55 |
128 new_uuid_match = re.match("^ uuid (.{8}-.{4}-.{4}-.{4}-.{12})$", | 130 new_uuid_match = re.match("^ {3,4}uuid (.{8}-.{4}-.{4}-.{4}-.{12})$", |
129 otool_line) | 131 otool_line) |
130 if new_uuid_match: | 132 if new_uuid_match: |
131 uuid = new_uuid_match.group(1) | 133 uuid = new_uuid_match.group(1) |
132 | 134 |
133 # Skip state 4, there is no second line to read. | 135 # Skip state 4, there is no second line to read. |
134 state = 5 | 136 state = 5 |
135 else: | 137 else: |
136 old_uuid_match = re.match("^ uuid 0x(..) 0x(..) 0x(..) 0x(..) " | 138 old_uuid_match = re.match("^ uuid 0x(..) 0x(..) 0x(..) 0x(..) " |
137 "0x(..) 0x(..) 0x(..) 0x(..)$", | 139 "0x(..) 0x(..) 0x(..) 0x(..)$", |
138 otool_line) | 140 otool_line) |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 print >> sys.stderr, "Nothing to strip" | 334 print >> sys.stderr, "Nothing to strip" |
333 return 1 | 335 return 1 |
334 | 336 |
335 if not strip_and_make_fake_dsym(macho): | 337 if not strip_and_make_fake_dsym(macho): |
336 return 1 | 338 return 1 |
337 | 339 |
338 return 0 | 340 return 0 |
339 | 341 |
340 if __name__ == "__main__": | 342 if __name__ == "__main__": |
341 sys.exit(main(sys.argv)) | 343 sys.exit(main(sys.argv)) |
OLD | NEW |