microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.5k stars 1.55k forks source link

Can't debug on macOS Catalina (LLDB) #3829

Closed man-jai closed 4 years ago

man-jai commented 5 years ago

Type: Debugger Input information below

Please review existing issues and our documentation at https://github.com/Microsoft/vscode-cpptools/tree/master/Documentation prior to filing an issue.

Describe the bug

To Reproduce

launch.json ``` "version":"0.2.0", "configurations":[ { "type":"cppdbg", "request":"launch", "name":"Debug", "preLaunchTask":"build", "program":"${workspaceFolder}/debug/OpenGLTut.out", "args":[ ], "stopAtEntry":true, "cwd":"${workspaceFolder}", "environment":[ ], "externalConsole":true, "MIMode":"lldb", "internalConsoleOptions":"openOnSessionStart", "showDisplayString":false, "logging":{ "trace":true, "traceResponse":true, "engineLogging":true, "programOutput":true, } } ] ```
tasks.json ``` "version":"2.0.0", "tasks":[ { "type":"shell", "label":"build", "command":"clang++", "args":[ "-g", "-std=c++17", "-stdlib=libc++", "-framework", "Cocoa", "-framework", "OpenGL", "-framework", "IOKit", "-framework", "CoreVideo", "-L", "/usr/local/include/", "-lglew", "-lglfw3", "${workspaceFolder}/src/Application.cpp", "-o", "${workspaceFolder}/debug/OpenGlTut.out", "--debug", ], "group":{ "kind":"build", "isDefault":true } } ] ```

Steps to reproduce the behaviour: debug using the above tasks and launch files

Additional context If applicable, please include logging by adding "logging": { "engineLogging": true, "trace": true, "traceResponse": true } in your launch.json Add any other context about the problem here including log or error messages in your Debug Console or Output windows.

wangzhen11aaa commented 4 years ago

But i have the launch.json. { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [

    {
        "type": "lldb",
        "request": "launch",
        "name": "Launch",
        "program": "test_priority_queue",
        "args": [],
        "cwd": "${workspaceFolder}"
    }
    // {
    //     "type": "lldb",
    //     "request": "launch",
    //     "name": "Launch Program",
    //     "program": "test_priority_queue",
    //     "cwd": "${workspaceRoot}"
    //     }
]

}

wangzhen11aaa commented 4 years ago

launch.json in .vscode direcotory. image

workspace: image

When I use debug: image Then Select the LLDB image This is the extension i installed. image I have uninstalled the CodeLLDB : It shows this. image

I reinstalled it. image It's good now. image

But when I restart the vscode. open the same code directory. image

When I choose LLDB:

image

And it does not debug any more... But the file does not change. image image

What happend..

wangzhen11aaa commented 4 years ago

I just found the problem. You need to reload the project with some extension named reload. image

zhusjfaker commented 4 years ago

@cxstdio launch.json

- "type": "cppdbg"
+ "type": "lldb"

感谢大佬

lldb 类型不支持 需要装什么样的扩展吗

ghost commented 4 years ago

@cxstdio launch.json

- "type": "cppdbg"
+ "type": "lldb"

感谢大佬

lldb 类型不支持 需要装什么样的扩展吗

Mac先要安装微软那个c/c++拓展。然后配置task和launch我目前是vscode最新版,没问题。我的lldb是xcode自带的。

a4z commented 4 years ago

just got hit by the same problem, Catalina 10.15.1 and Xcode 11.2 wonder what the 'official' recommendation for solving this problem is

here I see 2 different plugin as workaround suggested,

or, installing just lldb-mi ?

it would be extreme helpful to have just 1 way to follow, especially, if the C++ tools will be fixed some day, with a way to switch back

Saafo commented 4 years ago

I've also been troubled by this issue in my exam week.....
I spent about three hours last night until 1 a.m. to solve this problem until I found that it is not my mistake here.
I'm using Catalina 10.15.1 and Xcode 11.2.

I've tried about the CodeLLVM extension this noon. It works fine and my breakpoints start to work again. but I've got a problem: How can I enable the external console if I want to input something in my program? There seem to exist some problem in my launch.json:
image Besides, I also wonder the "official" recommendation as @a4z had mentioned.

ruokid commented 4 years ago

I've also been troubled by this issue in my exam week..... I spent about three hours last night until 1 a.m. to solve this problem until I found that it is not my mistake here. I'm using Catalina 10.15.1 and Xcode 11.2.

I've tried about the CodeLLVM extension this noon. It works fine and my breakpoints start to work again. but I've got a problem: How can I enable the external console if I want to input something in my program? There seem to exist some problem in my launch.json: Besides, I also wonder the "official" recommendation as @a4z had mentioned.

"terminal": "external"

Saafo commented 4 years ago

