[Lldb-commits] [PATCH] D70848: [LLDB] Set the right address size on output DataExtractors from ObjectFile

Martin Storsjö via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 2 23:38:58 PST 2019


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


================
Comment at: lldb/source/Symbol/ObjectFile.cpp:480-486
+  size_t ret = data.SetData(m_data, offset, length);
+  // DataExtractor::SetData copies the address byte size from m_data, but
+  // m_data's address byte size is only set from sizeof(void*), and we can't
+  // access subclasses GetAddressByteSize() when setting up m_data in the
+  // constructor.
+  data.SetAddressByteSize(GetAddressByteSize());
+  return ret;
----------------
clayborg wrote:
> I would vote to make this happen within DataExtractor::SetData(const DataExtractor &...)
Do you mean that we'd extend `DataExtractor::SetData(const DataExtractor &...)` to take a byte address size parameter, or that we'd update `m_data`'s byte address size before doing `data.SetData()` here?

Ideally I'd set the right byte address size in `m_data` as soon as it is known and available. It's not possible to do this in `ObjectFile`'s constructor, as that is called before the subclass is constructed and its virtual methods are available, but is there a better point in the lifetime where we could update it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70848





More information about the lldb-commits mailing list