How to setup Eclipse IDE for gem5 development?

老子叫甜甜 提交于 2020-05-17 07:13:32

问题


Due to:

  • extensive usage of code auto-generation (notably for the .isa instruction and decoder sublanguage)
  • scons symlinking sources into the build tree, and in particular symlinking src/arch/ARCH to src/ARCH

it becomes very hard to setup Eclipse to work well with gem5.

Has anyone managed to achieve a good setup? Especially interested in Linux hosts.


回答1:


I have achieved a very good setup with the following horrendous hack: define the Eclipse project inside the build/ARM directory itself!

This is done by creating a "New makefile project with existing code" in the build directory. You will also want to fix the C++ standard library as mentioned at: How to solve "Unresolved inclusion: <iostream>" in a C++ file in Eclipse CDT?

This works amazingly because the way the gem5 build system works as of May 2020, the build/ARM directory contains exactly the final compilation tree, including all the source symlinks and autogenerated code,.

This setup is not perfect because there is still some C++ stuff in build/ outside of ARM, e.g. ext, but 99% of the time we don't care about those, and I can perfectly navigate key autogenerated code such as instructions and decoder.

I then just build via the command line normally with scons.

Humongous autogenerated files like exec-ns.cc.inc turn on Eclipse's large file limited mode. Notably, if you want to jump to a definition, Ctrl + click does not work for me, so I just copy the symbol of interest and Ctrl + Shift + T to go to its definition.

I don't usually bother to try GDB step debug gem5 through Eclipse and use it mostly for code navigation, since GDB Dashboard tends to work well enough for me, and I often need to do new log collection runs and I sometimes use reverse debugging when things get serious.

But I have tested step debugging through Eclipse, and it idd work normally (no reason not to I guess), you just have to set it up in exactly the same was as for any other C++ application with a Makefile, i.e. basically tell eclipse the Binary name and the desired CLI on the debug configurations.

You have of course as usual to choose between a gem5.debug debug build or a gem5.opt build, where the .debug build is about 10-20x slower but gives greater debug visibility. In general, if the time to reach the point of interest in a debug build starts to annoy you however, what you tend to really want is to do use reverse debugging.

This is also mentioned at: https://cirosantilli.com/linux-kernel-module-cheat/#gem5-eclipse-configuration

Tested in Eclipse 2020-03.



来源:https://stackoverflow.com/questions/61656709/how-to-setup-eclipse-ide-for-gem5-development

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!