I am trying to debug a python module I wrote in nim using lldb on a Macintosh. Anyone know how to debug a python module?
The shared library module is compiled like:
nim c -d:buidingLib --debugger:native --verbosity:0 --hints:off --threads:on \
--tlsEmulation:off --app:lib --out:bin/metar.so metar/metar
Here are the steps I use to debug:
$ lldb -- /usr/bin/python python/example.py
(lldb) target create "/usr/bin/python"
Current executable set to '/usr/bin/python' (x86_64).
(lldb) settings set -- target.run-args "python/example.py"
(lldb) breakpoint set -f readMetadata.nim -l 60
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
(lldb) r
Process 4949 launched: '/usr/bin/python' (x86_64)
Process 4949 stopped
* thread #2, stop reason = exec
frame #0: 0x000000010000719c dyld`_dyld_start
dyld`_dyld_start:
-> 0x10000719c <+0>: popq %rdi
0x10000719d <+1>: pushq $0x0
0x10000719f <+3>: movq %rsp, %rbp
0x1000071a2 <+6>: andq $-0x10, %rsp
Target 0: (Python) stopped.
(lldb) r
There is a running process, kill it and restart?: [Y/n] n
I expect the debugger to stop at my breakpoint and show source code when I run the first time. And if the breakpoint was missed for some reason, I expect a lot of screen output from my program.
The size of the module is much bigger so it appears it has debugging symbols.
I can debug a nim program with lldb but not this shared lib.