diff --git a/api/python/ELF/objects/pyBinary.cpp b/api/python/ELF/objects/pyBinary.cpp index 27eaef8..e81948c 100644 --- a/api/python/ELF/objects/pyBinary.cpp +++ b/api/python/ELF/objects/pyBinary.cpp @@ -324,7 +324,8 @@ void create(py::module& m) { .def("replace", static_cast(&Binary::replace), - "Replace the segment given in 2nd parameter with the segment given in the first one and return the updated segment", + "Replace the segment given in 2nd parameter with the segment given in the first one and return the updated segment." + ".. warning:: The ``original_segment`` is no longer valid after this function\n\n", "new_segment"_a, "original_segment"_a, "base"_a = 0, py::return_value_policy::reference) diff --git a/include/LIEF/ELF/Binary.hpp b/include/LIEF/ELF/Binary.hpp index 378046d..af0ea9b 100644 --- a/include/LIEF/ELF/Binary.hpp +++ b/include/LIEF/ELF/Binary.hpp @@ -349,6 +349,9 @@ class LIEF_API Binary : public LIEF::Binary { //! @return The segment added. `Virtual address` and `File Offset` may have changed Segment& add(const Segment& segment, uint64_t base = 0); + //! Replace the segment given in 2nd parameter with the segment given in the first one and return the updated segment. + //! + //! @warning .The ``original_segment`` is no longer valid after this function Segment& replace(const Segment& new_segment, const Segment& original_segment, uint64_t base = 0); Segment& extend(const Segment& segment, uint64_t size);