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

Clion: GDB cannot find C++ sources in cache / external #6498

Open
Algomorph opened this issue Jun 21, 2024 · 3 comments
Open

Clion: GDB cannot find C++ sources in cache / external #6498

Algomorph opened this issue Jun 21, 2024 · 3 comments
Assignees
Labels
awaiting-maintainer Awaiting review from Bazel team on issues lang: c++ C++ rules integration product: CLion CLion plugin type: bug

Comments

@Algomorph
Copy link

Algomorph commented Jun 21, 2024

Description of the bug:

The debugger (at least GDB) is not configured to discern sources from external dependencies.

In order to debug through (and hit breakpoints in) sources from external project dependencies, the workaround is to run the (equivalent of) the following command in GDB:

set substitute-path external /home/greg/.cache/bazel/_bazel_greg/217399706ea15206fcdc8f34c121835f/external

However, this has to be done on every run, upon hitting a breakpoint in the current project sources.

image

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

This is relevant for at least projects using the old WORKSPACE dependency structure (not bzlmod).

Simplest way to reproduce is to load a Bazel project with C++ sources & external dependencies, e.g. mediapipe, and try to debug the sources of the dependencies, i.e. something inside cache's external folder.

Which Intellij IDE are you using? Please provide the specific version.

CLion 2024.1.1 Build #CL-241.15989.121

What programming languages and tools are you using? Please provide specific versions.

C++17,
GCC: 11.4.0
Bundled GDB 14.1 (I'm hoping Bazel's using the bundled version, the system version is 12.1)

What Bazel plugin version are you using?

2024.06.04.0.2-api-version-241

Any other information, logs, or outputs that you want to share?

CLion 2024.1.1
Build #CL-241.15989.121, built on April 25, 2024
Licensed to Presage Security, Inc / Gregory Kramida
Subscription is active until November 19, 2024.
Runtime version: 17.0.10+1-b1207.14 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.5.0-41-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 8192M
Cores: 32
Registry:
actionSystem.update.actions.warn.dataRules.on.edt=false
debugger.attach.dialog.enabled=true
run.processes.with.pty=TRUE
ide.experimental.ui=true
ide.slow.operations.assertion=false
terminal.new.ui=true
Non-Bundled Plugins:
idea.plugin.protoeditor (241.15989.49)
org.turbanov.run.configuration.as.action (3.0)
com.codeium.intellij (1.8.66)
dev.meanmail.plugin.nginx-intellij-plugin (2024.3)
A move tab left and right using the keyboard plugin - by momomo.com (12.550)
com.mikejhill.intellij.movetab (2.1.1)
ru.adelf.idea.dotenv (2024.1)
kemoke.net.cssmodule (1.1)
com.haulmont.rcb (241.14494.140)
com.google.idea.bazel.clwb (2024.06.04.0.2-api-version-241)
Current Desktop: ubuntu:GNOME

@Algomorph Algomorph added awaiting-maintainer Awaiting review from Bazel team on issues type: bug labels Jun 21, 2024
@iancha1992 iancha1992 added lang: c++ C++ rules integration product: CLion CLion plugin labels Jun 21, 2024
@tpasternak
Copy link
Contributor

Hey @Algomorph could you please share a minimal-reproducible example of that?

@Algomorph
Copy link
Author

@tpasternak I don't have a minimal-reproducible example of that. Were you able to replicate using MediaPipe 0.10.11 or later? Perhaps you can work that down to an MRE, I doubt I will have time in the forseable future.

An even better work-around at the moment is to use .gdbinit file (e.g. in $HOME directory on your Linux system) to set the substitute path right away on every GDB run, i.e. make that file and put one line in:

set substitute-path external /home/greg/.cache/bazel/_bazel_greg/217399706ea15206fcdc8f34c121835f/external

The obvious drawback is that this would need to change for different bazel cache directories / projects.

@tpasternak
Copy link
Contributor

partially related to this #6922

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-maintainer Awaiting review from Bazel team on issues lang: c++ C++ rules integration product: CLion CLion plugin type: bug
Projects
None yet
Development

No branches or pull requests

8 participants