LCOV - code coverage report
Current view: top level - backends - i386_initreg_sample.c (source / functions) Coverage Total Hit
Test: elfutils-0.193 Lines: 0.0 % 11 0
Test Date: 2025-08-30 14:31:09 Functions: 0.0 % 3 0
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
Branches: 0.0 % 2 0

             Branch data     Line data    Source code
       1                 :             : /* Populate process registers from a linux perf_events sample.
       2                 :             :    Copyright (C) 2025 Red Hat, Inc.
       3                 :             :    This file is part of elfutils.
       4                 :             : 
       5                 :             :    This file is free software; you can redistribute it and/or modify
       6                 :             :    it under the terms of either
       7                 :             : 
       8                 :             :      * the GNU Lesser General Public License as published by the Free
       9                 :             :        Software Foundation; either version 3 of the License, or (at
      10                 :             :        your option) any later version
      11                 :             : 
      12                 :             :    or
      13                 :             : 
      14                 :             :      * the GNU General Public License as published by the Free
      15                 :             :        Software Foundation; either version 2 of the License, or (at
      16                 :             :        your option) any later version
      17                 :             : 
      18                 :             :    or both in parallel, as here.
      19                 :             : 
      20                 :             :    elfutils is distributed in the hope that it will be useful, but
      21                 :             :    WITHOUT ANY WARRANTY; without even the implied warranty of
      22                 :             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      23                 :             :    General Public License for more details.
      24                 :             : 
      25                 :             :    You should have received copies of the GNU General Public License and
      26                 :             :    the GNU Lesser General Public License along with this program.  If
      27                 :             :    not, see <http://www.gnu.org/licenses/>.  */
      28                 :             : 
      29                 :             : #ifdef HAVE_CONFIG_H
      30                 :             : # include <config.h>
      31                 :             : #endif
      32                 :             : 
      33                 :             : #include <stdlib.h>
      34                 :             : #if (defined __i386__ || defined __x86_64__) && defined(__linux__)
      35                 :             : # include <linux/perf_event.h>
      36                 :             : # include <asm/perf_regs.h>
      37                 :             : #endif
      38                 :             : 
      39                 :             : #define BACKEND i386_
      40                 :             : #include "libebl_CPU.h"
      41                 :             : #include "libebl_PERF_FLAGS.h"
      42                 :             : #if (defined __i386__ || defined __x86_64__) && defined(__linux__)
      43                 :             : # include "linux-perf-regs.c"
      44                 :             : # include "x86_initreg_sample.c"
      45                 :             : #endif
      46                 :             : 
      47                 :             : /* Register ordering cf. linux arch/x86/include/uapi/asm/perf_regs.h,
      48                 :             :    enum perf_event_x86_regs: */
      49                 :             : Dwarf_Word
      50                 :           0 : i386_sample_base_addr (const Dwarf_Word *regs, uint32_t n_regs,
      51                 :             :                        uint64_t regs_mask,
      52                 :             :                        /* XXX hypothetically needed if abi varies
      53                 :             :                           between samples in the same process;
      54                 :             :                           not needed on x86 */
      55                 :             :                        uint32_t abi __attribute__((unused)))
      56                 :             : {
      57                 :             : #if (!defined __i386__ && !defined __x86_64__) || !defined(__linux__)
      58                 :             :   (void)regs;
      59                 :             :   (void)n_regs;
      60                 :             :   (void)regs_mask;
      61                 :             :   return 0;
      62                 :             : #else /* __i386__ || __x86_64__ */
      63                 :           0 :   (void)regs;
      64                 :           0 :   (void)n_regs;
      65                 :           0 :   (void)regs_mask;
      66                 :           0 :   return perf_sample_find_reg (regs, n_regs, regs_mask,
      67                 :             :                                7 /* index into perf_event_x86_regs */);
      68                 :             : #endif
      69                 :             : }
      70                 :             : 
      71                 :             : Dwarf_Word
      72                 :           0 : i386_sample_pc (const Dwarf_Word *regs, uint32_t n_regs,
      73                 :             :                 uint64_t regs_mask,
      74                 :             :                 uint32_t abi __attribute__((unused)))
      75                 :             : {
      76                 :             : #if (!defined __i386__ && !defined __x86_64__) || !defined(__linux__)
      77                 :             :   (void)regs;
      78                 :             :   (void)n_regs;
      79                 :             :   (void)regs_mask;
      80                 :             :   return 0;
      81                 :             : #else /* __i386__ || __x86_64__ */
      82                 :           0 :   return perf_sample_find_reg (regs, n_regs, regs_mask,
      83                 :             :                                8 /* index into perf_event_x86_regs */);
      84                 :             : #endif
      85                 :             : }
      86                 :             : 
      87                 :             : bool
      88                 :           0 : i386_set_initial_registers_sample (const Dwarf_Word *regs, uint32_t n_regs,
      89                 :             :                                    uint64_t regs_mask, uint32_t abi,
      90                 :             :                                    ebl_tid_registers_t *setfunc,
      91                 :             :                                    void *arg)
      92                 :             : {
      93                 :             : #if (!defined __i386__ && !defined __x86_64__) || !defined(__linux__)
      94                 :             :   (void)regs;
      95                 :             :   (void)n_regs;
      96                 :             :   (void)regs_mask;
      97                 :             :   (void)abi;
      98                 :             :   (void)setfunc;
      99                 :             :   (void)arg;
     100                 :             :   return false;
     101                 :             : #else /* __i386__ || __x86_64__ */
     102                 :           0 :   Dwarf_Word dwarf_regs[9];
     103         [ #  # ]:           0 :   if (!x86_set_initial_registers_sample (regs, n_regs, regs_mask,
     104                 :             :                                          abi, dwarf_regs, 9))
     105                 :             :     return false;
     106                 :           0 :   return setfunc (0, 9, dwarf_regs, arg);
     107                 :             : #endif
     108                 :             : }
        

Generated by: LCOV version 2.0-1