[Lldb-commits] [PATCH] D153913: [lldb][NFC] Prevent slicing when converting DataExtractors

Felipe de Azevedo Piovezan via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 27 13:18:36 PDT 2023


fdeazeve created this revision.
Herald added a subscriber: arphaman.
Herald added a project: All.
fdeazeve requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

LLDB's implementation of DWARFDataExtractor has a method that returns a
llvm::DWARFDataExtractor. In some cases, like DebugNamesDWARFIndex::Create, we
were passing an LLVM::DWARFDataExtractor to a function that expects a
LLVM:DataExtractor by value. This is causing slicing of the derived class.

While slicing is not inherently bad, it can be dangerous if the constructor of
the derived class mutates the base class in a way that leaves it in an invalid
state after slicing.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153913

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153913.535107.patch
Type: text/x-patch
Size: 6159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230627/76254a0a/attachment.bin>


More information about the lldb-commits mailing list