[all-commits] [llvm/llvm-project] ae6837: [lldb][NFC] Change ObjectFile's DataExtractor to a...

Jason Molenda via All-commits all-commits at lists.llvm.org
Mon Dec 1 14:38:16 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ae68377c69db15d1d567368b2321455d31f41b69
      https://github.com/llvm/llvm-project/commit/ae68377c69db15d1d567368b2321455d31f41b69
  Author: Jason Molenda <jmolenda at apple.com>
  Date:   2025-12-01 (Mon, 01 Dec 2025)

  Changed paths:
    M lldb/include/lldb/Symbol/ObjectFile.h
    M lldb/include/lldb/lldb-forward.h
    M lldb/source/Expression/ObjectFileJIT.cpp
    M lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
    M lldb/source/Plugins/ObjectFile/COFF/ObjectFileCOFF.cpp
    M lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    M lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    M lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
    M lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp
    M lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
    M lldb/source/Symbol/ObjectFile.cpp

  Log Message:
  -----------
  [lldb][NFC] Change ObjectFile's DataExtractor to a shared ptr (#170066)

ObjectFile has an m_data DataExtractor ivar which may be default
constructed initially, or initialized with a DataBuffer passed in to its
ctor. If the DataExtractor does not get a DataBuffer source passed in,
the subclass will initialize it with access to the object file's data.
When a DataBuffer is passed in to the base class ctor, the DataExtractor
only has its buffer initialized; ObjectFile doesn't yet know the address
size and endianness to fully initialize the DataExtractor.

This patch changes ObjectFile to instead have a DataExtractorSP ivar
which is always initialized with at least a default-constructed
DataExtractor object in the base class ctor. The next patch I will be
writing is to change the ObjectFile ctor to take an optional
DataExtractorSP, so the caller can pass a DataExtractor subclass -- the
VirtualizeDataExtractor being added via
https://github.com/llvm/llvm-project/pull/168802
instead of a DataBuffer which is trivially saved into the DataExtractor.

The change is otherwise mechanical; all `m_data.` changed to
`m_data_sp->` and all the places where `m_data` was passed in for a
by-ref call were changed to `*m_data_sp.get()`. The shared pointer is
always initialized to contain an object.

I built & ran the testsuite on macOS and on aarch64-Ubuntu (thanks for
getting the Linux testsuite to run on SME-only systems David). All of
the ObjectFile subclasses I modifed compile cleanly, but I haven't
tested them beyond any unit tests they may have (prob breakpad).

rdar://148939795



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list