当前位置: 首页>>代码示例>>Python>>正文


Python OPTIONS.target方法代码示例

本文整理汇总了Python中src.build.build_options.OPTIONS.target方法的典型用法代码示例。如果您正苦于以下问题:Python OPTIONS.target方法的具体用法?Python OPTIONS.target怎么用?Python OPTIONS.target使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在src.build.build_options.OPTIONS的用法示例。


在下文中一共展示了OPTIONS.target方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_crash_report

# 需要导入模块: from src.build.build_options import OPTIONS [as 别名]
# 或者: from src.build.build_options.OPTIONS import target [as 别名]
  def get_crash_report(self):
    assert self._crash_addr is not None
    for binary_name, start_addr, end_addr in self._text_segments:
      if start_addr > self._crash_addr or self._crash_addr >= end_addr:
        continue

      addr = self._crash_addr
      # For PIC or PIE, we need to subtract the load bias.
      if binary_name.endswith('.so') or OPTIONS.is_bare_metal_build():
        addr -= start_addr

      if os.path.exists(binary_name):
        binary_filename = binary_name
      else:
        self.init_binary_map()
        if binary_name not in self._binary_map:
          return '%s %x (binary file not found)\n' % (binary_name, addr)
        binary_filename = self._binary_map[binary_name]

      pipe = subprocess.Popen([toolchain.get_tool(OPTIONS.target(),
                                                  'addr2line'),
                               '-e', binary_filename],
                              stdin=subprocess.PIPE,
                              stdout=subprocess.PIPE,
                              stderr=subprocess.STDOUT)
      addr2line_result = pipe.communicate('%x\n' % addr)[0]

      # We can always get clean result using 32 byte aligned start
      # address as NaCl binary does never overlap 32 byte boundary.
      objdump_start_addr = (addr & ~31) - 32
      objdump_end_addr = addr + 64
      pipe = subprocess.Popen([toolchain.get_tool(OPTIONS.target(),
                                                  'objdump'),
                               '-SC', binary_filename,
                               '--start-address', '0x%x' % objdump_start_addr,
                               '--stop-address', '0x%x' % objdump_end_addr],
                              stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
      objdump_result = pipe.communicate('%x\n' % addr)[0]

      if self._is_annotating:
        report = ('[[ %s 0x%x %s ]]' %
                  (binary_filename, addr, addr2line_result.strip()))
        # The result of objdump is too verbose for annotation.
      else:
        report = '%s 0x%x\n' % (binary_filename, addr)
        report += addr2line_result
        report += objdump_result

      return report
    return 'Failed to retrieve a crash report\n'
开发者ID:epowers,项目名称:arc,代码行数:52,代码来源:crash_analyzer.py

示例2: _get_generate_libvpx_asm_ninja

# 需要导入模块: from src.build.build_options import OPTIONS [as 别名]
# 或者: from src.build.build_options.OPTIONS import target [as 别名]
def _get_generate_libvpx_asm_ninja():
    if not OPTIONS.is_arm():
        return None

    gen_asm_ninja = ninja_generator.NinjaGenerator('libvpx_asm')
    # Translate RVCT format assembly code into GNU Assembler format.
    gen_asm_ninja.rule(
        _GEN_LIBVPX_ASM_RULE,
        command=_ADS2GAS + ' < $in > $out.tmp && (mv $out.tmp $out)')

    # Translate C source code into assembly code and run grep to
    # generate a list of constants. Assembly code generated by this rule
    # will be included from other assembly code. See
    # third_party/android/external/libvpx/libvpx.mk for corresponding
    # rules written in Makefile.
    asm_include_paths = [
        '-I' + staging.as_staging('android/external/libvpx/armv7a-neon'),
        '-I' + staging.as_staging('android/external/libvpx/libvpx')
    ]
    gen_asm_ninja.rule(
        _GEN_LIBVPX_OFFSETS_ASM_RULE,
        command=('%s -DINLINE_ASM %s -S $in -o $out.s && '
                 'grep \'^[a-zA-Z0-9_]* EQU\' $out.s | '
                 'tr -d \'$$\\#\' | '
                 '%s > $out.tmp && (mv $out.tmp $out)' % (toolchain.get_tool(
                     OPTIONS.target(), 'cc'), ' '.join(asm_include_paths),
                                                          _ADS2GAS)))

    return gen_asm_ninja
开发者ID:nehz,项目名称:google-arc,代码行数:31,代码来源:config.py

示例3: get_build_dir

# 需要导入模块: from src.build.build_options import OPTIONS [as 别名]
# 或者: from src.build.build_options.OPTIONS import target [as 别名]
def get_build_dir(target_override=None, is_host=False):
    if is_host:
        return os.path.join(OUT_DIR, "target", "host" + _get_opt_suffix())
    else:
        target = target_override or OPTIONS.target()
        assert target != "host" and target != "java"
        return os.path.join(OUT_DIR, "target", get_target_dir_name(target))
开发者ID:nehz,项目名称:google-arc,代码行数:9,代码来源:build_common.py

示例4: main

# 需要导入模块: from src.build.build_options import OPTIONS [as 别名]
# 或者: from src.build.build_options.OPTIONS import target [as 别名]
def main():
    OPTIONS.parse_configure_file()
    target = OPTIONS.target()
    regular_expectations = _get_expectations()
    large_expectations = _get_expectations(["--include-large"])
    for botname in os.listdir(_BOTLOGS_DIR):
        if not botname.replace("-", "_").startswith(target):
            continue
        botdir = os.path.join(_BOTLOGS_DIR, botname)
        lognames = [os.path.join(botdir, filename) for filename in os.listdir(botdir)]
        failures, incompletes = _parse(lognames)
        top_flake = sorted([(freq, name) for name, freq in failures.iteritems()], reverse=True)
        print "%s:" % botname
        if "large_tests" in botname:
            expectations = large_expectations
        else:
            expectations = regular_expectations
        for freq, name in top_flake:
            assert name in expectations, "%s is not in expectations list" % name
            run, flags = expectations[name]
            if run == "SKIP":
                continue
            failrate = 100.0 * freq / float(len(lognames))
            print "%5.2f%% fail rate [%-4s %-19s] %s" % (failrate, run, ",".join(flags), name)
        print
    return 0
开发者ID:nehz,项目名称:google-arc,代码行数:28,代码来源:find_flaky_tests.py

示例5: _configure_build_options

# 需要导入模块: from src.build.build_options import OPTIONS [as 别名]
# 或者: from src.build.build_options.OPTIONS import target [as 别名]
def _configure_build_options():
  if OPTIONS.parse(sys.argv[1:]):
    print 'Args error'
    return False

  # Write out the configure file early so all other scripts can use
  # the options passed into configure. (e.g., sync_chrome).
  OPTIONS.write_configure_file()

  # Target directory is replaced. If an old directory, out/target/<target>,
  # exists, move it to the new place, out/target/<target>_<opt>.
  old_path = os.path.join('out/target', OPTIONS.target())
  new_path = build_common.get_build_dir()
  if os.path.lexists(old_path):
    if os.path.isdir(old_path) and not os.path.islink(old_path):
      if os.path.exists(new_path):
        file_util.rmtree(old_path)
      else:
        shutil.move(old_path, new_path)
    else:
      os.remove(old_path)

  # Create an empty directory as a placeholder if necessary.
  file_util.makedirs_safely(new_path)

  # Create a symlink from new place to old place to keep as compatible as
  # possible.
  os.symlink(os.path.basename(new_path), old_path)

  # Write out the configure file to a target specific location, which can be
  # queried later to find out what the config for a target was.
  OPTIONS.write_configure_file(build_common.get_target_configure_options_file())

  OPTIONS.set_up_goma()
  return True
开发者ID:epowers,项目名称:arc,代码行数:37,代码来源:configure.py

示例6: get_art_isa

# 需要导入模块: from src.build.build_options import OPTIONS [as 别名]
# 或者: from src.build.build_options.OPTIONS import target [as 别名]
def get_art_isa():
    if OPTIONS.is_i686():
        return "x86"
    elif OPTIONS.is_x86_64():
        return "x86_64"
    elif OPTIONS.is_arm():
        return "arm"
    raise Exception("Unable to map target into an ART ISA: %s" % OPTIONS.target())
开发者ID:nehz,项目名称:google-arc,代码行数:10,代码来源:build_common.py

示例7: _set_nacl_resource_permission

# 需要导入模块: from src.build.build_options import OPTIONS [as 别名]
# 或者: from src.build.build_options.OPTIONS import target [as 别名]
def _set_nacl_resource_permission(executor):
  # On Windows, NaCl cannot open resources without executable bit.
  # So, here, we manually set it regardless of the original permissions.
  resource_path = 'out/target/%s/runtime/_platform_specific/%s/' % (
      build_common.get_target_dir_name(),
      OPTIONS.target())
  executor.run(' '.join([
      'cd', executor.get_remote_arc_root(), '&&',
      'chmod', '-R', 'a+x', resource_path]))
开发者ID:epowers,项目名称:arc,代码行数:11,代码来源:remote_windows_executor.py

示例8: main

# 需要导入模块: from src.build.build_options import OPTIONS [as 别名]
# 或者: from src.build.build_options.OPTIONS import target [as 别名]
def main():
  description = 'Tool to manipulate symbol list files.'
  parser = argparse.ArgumentParser(description=description)
  parser.add_argument(
      '--dump-defined', action='store_true',
      help='Dump defined symbols from the given shared object.')
  parser.add_argument(
      '--dump-undefined', action='store_true',
      help='Dump defined symbols from the given shared object.')
  parser.add_argument(
      '--clean', action='store_true',
      help='Copy symbols file with comments stripped.')
  parser.add_argument(
      '--verify', action='store_true',
      help='Verify that file 1 does not contain symbols listed in file 2.')
  parser.add_argument('args', nargs=argparse.REMAINDER)

  args = parser.parse_args()

  OPTIONS.parse_configure_file()
  nm = toolchain.get_tool(OPTIONS.target(), 'nm')

  if args.dump_defined:
    command = (nm + ' --defined-only --extern-only --format=posix %s | '
               'sed -n \'s/^\(.*\) [A-Za-z].*$/\\1/p\' | '
               'LC_ALL=C sort -u' % args.args[0])
    return subprocess.check_call(command, shell=True)

  elif args.dump_undefined:
    command = (nm + ' --undefined-only --format=posix %s | '
               'sed -n \'s/^\(.*\) U.*$/\\1/p\' | '
               'LC_ALL=C sort -u' % args.args[0])
    return subprocess.check_call(command, shell=True)

  elif args.clean:
    command = ('egrep -ve "^#" %s | LC_ALL=C sort' % args.args[0])
    return subprocess.check_call(command, shell=True)

  elif args.verify:
    command = ('LC_ALL=C comm -12 %s %s' % (args.args[0], args.args[1]))
    try:
      diff = subprocess.check_output(command, shell=True,
                                     stderr=subprocess.STDOUT)
    except subprocess.CalledProcessError as e:
      # This can happen if files are not sorted
      print e.output.rstrip()
      return 1
    if diff:
      print '%s has disallowed symbols: ' % (args.args[0])
      print diff.rstrip()
      return 1
    return 0

  print 'No command specified.'
  return 1
开发者ID:epowers,项目名称:arc,代码行数:57,代码来源:symbol_tool.py

示例9: _launch_plugin_gdb

# 需要导入模块: from src.build.build_options import OPTIONS [as 别名]
# 或者: from src.build.build_options.OPTIONS import target [as 别名]
def _launch_plugin_gdb(gdb_args, gdb_type):
  """Launches GDB for a plugin process."""
  gdb = toolchain.get_tool(OPTIONS.target(), 'gdb')
  if gdb_type == 'xterm':
    # For "xterm" mode, just run the gdb process.
    command = _get_xterm_gdb('plugin', gdb, gdb_args)
    subprocess.Popen(command)
  elif gdb_type == 'screen':
    command = _get_screen_gdb('plugin', gdb, gdb_args)
    subprocess.Popen(command)
    print '''

=====================================================================

Now gdb should be running in another screen. Set breakpoints as you
like and start debugging by

(gdb) continue

=====================================================================
'''
  elif gdb_type == 'emacsclient':
    command = _get_emacsclient_gdb('plugin', gdb, gdb_args)
    subprocess.Popen(command)
    print '''

=====================================================================

Now gdb should be running in your emacs session. Set breakpoints as you
like and start debugging by

(gdb) continue

=====================================================================
'''
  else:
    # For "wait" mode, we create a shell script and let the user know.
    command_file = _create_command_file([gdb] + gdb_args)
    print '''

=====================================================================

Now you can attach GDB. Run the following command in another shell.

$ cd /path/to/arc
$ sh %s

Then, set breakpoints as you like and start debugging by

(gdb) continue

=====================================================================

''' % command_file.name
开发者ID:epowers,项目名称:arc,代码行数:56,代码来源:gdb_util.py

示例10: get_defined_symbols

# 需要导入模块: from src.build.build_options import OPTIONS [as 别名]
# 或者: from src.build.build_options.OPTIONS import target [as 别名]
def get_defined_symbols(filename):
  output = subprocess.check_output([toolchain.get_tool(OPTIONS.target(), 'nm'),
                                    '--defined-only', '-D', filename])
  syms = set()
  for line in output.splitlines():
    toks = line.split()
    # Empty lines or a filename line.
    if len(toks) <= 1:
      continue
    addr, sym_type, name = line.split()
    syms.add(name)
  return syms
开发者ID:epowers,项目名称:arc,代码行数:14,代码来源:check_symbols.py

示例11: _get_nacl_irt_path

# 需要导入模块: from src.build.build_options import OPTIONS [as 别名]
# 或者: from src.build.build_options.OPTIONS import target [as 别名]
def _get_nacl_irt_path(parsed_args):
  if not OPTIONS.is_nacl_build():
    return None
  chrome_path = _get_chrome_path(parsed_args)
  irt = toolchain.get_tool(OPTIONS.target(), 'irt')
  nacl_irt_path = os.path.join(os.path.dirname(chrome_path), irt)
  nacl_irt_debug_path = nacl_irt_path + '.debug'
  # Use debug version nacl_irt if it exists.
  if os.path.exists(nacl_irt_debug_path):
    return nacl_irt_debug_path
  else:
    return nacl_irt_path
开发者ID:epowers,项目名称:arc,代码行数:14,代码来源:launch_chrome.py

示例12: main

# 需要导入模块: from src.build.build_options import OPTIONS [as 别名]
# 或者: from src.build.build_options.OPTIONS import target [as 别名]
def main():
  signal_util.setup()

  OPTIONS.parse_configure_file()

  parsed_args = launch_chrome_options.parse_args(sys.argv)
  logging_util.setup(
      level=logging.DEBUG if parsed_args.verbose else logging.INFO)

  _prepare_chrome_user_data_dir(parsed_args)
  global _CHROME_PID_PATH
  _CHROME_PID_PATH = os.path.join(_USER_DATA_DIR, 'chrome.pid')

  # If there is an X server at :0.0 and GPU is enabled, set it as the
  # current display.
  if parsed_args.display:
    os.environ['DISPLAY'] = parsed_args.display

  os.chdir(_ROOT_DIR)

  if not parsed_args.remote:
    _kill_running_chrome()

  if parsed_args.run_ninja:
    build_common.run_ninja()

  ld_library_path = os.environ.get('LD_LIBRARY_PATH')
  lib_paths = ld_library_path.split(':') if ld_library_path else []
  lib_paths.append(build_common.get_load_library_path())
  # Add the directory of the chrome binary so that .so files in the directory
  # can be loaded. This is needed for loading libudev.so.0.
  # TODO(crbug.com/375609): Remove the hack once it becomes no longer needed.
  lib_paths.append(os.path.dirname(_get_chrome_path(parsed_args)))
  os.environ['LD_LIBRARY_PATH'] = ':'.join(lib_paths)
  launch_chrome_util.set_environment_for_chrome()

  if not platform_util.is_running_on_remote_host():
    _check_apk_existence(parsed_args)

  if not platform_util.is_running_on_remote_host():
    prep_launch_chrome.prepare_crx(parsed_args)
  prep_launch_chrome.remove_crx_at_exit_if_needed(parsed_args)

  if parsed_args.remote:
    remote_executor.launch_remote_chrome(parsed_args, sys.argv[1:])
  else:
    platform_util.assert_machine(OPTIONS.target())
    _check_crx_existence(parsed_args)
    _run_chrome_iterations(parsed_args)

  return 0
开发者ID:epowers,项目名称:arc,代码行数:53,代码来源:launch_chrome.py

示例13: _launch_nacl_gdb

# 需要导入模块: from src.build.build_options import OPTIONS [as 别名]
# 或者: from src.build.build_options.OPTIONS import target [as 别名]
def _launch_nacl_gdb(gdb_type, nacl_irt_path, port):
  nmf = os.path.join(build_common.get_runtime_out_dir(),
                     'arc_' + OPTIONS.target() + '.nmf')
  assert os.path.exists(nmf), (
      nmf + ' not found, you will have a bad time debugging')

  # TODO(nativeclient:3739): We explicitly specify the path of
  # runnable-ld.so to work-around the issue in nacl-gdb, but we should
  # let nacl-gdb find the path from NMF.
  gdb_args = ['-ex', 'nacl-manifest %s' % nmf]
  if nacl_irt_path:
    gdb_args.extend(['-ex', 'nacl-irt %s' % nacl_irt_path])
  gdb_args.extend(['-ex', 'target remote %s:%s' % (_LOCAL_HOST, port),
                   build_common.get_bionic_runnable_ld_so()])
  _launch_plugin_gdb(gdb_args, gdb_type)
开发者ID:epowers,项目名称:arc,代码行数:17,代码来源:gdb_util.py

示例14: get_gdb_python_init_args

# 需要导入模块: from src.build.build_options import OPTIONS [as 别名]
# 或者: from src.build.build_options.OPTIONS import target [as 别名]
def get_gdb_python_init_args():
  """Builds gdb arguments to initialize Python interpreter.

  These arguments must be inserted before any argument built by
  get_gdb_python_script_init_args().

  Returns:
    A list of gdb argument strings.
  """
  init_args = {
      'target': OPTIONS.target(),
  }
  return [
      '-ex',
      'python sys.path.insert(0, %r)' %
      os.path.abspath('src/build/util/gdb_scripts'),
      '-ex',
      'python import gdb_script_util',
      '-ex',
      'python gdb_script_util.init(%s)' %
      ','.join('%s=%r' % item for item in init_args.iteritems()),
  ]
开发者ID:epowers,项目名称:arc,代码行数:24,代码来源:gdb_util.py

示例15: get_runtime_main_nexe

# 需要导入模块: from src.build.build_options import OPTIONS [as 别名]
# 或者: from src.build.build_options.OPTIONS import target [as 别名]
def get_runtime_main_nexe():
    return os.path.join(get_build_dir(), "lib/arc_%s.nexe" % OPTIONS.target())
开发者ID:nehz,项目名称:google-arc,代码行数:4,代码来源:build_common.py


注:本文中的src.build.build_options.OPTIONS.target方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。