GDB "set directory" equivalence in CLion for remote debugging setup
In CLion remote debugger configuration, we have the concept of "path mappings". I want to believe these are equivalent to the gdb substitute-path, and that CLion needs to be aware of them as well to get access to those source files. [Alternatively CLion could be reading those back from gdb, but I believe this is not the case].
However, it is not clear whether "path mappings" are good for setting gdb "directories" (https://sourceware.org/gdb/onlinedocs/gdb/Source-Path.html), that is, the folder where "relative" source path specifications are looked for. Can anyone clarify if the "path mappings" in the remote debugger config window can effectively set the "directories" gdb var (source directory search paths)?
Important note: this is a Bazel based project. So setup is not _conventional_. In this situation it is *critical* for me to specify manually the source search directories because for this project my _source root_ is neither $cdir or $cwd.
The only way I have for gdb to find the source files is to "set directories" to the root folder of the Bazel project. HOWEVER, CLion does not seem to be "reading back" this change and still cannot locate the source, giving me only the disassembly view of the corresponding functions.
Please sign in to leave a comment.
Hi, Jacobo,
You're absolutely right, "path mappings" are equivalent to the gdb "substitute-path". Unfortunately, there is no way to set gdb "directories" in CLion. Feel free to create a feature request in our tracker: https://youtrack.jetbrains.com/issues/CPP. Meanwhile you can set "directories" in
.gdbinit. By default the gdb in CLion uses default~/.gdbinitso specifying it there should be enough.Hi Anna,
Thanks for pointing out that CLion launched gdb will respect the "directories" commands set in .gdbinit and that CLion will be able to locate source based on that. Have tested it with a remote dbg config and seems to be working fine.
I'l be probably opening as well a feature request.