Esempio n. 1
0
    def ensure_lldb_is_running(cls, w=None):
        """Returns True if lldb is running (we don't care if we started it or not).
    Returns False on error"""
        # Ensure we reflect any changes to saved settings (including project settings)
        # reload_settings()

        if not w and window_ref():
            w = window_ref()
        else:
            # We're redefining the default window.
            set_window_ref(w)

        if driver_instance() is None:
            sm = SettingsManager.getSM()
            clear_view_on_startup = sm.get_default('i/o.view.clear_on_startup',
                                                   True)
            if clear_view_on_startup:
                LLDBLayoutManager.clear_view(lldb_out_view())

            if not cls.start_debugging(w):
                return False

            set_ui_updater(LLDBUIUpdater())
            g = cls.lldb_greeting()
            if lldb_out_view().size() > 0:
                g = '\n\n' + cls.lldb_greeting()
            lldb_view_write(g)
            lldb_view_write('cwd: ' + os.getcwd() + '\n')
            w.set_view_index(lldb_out_view(), 1, 0)

            cls.debug_prologue(driver_instance())
            return True

        return True
Esempio n. 2
0
    def ensure_lldb_is_running(cls, w=None):
        """Returns True if lldb is running (we don't care if we started it or not).
    Returns False on error"""
        # Ensure we reflect any changes to saved settings (including project settings)
        # reload_settings()

        if not w and window_ref():
            w = window_ref()
        else:
            # We're redefining the default window.
            set_window_ref(w)

        if driver_instance() is None:
            sm = SettingsManager.getSM()
            clear_view_on_startup = sm.get_default('i/o.view.clear_on_startup', True)
            if clear_view_on_startup:
                LLDBLayoutManager.clear_view(lldb_out_view())

            if not cls.start_debugging(w):
                return False

            set_ui_updater(LLDBUIUpdater())
            g = cls.lldb_greeting()
            if lldb_out_view().size() > 0:
                g = '\n\n' + cls.lldb_greeting()
            lldb_view_write(g)
            lldb_view_write('cwd: ' + os.getcwd() + '\n')
            w.set_view_index(lldb_out_view(), 1, 0)

            cls.debug_prologue(driver_instance())
            return True

        return True
Esempio n. 3
0
    def debug_prologue(cls, driver):
        """
        Prologue for the debugging session during the development of the plugin.
        Loads a simple program in the debugger and sets a breakpoint in main()
        """
        sm = SettingsManager.getSM()
        prologue = sm.get_default('prologue', [])

        debug(debugPlugin, 'LLDB prologue: %s' % str(prologue))
        for c in prologue:
            lldb_view_write(lldb_prompt() + c + '\n')
            driver.interpret_command(c)
Esempio n. 4
0
    def debug_prologue(cls, driver):
        """
        Prologue for the debugging session during the development of the plugin.
        Loads a simple program in the debugger and sets a breakpoint in main()
        """
        sm = SettingsManager.getSM()
        prologue = sm.get_default('prologue', [])

        debug(debugPlugin, 'LLDB prologue: %s' % str(prologue))
        for c in prologue:
            lldb_view_write(lldb_prompt() + c + '\n')
            driver.interpret_command(c)
Esempio n. 5
0
    def initialize_lldb(cls, w):
        # set_got_input_function(lldb_in_panel_on_done)

        driver = LldbDriver(w, lldb_view_send, process_stopped, on_exit_callback=cls.cleanup)
        event = lldb.SBEvent()
        listener = lldb.SBListener('Wait for lldb initialization')
        listener.StartListeningForEvents(driver.broadcaster,
                LldbDriver.eBroadcastBitThreadDidStart)

        driver.start()
        listener.WaitForEvent(START_LLDB_TIMEOUT, event)
        listener.Clear()

        if not event:
            lldb_view_write("oops... the event isn't valid")

        return driver
Esempio n. 6
0
    def initialize_lldb(cls, w):
        # set_got_input_function(lldb_in_panel_on_done)

        driver = LldbDriver(w,
                            lldb_view_send,
                            process_stopped,
                            on_exit_callback=cls.cleanup)
        event = lldb.SBEvent()
        listener = lldb.SBListener('Wait for lldb initialization')
        listener.StartListeningForEvents(
            driver.broadcaster, LldbDriver.eBroadcastBitThreadDidStart)

        driver.start()
        listener.WaitForEvent(START_LLDB_TIMEOUT, event)
        listener.Clear()

        if not event:
            lldb_view_write("oops... the event isn't valid")

        return driver