Skip to content

Using trepan With A Multithreaded Application #19

@jterk

Description

@jterk

I'm trying to use trepan to debug a multithreaded web application remotely. I've managed to get remotely connected by doing this on the server:

from threading import Thread
from trepan import debugger
from trepan.api import debug
from trepan.interfaces import server

def _trepan_run():
    connection_opts = {
        'IO': 'TCP',
        'PORT': 1027
    }

    interface = server.ServerInterface(connection_opts=connection_opts)

    debug_opts = {
        'interface': interface
    }

    debug(dbg_opts=debug_opts)

    # An alternative attempt to allow the client to attach
    #
    # dbg = debugger.Debugger(debug_opts)
    # dbg.core.add_ignore(_trepan_run)
    # dbg.core.start()
    #
    # while True:
    #     dbg.core.processor.process_commands()

t = Thread(target=_trepan_run)
t.daemon = True
t.start()

I'm able to connect using python /usr/local/lib/python2.7/site-packages/trepan/client.py -H HOSTNAME and I seem to be able to set breakpoints (I get a Breakpoint 1 set at line X of file FILE message), but execution never stops on the breakpoints I set.

Can you provide any guidance on whether my use-case is possible with trepan and, if so, what I need to do to make it work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions