Vscode-cpptools: Unable to start debugging

Created on 20 Aug 2018  Â·  10Comments  Â·  Source: microsoft/vscode-cpptools

Type: Debugger

Unable to start debugging

  • OS and Version: Mac OS High Sierra 10.13.6
  • VS Code Version: 1.26.1
  • C/C++ Extension Version: 0.2.2
  • Other extensions you installed (and if the issue persists after disabling them):
  • A clear and concise description of what the bug is. I'm new to programming and I'm trying to learn how to debug my program. Whenever I try to, I get this error:

Unable to start debugging. Program path '/Users/myComputer/vscodeworkspace/test.cpp' is missing or invalid.

LLDB failed with message: Command 'file-exec-and-symbols'. Target binary '/Users/myComputer/vscodeworkspace/test.cpp' is invalid. error: '/Users/myComputer/vscodeworkspace/test.cpp' doesn't contain any 'host' platform architectures: x86_64h, x86_64, i386

This may occur if the process's executable was changed after the process was started, such as when installing an update. Try re-launching the application or restarting the machine.

Here is the launch.json:
{
"version": "0.2.0",
"configurations": [

    {
        "name": "(lldb) Launch",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}/test.cpp",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": true,
        "MIMode": "lldb"
    }
]

}

I'm sorry if this is a common issue or I'm doing something stupid, but I've looked all over the internet for anyone with the same error and I can't find anything. Pls help!

debugger question

Most helpful comment

@timothyk120 you need to compile your .cpp file before you debug. The program will be the executable that comes out after you compile it.

if you are on a mac, you can compile using g++ -g <your .cpp files separated by space> -o <your executable name> and then put your executable name in the program field.

All 10 comments

@timothyk120 you need to compile your .cpp file before you debug. The program will be the executable that comes out after you compile it.

if you are on a mac, you can compile using g++ -g <your .cpp files separated by space> -o <your executable name> and then put your executable name in the program field.

Thanks for the response. The debugger runs now but when I run it the debug console just outputs a bunch of stuff but doesn't actually let me debug the code.

Here is what the debug console outputs:

Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=thread-selected,id="1"
Loaded '/usr/lib/dyld'. Symbols loaded.
Loaded '/usr/lib/libc++.1.dylib'. Symbols loaded.
Loaded '/usr/lib/libSystem.B.dylib'. Symbols loaded.
Loaded '/usr/lib/libc++abi.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libcache.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libcommonCrypto.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libcompiler_rt.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libcopyfile.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libcorecrypto.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libdispatch.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libdyld.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libkeymgr.dylib'. Symbols loaded.

The program '/Users/myComputer/vscodeworkspace/test2' has exited with code 0 (0x00000000).

@timothyk120 Did you change stopAtEntry to true or set a breakpoint? Otherwise it will run your app under a debugger. The exit with code 0 tells us that your program ram correctly.

Thanks for the reply, I set a breakpoint and it works now. Not sure what stopAtEntry is though, is that something I should have set to true? And do I always have to set a breakpoint in order to be able to step through my code?

@timothyk120 stopAtEntry will automatically stop at the first line of your main() method when launching. Its an option you can set if you want to start debugging at the beginning of main without setting a breakpoint.

hi..
I am similar to his question。
My set a breakpoint!
error message:
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=thread-selected,id="1"

OS and Version: Mac OS Catalina 10.15
VS Code Version: 1.39.2
C/C++ Extension Version: 0.26.1

@tuyuwei please refer to the tagged Mac OS Catalina issue and comment there.

OK, thanks!!

Hey @pieandcakes
i am also getting the same error in my mac
error message:
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.

Was this page helpful?
0 / 5 - 0 ratings