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

Unable to find GDB in default search path and /usr/local/bin/lldb-9 #1060

Closed
sochooligan opened this issue Feb 11, 2020 · 12 comments
Closed
Labels
bug a bug in the product Feature: debug/launch fixed (release pending) fixed in pre-release and is pending official release
Milestone

Comments

@sochooligan
Copy link

sochooligan commented Feb 11, 2020

When I use CMake Tools's Debug It says "Unable to find GDB in default search path and /usr/local/bin/lldb-9."
I don't know where to set gdb path for the CMake Tools Plugin. I think this is an issue.

My Env:

macos: 10.15.3
Xcode: 11.3.1
/usr/local/opt/llvm/bin/lldb -v: 9.0.0
cmake: 3.15.3
make:4.3
gdb: 8.3
g++: 9.2.0_3
vs code: 1.42.0
cmake tools: 1.3.0

When I add in settings.json:
"cmake.debugConfig": {
"MIMode": "gdb",
"miDebuggerPath": "/usr/local/bin/gdb",
}
it does not take effect.

@andreeis
Copy link
Contributor

On Windows and Ubuntu I am not able to get any "cmake.debugConfig" settings to be ignored. I will try on MAC shortly, although I don't think something may reproduce only because of this.
I wonder what else is specific to your situation.
You tried CMake Tools 1.3.0, right?

@andreeis andreeis added the more info needed More info is needed from the community for us to properly triage and investigate. label Feb 12, 2020
@sochooligan
Copy link
Author

sochooligan commented Feb 12, 2020

On Windows and Ubuntu I am not able to get any "cmake.debugConfig" settings to be ignored. I will try on MAC shortly, although I don't think something may reproduce only because of this.
I wonder what else is specific to your situation.
You tried CMake Tools 1.3.0, right?

Reply:

  1. The Output When I pushed CMake Tool's Debug button located on the middle bottom of Vs Code:

[build] Starting build
[proc] Executing command: /usr/local/bin/cmake --build /Users/jzwang/Documents/localrepos/codes/CppCmakeGettingStarted/build --config Debug --target CppCmakeGettingStarted -- -j 6
[build] make[1]: Entering directory '/Users/Documents/localrepos/codes/CppCmakeGettingStarted/build'
[build] make[2]: Entering directory '/Users/Documents/localrepos/codes/CppCmakeGettingStarted/build'
[build] make[3]: Entering directory '/Users/Documents/localrepos/codes/CppCmakeGettingStarted/build'
[build] make[3]: Leaving directory '/Users/Documents/localrepos/codes/CppCmakeGettingStarted/build'
[build] [100%] Built target CppCmakeGettingStarted
[build] make[2]: Leaving directory '/Users/Documents/localrepos/codes/CppCmakeGettingStarted/build'
[build] make[1]: Leaving directory '/Users/Documents/localrepos/codes/CppCmakeGettingStarted/build'
[build] Build finished with exit code 0
[proc] Executing command: /usr/local/bin/lldb-9 --version

I don't know what the last message means. I have no "/usr/local/bin/lldb-9".

  1. I installed only two plugs which is C/C++ 0.2.6.3 and CMake Tools 1.3.0. I just test a simple CMakeLists.txt of a practice C++ project. I have /usr/local/bin/gdb, /usr/bin/lldb on my macos.

  1. I tried CMake Tools 1.3.0, 1.1.3.

@sochooligan
Copy link
Author

sochooligan commented Feb 13, 2020

Finally, I find the lldb path in macOS is: /usr/local/opt/llvm/bin.

(1) create a soft link: lldb-9 -> /usr/local/opt/llvm/bin/lldb
(2) set cmake.debugConfig as #506 @FelikZ

Now, I can use CMake Tools's Debug, but it can't break as known.(https://stackoverflow.com/questions/58329611/vscode-macos-catalina-doesnt-stop-on-breakpoints-on-c-c-debug)

@sochooligan
Copy link
Author

sochooligan commented Feb 13, 2020

Make CMake Tools Debug BREAKSTOP Success on Xcode 11.3.1!!!

Question:

We have lldb under /Applications/Xcode.app/Contents/Developer/usr/bin/, but we don't have lldb-mi.

Solution:

Compile lldb-mi for Xcode 11.3.1

Steps:

(1) sudo vim /etc/paths
/usr/local/Cellar/llvm/9.0.0/bin
/usr/bin
/usr/local/bin
/bin
/usr/sbin
/sbin
notes: /usr/bin before /usr/local/bin so when step(3) compile lldb-mi will use /usr/bin/clang tools)
(2) git clone https://github.com/lldb-tools/lldb-mi.git
(3) cd lldb-mi
cmake .
cmake --build .
(4) sudo cp ./src/lldb-mi /Applications/Xcode.app/Contents/Developer/usr/bin/

