Missing module (debug symbols?) for Swift

Hello,

I am new to LLDB and don't quite understand the relationship between
llvm.org and Apple. However, I would like to fix a bug that is
preventing me from debugging some code that I compiled with Swift 4.2
on Ubuntu 18.04. Specifically, when I use the Apple/Swift LLDB with
this code and LLDB_SWIFT_DUMP_DIAGS=1 enabled I get errors that say
"<unknown>:0: error: missing required module 'Clibavahiclient'".
However, I went looking and to my novice eyes it looks like the module
(symbols?) that LLDB is looking for are on the file system.
Specifically, there is a file (Clibavahiclient-2J8WBHG3Q43SC.pcm)
which is an ELF binary with lots of DWARF symbols, including the
following:

0x00000026: DW_TAG_module
                DW_AT_name ("Clibavahiclient")
                DW_AT_LLVM_config_macros ("\"-D__swift__=40150\"")
                DW_AT_LLVM_include_path
("/work/AvahiClient/.build/checkouts/Clibavahiclient.git--4733535768090925471")
                DW_AT_LLVM_isysroot ("/")

I have posted a full write-up with source code and all the symbols here:
https://github.com/TaborKelly/AvahiClient

Am I on the right track? Does Clibavahiclient-2J8WBHG3Q43SC.pcm have
the information that LLDB is missing? If so, how would I go about
getting that knowledge to LLDB?

Thank you,

Tabor

Hello,

I am new to LLDB and don't quite understand the relationship between
llvm.org and Apple. However, I would like to fix a bug that is
preventing me from debugging some code that I compiled with Swift 4.2
on Ubuntu 18.04. Specifically, when I use the Apple/Swift LLDB with
this code and LLDB_SWIFT_DUMP_DIAGS=1 enabled I get errors that say
"<unknown>:0: error: missing required module 'Clibavahiclient'".
However, I went looking and to my novice eyes it looks like the module
(symbols?) that LLDB is looking for are on the file system.
Specifically, there is a file (Clibavahiclient-2J8WBHG3Q43SC.pcm)
which is an ELF binary with lots of DWARF symbols, including the
following:

0x00000026: DW_TAG_module
               DW_AT_name ("Clibavahiclient")
               DW_AT_LLVM_config_macros ("\"-D__swift__=40150\"")
               DW_AT_LLVM_include_path
("/work/AvahiClient/.build/checkouts/Clibavahiclient.git--4733535768090925471")
               DW_AT_LLVM_isysroot ("/")

If the code that you are debugging is in a Swift context, then this is actually not the place that LLDB looks for paths to Clang modules. Instead it will looks at the serialized search paths in the .swiftmodule. You can see what they are by running "log enable lldb types" at the beginning of your session and look at the various SwiftASTContext initializations. Also note that we've fixed a lot of search path problems in Swift 5.0, so I'd really recommend checking that out first as it may already work out of the box.

-- adrian