[Lldb-commits] [lldb] 918b1e7 - Revert "[lldb] add SBSection.alignment to python bindings"

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 12 03:19:15 PDT 2022


Author: Pavel Labath
Date: 2022-07-12T12:17:29+02:00
New Revision: 918b1e7bbdd7f7b0228fa2535190f52c4b54d346

URL: https://github.com/llvm/llvm-project/commit/918b1e7bbdd7f7b0228fa2535190f52c4b54d346
DIFF: https://github.com/llvm/llvm-project/commit/918b1e7bbdd7f7b0228fa2535190f52c4b54d346.diff

LOG: Revert "[lldb] add SBSection.alignment to python bindings"

The patch didn't get proper attribution. Will recommit.

This reverts commit 4135abca897d1b945193f767cbf42a200b55bbdc.

Added: 
    

Modified: 
    lldb/bindings/interface/SBSection.i
    lldb/include/lldb/API/SBSection.h
    lldb/source/API/SBSection.cpp
    lldb/test/API/python_api/section/TestSectionAPI.py

Removed: 
    lldb/test/API/python_api/section/aligned.yaml


################################################################################
diff  --git a/lldb/bindings/interface/SBSection.i b/lldb/bindings/interface/SBSection.i
index a138d81825b53..b86d4e99c5ea0 100644
--- a/lldb/bindings/interface/SBSection.i
+++ b/lldb/bindings/interface/SBSection.i
@@ -105,9 +105,6 @@ public:
     uint32_t
     GetTargetByteSize ();
 
-    uint32_t
-    GetAlignment ();
-
     bool
     GetDescription (lldb::SBStream &description);
 
@@ -141,7 +138,6 @@ public:
         data = property(GetSectionData, None, doc='''A read only property that returns an lldb object that represents the bytes for this section (lldb.SBData) for this section.''')
         type = property(GetSectionType, None, doc='''A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eSectionType") that represents the type of this section (code, data, etc.).''')
         target_byte_size = property(GetTargetByteSize, None, doc='''A read only property that returns the size of a target byte represented by this section as a number of host bytes.''')
-        alignment = property(GetAlignment, None, doc='''A read only property that returns the alignment of this section as a number of host bytes.''')
     %}
 #endif
 

diff  --git a/lldb/include/lldb/API/SBSection.h b/lldb/include/lldb/API/SBSection.h
index 94c6614ecfa99..d722dbe4ff1fb 100644
--- a/lldb/include/lldb/API/SBSection.h
+++ b/lldb/include/lldb/API/SBSection.h
@@ -76,12 +76,6 @@ class LLDB_API SBSection {
   ///     The number of host (8-bit) bytes needed to hold a target byte
   uint32_t GetTargetByteSize();
 
-  /// Return the alignment of the section in bytes
-  ///
-  /// \return
-  ///     The alignment of the section in bytes
-  uint32_t GetAlignment();
-
   bool operator==(const lldb::SBSection &rhs);
 
   bool operator!=(const lldb::SBSection &rhs);

diff  --git a/lldb/source/API/SBSection.cpp b/lldb/source/API/SBSection.cpp
index 3a9cf20e484a5..733e0db0b5bad 100644
--- a/lldb/source/API/SBSection.cpp
+++ b/lldb/source/API/SBSection.cpp
@@ -242,15 +242,6 @@ uint32_t SBSection::GetTargetByteSize() {
   return 0;
 }
 
-uint32_t SBSection::GetAlignment() {
-  LLDB_INSTRUMENT_VA(this);
-
-  SectionSP section_sp(GetSP());
-  if (section_sp.get())
-    return (1 << section_sp->GetLog2Align());
-  return 0;
-}
-
 bool SBSection::operator==(const SBSection &rhs) {
   LLDB_INSTRUMENT_VA(this, rhs);
 

diff  --git a/lldb/test/API/python_api/section/TestSectionAPI.py b/lldb/test/API/python_api/section/TestSectionAPI.py
index ab9ae56238c8b..51a003701924d 100644
--- a/lldb/test/API/python_api/section/TestSectionAPI.py
+++ b/lldb/test/API/python_api/section/TestSectionAPI.py
@@ -37,14 +37,3 @@ def test_get_target_byte_size(self):
 
         self.assertIsNotNone(data_section)
         self.assertEqual(data_section.target_byte_size, 1)
-
-    def test_get_alignment(self):
-        exe = self.getBuildArtifact("aligned.out")
-        self.yaml2obj("aligned.yaml", exe)
-        target = self.dbg.CreateTarget(exe)
-        self.assertTrue(target, VALID_TARGET)
-
-        # exe contains a single section aligned to 0x1000
-        section = target.modules[0].sections[0]
-        self.assertEqual(section.GetAlignment(), 0x1000)
-        self.assertEqual(section.alignment, 0x1000)

diff  --git a/lldb/test/API/python_api/section/aligned.yaml b/lldb/test/API/python_api/section/aligned.yaml
deleted file mode 100644
index f96d48419c197..0000000000000
--- a/lldb/test/API/python_api/section/aligned.yaml
+++ /dev/null
@@ -1,14 +0,0 @@
---- !ELF
-FileHeader:      
-  Class:           ELFCLASS64
-  Data:            ELFDATA2LSB
-  Type:            ET_EXEC
-  Machine:         EM_X86_64
-  Entry:           0x0000000000400000
-Sections:        
-  - Name:            .text1
-    Type:            SHT_PROGBITS
-    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
-    Address:         0x0000000000400000
-    AddressAlign:    0x0000000000001000
-    Size:            0xb0


        


More information about the lldb-commits mailing list