Example #1
0
  def _DisplayPC( self ):
    frame = self._current_frame
    if not frame:
      return

    self._UndisplayPC( clear_pc = False )

    # FIXME: Do we relly need to keep using up IDs ?
    self._signs[ 'vimspectorPC' ] = self._next_sign_id
    self._next_sign_id += 1

    sign = 'vimspectorPC'
    # If there's also a breakpoint on this line, use vimspectorPCBP
    for bp in self._breakpoints.get( frame[ 'source' ][ 'path' ], [] ):
      if 'line' not in bp:
        continue

      if bp[ 'line' ] == frame[ 'line' ]:
        sign = 'vimspectorPCBP'
        break

    if utils.BufferExists( frame[ 'source' ][ 'path' ] ):
      signs.PlaceSign( self._signs[ 'vimspectorPC' ],
                       'VimspectorCode',
                       sign,
                       frame[ 'source' ][ 'path' ],
                       frame[ 'line' ] )
Example #2
0
  def _ShowBreakpoints( self ):
    for file_name, line_breakpoints in self._line_breakpoints.items():
      for bp in line_breakpoints:
        self._SignToLine( file_name, bp )
        if 'sign_id' in bp:
          signs.UnplaceSign( bp[ 'sign_id' ], 'VimspectorBP' )
        else:
          bp[ 'sign_id' ] = self._next_sign_id
          self._next_sign_id += 1

        line = bp[ 'line' ]
        if 'server_bp' in bp:
          server_bp = bp[ 'server_bp' ]
          line = server_bp.get( 'line', line )
          verified = server_bp[ 'verified' ]
        else:
          verified = self._connection is None

        sign = ( 'vimspectorBPDisabled'
                   if bp[ 'state' ] != 'ENABLED' or not verified
                 else 'vimspectorBPLog'
                   if 'logMessage' in bp[ 'options' ]
                 else 'vimspectorBPCond'
                   if 'condition' in bp[ 'options' ]
                   or 'hitCondition' in bp[ 'options' ]
                 else 'vimspectorBP' )

        if utils.BufferExists( file_name ):
          signs.PlaceSign( bp[ 'sign_id' ],
                           'VimspectorBP',
                           sign,
                           file_name,
                           line )
Example #3
0
    def _ShowBreakpoints(self):
        for file_name, line_breakpoints in self._line_breakpoints.items():
            for bp in line_breakpoints:
                self._SignToLine(file_name, bp)
                if 'sign_id' in bp:
                    signs.UnplaceSign(bp['sign_id'], 'VimspectorBP')
                else:
                    bp['sign_id'] = self._next_sign_id
                    self._next_sign_id += 1

                sign = ('vimspectorBPDisabled'
                        if bp['state'] != 'ENABLED' else 'vimspectorBPCond'
                        if 'condition' in bp['options'] else 'vimspectorBP')

                if utils.BufferExists(file_name):
                    signs.PlaceSign(bp['sign_id'], 'VimspectorBP', sign,
                                    file_name, bp['line'])
Example #4
0
  def _SignToLine( self, file_name, bp ):
    if self._connection is not None:
      return

    if 'sign_id' not in bp:
      return bp[ 'line' ]

    if not utils.BufferExists( file_name ):
      return bp[ 'line' ]

    signs = vim.eval( "sign_getplaced( '{}', {} )".format(
      utils.Escape( file_name ),
      json.dumps( { 'id': bp[ 'sign_id' ], 'group': 'VimspectorBP', } ) ) )

    if len( signs ) == 1 and len( signs[ 0 ][ 'signs' ] ) == 1:
      bp[ 'line' ] = int( signs[ 0 ][ 'signs' ][ 0 ][ 'lnum' ] )

    return bp[ 'line' ]
Example #5
0
    def _DisplayPC(self):
        frame = self._current_frame
        if not frame:
            return

        self._UndisplayPC(clear_pc=False)

        # FIXME: Do we relly need to keep using up IDs ?
        self._signs['vimspectorPC'] = self._next_sign_id
        self._next_sign_id += 1

        # If there's also a breakpoint on this line, use vimspectorPCBP
        sign = 'vimspectorPCBP' if self._IsBreakpointPresentAt(
            frame['source']['path'], frame['line']) else 'vimspectorPC'

        if utils.BufferExists(frame['source']['path']):
            signs.PlaceSign(self._signs['vimspectorPC'], 'VimspectorCode',
                            sign, frame['source']['path'], frame['line'])
Example #6
0
    def ShowBreakpoints(self):
        self._UndisplaySigns()

        for file_name, breakpoints in self._breakpoints.items():
            for breakpoint in breakpoints:
                if 'line' not in breakpoint:
                    continue

                sign_id = self._next_sign_id
                self._next_sign_id += 1
                self._signs['breakpoints'].append(sign_id)
                if utils.BufferExists(file_name):
                    signs.PlaceSign(
                        sign_id, 'VimspectorCode', 'vimspectorBP'
                        if breakpoint['verified'] else 'vimspectorBPDisabled',
                        file_name, breakpoint['line'])

        # We need to also check if there's a breakpoint on this PC line and chnge
        # the PC
        self._DisplayPC()