/* Copyright 2017 - 2021 R. Thomas * Copyright 2017 - 2021 Quarkslab * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include "pyELF.hpp" #include "LIEF/ELF/hash.hpp" #include "LIEF/ELF/NoteDetails/core/CoreSigInfo.hpp" namespace LIEF { namespace ELF { template using getter_t = T (CoreSigInfo::*)(void) const; template using setter_t = void (CoreSigInfo::*)(T); template<> void create(py::module& m) { py::class_(m, "CoreSigInfo") .def_property("signo", static_cast>(&CoreSigInfo::signo), static_cast>(&CoreSigInfo::signo), "Signal number") .def_property("sigcode", static_cast>(&CoreSigInfo::sigcode), static_cast>(&CoreSigInfo::sigcode), "Signal code") .def_property("sigerrno", static_cast>(&CoreSigInfo::sigerrno), static_cast>(&CoreSigInfo::sigerrno), "If non-zero, an errno value associated with this signal") .def("__eq__", &CoreSigInfo::operator==) .def("__ne__", &CoreSigInfo::operator!=) .def("__hash__", [] (const CoreSigInfo& note) { return Hash::hash(note); }) .def("__str__", [] (const CoreSigInfo& note) { std::ostringstream stream; stream << note; std::string str = stream.str(); return str; }); } } // namespace ELF } // namespace LIEF