[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 14:51:30 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;
----------------
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.


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

https://reviews.llvm.org/D145180



More information about the lldb-commits mailing list