def consume_source( msg ): self._sources[ source_reference ] = source buf_name = os.path.join( '_vimspector_tmp', source[ 'name' ] ) self._logger.debug( "Received source %s: %s", buf_name, msg ) buf = utils.BufferForFile( buf_name ) utils.SetUpScratchBuffer( buf, buf_name ) source[ 'path' ] = buf_name with utils.ModifiableScratchBuffer( buf ): utils.SetBufferContents( buf, msg[ 'body' ][ 'content' ] ) and_then( self._sources[ source_reference ] )
def ShowMemory(self, memoryReference, length, offset, msg): if not self._window.valid: return False buf_name = os.path.join('_vimspector_mem', memoryReference) buf = utils.BufferForFile(buf_name) self._scratch_buffers.append(buf) utils.SetUpHiddenBuffer(buf, buf_name) with utils.ModifiableScratchBuffer(buf): # TODO: The data is encoded in base64, so we need to convert that to the # equivalent output of say xxd data = msg.get('body', {}).get('data', '') utils.SetBufferContents(buf, [ f'Memory Dump for Reference {memoryReference} Length: {length} bytes' f' Offset: {offset}', '-' * 80, 'Offset Bytes Text', '-' * 80, ]) utils.AppendToBuffer(buf, utils.Base64ToHexDump(data)) utils.SetSyntax('', 'vimspector-memory', buf) utils.JumpToWindow(self._window) utils.OpenFileInCurrentWindow(buf_name)