I've also been troubled by this issue in my exam week..... I spent about three hours last night until 1 a.m. to solve this problem until I found that it is not my mistake here. I'm using Catalina 10.15.1 and Xcode 11.2. I've tried about the CodeLLVM extension this noon. It works fine and my breakpoints start to work again. but I've got a problem: How can I enable the external console if I want to input something in my program? There seem to exist some problem in my launch.json: Besides, I also wonder the "official" recommendation as @a4z had mentioned.

"terminal": "external"

It works! Thanks very much.
BTW, could you please tell me how do you know we should use the "terminal:external" key-value in launch.json? Is there any documents?

pidanself commented 4 years ago

I've also been troubled by this issue in my exam week..... I spent about three hours last night until 1 a.m. to solve this problem until I found that it is not my mistake here. I'm using Catalina 10.15.1 and Xcode 11.2. I've tried about the CodeLLVM extension this noon. It works fine and my breakpoints start to work again. but I've got a problem: How can I enable the external console if I want to input something in my program? There seem to exist some problem in my launch.json: Besides, I also wonder the "official" recommendation as @a4z had mentioned.

"terminal": "external"

It works! Thanks very much. BTW, could you please tell me how do you know we should use the "terminal:external" key-value in launch.json? Is there any documents?

MANUAL contains these informations. And I have a question. My output couldn't display in terminal when debugging like this:

截屏2019-11-17下午3 00 56
Saafo commented 4 years ago

I've also been troubled by this issue in my exam week..... I spent about three hours last night until 1 a.m. to solve this problem until I found that it is not my mistake here. I'm using Catalina 10.15.1 and Xcode 11.2. I've tried about the CodeLLVM extension this noon. It works fine and my breakpoints start to work again. but I've got a problem: How can I enable the external console if I want to input something in my program? There seem to exist some problem in my launch.json: Besides, I also wonder the "official" recommendation as @a4z had mentioned.

"terminal": "external"

It works! Thanks very much. BTW, could you please tell me how do you know we should use the "terminal:external" key-value in launch.json? Is there any documents?

MANUAL contains these informations. And I have a question. My output couldn't display in terminal when debugging like this:

截屏2019-11-17下午3 00 56

Maybe you should go to your desktop to see if there is the terminal.app here....

pidanself commented 4 years ago

I've also been troubled by this issue in my exam week..... I spent about three hours last night until 1 a.m. to solve this problem until I found that it is not my mistake here. I'm using Catalina 10.15.1 and Xcode 11.2. I've tried about the CodeLLVM extension this noon. It works fine and my breakpoints start to work again. but I've got a problem: How can I enable the external console if I want to input something in my program? There seem to exist some problem in my launch.json: Besides, I also wonder the "official" recommendation as @a4z had mentioned.

"terminal": "external"

It works! Thanks very much. BTW, could you please tell me how do you know we should use the "terminal:external" key-value in launch.json? Is there any documents?

MANUAL contains these informations. And I have a question. My output couldn't display in terminal when debugging like this:

截屏2019-11-17下午3 00 56

Maybe you should go to your desktop to see if there is the terminal.app here....

可以弹出终端并正常调试,但是在调试的过程中我的代码中printf输出的内容不会显示在终端上,只有调试结束后内容才会显示在终端,不知道这是否算是正常?

yrpang commented 4 years ago

I've also been troubled by this issue when I struggling in exam review. It really confused me. Really hope it will be fixed soon.

thekeels commented 4 years ago

I was having this problem when I upgraded to Catalina. At that time, the solution above of finding the lldb-mi from an older Xcode, copying it to /Applications/Xcode.app/Contents/Developer/usr/bin/ and referencing that location as the "miDebuggerPath" was working.

They might have fixed in in the new version of cpptools? I found that the ~/.vscode/extensions/ms-vscode.cpptools/debugAdapter/lldb folder contains a copy of lldb-mi and using that as the miDebuggerPath is working for me. I'm using ms-vscode.cpptools v0.26.1.

theclaw37 commented 4 years ago

@thekeels doesn't work. The path is ~/.vscode/extensions/ms-vscode.cpptools/debugAdapters/lldb (you forgot the s), but the breakpoints are still not hit

satysin commented 4 years ago

I tested with a clean install of code and the extension and it appears to work without any extra work. Going to test again tonight and document my steps. Didn’t expect it to work this time so didn’t keep a note of what I did sorry! Will comment again later.

zhusjfaker commented 4 years ago

image

image

please install anther extension to use lldb debug c++ app it's work

zhusjfaker commented 4 years ago

image

image

please install anther extension to use lldb debug c++ app it's work

billowqiu commented 4 years ago

CodeLLDB works in macos 10.15.1

maxtomczyk commented 4 years ago

On my MacOS 10.15.1 CodeLLDB started to work properly only after full macOS reinstall (with full disk wipe). However, clean install didn't make C/C++ extension debug working, as @satysin suggested.

satysin commented 4 years ago

Okay I followed the instructions at https://code.visualstudio.com/docs/cpp/config-clang-mac and everything appears to work as it should, at least in regards to breakpoints. I didn't test if watches, etc. work properly sorry. Below is a screenshot with it stopped at a breakpoint as expected.

