Crombie Tools
debug.py
Go to the documentation of this file.
1
"""@package CrombieTools.debug
2
3
Activates debugging symbols and gives a debugging hook.
4
5
@author: Daniel Abercrombie <dabercro@mit.edu>
6
"""
7
8
import
CrombieTools
9
10
11
CrombieTools.loadAddOn =
'++g'
12
13
14
def
debug
(debugger='gdb'):
15
"""Hooks a debugger to a script.
16
17
See https://root.cern.ch/phpBB3/viewtopic.php?t=10227.
18
19
@param debugger is type of debugger
20
"""
21
import
os
22
pid = os.spawnvp(os.P_NOWAIT,
23
debugger, [debugger,
'-q'
,
'python'
, str(os.getpid())])
24
25
# give debugger some time to attach to the python process
26
import
time
27
time.sleep(1)
28
29
# verify the process' existence (will raise OSError if failed)
30
os.waitpid(pid, os.WNOHANG)
31
os.kill(pid, 0)
python
CrombieTools
debug.py
Generated on Tue Nov 3 2020 04:04:03 for Crombie Tools by
1.8.12