| 11 | namespace LIEF::dwarf::py { |
| 12 | template<> |
| 13 | void create<dw::Editor>(nb::module_& m) { |
| 14 | nb::module_ m_editor = m.def_submodule("editor"); |
| 15 | |
| 16 | create<LIEF::dwarf::editor::Type>(m_editor); |
| 17 | create<LIEF::dwarf::editor::Function>(m_editor); |
| 18 | create<LIEF::dwarf::editor::Variable>(m_editor); |
| 19 | create<LIEF::dwarf::editor::CompilationUnit>(m_editor); |
| 20 | |
| 21 | nb::class_<dw::Editor> editor(m, "Editor", |
| 22 | R"doc( |
| 23 | This class exposes the main API to create DWARF information |
| 24 | )doc"_doc |
| 25 | ); |
| 26 | |
| 27 | editor |
| 28 | .def_static("from_binary", &dw::Editor::from_binary, |
| 29 | "Instantiate an editor for the given binary object"_doc, |
| 30 | "bin"_a |
| 31 | ) |
| 32 | .def("create_compilation_unit", &dw::Editor::create_compilation_unit, |
| 33 | "Create a new compilation unit"_doc |
| 34 | ) |
| 35 | .def("write", [] (dw::Editor& self, nb::PathLike path) { |
| 36 | self.write(path); |
| 37 | }, |
| 38 | "Write the DWARF file to the specified output"_doc, |
| 39 | "output"_a |
| 40 | ) |
| 41 | ; |
| 42 | |
| 43 | } |
| 44 | |
| 45 | } |