LCOV - code coverage report
Current view: top level - src/elf/note/core - prpsinfo.rs (source / functions) Coverage Total Hit
Test: lief.lcov Lines: 76.5 % 17 13
Test Date: 2026-04-12:00:00:00 Functions: 60.0 % 5 3

            Line data    Source code
       1              : use lief_ffi as ffi;
       2              : use std::marker::PhantomData;
       3              : 
       4              : use crate::common::FromFFI;
       5              : use crate::elf::note::NoteBase;
       6              : 
       7              : /// Process info from a core dump
       8            0 : #[derive(Debug)]
       9              : pub struct Info {
      10              :     /// Numeric process state
      11              :     pub state: u32,
      12              :     /// Printable character representing state
      13              :     pub sname: String,
      14              :     /// Whether the process is a zombie
      15              :     pub zombie: bool,
      16              :     /// Nice value
      17              :     pub nice: u32,
      18              :     /// Process flag
      19              :     pub flag: u64,
      20              :     /// Process user ID
      21              :     pub uid: u32,
      22              :     /// Process group ID
      23              :     pub gid: u32,
      24              :     /// Process ID
      25              :     pub pid: u32,
      26              :     /// Process parent ID
      27              :     pub ppid: u32,
      28              :     /// Process group
      29              :     pub pgrp: u32,
      30              :     /// Process session id
      31              :     pub sid: u32,
      32              :     /// Filename of the executable
      33              :     pub filename: String,
      34              :     /// Initial part of the arguments
      35              :     pub args: String,
      36              : }
      37              : 
      38              : /// Note representing core process info (`NT_PRPSINFO`)
      39              : pub struct PrPsInfo<'a> {
      40              :     ptr: cxx::UniquePtr<ffi::ELF_CorePrPsInfo>,
      41              :     _owner: PhantomData<&'a ffi::ELF_Binary>,
      42              : }
      43              : 
      44              : impl PrPsInfo<'_> {
      45            0 :     pub fn info(&self) -> Option<Info> {
      46            0 :         todo!();
      47            0 :     }
      48              : }
      49              : 
      50              : impl NoteBase for PrPsInfo<'_> {
      51          299 :     fn get_base(&self) -> &ffi::ELF_Note {
      52          299 :         self.ptr.as_ref().unwrap().as_ref()
      53          299 :     }
      54              : }
      55              : 
      56              : impl FromFFI<ffi::ELF_CorePrPsInfo> for PrPsInfo<'_> {
      57          104 :     fn from_ffi(ptr: cxx::UniquePtr<ffi::ELF_CorePrPsInfo>) -> Self {
      58          104 :         Self {
      59          104 :             ptr,
      60          104 :             _owner: PhantomData,
      61          104 :         }
      62          104 :     }
      63              : }
      64              : 
      65              : impl std::fmt::Debug for PrPsInfo<'_> {
      66           78 :     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
      67           78 :         let base = self as &dyn NoteBase;
      68           78 :         f.debug_struct("CorePrPsInfo").field("base", &base).finish()
      69           78 :     }
      70              : }
        

Generated by: LCOV version 2.1-1