1

I am debugging a python program with pdb. The program will start a new thread.

newThread = Thread(group = None,target = dosomething,name = "thename",
                               args = (),kwargs = {})

def dosomething():
    balaba

Use the normal pdb command e.g. -b to set break point in the line of the new thread(e.g. line of balaba), seems will not trigger the breakpoint.

The question I want to ask is: is there a way I can break into the new thread target function to look into the behavor the new thread?

1
  • This code doesn't run. Could you past your real code? Commented Jun 19, 2012 at 0:00

1 Answer 1

1

One problem to begin with, you have to explicitly start the thread by using .start() - they do not start automatically when you create your Thread object (assuming you are using Python's built in threading library?).

newThread.start()

then see if your line of code is triggered using your debug method.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.