Set soft link(no need to set cmake.debugConfig anymore)

cd /usr/local/bin
ln -s /Applications/Xcode.app/Contents/Developer/usr/bin/lldb-mi lldb-9

Others:

Because I Use g++ under /usr/local/bin/, so after compiling, I modified /etc/paths as:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

refs:

https://forums.developer.apple.com/thread/125482
https://github.com/lldb-tools/lldb-mi

@bobbrow
Copy link
Member

bobbrow commented Feb 19, 2020

Unfortunately Apple doesn't distribute lldb-mi anymore. The cpptools extension is almost ready to start distributing a copy of it with the extension. At that point we can start pointing to that one by default.

@sochooligan
Copy link
Author

Unfortunately Apple doesn't distribute lldb-mi anymore. The cpptools extension is almost ready to start distributing a copy of it with the extension. At that point we can start pointing to that one by default.
#1060 (comment)

@bobbrow bobbrow added bug a bug in the product Feature: debug/launch and removed more info needed More info is needed from the community for us to properly triage and investigate. labels Mar 2, 2020
@bobbrow
Copy link
Member

bobbrow commented Mar 2, 2020

I believe I have a fix for this in PR #1102

@andreeis andreeis added the fixed (release pending) fixed in pre-release and is pending official release label Mar 6, 2020
@bobbrow bobbrow added this to the 1.4.0 milestone Apr 13, 2020
@andreeis
Copy link
Contributor

CMake Tools 1.4.0 Beta is available on GitHub.
https://github.com/microsoft/vscode-cmake-tools/releases/tag/1.4.0-beta

Please try it out and let us know if you encounter any issues.

@andreeis
Copy link
Contributor

This fix is available in CMake Tools #1.4.0 which has been released.

@EzioZz
Copy link

EzioZz commented Jan 1, 2021

How to configure if I need to compile the program using GCC and debug with GDB.
"cmake.debugConfig": {
"MIMode": "gdb",
"miDebuggerPath": "/usr/local/bin/gdb"
}
using the configuration above the debugger doesn't go to the breakpoint.

@andreeis
Copy link
Contributor

andreeis commented Jan 8, 2021

That should work. Double check if the source code file where you want to hit the breakpoint is compiled with debug information (-g flag). As an experiment, also add "stopAtEntry" inside cmake.debugConfig and set it to true, see if that generates any breakpoint hit at startup.

@BH1SCW
Copy link

BH1SCW commented Oct 13, 2021

Make CMake Tools Debug BREAKSTOP Success on Xcode 11.3.1!!!

Question:

We have lldb under /Applications/Xcode.app/Contents/Developer/usr/bin/, but we don't have lldb-mi.

Solution:

Compile lldb-mi for Xcode 11.3.1

Steps:

(1) sudo vim /etc/paths /usr/local/Cellar/llvm/9.0.0/bin /usr/bin /usr/local/bin /bin /usr/sbin /sbin notes: /usr/bin before /usr/local/bin so when step(3) compile lldb-mi will use /usr/bin/clang tools) (2) git clone https://github.com/lldb-tools/lldb-mi.git (3) cd lldb-mi cmake . cmake --build . (4) sudo cp ./src/lldb-mi /Applications/Xcode.app/Contents/Developer/usr/bin/

Set soft link(no need to set cmake.debugConfig anymore)

cd /usr/local/bin ln -s /Applications/Xcode.app/Contents/Developer/usr/bin/lldb-mi lldb-9

Others:

Because I Use g++ under /usr/local/bin/, so after compiling, I modified /etc/paths as: /usr/local/bin /usr/bin /bin /usr/sbin /sbin

refs:

https://forums.developer.apple.com/thread/125482 https://github.com/lldb-tools/lldb-mi

works for me , Great thanks~

@github-actions github-actions bot locked and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug a bug in the product Feature: debug/launch fixed (release pending) fixed in pre-release and is pending official release
Projects
None yet
Development

No branches or pull requests

5 participants