コード例 #1
0
ファイル: LLDB.py プロジェクト: wtismyza/_LLVM
    def _load_interface(self):
        try:
            args = [self.lldb_executable, '-P']
            pythonpath = check_output(
                args, stderr=STDOUT).rstrip().decode('utf-8')
        except CalledProcessError as e:
            raise LoadDebuggerException(str(e), sys.exc_info())
        except OSError as e:
            raise LoadDebuggerException(
                '{} ["{}"]'.format(e.strerror, self.lldb_executable),
                sys.exc_info())

        if not os.path.isdir(pythonpath):
            raise LoadDebuggerException(
                'path "{}" does not exist [result of {}]'.format(
                    pythonpath, args), sys.exc_info())

        try:
            module_info = imp.find_module('lldb', [pythonpath])
            return imp.load_module('lldb', *module_info)
        except ImportError as e:
            msg = str(e)
            if msg.endswith('not a valid Win32 application.'):
                msg = '{} [Are you mixing 32-bit and 64-bit binaries?]'.format(
                    msg)
            raise LoadDebuggerException(msg, sys.exc_info())
コード例 #2
0
ファイル: dbgeng.py プロジェクト: TomWeaver18/dexter
    def _load_interface(self):
        arch = platform.architecture()[0]
        machine = platform.machine()
        if arch == '32bit' and machine == 'AMD64':
          # This python process is 32 bits, but is sitting on a 64 bit machine.
          # Bad things may happen, don't support it.
          raise LoadDebuggerException('Can\'t run Dexter dbgeng on 32 bit python in a 64 bit environment')

        if platform.system() != 'Windows':
          raise LoadDebuggerException('DbgEng supports Windows only')
コード例 #3
0
 def _load_solution(self):
     try:
         self._solution.Open(self.context.options.vs_solution)
     except:
         raise LoadDebuggerException(
             'could not load specified vs solution at {}'.format(
                 self.context.options.vs_solution), sys.exc_info())
コード例 #4
0
 def __init__(self, class_string):
     try:
         super(DTE, self).__init__(com.DispatchEx(class_string))
     except _com_error as e:
         msg, exc = _handle_com_error(e)
         raise LoadDebuggerException(
             '{} [{}]'.format(msg, class_string), orig_exception=exc)
コード例 #5
0
ファイル: VisualStudio.py プロジェクト: kusmour/llvm-project
def _load_com_module():
    try:
        module_info = imp.find_module(
            'ComInterface',
            [os.path.join(os.path.dirname(__file__), 'windows')])
        return imp.load_module('ComInterface', *module_info)
    except ImportError as e:
        raise LoadDebuggerException(e, sys.exc_info())
コード例 #6
0
 def _create_solution(self):
     self._solution.Create(self.context.working_directory.path,
                           'DexterSolution')
     try:
         self._solution.AddFromFile(self._project_file)
     except OSError:
         raise LoadDebuggerException(
             'could not debug the specified executable', sys.exc_info())
コード例 #7
0
 def _break_point_all_lines(self):
     for s in self.context.options.source_files:
         with open(s, 'r') as fp:
             num_lines = len(fp.readlines())
         for line in range(1, num_lines + 1):
             try:
                 self.debugger.add_breakpoint(s, line)
             except DebuggerException:
                 raise LoadDebuggerException(DebuggerException.msg)
コード例 #8
0
ファイル: LLDB.py プロジェクト: wtismyza/_LLVM
 def _custom_init(self):
     self._debugger = self._interface.SBDebugger.Create()
     self._debugger.SetAsync(False)
     self._target = self._debugger.CreateTargetWithFileAndArch(
         self.context.options.executable, self.context.options.arch)
     if not self._target:
         raise LoadDebuggerException(
             'could not create target for executable "{}" with arch:{}'.
             format(self.context.options.executable,
                    self.context.options.arch))
コード例 #9
0
ファイル: VisualStudio.py プロジェクト: kusmour/llvm-project
    def _custom_init(self):
        try:
            self._debugger = self._interface.Debugger
            self._debugger.HexDisplayMode = False

            self._interface.MainWindow.Visible = (
                self.context.options.show_debugger)

            self._solution = self._interface.Solution
            self._solution.Create(self.context.working_directory.path,
                                  'DexterSolution')

            try:
                self._solution.AddFromFile(self._project_file)
            except OSError:
                raise LoadDebuggerException(
                    'could not debug the specified executable', sys.exc_info())

            self._fn_step = self._debugger.StepInto
            self._fn_go = self._debugger.Go

        except AttributeError as e:
            raise LoadDebuggerException(str(e), sys.exc_info())
コード例 #10
0
    def _custom_init(self):
        try:
            self._debugger = self._interface.Debugger
            self._debugger.HexDisplayMode = False

            self._interface.MainWindow.Visible = (
                self.context.options.show_debugger)

            self._solution = self._interface.Solution
            if self.context.options.vs_solution is None:
                self._create_solution()
            else:
                self._load_solution()

            self._fn_step = self._debugger.StepInto
            self._fn_go = self._debugger.Go

        except AttributeError as e:
            raise LoadDebuggerException(str(e), sys.exc_info())
コード例 #11
0
 def add_breakpoint(self, file_, line):
     if not self._target.BreakpointCreateByLocation(file_, line):
         raise LoadDebuggerException(
             'could not add breakpoint [{}:{}]'.format(file_, line))