Configure gdb 7.7.1 and brew install gcc-4.8 in eclipse makefile project

I just installed gdb 7.7.1 and gcc 4.8.3 on brew on my mac 10.9.4, it works well when I use gcc to compile test.cpp and use gdb to debug it; but i cant setup my eclipse cdt IDE to do this? Below is the output and my setup on eclipse?

gcc ouptput when compile in terminal:

    wens@mac-pro:test$ g++ -g -std=c++11 -v test.cpp 
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc48/4.8.3/libexec/gcc/x86_64-apple-           darwin13.3.0/4.8.3/lto-wrapper
Target: x86_64-apple-darwin13.3.0
Configured with: ../configure --build=x86_64-apple-darwin13.3.0 --  prefix=/usr/local/Cellar/gcc48/4.8.3 --enable-languages=c,c++,objc,obj-c++ --program-suffix=-4.8 --with-gmp=/usr/local/opt/gmp4 --with-mpfr=/usr/local/opt/mpfr2 --with-mpc=/usr/local/opt/libmpc08 --with-cloog=/usr/local/opt/cloog018 --with-isl=/usr/local/opt/isl011 --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --with-pkgversion='Homebrew gcc48 4.8.3' --with-bugurl=https://github.com/Homebrew/homebrew-versions/issues --enable-plugin --disable-nls --enable-multilib
Thread model: posix
gcc version 4.8.3 (Homebrew gcc48 4.8.3) 
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.9.3' '-g' '-std=c++11' '-v' '-shared-libgcc' '-mtune=core2'
/usr/local/Cellar/gcc48/4.8.3/libexec/gcc/x86_64-apple-darwin13.3.0/4.8.3/cc1plus -quiet -v -D__DYNAMIC__ test.cpp -fPIC -feliminate-unused-debug-symbols -quiet -dumpbase test.cpp -mmacosx-version-min=10.9.3 -mtune=core2 -auxbase test -g -std=c++11 -version -o /var/folders/8j/2cdrpyn133v4mvc7x65b6c040000gn/T//ccnjAUQK.s
GNU C++ (Homebrew gcc48 4.8.3) version 4.8.3 (x86_64-apple-darwin13.3.0)
compiled by GNU C version 4.8.3, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/Cellar/gcc48/4.8.3/include"
ignoring nonexistent directory "/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-     darwin13.3.0/4.8.3/../../../../x86_64-apple-darwin13.3.0/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/include/c++
/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/include/c++/x86_64-apple-darwin13.3.0
/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/include/c++/backward
/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/include
/usr/local/include
/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/include-fixed
/usr/include
/System/Library/Frameworks
/Library/Frameworks
End of search list.
GNU C++ (Homebrew gcc48 4.8.3) version 4.8.3 (x86_64-apple-darwin13.3.0)
    compiled by GNU C version 4.8.3, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
    Compiler executable checksum: ef96a7cbf8b02312d9306455464399f1
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.9.3' '-g' '-std=c++11' '-v' '-shared-libgcc' '-mtune=core2'
 as -arch x86_64 -force_cpusubtype_ALL -o    /var/folders/8j/2cdrpyn133v4mvc7x65b6c040000gn/T//ccvxLrmP.o /var/folders/8j/2cdrpyn133v4mvc7x65b6c040000gn/T//ccnjAUQK.s
