Home > other >  How to add a breakpoint executing child process or thread
How to add a breakpoint executing child process or thread

Time:09-26

I am using VSCode development environment,
Today to see other people's code, write a GUI front, on the GUI point after the RUN, the breakpoint will only stop when the GUI py files, by calling other py files inside this file cannot be suspended, even if I add a breakpoint to execute code will not pause,
He used inside the
Runner=multiprocessing. The process ()
Runner. The start ()
I want to suspend execution step by step in the start, then the debug, I added a breakpoint within the corresponding file, at the time of execution does not stop there,
Also used in the threading. Thread (). Also can not be suspended,

My main question is, why not pause, how to operate, how to understand the multiprocessing, thank you!

CodePudding user response:

In what way you call other py files

CodePudding user response:

Tried this way call, debugging a problem

Amy polumbo y
 
The import wx

The class MyFrame (wx. Frame) :
Def __init__ (self) :
Wx. Frame. __init__ (self, None)
The panel=wx. A panel (self)
Btn1=wx. Button (panel, label='test', pos=(5, 55))
The self. The Bind (wx. EVT_BUTTON, self clickBtn, btn1)

Def clickBtn (self, event) :
The from other_file import test
The import multiprocessing as mp
M=mp Process (target=test, args=(1))
Margaret spellings tart ()
Modes oin ()

If __name__=="__main__ ':
=wx app. The app ()
Frame1=MyFrame ()
Frame1. The Show ()
App. MainLoop ()


Other_file. Py
 
Def test (x) :
Print (x)

CodePudding user response:

refer to the second floor of ice wind response:
calls tried this way, debugging a problem

Amy polumbo y
 
The import wx

The class MyFrame (wx. Frame) :
Def __init__ (self) :
Wx. Frame. __init__ (self, None)
The panel=wx. A panel (self)
Btn1=wx. Button (panel, label='test', pos=(5, 55))
The self. The Bind (wx. EVT_BUTTON, self clickBtn, btn1)

Def clickBtn (self, event) :
The from other_file import test
The import multiprocessing as mp
M=mp Process (target=test, args=(1))
Margaret spellings tart ()
Modes oin ()

If __name__=="__main__ ':
=wx app. The app ()
Frame1=MyFrame ()
Frame1. The Show ()
App. MainLoop ()


Other_file. Py
 
Def test (x) :
Print (x)


Hello, my hand code roughly three modules, the GUI part, begins with the GUI, a process control hardware GUI open a mainloop test, I met the question is, on this side of the GUI code in process. After the start, I want to break point to the part of the process, and there was the mainloop also can not be suspended,

CodePudding user response:

Light to hear you say still don't understand, you can give a simple example code
  • Related