Example #1
0
            def execute(self, terminal, *_):
                table = Table()
                for name, snippet in snippet_repository.snippets():
                    row = Row()
                    row.add_cell(Cell('%s%s' % ('%(face-identifier)s', name)))
                    row.add_cell(Cell('%s%s' % ('%(face-comment)s',
                                                snippet.description())))
                    table.add_row(row)

                section = Section('snippets')
                section.add_component(table)
                section.draw(terminal, terminal.width())
Example #2
0
    def execute(self, terminal, thread, arguments):
        if len(arguments) != 2:
            terminal.write(('%(face-error)sError:'
                            '%(face-normal)s invalid arguments!\n'))
            return

        address = abs(long(arguments[0]))
        size = abs(long(arguments[1]))

        inferior = thread.get_inferior()
        listing = inferior.disassemble(address, size)

        section = Section('0x%016lX' % address)
        section.add_component(InstructionListingWidget(listing))
        section.draw(terminal, terminal.width())
Example #3
0
    def execute(self, terminal, thread, arguments):
        if len(arguments) != 2:
            terminal.write(('%(face-error)sError:'
                            '%(face-normal)s invalid arguments!\n'))
            return

        address = abs(int(arguments[0]))
        size = abs(int(arguments[1]))

        inferior = thread.get_inferior()
        listing = inferior.disassemble(address, size)

        section = Section('0x%016lX' % address)
        section.add_component(InstructionListingWidget(listing))
        section.draw(terminal, terminal.width())
Example #4
0
    def draw(self, terminal, width):
        section = Section("context")
        regs = self._create_registers_section(self._previous_context, self._context)
        section.add_component(regs)

        if self._context.stack() is not None and len(self._context.stack()):
            stack = self._create_stack_section(self._context)
            section.add_component(stack)

        if len(self._context.instruction_listing()):
            instructions = self._create_code_section(self._context)
            section.add_component(instructions)

        section.draw(terminal, width)
        terminal.reset()
Example #5
0
    def execute(self, terminal, thread, arguments):
        if len(arguments) != 2:
            terminal.write(('%(face-error)sError:'
                            '%(face-normal)s invalid arguments!\n'))
            return

        address = abs(long(arguments[0]))
        size = abs(long(arguments[1]))

        inferior = thread.get_inferior()
        data_dump = inferior.read_memory(address, size)
        data_chunk = DataChunk(address, data_dump)

        section = Section('0x%016lX' % address)
        section.add_component(DataWidget(data_chunk))
        section.draw(terminal, terminal.width())
Example #6
0
    def draw(self, terminal, width):
        section = Section('context')
        regs = self._create_registers_section(self._previous_context,
                                              self._context)
        section.add_component(regs)

        if self._context.stack() is not None and len(self._context.stack()):
            stack = self._create_stack_section(self._context)
            section.add_component(stack)

        if len(self._context.instruction_listing()):
            instructions = self._create_code_section(self._context)
            section.add_component(instructions)

        section.draw(terminal, width)
        terminal.reset()
Example #7
0
    def execute(self, terminal, thread, arguments):
        if len(arguments) != 2:
            terminal.write(('%(face-error)sError:'
                            '%(face-normal)s invalid arguments!\n'))
            return

        address = abs(int(arguments[0]))
        size = abs(int(arguments[1]))

        inferior = thread.get_inferior()
        data_dump = inferior.read_memory(address, size)
        data_chunk = DataChunk(address, data_dump)

        section = Section('0x%016lX' % address)
        section.add_component(DataWidget(data_chunk))
        section.draw(terminal, terminal.width())
Example #8
0
    def test_section(self):
        section = Section("test section")
        section.draw(self._terminal, self._terminal.width())

        self.assertRaises(AssertionError, section.draw, self._terminal, 1)
Example #9
0
    def test_section(self):
        section = Section('test section')
        section.draw(self._terminal, self._terminal.width())

        self.assertRaises(AssertionError, section.draw, self._terminal, 1)