[Lldb-commits] [PATCH] D145180: [lldb] Introduce new SymbolFileJSON and ObjectFileJSON

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 7 15:04:28 PST 2023


JDevlieghere marked an inline comment as done.
JDevlieghere added inline comments.


================
Comment at: lldb/source/Symbol/Symbol.cpp:44-49
+  if (!section_list)
+    return;
+
+  // This should've been caught during deserialization.
+  if (!symbol.value && !symbol.address)
+    return;
----------------
JDevlieghere wrote:
> clayborg wrote:
> > We probably should make this function into a static factory function that returns a llvm::Expected<Symbol> so we can return an error if the symbol has not value or address, and if we can't resolve the address in a section:
> > ```
> > llvm::Expected<Symbol> Symbol::CreateSymbol(const JSONSymbol &symbol, SectionList *section_list);
> > ```
> > Then we can return errors for the above cases and also for below.
> Do you prefer to handle the error here or during deserialization? Currently these things are enforced there. I don't think it makes sense to check the same invariant twice. I'm happy to move it here though if you think that's better.
Oh I missed the case where the address doesn't belong to a section. Yeah we definitely need to diagnose that here. 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145180/new/

https://reviews.llvm.org/D145180



More information about the lldb-commits mailing list