I have a python script, which is extending gdb for C debugging. I run gdb project_name/gdb/target.elf
to start gdb. I'm on Windows 10 using the cygwin terminal. When i'm in the gdb console I type source project_name/gdb/debug.py
. In my debug.py file I have a class StartupHandler:
class StartupHandler(gdb.Command):
def __init__ (self):
super (StartupHandler, self).__init__ ("startup-handler", gdb.COMMAND_NONE)
def invoke (self, args):
which is getting inizialized using the code StartupHandler()
. After that I can run startup_handler args
in the gdb console which calls the invoke()
method, that makes some initialization. After that I can debug my target.
Now I would like to factor out some global variables I'm using in project_name/gdb/debug.py
in an additional file called project_name/gdb/debug_data.py
and import the global vars like from debug_data import var1
By importing the global vars from the new file I'm getting the Error:
File "c:\current\share\gdb/python\gdb\__init__.py", line 130, in _execute_file
exec(compiled, globals, globals)
File "project/gdb/debug.py", line 17, in <module>
from debug_data import var1
ModuleNotFoundError: No module named 'debug_data'
when I type in source hymap/gdb/debug.py
in the gdb console.
Does anyone know why the python interpreter inside gdb throws the ModuleNotFoundError?