eclipse 调试 MinGW 编译的代码时,gdb 失败并显示错误 193

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2229247/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 14:23:40  来源:igfitidea点击:

gdb fails with error 193 when debugging MinGW-compiled code

ceclipsegccgdbdebugging

提问by Pieter

This is shown when I try to debug my code with Eclipse:

当我尝试使用 Eclipse 调试我的代码时会显示:

alt text

替代文字

I then tried creating a simple Hello World program manually with Notepad++ and the command-line gcc. When I launched the gdb debugger this happened:

然后我尝试使用 Notepad++ 和命令行手动创建一个简单的 Hello World 程序gcc。当我启动 gdb 调试器时,发生了这种情况:

(gdb) run

Starting program: C:\Documents and Settings\Pieter\Bureaublad/test.exe Error creating process C:\Documents and Settings\Pieter\Bureaublad/test.exe, (error 193).

(gdb) 运行

启动程序:C:\Documents and Settings\Pieter\Bureaublad/test.exe 创建进程 C:\Documents and Settings\Pieter\Bureaublad/test.exe 时出错(错误 193)。

The binary runs fine, but as soon as I try to debug it error 193 is returned. I'm working with C code that is processed by the MinGW GCC compiler. I tried reinstalling both the compiler and the debugger (latest versions) but that didn't change anything. It has worked in the past, and I do not remember making any changes to settings related to the compiler.

二进制文件运行良好,但一旦我尝试调试它,就会返回错误 193。我正在使用由 MinGW GCC 编译器处理的 C 代码。我尝试重新安装编译器和调试器(最新版本),但这并没有改变任何东西。它过去一直有效,我不记得对与编译器相关的设置进行了任何更改。

Here's an example of an error log as it was generated by Eclipse.

这是 Eclipse 生成的错误日志示例。

!ENTRY org.eclipse.cdt.dsf.gdb 4 5012 2010-02-09 18:19:47.375 !MESSAGE Error in final launch sequence !STACK 1 org.eclipse.core.runtime.CoreException: Failed to execute MI command: -exec-run Error message from debugger back end: Error creating process C:/Documents and Settings/Pieter/Mijn documenten/My Dropbox/Unief/C/H12/Opdr07/Debug/CH12O07.exe, (error 193). at org.eclipse.cdt.dsf.concurrent.Sequence.abortExecution(Sequence.java:560) at org.eclipse.cdt.dsf.concurrent.Sequence.access$4(Sequence.java:552) at org.eclipse.cdt.dsf.concurrent.Sequence$2.handleErrorOrWarning(Sequence.java:424) at org.eclipse.cdt.dsf.concurrent.RequestMonitor.handleFailure(RequestMonitor.java:314) at org.eclipse.cdt.dsf.concurrent.RequestMonitor.handleCompleted(RequestMonitor.java:277) at org.eclipse.cdt.dsf.concurrent.RequestMonitor$2.run(RequestMonitor.java:239) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) !SUBENTRY 1 org.eclipse.cdt.dsf.gdb 4 10004 2010-02-09 18:19:47.546 !MESSAGE Failed to execute MI command: -exec-run Error message from debugger back end: Error creating process C:/Documents and Settings/Pieter/Mijn documenten/My Dropbox/Unief/C/H12/Opdr07/Debug/CH12O07.exe, (error 193).

!ENTRY org.eclipse.cdt.dsf.gdb 4 5012 2010-02-09 18:19:47.375 !MESSAGE 最终启动序列错误!STACK 1 org.eclipse.core.runtime.CoreException:无法执行 MI 命令:-来自调试器后端的 exec-run 错误消息:错误创建进程 C:/Documents and Settings/Pieter/Mijn documenten/My Dropbox/Unief/C/H12/Opdr07/Debug/CH12O07.exe,(错误 193)。在 org.eclipse.cdt.dsf.concurrent.Sequence.abortExecution(Sequence.java:560) 在 org.eclipse.cdt.dsf.concurrent.Sequence.access$4(Sequence.java:552) 在 org.eclipse.cdt。 dsf.concurrent.Sequence$2.handleErrorOrWarning(Sequence.java:424) at org.eclipse.cdt.dsf.concurrent.RequestMonitor.handleFailure(RequestMonitor.java:314) at org.eclipse.cdt.dsf.concurrent.RequestMonitor.handleCompleted (RequestMonitor.java:277) 在 org.eclipse.cdt.dsf.concurrent。

