PyCortexMDebug
PyCortexMDebug copied to clipboard
ModuleNotFoundError: No module named 'cmdebug' when sourcing in gdb
Hello @bnahill and co developers
Thanks for this tool. I came across it in this Interrupt blog. So I cloned the repo, installed it with python3 with setup.py. Then in gdb I tried
source ~/PyCortexDebug/cmdebug/svd_gdb.py
which gives the following error
Traceback (most recent call last):
File "~/PyCortexDebug/cmdebug/svd_gdb.py", line 26, in <module>
ModuleNotFoundError: No module named 'cmdebug'
Any obvious thing that I am missing? Thanks.
Is there a chance your GDB is built with Python2? This is surprisingly common still these days. Try installing the python2 branch and see if it picks it up.
Just reporting here in case someone else bumps into this error.
After seeing this response, I verified that my gdb-multiarch is built with Python3.x.
To verify, I ran the following inside my gdb prompt:
(gdb) py
>import sys
>print(sys.version)
>end
3.8.10 (default, Jun 22 2022, 20:18:18)
[GCC 9.4.0]
To fix the issue, I had to run the following in this project directory:
pip3 install ./
After that, I was able to load the python file from GDB and got past this step.