# Linux Kernel Module Cheat

#### 23.8.2. Debug gem5 Python scripts

Start pdb at the first instruction:

    ./run --emulator gem5 --gem5-exe-args='--pdb' --terminal

Requires `--terminal` as we must be on foreground.

Alternatively, you can add to the point of the code where you want to break the usual:

    import ipdb; ipdb.set_trace()

and then run with:

    ./run --emulator gem5 --terminal

TODO test PyCharm: https://stackoverflow.com/questions/51982735/writing-gem5-configuration-scripts-with-pycharm