[Lldb-commits] [PATCH] D65435: SymbolVendor: Introduce Module::GetSymbolFile

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 31 08:15:36 PDT 2019

labath added a comment.

In D65435#1608276 <https://reviews.llvm.org/D65435#1608276>, @clayborg wrote:

> Alternatively we can switch to using a reference for:
>   SymbolFile &Module::GetSymbolFile(bool can_create Stream *feedback_strm);
> As I believe we always fall back to SymbolFileSymtab don't we?

That is mostly true, but not 100% true in all circumstances. If we manage to create an object file for the module, then yes, I believe we should also always be able to construct a symbol file. However, we currently can run into situations where we fail to create an object file for a module (because the constructor does not check that). Instead what people usually do is that after constructing a module object, they call GetObjectFile() to check whether the module is really valid.

One of my ideas for the future is to change how modules are constructed, so that once we get a module object, we can assume that it will always contain a valid ObjectFile. At that point we would be able to assume the existence of SymbolFile. Until then, I can add the null checks you requested, though I don't think they can be really triggered now as those objectfile-less modules should not end up in the module list of a target.



More information about the lldb-commits mailing list