INim
INim copied to clipboard
option to handle errors by breaking into a debugger (same behavior as in ipython --pdb)
this feature is invaluable for debugging:
ipython3 --pdb -i tests/python/t01_inim_issue_debug_on_error.py
Python 3.6.5 (default, Jun 20 2018, 01:40:23)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
~/git_clone/nim/timn/tests/python/t01_inim_issue_debug_on_error.py in <module>()
4 print(b[3])
5
----> 6 fun()
~/git_clone/nim/timn/tests/python/t01_inim_issue_debug_on_error.py in fun()
2 a = 10
3 b = [1, 2, 3]
----> 4 print(b[3])
5
6 fun()
IndexError: list index out of range
> /Users/timothee/git_clone/nim/timn/tests/python/t01_inim_issue_debug_on_error.py(4)fun()
2 a = 10
3 b = [1, 2, 3]
----> 4 print(b[3])
5
6 fun()
ipdb> h
Documented commands (type help <topic>):
========================================
EOF cl disable interact next psource rv unt
a clear display j p q s until
alias commands down jump pdef quit source up
args condition enable l pdoc r step w
b cont exit list pfile restart tbreak whatis
break continue h ll pinfo return u where
bt d help longlist pinfo2 retval unalias
c debug ignore n pp run undisplay
Miscellaneous help topics:
==========================
exec pdb
ipdb> whatis a
<class 'int'>
ipdb> pp a
10
ipdb> pp b
[1, 2, 3]
tests/python/t01_inim_issue_debug_on_error.py
def fun():
a = 10
b = [1, 2, 3]
print(b[3])
fun()
implementation
this could actually be pretty simple: we could use this when compiling programs: nim --debugger:native|endb
NOTE: this option should be enabled / disabled during inim session
NOTE: more generally, options for nim compilation (cf the --nim=
I added) should be customizable during inim session. Just need a good way to handle these "meta" commands
We now have compile-time options available after #51, Is this now possible?