[llvm-dev] Disabling LLVM_ATTRIBUTE_ALWAYS_INLINE for development?

Brian Gesiak via llvm-dev llvm-dev at lists.llvm.org
Sat Dec 15 10:32:57 PST 2018


Hello all!

I find that using lldb to debug LLVM libraries can be super
frustrating, because a lot of LLVM classes, like the constructor for
StringRef, are marked LLVM_ATTRIBUTE_ALWAYS_INLINE. So when I attempt
to have lldb evaluate an expression that implicitly instantiates a
StringRef, I get 'error: Couldn't lookup symbols:
__ZN4llvm9StringRefC1EPKc'.

As an example, most recently this happened to me when playing around
with llvm::AttributeSet, having attached lldb to an opt built with
-DCMAKE_BUILD_TYPE="Debug":

   (lldb) e $AS.hasAttribute("myattr")
   error: Couldn't lookup symbols:
     __ZN4llvm9StringRefC1EPKc

Despite having built in a "Debug" configuration,
LLVM_ATTRIBUTE_ALWAYS_INLINE makes it very difficult to debug LLVM.

How do you all deal with or work around this problem? Is there a good
way to do so? If not, would anyone object if I sent up a patch to
introduce a CMake variable or something to conditionally disable
LLVM_ATTRIBUTE_ALWAYS_INLINE? I'd like to be able to turn it off, but
I'm not sure if there's some good reason it needs to stay on even for
debug builds?

- Brian Gesiak


More information about the llvm-dev mailing list