OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 """Downloads a custom GDB and places it in the nacl_sdk folder. |
| 7 |
| 8 The custom GDB is used in the add-in while we wait for nacl-gdb. The zip |
| 9 file is downloaded to %TEMP% and gdb.exe is extracted to %NACL_SDK_ROOT%. |
| 10 """ |
| 11 |
| 12 import os |
| 13 import urllib |
| 14 import zipfile |
| 15 |
| 16 OUTPUT_DIRECTORY = os.getenv('TEMP', None) |
| 17 URL = ("http://www.chromium.org/nativeclient/how-tos/debugging-documentation" |
| 18 "/debugging-untrusted-code-with-a-special-gdb-build-on-windows" |
| 19 "/gdb-remote-x86-64.zip") |
| 20 |
| 21 |
| 22 def main(): |
| 23 nacl_sdk_root = os.getenv('NACL_SDK_ROOT', None) |
| 24 if nacl_sdk_root is None: |
| 25 raise Exception('Environment Variable NACL_SDK_ROOT is not set') |
| 26 if not os.path.exists(nacl_sdk_root): |
| 27 raise Exception('NaCl SDK does not exist at location: %s' % (nacl_sdk_root)) |
| 28 zip_path = os.path.join(OUTPUT_DIRECTORY, "gdb-remote-x86-64.zip") |
| 29 |
| 30 print 'Downloading custom GDB from:' |
| 31 print URL |
| 32 urllib.urlretrieve(URL, zip_path) |
| 33 print 'Download complete. Unzipping...' |
| 34 zip_file = zipfile.ZipFile(zip_path) |
| 35 zip_file.extract('gdb-remote-x86-64/gdb.exe', nacl_sdk_root) |
| 36 zip_file.close() |
| 37 os.remove(zip_path) |
| 38 print 'Success!' |
| 39 |
| 40 if __name__ == '__main__': |
| 41 main() |
OLD | NEW |