GDB Unknown Target Exception (when debugging 32-bit target with 64-bit environment)

烈酒焚心 提交于 2020-06-17 09:16:49

问题


I want to use the GDB debugger provided with the 64-bit version of MinGW-w64 (x86_64-w64-mingw32) to debug 32-bit targets created using the 32-bit version of MinGW-w64 (x86_64-w64-mingw32). According to Debug 32 bit application with gdb in 64 bit environment , this is entirely possible. I want to do this as it simplifies my setup.

However, I am getting the following error messages from the debug console of VS Code:

A bunch of "i386:x86-64 is not compatible with target architecture i386":

1: (516) ->&"warning: `C:\\WINDOWS\\SYSTEM32\\ntdll.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.\n"
1: (516) ->=library-loaded,id="C:\\WINDOWS\\SYSTEM32\\ntdll.dll",target-name="C:\\WINDOWS\\SYSTEM32\\ntdll.dll",host-name="C:\\WINDOWS\\SYSTEM32\\ntdll.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x30901000",to="0x30aef528"}]
1: (517) ->&"warning: `C:\\WINDOWS\\System32\\wow64.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.\n"
1: (517) ->=library-loaded,id="C:\\WINDOWS\\System32\\wow64.dll",target-name="C:\\WINDOWS\\System32\\wow64.dll",host-name="C:\\WINDOWS\\System32\\wow64.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x2ec51000",to="0x2eca4560"}]
1: (518) ->&"warning: `C:\\WINDOWS\\System32\\wow64win.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.\n"
1: (518) ->=library-loaded,id="C:\\WINDOWS\\System32\\wow64win.dll",target-name="C:\\WINDOWS\\System32\\wow64win.dll",host-name="C:\\WINDOWS\\System32\\wow64win.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x2f5d1000",to="0x2f64c654"}]
..........
1: (686) ->&"warning: `C:\\mingw64\\bin\\libstdc++-6.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.\n"
1: (687) ->=library-loaded,id="C:\\mingw64\\bin\\libstdc++-6.dll",target-name="C:\\mingw64\\bin\\libstdc++-6.dll",host-name="C:\\mingw64\\bin\\libstdc++-6.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x6fc41000",to="0x6fdfaec8"}]
1: (799) ->=library-loaded,id="C:\\mingw32\\bin\\libgcc_s_dw2-1.dll",target-name="C:\\mingw32\\bin\\libgcc_s_dw2-1.dll",host-name="C:\\mingw32\\bin\\libgcc_s_dw2-1.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x6eb41000",to="0x6eb658f4"}]
1: (815) ->=library-unloaded,id="C:\\mingw64\\bin\\libstdc++-6.dll",target-name="C:\\mingw64\\bin\\libstdc++-6.dll",host-name="C:\\mingw64\\bin\\libstdc++-6.dll",thread-group="i1"
=library-unloaded,id="C:\\mingw64\\bin\\libstdc++-6.dll",target-name="C:\\mingw64\\bin\\libstdc++-6.dll",host-name="C:\\mingw64\\bin\\libstdc++-6.dll",thread-group="i1"

and this unknown target exception and unknown signal message:

gdb: unknown target exception 0x4000001f at 0x4016a6
1: (1003) ->~"\nThread "

Thread 
1: (1003) ->~"1 received signal ?, Unknown signal.\n"
1 received signal ?, Unknown signal.
1: (1003) ->~"0x0009dfb8 in ?? ()\n"
0x0009dfb8 in ?? ()
1: (1003) ->*stopped,reason="signal-received",signal-name="?",signal-meaning="Unknown signal",frame={addr="0x0009dfb8",func="??",args=[],arch="i386"},thread-id="1",stopped-threads="all"

with all threads seemingly being stopped afterwards.

I am not sure which warnings cause the issue, but when I try to debug in VS Code, my hello world program simply hangs, not outputting anything to the console and not hitting any breakpoints.

I am able to successfully debug using the 64-bit debugger with a 64-bit target. What could be the issue with 32-bit?

My MinGW version is 7.0.0 and the corresponding GCC version is 10.1.0 (downloaded from http://winlibs.com/)

来源:https://stackoverflow.com/questions/62404382/gdb-unknown-target-exception-when-debugging-32-bit-target-with-64-bit-environme

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