COMPILER_PATH=/usr/local/Cellar/gcc48/4.8.3/libexec/gcc/x86_64-apple-darwin13.3.0/4.8.3/:/usr/local/Cellar/gcc48/4.8.3/libexec/gcc/x86_64-apple-    darwin13.3.0/4.8.3/:/usr/local/Cellar/gcc48/4.8.3/libexec/gcc/x86_64-apple-darwin13.3.0/:/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/:/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/
LIBRARY_PATH=/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/:/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/../../../:/usr/lib/
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.9.3' '-g' '-std=c++11' '-v' '-shared-libgcc' '-mtune=core2' /usr/local/Cellar/gcc48/4.8.3/libexec/gcc/x86_64-apple darwin13.3.0/4.8.3/collect2 -dynamic -arch x86_64 -macosx_version_min 10.9.3 -weak_reference_mismatches non-weak -o a.out -L/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3 -L/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/../../.. /var/folders/8j/2cdrpyn133v4mvc7x65b6c040000gn/T//ccvxLrmP.o -lstdc++ -no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lSystem -v -idsym -dsym
collect2 version 4.8.3
/usr/bin/ld -dynamic -arch x86_64 -macosx_version_min 10.9.3 -weak_reference_mismatches non-weak -o a.out -L/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3 -L/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/../../.. /var/folders/8j/2cdrpyn133v4mvc7x65b6c040000gn/T//ccvxLrmP.o -lstdc++ -no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lSystem -v
@(#)PROGRAM:ld  PROJECT:ld64-236.4
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 armv6m armv7m armv7em
Library search paths:
    /usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3
    /usr/local/Cellar/gcc48/4.8.3/lib
    /usr/lib
    /usr/local/lib
Framework search paths:
    /Library/Frameworks/
    /System/Library/Frameworks/
dsymutil a.out

      

This "a.out" and "a.out.dSYM" output is like native clang and I can debug it correctly with gdb.

Below is the output from eclipse:

    18:02:32 **** Build of configuration Default for project test ****
make all 
/usr/local/bin/g++ -g  -std=c++11 -v   -c -o test.o test.cpp
Using built-in specs.
COLLECT_GCC=/usr/local/bin/g++
Target: x86_64-apple-darwin13.3.0
Configured with: ../configure --build=x86_64-apple-darwin13.3.0 --    prefix=/usr/local/Cellar/gcc48/4.8.3 --enable-languages=c,c++,objc,obj-c++ --program-suffix=-4.8 --with-gmp=/usr/local/opt/gmp4 --with-mpfr=/usr/local/opt/mpfr2 --with-mpc=/usr/local/opt/libmpc08 --with-cloog=/usr/local/opt/cloog018 --with-isl=/usr/local/opt/isl011 --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --with-pkgversion='Homebrew gcc48 4.8.3' --with-bugurl=https://github.com/Homebrew/homebrew-versions/issues --enable-plugin --disable-nls --enable-multilib 
Thread model: posix
gcc version 4.8.3 (Homebrew gcc48 4.8.3) 
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.9.3' '-g' '-std=c++11' '-v' '-c' '-o' 'test.o' '-shared-libgcc' '-mtune=core2'
 /usr/local/Cellar/gcc48/4.8.3/libexec/gcc/x86_64-apple-darwin13.3.0/4.8.3/cc1plus -quiet -v -D__DYNAMIC__ test.cpp -fPIC -feliminate-unused-debug-symbols -quiet -dumpbase test.cpp -mmacosx-version-min=10.9.3 -mtune=core2 -auxbase-strip test.o -g -std=c++11 -version -o /var/folders/8j/2cdrpyn133v4mvc7x65b6c040000gn/T//ccJWTQT8.s
GNU C++ (Homebrew gcc48 4.8.3) version 4.8.3 (x86_64-apple-darwin13.3.0)
    compiled by GNU C version 4.8.3, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/Cellar/gcc48/4.8.3/include"
ignoring nonexistent directory "/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-   darwin13.3.0/4.8.3/../../../../x86_64-apple-darwin13.3.0/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/include/c++
 /usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/include/c++/x86_64-apple-darwin13.3.0
 /usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/include/c++/backward
 /usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/include
 /usr/local/include
 /usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/include-fixed
 /usr/include
 /System/Library/Frameworks
 /Library/Frameworks
End of search list.
GNU C++ (Homebrew gcc48 4.8.3) version 4.8.3 (x86_64-apple-darwin13.3.0)
compiled by GNU C version 4.8.3, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: ef96a7cbf8b02312d9306455464399f1
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.9.3' '-g' '-std=c++11' '-v' '-c' '-o' 'test.o' '-shared-libgcc' '-mtune=core2'
as -arch x86_64 -force_cpusubtype_ALL -o test.o   /var/folders/8j/2cdrpyn133v4mvc7x65b6c040000gn/T//ccJWTQT8.s
COMPILER_PATH=/usr/local/Cellar/gcc48/4.8.3/libexec/gcc/x86_64-apple-darwin13.3.0/4.8.3/:/usr/local/Cellar/gcc48/4.8.3/libexec/gcc/x86_64-apple-darwin13.3.0/4.8.3/:/usr/local/Cellar/gcc48/4.8.3/libexec/gcc/x86_64-apple-darwin13.3.0/:/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/:/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/
/usr/local/bin/g++ -o test test.o 
LIBRARY_PATH=/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/:/usr/local/Cellar/gcc48/4.8.3/lib/gcc/x86_64-apple-darwin13.3.0/4.8.3/../../../:/usr/lib/
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.9.3' '-g' '-std=c++11' '-v' '-c' '-o' 'test.o' '-shared-libgcc' '-mtune=core2'
18:02:32 Build Finished (took 415ms)

      

Configuration in tiny c ++ project makefile project

    CXX = /usr/local/bin/g++
CXXFLAGS = -mmacosx-version-min=10.9.3  -g  -std=c++11 -v -shared-libgcc -mtune=core2

OBJS =      test.o

LIBS =

TARGET =    test

$(TARGET):  $(OBJS)
    $(CXX) -o $(TARGET) $(OBJS) $(LIBS)

all:    $(TARGET)

clean:
    rm -f $(OBJS) $(TARGET)

      

when i use gdb to print local value in main () it gives this:

    (gdb) r
(gdb) file test
Reading symbols from test...done.
(gdb) list
8   #include <iostream>
9   #include <vector>
10  
11  using namespace std;
12  
13  //extern vector<int> spiral_output_matrix(vector<vector<int> > const &v);
14  
15  int main()
16  {
17      vector<int> origin = {1, 3, 5};
(gdb) break 20
Breakpoint 1 at 0x100000810: file test.cpp, line 20.
(gdb) run
Starting program: /Users/wens/Desktop/code_study/eclipse/test/test 

Breakpoint 1, main () at test.cpp:21
21      for (auto i : origin)
(gdb) print i
Could not find the frame base for "main()".
(gdb) 

      

I used the same gcc-4.8 and gdb 7.7.1 for eclipse, from the above output can I learn something about ld and dsymutil? This causes different, right? can anyone tell me if there is a way to configure eclipse for this?

+3


source to share





All Articles