如何使用 Eclipse 调试 GEM5 代码
Found DPRINTF based debugging unable to meet your needs?
Found GDB based debugging unfriendly to human beings?
Want to debug gem5 source with the help of modern IDEs like Eclipse?
Failed in getting help from GEM5 community?
Come on, dude! Here is the up-to-date tutorial for you!
Environment Configuration
Note that this is just the environment we are currently working under, and it’s at your own risk to adopt the other environments.
- OS:Ubuntu 16.04.1 Desktop
- Eclipse: eclipse-cpp-2018-12-R-linux-gtk-x86_64
- Gem5 Commit ID:c428c220fd351626e2ee0005dda696940261793b
- OpenJDK: 1.8.0_191
Steps to Work
- Build gem5.debug
git clone https://github.com/gem5/gem5 cd gem5 scons build/X86/gem5.debug -j$(cat /proc/cpuinfo | grep "processor" | wc -l) cd util/term make && sudo make install cd ../../..
- Install JRE
sudo apt install default-jre
- Setup eclipse
wget http://ftp.yz.yamagata-u.ac.jp/pub/eclipse/technology/epp/downloads/release/2018-12/R/eclipse-cpp-2018-12-R-linux-gtk-x86_64.tar.gz tar -xvzf eclipse-cpp-2018-12-R-linux-gtk-x86_64.tar.gz
- Config eclipse
-
Open eclipse
cd eclipse ./eclipse
-
Import gem5.debug as the C/C++ executable file
Menu -> File -> Import -> C/C++ folder -> C/C++ Executable
Select gem5.debug as the executableeg. at gem5/build/X86/gem5.debug
-
Create a lauch configuration
Just Leave every thing AS IT IS.
-
- Debug configurations
- Set arguments for gem5.debug to bootup gem5 in the way you expected.
- Set the variable M5_PATH to point out the location of your binaries if you are to use gem5 FS mode.
It’s beyond of this tutorial’s scope to describe where to put these binaries and disk images .
- Tell Eclipse where to lookup the source.
eg. at gem5/build/X86
- Set arguments for gem5.debug to bootup gem5 in the way you expected.
- Just be ready for THE ENDLESS NIGHTMARE gem5 will bring!