bazelbuild / intellij

IntelliJ plugin for Bazel projects
https://ij.bazel.build/
Apache License 2.0
752 stars 296 forks source link

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

Open Algomorph opened 2 weeks ago

Algomorph commented 2 weeks ago

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

tpasternak commented 1 week ago

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