Code version: 1.40.1 ms-vscode.cpptools version: 0.26.2-insiders2

Screenshot 2019-11-25 at 19 54 47

And here are my json files

tasks.json { "version": "2.0.0", "tasks": [ { "label": "Build with Clang", "type": "shell", "command": "clang++", "args": [ "-std=c++17", "-stdlib=libc++", "helloworld.cpp", "-o", "helloworld.out", "--debug" ], "group": { "kind": "build", "isDefault": true } } ] }

launch.json { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(lldb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/helloworld.out", "args": [], "stopAtEntry": true, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "lldb" } ] }

c_cpp_properties.json { "configurations": [ { "name": "Mac", "includePath": [ "${workspaceFolder}/**" ], "defines": [], "macFrameworkPath": [ "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks" ], "compilerPath": "/usr/bin/clang", "cStandard": "c11", "cppStandard": "c++17", "intelliSenseMode": "${default}" } ], "version": 4 }

Aleishus commented 4 years ago

have the same problem , only codelldb can work on 10.15.1 I add miDebuggerPath ,but get this error

WARNING: Debugger executable '/Users/xxx/.vscode/extensions/ms-vscode.cpptools-0.26.2-insiders3/debugAdapters/lldb/bin/lldb-mi' is not signed. As a result, debugging may not work properly.

and still don't hit the breakpoint after I signed it

sudo codesign -fs lldb-mi-xi lldb-mi
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=thread-selected,id="1"
wangbo223 commented 4 years ago

Same issue for Catalina reported here https://github.com/microsoft/vscode-cpptools/issues/4660

sewellge commented 4 years ago

@satysin I had the same setup on a clean install but didn't work for me. Upgraded to 1.40.2 just in case, still didn't work.

Workaround of CodeLLDB worked though.

KGIgor commented 4 years ago

I have the same issue. debugger doesn't stop at breakpoints. OS: Catalina 10.15.1 VSCode: 1.40.2 C/C++ for Visual Studio Code: Version 0.26.2: December 2, 2019

launch.json

"configurations": [ { "name": "clang build and debug active file", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/runme", "args": ["1.test"], "stopAtEntry": true, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "MIMode": "lldb", // "preLaunchTask": "clang build active file" } ]

Also, after pushing F5 in DEBUG CONSOLE there are only:

Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=thread-selected,id="1"

plus my binary's output and nothing more.

On other Mac with High Sierra OS the same operation outputs some additional information about loading different libraries.

CodeLLDB works fine.

ligadata-dima commented 4 years ago

cannot set break point in VSCode 1.40.2 on MacOS Catalina 10.15.1 tried to install CodeLLDB with no luck (may be it need to be configured?)

on top of that - this is my first time ever using VScode for C++ on Mac so I never saw it working and don't know if it even suppose to work)

please help!!!!!!!

I have one file helloworld.cpp with

#include <iostream>
using namespace std;
int main()
{
    cout << "hello break point? where are you???" << endl;
}

And here are my json files c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(lldb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/helloworld.out",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "lldb",
            "logging": {
                "trace": true,
                "traceResponse": true,
                "engineLogging": true
              }
        }
    ]
}

tasks.json

{
    "version": "2.0.0",
    "tasks": [
      {
        "label": "Build with Clang",
        "type": "shell",
        "command": "clang++",
        "args": [
          "-std=c++17",
          "-stdlib=libc++",
          "helloworld.cpp",
          "-o",
          "helloworld.out",
          "--debug"
        ],
        "group": {
          "kind": "build",
          "isDefault": true
        }
      }
    ]
  }

P.S. i used this tutorial https://code.visualstudio.com/docs/cpp/config-clang-mac

ligadata-dima commented 4 years ago

cannot set break point in VSCode 1.40.2 on MacOS Catalina 10.15.1 tried to install CodeLLDB with no luck (may be it need to be configured?) ...

it seems to be fixed by installing CodeLLDB VSCode plugin

and replacing launch.json with this text

        {
            "name": "lldb123",
            "type": "lldb",
            "request": "launch",
            "program": "${workspaceFolder}/helloworld.out",
            "args": []
        }

I lost console window though I don't see any output

ligadata-dima commented 4 years ago

it is very sad to see such popular product like VSCode have critical bug open since June

z-x-z commented 4 years ago

It's also sad that you have spent 3 hours to find the significative issue instead of the useless trash info on the Internet.

dz-s commented 4 years ago

I bet I was able to debug simple helloworld.cpp on macOS Catalina. Now I've just come across the same issue. Everything but breakpoints works fine.

CodeLLDB works perfectly, big kudos to vadimcn.

pstarkgit commented 4 years ago

+1, with Xcode 11.3 out this issue is only getting worse. I am unable to debug at all using VS Code 1.41.1.

dstein64 commented 4 years ago

A workaround is to use gdb instead of lldb, which requires:

  1. Installing gdb
  2. Code signing the gdb binary: https://sourceware.org/gdb/wiki/PermissionsDarwin
  3. Setting "MIMode": "gdb" in launch.json

I've tested this with gdb 8.3.1. It works, but in some cases the debugger would not reach the first breakpoint. In such cases, stopping the debugger and relaunching was sufficient to reach the breakpoint.

nolongerwait commented 4 years ago

I also could not use lldb to debug C++ on macOS. with Xcode Version 11.3 (11C29), macOS Catalina 10.15.2 (19C57) and VS code

Version: 1.41.1
Commit: 26076a4de974ead31f97692a0d32f90d735645c0
Date: 2019-12-18T14:57:51.166Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 19.2.0

(helloworld.cpp)

Debug Console Log ``` --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (143) LaunchOptions E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (155) LaunchOptions ExePath='/Users/welkin/Visual Studio Code C++/main.out'\n"},"seq":4} 1: (155) LaunchOptions ExePath='/Users/welkin/Visual Studio Code C++/main.out' --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (155) LaunchOptions WorkingDirectory='/Users/welkin/Visual Studio Code C++'\n"},"seq":6} 1: (155) LaunchOptions WorkingDirectory='/Users/welkin/Visual Studio Code C++' --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (155) LaunchOptions ExeArguments=''\n"},"seq":8} 1: (155) LaunchOptions ExeArguments='' --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (155) LaunchOptions MIMode='lldb'\n"},"seq":10} 1: (155) LaunchOptions MIMode='lldb' --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (156) LaunchOptions MIDebuggerPath='/Users/welkin/.vscode/extensions/ms-vscode.cpptools-0.26.3-insiders2/debugAdapters/lldb/bin/lldb-mi'\n"},"seq":12} 1: (156) LaunchOptions MIDebuggerPath='/Users/welkin/.vscode/extensions/ms-vscode.cpptools-0.26.3-insiders2/debugAdapters/lldb/bin/lldb-mi' --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (156) LaunchOptions WaitDynamicLibLoad='false'\n"},"seq":14} 1: (156) LaunchOptions WaitDynamicLibLoad='false' --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (156) LaunchOptions ExternalConsole='true'\n"},"seq":16} 1: (156) LaunchOptions ExternalConsole='true' --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (156) LaunchOptions>\n"},"seq":18} 1: (156) LaunchOptions> --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (156) LaunchOptions\n"},"seq":20} 1: (156) LaunchOptions --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (245) Starting: \"/Users/welkin/.vscode/extensions/ms-vscode.cpptools-0.26.3-insiders2/debugAdapters/lldb/bin/lldb-mi\" --interpreter=mi\n"},"seq":22} 1: (245) Starting: "/Users/welkin/.vscode/extensions/ms-vscode.cpptools-0.26.3-insiders2/debugAdapters/lldb/bin/lldb-mi" --interpreter=mi --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (268) DebuggerPid=56698\n"},"seq":24} 1: (268) DebuggerPid=56698 --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (426) ->(gdb)\n"},"seq":26} 1: (426) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (440) <-1001-gdb-set auto-solib-add on\n"},"seq":28} 1: (440) <-1001-gdb-set auto-solib-add on --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (441) ->1001^done\n"},"seq":30} 1: (441) ->1001^done --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (442) ->(gdb)\n"},"seq":32} 1: (442) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (443) 1001: elapsed time 3\n"},"seq":34} 1: (443) 1001: elapsed time 3 --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (444) <-1002-gdb-set solib-search-path \"/Users/welkin/Visual Studio Code C++:\"\n"},"seq":36} 1: (444) <-1002-gdb-set solib-search-path "/Users/welkin/Visual Studio Code C++:" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (445) ->1002^done\n"},"seq":38} 1: (445) ->1002^done --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (445) 1002: elapsed time 1\n"},"seq":40} 1: (445) 1002: elapsed time 1 --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (445) ->(gdb)\n"},"seq":42} 1: (445) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (445) <-1003-environment-cd \"/Users/welkin/Visual Studio Code C++\"\n"},"seq":44} 1: (445) <-1003-environment-cd "/Users/welkin/Visual Studio Code C++" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (446) ->1003^done,path=\"/Users/welkin/Visual Studio Code C++\"\n"},"seq":46} 1: (446) ->1003^done,path="/Users/welkin/Visual Studio Code C++" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (446) ->(gdb)\n"},"seq":48} 1: (446) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (449) 1003: elapsed time 3\n"},"seq":50} 1: (449) 1003: elapsed time 3 --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (449) <-1004-gdb-set new-console on\n"},"seq":52} 1: (449) <-1004-gdb-set new-console on --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (450) ->1004^done\n"},"seq":54} 1: (450) ->1004^done --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (450) ->(gdb)\n"},"seq":56} 1: (450) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (450) 1004: elapsed time 0\n"},"seq":58} 1: (450) 1004: elapsed time 0 --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (450) <-1005-file-exec-and-symbols \"/Users/welkin/Visual Studio Code C++/main.out\"\n"},"seq":60} 1: (450) <-1005-file-exec-and-symbols "/Users/welkin/Visual Studio Code C++/main.out" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (575) ->1005^done\n"},"seq":62} 1: (575) ->1005^done --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (575) ->(gdb)\n"},"seq":64} 1: (575) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (575) 1005: elapsed time 125\n"},"seq":66} 1: (575) 1005: elapsed time 125 --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (577) ->=library-loaded,id=\"/Users/welkin/Visual Studio Code C++/main.out\",target-name=\"/Users/welkin/Visual Studio Code C++/main.out\",host-name=\"/Users/welkin/Visual Studio Code C++/main.out\",symbols-loaded=\"1\",symbols-path=\"/System/Volumes/Data/Users/welkin/Visual Studio Code C++/main.out.dSYM/Contents/Resources/DWARF/main.out\",loaded_addr=\"-\",size=\"12288\"\n"},"seq":68} 1: (577) ->=library-loaded,id="/Users/welkin/Visual Studio Code C++/main.out",target-name="/Users/welkin/Visual Studio Code C++/main.out",host-name="/Users/welkin/Visual Studio Code C++/main.out",symbols-loaded="1",symbols-path="/System/Volumes/Data/Users/welkin/Visual Studio Code C++/main.out.dSYM/Contents/Resources/DWARF/main.out",loaded_addr="-",size="12288" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (577) <-1006-interpreter-exec console \"platform status\"\n"},"seq":70} 1: (577) <-1006-interpreter-exec console "platform status" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (578) -> Platform: host\n"},"seq":72} 1: (578) -> Platform: host --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (578) -> Triple: x86_64h-apple-macosx\n"},"seq":74} 1: (578) -> Triple: x86_64h-apple-macosx --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (579) ->OS Version: 10.15.2 (19C57)\n"},"seq":76} 1: (579) ->OS Version: 10.15.2 (19C57) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (579) -> Kernel: Darwin Kernel Version 19.2.0: Sat Nov 9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64\n"},"seq":78} 1: (579) -> Kernel: Darwin Kernel Version 19.2.0: Sat Nov 9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64 --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (579) -> Hostname: 127.0.0.1\n"},"seq":80} 1: (579) -> Hostname: 127.0.0.1 --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (579) ->WorkingDir: /Users/welkin/Visual Studio Code C++\n"},"seq":82} 1: (579) ->WorkingDir: /Users/welkin/Visual Studio Code C++ --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (579) ->1006^done\n"},"seq":84} 1: (579) ->1006^done --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (580) ->(gdb)\n"},"seq":86} 1: (580) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (581) 1006: elapsed time 3\n"},"seq":88} 1: (581) 1006: elapsed time 3 --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (582) <-1007-break-insert -f on main\n"},"seq":90} 1: (582) <-1007-break-insert -f on main --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (585) ->1007^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x00000001000007b7\",func=\"main\",file=\"main.cpp\",fullname=\"/Users/welkin/Visual Studio Code C++/main.cpp\",line=\"9\",pending=[\"main\"],times=\"0\",original-location=\"main\"}\n"},"seq":92} 1: (585) ->1007^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00000001000007b7",func="main",file="main.cpp",fullname="/Users/welkin/Visual Studio Code C++/main.cpp",line="9",pending=["main"],times="0",original-location="main"} --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (585) ->(gdb)\n"},"seq":94} 1: (585) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (586) ->=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x00000001000007b7\",func=\"main\",file=\"main.cpp\",fullname=\"/Users/welkin/Visual Studio Code C++/main.cpp\",line=\"9\",pending=[\"main\"],times=\"0\",original-location=\"main\"}\n"},"seq":96} 1: (586) ->=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00000001000007b7",func="main",file="main.cpp",fullname="/Users/welkin/Visual Studio Code C++/main.cpp",line="9",pending=["main"],times="0",original-location="main"} --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (586) ->(gdb)\n"},"seq":98} 1: (586) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (588) 1007: elapsed time 5\n"},"seq":100} 1: (588) 1007: elapsed time 5 --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (596) Send Event AD7EngineCreateEvent\n"},"seq":102} 1: (596) Send Event AD7EngineCreateEvent --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (599) Send Event AD7ProgramCreateEvent\n"},"seq":104} 1: (599) Send Event AD7ProgramCreateEvent --> E (output): {"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/Launch","data":{"VS.Diagnostics.Debugger.ImplementationName":"Microsoft.MIDebugEngine","VS.Diagnostics.Debugger.EngineVersion":"14.0.61023.1","VS.Diagnostics.Debugger.HostVersion":"14.0.61023.1","VS.Diagnostics.Debugger.AdapterId":"cppdbg","VS.Diagnostics.Debugger.Launch.Duration":510,"VS.Diagnostics.Debugger.Launch.IsCoreDump":false,"VS.Diagnostics.Debugger.VisualizerFileUsed":false,"VS.Diagnostics.Debugger.SourceFileMappings":0,"VS.Diagnostics.Debugger.MIMode":null}},"seq":106} --> R (launch-2): {"type":"response","request_seq":2,"success":true,"command":"launch","body":{},"seq":108} --> E (initialized): {"type":"event","event":"initialized","body":{},"seq":110} <-- C (setBreakpoints-3): {"command":"setBreakpoints","arguments":{"source":{"name":"main.cpp","path":"/Users/welkin/Visual Studio Code C++/main.cpp"},"lines":[9],"breakpoints":[{"line":9}],"sourceModified":false},"type":"request","seq":3} --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (643) <-1008-break-insert -f on main.cpp:9\n"},"seq":113} 1: (643) <-1008-break-insert -f on main.cpp:9 --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (644) ->1008^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x00000001000007b7\",func=\"main\",file=\"main.cpp\",fullname=\"/Users/welkin/Visual Studio Code C++/main.cpp\",line=\"9\",pending=[\"main.cpp:9\"],times=\"0\",original-location=\"main.cpp:9\"}\n"},"seq":115} 1: (644) ->1008^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x00000001000007b7",func="main",file="main.cpp",fullname="/Users/welkin/Visual Studio Code C++/main.cpp",line="9",pending=["main.cpp:9"],times="0",original-location="main.cpp:9"} --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (644) ->(gdb)\n"},"seq":117} 1: (644) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (645) ->=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x00000001000007b7\",func=\"main\",file=\"main.cpp\",fullname=\"/Users/welkin/Visual Studio Code C++/main.cpp\",line=\"9\",pending=[\"main.cpp:9\"],times=\"0\",original-location=\"main.cpp:9\"}\n"},"seq":119} 1: (645) ->=breakpoint-modified,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x00000001000007b7",func="main",file="main.cpp",fullname="/Users/welkin/Visual Studio Code C++/main.cpp",line="9",pending=["main.cpp:9"],times="0",original-location="main.cpp:9"} --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (645) ->(gdb)\n"},"seq":121} 1: (645) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (645) 1008: elapsed time 1\n"},"seq":123} 1: (645) 1008: elapsed time 1 --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (655) Send Event AD7BreakpointBoundEvent\n"},"seq":125} 1: (655) Send Event AD7BreakpointBoundEvent --> R (setBreakpoints-3): {"type":"response","request_seq":3,"success":true,"command":"setBreakpoints","body":{"breakpoints":[{"id":1,"verified":true,"line":9}]},"seq":127} --> E (breakpoint): {"type":"event","event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":1,"verified":true,"line":9}},"seq":129} <-- C (setFunctionBreakpoints-4): {"command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":4} --> R (setFunctionBreakpoints-4): {"type":"response","request_seq":4,"success":true,"command":"setFunctionBreakpoints","body":{"breakpoints":[]},"seq":132} <-- C (setExceptionBreakpoints-5): {"command":"setExceptionBreakpoints","arguments":{"filters":[]},"type":"request","seq":5} --> R (setExceptionBreakpoints-5): {"type":"response","request_seq":5,"success":true,"command":"setExceptionBreakpoints","body":{},"seq":135} <-- C (configurationDone-6): {"command":"configurationDone","type":"request","seq":6} --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (742) Send Event AD7LoadCompleteEvent\n"},"seq":139} 1: (742) Send Event AD7LoadCompleteEvent --> R (configurationDone-6): {"type":"response","request_seq":6,"success":true,"command":"configurationDone","body":{},"seq":138} --> E (output): {"type":"event","event":"output","body":{"category":"stdout","output":"Warning: Debuggee TargetArchitecture not detected, assuming x86_64.\n"},"seq":142} Warning: Debuggee TargetArchitecture not detected, assuming x86_64. <-- C (threads-7): {"command":"threads","type":"request","seq":7} --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (746) <-1009-exec-run\n"},"seq":145} 1: (746) <-1009-exec-run --> R (threads-7): {"type":"response","request_seq":7,"success":true,"command":"threads","body":{"threads":[]},"seq":147} --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1483) ->1009^running\n"},"seq":149} 1: (1483) ->1009^running --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1483) ->=thread-group-started,id=\"i1\",pid=\"56703\"\n"},"seq":151} 1: (1483) ->=thread-group-started,id="i1",pid="56703" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1483) ->(gdb)\n"},"seq":153} 1: (1483) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1483) 1009: elapsed time 737\n"},"seq":155} 1: (1483) 1009: elapsed time 737 --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1483) ->=thread-created,id=\"1\",group-id=\"i1\"\n"},"seq":157} 1: (1483) ->=thread-created,id="1",group-id="i1" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1483) ->=thread-selected,id=\"1\"\n"},"seq":159} 1: (1483) ->=thread-selected,id="1" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1483) ->(gdb)\n"},"seq":161} 1: (1483) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1484) ->*running,thread-id=\"all\"\n"},"seq":163} 1: (1484) ->*running,thread-id="all" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1484) ->(gdb)\n"},"seq":165} 1: (1484) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1485) ->(gdb)\n"},"seq":167} 1: (1485) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1486) ->=thread-exited,id=\"1\",group-id=\"i1\"\n"},"seq":169} 1: (1486) ->=thread-exited,id="1",group-id="i1" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1486) ->=thread-group-exited,id=\"i1\",exit-code=\"0\"\n"},"seq":171} 1: (1486) ->=thread-group-exited,id="i1",exit-code="0" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1486) ->*stopped,reason=\"exited-normally\"\n"},"seq":173} 1: (1486) ->*stopped,reason="exited-normally" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1486) ->(gdb)\n"},"seq":175} 1: (1486) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1487) <-1010-thread-info 1\n"},"seq":177} 1: (1487) <-1010-thread-info 1 --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1488) ->1010^done,threads=[{id=\"1\",target-id=\"Thread 1\",frame={level=\"0\",addr=\"0xffffffffffffffff\",func=\"??\",args=[],file=\"??\",fullname=\"??\",line=\"0\"},state=\"running\"}]\n"},"seq":179} 1: (1488) ->1010^done,threads=[{id="1",target-id="Thread 1",frame={level="0",addr="0xffffffffffffffff",func="??",args=[],file="??",fullname="??",line="0"},state="running"}] --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1488) ->(gdb)\n"},"seq":181} 1: (1488) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"stdout","output":"=thread-selected,id=\"1\"\n"},"seq":183} =thread-selected,id="1" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1493) 1010: elapsed time 5\n"},"seq":185} 1: (1493) 1010: elapsed time 5 --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1495) Send Event AD7ProcessInfoUpdatedEvent\n"},"seq":187} 1: (1495) Send Event AD7ProcessInfoUpdatedEvent --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1495) Send Event AD7ThreadCreateEvent\n"},"seq":189} 1: (1495) Send Event AD7ThreadCreateEvent --> E (thread): {"type":"event","event":"thread","body":{"reason":"started","threadId":1},"seq":191} --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1502) <--gdb-exit\n"},"seq":193} 1: (1502) <--gdb-exit --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1503) ->^exit\n"},"seq":195} 1: (1503) ->^exit --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1503) ->=thread-group-exited,id=\"i1\"\n"},"seq":197} 1: (1503) ->=thread-group-exited,id="i1" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1503) ->(gdb)\n"},"seq":199} 1: (1503) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1504) ->\n"},"seq":201} 1: (1504) -> --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1504) ->\n"},"seq":203} 1: (1504) -> --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1508) <-logout\n"},"seq":205} 1: (1508) <-logout --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1514) Send Event AD7ProgramDestroyEvent\n"},"seq":207} 1: (1514) Send Event AD7ProgramDestroyEvent --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"The program '/Users/welkin/Visual Studio Code C++/main.out' has exited with code 0 (0x00000000).\r\n\n"},"seq":209} The program '/Users/welkin/Visual Studio Code C++/main.out' has exited with code 0 (0x00000000). --> E (exited): {"type":"event","event":"exited","body":{"exitCode":0},"seq":211} --> E (terminated): {"type":"event","event":"terminated","body":{},"seq":213} --> E (output): {"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/DebugCompleted","data":{"VS.Diagnostics.Debugger.ImplementationName":"Microsoft.MIDebugEngine","VS.Diagnostics.Debugger.EngineVersion":"14.0.61023.1","VS.Diagnostics.Debugger.HostVersion":"14.0.61023.1","VS.Diagnostics.Debugger.AdapterId":"cppdbg","VS.Diagnostics.Debugger.DebugCompleted.BreakCounter":0}},"seq":215} <-- C (disconnect-8): {"command":"disconnect","arguments":{"restart":false},"type":"request","seq":8} --> R (disconnect-8): {"type":"response","request_seq":8,"success":true,"command":"disconnect","body":{},"seq":218} ```
puremourning commented 4 years ago

So I spent some time trying to actually fix this. Here's some background:

So, I believe that this issue can be fixed by doing all of the following:

Unfortunately, that requires the first 2 to happen before users can actually trigger breakpoints on macOS again.

@WardenGnaw if there is anything I can do to help make that happen, let me know.

benbenji commented 4 years ago

So I spent some time trying to actually fix this. Here's some background:

  • the version of lldb-mi bundled with the macOS version of vscode-cpptools no longer works. Breakpoints don't trigger. This was identified at the beginning of this thread.
  • since then, lldb-mi has been removed from lldb source tree and moved to its own repository, but is still actively developed and maintained.
  • I have proven that the latest builds of lldb-mi do work and do trigger breakpoints.
  • however, they do not work with vscode-cpptools because of a no-longer-required workaround in MIEngine. A historical bug in lldb-mi has been fixed, but that has broken MIEngine's -break-insert command sent to lldb-mi: microsoft/MIEngine#946

So, I believe that this issue can be fixed by doing all of the following:

  • changing MIEngine to remove the workaround for lldb-mi having incorrect break-insert processing: microsoft/MIEngine#946
  • taking a fixed MIEngine into vscode-cpptools and bundling it up for macOS
  • setting miDebuggerPath to point at a build of the latest lldb-mi code, or ideally including a build of the latest lldb-mi (https://github.com/lldb-tools/lldb-mi) in the macOS version of vscode-cpptools.

Unfortunately, that requires the first 2 to happen before users can actually trigger breakpoints on macOS again.

@WardenGnaw if there is anything I can do to help make that happen, let me know.

man. you means that if we want to use lldb-mi again. we should wait they taking a fixed MIEngine into vscode-cpptools?

puremourning commented 4 years ago

man. you means that if we want to use lldb-mi again. we should wait they taking a fixed MIEngine into vscode-cpptools?

Unless you can make the patch to MIEngine and build it yourself. I can't because it only builds on Windows.

I'm like N% certain that removing these lines will fix it.

Edit: Looks like @WardenGnaw committed that exact change :)

benbenji commented 4 years ago

these lines

Thank you man, Are they going to solve the problem next or not? I see that line you remove,It is really handsome!

puremourning commented 4 years ago

You can track this: https://github.com/microsoft/MIEngine/issues/946

tsangint commented 4 years ago

Same problem. MacOS: 10.15.1 VSCode: 1.41.1

mtuba commented 4 years ago

Same problem MacOS: 10.15.2 Vscode: 1.41.1 Tutorial: https://code.visualstudio.com/docs/cpp/config-clang-mac

nigelterry commented 4 years ago

Same problem MacOS: 10.15.2 Vscode: 1.41.1

puremourning commented 4 years ago

Adding ‘same problem’ isn’t moving the needle on resolving this. The upstream change in MIEngine has been merged. Hopefully that means soon it will be possible to make this work with a custom built lldb-mi

a4z commented 4 years ago

Adding ‘same problem’ isn’t moving the needle on resolving this. The upstream change in MIEngine has been merged. Hopefully that means soon it will be possible to make this work with a custom built lldb-mi

given how old the problem is, it can not harm to show, and report, that many people have this problem, so IMHO even repetitions are a valid point to report.

but lets hope that after several month we will soon be able to use the debugger again, and users will not wast a lot of time to land here, and report this problem again ;-)

p-i- commented 4 years ago

In this case surely the best response would be to simply upvote the original issue. Given that the problem has been tracked down, providing OS/VSCode versions won't help anyone. Adding comments to the thread disturbs everyone subscribed to the thread. In the case of a problem that is not being actively worked on, the community SHOULD disturb the repo, until someone fixes it. We can externally push priority levels on issues by making noise. However on this particular issue, as can be seen from the comments, @puremourning is in the process of crushing this one with @WardenGnaw . So I recommend we STFU and let them work their magick ;)

p-i- commented 4 years ago

It would be great if repository maintainers were able to edit the original post for a particular issue, maintaining a "current-state/issue-summary/roadmap" so that newcomers can immediately see the state of play without having to piece it together from dozens of comments.

I guess with a very thorough workflow, repo maintenance staff could respond to the OP immediately and keep revising this initial response, so that it is always up-to-date. I wonder if anyone has thought of using GitHub issue-tracker this way...

DavidLudwig commented 4 years ago

@a4z One problem with having people continually report, "same here", type messages is that users (myself included) who are monitoring this bug to await a fix will get e-mailed every time someone posts a message. This does not happen if someone merely upvotes it.

n4ll3ec commented 4 years ago

same issue +1 macOS: 10.15.2 VS Code: 1.41.1 C/C++ version: 0.26.3-insiders3: January 8, 2020

tachyon83 commented 4 years ago

I went through the same problem. My cpp code debugging started having problem right after I upgraded my macOS from Mojave to Catalina. I had a similar problem whenever I did the OS update. Sometimes I could fix the problem by reinstalling Xcode.

After a few hours of struggling, I finally got here. I thought maybe upgrading Xcode could get this working. But as mentioned above, it looks like upgrading Xcode is really not a good idea. Maybe better keep it as 10.3 ?

Anyways, thank you very much for introducing CodeLLDB. I never knew about CodeLLDB. and it works perfectly. thank you again!

tachyon83 commented 4 years ago

Ping. Just wanted to mention that the problem persists with the latest Catalina Beta and Xcode11 "Gold Master" version, both pretty late in their release cycle, so I think that's not something that will be fixed on Apple's part.

Also the CodeLLDB extension doesn't have the problem.

Thank you very much for letting me know about CodeLLDB

zmer007 commented 4 years ago

I installed CodeLLDB and change launch.json as follow, then it works.

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "lldb",
            "request": "launch",
            "program": "${workspaceFolder}/helloworld.out",
            "args": [
                "-arg1",
                "-arg2"
            ]
        }
    ]
}