| 12 | namespace LIEF::pdb::py { |
| 13 | template<> |
| 14 | void create<pdb::DebugInfo>(nb::module_& m) { |
| 15 | nb::class_<pdb::DebugInfo, LIEF::DebugInfo> dbg_info(m, "DebugInfo", |
| 16 | R"doc( |
| 17 | This class provides an interface for PDB files. |
| 18 | |
| 19 | One can instantiate this class using :func:`lief.pdb.load` or |
| 20 | :meth:`lief.pdb.DebugInfo.from_file` |
| 21 | )doc"_doc |
| 22 | ); |
| 23 | dbg_info |
| 24 | .def_prop_ro("age", &pdb::DebugInfo::age, |
| 25 | "The number of times the PDB file has been written."_doc) |
| 26 | |
| 27 | .def_prop_ro("guid", &pdb::DebugInfo::guid, |
| 28 | "Unique identifier of the PDB file."_doc) |
| 29 | |
| 30 | .def_static("from_file", |
| 31 | [] (nb::PathLike path) { return pdb::DebugInfo::from_file(path); }, |
| 32 | R"doc( |
| 33 | Instantiate this class from the given PDB file. It returns ``None`` |
| 34 | if the PDB can't be processed. |
| 35 | )doc"_doc, "filepath"_a |
| 36 | ) |
| 37 | |
| 38 | .def("find_type", &pdb::DebugInfo::find_type, |
| 39 | R"doc( |
| 40 | Find the type with the given name |
| 41 | )doc"_doc, "name"_a |
| 42 | ) |
| 43 | |
| 44 | .def("find_public_symbol", &pdb::DebugInfo::find_public_symbol, |
| 45 | R"doc( |
| 46 | Try to find the PublicSymbol from the given name (based on the public symbol stream) |
| 47 | The function returns ``None`` if the symbol can't be found. |
| 48 | |
| 49 | .. code-block:: python |
| 50 | |
| 51 | debug_info: lief.pdb.DebugInfo = ... |
| 52 | if sym := debug_info.find_public_symbol("MiSyncSystemPdes"): |
| 53 | print("found") |
| 54 | )doc"_doc, "name"_a |
| 55 | ) |
| 56 | .def_prop_ro("public_symbols", |
| 57 | [] (pdb::DebugInfo& self) { |
| 58 | auto symbols = self.public_symbols(); |
| 59 | return nb::make_iterator<nb::rv_policy::reference_internal>( |
| 60 | nb::type<pdb::DebugInfo>(), "public_symbols_it", symbols); |
| 61 | }, |
| 62 | R"doc( |
| 63 | Return an iterator over the public symbol stream. |
| 64 | )doc"_doc, nb::keep_alive<0, 1>()) |
| 65 | |
| 66 | .def_prop_ro("compilation_units", |
| 67 | [] (pdb::DebugInfo& self) { |
| 68 | auto units = self.compilation_units(); |
| 69 | return nb::make_iterator<nb::rv_policy::reference_internal>( |
| 70 | nb::type<pdb::DebugInfo>(), "compilation_units_it", units); |
| 71 | }, |
nothing calls this directly
no test coverage detected