LCOV - code coverage report
Current view: top level - src - debug_info.rs (source / functions) Coverage Total Hit
Test: lief.lcov Lines: 0.0 % 23 0
Test Date: 2024-11-30:00:00:00 Functions: 0.0 % 1 0

            Line data    Source code
       1              : use lief_ffi as ffi;
       2              : 
       3              : use crate::pdb;
       4              : use crate::dwarf;
       5              : use crate::common::FromFFI;
       6              : 
       7              : /// This enum wraps either a PDB or a DWARF debug info
       8              : pub enum DebugInfo<'a> {
       9              :     Pdb(pdb::DebugInfo<'a>),
      10              :     Dwarf(dwarf::DebugInfo<'a>),
      11              : }
      12              : 
      13              : impl FromFFI<ffi::AbstracDebugInfo> for DebugInfo<'_> {
      14            0 :     fn from_ffi(info: cxx::UniquePtr<ffi::AbstracDebugInfo>) -> Self {
      15            0 :         unsafe {
      16            0 :             let info_ref = info.as_ref().unwrap();
      17            0 : 
      18            0 :             if ffi::PDB_DebugInfo::classof(info_ref) {
      19            0 :                 let raw = {
      20            0 :                     type From = cxx::UniquePtr<ffi::AbstracDebugInfo>;
      21            0 :                     type To = cxx::UniquePtr<ffi::PDB_DebugInfo>;
      22            0 :                     std::mem::transmute::<From, To>(info)
      23            0 :                 };
      24            0 :                 return DebugInfo::Pdb(pdb::DebugInfo::from_ffi(raw));
      25            0 :             }
      26            0 : 
      27            0 :             if !ffi::DWARF_DebugInfo::classof(info_ref) {
      28            0 :                 panic!("Expecting a DWARF debug info");
      29            0 :             }
      30            0 :             let raw = {
      31            0 :                 type From = cxx::UniquePtr<ffi::AbstracDebugInfo>;
      32            0 :                 type To = cxx::UniquePtr<ffi::DWARF_DebugInfo>;
      33            0 :                 std::mem::transmute::<From, To>(info)
      34            0 :             };
      35            0 :             DebugInfo::Dwarf(dwarf::DebugInfo::from_ffi(raw))
      36              :         }
      37            0 :     }
      38              : }
        

Generated by: LCOV version 2.1-1