ich vor kurzem installiert GCC 4.7.3 und GDB 7.6 auf meinem OS X 10.7 System über MacPorts der Lage sein, C++ 11-Code zu kompilieren. Ich kann Apples selbstgemachten clang ++ und gdb nicht verwenden, da es mir nicht erlaubt, den Code der Standardvorlagenbibliothek richtig zu debuggen (wenn ich beispielsweise einen Listeniterator dereferenziere, stürzt das Programm ab).gcc 4.7.3 und GDB 7.6 auf Mac - seltsame Schritt Probleme
Jetzt, mit der neuen GCC/GDB Kombination, habe ich einige seltsame Probleme beim Einstieg in Funktionen. Nehmen Sie dieses minimal Beispiel:
#include <stdio.h>
class A {
public:
virtual void testMethod() {
printf("test in A\n");
}
};
void test(A &a) {
printf("asdf\n");
a.testMethod(); // here, stepping works with -std=c++11
}
int main() {
A a;
a.testMethod();
test(a);
a.testMethod();
return 0;
}
Wenn ich den Code mit g++ -O0 -ggdb test.cpp
kompilieren, GDB nicht in A::testMethod
überhaupt Schritt ist. Ich kann einen Haltepunkt setzen, indem ich die Codezeile innerhalb von A::testMethod
festlege, aber nicht durch Angabe des Methodennamens (b A::testMethod()
).
Komischerweise, wenn ich mit g++ -O0 -ggdb -std=c++11 test.cpp
kompilieren, tritt GDB in testMethod, wenn von void test()
aufgerufen. Stepping funktioniert immer noch nicht. Jetzt kann ich jedoch einen Haltepunkt festlegen, indem Sie nur den Methodennamen angeben.
Weiter, sobald ich das Programm in GDB starten, bekomme ich GDB Warnungen, wie in verwandten Fragen beschrieben. Diese Warnungen erscheinen unabhängig davon, ob ich -std=c++11
oder nicht angeben.
warning: Could not open OSO archive file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libstdcxx-devel/work/build/./gcc/libgcc_eh.a"
warning: Could not open OSO archive file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libstdcxx-devel/work/build/x86_64-apple-darwin11/libstdc++-v3/src/../libsupc++/.libs/libsupc++convenience.a"
warning: Could not open OSO archive file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libstdcxx-devel/work/build/x86_64-apple-darwin11/libstdc++-v3/src/../src/c++11/.libs/libc++11convenience.a"
warning: Could not open OSO archive file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libstdcxx-devel/work/build/x86_64-apple-darwin11/libstdc++-v3/src/../src/c++98/.libs/libc++98convenience.a"
warning: `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libstdcxx-devel/work/build/x86_64-apple-darwin11/libstdc++-v3/src/.libs/compatibility-atomic-c++0x.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libstdcxx-devel/work/build/x86_64-apple-darwin11/libstdc++-v3/src/.libs/compatibility-c++0x.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libstdcxx-devel/work/build/x86_64-apple-darwin11/libstdc++-v3/src/.libs/compatibility-debug_list-2.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libstdcxx-devel/work/build/x86_64-apple-darwin11/libstdc++-v3/src/.libs/compatibility-debug_list.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libstdcxx-devel/work/build/x86_64-apple-darwin11/libstdc++-v3/src/.libs/compatibility-thread-c++0x.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/libstdcxx-devel/work/build/x86_64-apple-darwin11/libstdc++-v3/src/.libs/compatibility.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/_muldi3_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/addtf3_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/darwin-64_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/divtf3_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/emutls_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/enable-execute-stack_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/eqtf2_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/extenddftf2_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/extendsftf2_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/extendxftf2_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/fixtfdi_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/fixtfsi_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/fixtfti_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/fixunstfdi_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/fixunstfsi_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/fixunstfti_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/floatditf_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/floatsitf_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/floattitf_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/floatunditf_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/floatunsitf_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/floatuntitf_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/getf2_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/letf2_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/multf3_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/negtf2_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/subtf3_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/trunctfdf2_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/trunctfsf2_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/trunctfxf2_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/unordtf2_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/unwind-c_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/unwind-dw2-fde-darwin_s.o': can't open to read symbols: No such file or directory.
warning: `/opt/local/var/macports/build/_opt_mports_dports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libgcc/unwind-dw2_s.o': can't open to read symbols: No such file or directory.
Ich bin mir bewusst, folgende Fragen: Debugging Problems, Weird GDB messages, GDB error message, GDB fails on Mountain Lion, doch sind sie nicht mir geholfen hat. Die Angabe -gdwarf-2 -gstrict-dwarf
hilft auch nicht.
-EDIT- Die Ausgabe von nm
ist in beiden Fällen gleich:
0000000100001068 s GCC_except_table0
00000001000010c0 S _NXArgc
00000001000010c8 S _NXArgv
U __Unwind_Resume
0000000100000e34 T __Z4testR1A
0000000100000eae T __ZN1A10testMethodEv
00000001000010b0 S __ZTI1A
0000000100000f1d S __ZTS1A
0000000100001090 S __ZTV1A
U __ZTVN10__cxxabiv117__class_type_infoE
U ___gxx_personality_v0
00000001000010d8 S ___progname
0000000100000000 T __mh_execute_header
00000001000010d0 S _environ
U _exit
0000000100000e61 T _main
U _puts
0000000100001000 s _pvars
U dyld_stub_binder
0000000100000df8 T start
hat es geschafft, jemand GCC 4.7 und einige entsprechende Debugger arbeiten auf OS X Lion zu bekommen?
hat eine lösung gefunden? Ich habe sehr ähnliche Probleme (http://stackoverflow.com/questions/22581645/gdb-7-7-does-not-step-in-o-on-x-mavericks-with-gcc4-7-3-macports)) – Denis
Nein, tut mir leid. Ich gab schließlich auf. – Entropia