Ejemplo n.º 1
0
def _run_gdb_for_bare_metal_arm(runner_args, test_args):
  gdb = toolchain.get_tool(build_options.OPTIONS.target(), 'gdb')
  bare_metal_loader_index = runner_args.index(
      toolchain.get_nonsfi_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',
           toolchain.get_nonsfi_loader()])
  subprocess.call(args)

  qemu_arm_proc.kill()
Ejemplo n.º 2
0
def _get_gdb_command_to_inject_bare_metal_gdb_py(main_binary):
  return (
      gdb_util.get_gdb_python_init_args() +
      gdb_util.get_gdb_python_script_init_args(
          'bare_metal_support_for_unittest',
          nonsfi_loader=toolchain.get_nonsfi_loader(),
          test_binary=main_binary,
          library_path=build_common.get_load_library_path(),
          runnable_ld_path=build_common.get_bionic_runnable_ld_so()))
Ejemplo n.º 3
0
def get_nacl_tools():
  """Returns a list of the NaCl tools that are needed to run unit tests."""
  if build_options.OPTIONS.is_bare_metal_build():
    return [toolchain.get_nonsfi_loader()]

  bitsize = build_options.OPTIONS.get_target_bitsize()
  arch = 'x86_%d' % bitsize
  nacl_tools = [toolchain.get_nacl_tool('sel_ldr_%s' % arch),
                toolchain.get_nacl_tool('irt_core_%s.nexe' % arch),
                os.path.join(toolchain.get_nacl_toolchain_libs_path(bitsize),
                             'runnable-ld.so')]
  return [os.path.relpath(nacl_tool, build_common.get_arc_root())
          for nacl_tool in nacl_tools]
Ejemplo n.º 4
0
def _run_gdb_for_bare_metal(runner_args, test_args):
  gdb = toolchain.get_tool(build_options.OPTIONS.target(), 'gdb')
  bare_metal_loader_index = runner_args.index(
      toolchain.get_nonsfi_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)