[issue28610] Provide PDB hook to customize how to find source files

Xavier de Gaye report at bugs.python.org
Fri Nov 4 16:18:26 EDT 2016


Xavier de Gaye added the comment:

The lazycache() function of the linecache module meets your request, I think. See the following debugging session using the attached script:

$ python -m pdb debug_script.py
> /path/to/cwd/debug_script.py(1)<module>()
-> def debug_script(script):
(Pdb) n
> /path/to/cwd/debug_script.py(19)<module>()
-> """
(Pdb) n
> /path/to/cwd/debug_script.py(20)<module>()
-> code, globs = debug_script(s)
(Pdb) n
> /path/to/cwd/debug_script.py(21)<module>()
-> exec(code, globs)
(Pdb) s
--Call--
> /path/to/cwd/script_name(2)<module>()
-> x = 1
(Pdb) s
> /path/to/cwd/script_name(2)<module>()
-> x = 1
(Pdb) s
> /path/to/cwd/script_name(3)<module>()
-> y = 'blabla'
(Pdb) s
--Return--
> /path/to/cwd/script_name(3)<module>()->None
-> y = 'blabla'
(Pdb) s
--Return--
> /path/to/cwd/debug_script.py(21)<module>()->None
-> exec(code, globs)
(Pdb)

----------
nosy: +xdegaye
Added file: http://bugs.python.org/file45358/debug_script.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28610>
_______________________________________


More information about the Python-bugs-list mailing list