Eclipse Luna error messages on GDB and Valgrind, unable to Debug or Profile C++ program as Local C/C++ Application

时光总嘲笑我的痴心妄想 提交于 2020-01-15 11:16:08

问题


I downloaded Eclipse Luna for 64-bit Mac OS X just a few days ago. Would like to use Eclipse for a small C++ program assigned as student homework. Set this up as an Eclipse C++ project.

I built the selected configuration as Debug and run it as Local C/C++ Application. All good. My C++ program runs and output appears in Console window exactly as I want it.

When I attempt Debug as Local C/C++ Application there is a message window Error with command: gdb --version. Cannot run program 'gdb': Unknown reason. So I am unable to launch my program in the Debug perspective and step-execute line by line, use breakpoints, examine variable assignments, etc.

When I attempt Profile as Local C/C++ Application, there is a message window Couldn't determine version of Valgrind. So I am unable to perform automated memory leak detection.

Do I need to complete my Eclipse installation in some additional way using Eclipse > Help > Install New Software option? Do I need to perform some additional installation(s) on my Mac that are outside of the Eclipse framework? I do not see what is missing here, as far as my software installations.

Any assistance, much appreciated..!

Properties for MyLittleProject, Tool Chain Editor Current toolchain: MacOSX GCC Current builder: Gnu Make Builder Used tools MacOS X C Linker MacOS X C++ Linker GCC Assembler GCC Archiver GCC C++ Compiler GCC C Compiler

ABOUT ECLIPSE Eclipse IDE for C/C++ Developers Version: Luna Release (4.4.0) Build id: 20140612-0600

INSTALLATION DETAILS>>INSTALLED SOFTWARE Eclipse IDE for C/C++ Developers EPP CPP Feature C/C++ Autotools support C/C++ Development Tools C/C++ Common GDB Support . . . C/C++ GCC Cross Compiler Support . . . CDT Standalone Debugger Support . . . GDB Tracepoint Analysis . . . Valgrind Tools Integration Profile Framework


回答1:


Eclipse can find neither gdb nor valgrind on your computer. You have to install these manually. You see at INSTALLATION DETAILS>>INSTALLED SOFTWARE that the interfaces to these two programs are installed, yet the programs themselves are missing.

On Mac, you may want to use LLDB instead of gdb.

If you insist on using the two, you have to install them first. I am not familiar with MacOS, but maybe the following links prove to be usefull:

  • http://ntraft.com/installing-gdb-on-os-x-mavericks/
  • http://calvinx.com/2014/05/04/valgrind-on-mac-os-x-10-9-mavericks/

Amendment: The valgrind plugin searches at a specific path for the binary. If it does not work, you need to add a symbolic link to the actual binary like so (from the offical documentation, note that there is a mistake which is corrected below):

ln -s $(which valgrind) /usr/bin/valgrind 


来源:https://stackoverflow.com/questions/25847091/eclipse-luna-error-messages-on-gdb-and-valgrind-unable-to-debug-or-profile-c

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