[Lldb-commits] [PATCH] D97786: LLDB: Use path relative to binary, not relative to debugger CWD, for finding .dwo files.

Philip Pfaffe via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 30 06:04:15 PDT 2021

pfaffe added a comment.

This change breaks all existing uses of relative comp_dirs that don't accidentally make all of them relative to the executable's directory already.

It's easy to construct broken use cases: Consider compiling your program like `clang -g ./src/src.c -gsplit-dwarf -o ./out/src -fdebug-prefix-map=$(pwd)=.`. This will create `src.dwo` in $(pwd) and set the DW_AT_comp_dir of `src` to ".";  the change makes it impossible to load `src.dwo`.

The problem is easy to see in this slightly constructed example and could be fixed here by moving around the dwo files or setting the prefix to '..' to make it point to the executable. But that's not always possible! What if we have a static library that gets linked into multiple executables in different locations? What do we set comp_dir to in the library objects?

The change also introduces different behavior for loading dwos vs. source files. The latter will still be loaded relative to the CWD.

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list