Debugging in the REDHAWK IDE

谁说我不能喝 提交于 2019-12-25 15:18:22

问题


When stepping through debugging in the REDHAWK IDE, the line marker sometimes doesn't seem to follow proper program flow and not all variables don't seem to be updating appropriately.

I am running in the chalkboard with multiple components. I start debugging by opening the component's .spd.xml file and clicking on the "debug as" hyperlink on the overview tab. This adds the component to the chalkboard with the others. The debugger hits my breakpoint after I start all of the components.

Has anyone experienced either of these symptoms (data not updating or program incorrectly stepping)? If so, what is the cause and how do I overcome this?

Thanks,

--Mike


回答1:


It is likely that you are debugging a C++ executable. When the source code was compiled, the compiler performed certain optimizations which may have caused the machine code to be out of order when compared to the source code. These optimizations may also remove variables from scope. The optimization level is a parameter during compilation. The default level used in REDHAWK is -O2. See the GCC man page for details (http://linux.die.net/man/1/gcc).

If you have the source code for this component, try the following:

make clean; # Remove the binaries previously compiled if any.
./reconf;
./configure;

# Stop here and check the config.log file and search for CXXFLAGS, at the bottom of the log file you'll notice that they are by default set to '-g -O2'.

make V=1 #The V=1 will set the verbose flag and you'll see the calls to g++/gcc. Notice that the CXXFLAGS are in the g++ calls.


To override the CXXFLAGS you may call configure like so:
./configure 'CXXFLAGS=-O0 -g'

Now when you rerun make V=1 you'll see that the optimization level has been reduced from 2 to zero. This will likely solve your debugging issue but has produced a less optimized binary.



来源:https://stackoverflow.com/questions/26642253/debugging-in-the-redhawk-ide

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