回答by Alok Singhal

Could it be that either you are using an older version of gdb, that doesn't support native MinGW debugging(unlikely since you said you updated to the latest version), or you are invoking the debugger incorrectly? In other words, if your executable is named helloworld.exe, gdb helloworldmay give you that error, whereas gdb helloworld.exemay work.

可能是您使用的是旧版本的 gdb,不支持本机 MinGW 调试(不太可能,因为您说您更新到最新版本),或者您错误地调用了调试器?换句话说,如果您的可执行文件名为helloworld.exe,则gdb helloworld可能会出现该错误,而gdb helloworld.exe可能会起作用。

Edit: further googling says that trying a directory name without spacesmight work (the solution is for Code::Blocks, but it doesn't hurt to try).

编辑:进一步的谷歌搜索说尝试不带空格目录名称可能会起作用(解决方案是针对 Code::Blocks,但尝试并没有什么坏处)。

回答by Michael Borgwardt

Google tells me that "Error 193" is a Windows error code that means an executable is not, in fact, executable. Looks like there's something wrong with your EXE - can you start it directly?

Google 告诉我“错误 193”是一个 Windows 错误代码,这意味着可执行文件实际上不是可执行文件。看起来你的 EXE 有问题——你能直接启动它吗?

回答by ohsaycanyouc

your shared library setting got turned on (probably because you switched your project from an executable to a shared library, then back) and gcc is still being called with the '-shared' options, but the output file has the .exe extension. There is a checkbox called 'shared' in

您的共享库设置已打开(可能是因为您将项目从可执行文件切换到共享库,然后返回)并且仍使用“-shared”选项调用 gcc,但输出文件具有 .exe 扩展名。有一个名为“共享”的复选框

Properties => C/C++ Build => Settings => Tool Settings => MinGW C Linker => Shared Library Settings.   

Make sure it's not checked. I had also error 193 until I flipped this off.

确保它没有被检查。我也有错误 193,直到我关闭它。

回答by VonC

This threaddoes mention:

这个线程确实提到:

  • Error 193 is ERROR_BAD_EXE_FORMAT
  • this can be an issue with your cygwin installation.
  • 错误 193 是 ERROR_BAD_EXE_FORMAT
  • 这可能是您的 cygwin 安装的问题。

Note (as an example of "problem with cygwin installation): there was a bug with gdb if installed in a cygwin referenced with a path including a space in it (see this thread)

请注意(作为“cygwin 安装问题”的示例):如果安装在引用包含空格的路径的 cygwin 中,则 gdb 存在错误(请参阅此线程

What version of gdb are you using when you reproduce the issue outside of Eclipse CDT?

在 Eclipse CDT 之外重现问题时,您使用的是什么版本的 gdb?

回答by lorenzog

You said:

你说:

(gdb) run

Starting program: C:\Documents and Settings\Pieter\Bureaublad/test.exe Error creating process C:\Documents and Settings\Pieter\Bureaublad/test.exe, (error 193).

(gdb) 运行

启动程序:C:\Documents and Settings\Pieter\Bureaublad/test.exe 创建进程 C:\Documents and Settings\Pieter\Bureaublad/test.exe 时出错(错误 193)。

Might it have anything to do with the forward/reverse slash at the end of the executable path? Perhaps the part Bureaublad/test.exeis here intended as a single executable, and it can't be found?

它可能与可执行路径末尾的正/反斜杠有关吗?也许Bureaublad/test.exe这里的部分是作为一个单一的可执行文件,它无法找到?