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

             Branch data     Line data    Source code
       1                 :             : /* Common pieces for handling registers in 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                 :             : static Dwarf_Word
      30                 :           0 : perf_sample_find_reg (const Dwarf_Word *regs, uint32_t n_regs,
      31                 :             :                       uint64_t regs_mask,
      32                 :             :                       int target)
      33                 :             : {
      34                 :           0 :   int j, k; uint64_t bit;
      35         [ #  # ]:           0 :   for (j = 0, k = 0, bit = 1; k < PERF_REG_X86_64_MAX; k++, bit <<= 1)
      36                 :             :     {
      37         [ #  # ]:           0 :       if (bit & regs_mask) {
      38         [ #  # ]:           0 :         if (n_regs <= (uint32_t) j)
      39                 :             :           return 0; /* regs_mask count doesn't match n_regs */
      40         [ #  # ]:           0 :         if (k == target)
      41                 :           0 :           return regs[j];
      42         [ #  # ]:           0 :         if (k > target)
      43                 :             :           return 0; /* regs_mask doesn't include desired reg */
      44                 :           0 :         j++;
      45                 :             :       }
      46                 :             :     }
      47                 :             :   return 0;
      48                 :             : }
        

Generated by: LCOV version 2.0-1