Example #1
0
def main():
    args = parseArgs()
    debugger = lldb.SBDebugger.Create()
    if args.name:
        debugger.HandleCommand('process attach -n %r' % args.name)
    elif args.pid:
        debugger.HandleCommand('process attach -p %d' % args.pid)

    # Run a script command in the interpreter, this seems to be necessary as
    # things like assembly seems to not be available from the script
    # environment otherwise.
    debugger.HandleCommand('script 1')

    # Turn on auto-confirm so LLDB does not block forever querying users for
    # command confirmations.
    lldb.SBDebugger.SetInternalVariable('auto-confirm', 'true',
                                        debugger.GetInstanceName())

    try:
        app = ChromeDevToolsDebuggerApp(debugger,
                                        port=args.port,
                                        basepath=args.basepath)
        print('Port: %s' % app.debug_server.server_port)
        sys.stdout.flush()
        app.start_blocking()
    except KeyboardInterrupt:  # Force app to exit on Ctrl-C.
        os._exit(1)
Example #2
0
def main():
    arguments = parse_args()
    lldb_python_path = getattr(arguments, 'lldb_python_path', None)
    if lldb_python_path is not None:
        set_custom_lldb_path(os.path.expanduser(lldb_python_path))
    lldb = get_lldb()
    debugger = lldb.SBDebugger.Create()

    is_attach = (getattr(arguments, 'executable_path', None) == None)
    is_interactive = getattr(arguments, 'interactive', False)
    ipc_channel = IpcChannel(is_interactive)

    start_debugging(debugger, arguments, ipc_channel, is_attach)
    register_signal_handler(debugger)

    chrome_channel = ChromeChannel()
    debugger_store = DebuggerStore(
        debugger,
        chrome_channel,
        ipc_channel,
        is_attach,
        str(getattr(arguments, 'basepath', '.')))

    try:
        app = ChromeDevToolsDebuggerApp(debugger_store, getattr(arguments, 'port', 0))

        # Tell IDE server is ready.
        log_debug('Port: %s' % app.debug_server.server_port)

        event_thread = LLDBListenerThread(debugger_store, app)
        event_thread.start()

        if is_interactive:
            app.start_nonblocking()
            interactive_loop(debugger)
        else:
            app.start_blocking()
    except KeyboardInterrupt:  # Force app to exit on Ctrl-C.
        os._exit(1)

    event_thread.join()
    lldb.SBDebugger.Destroy(debugger)
    lldb.SBDebugger.Terminate()
    # TODO: investigate why we need os._exit() to terminate python process.
    os._exit(0)
Example #3
0
def main():
    arguments = parseArgs()
    debugger = lldb.SBDebugger.Create()
    is_attach = startDebugging(debugger, arguments)

    channel = NotificationChannel()
    debugger_store = DebuggerStore(channel, debugger, arguments.basepath)
    event_thread = LLDBListenerThread(debugger_store, is_attach=is_attach)
    event_thread.start()

    try:
        app = ChromeDevToolsDebuggerApp(debugger_store, arguments.port)
        log_debug('Port: %s' % app.debug_server.server_port)
        if arguments.interactive:
            app.start_nonblocking()
            interactive_loop(debugger)
        else:
            app.start_blocking()
    except KeyboardInterrupt:  # Force app to exit on Ctrl-C.
        os._exit(1)
Example #4
0
def main():
    arguments = parse_args()
    debugger = lldb.SBDebugger.Create()

    is_interactive = getattr(arguments, 'interactive', False)
    ipc_channel = IpcChannel(is_interactive)
    is_attach = start_debugging(debugger, arguments, ipc_channel)

    chrome_channel = ChromeChannel()
    debugger_store = DebuggerStore(
        debugger,
        chrome_channel,
        ipc_channel,
        is_attach,
        str(getattr(arguments, 'basepath', '.')))

    try:
        app = ChromeDevToolsDebuggerApp(debugger_store, getattr(arguments, 'port', 0))
        log_debug('Port: %s' % app.debug_server.server_port)

        event_thread = LLDBListenerThread(debugger_store, app)
        event_thread.start()

        if is_interactive:
            app.start_nonblocking()
            interactive_loop(debugger)
        else:
            app.start_blocking()
    except KeyboardInterrupt:  # Force app to exit on Ctrl-C.
        os._exit(1)

    event_thread.join()
    lldb.SBDebugger.Destroy(debugger)
    lldb.SBDebugger.Terminate()
    # TODO: investigate why we need os._exit() to terminate python process.
    os._exit(0)
Example #5
0
def main():
    arguments = parse_args()
    lldb_python_path = getattr(arguments, 'lldb_python_path', None)
    if lldb_python_path is not None:
        set_custom_lldb_path(os.path.expanduser(lldb_python_path))
    lldb = get_lldb()
    debugger = lldb.SBDebugger.Create()

    is_attach = (getattr(arguments, 'executable_path', None) == None)
    is_interactive = getattr(arguments, 'interactive', False)
    ipc_channel = IpcChannel(is_interactive)

    start_debugging(debugger, arguments, ipc_channel, is_attach)
    register_signal_handler(debugger)

    chrome_channel = ChromeChannel()
    debugger_store = DebuggerStore(debugger, chrome_channel, ipc_channel,
                                   is_attach,
                                   str(getattr(arguments, 'basepath', '.')))

    try:
        app = ChromeDevToolsDebuggerApp(debugger_store,
                                        getattr(arguments, 'port', 0))

        # Tell IDE server is ready.
        log_debug('Port: %s' % app.debug_server.server_port)

        event_thread = LLDBListenerThread(debugger_store, app)
        event_thread.start()

        if is_interactive:
            app.start_nonblocking()
            interactive_loop(debugger)
        else:
            app.start_blocking()
    except KeyboardInterrupt:  # Force app to exit on Ctrl-C.
        os._exit(1)

    event_thread.join()
    lldb.SBDebugger.Destroy(debugger)
    lldb.SBDebugger.Terminate()
    # TODO: investigate why we need os._exit() to terminate python process.
    os._exit(0)