Exemplo n.º 1
0
def init(arc_nexe,
         library_path,
         runnable_ld_path,
         lock_file,
         remote_address=None,
         ssh_options=None):
    """Initializes GDB plugin for nacl_helper in Bare Metal mode.

  If remote_address is specified, we control the _LOCK_FILE using this
  address. This should be specified only for Chrome OS.
  """
    program_address = (
        _get_program_loaded_address(runnable_ld_path) +
        gdb_script_util.get_text_section_file_offset(runnable_ld_path))
    gdb.execute('add-symbol-file %s 0x%x' %
                (runnable_ld_path, program_address))
    LoadHandlerBreakpoint(arc_nexe, library_path)

    # Everything gets ready, so unlock the program.
    if remote_address:
        command = ['ssh', 'root@%s' % remote_address]
        if ssh_options:
            command.extend(ssh_options)
        command.extend(['rm', lock_file])
        subprocess.check_call(command)
    else:
        os.unlink(lock_file)
Exemplo n.º 2
0
 def stop(self):
     # Note as this class is inherited from FinishBreakpoint, this
     # breakpoint will be removed this function returns once.
     file_off = gdb_script_util.get_text_section_file_offset(
         self._runnable_ld_path)
     if file_off is None:
         return None
     gdb.execute('add-symbol-file %s 0x%x' %
                 (self._runnable_ld_path, file_off + self._mmap_addr))
     bare_metal_support.LoadHandlerBreakpoint(self._main_binary,
                                              self._library_path)
 def stop(self):
   # Note as this class is inherited from FinishBreakpoint, this
   # breakpoint will be removed this function returns once.
   file_off = gdb_script_util.get_text_section_file_offset(
       self._runnable_ld_path)
   if file_off is None:
     return None
   gdb.execute('add-symbol-file %s 0x%x' % (self._runnable_ld_path,
                                            file_off + self._mmap_addr))
   bare_metal_support.LoadHandlerBreakpoint(
       self._main_binary, self._library_path)
Exemplo n.º 4
0
 def _get_text_section_address_from_link_map(self, path):
   base_addr_str = gdb_script_util.get_arg('unsigned int', 1)
   if not base_addr_str:
     return None
   try:
     base_addr = int(base_addr_str)
   except ValueError:
     print('Failed to retrieve the address of the shared object: ' +
           base_addr_str)
     return None
   file_off = gdb_script_util.get_text_section_file_offset(path)
   if file_off is None:
     return None
   return file_off + base_addr
Exemplo n.º 5
0
 def _get_text_section_address_from_link_map(self, path):
     base_addr_str = gdb_script_util.get_arg('unsigned int', 1)
     if not base_addr_str:
         return None
     try:
         base_addr = int(base_addr_str)
     except ValueError:
         print('Failed to retrieve the address of the shared object: ' +
               base_addr_str)
         return None
     file_off = gdb_script_util.get_text_section_file_offset(path)
     if file_off is None:
         return None
     return file_off + base_addr
Exemplo n.º 6
0
def init(arc_nexe, library_path, runnable_ld_path, lock_file,
         remote_address=None, ssh_options=None):
  """Initializes GDB plugin for nacl_helper in Bare Metal mode.

  If remote_address is specified, we control the _LOCK_FILE using this
  address. This should be specified only for Chrome OS.
  """
  program_address = (
      _get_program_loaded_address(runnable_ld_path) +
      gdb_script_util.get_text_section_file_offset(runnable_ld_path))
  gdb.execute('add-symbol-file %s 0x%x' % (runnable_ld_path, program_address))
  LoadHandlerBreakpoint(arc_nexe, library_path)

  # Everything gets ready, so unlock the program.
  if remote_address:
    command = ['ssh', 'root@%s' % remote_address]
    if ssh_options:
      command.extend(ssh_options)
    command.extend(['rm', lock_file])
    subprocess.check_call(command)
  else:
    os.unlink(lock_file)