本文整理汇总了Python中build_options.OPTIONS.target方法的典型用法代码示例。如果您正苦于以下问题:Python OPTIONS.target方法的具体用法?Python OPTIONS.target怎么用?Python OPTIONS.target使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类build_options.OPTIONS
的用法示例。
在下文中一共展示了OPTIONS.target方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _run_gdb_for_nacl
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import target [as 别名]
def _run_gdb_for_nacl(args, test_args):
runnable_ld = args[-1]
assert 'runnable-ld.so' in runnable_ld
# Insert -g flag before -a to let sel_ldr wait for GDB.
a_index = args.index('-a')
assert 'sel_ldr' in args[a_index - 1]
args.insert(a_index, '-g')
args.extend(test_args)
# The child process call setsid(2) to create a new session so that
# sel_ldr will not die by Ctrl-C either. Note that ignoring SIGINT
# does not work for sel_ldr, because sel_ldr will override the
# setting.
sel_ldr_proc = subprocess.Popen(args, stderr=subprocess.STDOUT,
preexec_fn=os.setsid)
gdb = toolchain.get_tool(OPTIONS.target(), 'gdb')
irt = toolchain.get_tool(OPTIONS.target(), 'irt')
subprocess.call([
gdb,
'-ex', 'target remote :4014',
'-ex', 'nacl-irt %s' % irt,
# The Bionic does not pass a fullpath of a shared object to the
# debugger. Fixing this issue by modifying the Bionic loader
# will need a bunch of ARC MOD. We work-around the issue by
# passing the path of shared objects here.
#
# GDB uses NaCl Manifest file for arc.nexe so we do not need
# this for launch_chrome.
'-ex', 'set solib-search-path %s' %
build_common.get_load_library_path(),
'-ex',
'echo \n*** Type \'continue\' or \'c\' to start debugging ***\n\n',
runnable_ld])
sel_ldr_proc.kill()
示例2: __init__
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import target [as 别名]
def __init__(self, test_binary_name, inputs, output, build_commands):
self._test_binary_name = test_binary_name
self._build_commands = build_commands
out = os.path.join(BionicFundamentalTest._get_out_dir(), test_binary_name)
asmflags = ninja_generator.CNinjaGenerator.get_archasmflags()
if OPTIONS.is_bare_metal_build():
asmflags += ' -DBARE_METAL_BIONIC '
cflags = ninja_generator.CNinjaGenerator.get_archcflags()
cxxflags = ninja_generator.CNinjaGenerator.get_cxxflags()
cflags = asmflags + cflags + ' $commonflags -g -fPIC -Wall -W -Werror '
cxxflags = cflags + cxxflags
ldflags = ('-Wl,-rpath-link=' + build_common.get_load_library_path() +
' -Wl,--hash-style=sysv')
# Use -Bsymbolic to have similar configuration as other NaCl
# executables in ARC.
soflags = '-shared -Wl,-Bsymbolic'
if OPTIONS.is_arm():
# For ARM, we need to link libgcc.a into shared objects. See the comment
# in SharedObjectNinjaGenerator.
# TODO(crbug.com/283798): Build libgcc by ourselves and remove this.
soflags += ' ' + ' '.join(
ninja_generator.get_libgcc_for_bionic())
text_segment_address = (ninja_generator.ExecNinjaGenerator.
get_nacl_text_segment_address())
if OPTIONS.is_bare_metal_build():
execflags = '-pie'
# Goobuntu's linker emits RWX pages for small PIEs. Use gold
# instead. We cannot specify -fuse-ld=gold. As we are building
# executables directly from .c files, the -fuse-ld flag will be
# passed to cc1 and it does not recognize this flag.
ldflags += ' -Bthird_party/gold'
else:
# This is mainly for ARM. See src/build/ninja_generator.py for detail.
execflags = '-Wl,-Ttext-segment=' + text_segment_address
self._variables = {
'name': self._test_binary_name,
'cc': toolchain.get_tool(OPTIONS.target(), 'cc'),
'cxx': toolchain.get_tool(OPTIONS.target(), 'cxx'),
'lib_dir': build_common.get_load_library_path(),
'in_dir': BionicFundamentalTest._get_src_dir(),
'out_dir': BionicFundamentalTest._get_out_dir(),
'out': out,
'crtbegin_exe': build_common.get_bionic_crtbegin_o(),
'crtbegin_so': build_common.get_bionic_crtbegin_so_o(),
'crtend_exe': build_common.get_bionic_crtend_o(),
'crtend_so': build_common.get_bionic_crtend_so_o(),
'cflags': cflags,
'cxxflags': cxxflags,
'ldflags': ldflags,
'soflags': soflags,
'execflags': execflags
}
self._inputs = map(self._expand_vars, inputs)
self._output = self._expand_vars(output)
示例3: get_crash_report
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from 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'
示例4: _configure_build_options
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from 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):
shutil.rmtree(old_path)
else:
shutil.move(old_path, new_path)
else:
os.remove(old_path)
# Create an empty directory as a placeholder if necessary.
build_common.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
示例5: _run_gdb_for_bare_metal_arm
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import target [as 别名]
def _run_gdb_for_bare_metal_arm(runner_args, test_args):
gdb = toolchain.get_tool(OPTIONS.target(), 'gdb')
bare_metal_loader_index = runner_args.index(
build_common.get_bare_metal_loader())
# For Bare Metal ARM, we use qemu's remote debugging interface.
args = (runner_args[:bare_metal_loader_index] +
['-g', '4014'] +
runner_args[bare_metal_loader_index:] + test_args)
# Create a new session using setsid. See the comment in
# _run_gdb_for_nacl for detail.
qemu_arm_proc = subprocess.Popen(args, stderr=subprocess.STDOUT,
preexec_fn=os.setsid)
gdb_command = _get_gdb_command_to_inject_bare_metal_gdb_py(test_args[0])
args = ([gdb, '-ex', 'target remote :4014'] +
gdb_command +
gdb_util.get_args_for_stlport_pretty_printers() +
['-ex',
'echo \n*** Type \'continue\' or \'c\' to start debugging ***\n\n',
build_common.get_bare_metal_loader()])
subprocess.call(args)
qemu_arm_proc.kill()
示例6: get_build_dir
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from 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))
示例7: _get_defined_functions
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import target [as 别名]
def _get_defined_functions(library):
nm = toolchain.get_tool(OPTIONS.target(), 'nm')
nm_output = subprocess.check_output([nm, '-D', '--defined-only', library])
functions = []
for line in nm_output.splitlines():
matched = re.search(r' [TW] (\w+)', line)
if matched:
functions.append(matched.group(1))
return functions
示例8: main
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from 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
示例9: get_defined_symbols
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from 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
示例10: _get_nacl_irt_path
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from 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
示例11: main
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import target [as 别名]
def main():
_setup_sigterm_handler()
OPTIONS.parse_configure_file()
parsed_args = launch_chrome_options.parse_args(sys.argv)
_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)
set_environment_for_chrome()
if not platform_util.is_running_on_remote_host():
_check_apk_existence(parsed_args)
# Do not build crx for drive by mode.
# TODO(crbug.com/326724): Transfer args to metadata in driveby mode.
if parsed_args.mode != 'driveby':
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
示例12: _expand_target_and_glob
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import target [as 别名]
def _expand_target_and_glob(file_patterns):
"""Expands %(target)s and glob pattern in |file_patterns|.
NOTE: This function just expands %(target)s and glob pattern and does NOT
convert a directory path into a list of files under the directory.
"""
format_args = {
'target': build_common.get_target_dir_name(OPTIONS.target())
}
file_patterns = [pattern % format_args for pattern in file_patterns]
paths = []
for pattern in file_patterns:
paths += glob.glob(pattern)
return paths
示例13: __init__
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import target [as 别名]
def __init__(self):
self._test_out_dir = os.path.join(build_common.get_build_dir(),
'bionic_tests')
runner = toolchain.get_tool(OPTIONS.target(), 'runner')
# Add self._test_out_dir to LD_LIBRARY_PATH
runner_with_extra_ld_library_path = re.sub(
r'(LD_LIBRARY_PATH=[^ ]+)', r'\1:' + self._test_out_dir, runner)
self._variables = {
'runner': runner,
'runner_with_extra_ld_library_path': runner_with_extra_ld_library_path,
}
self._test_cnt = 0
self._fail_cnt = 0
示例14: _generate_linker_script_for_runnable_ld
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import target [as 别名]
def _generate_linker_script_for_runnable_ld():
# For Bare Metal mode, we do not modify linker script.
if OPTIONS.is_bare_metal_build():
return []
rule_name = 'gen_runnable_ld_lds'
n = ninja_generator.NinjaGenerator(rule_name)
cc = toolchain.get_tool(OPTIONS.target(), 'cc')
n.rule(rule_name,
command='$in %s > $out || (rm $out; exit 1)' % cc,
description=rule_name)
linker_script = os.path.join(build_common.get_build_dir(), 'runnable-ld.lds')
n.build(linker_script, rule_name, staging.as_staging(
'android/bionic/linker/arch/nacl/gen_runnable_ld_lds.py'))
return linker_script
示例15: _run_gdb_for_bare_metal
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import target [as 别名]
def _run_gdb_for_bare_metal(runner_args, test_args):
gdb = toolchain.get_tool(OPTIONS.target(), 'gdb')
bare_metal_loader_index = runner_args.index(
build_common.get_bare_metal_loader())
gdb_command = _get_gdb_command_to_inject_bare_metal_gdb_py(test_args[0])
args = (runner_args[:bare_metal_loader_index] +
[gdb] +
gdb_command +
gdb_util.get_args_for_stlport_pretty_printers() +
['-ex',
'echo \n*** Type \'run\' or \'r\' to start debugging ***\n\n',
'--args'] +
runner_args[bare_metal_loader_index:] +
test_args)
subprocess.call(args)