LCOV - code coverage report
Current view: top level - elfutils/libebl - ebldynamictagname.c (source / functions) Hit Total Coverage
Test: lcov.out Lines: 17 17 100.0 %
Date: 2012-10-31 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 16 18 88.9 %

           Branch data     Line data    Source code
       1                 :            : /* Return dynamic tag name.
       2                 :            :    Copyright (C) 2001, 2002, 2006, 2008 Red Hat, Inc.
       3                 :            :    This file is part of elfutils.
       4                 :            :    Written by Ulrich Drepper <drepper@redhat.com>, 2001.
       5                 :            : 
       6                 :            :    This file is free software; you can redistribute it and/or modify
       7                 :            :    it under the terms of either
       8                 :            : 
       9                 :            :      * the GNU Lesser General Public License as published by the Free
      10                 :            :        Software Foundation; either version 3 of the License, or (at
      11                 :            :        your option) any later version
      12                 :            : 
      13                 :            :    or
      14                 :            : 
      15                 :            :      * the GNU General Public License as published by the Free
      16                 :            :        Software Foundation; either version 2 of the License, or (at
      17                 :            :        your option) any later version
      18                 :            : 
      19                 :            :    or both in parallel, as here.
      20                 :            : 
      21                 :            :    elfutils is distributed in the hope that it will be useful, but
      22                 :            :    WITHOUT ANY WARRANTY; without even the implied warranty of
      23                 :            :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      24                 :            :    General Public License for more details.
      25                 :            : 
      26                 :            :    You should have received copies of the GNU General Public License and
      27                 :            :    the GNU Lesser General Public License along with this program.  If
      28                 :            :    not, see <http://www.gnu.org/licenses/>.  */
      29                 :            : 
      30                 :            : #ifdef HAVE_CONFIG_H
      31                 :            : # include <config.h>
      32                 :            : #endif
      33                 :            : 
      34                 :            : #include <inttypes.h>
      35                 :            : #include <stdio.h>
      36                 :            : #include <libeblP.h>
      37                 :            : 
      38                 :            : 
      39                 :            : const char *
      40                 :        962 : ebl_dynamic_tag_name (ebl, tag, buf, len)
      41                 :            :      Ebl *ebl;
      42                 :            :      int64_t tag;
      43                 :            :      char *buf;
      44                 :            :      size_t len;
      45                 :            : {
      46         [ +  - ]:        962 :   const char *res = ebl != NULL ? ebl->dynamic_tag_name (tag, buf, len) : NULL;
      47                 :            : 
      48         [ +  - ]:        962 :   if (res == NULL)
      49                 :            :     {
      50         [ +  + ]:        962 :       if (tag >= 0 && tag < DT_NUM)
      51                 :            :         {
      52                 :            :           static const char *stdtags[] =
      53                 :            :             {
      54                 :            :               "NULL", "NEEDED", "PLTRELSZ", "PLTGOT", "HASH", "STRTAB",
      55                 :            :               "SYMTAB", "RELA", "RELASZ", "RELAENT", "STRSZ", "SYMENT",
      56                 :            :               "INIT", "FINI", "SONAME", "RPATH", "SYMBOLIC", "REL", "RELSZ",
      57                 :            :               "RELENT", "PLTREL", "DEBUG", "TEXTREL", "JMPREL", "BIND_NOW",
      58                 :            :               "INIT_ARRAY", "FINI_ARRAY", "INIT_ARRAYSZ", "FINI_ARRAYSZ",
      59                 :            :               "RUNPATH", "FLAGS", "ENCODING", "PREINIT_ARRAY",
      60                 :            :               "PREINIT_ARRAYSZ"
      61                 :            :             };
      62                 :            : 
      63                 :        776 :           res = stdtags[tag];
      64                 :            :         }
      65         [ +  + ]:        186 :       else if (tag == DT_VERSYM)
      66                 :            :         res = "VERSYM";
      67         [ +  + ]:        158 :       else if (tag >= DT_GNU_PRELINKED && tag <= DT_SYMINENT)
      68                 :            :         {
      69                 :            :           static const char *valrntags[] =
      70                 :            :             {
      71                 :            :               "GNU_PRELINKED", "GNU_CONFLICTSZ", "GNU_LIBLISTSZ",
      72                 :            :               "CHECKSUM", "PLTPADSZ", "MOVEENT", "MOVESZ", "FEATURE_1",
      73                 :            :               "POSFLAG_1", "SYMINSZ", "SYMINENT"
      74                 :            :             };
      75                 :            : 
      76                 :         11 :           res = valrntags[tag - DT_GNU_PRELINKED];
      77                 :            :         }
      78         [ +  + ]:        147 :       else if (tag >= DT_GNU_HASH && tag <= DT_SYMINFO)
      79                 :            :         {
      80                 :            :           static const char *addrrntags[] =
      81                 :            :             {
      82                 :            :               "GNU_HASH", "TLSDESC_PLT", "TLSDESC_GOT",
      83                 :            :               "GNU_CONFLICT", "GNU_LIBLIST", "CONFIG", "DEPAUDIT", "AUDIT",
      84                 :            :               "PLTPAD", "MOVETAB", "SYMINFO"
      85                 :            :             };
      86                 :            : 
      87                 :         38 :           res = addrrntags[tag - DT_GNU_HASH];
      88                 :            :         }
      89         [ +  + ]:        109 :       else if (tag >= DT_RELACOUNT && tag <= DT_VERNEEDNUM)
      90                 :            :         {
      91                 :            :           static const char *suntags[] =
      92                 :            :             {
      93                 :            :               "RELACOUNT", "RELCOUNT", "FLAGS_1", "VERDEF", "VERDEFNUM",
      94                 :            :               "VERNEED", "VERNEEDNUM"
      95                 :            :             };
      96                 :            : 
      97                 :        106 :           res = suntags[tag - DT_RELACOUNT];
      98                 :            :         }
      99         [ +  + ]:          3 :       else if (tag == DT_AUXILIARY)
     100                 :            :         res = "AUXILIARY";
     101         [ +  + ]:          2 :       else if (tag == DT_FILTER)
     102                 :            :         res = "FILTER";
     103                 :            :       else
     104                 :            :         {
     105                 :          1 :           snprintf (buf, len, gettext ("<unknown>: %#" PRIx64), tag);
     106                 :            : 
     107                 :          1 :           res = buf;
     108                 :            : 
     109                 :            :         }
     110                 :            :     }
     111                 :            : 
     112                 :        962 :   return res;
     113                 :            : }

Generated by: LCOV version 1.9