Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: Unable to start debugging. Unexpected GDB output from command "-exec-run". During startup program exited with code 0xc0000139. #10709

Closed
BoBoINVICTUS opened this issue Mar 21, 2023 · 9 comments
Labels
debugger more info needed The issue report is not actionable in its current state

Comments

@BoBoINVICTUS
Copy link

Environment

  • OS and version: windows10
  • VS Code: 1.76
  • C/C++ extension: gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version: GNU gdb (GDB) 8.1

Bug Summary and Steps to Reproduce

Bug Summary:
=thread-group-added,id="i1"
GNU gdb (GDB) 8.1
Copyright (C) 2018 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-w64-mingw32".
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".
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"

Debugger Configurations

task.json:
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "opencv3.5.2",
            "command": "g++",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-I",
                "E:\\opencv\\build\\install\\include",
                "-L",
                "E:\\opencv\\build\\install\\x64\\mingw\\bin",
                "-l",
                "libopencv_world453",
                "-o",
                "${workspaceFolder}\\Debugger\\${fileBasenameNoExtension}.exe",
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind":"build",
                "isDefault": true  
            },
            "detail": "调试器生成的任务。"
        },
    ]
}
launch.json:
{

    "version": "0.2.0",
    "configurations": [
        {
            "name": "opencv debuge",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}\\Debugger\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false, //这里如果为 false,则说明调试直接运行。(反之则停止)
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,//是否调用外部cmd
            "MIMode": "gdb",
            "miDebuggerPath": "E:\\MinGw\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": false
                }
            ],
            "preLaunchTask": "opencv3.5.2"
        }
    ]
}

Debugger Logs

GNU gdb (GDB) 8.1
Copyright (C) 2018 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-w64-mingw32".
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".
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"

Other Extensions

No response

Additional Information

No response

@BoBoINVICTUS
Copy link
Author

I tested it against other relevant questions, and here are the results
image

@WardenGnaw
Copy link
Member

0xc0000139 means something was misconfigured in your setup.

Do you have MinGW in your PATH?

In the image you didnt start debugging. If you run gdb.exe test.exe then enter run does debugging start and end?

@WardenGnaw WardenGnaw added debugger more info needed The issue report is not actionable in its current state labels Mar 21, 2023
@BoBoINVICTUS
Copy link
Author

0xc0000139 means something was misconfigured in your setup.

Do you have MinGW in your PATH?

In the image you didnt start debugging. If you run gdb.exe test.exe then enter run does debugging start and end?

Thank you for your reply immediately, ran into a problem that when I pressed the F5 key, it didn't seem to generate the task as configured in my task.jaso file, running the result shown in the figure below
image

but, when I press "Run c/c++ File", it works.
image
@Q6PWL(E F{$M2423B%Z%H9
Can you tell me why?

@stephen-nju
Copy link

you can check your environment variable in msys2 ming64 terminal,using absolute path ,like export PATH=/D/msys64/mingw64/bin:$PATH

@BoBoINVICTUS
Copy link
Author

you can check your environment variable in msys2 ming64 terminal,using absolute path ,like export PATH=/D/msys64/mingw64/bin:$PATH

Thank you for your reply. Could you tell me more details? I am a novice and do not know much about similar operations, but I have added the path to my environment variable, as shown in the figure:
image

@BoBoINVICTUS
Copy link
Author

I have solved this problem, I installed the "C/C++ Compile Run" plugin and can use the F5 key when uninstalling it.

@meiony
Copy link

meiony commented May 1, 2023

ahh, i meet the same question, but only happen when i use std::thread. if i dont use std::thread, it works.
resolution: i find my system environment variable has anaconda ,it also has anaconda/mingw64 ,and it's on the top of gcc/mingw64 ,so i change the order of them , make gcc/mingw64 on the top of anaconda/ming 64 .
fortunately it works!
image

@BoBoINVICTUS
Copy link
Author

ahh, i meet the same question, but only happen when i use std::thread. if i dont use std::thread, it works. resolution: i find my system environment variable has anaconda ,it also has anaconda/mingw64 ,and it's on the top of gcc/mingw64 ,so i change the order of them , make gcc/mingw64 on the top of anaconda/ming 64 . fortunately it works! image

Thank you for you reply, I solved this problem successfully!

@sunwhw
Copy link

sunwhw commented Jun 6, 2023

ahh, i meet the same question, but only happen when i use std::thread. if i dont use std::thread, it works. resolution: i find my system environment variable has anaconda ,it also has anaconda/mingw64 ,and it's on the top of gcc/mingw64 ,so i change the order of them , make gcc/mingw64 on the top of anaconda/ming 64 . fortunately it works! image

I also successfully solve this problem with your tips. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debugger more info needed The issue report is not actionable in its current state
Projects
None yet
Development

No branches or pull requests

5 participants