2017-10-07 4 views
0

Ich versuche gdb zu Debuggen Mingw-W64 kompilierte 32-Bit-Binärdatei. Allerdings gibt gdb viele Warnungen und zeigt keine Stack-Trace. Wie kann ich diesen Prozess normalerweise debuggen?Debugging 32-Bit-Binärdatei in Cygwin-Windows kompiliert mit Mingw-W64

Hier sind einige relevante Details:

  • Diese GDB wurde als "x86_64-pc-Cygwin" konfiguriert.
  • GNU gdb (GDB) (Cygwin 7.10.1-1) 7.10.1
  • Ich kompiliere WxWidgets Bibliothek und bauen mein Programm damit. Aber das sollte für diese Frage nicht relevant sein, außer dass --host=i686-w64-mingw32 --build=i686-pc-cygwin Flags mit wxWidgets configure verwendet wurden.

[email protected] /cygdrive/c/Users/ashish/work/reachit

$ gdb program.exe 
GNU gdb (GDB) (Cygwin 7.10.1-1) 7.10.1 
Copyright (C) 2015 Free Software Foundation, Inc. 
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 
This is free software: you are free to change and redistribute it. 
There is NO WARRANTY, to the extent permitted by law. Type "show copying" 
and "show warranty" for details. 
This GDB was configured as "x86_64-pc-cygwin". 
Type "show configuration" for configuration details. 
For bug reporting instructions, please see: 
<http://www.gnu.org/software/gdb/bugs/>. 
Find the GDB manual and other documentation resources online at: 
<http://www.gnu.org/software/gdb/documentation/>. 
For help, type "help". 
Type "apropos word" to search for commands related to "word"... 
Reading symbols from program.exe...done. 
(gdb) b ReachItButton::OnChar(wxKeyEvent&) 
Breakpoint 1 at 0x734672: file binReach.cpp, line 49. 
(gdb) r 
Starting program: /cygdrive/c/Users/ashish/work/reachit/program.exe 
[New Thread 6148.0x184] 
warning: `/cygdrive/c/Windows/SYSTEM32/ntdll.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386. 
warning: `/cygdrive/c/Windows/System32/wow64.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386. 
warning: `/cygdrive/c/Windows/System32/wow64win.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386. 
warning: dll path for "WOW64_IMAGE_SECTION" can not be evaluated 
warning: Could not load shared library symbols for WOW64_IMAGE_SECTION. 
Do you need "set solib-search-path" or "set sysroot"? 
warning: dll path for "WOW64_IMAGE_SECTION" can not be evaluated 
warning: Could not load shared library symbols for WOW64_IMAGE_SECTION. 
Do you need "set solib-search-path" or "set sysroot"? 
warning: dll path for "NOT_AN_IMAGE" can not be evaluated 
warning: Could not load shared library symbols for NOT_AN_IMAGE. 
Do you need "set solib-search-path" or "set sysroot"? 
warning: dll path for "NOT_AN_IMAGE" can not be evaluated 
warning: Could not load shared library symbols for NOT_AN_IMAGE. 
Do you need "set solib-search-path" or "set sysroot"? 
warning: `/cygdrive/c/Windows/System32/wow64cpu.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386. 
[New Thread 6148.0x2b4] 
[New Thread 6148.0x314] 
[New Thread 6148.0x103c] 
12:33:26: mylog In ReachItPanel : 
12:33:28: mylog In ReachItButton.. onChar 
gdb: unknown target exception 0x4000001f at 0x734672 

Program received signal ?, Unknown signal. 
0x0009dfe8 in ??() 
(gdb) bt 
#0 0x0009dfe8 in ??() 
#1 0x00000000 in ??() 
(gdb) q 
A debugging session is active. 

     Inferior 1 [process 6148] will be killed. 

Quit anyway? (y or n) y 

[email protected] /cygdrive/c/Users/ashish/work/reachit 
$ 

In config.log i haben gcc/configue gegeben wird: -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=i686-w64-mingw32

/cygdrive/i/szsz/tmpp/cygwin64/mingw64-i686/mingw64-i686-gcc-5.4.0-4.x86_64/src/gcc-5.4.0/configure --srcdir=/cygdrive/i/szsz/tmpp/cygwin64/mingw64-i686/mi 
ngw64-i686-gcc-5.4.0-4.x86_64/src/gcc-5.4.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/mingw64-i686-gcc --htmldir=/usr/ 
share/doc/mingw64-i686-gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=i686-w64-mingw32 --without-libiconv-prefix --without-libintl-prefix --with-sysr 
oot=/usr/i686-w64-mingw32/sys-root --with-build-sysroot=/usr/i686-w64-mingw32/sys-root --disable-multilib --disable-win32-registry --enable-languages=c,ada,c++,fortran,lto, 
objc,obj-c++ --enable-fully-dynamic-string --enable-graphite --enable-libgomp --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-version-specific-ru 
ntime-libs --with-dwarf2 --with-gnu-ld --with-gnu-as --with-tune=generic --with-cloog-include=/usr/include/cloog-isl --with-system-zlib --enable-threads=posix --libexecdir= 
/usr/lib 

Gdb ist 64 bit binary und 32 Bit. Ich kann versuchen, mit 64-Bit-Binärdatei, aber ich bin mir nicht sicher, warum Mingw-W64 G ++ Compiler keine 64-Bit-Binärdatei generiert.

Cygwin ist 64 Bit.

Ich habe kompilierte Binärdatei mit:

i686-w64-mingw32-g++ -ggdb -O0 binReach.cpp `wx-config --cxxflags 
--libs std` -Wall -o program -static-libgcc -static-libstdc++ -Wl, 
-Bstatic,-lstdc++,-lpthread -Wl,-Bdynamic 
+0

ich glaube, ich bin dieses Problem schlagen: https://virtuallyfun.superglobalmegacorp.com/2015/ 10/04/32bit-64bit-gdb-collision/ aber ich kann keine gdb32.exe in cygwin64 finden –

+0

Um ein 32-Bit-Ziel zu produzieren, sollten Sie '-m32' Flag sowohl bei WxWidgets bauen und Ihr Programm verwenden. – Ripi2

+0

@ Ripi2 Binär ist bereits 32 Bit. Ich brauche es 64 Bit. –

Antwort