[Lldb-commits] [PATCH] D73914: [lldb] [ObjectFile/ELF] Fix negated seg ids on 32-bit arches

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 3 11:39:02 PST 2020


mgorny created this revision.
mgorny added a reviewer: labath.
Herald added subscribers: MaskRay, emaste.
Herald added a reviewer: espindola.

Scale segment identifier up to user_id_t before negating it.  This fixes
the identifers being wrongly e.g. 0x00000000fffffffe instead of
0xfffffffffffffffe.  Fix suggested by Pavel Labath.

This fixes 5 tests failing on i386 (PR #44748):

  lldb-shell :: ObjectFile/ELF/PT_LOAD-overlap-PT_INTERP.yaml
  lldb-shell :: ObjectFile/ELF/PT_LOAD-overlap-PT_TLS.yaml
  lldb-shell :: ObjectFile/ELF/PT_LOAD-overlap-section.yaml
  lldb-shell :: ObjectFile/ELF/PT_LOAD.yaml
  lldb-shell :: ObjectFile/ELF/PT_TLS-overlap-PT_LOAD.yaml


https://reviews.llvm.org/D73914

Files:
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp


Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -206,7 +206,9 @@
 
 } // end anonymous namespace
 
-static user_id_t SegmentID(size_t PHdrIndex) { return ~PHdrIndex; }
+static user_id_t SegmentID(size_t PHdrIndex) {
+  return ~user_id_t(PHdrIndex);
+}
 
 bool ELFNote::Parse(const DataExtractor &data, lldb::offset_t *offset) {
   // Read all fields.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73914.242141.patch
Type: text/x-patch
Size: 548 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200203/f4f12b3e/attachment.bin>


More information about the lldb-commits mailing list