LLVMFuzzerTestOneInput:
   33|  8.26k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   34|  8.26k|  char filename[256];
   35|       |#ifdef DWREGRESSIONTEMP
   36|       |  /* Under msys2, the /tmp/ results in an open fail */
   37|       |  sprintf(filename, "libfuzzer.%d", getpid());
   38|       |#else
   39|  8.26k|  sprintf(filename, "/tmp/libfuzzer.%d", getpid());
   40|  8.26k|#endif
   41|  8.26k|  FILE *fp = fopen(filename, "wb");
   42|  8.26k|  if (!fp) {
  ------------------
  |  Branch (42:7): [True: 0, False: 8.26k]
  ------------------
   43|      0|    printf("FAIL libfuzzer cannot open temp as writeable %s\n",
   44|      0|        filename);
   45|      0|    return 0;
   46|      0|  }
   47|       |
   48|  8.26k|  fwrite(data, size, 1, fp);
   49|  8.26k|  fclose(fp);
   50|       |
   51|  8.26k|  int fuzz_fd = 0;
   52|  8.26k|  Dwarf_Ptr errarg = 0;
   53|  8.26k|  Dwarf_Handler errhand = 0;
   54|  8.26k|  Dwarf_Error *errp = NULL;
   55|  8.26k|  Dwarf_Debug dbg = 0;
   56|       |
   57|  8.26k|  fuzz_fd = open(filename, O_RDONLY |O_BINARY);
  ------------------
  |  |   27|  8.26k|#define O_BINARY 0
  ------------------
   58|  8.26k|  if (fuzz_fd != -1) {
  ------------------
  |  Branch (58:7): [True: 8.26k, False: 0]
  ------------------
   59|  8.26k|    dwarf_init_b(fuzz_fd, DW_GROUPNUMBER_ANY, errhand, errarg, &dbg, errp);
  ------------------
  |  |  126|  8.26k|#define DW_GROUPNUMBER_ANY  0
  ------------------
   60|       |
   61|  8.26k|    int res = 0;
   62|  8.26k|    char *debuglink_path = 0;
   63|  8.26k|    unsigned char *crc = 0;
   64|  8.26k|    char *debuglink_fullpath = 0;
   65|  8.26k|    unsigned debuglink_fullpath_strlen = 0;
   66|  8.26k|    unsigned buildid_type = 0;
   67|  8.26k|    char *buildidowner_name = 0;
   68|  8.26k|    unsigned char *buildid_itself = 0;
   69|  8.26k|    unsigned buildid_length = 0;
   70|  8.26k|    char **paths = 0;
   71|  8.26k|    unsigned paths_count = 0;
   72|  8.26k|    unsigned i = 0;
   73|       |
   74|       |    /*  This is just an example if one knows
   75|       |        of another place full-DWARF objects
   76|       |        may be. "/usr/lib/debug" is automatically
   77|       |        set. */
   78|  8.26k|    res =
   79|  8.26k|        dwarf_add_debuglink_global_path(dbg, "/usr/include/c++/9/debug", errp);
   80|  8.26k|    res = dwarf_gnu_debuglink(dbg, &debuglink_path, &crc, &debuglink_fullpath,
   81|  8.26k|                              &debuglink_fullpath_strlen, &buildid_type,
   82|  8.26k|                              &buildidowner_name, &buildid_itself,
   83|  8.26k|                              &buildid_length, &paths, &paths_count, errp);
   84|       |    /*  Calling dwarf_gnu_debuglink and passing in
   85|       |        &paths here means the caller
   86|       |        is obligated to free the array/block of strings
   87|       |        returned. dwarf_finish() will NOT
   88|       |        free these strings. See the libdwarf documentation.  */
   89|  8.26k|    free(paths);
   90|       |    /*  Calling dwarf_gnu_debuglink and passing in
   91|       |        &debuglink_fullpath  means the caller
   92|       |        is obligated to free the array/block of strings
   93|       |        returned. dwarf_finish() will NOT
   94|       |        free these strings. See the libdwarf documentation.  */
   95|  8.26k|    free(debuglink_fullpath);
   96|       |
   97|  8.26k|    dwarf_finish(dbg);
   98|  8.26k|    close(fuzz_fd);
   99|  8.26k|  }
  100|       |
  101|  8.26k|  unlink(filename);
  102|  8.26k|  return 0;
  103|  8.26k|}

_dwarf_load_macho_header64:
   63|    829|{
   64|    829|    struct mach_header_64 mh64;
   65|    829|    int res = 0;
   66|    829|    Dwarf_Unsigned inner = mfp->mo_inner_offset;
   67|       |
   68|    829|    if (sizeof(mh64) > mfp->mo_filesize) {
  ------------------
  |  Branch (68:9): [True: 24, False: 805]
  ------------------
   69|     24|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     24|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
   70|     24|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     24|#define DW_DLV_ERROR      1
  ------------------
   71|     24|    }
   72|    805|    res = RRMOA(mfp->mo_fd, &mh64, inner, sizeof(mh64),
  ------------------
  |  |   65|    805|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    805|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
   73|    805|        (inner+mfp->mo_filesize), errcode);
   74|    805|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    805|#define DW_DLV_OK         0
  ------------------
  |  Branch (74:9): [True: 0, False: 805]
  ------------------
   75|      0|        return res;
   76|      0|    }
   77|       |    /* Do not adjust endianness of magic, leave as-is. */
   78|    805|    ASNAR(memcpy,mfp->mo_header.magic,mh64.magic);
  ------------------
  |  |   53|    805|    do {                                        \
  |  |   54|    805|        (t) = 0;                                \
  |  |   55|    805|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    805|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 805]
  |  |  ------------------
  ------------------
   79|    805|    ASNAR(mfp->mo_copy_word,mfp->mo_header.cputype,mh64.cputype);
  ------------------
  |  |   53|    805|    do {                                        \
  |  |   54|    805|        (t) = 0;                                \
  |  |   55|    805|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    805|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 805]
  |  |  ------------------
  ------------------
   80|    805|    ASNAR(mfp->mo_copy_word,mfp->mo_header.cpusubtype,
  ------------------
  |  |   53|    805|    do {                                        \
  |  |   54|    805|        (t) = 0;                                \
  |  |   55|    805|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    805|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 805]
  |  |  ------------------
  ------------------
   81|    805|        mh64.cpusubtype);
   82|    805|    ASNAR(mfp->mo_copy_word,mfp->mo_header.filetype,mh64.filetype);
  ------------------
  |  |   53|    805|    do {                                        \
  |  |   54|    805|        (t) = 0;                                \
  |  |   55|    805|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    805|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 805]
  |  |  ------------------
  ------------------
   83|    805|    ASNAR(mfp->mo_copy_word,mfp->mo_header.ncmds,mh64.ncmds);
  ------------------
  |  |   53|    805|    do {                                        \
  |  |   54|    805|        (t) = 0;                                \
  |  |   55|    805|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    805|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 805]
  |  |  ------------------
  ------------------
   84|    805|    ASNAR(mfp->mo_copy_word,mfp->mo_header.sizeofcmds,
  ------------------
  |  |   53|    805|    do {                                        \
  |  |   54|    805|        (t) = 0;                                \
  |  |   55|    805|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    805|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 805]
  |  |  ------------------
  ------------------
   85|    805|        mh64.sizeofcmds);
   86|    805|    ASNAR(mfp->mo_copy_word,mfp->mo_header.flags,mh64.flags);
  ------------------
  |  |   53|    805|    do {                                        \
  |  |   54|    805|        (t) = 0;                                \
  |  |   55|    805|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    805|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 805]
  |  |  ------------------
  ------------------
   87|    805|    ASNAR(mfp->mo_copy_word,mfp->mo_header.reserved,mh64.reserved);
  ------------------
  |  |   53|    805|    do {                                        \
  |  |   54|    805|        (t) = 0;                                \
  |  |   55|    805|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    805|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 805]
  |  |  ------------------
  ------------------
   88|    805|    mfp->mo_command_count = (unsigned int)mfp->mo_header.ncmds;
   89|    805|    if (mfp->mo_header.sizeofcmds >= MAX_COMMANDS_SIZE ||
  ------------------
  |  |   42|  1.61k|#define MAX_COMMANDS_SIZE  30000
  ------------------
  |  Branch (89:9): [True: 21, False: 784]
  ------------------
   90|    784|        mfp->mo_header.sizeofcmds >= mfp->mo_filesize ) {
  ------------------
  |  Branch (90:9): [True: 32, False: 752]
  ------------------
   91|     53|        *errcode = DW_DLE_MACHO_CORRUPT_HEADER;
  ------------------
  |  | 1532|     53|#define DW_DLE_MACHO_CORRUPT_HEADER            486
  ------------------
   92|     53|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     53|#define DW_DLV_ERROR      1
  ------------------
   93|     53|    }
   94|    752|    mfp->mo_machine = mfp->mo_header.cputype;
   95|    752|    mfp->mo_flags = mfp->mo_header.flags;
   96|    752|    mfp->mo_command_start_offset = sizeof(mh64);
   97|    752|    return DW_DLV_OK;
  ------------------
  |  |   59|    752|#define DW_DLV_OK         0
  ------------------
   98|    805|}
_dwarf_load_segment_command_content64:
  106|   201k|{
  107|   201k|    struct segment_command_64 sc;
  108|   201k|    int res = 0;
  109|   201k|    Dwarf_Unsigned filesize = mfp->mo_filesize;
  110|   201k|    Dwarf_Unsigned segoffset = mmp->offset_this_command;
  111|   201k|    Dwarf_Unsigned afterseghdr = segoffset + sizeof(sc);
  112|   201k|    Dwarf_Unsigned inner = mfp->mo_inner_offset;
  113|       |
  114|   201k|    if (segoffset > filesize ||
  ------------------
  |  Branch (114:9): [True: 0, False: 201k]
  ------------------
  115|   201k|        mmp->cmdsize > filesize ||
  ------------------
  |  Branch (115:9): [True: 0, False: 201k]
  ------------------
  116|   201k|        (mmp->cmdsize + segoffset) > filesize ) {
  ------------------
  |  Branch (116:9): [True: 0, False: 201k]
  ------------------
  117|      0|        *errcode = DW_DLE_MACH_O_SEGOFFSET_BAD;
  ------------------
  |  | 1462|      0|#define DW_DLE_MACH_O_SEGOFFSET_BAD            416
  ------------------
  118|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  119|      0|    }
  120|   201k|    res = RRMOA(mfp->mo_fd,&sc,inner+segoffset,
  ------------------
  |  |   65|   201k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|   201k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  121|   201k|        sizeof(sc), inner+filesize, errcode);
  122|   201k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|   201k|#define DW_DLV_OK         0
  ------------------
  |  Branch (122:9): [True: 24, False: 201k]
  ------------------
  123|     24|        return res;
  124|     24|    }
  125|   201k|    ASNAR(mfp->mo_copy_word,msp->cmd,sc.cmd);
  ------------------
  |  |   53|   201k|    do {                                        \
  |  |   54|   201k|        (t) = 0;                                \
  |  |   55|   201k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   201k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 201k]
  |  |  ------------------
  ------------------
  126|   201k|    ASNAR(mfp->mo_copy_word,msp->cmdsize,sc.cmdsize);
  ------------------
  |  |   53|   201k|    do {                                        \
  |  |   54|   201k|        (t) = 0;                                \
  |  |   55|   201k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   201k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 201k]
  |  |  ------------------
  ------------------
  127|   201k|    _dwarf_safe_strcpy(msp->segname,sizeof(msp->segname),
  128|   201k|        sc.segname,sizeof(sc.segname));
  129|   201k|    ASNAR(mfp->mo_copy_word,msp->vmaddr,sc.vmaddr);
  ------------------
  |  |   53|   201k|    do {                                        \
  |  |   54|   201k|        (t) = 0;                                \
  |  |   55|   201k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   201k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 201k]
  |  |  ------------------
  ------------------
  130|   201k|    ASNAR(mfp->mo_copy_word,msp->vmsize,sc.vmsize);
  ------------------
  |  |   53|   201k|    do {                                        \
  |  |   54|   201k|        (t) = 0;                                \
  |  |   55|   201k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   201k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 201k]
  |  |  ------------------
  ------------------
  131|   201k|    ASNAR(mfp->mo_copy_word,msp->fileoff,sc.fileoff);
  ------------------
  |  |   53|   201k|    do {                                        \
  |  |   54|   201k|        (t) = 0;                                \
  |  |   55|   201k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   201k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 201k]
  |  |  ------------------
  ------------------
  132|   201k|    ASNAR(mfp->mo_copy_word,msp->filesize,sc.filesize);
  ------------------
  |  |   53|   201k|    do {                                        \
  |  |   54|   201k|        (t) = 0;                                \
  |  |   55|   201k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   201k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 201k]
  |  |  ------------------
  ------------------
  133|   201k|    if (msp->fileoff > filesize ||
  ------------------
  |  Branch (133:9): [True: 98, False: 201k]
  ------------------
  134|   201k|        msp->filesize > filesize) {
  ------------------
  |  Branch (134:9): [True: 85, False: 201k]
  ------------------
  135|       |        /* corrupt */
  136|    183|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|    183|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  137|    183|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    183|#define DW_DLV_ERROR      1
  ------------------
  138|    183|    }
  139|   201k|    if ((msp->fileoff+msp->filesize ) > filesize) {
  ------------------
  |  Branch (139:9): [True: 27, False: 201k]
  ------------------
  140|       |        /* corrupt */
  141|     27|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|     27|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  142|     27|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     27|#define DW_DLV_ERROR      1
  ------------------
  143|     27|    }
  144|   201k|    ASNAR(mfp->mo_copy_word,msp->maxprot,sc.maxprot);
  ------------------
  |  |   53|   201k|    do {                                        \
  |  |   54|   201k|        (t) = 0;                                \
  |  |   55|   201k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   201k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 201k]
  |  |  ------------------
  ------------------
  145|   201k|    ASNAR(mfp->mo_copy_word,msp->initprot,sc.initprot);
  ------------------
  |  |   53|   201k|    do {                                        \
  |  |   54|   201k|        (t) = 0;                                \
  |  |   55|   201k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   201k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 201k]
  |  |  ------------------
  ------------------
  146|   201k|    ASNAR(mfp->mo_copy_word,msp->nsects,sc.nsects);
  ------------------
  |  |   53|   201k|    do {                                        \
  |  |   54|   201k|        (t) = 0;                                \
  |  |   55|   201k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   201k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 201k]
  |  |  ------------------
  ------------------
  147|   201k|    if (msp->nsects >= mfp->mo_filesize) {
  ------------------
  |  Branch (147:9): [True: 34, False: 201k]
  ------------------
  148|     34|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|     34|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  149|     34|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     34|#define DW_DLV_ERROR      1
  ------------------
  150|     34|    }
  151|   201k|    ASNAR(mfp->mo_copy_word,msp->flags,sc.flags);
  ------------------
  |  |   53|   201k|    do {                                        \
  |  |   54|   201k|        (t) = 0;                                \
  |  |   55|   201k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   201k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 201k]
  |  |  ------------------
  ------------------
  152|   201k|    msp->macho_command_index = mmpindex;
  153|   201k|    msp->sectionsoffset = afterseghdr;
  154|   201k|    return DW_DLV_OK;
  ------------------
  |  |   59|   201k|#define DW_DLV_OK         0
  ------------------
  155|   201k|}
_dwarf_macho_load_dwarf_section_details64:
  163|  45.4k|{
  164|  45.4k|    int            res = 0;
  165|  45.4k|    Dwarf_Unsigned seci = 0;
  166|  45.4k|    Dwarf_Unsigned seccount = segp->nsects;
  167|  45.4k|    Dwarf_Unsigned secalloc = seccount+1;
  168|       |
  169|       |    /* offset of sections being added */
  170|  45.4k|    Dwarf_Unsigned curoff = segp->sectionsoffset;
  171|  45.4k|    Dwarf_Unsigned shdrlen = sizeof(struct section_64);
  172|  45.4k|    Dwarf_Unsigned newcount = 0;
  173|  45.4k|    struct generic_macho_section *secs = 0;
  174|       |
  175|  45.4k|    if (mfp->mo_dwarf_sections) {
  ------------------
  |  Branch (175:9): [True: 44.7k, False: 653]
  ------------------
  176|  44.7k|        Dwarf_Unsigned secssizetot = 0;
  177|  44.7k|        struct generic_macho_section * originalsections =
  178|  44.7k|            mfp->mo_dwarf_sections;
  179|       |
  180|  44.7k|        if (!seccount) {
  ------------------
  |  Branch (180:13): [True: 27.1k, False: 17.6k]
  ------------------
  181|       |            /* No sections. Odd. Unexpected. */
  182|  27.1k|            return DW_DLV_OK;
  ------------------
  |  |   59|  27.1k|#define DW_DLV_OK         0
  ------------------
  183|  27.1k|        }
  184|  17.6k|        newcount = mfp->mo_dwarf_sectioncount + seccount;
  185|  17.6k|        res = _dwarf_uint64_mult(newcount,
  186|  17.6k|            sizeof(struct generic_macho_section),
  187|  17.6k|            &secssizetot);
  188|  17.6k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  17.6k|#define DW_DLV_OK         0
  ------------------
  |  Branch (188:13): [True: 0, False: 17.6k]
  ------------------
  189|       |            /* overflow */
  190|      0|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      0|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  191|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  192|      0|        }
  193|  17.6k|        if (secssizetot > mfp->mo_filesize ) {
  ------------------
  |  Branch (193:13): [True: 88, False: 17.5k]
  ------------------
  194|       |
  195|       |            /*  Really supposed to refer to size on disk, this
  196|       |                is therefore approximate test. */
  197|     88|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|     88|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  198|     88|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     88|#define DW_DLV_ERROR      1
  ------------------
  199|     88|        }
  200|  17.5k|        secs = (struct generic_macho_section *)calloc(
  201|  17.5k|            1,secssizetot);
  202|  17.5k|        if (!secs) {
  ------------------
  |  Branch (202:13): [True: 0, False: 17.5k]
  ------------------
  203|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  204|      0|            return DW_DLV_OK;
  ------------------
  |  |   59|      0|#define DW_DLV_OK         0
  ------------------
  205|      0|        }
  206|  17.5k|        memcpy(secs,mfp->mo_dwarf_sections,
  207|  17.5k|            mfp->mo_dwarf_sectioncount*
  208|  17.5k|            sizeof(struct generic_macho_section));
  209|  17.5k|        mfp->mo_dwarf_sections = secs;
  210|  17.5k|        seci =  mfp->mo_dwarf_sectioncount ;
  211|  17.5k|        mfp->mo_dwarf_sectioncount = newcount;
  212|  17.5k|        free(originalsections);
  213|  17.5k|        secs += seci;
  214|  17.5k|        secs->offset_of_sec_rec = curoff;
  215|  17.5k|        secalloc = newcount;
  216|  17.5k|    } else {
  217|    653|        Dwarf_Unsigned secssizetot = 0;
  218|       |
  219|    653|        newcount = secalloc;
  220|    653|        res = _dwarf_uint64_mult(newcount,
  221|    653|            sizeof(struct generic_macho_section),
  222|    653|            &secssizetot);
  223|    653|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    653|#define DW_DLV_OK         0
  ------------------
  |  Branch (223:13): [True: 0, False: 653]
  ------------------
  224|       |            /* overflow */
  225|      0|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      0|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  226|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  227|      0|        }
  228|    653|        if (secssizetot > mfp->mo_filesize ) {
  ------------------
  |  Branch (228:13): [True: 73, False: 580]
  ------------------
  229|       |            /*  Really supposed to refer to size on disk, this
  230|       |                is therefore approximate test. */
  231|     73|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|     73|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  232|     73|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     73|#define DW_DLV_ERROR      1
  ------------------
  233|     73|        }
  234|    580|        secs = (struct generic_macho_section *)calloc(
  235|    580|            1,secssizetot);
  236|    580|        if (!secs) {
  ------------------
  |  Branch (236:13): [True: 0, False: 580]
  ------------------
  237|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  238|      0|            return DW_DLV_OK;
  ------------------
  |  |   59|      0|#define DW_DLV_OK         0
  ------------------
  239|      0|        }
  240|    580|        mfp->mo_dwarf_sections = secs;
  241|    580|        mfp->mo_dwarf_sectioncount = secalloc;
  242|    580|        secs->offset_of_sec_rec = curoff;
  243|       |        /*  Leave 0 section all zeros except our offset,
  244|       |            elf-like in a sense */
  245|    580|        secs->dwarfsectname = "";
  246|    580|        seci = 1;
  247|    580|        ++secs;
  248|    580|    }
  249|  53.9k|    for (; seci < secalloc; ++seci,++secs,curoff += shdrlen ) {
  ------------------
  |  Branch (249:12): [True: 35.9k, False: 17.9k]
  ------------------
  250|  35.9k|        struct section_64 mosec;
  251|  35.9k|        Dwarf_Unsigned endoffset = 0;
  252|  35.9k|        Dwarf_Unsigned inner = mfp->mo_inner_offset;
  253|  35.9k|        Dwarf_Unsigned offplussize = 0;
  254|  35.9k|        Dwarf_Unsigned innercur = 0;
  255|       |
  256|  35.9k|        endoffset = curoff + sizeof(mosec);
  257|  35.9k|        if (curoff >=  mfp->mo_filesize ||
  ------------------
  |  Branch (257:13): [True: 1, False: 35.9k]
  ------------------
  258|  35.9k|            endoffset > mfp->mo_filesize) {
  ------------------
  |  Branch (258:13): [True: 2, False: 35.9k]
  ------------------
  259|      3|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      3|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  260|      3|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
  261|      3|        }
  262|  35.9k|        innercur = inner+curoff;
  263|  35.9k|        if (innercur < inner || innercur <curoff) {
  ------------------
  |  Branch (263:13): [True: 0, False: 35.9k]
  |  Branch (263:33): [True: 0, False: 35.9k]
  ------------------
  264|      0|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      0|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  265|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  266|      0|        }
  267|       |        /* inner refers to universal binaries */
  268|  35.9k|        offplussize = inner+mfp->mo_filesize;
  269|  35.9k|        if (offplussize < inner || offplussize <mfp->mo_filesize) {
  ------------------
  |  Branch (269:13): [True: 0, False: 35.9k]
  |  Branch (269:36): [True: 0, False: 35.9k]
  ------------------
  270|      0|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      0|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  271|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  272|      0|        }
  273|  35.9k|        res = RRMOA(mfp->mo_fd, &mosec,
  ------------------
  |  |   65|  35.9k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  35.9k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  274|  35.9k|            innercur, sizeof(mosec),
  275|  35.9k|            offplussize, errcode);
  276|  35.9k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  35.9k|#define DW_DLV_OK         0
  ------------------
  |  Branch (276:13): [True: 0, False: 35.9k]
  ------------------
  277|      0|            return res;
  278|      0|        }
  279|  35.9k|        _dwarf_safe_strcpy(secs->sectname,
  280|  35.9k|            sizeof(secs->sectname),
  281|  35.9k|            mosec.sectname,sizeof(mosec.sectname));
  282|  35.9k|        if (_dwarf_not_ascii(secs->sectname) ) {
  ------------------
  |  Branch (282:13): [True: 25, False: 35.9k]
  ------------------
  283|     25|            *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|     25|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  284|     25|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     25|#define DW_DLV_ERROR      1
  ------------------
  285|     25|        }
  286|  35.9k|        _dwarf_safe_strcpy(secs->segname,
  287|  35.9k|            sizeof(secs->segname),
  288|  35.9k|            mosec.segname,sizeof(mosec.segname));
  289|  35.9k|        ASNAR(mfp->mo_copy_word,secs->addr,mosec.addr);
  ------------------
  |  |   53|  35.9k|    do {                                        \
  |  |   54|  35.9k|        (t) = 0;                                \
  |  |   55|  35.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  35.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 35.9k]
  |  |  ------------------
  ------------------
  290|  35.9k|        ASNAR(mfp->mo_copy_word,secs->size,mosec.size);
  ------------------
  |  |   53|  35.9k|    do {                                        \
  |  |   54|  35.9k|        (t) = 0;                                \
  |  |   55|  35.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  35.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 35.9k]
  |  |  ------------------
  ------------------
  291|  35.9k|        ASNAR(mfp->mo_copy_word,secs->offset,mosec.offset);
  ------------------
  |  |   53|  35.9k|    do {                                        \
  |  |   54|  35.9k|        (t) = 0;                                \
  |  |   55|  35.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  35.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 35.9k]
  |  |  ------------------
  ------------------
  292|  35.9k|        ASNAR(mfp->mo_copy_word,secs->align,mosec.align);
  ------------------
  |  |   53|  35.9k|    do {                                        \
  |  |   54|  35.9k|        (t) = 0;                                \
  |  |   55|  35.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  35.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 35.9k]
  |  |  ------------------
  ------------------
  293|  35.9k|        ASNAR(mfp->mo_copy_word,secs->reloff,mosec.reloff);
  ------------------
  |  |   53|  35.9k|    do {                                        \
  |  |   54|  35.9k|        (t) = 0;                                \
  |  |   55|  35.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  35.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 35.9k]
  |  |  ------------------
  ------------------
  294|  35.9k|        ASNAR(mfp->mo_copy_word,secs->nreloc,mosec.nreloc);
  ------------------
  |  |   53|  35.9k|    do {                                        \
  |  |   54|  35.9k|        (t) = 0;                                \
  |  |   55|  35.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  35.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 35.9k]
  |  |  ------------------
  ------------------
  295|  35.9k|        ASNAR(mfp->mo_copy_word,secs->flags,mosec.flags);
  ------------------
  |  |   53|  35.9k|    do {                                        \
  |  |   54|  35.9k|        (t) = 0;                                \
  |  |   55|  35.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  35.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 35.9k]
  |  |  ------------------
  ------------------
  296|       |        /*offplussize = secs->offset+secs->size; */
  297|  35.9k|        res = _dwarf_uint64_add(secs->offset,secs->size,
  298|  35.9k|            &offplussize);
  299|  35.9k|        if (res == DW_DLV_ERROR){
  ------------------
  |  |   60|  35.9k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (299:13): [True: 7, False: 35.9k]
  ------------------
  300|       |            /* overflow in add */
  301|      7|            *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      7|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  302|      7|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      7|#define DW_DLV_ERROR      1
  ------------------
  303|      7|        }
  304|       |        /*  __text section size apparently refers to executable,
  305|       |            not dSYM, so do not check here
  306|       |            No check for __text.
  307|       |            All sections in __DWARF checked  */
  308|  35.9k|        if (0 == strcmp(secs->segname,"__DWARF")) {
  ------------------
  |  Branch (308:13): [True: 11.9k, False: 24.0k]
  ------------------
  309|  11.9k|            if (secs->offset > mfp->mo_filesize ||
  ------------------
  |  Branch (309:17): [True: 34, False: 11.8k]
  ------------------
  310|  11.8k|                secs->size > mfp->mo_filesize ||
  ------------------
  |  Branch (310:17): [True: 53, False: 11.8k]
  ------------------
  311|  11.8k|                offplussize > mfp->mo_filesize) {
  ------------------
  |  Branch (311:17): [True: 25, False: 11.7k]
  ------------------
  312|    112|                *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|    112|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  313|    112|                return DW_DLV_ERROR;
  ------------------
  |  |   60|    112|#define DW_DLV_ERROR      1
  ------------------
  314|    112|            }
  315|  11.9k|        }
  316|  35.8k|        secs->reserved1 = 0;
  317|  35.8k|        secs->reserved2 = 0;
  318|  35.8k|        secs->reserved3 = 0;
  319|  35.8k|        secs->offset_of_sec_rec = curoff;
  320|  35.8k|        secs->generic_segment_num  = segi;
  321|  35.8k|    }
  322|  17.9k|    return DW_DLV_OK;
  ------------------
  |  |   59|  17.9k|#define DW_DLV_OK         0
  ------------------
  323|  18.0k|}
_dwarf_fill_in_uni_arch_64:
  331|    270|{
  332|    270|    Dwarf_Unsigned i = 0;
  333|    270|    struct Dwarf_Universal_Arch_s * dua = 0;
  334|       |
  335|    270|    dua = duhd->au_arches;
  336|    621|    for ( ; i < duhd->au_count; ++i,++fa,++dua) {
  ------------------
  |  Branch (336:13): [True: 574, False: 47]
  ------------------
  337|    574|        ASNAR(word_swap,dua->au_cputype,fa->cputype);
  ------------------
  |  |   53|    574|    do {                                        \
  |  |   54|    574|        (t) = 0;                                \
  |  |   55|    574|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    574|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 574]
  |  |  ------------------
  ------------------
  338|    574|        ASNAR(word_swap,dua->au_cpusubtype,fa->cpusubtype);
  ------------------
  |  |   53|    574|    do {                                        \
  |  |   54|    574|        (t) = 0;                                \
  |  |   55|    574|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    574|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 574]
  |  |  ------------------
  ------------------
  339|    574|        ASNAR(word_swap,dua->au_offset,fa->offset);
  ------------------
  |  |   53|    574|    do {                                        \
  |  |   54|    574|        (t) = 0;                                \
  |  |   55|    574|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    574|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 574]
  |  |  ------------------
  ------------------
  340|    574|        if (dua->au_offset >= duhd->au_filesize) {
  ------------------
  |  Branch (340:13): [True: 85, False: 489]
  ------------------
  341|     85|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|     85|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
  342|     85|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     85|#define DW_DLV_ERROR      1
  ------------------
  343|     85|        }
  344|    489|        ASNAR(word_swap,dua->au_size,fa->size);
  ------------------
  |  |   53|    489|    do {                                        \
  |  |   54|    489|        (t) = 0;                                \
  |  |   55|    489|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    489|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 489]
  |  |  ------------------
  ------------------
  345|    489|        if (dua->au_size >= duhd->au_filesize) {
  ------------------
  |  Branch (345:13): [True: 84, False: 405]
  ------------------
  346|     84|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|     84|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
  347|     84|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     84|#define DW_DLV_ERROR      1
  ------------------
  348|     84|        }
  349|    405|        if ((dua->au_size+dua->au_offset) > duhd->au_filesize) {
  ------------------
  |  Branch (349:13): [True: 26, False: 379]
  ------------------
  350|     26|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|     26|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
  351|     26|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     26|#define DW_DLV_ERROR      1
  ------------------
  352|     26|        }
  353|    379|        ASNAR(word_swap,dua->au_align,fa->align);
  ------------------
  |  |   53|    379|    do {                                        \
  |  |   54|    379|        (t) = 0;                                \
  |  |   55|    379|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    379|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 379]
  |  |  ------------------
  ------------------
  354|    379|        if (dua->au_align >= 32) {
  ------------------
  |  Branch (354:13): [True: 28, False: 351]
  ------------------
  355|     28|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|     28|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
  356|     28|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     28|#define DW_DLV_ERROR      1
  ------------------
  357|     28|        }
  358|    351|        ASNAR(word_swap,dua->au_reserved,fa->reserved);
  ------------------
  |  |   53|    351|    do {                                        \
  |  |   54|    351|        (t) = 0;                                \
  |  |   55|    351|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    351|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 351]
  |  |  ------------------
  ------------------
  359|    351|    }
  360|     47|    return DW_DLV_OK;
  ------------------
  |  |   59|     47|#define DW_DLV_OK         0
  ------------------
  361|    270|}

_dwarf_free_static_errlist:
  296|  10.5k|{
  297|  10.5k|    unsigned i = 0;
  298|       |
  299|  10.5k|    for ( ; i <static_used; ++i) {
  ------------------
  |  Branch (299:13): [True: 0, False: 10.5k]
  ------------------
  300|      0|        Dwarf_Error e = staticerrlist[i];
  301|      0|        if (e) {
  ------------------
  |  Branch (301:13): [True: 0, False: 0]
  ------------------
  302|      0|            dw_empty_errlist_item(e);
  303|      0|            staticerrlist[i] = 0;
  304|      0|        }
  305|      0|    }
  306|  10.5k|}
_dwarf_get_alloc:
  630|     60|{
  631|     60|    char * alloc_mem = 0;
  632|     60|    Dwarf_Unsigned basesize = 0;
  633|     60|    Dwarf_Unsigned size = 0;
  634|     60|    unsigned int type = alloc_type;
  635|     60|    short action = 0;
  636|       |
  637|     60|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|     60|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|     60|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   33|      0|#define TRUE 1
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   36|     60|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 0, False: 60]
  |  |  |  Branch (159:7): [True: 0, False: 60]
  |  |  |  Branch (159:15): [True: 0, False: 60]
  |  |  ------------------
  ------------------
  638|       |#if DEBUG_ALLOC
  639|       |        printf("libdwarfdetector ALLOC dbg null  "
  640|       |            "ret NULL type 0x%x size %lu line %d %s\n",
  641|       |            (unsigned)alloc_type,(unsigned long)size,
  642|       |            __LINE__,__FILE__);
  643|       |        fflush(stdout);
  644|       |#endif /* DEBUG_ALLOC */
  645|      0|        return NULL;
  646|      0|    }
  647|     60|    if (type >= ALLOC_AREA_INDEX_TABLE_MAX) {
  ------------------
  |  |   48|     60|#define ALLOC_AREA_INDEX_TABLE_MAX 66
  ------------------
  |  Branch (647:9): [True: 0, False: 60]
  ------------------
  648|       |        /* internal error */
  649|       |#if DEBUG_ALLOC
  650|       |        printf("libdwarfdetector ALLOC type bad ret null  "
  651|       |            "ret NULL type 0x%x size %lu line %d %s\n",
  652|       |            (unsigned)alloc_type,(unsigned long)size,
  653|       |            __LINE__,__FILE__);
  654|       |        fflush(stdout);
  655|       |#endif /* DEBUG_ALLOC */
  656|      0|        return NULL;
  657|      0|    }
  658|     60|    basesize = alloc_instance_basics[alloc_type].ia_struct_size;
  659|     60|    action = alloc_instance_basics[alloc_type].ia_multiply_count;
  660|     60|    if (action == MULTIPLY_NO) {
  ------------------
  |  |   91|     60|#define MULTIPLY_NO 0
  ------------------
  |  Branch (660:9): [True: 60, False: 0]
  ------------------
  661|       |        /* Usually count is 1, but do not assume it. */
  662|     60|        size = basesize;
  663|     60|    } else if (action == MULTIPLY_CT) {
  ------------------
  |  |   92|      0|#define MULTIPLY_CT 1
  ------------------
  |  Branch (663:16): [True: 0, False: 0]
  ------------------
  664|      0|        size = basesize * count;
  665|      0|    }  else {
  666|       |        /* MULTIPLY_SP */
  667|       |        /* DW_DLA_ADDR.. count * largest size */
  668|      0|        size = count *
  669|      0|            (sizeof(Dwarf_Addr) > sizeof(Dwarf_Off) ?
  ------------------
  |  Branch (669:14): [Folded, False: 0]
  ------------------
  670|      0|            sizeof(Dwarf_Addr) : sizeof(Dwarf_Off));
  671|      0|    }
  672|     60|    size += DW_RESERVE;
  ------------------
  |  |  176|     60|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
  673|     60|    alloc_mem = malloc(size);
  674|     60|    if (!alloc_mem) {
  ------------------
  |  Branch (674:9): [True: 0, False: 60]
  ------------------
  675|      0|        return NULL;
  676|      0|    }
  677|     60|    {
  678|     60|        char * ret_mem = alloc_mem + DW_RESERVE;
  ------------------
  |  |  176|     60|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
  679|     60|        void *key = ret_mem;
  680|     60|        struct reserve_data_s *r = (struct reserve_data_s*)alloc_mem;
  681|     60|        void *result = 0;
  682|       |
  683|     60|        memset(alloc_mem, 0, size);
  684|       |        /* We are not actually using rd_dbg, we are using rd_type. */
  685|     60|        r->rd_dbg = dbg;
  686|     60|        r->rd_type = (unsigned short)alloc_type;
  687|       |        /*  The following is wrong for large records, but
  688|       |            it's not important, so let it be truncated.*/
  689|     60|        r->rd_length = (unsigned short)size;
  690|     60|        if (alloc_instance_basics[type].specialconstructor) {
  ------------------
  |  Branch (690:13): [True: 0, False: 60]
  ------------------
  691|      0|            int res = alloc_instance_basics[type].
  692|      0|                specialconstructor(dbg, ret_mem);
  693|      0|            if (res != DW_DLV_OK) {
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
  |  Branch (693:17): [True: 0, False: 0]
  ------------------
  694|       |                /*  We leak what we allocated in
  695|       |                    _dwarf_find_memory when
  696|       |                    constructor fails. */
  697|       |#if DEBUG_ALLOC
  698|       |    printf("libdwarfdetector ALLOC constructor fails ret NULL "
  699|       |        "type 0x%x size %lu line %d %s\n",
  700|       |        (unsigned)alloc_type,(unsigned long)size,__LINE__,__FILE__);
  701|       |    fflush(stdout);
  702|       |#endif /* DEBUG_ALLOC */
  703|      0|                return NULL;
  704|      0|            }
  705|      0|        }
  706|       |        /*  See global flag.
  707|       |            If zero then caller chooses not
  708|       |            to track allocations, so dwarf_finish()
  709|       |            is unable to free anything the caller
  710|       |            omitted to dealloc. Normally
  711|       |            the global flag is non-zero */
  712|       |        /*  As of March 14, 2020 it's
  713|       |            not necessary to test for alloc type, but instead
  714|       |            only call tsearch if de_alloc_tree_on. */
  715|     60|        if (global_de_alloc_tree_on) {
  ------------------
  |  Branch (715:13): [True: 60, False: 0]
  ------------------
  716|     60|            result = dwarf_tsearch((void *)key,
  ------------------
  |  |   76|     60|#define dwarf_tsearch  _dwarf_tsearch
  ------------------
  717|     60|                &dbg->de_alloc_tree,simple_compare_function);
  718|     60|            if (!result) {
  ------------------
  |  Branch (718:17): [True: 0, False: 60]
  ------------------
  719|       |                /*  Something badly wrong. Out of memory.
  720|       |                    pretend all is well. */
  721|      0|            }
  722|     60|        }
  723|       |#if DEBUG_ALLOC
  724|       |        printf("\nlibdwarfdetector ALLOC ret 0x%lx type 0x%x "
  725|       |            "size %lu line %d %s\n",
  726|       |            (unsigned long)ret_mem,(unsigned)alloc_type,
  727|       |            (unsigned long)size,__LINE__,__FILE__);
  728|       |        fflush(stdout);
  729|       |#endif /* DEBUG_ALLOC */
  730|     60|        return (ret_mem);
  731|     60|    }
  732|     60|}
dwarf_set_load_preference:
  780|  2.75k|{
  781|  2.75k|    enum Dwarf_Sec_Alloc_Pref prev_load_pref =
  782|  2.75k|        _dwarf_global_load_preference;
  783|  2.75k|#ifdef HAVE_FULL_MMAP
  784|       |    /*  Only set the preference if MMAP is available. */
  785|  2.75k|    switch(dw_load_preference) {
  786|      0|    case  Dwarf_Alloc_Malloc:
  ------------------
  |  Branch (786:5): [True: 0, False: 2.75k]
  ------------------
  787|      0|    case  Dwarf_Alloc_Mmap:
  ------------------
  |  Branch (787:5): [True: 0, False: 2.75k]
  ------------------
  788|      0|        _dwarf_global_load_preference = dw_load_preference;
  789|      0|        break;
  790|  2.75k|    case  Dwarf_Alloc_None:
  ------------------
  |  Branch (790:5): [True: 2.75k, False: 0]
  ------------------
  791|  2.75k|        break; /* ignore */
  792|      0|    default: break;
  ------------------
  |  Branch (792:5): [True: 0, False: 2.75k]
  ------------------
  793|  2.75k|    }
  794|       |#else
  795|       |    (void)dw_load_preference;
  796|       |#endif
  797|  2.75k|    return prev_load_pref;
  798|  2.75k|}
_dwarf_determine_section_allocation_type:
  852|  2.51k|{
  853|       |#ifndef HAVE_FULL_MMAP
  854|       |    return _dwarf_global_load_preference;
  855|       |#else
  856|  2.51k|    char *whichalloc = getenv("DWARF_WHICH_ALLOC");
  857|       |
  858|  2.51k|    if (whichalloc) {
  ------------------
  |  Branch (858:9): [True: 0, False: 2.51k]
  ------------------
  859|      0|        if (!strcmp(whichalloc,"mmap")) {
  ------------------
  |  Branch (859:13): [True: 0, False: 0]
  ------------------
  860|      0|            dwarf_set_load_preference(Dwarf_Alloc_Mmap);
  861|      0|            return Dwarf_Alloc_Mmap;
  862|      0|        }
  863|      0|        if (!strcmp(whichalloc,"malloc")) {
  ------------------
  |  Branch (863:13): [True: 0, False: 0]
  ------------------
  864|      0|            dwarf_set_load_preference(Dwarf_Alloc_Malloc);
  865|      0|            return Dwarf_Alloc_Malloc;
  866|      0|        }
  867|      0|    }
  868|  2.51k|    return _dwarf_global_load_preference;
  869|  2.51k|#endif /* HAVE_FULL_MMAP */
  870|  2.51k|}
dwarf_dealloc:
  955|     60|{
  956|     60|    unsigned int type = 0;
  957|     60|    char * malloc_addr = 0;
  958|     60|    struct reserve_data_s * r = 0;
  959|       |
  960|     60|    if (!space) {
  ------------------
  |  Branch (960:9): [True: 0, False: 60]
  ------------------
  961|       |#ifdef DEBUG_ALLOC
  962|       |        printf("DEALLOC does nothing, space NULL line %d %s\n",
  963|       |            __LINE__,__FILE__);
  964|       |        fflush(stdout);
  965|       |#endif /* DEBUG_ALLOC*/
  966|      0|        return;
  967|      0|    }
  968|     60|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|     60|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|     60|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   33|      0|#define TRUE 1
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   36|     60|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 0, False: 60]
  |  |  |  Branch (159:7): [True: 0, False: 60]
  |  |  |  Branch (159:15): [True: 0, False: 60]
  |  |  ------------------
  ------------------
  969|       |        /*  App error, or an app that failed in a
  970|       |            dwarf_init*() or dwarf_elf_init*() call.
  971|       |
  972|       |        */
  973|      0|        dw_empty_errlist_item(space);
  974|       |#ifdef DEBUG_ALLOC
  975|       |        printf( "DEALLOC dbg NULL line %d %s\n",
  976|       |            __LINE__,__FILE__);
  977|       |        fflush(stdout);
  978|       |#endif /* DEBUG_ALLOC*/
  979|      0|        return;
  980|      0|    }
  981|     60|    if (space == (Dwarf_Ptr)&_dwarf_failsafe_error) {
  ------------------
  |  Branch (981:9): [True: 0, False: 60]
  ------------------
  982|       |#ifdef DEBUG_ALLOC
  983|       |        printf("DEALLOC failsafe requested at 0x%lx. "
  984|       |            "ignore. line %d %s\n",
  985|       |            (unsigned long)space,
  986|       |            __LINE__,__FILE__);
  987|       |        fflush(stdout);
  988|       |        return;
  989|       |#endif /* DEBUG_ALLOC*/
  990|      0|    }
  991|     60|    if (dbg && alloc_type == DW_DLA_ERROR) {
  ------------------
  |  |  995|     60|#define DW_DLA_ERROR           0x0e  /* Dwarf_Error */
  ------------------
  |  Branch (991:9): [True: 60, False: 0]
  |  Branch (991:16): [True: 0, False: 60]
  ------------------
  992|      0|        dbg = dbg->de_errors_dbg;
  993|      0|    }
  994|     60|    if (dbg && dbg->de_alloc_tree) {
  ------------------
  |  Branch (994:9): [True: 60, False: 0]
  |  Branch (994:16): [True: 60, False: 0]
  ------------------
  995|       |        /*  If it's a string in debug_info etc doing
  996|       |            (char *)space - DW_RESERVE is totally bogus. */
  997|     60|        if (alloc_type == DW_DLA_STRING &&
  ------------------
  |  |  982|    120|#define DW_DLA_STRING          0x01  /* char* */
  ------------------
  |  Branch (997:13): [True: 0, False: 60]
  ------------------
  998|      0|            string_is_in_debug_section(dbg,space)) {
  ------------------
  |  Branch (998:13): [True: 0, False: 0]
  ------------------
  999|       |            /*  A string pointer may point into .debug_info or
 1000|       |                .debug_string etc.
 1001|       |                So must not be freed.  And strings have
 1002|       |                no need of a specialdestructor().
 1003|       |                Mostly a historical mistake here.
 1004|       |                Corrected in libdwarf March 14,2020. */
 1005|       |#ifdef DEBUG_ALLOC
 1006|       |            printf( "DEALLOC string in section, no dealloc "
 1007|       |                "line %d %s\n", __LINE__,__FILE__);
 1008|       |            fflush(stdout);
 1009|       |#endif /* DEBUG_ALLOC*/
 1010|      0|            return;
 1011|      0|        }
 1012|     60|    }
 1013|       |    /*  Otherwise it might be allocated string so it is ok
 1014|       |        do the (char *)space - DW_RESERVE  */
 1015|       |
 1016|       |    /*  If it's a DW_DLA_STRING case and erroneous
 1017|       |        the following pointer operations might
 1018|       |        result in a coredump if the pointer
 1019|       |        is to the beginning of a string section.
 1020|       |        If not DW_DLA_STRING
 1021|       |        no correctly written caller could coredump
 1022|       |        here.  */
 1023|     60|    if ((uintptr_t)space > DW_RESERVE) {
  ------------------
  |  |  176|     60|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
  |  Branch (1023:9): [True: 60, False: 0]
  ------------------
 1024|     60|        malloc_addr = (char *)space - DW_RESERVE;
  ------------------
  |  |  176|     60|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
 1025|     60|    } else {
 1026|       |        /* Impossible */
 1027|      0|        return;
 1028|      0|    }
 1029|     60|    r =(struct reserve_data_s *)malloc_addr;
 1030|     60|    if (dbg && dbg != r->rd_dbg) {
  ------------------
  |  Branch (1030:9): [True: 60, False: 0]
  |  Branch (1030:16): [True: 0, False: 60]
  ------------------
 1031|       |        /*  Mixed up or originally a no_dbg alloc */
 1032|       |#ifdef DEBUG_ALLOC
 1033|       |        printf("DEALLOC find was NULL  dbg 0x%lx "
 1034|       |            "rd_dbg 0x%lx space 0x%lx line %d %s\n",
 1035|       |            (unsigned long)dbg,
 1036|       |            (unsigned long)r->rd_dbg,
 1037|       |            (unsigned long)space,
 1038|       |            __LINE__,__FILE__);
 1039|       |        fflush(stdout);
 1040|       |#endif /* DEBUG_ALLOC*/
 1041|      0|    }
 1042|     60|    if (dbg && alloc_type != r->rd_type) {
  ------------------
  |  Branch (1042:9): [True: 60, False: 0]
  |  Branch (1042:16): [True: 0, False: 60]
  ------------------
 1043|       |        /*  Something is mixed up. */
 1044|       |#ifdef DEBUG_ALLOC
 1045|       |        printf("DEALLOC does nothing, type 0x%lx rd_type 0x%lx"
 1046|       |            " space 0x%lx line %d %s\n",
 1047|       |            (unsigned long)alloc_type,
 1048|       |            (unsigned long)r->rd_type,
 1049|       |            (unsigned long)space,
 1050|       |            __LINE__,__FILE__);
 1051|       |        fflush(stdout);
 1052|       |#endif /* DEBUG_ALLOC*/
 1053|      0|        return;
 1054|      0|    }
 1055|     60|    if (alloc_type == DW_DLA_ERROR) {
  ------------------
  |  |  995|     60|#define DW_DLA_ERROR           0x0e  /* Dwarf_Error */
  ------------------
  |  Branch (1055:9): [True: 0, False: 60]
  ------------------
 1056|      0|        Dwarf_Error ep = (Dwarf_Error)space;
 1057|       |
 1058|      0|        if (ep->er_static_alloc == DE_STATIC) {
  ------------------
  |  |   46|      0|#define DE_STATIC 1   /* Using global static var */
  ------------------
  |  Branch (1058:13): [True: 0, False: 0]
  ------------------
 1059|       |            /*  This is special, malloc arena
 1060|       |                was exhausted or a NULL dbg
 1061|       |                was used for the error because the real
 1062|       |                dbg was unavailable.
 1063|       |                There is nothing to delete, really.
 1064|       |                Set er_errval to signal that the
 1065|       |                space was dealloc'd. */
 1066|      0|            _dwarf_failsafe_error.er_errval =
 1067|      0|                DW_DLE_FAILSAFE_ERRVAL;
  ------------------
  |  | 1319|      0|#define DW_DLE_FAILSAFE_ERRVAL                 273
  ------------------
 1068|      0|            _dwarf_error_destructor(ep);
 1069|       |#ifdef DEBUG_ALLOC
 1070|       |            printf("DEALLOC does nothing, DE_STATIC line %d %s\n",
 1071|       |                __LINE__,__FILE__);
 1072|       |            fflush(stdout);
 1073|       |#endif /* DEBUG_ALLOC*/
 1074|      0|            return;
 1075|      0|        }
 1076|      0|        if (ep->er_static_alloc == DE_MALLOC) {
  ------------------
  |  |   47|      0|#define DE_MALLOC 2   /* Using malloc space */
  ------------------
  |  Branch (1076:13): [True: 0, False: 0]
  ------------------
 1077|       |            /*  This is special, we had no arena
 1078|       |                but have a full special area as normal. */
 1079|       |#ifdef DEBUG_ALLOC
 1080|       |            printf("DEALLOC does free, DE_MALLOC line %d %s\n",
 1081|       |                __LINE__,__FILE__);
 1082|       |            fflush(stdout);
 1083|       |#endif /* DEBUG_ALLOC*/
 1084|      0|            _dwarf_remove_from_staticerrlist(space);
 1085|      0|        }
 1086|       |        /* Was normal alloc, use normal dealloc. */
 1087|       |        /* DW_DLA_ERROR has a specialdestructor */
 1088|      0|    }
 1089|       |    /*  alloc types are a defined library-private
 1090|       |        set of integers. Less than 256 of them. */
 1091|     60|    type = (unsigned int)alloc_type;
 1092|       |#if DEBUG_ALLOC
 1093|       |    if (dbg != r->rd_dbg) {
 1094|       |        printf("DEALLOC  dbg != rd_dbg"
 1095|       |            " going ahead line %d %s\n",
 1096|       |            __LINE__,__FILE__);
 1097|       |        fflush(stdout);
 1098|       |    }
 1099|       |    printf("libdwarfdetector DEALLOC ret 0x%lx type 0x%x "
 1100|       |        "size %lu line %d %s\n",
 1101|       |        (unsigned long)space,(unsigned)type,
 1102|       |        (unsigned long)r->rd_length,__LINE__,__FILE__);
 1103|       |#endif /* DEBUG_ALLOC*/
 1104|     60|    if (type >= ALLOC_AREA_INDEX_TABLE_MAX) {
  ------------------
  |  |   48|     60|#define ALLOC_AREA_INDEX_TABLE_MAX 66
  ------------------
  |  Branch (1104:9): [True: 0, False: 60]
  ------------------
 1105|       |        /* internal or user app error */
 1106|       |#ifdef DEBUG_ALLOC
 1107|       |        printf("DEALLOC does nothing, type too big %lu line %d %s\n",
 1108|       |            (unsigned long)type,
 1109|       |            __LINE__,__FILE__);
 1110|       |        fflush(stdout);
 1111|       |#endif /* DEBUG_ALLOC*/
 1112|      0|        return;
 1113|      0|    }
 1114|     60|    if (alloc_instance_basics[type].specialdestructor) {
  ------------------
  |  Branch (1114:9): [True: 0, False: 60]
  ------------------
 1115|      0|        alloc_instance_basics[type].specialdestructor(space);
 1116|      0|    }
 1117|     60|    if (dbg && dbg->de_alloc_tree) {
  ------------------
  |  Branch (1117:9): [True: 60, False: 0]
  |  Branch (1117:16): [True: 60, False: 0]
  ------------------
 1118|       |        /*  The 'space' pointer we get points after the
 1119|       |            reserve space.  The key is 'space'
 1120|       |            and address to free
 1121|       |            is just a few bytes before 'space'. */
 1122|     60|        void *key = space;
 1123|       |
 1124|     60|        dwarf_tdelete(key,&dbg->de_alloc_tree,
  ------------------
  |  |   78|     60|#define dwarf_tdelete  _dwarf_tdelete
  ------------------
 1125|     60|            simple_compare_function);
 1126|       |        /*  If dwarf_tdelete returns NULL it might mean
 1127|       |            a) tree is empty.
 1128|       |            b) If hashsearch, then a single chain might
 1129|       |                now be empty,
 1130|       |                so we do not know of a 'parent node'.
 1131|       |            c) We did not find that key, we did nothing.
 1132|       |
 1133|       |            In any case, we simply don't worry about it.
 1134|       |            Not Supposed To Happen. */
 1135|     60|    }
 1136|     60|    r->rd_dbg  = (void *)(uintptr_t)0xfeadbeef;
 1137|     60|    r->rd_length = 0;
 1138|     60|    r->rd_type = 0;
 1139|     60|    free(malloc_addr);
 1140|     60|    return;
 1141|     60|}
_dwarf_get_debug:
 1149|  3.37k|{
 1150|  3.37k|    Dwarf_Debug dbg;
 1151|       |
 1152|  3.37k|    dbg = (Dwarf_Debug) malloc(sizeof(struct Dwarf_Debug_s));
 1153|  3.37k|    if (!dbg) {
  ------------------
  |  Branch (1153:9): [True: 0, False: 3.37k]
  ------------------
 1154|      0|        return NULL;
 1155|      0|    }
 1156|  3.37k|    memset(dbg, 0, sizeof(struct Dwarf_Debug_s));
 1157|       |    /* Set up for a dwarf_tsearch hash table */
 1158|  3.37k|    dbg->de_magic = DBG_IS_VALID;
  ------------------
  |  |  596|  3.37k|#define DBG_IS_VALID 0xebfdebfd
  ------------------
 1159|       |
 1160|       |    /*  See also dwarf_tsearchhash.c the prime number
 1161|       |        table 'primes[]'. */
 1162|  3.37k|#define INIT_HASH_INIT_LIMIT 2000000
 1163|  3.37k|    if (global_de_alloc_tree_on) {
  ------------------
  |  Branch (1163:9): [True: 3.37k, False: 0]
  ------------------
 1164|       |        /*  The type of the dwarf_initialize_search_hash
 1165|       |            initial-size argument */
 1166|  3.37k|        unsigned long size_est = (unsigned long)(filesize/30);
 1167|       |
 1168|  3.37k|        if (size_est > INIT_HASH_INIT_LIMIT) {
  ------------------
  |  | 1162|  3.37k|#define INIT_HASH_INIT_LIMIT 2000000
  ------------------
  |  Branch (1168:13): [True: 0, False: 3.37k]
  ------------------
 1169|      0|            size_est = INIT_HASH_INIT_LIMIT;
  ------------------
  |  | 1162|      0|#define INIT_HASH_INIT_LIMIT 2000000
  ------------------
 1170|      0|        }
 1171|       |#ifdef TESTINGHASHTAB
 1172|       |        printf("debugging: src filesize %lu hashtab init %lu\n",
 1173|       |            (unsigned long)filesize,size_est);
 1174|       |#endif
 1175|  3.37k|        dwarf_initialize_search_hash(&dbg->de_alloc_tree,
  ------------------
  |  |   82|  3.37k|#define dwarf_initialize_search_hash _dwarf_initialize_search_hash
  ------------------
 1176|  3.37k|            simple_value_hashfunc,size_est);
 1177|  3.37k|    }
 1178|  3.37k|    return dbg;
 1179|  3.37k|}
_dwarf_malloc_section_free:
 1188|   102k|{
 1189|       |    /*  Compressed sections will be malloc not mmap
 1190|       |        by the time we get here.
 1191|       |        No matter what the preference was.  */
 1192|   102k|    switch(sec->dss_actual_load_type) {
 1193|  1.79k|    case Dwarf_Alloc_Malloc:
  ------------------
  |  Branch (1193:5): [True: 1.79k, False: 100k]
  ------------------
 1194|  1.79k|        if (sec->dss_was_alloc) {
  ------------------
  |  Branch (1194:13): [True: 0, False: 1.79k]
  ------------------
 1195|      0|            free(sec->dss_data);
 1196|      0|        }
 1197|  1.79k|        break;
 1198|      0|    case Dwarf_Alloc_Mmap:
  ------------------
  |  Branch (1198:5): [True: 0, False: 102k]
  ------------------
 1199|      0|#ifdef HAVE_FULL_MMAP
 1200|      0|        if (sec->dss_was_alloc) {
  ------------------
  |  Branch (1200:13): [True: 0, False: 0]
  ------------------
 1201|      0|            int res = munmap(sec->dss_mmap_realarea,
 1202|      0|                sec->dss_computed_mmap_len);
 1203|       |#ifdef DEBUG_ALLOC
 1204|       |            if (res) {
 1205|       |                printf("FAILED to munmap!\n");
 1206|       |                fflush(stdout);
 1207|       |            }
 1208|       |#endif /* DEBUG_ALLOC */
 1209|      0|            (void)res; /* To avoid compiler warning. */
 1210|      0|        }
 1211|      0|#endif /* HAVE_FULL_MMAP */
 1212|      0|        break;
 1213|   100k|    case Dwarf_Alloc_None:
  ------------------
  |  Branch (1213:5): [True: 100k, False: 1.79k]
  ------------------
 1214|   100k|    default:
  ------------------
  |  Branch (1214:5): [True: 0, False: 102k]
  ------------------
 1215|   100k|    break;
 1216|   102k|    }
 1217|   102k|    sec->dss_data = 0;
 1218|       |    /* sec->dss_size = 0; */
 1219|   102k|    sec->dss_was_alloc = FALSE;
  ------------------
  |  |   36|   102k|#define FALSE 0
  ------------------
 1220|   102k|    sec->dss_mmap_realarea = 0;
 1221|   102k|    sec->dss_computed_mmap_len = 0;
 1222|   102k|    sec->dss_computed_mmap_offset = 0;
 1223|   102k|}
_dwarf_free_all_of_one_debug:
 1261|  3.37k|{
 1262|  3.37k|    unsigned g = 0;
 1263|       |
 1264|  3.37k|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|  3.37k|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|  3.37k|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   33|      0|#define TRUE 1
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   36|  3.37k|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 0, False: 3.37k]
  |  |  |  Branch (159:7): [True: 0, False: 3.37k]
  |  |  |  Branch (159:15): [True: 0, False: 3.37k]
  |  |  ------------------
  ------------------
 1265|      0|        _dwarf_free_static_errlist();
 1266|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
 1267|      0|    }
 1268|       |    /*  To do complete validation that we have no surprising
 1269|       |        missing or erroneous deallocs it is advisable to do
 1270|       |        the dwarf_deallocs here
 1271|       |        that are not things the user can otherwise request.
 1272|       |        Housecleaning.  */
 1273|  3.37k|    if (dbg->de_cu_hashindex_data) {
  ------------------
  |  Branch (1273:9): [True: 11, False: 3.36k]
  ------------------
 1274|     11|        dwarf_dealloc_xu_header(dbg->de_cu_hashindex_data);
 1275|     11|        dbg->de_cu_hashindex_data = 0;
 1276|     11|    }
 1277|  3.37k|    if (dbg->de_tu_hashindex_data) {
  ------------------
  |  Branch (1277:9): [True: 16, False: 3.35k]
  ------------------
 1278|     16|        dwarf_dealloc_xu_header(dbg->de_tu_hashindex_data);
 1279|     16|        dbg->de_tu_hashindex_data = 0;
 1280|     16|    }
 1281|  3.37k|    if (dbg->de_printf_callback_null_device_handle) {
  ------------------
  |  Branch (1281:9): [True: 0, False: 3.37k]
  ------------------
 1282|      0|        fclose(dbg->de_printf_callback_null_device_handle);
 1283|      0|        dbg->de_printf_callback_null_device_handle = 0;
 1284|      0|    }
 1285|  3.37k|    freecontextlist(dbg,&dbg->de_info_reading);
 1286|  3.37k|    freecontextlist(dbg,&dbg->de_types_reading);
 1287|       |    /* Housecleaning done. Now really free all the space. */
 1288|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_info);
 1289|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_types);
 1290|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_abbrev);
 1291|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_line);
 1292|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_line_str);
 1293|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_loc);
 1294|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_aranges);
 1295|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_macinfo);
 1296|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_macro);
 1297|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_names);
 1298|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_pubnames);
 1299|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_str);
 1300|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_sup);
 1301|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_frame);
 1302|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_frame_eh_gnu);
 1303|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_pubtypes);
 1304|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_funcnames);
 1305|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_typenames);
 1306|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_varnames);
 1307|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_weaknames);
 1308|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_ranges);
 1309|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_str_offsets);
 1310|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_addr);
 1311|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_gdbindex);
 1312|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_cu_index);
 1313|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_tu_index);
 1314|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_loclists);
 1315|  3.37k|    _dwarf_malloc_section_free(&dbg->de_debug_rnglists);
 1316|  3.37k|    _dwarf_malloc_section_free(&dbg->de_gnu_debuglink);
 1317|  3.37k|    _dwarf_malloc_section_free(&dbg->de_note_gnu_buildid);
 1318|  3.37k|    _dwarf_harmless_cleanout(&dbg->de_harmless_errors);
 1319|       |
 1320|  3.37k|    _dwarf_dealloc_rnglists_context(dbg);
 1321|  3.37k|    _dwarf_dealloc_loclists_context(dbg);
 1322|  3.37k|    if (dbg->de_printf_callback.dp_buffer &&
  ------------------
  |  Branch (1322:9): [True: 0, False: 3.37k]
  ------------------
 1323|      0|        !dbg->de_printf_callback.dp_buffer_user_provided ) {
  ------------------
  |  Branch (1323:9): [True: 0, False: 0]
  ------------------
 1324|      0|        free(dbg->de_printf_callback.dp_buffer);
 1325|      0|    }
 1326|  3.37k|    _dwarf_destroy_group_map(dbg);
 1327|       |    /*  de_alloc_tree might be NULL if
 1328|       |        global_de_alloc_tree_on is zero. */
 1329|  3.37k|    if (dbg->de_alloc_tree) {
  ------------------
  |  Branch (1329:9): [True: 3.37k, False: 0]
  ------------------
 1330|  3.37k|        dbg->de_in_tdestroy = TRUE;
  ------------------
  |  |   33|  3.37k|#define TRUE 1
  ------------------
 1331|  3.37k|        dwarf_tdestroy(dbg->de_alloc_tree,tdestroy_free_node);
  ------------------
  |  |   80|  3.37k|#define dwarf_tdestroy _dwarf_tdestroy
  ------------------
 1332|  3.37k|        dbg->de_in_tdestroy = FALSE;
  ------------------
  |  |   36|  3.37k|#define FALSE 0
  ------------------
 1333|  3.37k|        dbg->de_alloc_tree = 0;
 1334|  3.37k|    }
 1335|  3.37k|    _dwarf_free_static_errlist();
 1336|       |    /*  first, walk the search and free()
 1337|       |        contents. */
 1338|       |    /*  Now  do the search tree itself */
 1339|  3.37k|    if (dbg->de_tied_data.td_tied_search) {
  ------------------
  |  Branch (1339:9): [True: 0, False: 3.37k]
  ------------------
 1340|      0|        dwarf_tdestroy(dbg->de_tied_data.td_tied_search,
  ------------------
  |  |   80|      0|#define dwarf_tdestroy _dwarf_tdestroy
  ------------------
 1341|      0|            _dwarf_tied_destroy_free_node);
 1342|      0|        dbg->de_tied_data.td_tied_search = 0;
 1343|      0|    }
 1344|  3.37k|    free((void *)dbg->de_path);
 1345|  3.37k|    dbg->de_path = 0;
 1346|  5.52k|    for (g = 0; g < dbg->de_gnu_global_path_count; ++g) {
  ------------------
  |  Branch (1346:17): [True: 2.15k, False: 3.37k]
  ------------------
 1347|  2.15k|        free((char *)dbg->de_gnu_global_paths[g]);
 1348|  2.15k|        dbg->de_gnu_global_paths[g] = 0;
 1349|  2.15k|    }
 1350|  3.37k|    free((void*)dbg->de_gnu_global_paths);
 1351|  3.37k|    dbg->de_gnu_global_paths = 0;
 1352|  3.37k|    dbg->de_gnu_global_path_count = 0;
 1353|  3.37k|    memset(dbg, 0, sizeof(*dbg)); /* Prevent accidental use later. */
 1354|  3.37k|    free(dbg);
 1355|  3.37k|    return DW_DLV_OK;
  ------------------
  |  |  122|  3.37k|#define DW_DLV_OK        0
  ------------------
 1356|  3.37k|}
dwarf_alloc.c:simple_compare_function:
  599|     60|{
  600|     60|    DW_TSHASHTYPE lp = (DW_TSHASHTYPE)(uintptr_t)l;
  ------------------
  |  |   54|     60|#define DW_TSHASHTYPE uintptr_t
  ------------------
  601|     60|    DW_TSHASHTYPE rp = (DW_TSHASHTYPE)(uintptr_t)r;
  ------------------
  |  |   54|     60|#define DW_TSHASHTYPE uintptr_t
  ------------------
  602|     60|    if (lp < rp) {
  ------------------
  |  Branch (602:9): [True: 0, False: 60]
  ------------------
  603|      0|        return -1;
  604|      0|    }
  605|     60|    if (lp > rp) {
  ------------------
  |  Branch (605:9): [True: 0, False: 60]
  ------------------
  606|      0|        return 1;
  607|      0|    }
  608|     60|    return 0;
  609|     60|}
dwarf_alloc.c:simple_value_hashfunc:
  549|    120|{
  550|    120|    DW_TSHASHTYPE up = (DW_TSHASHTYPE)(uintptr_t)keyp;
  ------------------
  |  |   54|    120|#define DW_TSHASHTYPE uintptr_t
  ------------------
  551|    120|    return up;
  552|    120|}
dwarf_alloc.c:freecontextlist:
 1227|  6.75k|{
 1228|  6.75k|    Dwarf_CU_Context context = 0;
 1229|  6.75k|    Dwarf_CU_Context nextcontext = 0;
 1230|  6.75k|    for (context = dis->de_cu_context_list;
 1231|  6.75k|        context; context = nextcontext) {
  ------------------
  |  Branch (1231:9): [True: 0, False: 6.75k]
  ------------------
 1232|      0|        Dwarf_Hash_Table hash_table = 0;
 1233|       |
 1234|      0|        hash_table = context->cc_abbrev_hash_table;
 1235|       |
 1236|      0|        _dwarf_free_abbrev_hash_table_contents(hash_table,
 1237|      0|            FALSE);
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
 1238|      0|        hash_table->tb_entries = 0;
 1239|      0|        nextcontext = context->cc_next;
 1240|      0|        context->cc_next = 0;
 1241|       |        /*  See also  local_dealloc_cu_context() in
 1242|       |            dwarf_die_deliv.c */
 1243|      0|        free(hash_table);
 1244|      0|        context->cc_abbrev_hash_table = 0;
 1245|      0|        dwarf_dealloc(dbg, context, DW_DLA_CU_CONTEXT);
  ------------------
  |  |  106|      0|#define DW_DLA_CU_CONTEXT       0x20
  ------------------
 1246|      0|    }
 1247|  6.75k|    dis->de_cu_context_list = 0;
 1248|  6.75k|}

_dwarf_pathjoinl:
  236|    659|{
  237|    659|    char *inputs = dwarfstring_string(input);
  238|    659|    char *targ = dwarfstring_string(target);
  239|    659|    size_t targlenszt = 0;
  240|       |#if defined (_WIN32)
  241|       |    /*  Assuming we are in mingw msys2 or equivalent.
  242|       |        If we are reading a Windows object file but
  243|       |        running non-Windows this won't happen
  244|       |        but debuglink won't be useful anyway. */
  245|       |    dwarfstring winput;
  246|       |
  247|       |    dwarfstring_constructor_static(&winput,winbuf,sizeof(winbuf));
  248|       |    transform_to_posix_slash(&winput,inputs);
  249|       |    targlenszt = dwarfstring_strlen(target);
  250|       |    inputs = dwarfstring_string(&winput);
  251|       |    if (!targlenszt) {
  252|       |        dwarfstring_append(target,inputs);
  253|       |        return DW_DLV_OK;
  254|       |    }
  255|       |#else /* !_Windows */
  256|    659|    targlenszt = dwarfstring_strlen(target);
  257|    659|#endif /* _WIN32 */
  258|       |
  259|    659|    if (!targlenszt) {
  ------------------
  |  Branch (259:9): [True: 310, False: 349]
  ------------------
  260|    310|        dwarfstring_append(target,inputs);
  261|    310|        return DW_DLV_OK;
  ------------------
  |  |  122|    310|#define DW_DLV_OK        0
  ------------------
  262|    310|    }
  263|    349|    targ = dwarfstring_string(target);
  264|    349|    if (!is_full_path(targ+targlenszt-1)) {
  ------------------
  |  Branch (264:9): [True: 259, False: 90]
  ------------------
  265|    259|        if (!is_full_path(inputs)) {
  ------------------
  |  Branch (265:13): [True: 257, False: 2]
  ------------------
  266|    257|            dwarfstring_append(target,joinstr);
  267|    257|            dwarfstring_append(target,inputs);
  268|    257|        } else {
  269|      2|            dwarfstring_append(target,inputs);
  270|      2|        }
  271|    259|    } else {
  272|     90|        if (!is_full_path(inputs)) {
  ------------------
  |  Branch (272:13): [True: 86, False: 4]
  ------------------
  273|     86|            dwarfstring_append(target,inputs);
  274|     86|        } else {
  275|      4|            dwarfstring_append(target,inputs+1);
  276|      4|        }
  277|     90|    }
  278|       |#if defined (_WIN32)
  279|       |    dwarfstring_destructor(&winput);
  280|       |#endif /* _WIN32 */
  281|    349|    return DW_DLV_OK;
  ------------------
  |  |  122|    349|#define DW_DLV_OK        0
  ------------------
  282|    659|}
_dwarf_construct_linkedto_path:
  618|    110|{
  619|    110|    char * pathname = pathname_in;
  620|    110|    int               res = 0;
  621|    110|    struct joins_s    joind;
  622|    110|    size_t            dirnamelen = 0;
  623|    110|    struct dwarfstring_list_s  base_dwlist;
  624|    110|    struct dwarfstring_list_s *last_entry = 0;
  625|       |
  626|    110|    dwarfstring_list_constructor(&base_dwlist);
  627|    110|    construct_js(&joind);
  628|    110|    dirnamelen = mydirlen(pathname);
  629|    110|    if (dirnamelen) {
  ------------------
  |  Branch (629:9): [True: 0, False: 110]
  ------------------
  630|       |        /*  Original dirname, before cwd (if needed) */
  631|      0|        dwarfstring_append_length(&joind.js_tmp2,
  632|      0|            pathname,dirnamelen);
  633|      0|    }
  634|    110|    if (!is_full_path(pathname)) {
  ------------------
  |  Branch (634:9): [True: 110, False: 0]
  ------------------
  635|       |        /*  Meaning a/b or b, not /a/b or /b ,
  636|       |            so we apply cwd */
  637|    110|        char  buffer[2000];
  638|    110|        unsigned buflen= sizeof(buffer);
  639|    110|        char *wdret = 0;
  640|       |
  641|    110|        buffer[0] = 0;
  642|    110|        wdret = getcwd(buffer,buflen);
  643|    110|        if (!wdret) {
  ------------------
  |  Branch (643:13): [True: 0, False: 110]
  ------------------
  644|       |            /* printf("getcwd() issue. Do nothing. "
  645|       |                " line  %d %s\n",__LINE__,__FILE__); */
  646|      0|            dwarfstring_list_destructor(&base_dwlist);
  647|      0|            destruct_js(&joind);
  648|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  649|      0|            return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  650|      0|        }
  651|    110|        dwarfstring_append(&joind.js_cwd,buffer);
  652|    110|    }
  653|       |    /* Applies to the leading chars in the named file */
  654|    110|    if (dwarfstring_strlen(&joind.js_tmp2) > 0) {
  ------------------
  |  Branch (654:9): [True: 0, False: 110]
  ------------------
  655|      0|        transform_leading_windowsletter(&joind.js_dirname,
  656|      0|            dwarfstring_string(&joind.js_tmp2));
  657|      0|    }
  658|    110|    dwarfstring_reset(&joind.js_tmp2);
  659|       |
  660|       |    /* Creating a real basename. No slashes. */
  661|    110|    dwarfstring_append(&joind.js_basenamesimple,
  662|    110|        pathname+dirnamelen);
  663|    110|    dwarfstring_append(&joind.js_basesimpledebug,
  664|    110|        dwarfstring_string(&joind.js_basenamesimple));
  665|    110|    dwarfstring_append(&joind.js_basesimpledebug,".debug");
  666|       |
  667|       |    /*  Now js_dirname / js_basenamesimple
  668|       |        are reflecting a full path  */
  669|       |
  670|       |    /*  saves the full path to the original
  671|       |        executable */
  672|    110|    dwarfstring_append(&joind.js_originalfullpath,
  673|    110|        dwarfstring_string(&joind.js_dirname));
  674|    110|    _dwarf_pathjoinl(&joind.js_originalfullpath,
  675|    110|        &joind.js_basenamesimple);
  676|       |
  677|    110|    build_buildid_filename(&joind.js_buildid_filename,
  678|    110|        buildid_length, buildid);
  679|       |    /*  The GNU buildid method of finding debug files.
  680|       |        No crc calculation required ever. */
  681|    110|    res = _dwarf_do_buildid_setup(buildid_length,
  682|    110|        global_prefixes_in,
  683|    110|        length_global_prefixes_in,
  684|    110|        &last_entry,
  685|    110|        &joind,
  686|    110|        &base_dwlist,errcode);
  687|    110|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|    110|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (687:9): [True: 0, False: 110]
  ------------------
  688|      0|        dwarfstring_list_destructor(&base_dwlist);
  689|      0|        destruct_js(&joind);
  690|      0|        return res;
  691|      0|    }
  692|       |
  693|       |    /*  The debug link method of finding debug files.
  694|       |        A crc calculation is required for full
  695|       |        checking.  Which can be slow if an object file is large.  */
  696|    110|    res = _dwarf_do_debuglink_setup(link_string_in,
  697|    110|        link_string_fullpath_out,
  698|    110|        global_prefixes_in,
  699|    110|        length_global_prefixes_in,
  700|    110|        &last_entry,
  701|    110|        &joind,&base_dwlist,errcode);
  702|    110|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|    110|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (702:9): [True: 0, False: 110]
  ------------------
  703|      0|        dwarfstring_list_destructor(&base_dwlist);
  704|      0|        destruct_js(&joind);
  705|      0|        return res;
  706|      0|    }
  707|       |
  708|       |    /*  Now malloc space for the pointer array
  709|       |        and the strings they point at so a simple
  710|       |        free by our caller will clean up
  711|       |        everything.  Copy the data from
  712|       |        base_dwlist to the new area. */
  713|    110|    {
  714|    110|        struct dwarfstring_list_s *cur = 0;
  715|    110|        char        **resultfullstring = 0;
  716|    110|        unsigned long count = 0;
  717|    110|        size_t        pointerarraysize = 0;
  718|    110|        size_t        sumstringlengths = 0;
  719|    110|        size_t        totalareasize = 0;
  720|    110|        size_t        setptrindex = 0;
  721|    110|        size_t        setstrindex = 0;
  722|       |
  723|    110|        cur = &base_dwlist;
  724|    417|        for ( ; cur ; cur = cur->dl_next) {
  ------------------
  |  Branch (724:17): [True: 307, False: 110]
  ------------------
  725|    307|            ++count;
  726|    307|            pointerarraysize += sizeof(void *);
  727|    307|            sumstringlengths +=
  728|    307|                dwarfstring_strlen(&cur->dl_string) +1;
  729|    307|        }
  730|       |        /*  Make a final null pointer in the pointer array. */
  731|    110|        pointerarraysize += sizeof(void *);
  732|    110|        totalareasize = pointerarraysize + sumstringlengths +8;
  733|    110|        resultfullstring = (char **)malloc(totalareasize);
  734|    110|        setstrindex = pointerarraysize;
  735|    110|        if (!resultfullstring) {
  ------------------
  |  Branch (735:13): [True: 0, False: 110]
  ------------------
  736|      0|            dwarfstring_list_destructor(&base_dwlist);
  737|      0|            destruct_js(&joind);
  738|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  739|      0|            return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  740|      0|        }
  741|    110|        memset(resultfullstring,0,totalareasize);
  742|    110|        cur = &base_dwlist;
  743|       |
  744|    417|        for ( ; cur ; cur = cur->dl_next,++setptrindex) {
  ------------------
  |  Branch (744:17): [True: 307, False: 110]
  ------------------
  745|    307|            char **iptr = (char **)((char *)resultfullstring +
  746|    307|                setptrindex*sizeof(void *));
  747|    307|            char *sptr = (char*)resultfullstring + setstrindex;
  748|    307|            char *msg = dwarfstring_string(&cur->dl_string);
  749|    307|            size_t slen = dwarfstring_strlen(&cur->dl_string);
  750|       |
  751|    307|            _dwarf_safe_strcpy(sptr,totalareasize - setstrindex,
  752|    307|                msg,slen);
  753|    307|            setstrindex += slen +1;
  754|    307|            *iptr = sptr;
  755|    307|        }
  756|    110|        *paths_out = resultfullstring;
  757|    110|        *paths_out_length = count;
  758|    110|    }
  759|      0|    dwarfstring_list_destructor(&base_dwlist);
  760|    110|    destruct_js(&joind);
  761|    110|    return DW_DLV_OK;
  ------------------
  |  |  122|    110|#define DW_DLV_OK        0
  ------------------
  762|    110|}
dwarf_gnu_debuglink:
  964|  8.26k|{
  965|  8.26k|    dwarfstring debuglink_fullpath;
  966|  8.26k|    int res = DW_DLV_ERROR;
  ------------------
  |  |  123|  8.26k|#define DW_DLV_ERROR     1
  ------------------
  967|  8.26k|    char * pathname = 0;
  968|  8.26k|    int errcode = 0;
  969|  8.26k|    struct Dwarf_Section_s * pdebuglink = 0;
  970|  8.26k|    struct Dwarf_Section_s * pbuildid = 0;
  971|       |
  972|  8.26k|    CHECK_DBG(dbg,error,"dwarf_gnu_debuglink()");
  ------------------
  |  |  190|  8.26k|    do {                                                      \
  |  |  191|  8.26k|        if (!(cd_dbg) || (cd_dbg)->de_magic != DBG_IS_VALID) {    \
  |  |  ------------------
  |  |  |  |  596|  1.07k|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |  |  Branch (191:13): [True: 7.18k, False: 1.07k]
  |  |  |  Branch (191:26): [True: 0, False: 1.07k]
  |  |  ------------------
  |  |  192|  7.18k|            _dwarf_error_string(NULL, (cd_er), DW_DLE_DBG_NULL, \
  |  |  ------------------
  |  |  |  | 1126|  7.18k|#define DW_DLE_DBG_NULL                         81
  |  |  ------------------
  |  |  193|  7.18k|                "DW_DLE_DBG_NULL: "                           \
  |  |  194|  7.18k|                "dbg argument to " cd_funcname                \
  |  |  195|  7.18k|                "either null or it contains"                  \
  |  |  196|  7.18k|                "a stale Dwarf_Debug pointer");               \
  |  |  197|  7.18k|            return DW_DLV_ERROR;                              \
  |  |  ------------------
  |  |  |  |  123|  7.18k|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  198|  7.18k|        }                                                     \
  |  |  199|  8.26k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (199:14): [Folded, False: 1.07k]
  |  |  ------------------
  ------------------
  973|  1.07k|    if (dbg->de_gnu_debuglink.dss_size) {
  ------------------
  |  Branch (973:9): [True: 334, False: 741]
  ------------------
  974|    334|        pdebuglink = &dbg->de_gnu_debuglink;
  975|    334|        res = _dwarf_load_section(dbg, pdebuglink,error);
  976|    334|        if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|    334|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (976:13): [True: 264, False: 70]
  ------------------
  977|    264|            return res;
  978|    264|        }
  979|    334|    }
  980|    811|    if (dbg->de_note_gnu_buildid.dss_size) {
  ------------------
  |  Branch (980:9): [True: 540, False: 271]
  ------------------
  981|    540|        pbuildid = &dbg->de_note_gnu_buildid;
  982|    540|        res = _dwarf_load_section(dbg, pbuildid,error);
  983|    540|        if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|    540|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (983:13): [True: 311, False: 229]
  ------------------
  984|    311|            return res;
  985|    311|        }
  986|    540|    }
  987|    500|    if (!pdebuglink && !pbuildid) {
  ------------------
  |  Branch (987:9): [True: 433, False: 67]
  |  Branch (987:24): [True: 211, False: 222]
  ------------------
  988|    211|        if (dbg->de_path) {
  ------------------
  |  Branch (988:13): [True: 0, False: 211]
  ------------------
  989|      0|            *debuglink_fullpath_returned = strdup(dbg->de_path);
  990|      0|            *debuglink_fullpath_length_returned =
  991|      0|            (unsigned)strlen(dbg->de_path);
  992|    211|        } else {
  993|    211|            *debuglink_fullpath_returned = 0;
  994|    211|            *debuglink_fullpath_length_returned = 0;
  995|    211|        }
  996|    211|        return DW_DLV_OK;
  ------------------
  |  |  122|    211|#define DW_DLV_OK        0
  ------------------
  997|    211|    }
  998|       |
  999|    289|    if (pbuildid) {
  ------------------
  |  Branch (999:9): [True: 229, False: 60]
  ------------------
 1000|       |        /* buildid does not involve calculating a crc at any point */
 1001|    229|        int buildidres = 0;
 1002|    229|        buildidres = _dwarf_extract_buildid(dbg,
 1003|    229|            pbuildid,
 1004|    229|            buildid_type_returned,
 1005|    229|            buildid_owner_name_returned,
 1006|    229|            buildid_returned,
 1007|    229|            buildid_length_returned,
 1008|    229|            error);
 1009|    229|        if (buildidres == DW_DLV_ERROR) {
  ------------------
  |  |  123|    229|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (1009:13): [True: 161, False: 68]
  ------------------
 1010|    161|            return buildidres;
 1011|    161|        }
 1012|    229|    }
 1013|    128|    if (pdebuglink) {
  ------------------
  |  Branch (1013:9): [True: 64, False: 64]
  ------------------
 1014|     64|        int linkres = 0;
 1015|       |
 1016|     64|        linkres = _dwarf_extract_debuglink(dbg,
 1017|     64|            pdebuglink,
 1018|     64|            debuglink_path_returned,
 1019|     64|            crc_returned,
 1020|     64|            error);
 1021|     64|        if (linkres == DW_DLV_ERROR) {
  ------------------
  |  |  123|     64|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (1021:13): [True: 18, False: 46]
  ------------------
 1022|     18|            return linkres;
 1023|     18|        }
 1024|     64|    }
 1025|    110|    dwarfstring_constructor(&debuglink_fullpath);
 1026|    110|    pathname = dbg->de_path?(char *)dbg->de_path:
  ------------------
  |  Branch (1026:16): [True: 0, False: 110]
  ------------------
 1027|    110|        "";
 1028|    110|    if (pathname && paths_returned) {
  ------------------
  |  Branch (1028:9): [True: 110, False: 0]
  |  Branch (1028:21): [True: 110, False: 0]
  ------------------
 1029|       |        /*  Caller wants paths created and returned. */
 1030|    110|        res =  _dwarf_construct_linkedto_path(
 1031|    110|            (char **)dbg->de_gnu_global_paths,
 1032|    110|            dbg->de_gnu_global_path_count,
 1033|    110|            pathname,
 1034|    110|            *debuglink_path_returned,
 1035|    110|            &debuglink_fullpath,
 1036|    110|            *buildid_returned,
 1037|    110|            *buildid_length_returned,
 1038|    110|            paths_returned,
 1039|    110|            paths_count_returned,
 1040|    110|            &errcode);
 1041|    110|        if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|    110|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (1041:13): [True: 0, False: 110]
  ------------------
 1042|      0|            dwarfstring_destructor(&debuglink_fullpath);
 1043|      0|            return res;
 1044|      0|        }
 1045|    110|        if (dwarfstring_strlen(&debuglink_fullpath)) {
  ------------------
  |  Branch (1045:13): [True: 42, False: 68]
  ------------------
 1046|     42|            *debuglink_fullpath_returned =
 1047|     42|                strdup(dwarfstring_string(&debuglink_fullpath));
 1048|     42|            *debuglink_fullpath_length_returned =
 1049|     42|                (unsigned)dwarfstring_strlen(&debuglink_fullpath);
 1050|     42|        }
 1051|    110|    } else if (paths_count_returned) {
  ------------------
  |  Branch (1051:16): [True: 0, False: 0]
  ------------------
 1052|      0|        *paths_count_returned = 0;
 1053|      0|    } else {
 1054|       |        /* nothing special to do */
 1055|      0|    }
 1056|    110|    dwarfstring_destructor(&debuglink_fullpath);
 1057|    110|    return DW_DLV_OK;
  ------------------
  |  |  122|    110|#define DW_DLV_OK        0
  ------------------
 1058|    110|}
dwarf_add_debuglink_global_path:
 1069|  9.33k|{
 1070|  9.33k|    unsigned    glpath_count_in = 0;
 1071|  9.33k|    unsigned    glpath_count_out = 0;
 1072|  9.33k|    char      **glpaths = 0;
 1073|  9.33k|    char       *path1 = 0;
 1074|       |
 1075|  9.33k|    CHECK_DBG(dbg,error,"dwarf_add_debuglink_global_path()");
  ------------------
  |  |  190|  9.33k|    do {                                                      \
  |  |  191|  9.33k|        if (!(cd_dbg) || (cd_dbg)->de_magic != DBG_IS_VALID) {    \
  |  |  ------------------
  |  |  |  |  596|  2.15k|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |  |  Branch (191:13): [True: 7.18k, False: 2.15k]
  |  |  |  Branch (191:26): [True: 0, False: 2.15k]
  |  |  ------------------
  |  |  192|  7.18k|            _dwarf_error_string(NULL, (cd_er), DW_DLE_DBG_NULL, \
  |  |  ------------------
  |  |  |  | 1126|  7.18k|#define DW_DLE_DBG_NULL                         81
  |  |  ------------------
  |  |  193|  7.18k|                "DW_DLE_DBG_NULL: "                           \
  |  |  194|  7.18k|                "dbg argument to " cd_funcname                \
  |  |  195|  7.18k|                "either null or it contains"                  \
  |  |  196|  7.18k|                "a stale Dwarf_Debug pointer");               \
  |  |  197|  7.18k|            return DW_DLV_ERROR;                              \
  |  |  ------------------
  |  |  |  |  123|  7.18k|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  198|  7.18k|        }                                                     \
  |  |  199|  9.33k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (199:14): [Folded, False: 2.15k]
  |  |  ------------------
  ------------------
 1076|  2.15k|    glpath_count_in = dbg->de_gnu_global_path_count;
 1077|  2.15k|    glpath_count_out = glpath_count_in+1;
 1078|  2.15k|    glpaths = (char **)malloc(sizeof(char *)*
 1079|  2.15k|        glpath_count_out);
 1080|  2.15k|    if (!glpaths) {
  ------------------
  |  Branch (1080:9): [True: 0, False: 2.15k]
  ------------------
 1081|      0|        _dwarf_error(dbg,error,DW_DLE_ALLOC_FAIL);
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1082|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1083|      0|    }
 1084|  2.15k|    if (glpath_count_in) {
  ------------------
  |  Branch (1084:9): [True: 1.07k, False: 1.07k]
  ------------------
 1085|  1.07k|        memcpy(glpaths, dbg->de_gnu_global_paths,
 1086|  1.07k|            sizeof(char *)*glpath_count_in);
 1087|  1.07k|    }
 1088|  2.15k|    path1 = strdup(pathname);
 1089|  2.15k|    if (!path1) {
  ------------------
  |  Branch (1089:9): [True: 0, False: 2.15k]
  ------------------
 1090|      0|        free(glpaths);
 1091|      0|        _dwarf_error(dbg,error,DW_DLE_ALLOC_FAIL);
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1092|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1093|      0|    }
 1094|  2.15k|    free(dbg->de_gnu_global_paths);
 1095|  2.15k|    glpaths[glpath_count_in] = path1;
 1096|  2.15k|    dbg->de_gnu_global_paths = (const char **)glpaths;
 1097|  2.15k|    dbg->de_gnu_global_path_count = glpath_count_out;
 1098|  2.15k|    return DW_DLV_OK;
  ------------------
  |  |  122|  2.15k|#define DW_DLV_OK        0
  ------------------
 1099|  2.15k|}
dwarf_debuglink.c:is_full_path:
   78|    808|{
   79|    808|    unsigned char c = path[0];
   80|    808|    unsigned char c1 = 0;
   81|    808|    int okdriveletter = FALSE;
  ------------------
  |  |   36|    808|#define FALSE 0
  ------------------
   82|       |
   83|    808|    if (!c) {
  ------------------
  |  Branch (83:9): [True: 209, False: 599]
  ------------------
   84|       |        /* empty string. */
   85|    209|        return FALSE;
  ------------------
  |  |   36|    209|#define FALSE 0
  ------------------
   86|    209|    }
   87|    599|    if (c == joinchar) {
  ------------------
  |  Branch (87:9): [True: 93, False: 506]
  ------------------
   88|     93|        return TRUE;
  ------------------
  |  |   33|     93|#define TRUE 1
  ------------------
   89|     93|    }
   90|    506|    if (c >= 'c' && c <= 'z') {
  ------------------
  |  Branch (90:9): [True: 325, False: 181]
  |  Branch (90:21): [True: 283, False: 42]
  ------------------
   91|    283|        okdriveletter = TRUE;
  ------------------
  |  |   33|    283|#define TRUE 1
  ------------------
   92|    283|    } else  if (c >= 'C' && c <= 'Z') {
  ------------------
  |  Branch (92:17): [True: 72, False: 151]
  |  Branch (92:29): [True: 21, False: 51]
  ------------------
   93|     21|        okdriveletter = TRUE;
  ------------------
  |  |   33|     21|#define TRUE 1
  ------------------
   94|     21|    }
   95|    506|    if (!okdriveletter) {
  ------------------
  |  Branch (95:9): [True: 202, False: 304]
  ------------------
   96|    202|        return FALSE;
  ------------------
  |  |   36|    202|#define FALSE 0
  ------------------
   97|    202|    }
   98|       |
   99|    304|    c1 = path[1];
  100|    304|    if (!c1) {
  ------------------
  |  Branch (100:9): [True: 268, False: 36]
  ------------------
  101|       |        /* No second character */
  102|    268|        return FALSE;
  ------------------
  |  |   36|    268|#define FALSE 0
  ------------------
  103|    268|    }
  104|     36|    if (c1 == ':') {
  ------------------
  |  Branch (104:9): [True: 3, False: 33]
  ------------------
  105|       |        /*  Windows full path, we assume
  106|       |            We just assume nobody would be silly enough
  107|       |            to name a linux/posix directory starting with "C:" */
  108|      3|        return TRUE;
  ------------------
  |  |   33|      3|#define TRUE 1
  ------------------
  109|      3|    }
  110|       |    /*  No kind of full path name */
  111|     33|    return FALSE;
  ------------------
  |  |   36|     33|#define FALSE 0
  ------------------
  112|     36|}
dwarf_debuglink.c:dwarfstring_list_constructor:
  321|    307|{
  322|    307|    dwarfstring_constructor(&l->dl_string);
  323|    307|    l->dl_next = 0;
  324|    307|}
dwarf_debuglink.c:construct_js:
  139|    110|{
  140|    110|    memset(js,0,sizeof(struct joins_s));
  141|    110|    dwarfstring_constructor(&js->js_dirname);
  142|    110|    dwarfstring_constructor(&js->js_basenamesimple);
  143|    110|    dwarfstring_constructor(&js->js_basesimpledebug);
  144|    110|    dwarfstring_constructor(&js->js_cwd);
  145|    110|    dwarfstring_constructor(&js->js_originalfullpath);
  146|    110|    dwarfstring_constructor(&js->js_linkstring);
  147|    110|    dwarfstring_constructor(&js->js_tmp2);
  148|    110|    dwarfstring_constructor(&js->js_tmp3);
  149|    110|    dwarfstring_constructor(&js->js_buildid);
  150|    110|    dwarfstring_constructor(&js->js_buildid_filename);
  151|    110|}
dwarf_debuglink.c:mydirlen:
  287|    110|{
  288|    110|    char *cp = 0;
  289|    110|    char *lastjoinchar = 0;
  290|    110|    size_t count =0;
  291|       |
  292|    110|    for (cp = s ; *cp ; ++cp,++count)  {
  ------------------
  |  Branch (292:19): [True: 0, False: 110]
  ------------------
  293|      0|        if (*cp == joinchar) {
  ------------------
  |  Branch (293:13): [True: 0, False: 0]
  ------------------
  294|      0|            lastjoinchar = cp;
  295|      0|        }
  296|      0|    }
  297|    110|    if (lastjoinchar) {
  ------------------
  |  Branch (297:9): [True: 0, False: 110]
  ------------------
  298|       |        /*  ptrdiff_t is generated but not named */
  299|      0|        Dwarf_Unsigned sizetoendjoin =
  300|      0|            (lastjoinchar >= s)?
  ------------------
  |  Branch (300:13): [True: 0, False: 0]
  ------------------
  301|      0|            (Dwarf_Unsigned)(uintptr_t)lastjoinchar -
  302|      0|            (Dwarf_Unsigned)(uintptr_t)s
  303|      0|            :(Dwarf_Unsigned)0xffffffff;
  304|       |        /* count the last join as mydirlen. */
  305|      0|        if (sizetoendjoin == 0xffffffff) {
  ------------------
  |  Branch (305:13): [True: 0, False: 0]
  ------------------
  306|       |            /* impossible. */
  307|      0|            return 0;
  308|      0|        }
  309|      0|        return sizetoendjoin;
  310|      0|    }
  311|    110|    return 0;
  312|    110|}
dwarf_debuglink.c:dwarfstring_list_destructor:
  359|    110|{
  360|    110|    struct dwarfstring_list_s *curl = l;
  361|    110|    struct dwarfstring_list_s *nextl = l;
  362|       |
  363|    110|    nextl = curl->dl_next;
  364|    110|    dwarfstring_destructor(&curl->dl_string);
  365|    110|    curl->dl_next = 0;
  366|    110|    curl = nextl;
  367|    307|    for ( ; curl ; curl = nextl) {
  ------------------
  |  Branch (367:13): [True: 197, False: 110]
  ------------------
  368|    197|        nextl = curl->dl_next;
  369|    197|        dwarfstring_destructor(&curl->dl_string);
  370|    197|        curl->dl_next = 0;
  371|    197|        free(curl);
  372|    197|    }
  373|    110|}
dwarf_debuglink.c:destruct_js:
  154|    110|{
  155|    110|    dwarfstring_destructor(&js->js_dirname);
  156|    110|    dwarfstring_destructor(&js->js_basenamesimple);
  157|    110|    dwarfstring_destructor(&js->js_basesimpledebug);
  158|    110|    dwarfstring_destructor(&js->js_cwd);
  159|    110|    dwarfstring_destructor(&js->js_originalfullpath);
  160|    110|    dwarfstring_destructor(&js->js_linkstring);
  161|    110|    dwarfstring_destructor(&js->js_tmp2);
  162|    110|    dwarfstring_destructor(&js->js_tmp3);
  163|    110|    dwarfstring_destructor(&js->js_buildid);
  164|    110|    dwarfstring_destructor(&js->js_buildid_filename);
  165|    110|}
dwarf_debuglink.c:build_buildid_filename:
  392|    110|{
  393|    110|    dwarfstring tmp;
  394|    110|    unsigned bu = 0;
  395|    110|    unsigned char *cp  = 0;
  396|       |
  397|    110|    dwarfstring_constructor(&tmp);
  398|    110|    dwarfstring_append(&tmp,".build-id");
  399|    110|    dwarfstring_append(&tmp,joinstr);
  400|    110|    cp = buildid;
  401|  50.9k|    for (bu = 0; bu < buildid_length; ++bu ,++cp) {
  ------------------
  |  Branch (401:18): [True: 50.7k, False: 110]
  ------------------
  402|  50.7k|        dwarfstring_append_printf_u(&tmp, "%02x",*cp);
  403|  50.7k|        if (bu == 0) {
  ------------------
  |  Branch (403:13): [True: 62, False: 50.7k]
  ------------------
  404|     62|            dwarfstring_append(&tmp,"/");
  405|     62|        }
  406|  50.7k|    }
  407|    110|    _dwarf_pathjoinl(target,&tmp);
  408|    110|    dwarfstring_append(target,".debug");
  409|    110|    dwarfstring_destructor(&tmp);
  410|    110|    return;
  411|    110|}
dwarf_debuglink.c:_dwarf_do_buildid_setup:
  542|    110|{
  543|    110|    unsigned                   global_prefix_number = 0;
  544|    110|    int res = 0;
  545|       |
  546|    110|    if (!buildid_length) {
  ------------------
  |  Branch (546:9): [True: 48, False: 62]
  ------------------
  547|     48|        return DW_DLV_OK;
  ------------------
  |  |  122|     48|#define DW_DLV_OK        0
  ------------------
  548|     48|    }
  549|     62|    for (global_prefix_number = 0;
  550|    186|        buildid_length &&
  ------------------
  |  Branch (550:9): [True: 186, False: 0]
  ------------------
  551|    186|        (global_prefix_number < length_global_prefixes_in);
  ------------------
  |  Branch (551:9): [True: 124, False: 62]
  ------------------
  552|    124|        ++global_prefix_number) {
  553|    124|        char * prefix = 0;
  554|    124|        struct dwarfstring_list_s *now_last = 0;
  555|       |
  556|    124|        prefix = global_prefixes_in[global_prefix_number];
  557|    124|        dwarfstring_reset(&joind->js_buildid);
  558|    124|        dwarfstring_append(&joind->js_buildid,prefix);
  559|    124|        _dwarf_pathjoinl(&joind->js_buildid,
  560|    124|            &joind->js_buildid_filename);
  561|    124|        res = dwarfstring_list_add_new(
  562|    124|            base_dwlist,
  563|    124|            *last_entry,&joind->js_buildid,
  564|    124|            &now_last,errcode);
  565|    124|        if (res != DW_DLV_OK) {
  ------------------
  |  |  122|    124|#define DW_DLV_OK        0
  ------------------
  |  Branch (565:13): [True: 0, False: 124]
  ------------------
  566|      0|            return res;
  567|      0|        }
  568|    124|        *last_entry = now_last;
  569|    124|    }
  570|     62|    return DW_DLV_OK;
  ------------------
  |  |  122|     62|#define DW_DLV_OK        0
  ------------------
  571|     62|}
dwarf_debuglink.c:dwarfstring_list_add_new:
  332|    301|{
  333|    301|    struct dwarfstring_list_s *next = 0;
  334|       |
  335|    301|    if (prev) {
  ------------------
  |  Branch (335:9): [True: 197, False: 104]
  ------------------
  336|    197|        next = ( struct dwarfstring_list_s *)
  337|    197|        malloc(sizeof(struct dwarfstring_list_s));
  338|    197|        if (!next) {
  ------------------
  |  Branch (338:13): [True: 0, False: 197]
  ------------------
  339|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  340|      0|            return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  341|      0|        }
  342|    197|        dwarfstring_list_constructor(next);
  343|    197|    } else {
  344|    104|        next = base_entry;
  345|    104|    }
  346|    301|    dwarfstring_append(&next->dl_string,
  347|    301|        dwarfstring_string(input));
  348|    301|    if (prev) {
  ------------------
  |  Branch (348:9): [True: 197, False: 104]
  ------------------
  349|    197|        prev->dl_next = next;
  350|    197|    }
  351|    301|    *new_out = next;
  352|    301|    return DW_DLV_OK;
  ------------------
  |  |  122|    301|#define DW_DLV_OK        0
  ------------------
  353|    301|}
dwarf_debuglink.c:_dwarf_do_debuglink_setup:
  453|    110|{
  454|    110|    int res = 0;
  455|       |
  456|    110|    if (!link_string_in) {
  ------------------
  |  Branch (456:9): [True: 65, False: 45]
  ------------------
  457|     65|        return DW_DLV_OK;
  ------------------
  |  |  122|     65|#define DW_DLV_OK        0
  ------------------
  458|     65|    }
  459|     45|    {
  460|       |        /* First try dir of executable */
  461|     45|        struct dwarfstring_list_s *now_last = 0;
  462|     45|        unsigned  global_prefix_number = 0;
  463|       |
  464|     45|        dwarfstring_append(&joind->js_linkstring,
  465|     45|            link_string_in);
  466|     45|        dwarfstring_reset(&joind->js_tmp3);
  467|     45|        dwarfstring_reset(&joind->js_tmp2);
  468|     45|        prepare_linked_name(&joind->js_tmp3,
  469|     45|            &joind->js_dirname,
  470|     45|            0,&joind->js_linkstring);
  471|     45|        dwarfstring_append(
  472|     45|            link_string_fullpath_out,
  473|     45|            dwarfstring_string(&joind->js_tmp3));
  474|     45|        if (!duplicatedpath(&joind->js_originalfullpath,
  ------------------
  |  Branch (474:13): [True: 42, False: 3]
  ------------------
  475|     45|            &joind->js_tmp3)) {
  476|     42|            res = dwarfstring_list_add_new(
  477|     42|                base_dwlist,
  478|     42|                *last_entry,&joind->js_tmp3,
  479|     42|                &now_last,errcode);
  480|     42|            if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     42|#define DW_DLV_OK        0
  ------------------
  |  Branch (480:17): [True: 0, False: 42]
  ------------------
  481|      0|                return res;
  482|      0|            }
  483|     42|            *last_entry = now_last;
  484|     42|        }
  485|     45|        dwarfstring_reset(&joind->js_tmp2);
  486|     45|        dwarfstring_reset(&joind->js_tmp3);
  487|     45|        dwarfstring_append(&joind->js_tmp3,".debug");
  488|     45|        prepare_linked_name(&joind->js_tmp2,
  489|     45|            &joind->js_dirname,
  490|     45|            &joind->js_tmp3,&joind->js_linkstring);
  491|     45|        if (! duplicatedpath(&joind->js_originalfullpath,
  ------------------
  |  Branch (491:13): [True: 45, False: 0]
  ------------------
  492|     45|            &joind->js_tmp2)) {
  493|     45|            res = dwarfstring_list_add_new(
  494|     45|                base_dwlist,
  495|     45|                *last_entry,&joind->js_tmp2,
  496|     45|                &now_last,errcode);
  497|     45|            if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     45|#define DW_DLV_OK        0
  ------------------
  |  Branch (497:17): [True: 0, False: 45]
  ------------------
  498|      0|                return res;
  499|      0|            }
  500|     45|            *last_entry = now_last;
  501|     45|        } else {
  502|      0|        }
  503|       |        /*  Now look in the global locations. */
  504|     45|        for (global_prefix_number = 0;
  505|    135|            global_prefix_number < length_global_prefixes_in;
  ------------------
  |  Branch (505:13): [True: 90, False: 45]
  ------------------
  506|     90|            ++global_prefix_number) {
  507|     90|            char * prefix =
  508|     90|                global_prefixes_in[global_prefix_number];
  509|       |
  510|     90|            dwarfstring_reset(&joind->js_tmp2);
  511|     90|            dwarfstring_reset(&joind->js_tmp3);
  512|     90|            dwarfstring_append(&joind->js_tmp2, prefix);
  513|     90|            prepare_linked_name(&joind->js_tmp3,
  514|     90|                &joind->js_tmp2,
  515|     90|                &joind->js_dirname,
  516|     90|                &joind->js_linkstring);
  517|     90|            if (!duplicatedpath(&joind->js_originalfullpath,
  ------------------
  |  Branch (517:17): [True: 90, False: 0]
  ------------------
  518|     90|                &joind->js_tmp3)) {
  519|     90|                res = dwarfstring_list_add_new(
  520|     90|                    base_dwlist,
  521|     90|                    *last_entry,&joind->js_tmp3,
  522|     90|                    &now_last,errcode);
  523|     90|                if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     90|#define DW_DLV_OK        0
  ------------------
  |  Branch (523:21): [True: 0, False: 90]
  ------------------
  524|      0|                    return res;
  525|      0|                }
  526|     90|                *last_entry = now_last;
  527|     90|            } else {
  528|      0|            }
  529|     90|        }
  530|     45|    }
  531|     45|    return DW_DLV_OK;
  ------------------
  |  |  122|     45|#define DW_DLV_OK        0
  ------------------
  532|     45|}
dwarf_debuglink.c:prepare_linked_name:
  380|    180|{
  381|    180|    dwarfstring_append(out, dwarfstring_string(dirname));
  382|    180|    if (extradir) {
  ------------------
  |  Branch (382:9): [True: 135, False: 45]
  ------------------
  383|    135|        _dwarf_pathjoinl(out,extradir);
  384|    135|    }
  385|    180|    _dwarf_pathjoinl(out,linkname);
  386|    180|}
dwarf_debuglink.c:duplicatedpath:
  435|    180|{
  436|    180|    if (strcmp(dwarfstring_string(l),
  ------------------
  |  Branch (436:9): [True: 177, False: 3]
  ------------------
  437|    180|        dwarfstring_string(r))) {
  438|    177|        return FALSE;
  ------------------
  |  |   36|    177|#define FALSE 0
  ------------------
  439|    177|    }
  440|       |    /*  Oops. somebody made a mistake */
  441|      3|    return TRUE;
  ------------------
  |  |   33|      3|#define TRUE 1
  ------------------
  442|    180|}
dwarf_debuglink.c:_dwarf_extract_buildid:
  825|    229|{
  826|    229|    Dwarf_Small * ptr = 0;
  827|    229|    Dwarf_Small * endptr = 0;
  828|    229|    int res = DW_DLV_ERROR;
  ------------------
  |  |  123|    229|#define DW_DLV_ERROR     1
  ------------------
  829|    229|    struct buildid_s *bu = 0;
  830|    229|    Dwarf_Unsigned namesize = 0;
  831|    229|    Dwarf_Unsigned descrsize = 0;
  832|    229|    Dwarf_Unsigned type = 0;
  833|    229|    Dwarf_Unsigned finalsize;
  834|    229|    Dwarf_Unsigned secsize = 0;
  835|       |
  836|    229|    if (!pbuildid->dss_data) {
  ------------------
  |  Branch (836:9): [True: 1, False: 228]
  ------------------
  837|      1|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      1|#define DW_DLV_NO_ENTRY -1
  ------------------
  838|      1|    }
  839|    228|    secsize = pbuildid->dss_size;
  840|    228|    ptr = pbuildid->dss_data;
  841|    228|    if (secsize < sizeof(struct buildid_s)) {
  ------------------
  |  Branch (841:9): [True: 3, False: 225]
  ------------------
  842|      3|        _dwarf_error(dbg,error,DW_DLE_CORRUPT_NOTE_GNU_DEBUGID);
  ------------------
  |  | 1503|      3|#define DW_DLE_CORRUPT_NOTE_GNU_DEBUGID        457
  ------------------
  843|      3|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      3|#define DW_DLV_ERROR     1
  ------------------
  844|      3|    }
  845|    225|    endptr = ptr + secsize;
  846|       |    /*  We hold gh_content till all is closed
  847|       |        as we return pointers into it
  848|       |        if all goes well. */
  849|    225|    bu = (struct buildid_s *)ptr;
  850|    225|    ASNAR(dbg->de_copy_word,namesize, bu->bu_ownernamesize);
  ------------------
  |  |   53|    225|    do {                                        \
  |  |   54|    225|        (t) = 0;                                \
  |  |   55|    225|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    225|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 225]
  |  |  ------------------
  ------------------
  851|    225|    ASNAR(dbg->de_copy_word,descrsize,bu->bu_buildidsize);
  ------------------
  |  |   53|    225|    do {                                        \
  |  |   54|    225|        (t) = 0;                                \
  |  |   55|    225|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    225|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 225]
  |  |  ------------------
  ------------------
  852|    225|    if (descrsize >= secsize) {
  ------------------
  |  Branch (852:9): [True: 75, False: 150]
  ------------------
  853|     75|        _dwarf_error_string(dbg,error,
  854|     75|            DW_DLE_BUILD_ID_DESCRIPTION_SIZE,
  ------------------
  |  | 1541|     75|#define DW_DLE_BUILD_ID_DESCRIPTION_SIZE       495
  ------------------
  855|     75|            "DW_DLE_BUILD_ID_DESCRIPTION_SIZE Size is much too "
  856|     75|            "large to be correct. Corrupt Dwarf");
  857|     75|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     75|#define DW_DLV_ERROR     1
  ------------------
  858|     75|    }
  859|    150|    if ((descrsize+8) >= secsize) {
  ------------------
  |  Branch (859:9): [True: 5, False: 145]
  ------------------
  860|      5|        _dwarf_error_string(dbg,error,
  861|      5|            DW_DLE_BUILD_ID_DESCRIPTION_SIZE,
  ------------------
  |  | 1541|      5|#define DW_DLE_BUILD_ID_DESCRIPTION_SIZE       495
  ------------------
  862|      5|            "DW_DLE_BUILD_ID_DESCRIPTION_SIZE Size is too "
  863|      5|            "large to be correct. Corrupt Dwarf");
  864|      5|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      5|#define DW_DLV_ERROR     1
  ------------------
  865|      5|    }
  866|    145|    if (descrsize >= DW_BUILDID_SANE_SIZE) {
  ------------------
  |  |   38|    145|#define  DW_BUILDID_SANE_SIZE (8*1024)
  ------------------
  |  Branch (866:9): [True: 9, False: 136]
  ------------------
  867|      9|        _dwarf_error_string(dbg,error,
  868|      9|            DW_DLE_BUILD_ID_DESCRIPTION_SIZE,
  ------------------
  |  | 1541|      9|#define DW_DLE_BUILD_ID_DESCRIPTION_SIZE       495
  ------------------
  869|      9|            "DW_DLE_BUILD_ID_DESCRIPTION_SIZE Size is too "
  870|      9|            "large to be sane. Corrupt Dwarf");
  871|      9|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      9|#define DW_DLV_ERROR     1
  ------------------
  872|      9|    }
  873|       |
  874|    136|    ASNAR(dbg->de_copy_word,type,     bu->bu_type);
  ------------------
  |  |   53|    136|    do {                                        \
  |  |   54|    136|        (t) = 0;                                \
  |  |   55|    136|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    136|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 136]
  |  |  ------------------
  ------------------
  875|       |    /*  descrsize  test is no longer appropriate, other lengths
  876|       |        than 20 may exist.  --Wl,--build-id= can have
  877|       |        at least one of 'fast', 'md5', 'sha1', 'uuid' or
  878|       |        possibly others so we should not check the length. */
  879|    136|    res = _dwarf_check_string_valid(dbg,
  880|    136|        (Dwarf_Small *)&bu->bu_owner[0],
  881|    136|        (Dwarf_Small *)&bu->bu_owner[0],
  882|    136|        endptr,
  883|    136|        DW_DLE_CORRUPT_GNU_DEBUGID_STRING,
  ------------------
  |  | 1505|    136|#define DW_DLE_CORRUPT_GNU_DEBUGID_STRING      459
  ------------------
  884|    136|        error);
  885|    136|    if ( res != DW_DLV_OK) {
  ------------------
  |  |  122|    136|#define DW_DLV_OK        0
  ------------------
  |  Branch (885:10): [True: 1, False: 135]
  ------------------
  886|      1|        return res;
  887|      1|    }
  888|    135|    if ((strlen(bu->bu_owner) +1) != namesize) {
  ------------------
  |  Branch (888:9): [True: 63, False: 72]
  ------------------
  889|     63|        _dwarf_error(dbg,error, DW_DLE_CORRUPT_GNU_DEBUGID_STRING);
  ------------------
  |  | 1505|     63|#define DW_DLE_CORRUPT_GNU_DEBUGID_STRING      459
  ------------------
  890|     63|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     63|#define DW_DLV_ERROR     1
  ------------------
  891|     63|    }
  892|       |
  893|     72|    finalsize = sizeof(struct buildid_s)-1 + namesize + descrsize;
  894|     72|    if (finalsize > secsize) {
  ------------------
  |  Branch (894:9): [True: 5, False: 67]
  ------------------
  895|      5|        _dwarf_error(dbg,error, DW_DLE_CORRUPT_GNU_DEBUGID_SIZE);
  ------------------
  |  | 1504|      5|#define DW_DLE_CORRUPT_GNU_DEBUGID_SIZE        458
  ------------------
  896|      5|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      5|#define DW_DLV_ERROR     1
  ------------------
  897|      5|    }
  898|     67|    *type_returned = (unsigned)type;
  899|     67|    *owner_name_returned = &bu->bu_owner[0];
  900|     67|    if (descrsize >= secsize) { /* In case value insanely large */
  ------------------
  |  Branch (900:9): [True: 0, False: 67]
  ------------------
  901|      0|        dwarfstring m;
  902|       |
  903|      0|        dwarfstring_constructor(&m);
  904|      0|        dwarfstring_append_printf_u(&m,
  905|      0|            "DW_DLE_CORRUPT_NOTE_GNU_DEBUGID buildid description"
  906|      0|            "length %u larger than the section size. "
  907|      0|            "Corrupt object section",descrsize);
  908|      0|        _dwarf_error_string(dbg,error,
  909|      0|            DW_DLE_CORRUPT_GNU_DEBUGID_SIZE,
  ------------------
  |  | 1504|      0|#define DW_DLE_CORRUPT_GNU_DEBUGID_SIZE        458
  ------------------
  910|      0|            dwarfstring_string(&m));
  911|      0|        dwarfstring_destructor(&m);
  912|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  913|      0|    }
  914|     67|    if ((descrsize+8) >= secsize) { /* In case a bit too large */
  ------------------
  |  Branch (914:9): [True: 0, False: 67]
  ------------------
  915|      0|        dwarfstring m;
  916|       |
  917|      0|        dwarfstring_constructor(&m);
  918|      0|        dwarfstring_append_printf_u(&m,
  919|      0|            "DW_DLE_CORRUPT_NOTE_GNU_DEBUGID buildid description"
  920|      0|            "length %u larger than is appropriate. "
  921|      0|            "Corrupt object section",descrsize);
  922|      0|        _dwarf_error_string(dbg,error,
  923|      0|            DW_DLE_CORRUPT_GNU_DEBUGID_SIZE,
  ------------------
  |  | 1504|      0|#define DW_DLE_CORRUPT_GNU_DEBUGID_SIZE        458
  ------------------
  924|      0|            dwarfstring_string(&m));
  925|      0|        dwarfstring_destructor(&m);
  926|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  927|      0|    }
  928|     67|    *build_id_length_returned = (unsigned)descrsize;
  929|     67|    *build_id_returned = (unsigned char *)ptr +
  930|     67|        sizeof(struct buildid_s)-1 + namesize;
  931|     67|    return DW_DLV_OK;
  ------------------
  |  |  122|     67|#define DW_DLV_OK        0
  ------------------
  932|     67|}
dwarf_debuglink.c:_dwarf_extract_debuglink:
  770|     64|{
  771|     64|    Dwarf_Small *ptr = 0;
  772|     64|    Dwarf_Small *endptr = 0;
  773|     64|    size_t   namelenszt = 0;
  774|     64|    unsigned m = 0;
  775|     64|    unsigned incr = 0;
  776|     64|    Dwarf_Small *crcptr = 0;
  777|     64|    int res = DW_DLV_ERROR;
  ------------------
  |  |  123|     64|#define DW_DLV_ERROR     1
  ------------------
  778|     64|    Dwarf_Unsigned secsize = 0;
  779|       |
  780|     64|    if (!pdebuglink->dss_data) {
  ------------------
  |  Branch (780:9): [True: 1, False: 63]
  ------------------
  781|      1|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      1|#define DW_DLV_NO_ENTRY -1
  ------------------
  782|      1|    }
  783|     63|    secsize = pdebuglink->dss_size;
  784|     63|    ptr = pdebuglink->dss_data;
  785|     63|    endptr = ptr + secsize;
  786|       |
  787|     63|    res = _dwarf_check_string_valid(dbg,ptr,
  788|     63|        ptr, endptr,  DW_DLE_FORM_STRING_BAD_STRING,
  ------------------
  |  | 1407|     63|#define DW_DLE_FORM_STRING_BAD_STRING          361
  ------------------
  789|     63|        error);
  790|     63|    if ( res != DW_DLV_OK) {
  ------------------
  |  |  122|     63|#define DW_DLV_OK        0
  ------------------
  |  Branch (790:10): [True: 5, False: 58]
  ------------------
  791|      5|        return res;
  792|      5|    }
  793|     58|    namelenszt = strlen((const char*)ptr);
  794|     58|    m = (namelenszt+1) %4;
  795|     58|    if (m) {
  ------------------
  |  Branch (795:9): [True: 37, False: 21]
  ------------------
  796|     37|        incr = 4 - m;
  797|     37|    }
  798|     58|    crcptr = (unsigned char *)ptr +namelenszt +1 +incr;
  799|     58|    if ((crcptr +4) != (unsigned char*)endptr) {
  ------------------
  |  Branch (799:9): [True: 13, False: 45]
  ------------------
  800|     13|        _dwarf_error(dbg,error,DW_DLE_CORRUPT_GNU_DEBUGLINK);
  ------------------
  |  | 1502|     13|#define DW_DLE_CORRUPT_GNU_DEBUGLINK           456
  ------------------
  801|     13|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     13|#define DW_DLV_ERROR     1
  ------------------
  802|     13|    }
  803|     45|    *name_returned = (char *)ptr;
  804|     45|    *crc_returned = crcptr;
  805|     45|    return DW_DLV_OK;
  ------------------
  |  |  122|     45|#define DW_DLV_OK        0
  ------------------
  806|     58|}

_dwarf_load_elf_symtab_symbols:
 1008|  2.76k|{
 1009|  2.76k|    int res = 0;
 1010|  2.76k|    struct generic_symentry *gsym = 0;
 1011|  2.76k|    Dwarf_Unsigned count = 0;
 1012|  2.76k|    Dwarf_Unsigned secnum = ep->f_symtab_sect_index;
 1013|  2.76k|    struct generic_shdr * psh = 0;
 1014|       |
 1015|  2.76k|    if (!secnum) {
  ------------------
  |  Branch (1015:9): [True: 2.69k, False: 69]
  ------------------
 1016|  2.69k|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|  2.69k|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1017|  2.69k|    }
 1018|     69|    psh = ep->f_shdr + secnum;
 1019|     69|    if (psh->gh_size > ep->f_filesize) {
  ------------------
  |  Branch (1019:9): [True: 0, False: 69]
  ------------------
 1020|      0|        *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      0|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1021|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1022|      0|    }
 1023|     69|    res = _dwarf_generic_elf_load_symbols(ep,
 1024|     69|        secnum,
 1025|     69|        psh,
 1026|     69|        &gsym,
 1027|     69|        &count,errcode);
 1028|     69|    if (res == DW_DLV_OK) {
  ------------------
  |  |   59|     69|#define DW_DLV_OK         0
  ------------------
  |  Branch (1028:9): [True: 50, False: 19]
  ------------------
 1029|     50|        ep->f_symtab = gsym;
 1030|     50|        ep->f_loc_symtab.g_count = count;
 1031|     50|    }
 1032|     69|    return res;
 1033|     69|}
_dwarf_load_elf_symstr:
 1214|  2.89k|{
 1215|  2.89k|    struct generic_shdr *strpsh = 0;
 1216|  2.89k|    int res = 0;
 1217|  2.89k|    Dwarf_Unsigned strsectindex  =0;
 1218|  2.89k|    Dwarf_Unsigned strsectlength = 0;
 1219|  2.89k|    Dwarf_Unsigned flags = 0;
 1220|       |
 1221|  2.89k|    if (!ep->f_symtab_sect_strings_sect_index) {
  ------------------
  |  Branch (1221:9): [True: 2.64k, False: 249]
  ------------------
 1222|  2.64k|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|  2.64k|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1223|  2.64k|    }
 1224|    249|    strsectindex = ep->f_symtab_sect_strings_sect_index;
 1225|    249|    strsectlength = ep->f_symtab_sect_strings_max;
 1226|    249|    strpsh = ep->f_shdr + strsectindex;
 1227|    249|    if (strsectindex == ep->f_elf_shstrings_index) {
  ------------------
  |  Branch (1227:9): [True: 64, False: 185]
  ------------------
 1228|       |        /*  content loaded already by
 1229|       |            _dwarf_elf_load_sectstrings() as
 1230|       |            they are the same section number. */
 1231|     64|        ep->f_symtab_sect_strings_sect_index = strpsh->gh_secnum;
 1232|     64|        ep->f_symtab_sect_strings_max = ep->f_elf_shstrings_max;
 1233|     64|        ep->f_symtab_sect_strings = strpsh->gh_content;
 1234|     64|        return DW_DLV_OK;
  ------------------
  |  |   59|     64|#define DW_DLV_OK         0
  ------------------
 1235|     64|    }
 1236|       |    /*  if strpsh->gh_sht_group_array is non-zero
 1237|       |        then the section is set up as a GROUP section
 1238|       |        and reading as a string section is absurd.
 1239|       |        And gh_content set in a way we do not want.*/
 1240|    185|    if (strpsh->gh_sht_group_array ||
  ------------------
  |  Branch (1240:9): [True: 1, False: 184]
  ------------------
 1241|    184|        strpsh->gh_sht_group_array_count ||
  ------------------
  |  Branch (1241:9): [True: 0, False: 184]
  ------------------
 1242|    184|        strpsh->gh_content) {
  ------------------
  |  Branch (1242:9): [True: 0, False: 184]
  ------------------
 1243|      1|        *errcode = DW_DLE_ELF_GRPSTRING_SECTION_ERROR;
  ------------------
  |  | 1563|      1|#define DW_DLE_ELF_GRPSTRING_SECTION_ERROR     517
  ------------------
 1244|      1|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
 1245|      1|    }
 1246|       |    /*  Alloc an extra byte as a guaranteed NUL byte
 1247|       |        at the end of the strings in case the section
 1248|       |        is corrupted and lacks a NUL at end. */
 1249|    184|    if (strsectlength > ep->f_filesize ||
  ------------------
  |  Branch (1249:9): [True: 0, False: 184]
  ------------------
 1250|    184|        strpsh->gh_offset >ep->f_filesize ||
  ------------------
  |  Branch (1250:9): [True: 105, False: 79]
  ------------------
 1251|     79|        (strsectlength + strpsh->gh_offset) >
  ------------------
  |  Branch (1251:9): [True: 14, False: 65]
  ------------------
 1252|    119|            ep->f_filesize) {
 1253|    119|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|    119|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1254|    119|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    119|#define DW_DLV_ERROR      1
  ------------------
 1255|    119|    }
 1256|     65|    if (ep->f_symtab_sect_strings_sect_index ==
  ------------------
  |  Branch (1256:9): [True: 0, False: 65]
  ------------------
 1257|     65|        ep->f_elf_shstrings_index ) {
 1258|      0|        ep->f_symtab_sect_strings = ep->f_elf_shstrings_data;
 1259|      0|        ep->f_symtab_sect_strings_max = ep->f_elf_shstrings_max;
 1260|      0|        return DW_DLV_OK;
  ------------------
  |  |   59|      0|#define DW_DLV_OK         0
  ------------------
 1261|      0|    }
 1262|     65|    ep->f_symtab_sect_strings = calloc(1,strsectlength+1);
 1263|     65|    flags = strpsh->gh_flags;
 1264|     65|    if (!ep->f_symtab_sect_strings) {
  ------------------
  |  Branch (1264:9): [True: 0, False: 65]
  ------------------
 1265|      0|        ep->f_symtab_sect_strings = 0;
 1266|      0|        ep->f_symtab_sect_strings_max = 0;
 1267|      0|        ep->f_symtab_sect_strings_sect_index = 0;
 1268|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1269|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1270|      0|    }
 1271|     65|    strpsh->gh_load_type = Dwarf_Alloc_Malloc;
 1272|     65|    res = RRMOA(ep->f_fd,ep->f_symtab_sect_strings,
  ------------------
  |  |   65|     65|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     65|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1273|     65|        strpsh->gh_offset,
 1274|     65|        strsectlength,
 1275|     65|        ep->f_filesize,errcode);
 1276|     65|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     65|#define DW_DLV_OK         0
  ------------------
  |  Branch (1276:9): [True: 1, False: 64]
  ------------------
 1277|      1|        free(ep->f_symtab_sect_strings);
 1278|      1|        ep->f_symtab_sect_strings = 0;
 1279|      1|        return res;
 1280|      1|    }
 1281|     64|    strpsh->gh_content = ep->f_symtab_sect_strings;
 1282|     64|    strpsh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|     64|#define TRUE 1
  ------------------
 1283|     64|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|     64|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (1283:9): [True: 3, False: 61]
  ------------------
 1284|       |#if defined(HAVE_ZLIB) && defined(HAVE_ZSTD)
 1285|       |        /* decompress and set new section size */
 1286|       |        *errcode = 0;
 1287|       |        _dwarf_do_decompress_elf(ep,strpsh,errcode);
 1288|       |        if (*errcode) {
 1289|       |            /*  gh_content will cause the free */
 1290|       |            ep->f_symtab_sect_strings = 0;
 1291|       |            return DW_DLV_ERROR;
 1292|       |        }
 1293|       |        ep->f_symtab_sect_strings = strpsh->gh_content;
 1294|       |#else /* COMPRESSED TEST */
 1295|       |        /*  gh_content will cause the free */
 1296|      3|        ep->f_symtab_sect_strings = 0;
 1297|      3|        *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      3|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
 1298|      3|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
 1299|      3|#endif /* COMPRESSED TEST */
 1300|      3|    }
 1301|     61|    return DW_DLV_OK;
  ------------------
  |  |   59|     61|#define DW_DLV_OK         0
  ------------------
 1302|     64|}
_dwarf_load_elf_relx:
 1796|  19.2k|{
 1797|  19.2k|    struct generic_shdr *gshdr = 0;
 1798|  19.2k|    Dwarf_Unsigned seccount = 0;
 1799|  19.2k|    unsigned offsetsize = 0;
 1800|  19.2k|    struct generic_rela *grp = 0;
 1801|  19.2k|    Dwarf_Unsigned count_read = 0;
 1802|  19.2k|    int res = 0;
 1803|  19.2k|    unsigned oksec = 0;
 1804|  19.2k|    enum RelocOffsetSize localoffsize = RelocOffset32;
 1805|       |
 1806|       |    /*  ASSERT: Caller guarantees localr is
 1807|       |        a valid RelocRela  */
 1808|  19.2k|    if (!ep) {
  ------------------
  |  Branch (1808:9): [True: 0, False: 19.2k]
  ------------------
 1809|      0|        *errcode = DW_DLE_INTERNAL_NULL_POINTER;
  ------------------
  |  | 1482|      0|#define DW_DLE_INTERNAL_NULL_POINTER           436
  ------------------
 1810|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1811|      0|    }
 1812|  19.2k|    offsetsize = ep->f_offsetsize;
 1813|  19.2k|    seccount = ep->f_loc_shdr.g_count;
 1814|  19.2k|    if (secnum >= seccount) {
  ------------------
  |  Branch (1814:9): [True: 0, False: 19.2k]
  ------------------
 1815|      0|        *errcode = DW_DLE_ELF_SECTION_ERROR;
  ------------------
  |  | 1492|      0|#define DW_DLE_ELF_SECTION_ERROR               446
  ------------------
 1816|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1817|      0|    }
 1818|  19.2k|    gshdr = ep->f_shdr +secnum;
 1819|  19.2k|    if (is_empty_section(gshdr->gh_type)) {
  ------------------
  |  Branch (1819:9): [True: 14.1k, False: 5.05k]
  ------------------
 1820|       |
 1821|  14.1k|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|  14.1k|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1822|  14.1k|    }
 1823|       |
 1824|  5.05k|    res = this_rel_is_a_section_dwarf_related(ep,gshdr,
 1825|  5.05k|        &oksec,errcode);
 1826|  5.05k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  5.05k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1826:9): [True: 57, False: 4.99k]
  ------------------
 1827|     57|        return res;
 1828|     57|    }
 1829|  4.99k|    if (!oksec) {
  ------------------
  |  Branch (1829:9): [True: 3.04k, False: 1.94k]
  ------------------
 1830|  3.04k|        return DW_DLV_OK;
  ------------------
  |  |   59|  3.04k|#define DW_DLV_OK         0
  ------------------
 1831|  3.04k|    }
 1832|       |    /*  We will actually read these relocations. */
 1833|  1.94k|    if (offsetsize == 64) {
  ------------------
  |  Branch (1833:9): [True: 753, False: 1.19k]
  ------------------
 1834|    753|        localoffsize = RelocOffset64;
 1835|  1.19k|    } else if (offsetsize == 32) {
  ------------------
  |  Branch (1835:16): [True: 1.19k, False: 0]
  ------------------
 1836|  1.19k|        localoffsize = RelocOffset32;
 1837|  1.19k|    } else {
 1838|      0|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|      0|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
 1839|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1840|      0|    }
 1841|       |    /*  ASSERT: localoffsize is now a valid enum value,
 1842|       |        one of the two defined. */
 1843|  1.94k|    res = _dwarf_elf_load_a_relx_batch(ep,
 1844|  1.94k|        gshdr,&grp,&count_read,localr,localoffsize,errcode);
 1845|  1.94k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  1.94k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1845:9): [True: 169, False: 1.78k]
  ------------------
 1846|    169|        return res;
 1847|    169|    }
 1848|  1.78k|    if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |   58|  1.78k|#define DW_DLV_NO_ENTRY  -1
  ------------------
  |  Branch (1848:9): [True: 404, False: 1.37k]
  ------------------
 1849|    404|        return res;
 1850|    404|    }
 1851|  1.37k|    gshdr->gh_rels = grp;
 1852|  1.37k|    gshdr->gh_relcount = count_read;
 1853|  1.37k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.37k|#define DW_DLV_OK         0
  ------------------
 1854|  1.78k|}
_dwarf_load_elf_header:
 1993|  4.57k|{
 1994|  4.57k|    unsigned offsetsize = ep->f_offsetsize;
 1995|  4.57k|    int res = 0;
 1996|       |
 1997|  4.57k|    if (offsetsize == 32) {
  ------------------
  |  Branch (1997:9): [True: 3.04k, False: 1.52k]
  ------------------
 1998|  3.04k|        res = elf_load_elf_header32(ep,errcode);
 1999|  3.04k|    } else if (offsetsize == 64) {
  ------------------
  |  Branch (1999:16): [True: 1.52k, False: 0]
  ------------------
 2000|  1.52k|        if (sizeof(Dwarf_Unsigned) < 8) {
  ------------------
  |  Branch (2000:13): [Folded, False: 1.52k]
  ------------------
 2001|      0|            *errcode =  DW_DLE_INTEGER_TOO_SMALL;
  ------------------
  |  | 1485|      0|#define DW_DLE_INTEGER_TOO_SMALL               439
  ------------------
 2002|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2003|      0|        }
 2004|  1.52k|        res = elf_load_elf_header64(ep,errcode);
 2005|  1.52k|    } else {
 2006|      0|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|      0|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
 2007|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2008|      0|    }
 2009|  4.57k|    return res;
 2010|  4.57k|}
_dwarf_load_elf_sectheaders:
 2384|  4.50k|{
 2385|  4.50k|    int res = 0;
 2386|       |
 2387|  4.50k|    if (ep->f_offsetsize == 32) {
  ------------------
  |  Branch (2387:9): [True: 3.01k, False: 1.49k]
  ------------------
 2388|  3.01k|        res  = elf_load_sectheaders32(ep,ep->f_ehdr->ge_shoff,
 2389|  3.01k|            ep->f_ehdr->ge_shentsize,
 2390|  3.01k|            ep->f_ehdr->ge_shnum,errcode);
 2391|  3.01k|    } else  if (ep->f_offsetsize == 64) {
  ------------------
  |  Branch (2391:17): [True: 1.49k, False: 0]
  ------------------
 2392|  1.49k|        res  = elf_load_sectheaders64(ep,ep->f_ehdr->ge_shoff,
 2393|  1.49k|            ep->f_ehdr->ge_shentsize,
 2394|  1.49k|            ep->f_ehdr->ge_shnum,errcode);
 2395|  1.49k|    } else {
 2396|      0|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|      0|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
 2397|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2398|      0|    }
 2399|  4.50k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  4.50k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2399:9): [True: 1.11k, False: 3.38k]
  ------------------
 2400|  1.11k|        return res;
 2401|  1.11k|    }
 2402|  3.38k|    res  = _dwarf_elf_load_sectstrings(ep,
 2403|  3.38k|        ep->f_ehdr->ge_shstrndx,errcode);
 2404|  3.38k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  3.38k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2404:9): [True: 137, False: 3.25k]
  ------------------
 2405|    137|        return res;
 2406|    137|    }
 2407|  3.25k|    res  = _dwarf_elf_load_sect_namestrings(ep,errcode);
 2408|  3.25k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  3.25k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2408:9): [True: 45, False: 3.20k]
  ------------------
 2409|     45|        return res;
 2410|     45|    }
 2411|  3.20k|    res  = _dwarf_elf_find_sym_sections(ep,errcode);
 2412|  3.20k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  3.20k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2412:9): [True: 43, False: 3.16k]
  ------------------
 2413|     43|        return res;
 2414|     43|    }
 2415|  3.16k|    res = _dwarf_elf_setup_all_section_groups(ep,errcode);
 2416|  3.16k|    return res;
 2417|  3.20k|}
dwarf_elf_load_headers.c:_dwarf_generic_elf_load_symbols:
  970|     69|{
  971|     69|    int res = 0;
  972|     69|    struct generic_symentry *gsym = 0;
  973|     69|    Dwarf_Unsigned count = 0;
  974|       |
  975|     69|    if (!secnum) {
  ------------------
  |  Branch (975:9): [True: 0, False: 69]
  ------------------
  976|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  977|      0|    }
  978|     69|    if (psh->gh_size > ep->f_filesize) {
  ------------------
  |  Branch (978:9): [True: 0, False: 69]
  ------------------
  979|      0|        *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      0|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
  980|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  981|      0|    }
  982|     69|    if (ep->f_offsetsize == 32) {
  ------------------
  |  Branch (982:9): [True: 39, False: 30]
  ------------------
  983|     39|        res = _dwarf_generic_elf_load_symbols32(ep,
  984|     39|            &gsym,psh,
  985|     39|            &count,errcode);
  986|     39|    } else if (ep->f_offsetsize == 64) {
  ------------------
  |  Branch (986:16): [True: 30, False: 0]
  ------------------
  987|     30|        res = _dwarf_generic_elf_load_symbols64(ep,
  988|     30|            &gsym,psh,
  989|     30|            &count,errcode);
  990|     30|    } else {
  991|      0|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|      0|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
  992|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  993|      0|    }
  994|     69|    if (res == DW_DLV_OK) {
  ------------------
  |  |   59|     69|#define DW_DLV_OK         0
  ------------------
  |  Branch (994:9): [True: 50, False: 19]
  ------------------
  995|     50|        *gsym_out = gsym;
  996|     50|        *count_out = count;
  997|     50|    } else {
  998|     19|        free(psh->gh_content);
  999|     19|        psh->gh_content = 0;
 1000|     19|        psh->gh_was_alloc = FALSE;
  ------------------
  |  |   36|     19|#define FALSE 0
  ------------------
 1001|     19|    }
 1002|     69|    return res;
 1003|     69|}
dwarf_elf_load_headers.c:_dwarf_generic_elf_load_symbols32:
  748|     39|{
  749|     39|    Dwarf_Unsigned  ecount = 0;
  750|     39|    Dwarf_Unsigned  size2 = 0;
  751|     39|    Dwarf_Unsigned  offset =0;
  752|     39|    Dwarf_Unsigned  size =0;
  753|     39|    Dwarf_Unsigned  i = 0;
  754|     39|    dw_elf32_sym   *psym = 0;
  755|     39|    struct generic_symentry * gsym = 0;
  756|     39|    struct generic_symentry * orig_gsym = 0;
  757|     39|    Dwarf_Unsigned flags = 0;
  758|     39|    Dwarf_Small   *content = 0;
  759|     39|    int            res = 0;
  760|       |
  761|     39|    flags = psh->gh_flags;
  762|     39|    size = psh->gh_size;
  763|     39|    offset = psh->gh_offset;
  764|     39|    if (psh->gh_content) {
  ------------------
  |  Branch (764:9): [True: 2, False: 37]
  ------------------
  765|      2|        *errcode = DW_DLE_ELF_SECTION_ERROR;
  ------------------
  |  | 1492|      2|#define DW_DLE_ELF_SECTION_ERROR               446
  ------------------
  766|      2|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
  767|      2|    }
  768|     37|    if (psh->gh_sht_group_array ||
  ------------------
  |  Branch (768:9): [True: 0, False: 37]
  ------------------
  769|     37|        psh->gh_sht_group_array_count ||
  ------------------
  |  Branch (769:9): [True: 0, False: 37]
  ------------------
  770|     37|        psh->gh_content) {
  ------------------
  |  Branch (770:9): [True: 0, False: 37]
  ------------------
  771|      0|        *errcode = DW_DLE_ELF_GRPSTRING_SECTION_ERROR;
  ------------------
  |  | 1563|      0|#define DW_DLE_ELF_GRPSTRING_SECTION_ERROR     517
  ------------------
  772|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  773|      0|    }
  774|     37|    content = calloc(1,size);
  775|     37|    if (!content) {
  ------------------
  |  Branch (775:9): [True: 0, False: 37]
  ------------------
  776|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  777|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  778|      0|    }
  779|     37|    res = RRMOA(ep->f_fd,content,offset,size,
  ------------------
  |  |   65|     37|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     37|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  780|     37|        ep->f_filesize,errcode);
  781|     37|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     37|#define DW_DLV_OK         0
  ------------------
  |  Branch (781:9): [True: 4, False: 33]
  ------------------
  782|      4|        free(content);
  783|      4|        return res;
  784|      4|    }
  785|     33|    psh->gh_content = (char *)content;
  786|     33|    psh->gh_load_type = Dwarf_Alloc_Malloc;
  787|     33|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|     33|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (787:9): [True: 1, False: 32]
  ------------------
  788|       |#if defined(HAVE_ZLIB) && defined(HAVE_ZSTD)
  789|       |        *errcode = 0;
  790|       |        _dwarf_do_decompress_elf(ep,psh,errcode);
  791|       |        /* decompress and set new section size */
  792|       |        if (*errcode) {
  793|       |            free(psh->gh_content);
  794|       |            psh->gh_content = 0;
  795|       |            return DW_DLV_ERROR;
  796|       |        }
  797|       |#else /* COMPRESSED TEST */
  798|      1|        free(psh->gh_content);
  799|      1|        psh->gh_content = 0;
  800|      1|        *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      1|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
  801|      1|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
  802|      1|#endif /* COMPRESSED TEST */
  803|      1|    }
  804|     32|    size = psh->gh_size;
  805|     32|    ecount = (long)(size/sizeof(dw_elf32_sym));
  806|     32|    size2 = ecount * sizeof(dw_elf32_sym);
  807|     32|    if (size != size2) {
  ------------------
  |  Branch (807:9): [True: 4, False: 28]
  ------------------
  808|      4|        free(psh->gh_content);
  809|      4|        psh->gh_content = 0;
  810|      4|        *errcode = DW_DLE_SYMBOL_SECTION_SIZE_ERROR;
  ------------------
  |  | 1536|      4|#define DW_DLE_SYMBOL_SECTION_SIZE_ERROR       490
  ------------------
  811|      4|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
  812|      4|    }
  813|     28|    if (size >= ep->f_filesize ) {
  ------------------
  |  Branch (813:9): [True: 0, False: 28]
  ------------------
  814|      0|        free(psh->gh_content);
  815|      0|        psh->gh_content = 0;
  816|      0|        *errcode = DW_DLE_SYMBOL_SECTION_SIZE_ERROR;
  ------------------
  |  | 1536|      0|#define DW_DLE_SYMBOL_SECTION_SIZE_ERROR       490
  ------------------
  817|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  818|      0|    }
  819|     28|    psym = (dw_elf32_sym *)psh->gh_content;
  820|     28|    gsym = calloc(ecount,sizeof(struct generic_symentry));
  821|     28|    if (!gsym) {
  ------------------
  |  Branch (821:9): [True: 0, False: 28]
  ------------------
  822|      0|        free(psh->gh_content);
  823|      0|        psh->gh_content = 0;
  824|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  825|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  826|      0|    }
  827|     28|    orig_gsym = gsym;
  828|  17.1k|    for ( i = 0; i < ecount; ++i,++psym,++gsym) {
  ------------------
  |  Branch (828:18): [True: 17.1k, False: 28]
  ------------------
  829|  17.1k|        Dwarf_Unsigned bind = 0;
  830|  17.1k|        Dwarf_Unsigned type = 0;
  831|       |
  832|  17.1k|        ASNAR(ep->f_copy_word,gsym->gs_name,psym->st_name);
  ------------------
  |  |   53|  17.1k|    do {                                        \
  |  |   54|  17.1k|        (t) = 0;                                \
  |  |   55|  17.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  17.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 17.1k]
  |  |  ------------------
  ------------------
  833|  17.1k|        ASNAR(ep->f_copy_word,gsym->gs_value,psym->st_value);
  ------------------
  |  |   53|  17.1k|    do {                                        \
  |  |   54|  17.1k|        (t) = 0;                                \
  |  |   55|  17.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  17.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 17.1k]
  |  |  ------------------
  ------------------
  834|  17.1k|        ASNAR(ep->f_copy_word,gsym->gs_size,psym->st_size);
  ------------------
  |  |   53|  17.1k|    do {                                        \
  |  |   54|  17.1k|        (t) = 0;                                \
  |  |   55|  17.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  17.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 17.1k]
  |  |  ------------------
  ------------------
  835|  17.1k|        ASNAR(ep->f_copy_word,gsym->gs_info,psym->st_info);
  ------------------
  |  |   53|  17.1k|    do {                                        \
  |  |   54|  17.1k|        (t) = 0;                                \
  |  |   55|  17.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  17.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 17.1k]
  |  |  ------------------
  ------------------
  836|  17.1k|        ASNAR(ep->f_copy_word,gsym->gs_other,psym->st_other);
  ------------------
  |  |   53|  17.1k|    do {                                        \
  |  |   54|  17.1k|        (t) = 0;                                \
  |  |   55|  17.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  17.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 17.1k]
  |  |  ------------------
  ------------------
  837|  17.1k|        ASNAR(ep->f_copy_word,gsym->gs_shndx,psym->st_shndx);
  ------------------
  |  |   53|  17.1k|    do {                                        \
  |  |   54|  17.1k|        (t) = 0;                                \
  |  |   55|  17.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  17.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 17.1k]
  |  |  ------------------
  ------------------
  838|  17.1k|        bind = gsym->gs_info >> 4;
  839|  17.1k|        type = gsym->gs_info & 0xf;
  840|  17.1k|        gsym->gs_bind = bind;
  841|  17.1k|        gsym->gs_type = type;
  842|  17.1k|    }
  843|     28|    psh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|     28|#define TRUE 1
  ------------------
  844|     28|    psh->gh_load_type = Dwarf_Alloc_Malloc;
  845|     28|    *count_out = ecount;
  846|     28|    *gsym_out = orig_gsym;
  847|     28|    return DW_DLV_OK;
  ------------------
  |  |   59|     28|#define DW_DLV_OK         0
  ------------------
  848|     28|}
dwarf_elf_load_headers.c:_dwarf_generic_elf_load_symbols64:
  856|     30|{
  857|     30|    Dwarf_Unsigned ecount = 0;
  858|     30|    Dwarf_Unsigned size = 0;
  859|     30|    Dwarf_Unsigned offset = 0;
  860|     30|    Dwarf_Unsigned size2 = 0;
  861|     30|    Dwarf_Unsigned i = 0;
  862|     30|    dw_elf64_sym  *psym = 0;
  863|     30|    struct generic_symentry * gsym = 0;
  864|     30|    struct generic_symentry * orig_gsym = 0;
  865|     30|    int            res = 0;
  866|     30|    Dwarf_Unsigned flags = 0;
  867|     30|    char *         content = 0;
  868|       |
  869|     30|    flags = psh->gh_flags;
  870|     30|    size = psh->gh_size;
  871|     30|    offset = psh->gh_offset;
  872|     30|    if (psh->gh_sht_group_array ||
  ------------------
  |  Branch (872:9): [True: 0, False: 30]
  ------------------
  873|     30|        psh->gh_sht_group_array_count ||
  ------------------
  |  Branch (873:9): [True: 0, False: 30]
  ------------------
  874|     30|        psh->gh_content) {
  ------------------
  |  Branch (874:9): [True: 1, False: 29]
  ------------------
  875|      1|        *errcode = DW_DLE_ELF_GRPSTRING_SECTION_ERROR;
  ------------------
  |  | 1563|      1|#define DW_DLE_ELF_GRPSTRING_SECTION_ERROR     517
  ------------------
  876|      1|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
  877|      1|    }
  878|     29|    content = calloc(1,size);
  879|     29|    if (!content) {
  ------------------
  |  Branch (879:9): [True: 0, False: 29]
  ------------------
  880|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  881|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  882|      0|    }
  883|     29|    res = RRMOA(ep->f_fd,content,offset,size,
  ------------------
  |  |   65|     29|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     29|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  884|     29|        ep->f_filesize,errcode);
  885|     29|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     29|#define DW_DLV_OK         0
  ------------------
  |  Branch (885:9): [True: 1, False: 28]
  ------------------
  886|      1|        free(content);
  887|      1|        return res;
  888|      1|    }
  889|     28|    psh->gh_content = content;
  890|     28|    psh->gh_load_type = Dwarf_Alloc_Malloc;
  891|     28|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|     28|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (891:9): [True: 1, False: 27]
  ------------------
  892|       |#if defined(HAVE_ZLIB) && defined(HAVE_ZSTD)
  893|       |        *errcode = 0;
  894|       |        _dwarf_do_decompress_elf(ep,psh,errcode);
  895|       |        /* decompress and set new section size */
  896|       |
  897|       |        if (*errcode) {
  898|       |            free(psh->gh_content);
  899|       |            psh->gh_content = 0;
  900|       |            return DW_DLV_ERROR;
  901|       |        }
  902|       |#else /* COMPRESSED TEST */
  903|      1|        free(psh->gh_content);
  904|      1|        psh->gh_content = 0;
  905|      1|        *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      1|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
  906|      1|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
  907|      1|#endif /* COMPRESSED TEST */
  908|      1|    }
  909|     27|    size = psh->gh_size;
  910|     27|    ecount = (long)(size/sizeof(dw_elf64_sym));
  911|     27|    size2 = ecount * sizeof(dw_elf64_sym);
  912|     27|    if (size != size2) {
  ------------------
  |  Branch (912:9): [True: 5, False: 22]
  ------------------
  913|      5|        free(psh->gh_content);
  914|      5|        psh->gh_content = 0;
  915|      5|        *errcode = DW_DLE_SYMBOL_SECTION_SIZE_ERROR;
  ------------------
  |  | 1536|      5|#define DW_DLE_SYMBOL_SECTION_SIZE_ERROR       490
  ------------------
  916|      5|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      5|#define DW_DLV_ERROR      1
  ------------------
  917|      5|    }
  918|     22|    if (size >= ep->f_filesize ) {
  ------------------
  |  Branch (918:9): [True: 0, False: 22]
  ------------------
  919|      0|        free(psh->gh_content);
  920|      0|        psh->gh_content = 0;
  921|      0|        *errcode = DW_DLE_SYMBOL_SECTION_SIZE_ERROR;
  ------------------
  |  | 1536|      0|#define DW_DLE_SYMBOL_SECTION_SIZE_ERROR       490
  ------------------
  922|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  923|      0|    }
  924|     22|    psym = (dw_elf64_sym *)psh->gh_content;
  925|     22|    gsym = calloc(ecount,sizeof(struct generic_symentry));
  926|     22|    if (!gsym) {
  ------------------
  |  Branch (926:9): [True: 0, False: 22]
  ------------------
  927|      0|        free(psh->gh_content);
  928|      0|        psh->gh_content = 0;
  929|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  930|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  931|      0|    }
  932|     22|    res = RRMOA(ep->f_fd,psym,offset,size,
  ------------------
  |  |   65|     22|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     22|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  933|     22|        ep->f_filesize,errcode);
  934|     22|    if (res!= DW_DLV_OK) {
  ------------------
  |  |   59|     22|#define DW_DLV_OK         0
  ------------------
  |  Branch (934:9): [True: 0, False: 22]
  ------------------
  935|      0|        free(gsym);
  936|      0|        free(psh->gh_content);
  937|      0|        psh->gh_content = 0;
  938|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  939|      0|        return res;
  940|      0|    }
  941|     22|    orig_gsym = gsym;
  942|    808|    for ( i = 0; i < ecount; ++i,++psym,++gsym) {
  ------------------
  |  Branch (942:18): [True: 786, False: 22]
  ------------------
  943|    786|        Dwarf_Unsigned bind = 0;
  944|    786|        Dwarf_Unsigned type = 0;
  945|       |
  946|    786|        ASNAR(ep->f_copy_word,gsym->gs_name,psym->st_name);
  ------------------
  |  |   53|    786|    do {                                        \
  |  |   54|    786|        (t) = 0;                                \
  |  |   55|    786|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    786|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 786]
  |  |  ------------------
  ------------------
  947|    786|        ASNAR(ep->f_copy_word,gsym->gs_value,psym->st_value);
  ------------------
  |  |   53|    786|    do {                                        \
  |  |   54|    786|        (t) = 0;                                \
  |  |   55|    786|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    786|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 786]
  |  |  ------------------
  ------------------
  948|    786|        ASNAR(ep->f_copy_word,gsym->gs_size,psym->st_size);
  ------------------
  |  |   53|    786|    do {                                        \
  |  |   54|    786|        (t) = 0;                                \
  |  |   55|    786|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    786|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 786]
  |  |  ------------------
  ------------------
  949|    786|        ASNAR(ep->f_copy_word,gsym->gs_info,psym->st_info);
  ------------------
  |  |   53|    786|    do {                                        \
  |  |   54|    786|        (t) = 0;                                \
  |  |   55|    786|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    786|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 786]
  |  |  ------------------
  ------------------
  950|    786|        ASNAR(ep->f_copy_word,gsym->gs_other,psym->st_other);
  ------------------
  |  |   53|    786|    do {                                        \
  |  |   54|    786|        (t) = 0;                                \
  |  |   55|    786|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    786|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 786]
  |  |  ------------------
  ------------------
  951|    786|        ASNAR(ep->f_copy_word,gsym->gs_shndx,psym->st_shndx);
  ------------------
  |  |   53|    786|    do {                                        \
  |  |   54|    786|        (t) = 0;                                \
  |  |   55|    786|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    786|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 786]
  |  |  ------------------
  ------------------
  952|    786|        bind = gsym->gs_info >> 4;
  953|    786|        type = gsym->gs_info & 0xf;
  954|    786|        gsym->gs_bind = bind;
  955|    786|        gsym->gs_type = type;
  956|    786|    }
  957|     22|    psh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|     22|#define TRUE 1
  ------------------
  958|     22|    *count_out = ecount;
  959|     22|    *gsym_out = orig_gsym;
  960|     22|    return DW_DLV_OK;
  ------------------
  |  |   59|     22|#define DW_DLV_OK         0
  ------------------
  961|     22|}
dwarf_elf_load_headers.c:is_empty_section:
  352|   736k|{
  353|   736k|    if (type == SHT_NOBITS) {
  ------------------
  |  |   87|   736k|#define SHT_NOBITS 8
  ------------------
  |  Branch (353:9): [True: 7.06k, False: 728k]
  ------------------
  354|  7.06k|        return TRUE;
  ------------------
  |  |   33|  7.06k|#define TRUE 1
  ------------------
  355|  7.06k|    }
  356|   728k|    if (type == SHT_NULL) {
  ------------------
  |  |   44|   728k|#define SHT_NULL 0
  ------------------
  |  Branch (356:9): [True: 655k, False: 73.6k]
  ------------------
  357|   655k|        return TRUE;
  ------------------
  |  |   33|   655k|#define TRUE 1
  ------------------
  358|   655k|    }
  359|  73.6k|    return FALSE;
  ------------------
  |  |   36|  73.6k|#define FALSE 0
  ------------------
  360|   728k|}
dwarf_elf_load_headers.c:this_rel_is_a_section_dwarf_related:
 1764|  5.05k|{
 1765|  5.05k|    Dwarf_Unsigned oksecnum = 0;
 1766|  5.05k|    struct generic_shdr *gstarg = 0;
 1767|       |
 1768|  5.05k|    if (gshdr->gh_type != SHT_RELA &&
  ------------------
  |  |   56|  10.1k|#define SHT_RELA 4
  ------------------
  |  Branch (1768:9): [True: 2.82k, False: 2.23k]
  ------------------
 1769|  2.82k|        gshdr->gh_type != SHT_REL)  {
  ------------------
  |  |   59|  2.82k|#define SHT_REL 9
  ------------------
  |  Branch (1769:9): [True: 1.34k, False: 1.47k]
  ------------------
 1770|  1.34k|        *oksecnum_out = 0;
 1771|  1.34k|        return DW_DLV_OK;
  ------------------
  |  |   59|  1.34k|#define DW_DLV_OK         0
  ------------------
 1772|  1.34k|    }
 1773|  3.70k|    oksecnum = gshdr->gh_reloc_target_secnum;
 1774|  3.70k|    if (oksecnum >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (1774:9): [True: 57, False: 3.65k]
  ------------------
 1775|     57|        *oksecnum_out = 0;
 1776|     57|        *errcode = DW_DLE_ELF_SECTION_ERROR;
  ------------------
  |  | 1492|     57|#define DW_DLE_ELF_SECTION_ERROR               446
  ------------------
 1777|     57|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     57|#define DW_DLV_ERROR      1
  ------------------
 1778|     57|    }
 1779|  3.65k|    gstarg = ep->f_shdr+oksecnum;
 1780|  3.65k|    if (!gstarg->gh_is_dwarf) {
  ------------------
  |  Branch (1780:9): [True: 1.70k, False: 1.94k]
  ------------------
 1781|  1.70k|        *oksecnum_out = 0; /* no reloc needed. */
 1782|  1.70k|        return DW_DLV_OK;
  ------------------
  |  |   59|  1.70k|#define DW_DLV_OK         0
  ------------------
 1783|  1.70k|    }
 1784|  1.94k|    *oksecnum_out = (unsigned)oksecnum;
 1785|  1.94k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.94k|#define DW_DLV_OK         0
  ------------------
 1786|  3.65k|}
dwarf_elf_load_headers.c:_dwarf_elf_load_a_relx_batch:
 1613|  1.94k|{
 1614|  1.94k|    Dwarf_Unsigned count = 0;
 1615|  1.94k|    Dwarf_Unsigned size = 0;
 1616|  1.94k|    Dwarf_Unsigned flags = 0;
 1617|  1.94k|    Dwarf_Unsigned size2 = 0;
 1618|  1.94k|    Dwarf_Unsigned sizeg = 0;
 1619|  1.94k|    Dwarf_Unsigned offset = 0;
 1620|  1.94k|    int            res = 0;
 1621|  1.94k|    Dwarf_Unsigned object_reclen = 0;
 1622|  1.94k|    struct generic_rela *grel = 0;
 1623|  1.94k|    char *         relp = 0;
 1624|  1.94k|    int            local_alloc = FALSE;
  ------------------
  |  |   36|  1.94k|#define FALSE 0
  ------------------
 1625|       |
 1626|       |    /*  ASSERT: Caller guarantees localoffsetsize
 1627|       |        is a valid 4 or 8. */
 1628|       |    /*  ASSERT: Caller guarantees localrela is one
 1629|       |        of the 2 valid values 1 or 2 */
 1630|       |
 1631|  1.94k|    flags = gsh->gh_flags;
 1632|  1.94k|    offset = gsh->gh_offset;
 1633|  1.94k|    size = gsh->gh_size;
 1634|  1.94k|    if (size == 0) {
  ------------------
  |  Branch (1634:9): [True: 404, False: 1.54k]
  ------------------
 1635|    404|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|    404|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1636|    404|    }
 1637|  1.54k|    relp = (char *)gsh->gh_content;
 1638|  1.54k|    if (!relp) {
  ------------------
  |  Branch (1638:9): [True: 1.24k, False: 299]
  ------------------
 1639|  1.24k|        relp = (char *)malloc(size);
 1640|  1.24k|        local_alloc = TRUE;
  ------------------
  |  |   33|  1.24k|#define TRUE 1
  ------------------
 1641|  1.24k|    }
 1642|  1.54k|    if (!relp) {
  ------------------
  |  Branch (1642:9): [True: 0, False: 1.54k]
  ------------------
 1643|      0|        *errcode = DW_DLE_REL_ALLOC;
  ------------------
  |  | 1178|      0|#define DW_DLE_REL_ALLOC                       133
  ------------------
 1644|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1645|      0|    }
 1646|  1.54k|    if ((offset > ep->f_filesize)||
  ------------------
  |  Branch (1646:9): [True: 107, False: 1.43k]
  ------------------
 1647|  1.43k|        (size > ep->f_filesize) ||
  ------------------
  |  Branch (1647:9): [True: 0, False: 1.43k]
  ------------------
 1648|  1.43k|        ((size +offset) > ep->f_filesize)) {
  ------------------
  |  Branch (1648:9): [True: 25, False: 1.41k]
  ------------------
 1649|    132|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|    132|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1650|    132|        if (local_alloc) {
  ------------------
  |  Branch (1650:13): [True: 132, False: 0]
  ------------------
 1651|    132|            free(relp);
 1652|    132|        }
 1653|    132|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    132|#define DW_DLV_ERROR      1
  ------------------
 1654|    132|    }
 1655|  1.41k|    res = RRMOA(ep->f_fd,relp,offset,size,
  ------------------
  |  |   65|  1.41k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  1.41k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1656|  1.41k|        ep->f_filesize,errcode);
 1657|  1.41k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.41k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1657:9): [True: 0, False: 1.41k]
  ------------------
 1658|      0|        free(relp);
 1659|      0|        free(grel);
 1660|      0|        return res;
 1661|      0|    }
 1662|  1.41k|    if (local_alloc) {
  ------------------
  |  Branch (1662:9): [True: 1.11k, False: 299]
  ------------------
 1663|  1.11k|        gsh->gh_content = relp;
 1664|  1.11k|        gsh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|  1.11k|#define TRUE 1
  ------------------
 1665|  1.11k|        gsh->gh_load_type = Dwarf_Alloc_Malloc;
 1666|  1.11k|    }
 1667|  1.41k|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|  1.41k|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (1667:9): [True: 2, False: 1.41k]
  ------------------
 1668|       |#if defined(HAVE_ZLIB) && defined(HAVE_ZSTD)
 1669|       |        *errcode = 0;
 1670|       |        _dwarf_do_decompress_elf(ep,gsh,errcode);
 1671|       |        /* decompress and set new section size */
 1672|       |        if (*errcode) {
 1673|       |            return DW_DLV_ERROR;
 1674|       |        }
 1675|       |#else /* COMPRESSED TEST */
 1676|      2|        *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      2|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
 1677|      2|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
 1678|      2|#endif /* COMPRESSED TEST */
 1679|      2|    }
 1680|  1.41k|    size = gsh->gh_size;
 1681|  1.41k|    if (localoffsize == RelocOffset32) {
  ------------------
  |  Branch (1681:9): [True: 835, False: 576]
  ------------------
 1682|    835|        if (localrela ==  RelocIsRela) {
  ------------------
  |  Branch (1682:13): [True: 310, False: 525]
  ------------------
 1683|    310|            object_reclen = sizeof(dw_elf32_rela);
 1684|    310|            count = (long)(size/object_reclen);
 1685|    310|            size2 = count * object_reclen;
 1686|    310|            if (size != size2) {
  ------------------
  |  Branch (1686:17): [True: 20, False: 290]
  ------------------
 1687|     20|                *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|     20|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1688|     20|                return DW_DLV_ERROR;
  ------------------
  |  |   60|     20|#define DW_DLV_ERROR      1
  ------------------
 1689|     20|            }
 1690|    525|        } else {
 1691|    525|            object_reclen = sizeof(dw_elf32_rel);
 1692|    525|            count = (long)(size/object_reclen);
 1693|    525|            size2 = count * object_reclen;
 1694|    525|            if (size != size2) {
  ------------------
  |  Branch (1694:17): [True: 3, False: 522]
  ------------------
 1695|      3|                *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      3|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1696|      3|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
 1697|      3|            }
 1698|    525|        }
 1699|    835|    } else {
 1700|    576|        if (localrela ==  RelocIsRela) {
  ------------------
  |  Branch (1700:13): [True: 303, False: 273]
  ------------------
 1701|    303|            object_reclen = sizeof(dw_elf64_rela);
 1702|    303|            count = (long)(size/object_reclen);
 1703|    303|            size2 = count * object_reclen;
 1704|    303|            if (size != size2) {
  ------------------
  |  Branch (1704:17): [True: 9, False: 294]
  ------------------
 1705|      9|                *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      9|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1706|      9|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      9|#define DW_DLV_ERROR      1
  ------------------
 1707|      9|            }
 1708|    303|        } else {
 1709|    273|            object_reclen = sizeof(dw_elf64_rel);
 1710|    273|            count = (long)(size/object_reclen);
 1711|    273|            size2 = count * object_reclen;
 1712|    273|            if (size != size2) {
  ------------------
  |  Branch (1712:17): [True: 3, False: 270]
  ------------------
 1713|      3|                *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      3|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1714|      3|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
 1715|      3|            }
 1716|    273|        }
 1717|    576|    }
 1718|       |
 1719|  1.37k|    sizeg = count*sizeof(struct generic_rela);
 1720|  1.37k|    grel = (struct generic_rela *)malloc(sizeg);
 1721|  1.37k|    if (!grel) {
  ------------------
  |  Branch (1721:9): [True: 0, False: 1.37k]
  ------------------
 1722|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1723|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1724|      0|    }
 1725|  1.37k|    if (localoffsize == RelocOffset32) {
  ------------------
  |  Branch (1725:9): [True: 812, False: 564]
  ------------------
 1726|    812|        if (localrela ==  RelocIsRela) {
  ------------------
  |  Branch (1726:13): [True: 290, False: 522]
  ------------------
 1727|    290|            res = generic_rel_from_rela32(ep,gsh,
 1728|    290|                (dw_elf32_rela *)gsh->gh_content,grel,errcode);
 1729|    522|        } else {
 1730|    522|            res = generic_rel_from_rel32(ep,gsh,
 1731|    522|                (dw_elf32_rel *)gsh->gh_content,grel,errcode);
 1732|    522|        }
 1733|    812|    } else {
 1734|    564|        if (localrela ==  RelocIsRela) {
  ------------------
  |  Branch (1734:13): [True: 294, False: 270]
  ------------------
 1735|    294|            res = generic_rel_from_rela64(ep,gsh,
 1736|    294|                (dw_elf64_rela *)gsh->gh_content,grel,errcode);
 1737|    294|        } else {
 1738|    270|            res = generic_rel_from_rel64(ep,gsh,
 1739|    270|                (dw_elf64_rel *)gsh->gh_content,grel,errcode);
 1740|    270|        }
 1741|    564|    }
 1742|  1.37k|    if (res == DW_DLV_OK) {
  ------------------
  |  |   59|  1.37k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1742:9): [True: 1.37k, False: 0]
  ------------------
 1743|  1.37k|        gsh->gh_relcount = count;
 1744|  1.37k|        gsh->gh_rels = grel;
 1745|  1.37k|        *count_out = count;
 1746|  1.37k|        *grel_out = grel;
 1747|  1.37k|        return res;
 1748|  1.37k|    }
 1749|       |    /* Some sort of issue */
 1750|      0|    count_out = 0;
 1751|      0|    free(grel);
 1752|      0|    return res;
 1753|  1.37k|}
dwarf_elf_load_headers.c:generic_rel_from_rela32:
 1042|    290|{
 1043|    290|    Dwarf_Unsigned ecount = 0;
 1044|    290|    Dwarf_Unsigned size = gsh->gh_size;
 1045|    290|    Dwarf_Unsigned size2 = 0;
 1046|    290|    Dwarf_Unsigned i = 0;
 1047|       |
 1048|    290|    ecount = size/sizeof(dw_elf32_rela);
 1049|    290|    size2 = ecount * sizeof(dw_elf32_rela);
 1050|    290|    if (size >= ep->f_filesize) {
  ------------------
  |  Branch (1050:9): [True: 0, False: 290]
  ------------------
 1051|      0|        *errcode = DW_DLE_RELOCATION_SECTION_SIZE_ERROR;
  ------------------
  |  | 1535|      0|#define DW_DLE_RELOCATION_SECTION_SIZE_ERROR   489
  ------------------
 1052|      0|        return  DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1053|      0|    }
 1054|    290|    if (size != size2) {
  ------------------
  |  Branch (1054:9): [True: 0, False: 290]
  ------------------
 1055|      0|        *errcode = DW_DLE_RELOCATION_SECTION_SIZE_ERROR;
  ------------------
  |  | 1535|      0|#define DW_DLE_RELOCATION_SECTION_SIZE_ERROR   489
  ------------------
 1056|      0|        return  DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1057|      0|    }
 1058|  18.1k|    for ( i = 0; i < ecount; ++i,++relp,++grel) {
  ------------------
  |  Branch (1058:18): [True: 17.8k, False: 290]
  ------------------
 1059|  17.8k|        ASNAR(ep->f_copy_word,grel->gr_offset,relp->r_offset);
  ------------------
  |  |   53|  17.8k|    do {                                        \
  |  |   54|  17.8k|        (t) = 0;                                \
  |  |   55|  17.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  17.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 17.8k]
  |  |  ------------------
  ------------------
 1060|  17.8k|        ASNAR(ep->f_copy_word,grel->gr_info,relp->r_info);
  ------------------
  |  |   53|  17.8k|    do {                                        \
  |  |   54|  17.8k|        (t) = 0;                                \
  |  |   55|  17.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  17.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 17.8k]
  |  |  ------------------
  ------------------
 1061|       |        /* addend signed */
 1062|  17.8k|        ASNAR(ep->f_copy_word,grel->gr_addend,relp->r_addend);
  ------------------
  |  |   53|  17.8k|    do {                                        \
  |  |   54|  17.8k|        (t) = 0;                                \
  |  |   55|  17.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  17.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 17.8k]
  |  |  ------------------
  ------------------
 1063|  17.8k|        SIGN_EXTEND(grel->gr_addend,sizeof(relp->r_addend));
  ------------------
  |  |  102|  17.8k|    do {                                                          \
  |  |  103|  17.8k|        if (*(Dwarf_Sbyte *)((char *)&(dest)+ ((length)-1)) < 0) { \
  |  |  ------------------
  |  |  |  Branch (103:13): [True: 1.53k, False: 16.2k]
  |  |  ------------------
  |  |  104|  1.53k|            memcpy((char *)&(dest)+(length),                      \
  |  |  105|  1.53k|                "\xff\xff\xff\xff\xff\xff\xff\xff",               \
  |  |  106|  1.53k|                sizeof(dest) - (length));                         \
  |  |  107|  1.53k|        }                                                         \
  |  |  108|  17.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (108:14): [Folded, False: 17.8k]
  |  |  ------------------
  ------------------
 1064|  17.8k|        grel->gr_sym  = grel->gr_info>>8; /* ELF32_R_SYM */
 1065|  17.8k|        grel->gr_type = grel->gr_info & 0xff;
 1066|  17.8k|        grel->gr_is_rela = TRUE;
  ------------------
  |  |   33|  17.8k|#define TRUE 1
  ------------------
 1067|  17.8k|    }
 1068|    290|    return DW_DLV_OK;
  ------------------
  |  |   59|    290|#define DW_DLV_OK         0
  ------------------
 1069|    290|}
dwarf_elf_load_headers.c:generic_rel_from_rel32:
 1131|    522|{
 1132|    522|    Dwarf_Unsigned ecount = 0;
 1133|    522|    Dwarf_Unsigned size = gsh->gh_size;
 1134|    522|    Dwarf_Unsigned size2 = 0;
 1135|    522|    Dwarf_Unsigned i = 0;
 1136|       |
 1137|    522|    ecount = size/sizeof(dw_elf32_rel);
 1138|    522|    size2 = ecount * sizeof(dw_elf32_rel);
 1139|    522|    if (size >= ep->f_filesize) {
  ------------------
  |  Branch (1139:9): [True: 0, False: 522]
  ------------------
 1140|      0|        *errcode = DW_DLE_RELOCATION_SECTION_SIZE_ERROR;
  ------------------
  |  | 1535|      0|#define DW_DLE_RELOCATION_SECTION_SIZE_ERROR   489
  ------------------
 1141|      0|        return  DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1142|      0|    }
 1143|    522|    if (size != size2) {
  ------------------
  |  Branch (1143:9): [True: 0, False: 522]
  ------------------
 1144|      0|        *errcode = DW_DLE_RELOCATION_SECTION_SIZE_ERROR;
  ------------------
  |  | 1535|      0|#define DW_DLE_RELOCATION_SECTION_SIZE_ERROR   489
  ------------------
 1145|      0|        return  DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1146|      0|    }
 1147|   125k|    for ( i = 0; i < ecount; ++i,++relp,++grel) {
  ------------------
  |  Branch (1147:18): [True: 124k, False: 522]
  ------------------
 1148|   124k|        ASNAR(ep->f_copy_word,grel->gr_offset,relp->r_offset);
  ------------------
  |  |   53|   124k|    do {                                        \
  |  |   54|   124k|        (t) = 0;                                \
  |  |   55|   124k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   124k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 124k]
  |  |  ------------------
  ------------------
 1149|   124k|        ASNAR(ep->f_copy_word,grel->gr_info,relp->r_info);
  ------------------
  |  |   53|   124k|    do {                                        \
  |  |   54|   124k|        (t) = 0;                                \
  |  |   55|   124k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   124k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 124k]
  |  |  ------------------
  ------------------
 1150|   124k|        grel->gr_addend  = 0; /* Unused for plain .rel */
 1151|   124k|        grel->gr_sym  = grel->gr_info >>8; /* ELF32_R_SYM */
 1152|   124k|        grel->gr_is_rela = FALSE;
  ------------------
  |  |   36|   124k|#define FALSE 0
  ------------------
 1153|   124k|        grel->gr_type = grel->gr_info & 0xff;
 1154|   124k|    }
 1155|    522|    return DW_DLV_OK;
  ------------------
  |  |   59|    522|#define DW_DLV_OK         0
  ------------------
 1156|    522|}
dwarf_elf_load_headers.c:generic_rel_from_rela64:
 1077|    294|{
 1078|    294|    Dwarf_Unsigned ecount = 0;
 1079|    294|    Dwarf_Unsigned size = gsh->gh_size;
 1080|    294|    Dwarf_Unsigned size2 = 0;
 1081|    294|    Dwarf_Unsigned i = 0;
 1082|    294|    int objlittleendian = (ep->f_endian == DW_END_little);
  ------------------
  |  | 1115|    294|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1083|    294|    int ismips64 = (ep->f_machine == EM_MIPS);
  ------------------
  |  |  209|    294|#define EM_MIPS          8
  ------------------
 1084|    294|    int issparcv9 = (ep->f_machine == EM_SPARCV9);
  ------------------
  |  |  263|    294|#define EM_SPARCV9       43
  ------------------
 1085|       |
 1086|    294|    ecount = size/sizeof(dw_elf64_rela);
 1087|    294|    size2 = ecount * sizeof(dw_elf64_rela);
 1088|    294|    if (size >= ep->f_filesize) {
  ------------------
  |  Branch (1088:9): [True: 0, False: 294]
  ------------------
 1089|      0|        *errcode = DW_DLE_RELOCATION_SECTION_SIZE_ERROR;
  ------------------
  |  | 1535|      0|#define DW_DLE_RELOCATION_SECTION_SIZE_ERROR   489
  ------------------
 1090|      0|        return  DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1091|      0|    }
 1092|    294|    if (size != size2) {
  ------------------
  |  Branch (1092:9): [True: 0, False: 294]
  ------------------
 1093|      0|        *errcode = DW_DLE_RELOCATION_SECTION_SIZE_ERROR;
  ------------------
  |  | 1535|      0|#define DW_DLE_RELOCATION_SECTION_SIZE_ERROR   489
  ------------------
 1094|      0|        return  DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1095|      0|    }
 1096|  29.4k|    for ( i = 0; i < ecount; ++i,++relp,++grel) {
  ------------------
  |  Branch (1096:18): [True: 29.1k, False: 294]
  ------------------
 1097|  29.1k|        ASNAR(ep->f_copy_word,grel->gr_offset,relp->r_offset);
  ------------------
  |  |   53|  29.1k|    do {                                        \
  |  |   54|  29.1k|        (t) = 0;                                \
  |  |   55|  29.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  29.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 29.1k]
  |  |  ------------------
  ------------------
 1098|  29.1k|        ASNAR(ep->f_copy_word,grel->gr_info,relp->r_info);
  ------------------
  |  |   53|  29.1k|    do {                                        \
  |  |   54|  29.1k|        (t) = 0;                                \
  |  |   55|  29.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  29.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 29.1k]
  |  |  ------------------
  ------------------
 1099|  29.1k|        ASNAR(ep->f_copy_word,grel->gr_addend,relp->r_addend);
  ------------------
  |  |   53|  29.1k|    do {                                        \
  |  |   54|  29.1k|        (t) = 0;                                \
  |  |   55|  29.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  29.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 29.1k]
  |  |  ------------------
  ------------------
 1100|  29.1k|        SIGN_EXTEND(grel->gr_addend,sizeof(relp->r_addend));
  ------------------
  |  |  102|  29.1k|    do {                                                          \
  |  |  103|  29.1k|        if (*(Dwarf_Sbyte *)((char *)&(dest)+ ((length)-1)) < 0) { \
  |  |  ------------------
  |  |  |  Branch (103:13): [True: 1.15k, False: 27.9k]
  |  |  ------------------
  |  |  104|  1.15k|            memcpy((char *)&(dest)+(length),                      \
  |  |  105|  1.15k|                "\xff\xff\xff\xff\xff\xff\xff\xff",               \
  |  |  106|  1.15k|                sizeof(dest) - (length));                         \
  |  |  107|  1.15k|        }                                                         \
  |  |  108|  29.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (108:14): [Folded, False: 29.1k]
  |  |  ------------------
  ------------------
 1101|  29.1k|        if (ismips64 && objlittleendian ) {
  ------------------
  |  Branch (1101:13): [True: 1.81k, False: 27.2k]
  |  Branch (1101:25): [True: 1.52k, False: 287]
  ------------------
 1102|  1.52k|            char realsym[4];
 1103|       |
 1104|  1.52k|            memcpy(realsym,&relp->r_info,sizeof(realsym));
 1105|  1.52k|            ASNAR(ep->f_copy_word,grel->gr_sym,realsym);
  ------------------
  |  |   53|  1.52k|    do {                                        \
  |  |   54|  1.52k|        (t) = 0;                                \
  |  |   55|  1.52k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
 1106|  1.52k|            grel->gr_type  = relp->r_info[7];
 1107|  1.52k|            grel->gr_type2 = relp->r_info[6];
 1108|  1.52k|            grel->gr_type3 = relp->r_info[5];
 1109|  27.5k|        } else if (issparcv9) {
  ------------------
  |  Branch (1109:20): [True: 675, False: 26.9k]
  ------------------
 1110|       |            /*  Always Big Endian?  */
 1111|    675|            char realsym[4];
 1112|       |
 1113|    675|            memcpy(realsym,&relp->r_info,sizeof(realsym));
 1114|    675|            ASNAR(ep->f_copy_word,grel->gr_sym,realsym);
  ------------------
  |  |   53|    675|    do {                                        \
  |  |   54|    675|        (t) = 0;                                \
  |  |   55|    675|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    675|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 675]
  |  |  ------------------
  ------------------
 1115|    675|            grel->gr_type  = relp->r_info[7];
 1116|  26.9k|        } else {
 1117|  26.9k|            grel->gr_sym  = grel->gr_info >> 32;
 1118|  26.9k|            grel->gr_type = grel->gr_info & 0xffffffff;
 1119|  26.9k|        }
 1120|  29.1k|        grel->gr_is_rela = TRUE;
  ------------------
  |  |   33|  29.1k|#define TRUE 1
  ------------------
 1121|  29.1k|    }
 1122|    294|    return DW_DLV_OK;
  ------------------
  |  |   59|    294|#define DW_DLV_OK         0
  ------------------
 1123|    294|}
dwarf_elf_load_headers.c:generic_rel_from_rel64:
 1164|    270|{
 1165|    270|    Dwarf_Unsigned ecount = 0;
 1166|    270|    Dwarf_Unsigned size = gsh->gh_size;
 1167|    270|    Dwarf_Unsigned size2 = 0;
 1168|    270|    Dwarf_Unsigned i = 0;
 1169|    270|    int objlittleendian = (ep->f_endian == DW_END_little);
  ------------------
  |  | 1115|    270|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1170|    270|    int ismips64 = (ep->f_machine == EM_MIPS);
  ------------------
  |  |  209|    270|#define EM_MIPS          8
  ------------------
 1171|    270|    int issparcv9 = (ep->f_machine == EM_SPARCV9);
  ------------------
  |  |  263|    270|#define EM_SPARCV9       43
  ------------------
 1172|       |
 1173|    270|    ecount = size/sizeof(dw_elf64_rel);
 1174|    270|    size2 = ecount * sizeof(dw_elf64_rel);
 1175|    270|    if (size >= ep->f_filesize) {
  ------------------
  |  Branch (1175:9): [True: 0, False: 270]
  ------------------
 1176|      0|        *errcode = DW_DLE_RELOCATION_SECTION_SIZE_ERROR;
  ------------------
  |  | 1535|      0|#define DW_DLE_RELOCATION_SECTION_SIZE_ERROR   489
  ------------------
 1177|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1178|      0|    }
 1179|    270|    if (size != size2) {
  ------------------
  |  Branch (1179:9): [True: 0, False: 270]
  ------------------
 1180|      0|        *errcode = DW_DLE_RELOCATION_SECTION_SIZE_ERROR;
  ------------------
  |  | 1535|      0|#define DW_DLE_RELOCATION_SECTION_SIZE_ERROR   489
  ------------------
 1181|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1182|      0|    }
 1183|  13.1k|    for ( i = 0; i < ecount; ++i,++relp,++grel) {
  ------------------
  |  Branch (1183:18): [True: 12.8k, False: 270]
  ------------------
 1184|  12.8k|        ASNAR(ep->f_copy_word,grel->gr_offset,relp->r_offset);
  ------------------
  |  |   53|  12.8k|    do {                                        \
  |  |   54|  12.8k|        (t) = 0;                                \
  |  |   55|  12.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  12.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 12.8k]
  |  |  ------------------
  ------------------
 1185|  12.8k|        ASNAR(ep->f_copy_word,grel->gr_info,relp->r_info);
  ------------------
  |  |   53|  12.8k|    do {                                        \
  |  |   54|  12.8k|        (t) = 0;                                \
  |  |   55|  12.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  12.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 12.8k]
  |  |  ------------------
  ------------------
 1186|  12.8k|        grel->gr_addend  = 0; /* Unused for plain .rel */
 1187|  12.8k|        if (ismips64 && objlittleendian ) {
  ------------------
  |  Branch (1187:13): [True: 3.61k, False: 9.26k]
  |  Branch (1187:25): [True: 3.39k, False: 218]
  ------------------
 1188|  3.39k|            char realsym[4];
 1189|       |
 1190|  3.39k|            memcpy(realsym,&relp->r_info,sizeof(realsym));
 1191|  3.39k|            ASNAR(ep->f_copy_word,grel->gr_sym,realsym);
  ------------------
  |  |   53|  3.39k|    do {                                        \
  |  |   54|  3.39k|        (t) = 0;                                \
  |  |   55|  3.39k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.39k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.39k]
  |  |  ------------------
  ------------------
 1192|  3.39k|            grel->gr_type  = relp->r_info[7];
 1193|  3.39k|            grel->gr_type2 = relp->r_info[6];
 1194|  3.39k|            grel->gr_type3 = relp->r_info[5];
 1195|  9.48k|        } else if (issparcv9) {
  ------------------
  |  Branch (1195:20): [True: 550, False: 8.93k]
  ------------------
 1196|       |            /*  Always Big Endian?  */
 1197|    550|            char realsym[4];
 1198|       |
 1199|    550|            memcpy(realsym,&relp->r_info,sizeof(realsym));
 1200|    550|            ASNAR(ep->f_copy_word,grel->gr_sym,realsym);
  ------------------
  |  |   53|    550|    do {                                        \
  |  |   54|    550|        (t) = 0;                                \
  |  |   55|    550|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    550|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 550]
  |  |  ------------------
  ------------------
 1201|    550|            grel->gr_type  = relp->r_info[7];
 1202|  8.93k|        } else {
 1203|  8.93k|            grel->gr_sym  = grel->gr_info >>32;
 1204|  8.93k|            grel->gr_type = grel->gr_info & 0xffffffff;
 1205|  8.93k|        }
 1206|  12.8k|        grel->gr_is_rela = FALSE;
  ------------------
  |  |   36|  12.8k|#define FALSE 0
  ------------------
 1207|  12.8k|    }
 1208|    270|    return DW_DLV_OK;
  ------------------
  |  |   59|    270|#define DW_DLV_OK         0
  ------------------
 1209|    270|}
dwarf_elf_load_headers.c:elf_load_elf_header32:
 1934|  3.04k|{
 1935|  3.04k|    int res = 0;
 1936|  3.04k|    dw_elf32_ehdr ehdr32;
 1937|  3.04k|    struct generic_ehdr *ehdr = 0;
 1938|       |
 1939|  3.04k|    ehdr32 = eh32_zero;
 1940|  3.04k|    res = RRMOA(ep->f_fd,&ehdr32,0,sizeof(ehdr32),
  ------------------
  |  |   65|  3.04k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  3.04k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1941|  3.04k|        ep->f_filesize,errcode);
 1942|  3.04k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  3.04k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1942:9): [True: 4, False: 3.04k]
  ------------------
 1943|      4|        return res;
 1944|      4|    }
 1945|  3.04k|    ehdr = (struct generic_ehdr *)calloc(1,
 1946|  3.04k|        sizeof(struct generic_ehdr));
 1947|  3.04k|    if (!ehdr) {
  ------------------
  |  Branch (1947:9): [True: 0, False: 3.04k]
  ------------------
 1948|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1949|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1950|      0|    }
 1951|  3.04k|    res  = generic_ehdr_from_32(ep,ehdr,&ehdr32,errcode);
 1952|  3.04k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  3.04k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1952:9): [True: 26, False: 3.01k]
  ------------------
 1953|     26|        free(ehdr);
 1954|     26|        return res;
 1955|     26|    }
 1956|  3.01k|    ep->f_machine = (unsigned)ehdr->ge_machine;
 1957|  3.01k|    ep->f_flags = ehdr->ge_flags;
 1958|  3.01k|    return res;
 1959|  3.04k|}
dwarf_elf_load_headers.c:generic_ehdr_from_32:
  366|  3.04k|{
  367|  3.04k|    int i = 0;
  368|       |
  369|  51.6k|    for (i = 0; i < EI_NIDENT; ++i) {
  ------------------
  |  |  926|  51.6k|#define EI_NIDENT 16
  ------------------
  |  Branch (369:17): [True: 48.6k, False: 3.04k]
  ------------------
  370|  48.6k|        ehdr->ge_ident[i] = e->e_ident[i];
  371|  48.6k|    }
  372|  3.04k|    ASNAR(ep->f_copy_word,ehdr->ge_type,e->e_type);
  ------------------
  |  |   53|  3.04k|    do {                                        \
  |  |   54|  3.04k|        (t) = 0;                                \
  |  |   55|  3.04k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.04k]
  |  |  ------------------
  ------------------
  373|  3.04k|    ASNAR(ep->f_copy_word,ehdr->ge_machine,e->e_machine);
  ------------------
  |  |   53|  3.04k|    do {                                        \
  |  |   54|  3.04k|        (t) = 0;                                \
  |  |   55|  3.04k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.04k]
  |  |  ------------------
  ------------------
  374|  3.04k|    ASNAR(ep->f_copy_word,ehdr->ge_version,e->e_version);
  ------------------
  |  |   53|  3.04k|    do {                                        \
  |  |   54|  3.04k|        (t) = 0;                                \
  |  |   55|  3.04k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.04k]
  |  |  ------------------
  ------------------
  375|  3.04k|    ASNAR(ep->f_copy_word,ehdr->ge_entry,e->e_entry);
  ------------------
  |  |   53|  3.04k|    do {                                        \
  |  |   54|  3.04k|        (t) = 0;                                \
  |  |   55|  3.04k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.04k]
  |  |  ------------------
  ------------------
  376|  3.04k|    ASNAR(ep->f_copy_word,ehdr->ge_phoff,e->e_phoff);
  ------------------
  |  |   53|  3.04k|    do {                                        \
  |  |   54|  3.04k|        (t) = 0;                                \
  |  |   55|  3.04k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.04k]
  |  |  ------------------
  ------------------
  377|  3.04k|    ASNAR(ep->f_copy_word,ehdr->ge_shoff,e->e_shoff);
  ------------------
  |  |   53|  3.04k|    do {                                        \
  |  |   54|  3.04k|        (t) = 0;                                \
  |  |   55|  3.04k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.04k]
  |  |  ------------------
  ------------------
  378|  3.04k|    ASNAR(ep->f_copy_word,ehdr->ge_flags,e->e_flags);
  ------------------
  |  |   53|  3.04k|    do {                                        \
  |  |   54|  3.04k|        (t) = 0;                                \
  |  |   55|  3.04k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.04k]
  |  |  ------------------
  ------------------
  379|  3.04k|    ASNAR(ep->f_copy_word,ehdr->ge_ehsize,e->e_ehsize);
  ------------------
  |  |   53|  3.04k|    do {                                        \
  |  |   54|  3.04k|        (t) = 0;                                \
  |  |   55|  3.04k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.04k]
  |  |  ------------------
  ------------------
  380|  3.04k|    ASNAR(ep->f_copy_word,ehdr->ge_phentsize,e->e_phentsize);
  ------------------
  |  |   53|  3.04k|    do {                                        \
  |  |   54|  3.04k|        (t) = 0;                                \
  |  |   55|  3.04k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.04k]
  |  |  ------------------
  ------------------
  381|  3.04k|    ASNAR(ep->f_copy_word,ehdr->ge_phnum,e->e_phnum);
  ------------------
  |  |   53|  3.04k|    do {                                        \
  |  |   54|  3.04k|        (t) = 0;                                \
  |  |   55|  3.04k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.04k]
  |  |  ------------------
  ------------------
  382|  3.04k|    ASNAR(ep->f_copy_word,ehdr->ge_shentsize,e->e_shentsize);
  ------------------
  |  |   53|  3.04k|    do {                                        \
  |  |   54|  3.04k|        (t) = 0;                                \
  |  |   55|  3.04k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.04k]
  |  |  ------------------
  ------------------
  383|  3.04k|    ASNAR(ep->f_copy_word,ehdr->ge_shnum,e->e_shnum);
  ------------------
  |  |   53|  3.04k|    do {                                        \
  |  |   54|  3.04k|        (t) = 0;                                \
  |  |   55|  3.04k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.04k]
  |  |  ------------------
  ------------------
  384|  3.04k|    ASNAR(ep->f_copy_word,ehdr->ge_shstrndx,e->e_shstrndx);
  ------------------
  |  |   53|  3.04k|    do {                                        \
  |  |   54|  3.04k|        (t) = 0;                                \
  |  |   55|  3.04k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.04k]
  |  |  ------------------
  ------------------
  385|  3.04k|    if (!ehdr->ge_shoff) {
  ------------------
  |  Branch (385:9): [True: 1, False: 3.03k]
  ------------------
  386|      1|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      1|#define DW_DLV_NO_ENTRY  -1
  ------------------
  387|      1|    }
  388|  3.03k|    if (ehdr->ge_shoff < sizeof(dw_elf32_ehdr)) {
  ------------------
  |  Branch (388:9): [True: 6, False: 3.03k]
  ------------------
  389|       |        /* offset is inside the header! */
  390|      6|        *errcode = DW_DLE_TOO_FEW_SECTIONS;
  ------------------
  |  | 1540|      6|#define DW_DLE_TOO_FEW_SECTIONS                494
  ------------------
  391|      6|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      6|#define DW_DLV_ERROR      1
  ------------------
  392|      6|    }
  393|  3.03k|    if (ehdr->ge_shstrndx == SHN_XINDEX) {
  ------------------
  |  |  302|  3.03k|#define SHN_XINDEX 0xffff
  ------------------
  |  Branch (393:9): [True: 46, False: 2.98k]
  ------------------
  394|     46|        ehdr->ge_strndx_extended = TRUE;
  ------------------
  |  |   33|     46|#define TRUE 1
  ------------------
  395|  2.98k|    } else {
  396|  2.98k|        ehdr->ge_strndx_in_strndx = TRUE;
  ------------------
  |  |   33|  2.98k|#define TRUE 1
  ------------------
  397|  2.98k|        if (ehdr->ge_shstrndx < 1) {
  ------------------
  |  Branch (397:13): [True: 1, False: 2.98k]
  ------------------
  398|      1|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|      1|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
  399|      1|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
  400|      1|        }
  401|  2.98k|    }
  402|       |    /*  If !ge_strndx_extended && !ehdr->ge_shnum
  403|       |        this is a very unusual case.  */
  404|  3.03k|    if (!ehdr->ge_shnum) {
  ------------------
  |  Branch (404:9): [True: 94, False: 2.93k]
  ------------------
  405|     94|        ehdr->ge_shnum_extended = TRUE;
  ------------------
  |  |   33|     94|#define TRUE 1
  ------------------
  406|  2.93k|    } else {
  407|  2.93k|        ehdr->ge_shnum_in_shnum = TRUE;
  ------------------
  |  |   33|  2.93k|#define TRUE 1
  ------------------
  408|  2.93k|        if (!ehdr->ge_shnum) {
  ------------------
  |  Branch (408:13): [True: 0, False: 2.93k]
  ------------------
  409|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  410|      0|        }
  411|  2.93k|        if (ehdr->ge_shnum < 3) {
  ------------------
  |  Branch (411:13): [True: 2, False: 2.93k]
  ------------------
  412|      2|            *errcode = DW_DLE_TOO_FEW_SECTIONS;
  ------------------
  |  | 1540|      2|#define DW_DLE_TOO_FEW_SECTIONS                494
  ------------------
  413|      2|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
  414|      2|        }
  415|  2.93k|    }
  416|  3.03k|    if (ehdr->ge_shnum_in_shnum &&
  ------------------
  |  Branch (416:9): [True: 2.93k, False: 94]
  ------------------
  417|  2.93k|        ehdr->ge_strndx_in_strndx &&
  ------------------
  |  Branch (417:9): [True: 2.89k, False: 42]
  ------------------
  418|  2.89k|        (ehdr->ge_shstrndx >= ehdr->ge_shnum)) {
  ------------------
  |  Branch (418:9): [True: 16, False: 2.87k]
  ------------------
  419|     16|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|     16|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
  420|     16|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     16|#define DW_DLV_ERROR      1
  ------------------
  421|     16|    }
  422|       |
  423|  3.01k|    ep->f_machine = (unsigned int)ehdr->ge_machine;
  424|  3.01k|    ep->f_ftype = (unsigned int)ehdr->ge_type;
  425|  3.01k|    ep->f_ehdr = ehdr;
  426|  3.01k|    ep->f_loc_ehdr.g_name = "Elf File Header";
  427|  3.01k|    ep->f_loc_ehdr.g_offset = 0;
  428|  3.01k|    ep->f_loc_ehdr.g_count = 1;
  429|  3.01k|    ep->f_loc_ehdr.g_entrysize = sizeof(dw_elf32_ehdr);
  430|  3.01k|    ep->f_loc_ehdr.g_totalsize = sizeof(dw_elf32_ehdr);
  431|  3.01k|    return DW_DLV_OK;
  ------------------
  |  |   59|  3.01k|#define DW_DLV_OK         0
  ------------------
  432|  3.03k|}
dwarf_elf_load_headers.c:elf_load_elf_header64:
 1963|  1.52k|{
 1964|  1.52k|    int res = 0;
 1965|  1.52k|    dw_elf64_ehdr ehdr64;
 1966|  1.52k|    struct generic_ehdr *ehdr = 0;
 1967|       |
 1968|  1.52k|    ehdr64 = eh64_zero;
 1969|  1.52k|    res = RRMOA(ep->f_fd,&ehdr64,0,sizeof(ehdr64),
  ------------------
  |  |   65|  1.52k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  1.52k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1970|  1.52k|        ep->f_filesize,errcode);
 1971|  1.52k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.52k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1971:9): [True: 3, False: 1.52k]
  ------------------
 1972|      3|        return res;
 1973|      3|    }
 1974|  1.52k|    ehdr = (struct generic_ehdr *)calloc(1,
 1975|  1.52k|        sizeof(struct generic_ehdr));
 1976|  1.52k|    if (!ehdr) {
  ------------------
  |  Branch (1976:9): [True: 0, False: 1.52k]
  ------------------
 1977|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1978|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1979|      0|    }
 1980|  1.52k|    res  = generic_ehdr_from_64(ep,ehdr,&ehdr64,errcode);
 1981|  1.52k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.52k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1981:9): [True: 35, False: 1.49k]
  ------------------
 1982|     35|        free(ehdr);
 1983|     35|        return res;
 1984|     35|    }
 1985|  1.49k|    ep->f_machine = (unsigned)ehdr->ge_machine;
 1986|  1.49k|    ep->f_flags = ehdr->ge_flags;
 1987|  1.49k|    return res;
 1988|  1.52k|}
dwarf_elf_load_headers.c:generic_ehdr_from_64:
  438|  1.52k|{
  439|  1.52k|    int i = 0;
  440|       |
  441|  25.9k|    for (i = 0; i < EI_NIDENT; ++i) {
  ------------------
  |  |  926|  25.9k|#define EI_NIDENT 16
  ------------------
  |  Branch (441:17): [True: 24.4k, False: 1.52k]
  ------------------
  442|  24.4k|        ehdr->ge_ident[i] = e->e_ident[i];
  443|  24.4k|    }
  444|  1.52k|    ASNAR(ep->f_copy_word,ehdr->ge_type,e->e_type);
  ------------------
  |  |   53|  1.52k|    do {                                        \
  |  |   54|  1.52k|        (t) = 0;                                \
  |  |   55|  1.52k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
  445|  1.52k|    ASNAR(ep->f_copy_word,ehdr->ge_machine,e->e_machine);
  ------------------
  |  |   53|  1.52k|    do {                                        \
  |  |   54|  1.52k|        (t) = 0;                                \
  |  |   55|  1.52k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
  446|  1.52k|    ASNAR(ep->f_copy_word,ehdr->ge_version,e->e_version);
  ------------------
  |  |   53|  1.52k|    do {                                        \
  |  |   54|  1.52k|        (t) = 0;                                \
  |  |   55|  1.52k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
  447|  1.52k|    ASNAR(ep->f_copy_word,ehdr->ge_entry,e->e_entry);
  ------------------
  |  |   53|  1.52k|    do {                                        \
  |  |   54|  1.52k|        (t) = 0;                                \
  |  |   55|  1.52k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
  448|  1.52k|    ASNAR(ep->f_copy_word,ehdr->ge_phoff,e->e_phoff);
  ------------------
  |  |   53|  1.52k|    do {                                        \
  |  |   54|  1.52k|        (t) = 0;                                \
  |  |   55|  1.52k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
  449|  1.52k|    ASNAR(ep->f_copy_word,ehdr->ge_shoff,e->e_shoff);
  ------------------
  |  |   53|  1.52k|    do {                                        \
  |  |   54|  1.52k|        (t) = 0;                                \
  |  |   55|  1.52k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
  450|  1.52k|    ASNAR(ep->f_copy_word,ehdr->ge_flags,e->e_flags);
  ------------------
  |  |   53|  1.52k|    do {                                        \
  |  |   54|  1.52k|        (t) = 0;                                \
  |  |   55|  1.52k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
  451|  1.52k|    ASNAR(ep->f_copy_word,ehdr->ge_ehsize,e->e_ehsize);
  ------------------
  |  |   53|  1.52k|    do {                                        \
  |  |   54|  1.52k|        (t) = 0;                                \
  |  |   55|  1.52k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
  452|  1.52k|    ASNAR(ep->f_copy_word,ehdr->ge_phentsize,e->e_phentsize);
  ------------------
  |  |   53|  1.52k|    do {                                        \
  |  |   54|  1.52k|        (t) = 0;                                \
  |  |   55|  1.52k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
  453|  1.52k|    ASNAR(ep->f_copy_word,ehdr->ge_phnum,e->e_phnum);
  ------------------
  |  |   53|  1.52k|    do {                                        \
  |  |   54|  1.52k|        (t) = 0;                                \
  |  |   55|  1.52k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
  454|  1.52k|    ASNAR(ep->f_copy_word,ehdr->ge_shentsize,e->e_shentsize);
  ------------------
  |  |   53|  1.52k|    do {                                        \
  |  |   54|  1.52k|        (t) = 0;                                \
  |  |   55|  1.52k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
  455|  1.52k|    ASNAR(ep->f_copy_word,ehdr->ge_shnum,e->e_shnum);
  ------------------
  |  |   53|  1.52k|    do {                                        \
  |  |   54|  1.52k|        (t) = 0;                                \
  |  |   55|  1.52k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
  456|  1.52k|    ASNAR(ep->f_copy_word,ehdr->ge_shstrndx,e->e_shstrndx);
  ------------------
  |  |   53|  1.52k|    do {                                        \
  |  |   54|  1.52k|        (t) = 0;                                \
  |  |   55|  1.52k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
  457|  1.52k|    if (!ehdr->ge_shoff) {
  ------------------
  |  Branch (457:9): [True: 1, False: 1.52k]
  ------------------
  458|      1|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      1|#define DW_DLV_NO_ENTRY  -1
  ------------------
  459|      1|    }
  460|  1.52k|    if (ehdr->ge_shoff < sizeof(dw_elf64_ehdr)) {
  ------------------
  |  Branch (460:9): [True: 6, False: 1.51k]
  ------------------
  461|       |        /* zero or offset is inside the header! */
  462|      6|        *errcode = DW_DLE_TOO_FEW_SECTIONS;
  ------------------
  |  | 1540|      6|#define DW_DLE_TOO_FEW_SECTIONS                494
  ------------------
  463|      6|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      6|#define DW_DLV_ERROR      1
  ------------------
  464|      6|    }
  465|  1.51k|    if (ehdr->ge_shstrndx == SHN_XINDEX) {
  ------------------
  |  |  302|  1.51k|#define SHN_XINDEX 0xffff
  ------------------
  |  Branch (465:9): [True: 394, False: 1.12k]
  ------------------
  466|    394|        ehdr->ge_strndx_extended = TRUE;
  ------------------
  |  |   33|    394|#define TRUE 1
  ------------------
  467|  1.12k|    } else {
  468|  1.12k|        ehdr->ge_strndx_in_strndx = TRUE;
  ------------------
  |  |   33|  1.12k|#define TRUE 1
  ------------------
  469|  1.12k|        if (ehdr->ge_shstrndx < 1) {
  ------------------
  |  Branch (469:13): [True: 4, False: 1.12k]
  ------------------
  470|      4|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|      4|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
  471|      4|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
  472|      4|        }
  473|  1.12k|    }
  474|  1.51k|    if (!ehdr->ge_shnum) {
  ------------------
  |  Branch (474:9): [True: 177, False: 1.33k]
  ------------------
  475|    177|        ehdr->ge_shnum_extended = TRUE;
  ------------------
  |  |   33|    177|#define TRUE 1
  ------------------
  476|  1.33k|    } else {
  477|  1.33k|        ehdr->ge_shnum_in_shnum = TRUE;
  ------------------
  |  |   33|  1.33k|#define TRUE 1
  ------------------
  478|  1.33k|        if (!ehdr->ge_shnum) {
  ------------------
  |  Branch (478:13): [True: 0, False: 1.33k]
  ------------------
  479|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  480|      0|        }
  481|  1.33k|        if (ehdr->ge_shnum < 3) {
  ------------------
  |  Branch (481:13): [True: 3, False: 1.33k]
  ------------------
  482|      3|            *errcode = DW_DLE_TOO_FEW_SECTIONS;
  ------------------
  |  | 1540|      3|#define DW_DLE_TOO_FEW_SECTIONS                494
  ------------------
  483|      3|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
  484|      3|        }
  485|  1.33k|    }
  486|  1.51k|    if (ehdr->ge_shnum_in_shnum &&
  ------------------
  |  Branch (486:9): [True: 1.33k, False: 177]
  ------------------
  487|  1.33k|        ehdr->ge_strndx_in_strndx &&
  ------------------
  |  Branch (487:9): [True: 949, False: 386]
  ------------------
  488|    949|        (ehdr->ge_shstrndx >= ehdr->ge_shnum)) {
  ------------------
  |  Branch (488:9): [True: 21, False: 928]
  ------------------
  489|     21|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|     21|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
  490|     21|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     21|#define DW_DLV_ERROR      1
  ------------------
  491|     21|    }
  492|  1.49k|    ep->f_machine = (unsigned int)ehdr->ge_machine;
  493|  1.49k|    ep->f_ftype = (unsigned int)ehdr->ge_type;
  494|  1.49k|    ep->f_ehdr = ehdr;
  495|  1.49k|    ep->f_loc_ehdr.g_name = "Elf File Header";
  496|  1.49k|    ep->f_loc_ehdr.g_offset = 0;
  497|  1.49k|    ep->f_loc_ehdr.g_count = 1;
  498|  1.49k|    ep->f_loc_ehdr.g_entrysize = sizeof(dw_elf64_ehdr);
  499|  1.49k|    ep->f_loc_ehdr.g_totalsize = sizeof(dw_elf64_ehdr);
  500|  1.49k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.49k|#define DW_DLV_OK         0
  ------------------
  501|  1.51k|}
dwarf_elf_load_headers.c:elf_load_sectheaders32:
 1450|  3.01k|{
 1451|  3.01k|    Dwarf_Unsigned generic_count = 0;
 1452|  3.01k|    Dwarf_Unsigned shdr_count = 0;
 1453|  3.01k|    Dwarf_Bool have_shdr_count = FALSE;
  ------------------
  |  |   36|  3.01k|#define FALSE 0
  ------------------
 1454|  3.01k|    Dwarf_Unsigned shstrndx_number = 0;
 1455|  3.01k|    Dwarf_Bool have_shstrndx_number = FALSE;
  ------------------
  |  |   36|  3.01k|#define FALSE 0
  ------------------
 1456|  3.01k|    struct generic_ehdr *ehp = 0;
 1457|  3.01k|    int res = 0;
 1458|       |
 1459|  3.01k|    if (entsize < sizeof(dw_elf32_shdr)) {
  ------------------
  |  Branch (1459:9): [True: 6, False: 3.00k]
  ------------------
 1460|      6|        *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      6|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1461|      6|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      6|#define DW_DLV_ERROR      1
  ------------------
 1462|      6|    }
 1463|  3.00k|    ehp = ep->f_ehdr;
 1464|  3.00k|    if (!ehp->ge_shnum_in_shnum || !ehp->ge_strndx_in_strndx) {
  ------------------
  |  Branch (1464:9): [True: 91, False: 2.91k]
  |  Branch (1464:36): [True: 42, False: 2.87k]
  ------------------
 1465|    133|        res = get_counts_from_sec32_zero(ep,offset,
 1466|    133|            &have_shdr_count,&shdr_count,
 1467|    133|            &have_shstrndx_number,&shstrndx_number,
 1468|    133|            errcode);
 1469|    133|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    133|#define DW_DLV_OK         0
  ------------------
  |  Branch (1469:13): [True: 80, False: 53]
  ------------------
 1470|     80|            return res;
 1471|     80|        }
 1472|     53|        if (have_shdr_count) {
  ------------------
  |  Branch (1472:13): [True: 53, False: 0]
  ------------------
 1473|     53|            count = shdr_count;
 1474|     53|        }
 1475|     53|    }
 1476|  2.92k|    if (count == 0) {
  ------------------
  |  Branch (1476:9): [True: 0, False: 2.92k]
  ------------------
 1477|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1478|      0|    }
 1479|  2.92k|    if ((offset > ep->f_filesize)||
  ------------------
  |  Branch (1479:9): [True: 46, False: 2.88k]
  ------------------
 1480|  2.88k|        (entsize > 200)||
  ------------------
  |  Branch (1480:9): [True: 14, False: 2.86k]
  ------------------
 1481|  2.86k|        (count > ep->f_filesize) ||
  ------------------
  |  Branch (1481:9): [True: 51, False: 2.81k]
  ------------------
 1482|  2.81k|        ((count *entsize +offset) > ep->f_filesize)) {
  ------------------
  |  Branch (1482:9): [True: 46, False: 2.77k]
  ------------------
 1483|    157|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|    157|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1484|    157|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    157|#define DW_DLV_ERROR      1
  ------------------
 1485|    157|    }
 1486|  2.77k|    res = generic_shdr_from_shdr32(ep,&generic_count,
 1487|  2.77k|        offset,entsize,count,errcode);
 1488|  2.77k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.77k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1488:9): [True: 168, False: 2.60k]
  ------------------
 1489|    168|        return res;
 1490|    168|    }
 1491|  2.60k|    if (generic_count != count) {
  ------------------
  |  Branch (1491:9): [True: 0, False: 2.60k]
  ------------------
 1492|      0|        *errcode = DW_DLE_ELF_SECTION_COUNT_MISMATCH;
  ------------------
  |  | 1488|      0|#define DW_DLE_ELF_SECTION_COUNT_MISMATCH      442
  ------------------
 1493|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1494|      0|    }
 1495|  2.60k|    return DW_DLV_OK;
  ------------------
  |  |   59|  2.60k|#define DW_DLV_OK         0
  ------------------
 1496|  2.60k|}
dwarf_elf_load_headers.c:get_counts_from_sec32_zero:
 1403|    133|{
 1404|    133|    dw_elf32_shdr       shd32;
 1405|    133|    struct generic_shdr shdg;
 1406|    133|    int res = 0;
 1407|    133|    Dwarf_Unsigned size = sizeof(shd32);
 1408|    133|    struct generic_ehdr * geh  = ep->f_ehdr;
 1409|       |
 1410|    133|    shd32 =  shd32zero;
 1411|    133|    shdg  = shdgzero;
 1412|    133|    res = RRMOA(ep->f_fd,&shd32,offset,size,
  ------------------
  |  |   65|    133|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    133|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1413|    133|        ep->f_filesize,errcode);
 1414|    133|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    133|#define DW_DLV_OK         0
  ------------------
  |  Branch (1414:9): [True: 46, False: 87]
  ------------------
 1415|     46|        return res;
 1416|     46|    }
 1417|     87|    copysection32(ep,&shdg,&shd32);
 1418|     87|    if (geh->ge_shnum_extended) {
  ------------------
  |  Branch (1418:9): [True: 57, False: 30]
  ------------------
 1419|     57|        geh->ge_shnum = shdg.gh_size;
 1420|     57|        geh->ge_shnum_in_shnum = TRUE;
  ------------------
  |  |   33|     57|#define TRUE 1
  ------------------
 1421|     57|        if (geh->ge_shnum  < 3) {
  ------------------
  |  Branch (1421:13): [True: 1, False: 56]
  ------------------
 1422|      1|            *errcode = DW_DLE_TOO_FEW_SECTIONS;
  ------------------
  |  | 1540|      1|#define DW_DLE_TOO_FEW_SECTIONS                494
  ------------------
 1423|      1|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
 1424|      1|        }
 1425|     57|    }
 1426|     86|    *have_shdr_count = TRUE;
  ------------------
  |  |   33|     86|#define TRUE 1
  ------------------
 1427|     86|    *shdr_count = geh->ge_shnum;
 1428|     86|    if (geh->ge_strndx_extended) {
  ------------------
  |  Branch (1428:9): [True: 31, False: 55]
  ------------------
 1429|     31|        geh->ge_shstrndx = shdg.gh_link;
 1430|     31|        geh->ge_strndx_in_strndx = TRUE;
  ------------------
  |  |   33|     31|#define TRUE 1
  ------------------
 1431|     31|    }
 1432|     86|    if (geh->ge_shnum_in_shnum &&
  ------------------
  |  Branch (1432:9): [True: 86, False: 0]
  ------------------
 1433|     86|        geh->ge_strndx_in_strndx&&
  ------------------
  |  Branch (1433:9): [True: 86, False: 0]
  ------------------
 1434|     86|        (geh->ge_shstrndx >= geh->ge_shnum)) {
  ------------------
  |  Branch (1434:9): [True: 33, False: 53]
  ------------------
 1435|     33|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|     33|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
 1436|     33|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     33|#define DW_DLV_ERROR      1
  ------------------
 1437|     33|    }
 1438|     53|    *have_shstrndx_number = TRUE;
  ------------------
  |  |   33|     53|#define TRUE 1
  ------------------
 1439|     53|    *shstrndx_number = geh->ge_shstrndx;
 1440|     53|    return DW_DLV_OK;
  ------------------
  |  |   59|     53|#define DW_DLV_OK         0
  ------------------
 1441|     86|}
dwarf_elf_load_headers.c:copysection32:
  508|   187k|{
  509|   187k|    ASNAR(ep->f_copy_word,gshdr->gh_name,psh->sh_name);
  ------------------
  |  |   53|   187k|    do {                                        \
  |  |   54|   187k|        (t) = 0;                                \
  |  |   55|   187k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   187k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 187k]
  |  |  ------------------
  ------------------
  510|   187k|    ASNAR(ep->f_copy_word,gshdr->gh_type,psh->sh_type);
  ------------------
  |  |   53|   187k|    do {                                        \
  |  |   54|   187k|        (t) = 0;                                \
  |  |   55|   187k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   187k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 187k]
  |  |  ------------------
  ------------------
  511|   187k|    ASNAR(ep->f_copy_word,gshdr->gh_flags,psh->sh_flags);
  ------------------
  |  |   53|   187k|    do {                                        \
  |  |   54|   187k|        (t) = 0;                                \
  |  |   55|   187k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   187k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 187k]
  |  |  ------------------
  ------------------
  512|   187k|    ASNAR(ep->f_copy_word,gshdr->gh_addr,psh->sh_addr);
  ------------------
  |  |   53|   187k|    do {                                        \
  |  |   54|   187k|        (t) = 0;                                \
  |  |   55|   187k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   187k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 187k]
  |  |  ------------------
  ------------------
  513|   187k|    ASNAR(ep->f_copy_word,gshdr->gh_offset,psh->sh_offset);
  ------------------
  |  |   53|   187k|    do {                                        \
  |  |   54|   187k|        (t) = 0;                                \
  |  |   55|   187k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   187k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 187k]
  |  |  ------------------
  ------------------
  514|   187k|    ASNAR(ep->f_copy_word,gshdr->gh_size,psh->sh_size);
  ------------------
  |  |   53|   187k|    do {                                        \
  |  |   54|   187k|        (t) = 0;                                \
  |  |   55|   187k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   187k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 187k]
  |  |  ------------------
  ------------------
  515|   187k|    ASNAR(ep->f_copy_word,gshdr->gh_link,psh->sh_link);
  ------------------
  |  |   53|   187k|    do {                                        \
  |  |   54|   187k|        (t) = 0;                                \
  |  |   55|   187k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   187k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 187k]
  |  |  ------------------
  ------------------
  516|   187k|    ASNAR(ep->f_copy_word,gshdr->gh_info,psh->sh_info);
  ------------------
  |  |   53|   187k|    do {                                        \
  |  |   54|   187k|        (t) = 0;                                \
  |  |   55|   187k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   187k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 187k]
  |  |  ------------------
  ------------------
  517|   187k|    ASNAR(ep->f_copy_word,gshdr->gh_addralign,psh->sh_addralign);
  ------------------
  |  |   53|   187k|    do {                                        \
  |  |   54|   187k|        (t) = 0;                                \
  |  |   55|   187k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   187k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 187k]
  |  |  ------------------
  ------------------
  518|   187k|    ASNAR(ep->f_copy_word,gshdr->gh_entsize,psh->sh_entsize);
  ------------------
  |  |   53|   187k|    do {                                        \
  |  |   54|   187k|        (t) = 0;                                \
  |  |   55|   187k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   187k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 187k]
  |  |  ------------------
  ------------------
  519|   187k|}
dwarf_elf_load_headers.c:generic_shdr_from_shdr32:
  528|  2.77k|{
  529|  2.77k|    dw_elf32_shdr          *psh =0;
  530|  2.77k|    dw_elf32_shdr          *orig_psh =0;
  531|  2.77k|    struct generic_ehdr *ehdr = ep->f_ehdr;
  532|  2.77k|    struct generic_shdr *gshdr =0;
  533|  2.77k|    struct generic_shdr *orig_gshdr =0;
  534|  2.77k|    Dwarf_Unsigned i = 0;
  535|  2.77k|    int res = 0;
  536|       |
  537|  2.77k|    *count_out = 0;
  538|  2.77k|    psh = (dw_elf32_shdr *)calloc(count , entsize);
  539|  2.77k|    if (!psh) {
  ------------------
  |  Branch (539:9): [True: 0, False: 2.77k]
  ------------------
  540|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  541|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  542|      0|    }
  543|  2.77k|    gshdr = (struct generic_shdr *)calloc(count,sizeof(*gshdr));
  544|  2.77k|    if (!gshdr) {
  ------------------
  |  Branch (544:9): [True: 0, False: 2.77k]
  ------------------
  545|      0|        free(psh);
  546|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  547|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  548|      0|    }
  549|       |
  550|  2.77k|    orig_psh = psh;
  551|  2.77k|    orig_gshdr = gshdr;
  552|  2.77k|    res = RRMOA(ep->f_fd,psh,offset,count*entsize,
  ------------------
  |  |   65|  2.77k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  2.77k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  553|  2.77k|        ep->f_filesize,errcode);
  554|  2.77k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.77k|#define DW_DLV_OK         0
  ------------------
  |  Branch (554:9): [True: 0, False: 2.77k]
  ------------------
  555|      0|        free(orig_psh);
  556|      0|        free(orig_gshdr);
  557|      0|        return res;
  558|      0|    }
  559|   190k|    for (i = 0; i < count;
  ------------------
  |  Branch (559:17): [True: 187k, False: 2.60k]
  ------------------
  560|   187k|        ++i,  psh++,gshdr++) {
  561|   187k|        int isempty     = FALSE;
  ------------------
  |  |   36|   187k|#define FALSE 0
  ------------------
  562|   187k|        int bitsoncount = 0;
  563|       |
  564|   187k|        gshdr->gh_secnum = i;
  565|   187k|        copysection32(ep,gshdr,psh);
  566|   187k|        if (gshdr->gh_size >= ep->f_filesize &&
  ------------------
  |  Branch (566:13): [True: 588, False: 187k]
  ------------------
  567|    588|            gshdr->gh_type != SHT_NOBITS) {
  ------------------
  |  |   87|    588|#define SHT_NOBITS 8
  ------------------
  |  Branch (567:13): [True: 10, False: 578]
  ------------------
  568|     10|            free(orig_psh);
  569|     10|            free(orig_gshdr);
  570|     10|            *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|     10|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
  571|     10|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     10|#define DW_DLV_ERROR      1
  ------------------
  572|     10|        }
  573|   187k|        isempty = is_empty_section(gshdr->gh_type);
  574|   187k|        if (i == 0) {
  ------------------
  |  Branch (574:13): [True: 2.76k, False: 184k]
  ------------------
  575|  2.76k|            Dwarf_Unsigned shnum = 0;
  576|  2.76k|            Dwarf_Unsigned shstrx = 0;
  577|       |
  578|       |            /*  Catch errors asap */
  579|  2.76k|            if (!ehdr->ge_shnum_extended) {
  ------------------
  |  Branch (579:17): [True: 2.76k, False: 4]
  ------------------
  580|  2.76k|                shnum = gshdr->gh_size;
  581|  2.76k|            }
  582|  2.76k|            if (!ehdr->ge_strndx_extended) {
  ------------------
  |  Branch (582:17): [True: 2.75k, False: 10]
  ------------------
  583|  2.75k|                shstrx = gshdr->gh_link;
  584|  2.75k|            }
  585|       |            /*  We require that section zero be 'empty'
  586|       |                per the Elf ABI.
  587|       |                gh_link and gh_size are sometimes used
  588|       |                with the elf header, so we do not check
  589|       |                them here. */
  590|  2.76k|            if (!isempty || gshdr->gh_name || gshdr->gh_flags ||
  ------------------
  |  Branch (590:17): [True: 1, False: 2.76k]
  |  Branch (590:29): [True: 33, False: 2.73k]
  |  Branch (590:47): [True: 34, False: 2.70k]
  ------------------
  591|  2.70k|                shnum || shstrx ||
  ------------------
  |  Branch (591:17): [True: 3, False: 2.69k]
  |  Branch (591:26): [True: 1, False: 2.69k]
  ------------------
  592|  2.69k|                gshdr->gh_addr ||
  ------------------
  |  Branch (592:17): [True: 31, False: 2.66k]
  ------------------
  593|  2.66k|                gshdr->gh_info) {
  ------------------
  |  Branch (593:17): [True: 32, False: 2.63k]
  ------------------
  594|    135|                free(orig_psh);
  595|    135|                free(orig_gshdr);
  596|    135|                *errcode = DW_DLE_IMPROPER_SECTION_ZERO;
  ------------------
  |  | 1543|    135|#define DW_DLE_IMPROPER_SECTION_ZERO           497
  ------------------
  597|    135|                return DW_DLV_ERROR;
  ------------------
  |  |   60|    135|#define DW_DLV_ERROR      1
  ------------------
  598|    135|            }
  599|  2.76k|        }
  600|   187k|        bitsoncount = getbitsoncount(gshdr->gh_flags);
  601|   187k|        if (bitsoncount > 8) {
  ------------------
  |  Branch (601:13): [True: 23, False: 187k]
  ------------------
  602|     23|            free(orig_psh);
  603|     23|            free(orig_gshdr);
  604|     23|            *errcode = DW_DLE_BAD_SECTION_FLAGS;
  ------------------
  |  | 1542|     23|#define DW_DLE_BAD_SECTION_FLAGS               496
  ------------------
  605|     23|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     23|#define DW_DLV_ERROR      1
  ------------------
  606|     23|        }
  607|       |
  608|   187k|        if (gshdr->gh_type == SHT_REL || gshdr->gh_type == SHT_RELA){
  ------------------
  |  |   59|   374k|#define SHT_REL 9
  ------------------
                      if (gshdr->gh_type == SHT_REL || gshdr->gh_type == SHT_RELA){
  ------------------
  |  |   56|   185k|#define SHT_RELA 4
  ------------------
  |  Branch (608:13): [True: 1.51k, False: 185k]
  |  Branch (608:42): [True: 1.92k, False: 184k]
  ------------------
  609|  3.44k|            gshdr->gh_reloc_target_secnum = gshdr->gh_info;
  610|  3.44k|        }
  611|   187k|    }
  612|  2.60k|    free(orig_psh);
  613|  2.60k|    *count_out = count;
  614|  2.60k|    ep->f_shdr = orig_gshdr;
  615|  2.60k|    ep->f_loc_shdr.g_name = "Section Header";
  616|  2.60k|    ep->f_loc_shdr.g_count = count;
  617|  2.60k|    ep->f_loc_shdr.g_offset = offset;
  618|  2.60k|    ep->f_loc_shdr.g_entrysize = sizeof(dw_elf32_shdr);
  619|  2.60k|    ep->f_loc_shdr.g_totalsize = sizeof(dw_elf32_shdr)*count;
  620|  2.60k|    return DW_DLV_OK;
  ------------------
  |  |   59|  2.60k|#define DW_DLV_OK         0
  ------------------
  621|  2.77k|}
dwarf_elf_load_headers.c:getbitsoncount:
  152|   195k|{
  153|   195k|    int           bitscount = 0;
  154|   195k|    Dwarf_Unsigned v = v_in;
  155|       |
  156|   293k|    while (v) {
  ------------------
  |  Branch (156:12): [True: 97.4k, False: 195k]
  ------------------
  157|  97.4k|        unsigned int nibble = v & 0xf;
  158|  97.4k|        bitscount += nibblecounts[nibble];
  159|  97.4k|        v >>= 4;
  160|  97.4k|    }
  161|   195k|    return bitscount;
  162|   195k|}
dwarf_elf_load_headers.c:elf_load_sectheaders64:
 1555|  1.49k|{
 1556|  1.49k|    Dwarf_Unsigned generic_count = 0;
 1557|  1.49k|    Dwarf_Unsigned shdr_count = 0;
 1558|  1.49k|    Dwarf_Bool have_shdr_count = FALSE;
  ------------------
  |  |   36|  1.49k|#define FALSE 0
  ------------------
 1559|  1.49k|    Dwarf_Unsigned shstrndx_number = 0;
 1560|  1.49k|    Dwarf_Bool have_shstrndx_number = FALSE;
  ------------------
  |  |   36|  1.49k|#define FALSE 0
  ------------------
 1561|  1.49k|    struct generic_ehdr *ehp = 0;
 1562|  1.49k|    int res = 0;
 1563|       |
 1564|  1.49k|    ehp = ep->f_ehdr;
 1565|  1.49k|    if (!ehp->ge_shnum_in_shnum || !ehp->ge_strndx_in_strndx ) {
  ------------------
  |  Branch (1565:9): [True: 177, False: 1.31k]
  |  Branch (1565:36): [True: 386, False: 928]
  ------------------
 1566|    563|        res = get_counts_from_sec64_zero(ep,offset,
 1567|    563|            &have_shdr_count,&shdr_count,
 1568|    563|            &have_shstrndx_number,&shstrndx_number,
 1569|    563|            errcode);
 1570|    563|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    563|#define DW_DLV_OK         0
  ------------------
  |  Branch (1570:13): [True: 66, False: 497]
  ------------------
 1571|     66|            return res;
 1572|     66|        }
 1573|    497|        if (have_shdr_count) {
  ------------------
  |  Branch (1573:13): [True: 497, False: 0]
  ------------------
 1574|    497|            count = shdr_count;
 1575|    497|        }
 1576|    497|    }
 1577|  1.42k|    if (count == 0) {
  ------------------
  |  Branch (1577:9): [True: 0, False: 1.42k]
  ------------------
 1578|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1579|      0|    }
 1580|  1.42k|    if (entsize < sizeof(dw_elf64_shdr)) {
  ------------------
  |  Branch (1580:9): [True: 33, False: 1.39k]
  ------------------
 1581|     33|        *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|     33|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1582|     33|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     33|#define DW_DLV_ERROR      1
  ------------------
 1583|     33|    }
 1584|  1.39k|    if ((offset > ep->f_filesize)||
  ------------------
  |  Branch (1584:9): [True: 96, False: 1.29k]
  ------------------
 1585|  1.29k|        (entsize > 200)||
  ------------------
  |  Branch (1585:9): [True: 15, False: 1.28k]
  ------------------
 1586|  1.28k|        (count > ep->f_filesize) ||
  ------------------
  |  Branch (1586:9): [True: 115, False: 1.16k]
  ------------------
 1587|  1.16k|        ((count *entsize +offset) > ep->f_filesize)) {
  ------------------
  |  Branch (1587:9): [True: 48, False: 1.11k]
  ------------------
 1588|    274|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|    274|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1589|    274|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    274|#define DW_DLV_ERROR      1
  ------------------
 1590|    274|    }
 1591|       |
 1592|  1.11k|    res = generic_shdr_from_shdr64(ep,&generic_count,
 1593|  1.11k|        offset,entsize,count,errcode);
 1594|  1.11k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.11k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1594:9): [True: 332, False: 786]
  ------------------
 1595|    332|        return res;
 1596|    332|    }
 1597|    786|    if (generic_count != count) {
  ------------------
  |  Branch (1597:9): [True: 0, False: 786]
  ------------------
 1598|      0|        *errcode = DW_DLE_ELF_SECTION_COUNT_MISMATCH;
  ------------------
  |  | 1488|      0|#define DW_DLE_ELF_SECTION_COUNT_MISMATCH      442
  ------------------
 1599|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1600|      0|    }
 1601|    786|    return DW_DLV_OK;
  ------------------
  |  |   59|    786|#define DW_DLV_OK         0
  ------------------
 1602|    786|}
dwarf_elf_load_headers.c:get_counts_from_sec64_zero:
 1509|    563|{
 1510|    563|    dw_elf64_shdr       shd64;
 1511|    563|    struct generic_shdr shdg;
 1512|    563|    int res = 0;
 1513|    563|    Dwarf_Unsigned size = sizeof(shd64);
 1514|    563|    struct generic_ehdr * geh  = ep->f_ehdr;
 1515|       |
 1516|    563|    shd64 =  shd64zero;
 1517|    563|    shdg  = shdgzero;
 1518|    563|    res = RRMOA(ep->f_fd,&shd64,offset,size,
  ------------------
  |  |   65|    563|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    563|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1519|    563|        ep->f_filesize,errcode);
 1520|    563|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    563|#define DW_DLV_OK         0
  ------------------
  |  Branch (1520:9): [True: 56, False: 507]
  ------------------
 1521|     56|        return res;
 1522|     56|    }
 1523|    507|    copysection64(ep,&shdg,&shd64);
 1524|    507|    if (geh->ge_shnum_extended) {
  ------------------
  |  Branch (1524:9): [True: 148, False: 359]
  ------------------
 1525|    148|        geh->ge_shnum = shdg.gh_size;
 1526|    148|        geh->ge_shnum_in_shnum = TRUE;
  ------------------
  |  |   33|    148|#define TRUE 1
  ------------------
 1527|    148|        if (geh->ge_shnum  < 3) {
  ------------------
  |  Branch (1527:13): [True: 2, False: 146]
  ------------------
 1528|      2|            *errcode = DW_DLE_TOO_FEW_SECTIONS;
  ------------------
  |  | 1540|      2|#define DW_DLE_TOO_FEW_SECTIONS                494
  ------------------
 1529|      2|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
 1530|      2|        }
 1531|    148|    }
 1532|    505|    *have_shdr_count = TRUE;
  ------------------
  |  |   33|    505|#define TRUE 1
  ------------------
 1533|    505|    *shdr_count = geh->ge_shnum;
 1534|    505|    if (geh->ge_strndx_extended) {
  ------------------
  |  Branch (1534:9): [True: 366, False: 139]
  ------------------
 1535|    366|        geh->ge_shstrndx = shdg.gh_link;
 1536|    366|        geh->ge_strndx_in_strndx = TRUE;
  ------------------
  |  |   33|    366|#define TRUE 1
  ------------------
 1537|    366|    }
 1538|    505|    if (geh->ge_shnum_in_shnum    &&
  ------------------
  |  Branch (1538:9): [True: 505, False: 0]
  ------------------
 1539|    505|        geh->ge_strndx_in_strndx &&
  ------------------
  |  Branch (1539:9): [True: 505, False: 0]
  ------------------
 1540|    505|        (geh->ge_shstrndx >= geh->ge_shnum)) {
  ------------------
  |  Branch (1540:9): [True: 8, False: 497]
  ------------------
 1541|      8|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|      8|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
 1542|      8|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      8|#define DW_DLV_ERROR      1
  ------------------
 1543|      8|    }
 1544|       |
 1545|    497|    *have_shstrndx_number = TRUE;
  ------------------
  |  |   33|    497|#define TRUE 1
  ------------------
 1546|    497|    *shstrndx_number = geh->ge_shstrndx;
 1547|    497|    return DW_DLV_OK;
  ------------------
  |  |   59|    497|#define DW_DLV_OK         0
  ------------------
 1548|    505|}
dwarf_elf_load_headers.c:copysection64:
  628|  9.09k|{
  629|  9.09k|    ASNAR(ep->f_copy_word,gshdr->gh_name,psh->sh_name);
  ------------------
  |  |   53|  9.09k|    do {                                        \
  |  |   54|  9.09k|        (t) = 0;                                \
  |  |   55|  9.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  9.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 9.09k]
  |  |  ------------------
  ------------------
  630|  9.09k|    ASNAR(ep->f_copy_word,gshdr->gh_type,psh->sh_type);
  ------------------
  |  |   53|  9.09k|    do {                                        \
  |  |   54|  9.09k|        (t) = 0;                                \
  |  |   55|  9.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  9.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 9.09k]
  |  |  ------------------
  ------------------
  631|  9.09k|    ASNAR(ep->f_copy_word,gshdr->gh_flags,psh->sh_flags);
  ------------------
  |  |   53|  9.09k|    do {                                        \
  |  |   54|  9.09k|        (t) = 0;                                \
  |  |   55|  9.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  9.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 9.09k]
  |  |  ------------------
  ------------------
  632|  9.09k|    ASNAR(ep->f_copy_word,gshdr->gh_addr,psh->sh_addr);
  ------------------
  |  |   53|  9.09k|    do {                                        \
  |  |   54|  9.09k|        (t) = 0;                                \
  |  |   55|  9.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  9.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 9.09k]
  |  |  ------------------
  ------------------
  633|  9.09k|    ASNAR(ep->f_copy_word,gshdr->gh_offset,psh->sh_offset);
  ------------------
  |  |   53|  9.09k|    do {                                        \
  |  |   54|  9.09k|        (t) = 0;                                \
  |  |   55|  9.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  9.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 9.09k]
  |  |  ------------------
  ------------------
  634|  9.09k|    ASNAR(ep->f_copy_word,gshdr->gh_size,psh->sh_size);
  ------------------
  |  |   53|  9.09k|    do {                                        \
  |  |   54|  9.09k|        (t) = 0;                                \
  |  |   55|  9.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  9.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 9.09k]
  |  |  ------------------
  ------------------
  635|  9.09k|    ASNAR(ep->f_copy_word,gshdr->gh_link,psh->sh_link);
  ------------------
  |  |   53|  9.09k|    do {                                        \
  |  |   54|  9.09k|        (t) = 0;                                \
  |  |   55|  9.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  9.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 9.09k]
  |  |  ------------------
  ------------------
  636|  9.09k|    ASNAR(ep->f_copy_word,gshdr->gh_info,psh->sh_info);
  ------------------
  |  |   53|  9.09k|    do {                                        \
  |  |   54|  9.09k|        (t) = 0;                                \
  |  |   55|  9.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  9.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 9.09k]
  |  |  ------------------
  ------------------
  637|  9.09k|    ASNAR(ep->f_copy_word,gshdr->gh_addralign,psh->sh_addralign);
  ------------------
  |  |   53|  9.09k|    do {                                        \
  |  |   54|  9.09k|        (t) = 0;                                \
  |  |   55|  9.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  9.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 9.09k]
  |  |  ------------------
  ------------------
  638|  9.09k|    ASNAR(ep->f_copy_word,gshdr->gh_entsize,psh->sh_entsize);
  ------------------
  |  |   53|  9.09k|    do {                                        \
  |  |   54|  9.09k|        (t) = 0;                                \
  |  |   55|  9.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  9.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 9.09k]
  |  |  ------------------
  ------------------
  639|  9.09k|}
dwarf_elf_load_headers.c:generic_shdr_from_shdr64:
  648|  1.11k|{
  649|  1.11k|    dw_elf64_shdr          *psh =0;
  650|  1.11k|    dw_elf64_shdr          *orig_psh =0;
  651|  1.11k|    struct generic_shdr *gshdr =0;
  652|  1.11k|    struct generic_shdr *orig_gshdr =0;
  653|  1.11k|    struct generic_ehdr *ehdr = ep->f_ehdr;
  654|  1.11k|    Dwarf_Unsigned i = 0;
  655|  1.11k|    int res = 0;
  656|       |
  657|  1.11k|    *count_out = 0;
  658|  1.11k|    psh = (dw_elf64_shdr *)calloc(count , entsize);
  659|  1.11k|    if (!psh) {
  ------------------
  |  Branch (659:9): [True: 0, False: 1.11k]
  ------------------
  660|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  661|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  662|      0|    }
  663|  1.11k|    gshdr = (struct generic_shdr *)calloc(count,sizeof(*gshdr));
  664|  1.11k|    if (gshdr == 0) {
  ------------------
  |  Branch (664:9): [True: 0, False: 1.11k]
  ------------------
  665|      0|        free(psh);
  666|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  667|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  668|      0|    }
  669|  1.11k|    orig_psh = psh;
  670|  1.11k|    orig_gshdr = gshdr;
  671|  1.11k|    res = RRMOA(ep->f_fd,psh,offset,count*entsize,
  ------------------
  |  |   65|  1.11k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  1.11k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  672|  1.11k|        ep->f_filesize,errcode);
  673|  1.11k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.11k|#define DW_DLV_OK         0
  ------------------
  |  Branch (673:9): [True: 0, False: 1.11k]
  ------------------
  674|      0|        free(orig_psh);
  675|      0|        free(orig_gshdr);
  676|      0|        return res;
  677|      0|    }
  678|  9.37k|    for ( i = 0; i < count;
  ------------------
  |  Branch (678:18): [True: 8.58k, False: 786]
  ------------------
  679|  8.58k|        ++i,  psh++,gshdr++) {
  680|  8.58k|        int bitsoncount = 0;
  681|  8.58k|        int isempty = FALSE;
  ------------------
  |  |   36|  8.58k|#define FALSE 0
  ------------------
  682|       |
  683|  8.58k|        gshdr->gh_secnum = i;
  684|  8.58k|        copysection64(ep,gshdr,psh);
  685|  8.58k|        if (gshdr->gh_size >= ep->f_filesize &&
  ------------------
  |  Branch (685:13): [True: 621, False: 7.96k]
  ------------------
  686|    621|            gshdr->gh_type != SHT_NOBITS) {
  ------------------
  |  |   87|    621|#define SHT_NOBITS 8
  ------------------
  |  Branch (686:13): [True: 40, False: 581]
  ------------------
  687|     40|            free(orig_psh);
  688|     40|            free(orig_gshdr);
  689|     40|            *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|     40|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
  690|     40|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     40|#define DW_DLV_ERROR      1
  ------------------
  691|     40|        }
  692|  8.54k|        isempty = is_empty_section(gshdr->gh_type);
  693|  8.54k|        if (i == 0) {
  ------------------
  |  Branch (693:13): [True: 1.10k, False: 7.44k]
  ------------------
  694|  1.10k|            Dwarf_Unsigned shnum = 0;
  695|  1.10k|            Dwarf_Unsigned shstrx = 0;
  696|       |
  697|       |            /*  Catch errors asap */
  698|  1.10k|            if (!ehdr->ge_shnum_extended) {
  ------------------
  |  Branch (698:17): [True: 1.10k, False: 3]
  ------------------
  699|  1.10k|                shnum = gshdr->gh_size;
  700|  1.10k|            }
  701|  1.10k|            if (!ehdr->ge_strndx_extended) {
  ------------------
  |  Branch (701:17): [True: 768, False: 338]
  ------------------
  702|    768|                shstrx = gshdr->gh_link;
  703|    768|            }
  704|       |            /*  We require that section zero be 'empty'
  705|       |                per the Elf ABI.
  706|       |                But gh_link  and gh_size might be used for
  707|       |                ge_shstrndx and ge_shnum, respectively*/
  708|  1.10k|            if (!isempty || gshdr->gh_name || gshdr->gh_flags ||
  ------------------
  |  Branch (708:17): [True: 2, False: 1.10k]
  |  Branch (708:29): [True: 33, False: 1.07k]
  |  Branch (708:47): [True: 102, False: 969]
  ------------------
  709|    969|                shnum || shstrx ||
  ------------------
  |  Branch (709:17): [True: 2, False: 967]
  |  Branch (709:26): [True: 1, False: 966]
  ------------------
  710|    966|                gshdr->gh_addr ||
  ------------------
  |  Branch (710:17): [True: 79, False: 887]
  ------------------
  711|    887|                gshdr->gh_info) {
  ------------------
  |  Branch (711:17): [True: 1, False: 886]
  ------------------
  712|    220|                free(orig_psh);
  713|    220|                free(orig_gshdr);
  714|    220|                *errcode = DW_DLE_IMPROPER_SECTION_ZERO;
  ------------------
  |  | 1543|    220|#define DW_DLE_IMPROPER_SECTION_ZERO           497
  ------------------
  715|    220|                return DW_DLV_ERROR;
  ------------------
  |  |   60|    220|#define DW_DLV_ERROR      1
  ------------------
  716|    220|            }
  717|  1.10k|        }
  718|  8.32k|        bitsoncount = getbitsoncount(gshdr->gh_flags);
  719|  8.32k|        if (bitsoncount > 8) {
  ------------------
  |  Branch (719:13): [True: 72, False: 8.25k]
  ------------------
  720|     72|            free(orig_psh);
  721|     72|            free(orig_gshdr);
  722|     72|            *errcode = DW_DLE_BAD_SECTION_FLAGS;
  ------------------
  |  | 1542|     72|#define DW_DLE_BAD_SECTION_FLAGS               496
  ------------------
  723|     72|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     72|#define DW_DLV_ERROR      1
  ------------------
  724|     72|        }
  725|       |
  726|  8.25k|        if (gshdr->gh_type == SHT_REL ||
  ------------------
  |  |   59|  16.5k|#define SHT_REL 9
  ------------------
  |  Branch (726:13): [True: 568, False: 7.68k]
  ------------------
  727|  7.68k|            gshdr->gh_type == SHT_RELA){
  ------------------
  |  |   56|  7.68k|#define SHT_RELA 4
  ------------------
  |  Branch (727:13): [True: 1.19k, False: 6.49k]
  ------------------
  728|  1.75k|            gshdr->gh_reloc_target_secnum = gshdr->gh_info;
  729|  1.75k|        }
  730|  8.25k|    }
  731|    786|    free(orig_psh);
  732|    786|    *count_out = count;
  733|    786|    ep->f_shdr = orig_gshdr;
  734|    786|    ep->f_loc_shdr.g_name = "Section Header";
  735|    786|    ep->f_loc_shdr.g_count = count;
  736|    786|    ep->f_loc_shdr.g_offset = offset;
  737|    786|    ep->f_loc_shdr.g_entrysize = sizeof(dw_elf64_shdr);
  738|    786|    ep->f_loc_shdr.g_totalsize = sizeof(dw_elf64_shdr)*count;
  739|    786|    return DW_DLV_OK;
  ------------------
  |  |   59|    786|#define DW_DLV_OK         0
  ------------------
  740|  1.11k|}
dwarf_elf_load_headers.c:_dwarf_elf_load_sectstrings:
 1313|  3.38k|{
 1314|  3.38k|    int res = 0;
 1315|  3.38k|    struct generic_shdr *psh = 0;
 1316|  3.38k|    Dwarf_Unsigned secoffset = 0;
 1317|  3.38k|    Dwarf_Unsigned flags =  0;
 1318|       |
 1319|  3.38k|    if (stringsection >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (1319:9): [True: 0, False: 3.38k]
  ------------------
 1320|      0|        *errcode = DW_DLE_SECTION_INDEX_BAD;
  ------------------
  |  | 1484|      0|#define DW_DLE_SECTION_INDEX_BAD               438
  ------------------
 1321|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1322|      0|    }
 1323|  3.38k|    psh = ep->f_shdr+stringsection;
 1324|  3.38k|    flags = psh->gh_flags;
 1325|       |
 1326|  3.38k|    secoffset = psh->gh_offset;
 1327|  3.38k|    if (is_empty_section(psh->gh_type)) {
  ------------------
  |  Branch (1327:9): [True: 25, False: 3.36k]
  ------------------
 1328|     25|        *errcode = DW_DLE_ELF_STRING_SECTION_MISSING;
  ------------------
  |  | 1489|     25|#define DW_DLE_ELF_STRING_SECTION_MISSING      443
  ------------------
 1329|     25|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     25|#define DW_DLV_ERROR      1
  ------------------
 1330|     25|    }
 1331|  3.36k|    if (secoffset >= ep->f_filesize ||
  ------------------
  |  Branch (1331:9): [True: 84, False: 3.28k]
  ------------------
 1332|  3.28k|        psh->gh_size > ep->f_filesize ||
  ------------------
  |  Branch (1332:9): [True: 0, False: 3.28k]
  ------------------
 1333|  3.28k|        (secoffset + psh->gh_size) > ep->f_filesize) {
  ------------------
  |  Branch (1333:9): [True: 26, False: 3.25k]
  ------------------
 1334|    110|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|    110|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1335|    110|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    110|#define DW_DLV_ERROR      1
  ------------------
 1336|    110|    }
 1337|  3.25k|    if (psh->gh_content) {
  ------------------
  |  Branch (1337:9): [True: 0, False: 3.25k]
  ------------------
 1338|      0|        *errcode = DW_DLE_ELF_STRING_SECTION_ERROR;
  ------------------
  |  | 1493|      0|#define DW_DLE_ELF_STRING_SECTION_ERROR        447
  ------------------
 1339|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1340|      0|    }
 1341|       |    /* An extra zero byte so always null-terminated */
 1342|  3.25k|    psh->gh_content = (char *)calloc(1,psh->gh_size+1);
 1343|  3.25k|    if (!psh->gh_content) {
  ------------------
  |  Branch (1343:9): [True: 0, False: 3.25k]
  ------------------
 1344|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1345|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1346|      0|    }
 1347|  3.25k|    res = RRMOA(ep->f_fd,psh->gh_content,secoffset,
  ------------------
  |  |   65|  3.25k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  3.25k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1348|  3.25k|        psh->gh_size,
 1349|  3.25k|        ep->f_filesize,errcode);
 1350|  3.25k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  3.25k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1350:9): [True: 0, False: 3.25k]
  ------------------
 1351|      0|        free(ep->f_elf_shstrings_data);
 1352|      0|        ep->f_elf_shstrings_data = 0;
 1353|      0|        free(psh->gh_content);
 1354|      0|        psh->gh_content = 0;
 1355|      0|        return res;
 1356|      0|    }
 1357|  3.25k|    psh->gh_load_type = Dwarf_Alloc_Malloc;
 1358|  3.25k|    psh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|  3.25k|#define TRUE 1
  ------------------
 1359|  3.25k|    ep->f_elf_shstrings_index = stringsection;
 1360|  3.25k|    ep->f_elf_shstrings_max = psh->gh_size;
 1361|  3.25k|    ep->f_elf_shstrings_length = psh->gh_size;
 1362|  3.25k|    ep->f_elf_shstrings_data = psh->gh_content;
 1363|  3.25k|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|  3.25k|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (1363:9): [True: 2, False: 3.25k]
  ------------------
 1364|       |#if defined(HAVE_ZLIB) && defined(HAVE_ZSTD)
 1365|       |        *errcode = 0;
 1366|       |        _dwarf_do_decompress_elf(ep,psh,errcode);
 1367|       |        /* decompress and set new section size */
 1368|       |        if (*errcode) {
 1369|       |            return DW_DLV_ERROR;
 1370|       |        }
 1371|       |        ep->f_elf_shstrings_max = psh->gh_size;
 1372|       |        ep->f_elf_shstrings_length = psh->gh_size;
 1373|       |        ep->f_elf_shstrings_data = psh->gh_content;
 1374|       |#else /* COMPRESSED TEST */
 1375|       |        /* We cannot decompress, so we really have nothing. */
 1376|      2|        free(psh->gh_content);
 1377|      2|        psh->gh_content = 0;
 1378|      2|        ep->f_elf_shstrings_max = 0;
 1379|      2|        ep->f_elf_shstrings_length = 0;
 1380|      2|        ep->f_elf_shstrings_data = 0;
 1381|      2|        psh->gh_was_alloc = FALSE;
  ------------------
  |  |   36|      2|#define FALSE 0
  ------------------
 1382|      2|        *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      2|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
 1383|      2|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
 1384|      2|#endif /* COMPRESSED TEST */
 1385|      2|    }
 1386|  3.25k|    return DW_DLV_OK;
  ------------------
  |  |   59|  3.25k|#define DW_DLV_OK         0
  ------------------
 1387|  3.25k|}
dwarf_elf_load_headers.c:_dwarf_elf_load_sect_namestrings:
 1887|  3.25k|{
 1888|  3.25k|    struct generic_shdr *gshdr = 0;
 1889|  3.25k|    Dwarf_Unsigned generic_count = 0;
 1890|  3.25k|    Dwarf_Unsigned i = 1;
 1891|  3.25k|    const char *stringsecbase = 0;
 1892|       |
 1893|  3.25k|    stringsecbase = ep->f_elf_shstrings_data;
 1894|  3.25k|    gshdr = ep->f_shdr;
 1895|  3.25k|    generic_count = ep->f_loc_shdr.g_count;
 1896|       |    /*  Here we ensure gh_namestring set to something with
 1897|       |        null termination */
 1898|   194k|    for (i = 0; i < generic_count; i++, ++gshdr) {
  ------------------
  |  Branch (1898:17): [True: 191k, False: 3.20k]
  ------------------
 1899|   191k|        const char *namestr =
 1900|   191k|            "<No valid Elf section strings exist>";
 1901|   191k|        int res = 0;
 1902|       |
 1903|   191k|        if (!ep->f_ehdr->ge_shstrndx || !stringsecbase) {
  ------------------
  |  Branch (1903:13): [True: 0, False: 191k]
  |  Branch (1903:41): [True: 0, False: 191k]
  ------------------
 1904|      0|            gshdr->gh_namestring = namestr;
 1905|      0|            continue;
 1906|      0|        }
 1907|   191k|        namestr = "<Invalid sh_name value. Corrupt Elf.>";
 1908|   191k|        res = validate_section_name_string(ep->f_elf_shstrings_length,
 1909|   191k|            gshdr->gh_name, stringsecbase,
 1910|   191k|            errcode);
 1911|   191k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|   191k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1911:13): [True: 45, False: 191k]
  ------------------
 1912|     45|            gshdr->gh_namestring = namestr;
 1913|     45|            if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|     45|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1913:17): [True: 45, False: 0]
  ------------------
 1914|     45|                return res;
 1915|     45|            }
 1916|       |            /* no entry, missing strings. */
 1917|      0|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|      0|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
 1918|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1919|   191k|        } else {
 1920|   191k|            gshdr->gh_namestring = stringsecbase + gshdr->gh_name;
 1921|   191k|        }
 1922|   191k|    }
 1923|  3.20k|    return DW_DLV_OK;
  ------------------
  |  |   59|  3.20k|#define DW_DLV_OK         0
  ------------------
 1924|  3.25k|}
dwarf_elf_load_headers.c:validate_section_name_string:
 1861|   191k|{
 1862|   191k|    const char *endpoint = strings_start + section_length;
 1863|   191k|    const char *cur = 0;
 1864|       |
 1865|   191k|    if (section_length <= string_loc_index) {
  ------------------
  |  Branch (1865:9): [True: 42, False: 191k]
  ------------------
 1866|     42|        *errcode = DW_DLE_SECTION_STRING_OFFSET_BAD;
  ------------------
  |  | 1483|     42|#define DW_DLE_SECTION_STRING_OFFSET_BAD       437
  ------------------
 1867|     42|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     42|#define DW_DLV_ERROR      1
  ------------------
 1868|     42|    }
 1869|   191k|    cur = string_loc_index+strings_start;
 1870|  14.3M|    for ( ; cur < endpoint;++cur) {
  ------------------
  |  Branch (1870:13): [True: 14.3M, False: 3]
  ------------------
 1871|  14.3M|        if (!*cur) {
  ------------------
  |  Branch (1871:13): [True: 191k, False: 14.1M]
  ------------------
 1872|   191k|            return DW_DLV_OK;
  ------------------
  |  |   59|   191k|#define DW_DLV_OK         0
  ------------------
 1873|   191k|        }
 1874|  14.3M|    }
 1875|      3|    *errcode = DW_DLE_SECTION_STRING_OFFSET_BAD;
  ------------------
  |  | 1483|      3|#define DW_DLE_SECTION_STRING_OFFSET_BAD       437
  ------------------
 1876|      3|    return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
 1877|   191k|}
dwarf_elf_load_headers.c:_dwarf_elf_find_sym_sections:
 2342|  3.20k|{
 2343|  3.20k|    struct generic_shdr* psh = 0;
 2344|  3.20k|    Dwarf_Unsigned i = 0;
 2345|  3.20k|    Dwarf_Unsigned count = 0;
 2346|  3.20k|    int res = 0;
 2347|       |
 2348|  3.20k|    count = ep->f_loc_shdr.g_count;
 2349|  3.20k|    psh = ep->f_shdr;
 2350|   194k|    for (i = 0; i < count; ++psh,++i) {
  ------------------
  |  Branch (2350:17): [True: 191k, False: 3.20k]
  ------------------
 2351|   191k|        const char *name = psh->gh_namestring;
 2352|   191k|        if (is_empty_section(psh->gh_type)) {
  ------------------
  |  Branch (2352:13): [True: 174k, False: 16.8k]
  ------------------
 2353|       |            /*  No data here. */
 2354|   174k|            continue;
 2355|   174k|        }
 2356|  16.8k|        if (!strcmp(name,".dynsym")) {
  ------------------
  |  Branch (2356:13): [True: 259, False: 16.5k]
  ------------------
 2357|    259|            ep->f_dynsym_sect_index = i;
 2358|    259|            ep->f_loc_dynsym.g_offset = psh->gh_offset;
 2359|  16.5k|        } else if (!strcmp(name,".dynstr")) {
  ------------------
  |  Branch (2359:20): [True: 216, False: 16.3k]
  ------------------
 2360|    216|            ep->f_dynsym_sect_strings_sect_index = i;
 2361|    216|            ep->f_dynsym_sect_strings_max = psh->gh_size;
 2362|  16.3k|        } else if (!strcmp(name,".symtab")) {
  ------------------
  |  Branch (2362:20): [True: 479, False: 15.8k]
  ------------------
 2363|    479|            ep->f_symtab_sect_index = i;
 2364|    479|            ep->f_loc_symtab.g_offset = psh->gh_offset;
 2365|  15.8k|        } else if (!strcmp(name,".strtab")) {
  ------------------
  |  Branch (2365:20): [True: 622, False: 15.2k]
  ------------------
 2366|    622|            ep->f_symtab_sect_strings_sect_index = i;
 2367|    622|            ep->f_symtab_sect_strings_max = psh->gh_size;
 2368|  15.2k|        } else if (!strcmp(name,".dynamic")) {
  ------------------
  |  Branch (2368:20): [True: 201, False: 15.0k]
  ------------------
 2369|    201|            ep->f_dynamic_sect_index = i;
 2370|    201|            ep->f_loc_dynamic.g_offset = psh->gh_offset;
 2371|    201|        }
 2372|  16.8k|    }
 2373|  3.20k|    res = validate_links(ep,ep->f_symtab_sect_index,
 2374|  3.20k|        ep->f_symtab_sect_strings_sect_index,errcode);
 2375|  3.20k|    if (res!= DW_DLV_OK) {
  ------------------
  |  |   59|  3.20k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2375:9): [True: 43, False: 3.16k]
  ------------------
 2376|     43|        return res;
 2377|     43|    }
 2378|  3.16k|    return DW_DLV_OK;
  ------------------
  |  |   59|  3.16k|#define DW_DLV_OK         0
  ------------------
 2379|  3.20k|}
dwarf_elf_load_headers.c:validate_links:
 2018|  3.20k|{
 2019|  3.20k|    struct generic_shdr* pshk = 0;
 2020|       |
 2021|  3.20k|    if (!knownsect) {
  ------------------
  |  Branch (2021:9): [True: 3.09k, False: 115]
  ------------------
 2022|  3.09k|        return DW_DLV_OK;
  ------------------
  |  |   59|  3.09k|#define DW_DLV_OK         0
  ------------------
 2023|  3.09k|    }
 2024|    115|    if (!string_sect) {
  ------------------
  |  Branch (2024:9): [True: 16, False: 99]
  ------------------
 2025|     16|        *errcode = DW_DLE_ELF_STRING_SECTION_ERROR;
  ------------------
  |  | 1493|     16|#define DW_DLE_ELF_STRING_SECTION_ERROR        447
  ------------------
 2026|     16|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     16|#define DW_DLV_ERROR      1
  ------------------
 2027|     16|    }
 2028|     99|    pshk = ep->f_shdr + knownsect;
 2029|     99|    if (string_sect != pshk->gh_link) {
  ------------------
  |  Branch (2029:9): [True: 27, False: 72]
  ------------------
 2030|     27|        *errcode = DW_DLE_ELF_SECTION_LINK_ERROR;
  ------------------
  |  | 1486|     27|#define DW_DLE_ELF_SECTION_LINK_ERROR          440
  ------------------
 2031|     27|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     27|#define DW_DLV_ERROR      1
  ------------------
 2032|     27|    }
 2033|     72|    return DW_DLV_OK;
  ------------------
  |  |   59|     72|#define DW_DLV_OK         0
  ------------------
 2034|     99|}
dwarf_elf_load_headers.c:_dwarf_elf_setup_all_section_groups:
 2263|  3.16k|{
 2264|  3.16k|    struct generic_shdr* psh = 0;
 2265|  3.16k|    Dwarf_Unsigned i = 0;
 2266|  3.16k|    Dwarf_Unsigned count = 0;
 2267|  3.16k|    int res = 0;
 2268|       |
 2269|  3.16k|    count = ep->f_loc_shdr.g_count;
 2270|  3.16k|    psh = ep->f_shdr;
 2271|       |
 2272|       |    /* Does step A and step B */
 2273|   166k|    for (i = 0; i < count; ++psh,++i) {
  ------------------
  |  Branch (2273:17): [True: 163k, False: 2.89k]
  ------------------
 2274|   163k|        const char *name = psh->gh_namestring;
 2275|       |
 2276|   163k|        if (is_empty_section(psh->gh_type)) {
  ------------------
  |  Branch (2276:13): [True: 148k, False: 15.5k]
  ------------------
 2277|       |            /*  No data here. */
 2278|   148k|            continue;
 2279|   148k|        }
 2280|  15.5k|        if (elf_sht_groupsec(psh->gh_type,name)) {
  ------------------
  |  Branch (2280:13): [True: 1.45k, False: 14.0k]
  ------------------
 2281|  1.45k|            ep->f_shf_group_flag_section_count++;
 2282|  14.0k|        } else {
 2283|  14.0k|            continue;
 2284|  14.0k|        }
 2285|       |        /* Looks like a section group. Do Step A. */
 2286|  1.45k|        res  =read_gs_section_group(ep,psh,errcode);
 2287|  1.45k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.45k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2287:13): [True: 272, False: 1.18k]
  ------------------
 2288|    272|            return res;
 2289|    272|        }
 2290|  1.45k|    }
 2291|       |    /*  Any sections not marked above or here are in
 2292|       |        grep DW_GROUPNUMBER_BASE (1).
 2293|       |        Section C. */
 2294|  2.89k|    psh = ep->f_shdr;
 2295|   165k|    for (i = 0; i < count; ++psh,++i) {
  ------------------
  |  Branch (2295:17): [True: 162k, False: 2.89k]
  ------------------
 2296|   162k|        const char *name = psh->gh_namestring;
 2297|   162k|        int is_rel = FALSE;
  ------------------
  |  |   36|   162k|#define FALSE 0
  ------------------
 2298|   162k|        int is_rela = FALSE;
  ------------------
  |  |   36|   162k|#define FALSE 0
  ------------------
 2299|       |
 2300|   162k|        if (is_empty_section(psh->gh_type)) {
  ------------------
  |  Branch (2300:13): [True: 147k, False: 14.7k]
  ------------------
 2301|       |            /*  No data here. */
 2302|   147k|            continue;
 2303|   147k|        }
 2304|  14.7k|        if (elf_sht_groupsec(psh->gh_type,name)) {
  ------------------
  |  Branch (2304:13): [True: 1.11k, False: 13.6k]
  ------------------
 2305|  1.11k|            continue;
 2306|  1.11k|        }
 2307|       |        /* Not a section group */
 2308|  13.6k|        if (string_endswith(name,".dwo")) {
  ------------------
  |  Branch (2308:13): [True: 1.18k, False: 12.4k]
  ------------------
 2309|  1.18k|            if (psh->gh_section_group_number) {
  ------------------
  |  Branch (2309:17): [True: 1, False: 1.18k]
  ------------------
 2310|       |                /* multi-assignment to groups. Oops. */
 2311|      1|                *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      1|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2312|      1|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
 2313|      1|            }
 2314|  1.18k|            psh->gh_is_dwarf = TRUE;
  ------------------
  |  |   33|  1.18k|#define TRUE 1
  ------------------
 2315|  1.18k|            psh->gh_section_group_number = DW_GROUPNUMBER_DWO;
  ------------------
  |  |  128|  1.18k|#define DW_GROUPNUMBER_DWO  2
  ------------------
 2316|  1.18k|            ep->f_dwo_group_section_count++;
 2317|  12.4k|        } else if (_dwarf_load_elf_section_is_dwarf(name,
  ------------------
  |  Branch (2317:20): [True: 6.61k, False: 5.88k]
  ------------------
 2318|  12.4k|            psh->gh_type,
 2319|  12.4k|            &is_rela,&is_rel)) {
 2320|  6.61k|            if (!psh->gh_section_group_number) {
  ------------------
  |  Branch (2320:17): [True: 6.56k, False: 51]
  ------------------
 2321|  6.56k|                psh->gh_section_group_number = DW_GROUPNUMBER_BASE;
  ------------------
  |  |  127|  6.56k|#define DW_GROUPNUMBER_BASE 1
  ------------------
 2322|  6.56k|            }
 2323|  6.61k|            psh->gh_is_dwarf = TRUE;
  ------------------
  |  |   33|  6.61k|#define TRUE 1
  ------------------
 2324|  6.61k|        } else {
 2325|       |            /* Do nothing. */
 2326|  5.88k|        }
 2327|  13.6k|    }
 2328|  2.89k|    if (ep->f_sht_group_type_section_count) {
  ------------------
  |  Branch (2328:9): [True: 260, False: 2.63k]
  ------------------
 2329|       |        /*  Not ARM. Done. */
 2330|    260|    }
 2331|  2.89k|    if (!ep->f_shf_group_flag_section_count) {
  ------------------
  |  Branch (2331:9): [True: 2.58k, False: 307]
  ------------------
 2332|       |        /*  Nothing more to do. */
 2333|  2.58k|        return DW_DLV_OK;
  ------------------
  |  |   59|  2.58k|#define DW_DLV_OK         0
  ------------------
 2334|  2.58k|    }
 2335|    307|    return DW_DLV_OK;
  ------------------
  |  |   59|    307|#define DW_DLV_OK         0
  ------------------
 2336|  2.89k|}
dwarf_elf_load_headers.c:elf_sht_groupsec:
 2058|  30.3k|{
 2059|       |    /*  ARM compilers name SHT group "__ARM_grp<long name here>"
 2060|       |        not .group */
 2061|  30.3k|    if ((type == SHT_GROUP) || (!strcmp(sname,".group"))){
  ------------------
  |  |   99|  30.3k|#define SHT_GROUP  17
  ------------------
  |  Branch (2061:9): [True: 2.43k, False: 27.8k]
  |  Branch (2061:32): [True: 140, False: 27.7k]
  ------------------
 2062|  2.57k|        return TRUE;
  ------------------
  |  |   33|  2.57k|#define TRUE 1
  ------------------
 2063|  2.57k|    }
 2064|  27.7k|    return FALSE;
  ------------------
  |  |   36|  27.7k|#define FALSE 0
  ------------------
 2065|  30.3k|}
dwarf_elf_load_headers.c:read_gs_section_group:
 2077|  1.45k|{
 2078|  1.45k|    Dwarf_Unsigned i = 0;
 2079|  1.45k|    int res = 0;
 2080|       |
 2081|  1.45k|    if (!psh->gh_sht_group_array) {
  ------------------
  |  Branch (2081:9): [True: 1.45k, False: 0]
  ------------------
 2082|  1.45k|        Dwarf_Unsigned seclen = psh->gh_size;
 2083|  1.45k|        char *data = 0;
 2084|  1.45k|        char *dp = 0;
 2085|  1.45k|        Dwarf_Unsigned flags = psh->gh_flags;
 2086|  1.45k|        Dwarf_Unsigned* grouparray = 0;
 2087|  1.45k|        char dblock[4];
 2088|  1.45k|        Dwarf_Unsigned va = 0;
 2089|  1.45k|        Dwarf_Unsigned count = 0;
 2090|  1.45k|        Dwarf_Unsigned groupmallocsize = 0;
 2091|  1.45k|        int foundone = 0;
 2092|       |
 2093|  1.45k|        if (seclen >= ep->f_filesize) {
  ------------------
  |  Branch (2093:13): [True: 0, False: 1.45k]
  ------------------
 2094|      0|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      0|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2095|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2096|      0|        }
 2097|  1.45k|        if (seclen < DWARF_32BIT_SIZE) {
  ------------------
  |  |  133|  1.45k|#define DWARF_32BIT_SIZE 4
  ------------------
  |  Branch (2097:13): [True: 4, False: 1.45k]
  ------------------
 2098|      4|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      4|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2099|      4|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
 2100|      4|        }
 2101|  1.45k|        if (psh->gh_content) {
  ------------------
  |  Branch (2101:13): [True: 5, False: 1.45k]
  ------------------
 2102|       |            /* Should NOT be set earlier! */
 2103|      5|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      5|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2104|      5|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      5|#define DW_DLV_ERROR      1
  ------------------
 2105|      5|        }
 2106|  1.45k|        data = malloc(seclen);
 2107|  1.45k|        if (!data) {
  ------------------
  |  Branch (2107:13): [True: 0, False: 1.45k]
  ------------------
 2108|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 2109|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2110|      0|        }
 2111|  1.45k|        if (psh->gh_entsize != DWARF_32BIT_SIZE) {
  ------------------
  |  |  133|  1.45k|#define DWARF_32BIT_SIZE 4
  ------------------
  |  Branch (2111:13): [True: 96, False: 1.35k]
  ------------------
 2112|     96|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|     96|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2113|     96|            free(data);
 2114|     96|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     96|#define DW_DLV_ERROR      1
  ------------------
 2115|     96|        }
 2116|  1.35k|        if (!psh->gh_entsize) {
  ------------------
  |  Branch (2116:13): [True: 0, False: 1.35k]
  ------------------
 2117|      0|            free(data);
 2118|      0|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      0|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2119|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2120|      0|        }
 2121|  1.35k|        count = seclen/psh->gh_entsize;
 2122|  1.35k|        if (count >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (2122:13): [True: 16, False: 1.33k]
  ------------------
 2123|       |            /* Impossible */
 2124|     16|            free(data);
 2125|     16|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|     16|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2126|     16|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     16|#define DW_DLV_ERROR      1
  ------------------
 2127|     16|        }
 2128|  1.33k|        res = RRMOA(ep->f_fd,data,psh->gh_offset,seclen,
  ------------------
  |  |   65|  1.33k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  1.33k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 2129|  1.33k|            ep->f_filesize,errcode);
 2130|  1.33k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.33k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2130:13): [True: 1, False: 1.33k]
  ------------------
 2131|      1|            free(data);
 2132|      1|            return res;
 2133|      1|        }
 2134|  1.33k|        psh->gh_content = data;
 2135|  1.33k|        data = 0;
 2136|  1.33k|        psh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|  1.33k|#define TRUE 1
  ------------------
 2137|  1.33k|        psh->gh_load_type = Dwarf_Alloc_Malloc;
 2138|  1.33k|        if (flags & SHF_COMPRESSED) {
  ------------------
  |  |  288|  1.33k|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (2138:13): [True: 2, False: 1.33k]
  ------------------
 2139|       |#if defined(HAVE_ZLIB) && defined(HAVE_ZSTD)
 2140|       |            *errcode = 0;
 2141|       |            /*  decompress call will change gh_content
 2142|       |                pointer value.  */
 2143|       |            _dwarf_do_decompress_elf(ep,psh,errcode);
 2144|       |            /* decompress and set new section size */
 2145|       |            if (*errcode) {
 2146|       |                return DW_DLV_ERROR;
 2147|       |            }
 2148|       |#else /* COMPRESSED TEST */
 2149|      2|            *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      2|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
 2150|      2|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
 2151|      2|#endif /* COMPRESSED TEST */
 2152|      2|        }
 2153|       |        /*  Adding 1 is silly but possibly avoids a warning
 2154|       |            from a particular compiler. */
 2155|  1.33k|        groupmallocsize =  (1+count) * sizeof(Dwarf_Unsigned);
 2156|  1.33k|        if (groupmallocsize >= ep->f_filesize) {
  ------------------
  |  Branch (2156:13): [True: 0, False: 1.33k]
  ------------------
 2157|      0|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      0|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2158|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2159|      0|        }
 2160|  1.33k|        grouparray = malloc(groupmallocsize);
 2161|  1.33k|        if (!grouparray) {
  ------------------
  |  Branch (2161:13): [True: 0, False: 1.33k]
  ------------------
 2162|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 2163|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2164|      0|        }
 2165|  1.33k|        memcpy(dblock,psh->gh_content,DWARF_32BIT_SIZE);
  ------------------
  |  |  133|  1.33k|#define DWARF_32BIT_SIZE 4
  ------------------
 2166|  1.33k|        ASNAR(memcpy,va,dblock);
  ------------------
  |  |   53|  1.33k|    do {                                        \
  |  |   54|  1.33k|        (t) = 0;                                \
  |  |   55|  1.33k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.33k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.33k]
  |  |  ------------------
  ------------------
 2167|       |        /* There is ambiguity on the endianness of this stuff. */
 2168|  1.33k|        if (va != 1 && va != 0x1000000) {
  ------------------
  |  Branch (2168:13): [True: 741, False: 594]
  |  Branch (2168:24): [True: 62, False: 679]
  ------------------
 2169|       |            /*  Could be corrupted elf object. */
 2170|     62|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|     62|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2171|     62|            free(grouparray);
 2172|     62|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     62|#define DW_DLV_ERROR      1
  ------------------
 2173|     62|        }
 2174|  1.27k|        grouparray[0] = 1;
 2175|       |        /*  A .group section will have 0 to G sections
 2176|       |            listed. Ignore the initial 'version' value
 2177|       |            of 1 in [0] */
 2178|  1.27k|        dp = psh->gh_content;
 2179|       |        /* Skip the initial group version */
 2180|  1.27k|        dp = dp + DWARF_32BIT_SIZE;
  ------------------
  |  |  133|  1.27k|#define DWARF_32BIT_SIZE 4
  ------------------
 2181|       |        /* Remember all the group members */
 2182|  5.26k|        for ( i = 1; i < count; ++i,dp += DWARF_32BIT_SIZE) {
  ------------------
  |  |  133|  3.99k|#define DWARF_32BIT_SIZE 4
  ------------------
  |  Branch (2182:22): [True: 4.07k, False: 1.18k]
  ------------------
 2183|  4.07k|            Dwarf_Unsigned gseca = 0;
 2184|  4.07k|            Dwarf_Unsigned gsecb = 0;
 2185|  4.07k|            struct generic_shdr* targpsh = 0;
 2186|       |
 2187|  4.07k|            memcpy(dblock,dp,DWARF_32BIT_SIZE);
  ------------------
  |  |  133|  4.07k|#define DWARF_32BIT_SIZE 4
  ------------------
 2188|  4.07k|            ASNAR(memcpy,gseca,dblock);
  ------------------
  |  |   53|  4.07k|    do {                                        \
  |  |   54|  4.07k|        (t) = 0;                                \
  |  |   55|  4.07k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.07k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.07k]
  |  |  ------------------
  ------------------
 2189|       |            /*  Loading gseca and gsecb with different endianness.
 2190|       |                Only one of them can be of any use. */
 2191|  4.07k|            ASNAR(_dwarf_memcpy_swap_bytes,gsecb,dblock);
  ------------------
  |  |   53|  4.07k|    do {                                        \
  |  |   54|  4.07k|        (t) = 0;                                \
  |  |   55|  4.07k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.07k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.07k]
  |  |  ------------------
  ------------------
 2192|  4.07k|            if (!gseca) {
  ------------------
  |  Branch (2192:17): [True: 3, False: 4.07k]
  ------------------
 2193|       |                /*  zero! Oops. No point in looking at gsecb */
 2194|      3|                free(grouparray);
 2195|      3|                *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      3|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2196|      3|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
 2197|      3|            }
 2198|  4.07k|            if (gseca >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (2198:17): [True: 2.56k, False: 1.51k]
  ------------------
 2199|       |                /*  Might be confused endianness by
 2200|       |                    the compiler generating the SHT_GROUP.
 2201|       |                    This is pretty horrible. */
 2202|  2.56k|                if (gsecb >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (2202:21): [True: 80, False: 2.48k]
  ------------------
 2203|     80|                    *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|     80|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2204|     80|                    free(grouparray);
 2205|     80|                    return DW_DLV_ERROR;
  ------------------
  |  |   60|     80|#define DW_DLV_ERROR      1
  ------------------
 2206|     80|                }
 2207|       |                /*  Looks as though gsecb is the correct
 2208|       |                    interpretation.  Yes, ugly. */
 2209|  2.48k|                gseca = gsecb;
 2210|  2.48k|            }
 2211|  3.99k|            grouparray[i] = gseca;
 2212|  3.99k|            targpsh = ep->f_shdr + gseca;
 2213|  3.99k|            if (_dwarf_ignorethissection(targpsh->gh_namestring)){
  ------------------
  |  Branch (2213:17): [True: 3.04k, False: 950]
  ------------------
 2214|       |                /* dp ok as is. Iterate again. */
 2215|  3.04k|                continue;
 2216|  3.04k|            }
 2217|    950|            if (targpsh->gh_section_group_number) {
  ------------------
  |  Branch (2217:17): [True: 3, False: 947]
  ------------------
 2218|       |                /* multi-assignment to groups. Oops. */
 2219|      3|                free(grouparray);
 2220|      3|                *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      3|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2221|      3|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
 2222|      3|            }
 2223|    947|            targpsh->gh_section_group_number =
 2224|    947|                ep->f_sg_next_group_number;
 2225|    947|            foundone = 1;
 2226|    947|        }
 2227|  1.18k|        dp = 0;
 2228|  1.18k|        if (foundone) {
  ------------------
  |  Branch (2228:13): [True: 364, False: 823]
  ------------------
 2229|    364|            ++ep->f_sg_next_group_number;
 2230|    364|            ++ep->f_sht_group_type_section_count;
 2231|    364|        }
 2232|  1.18k|        psh->gh_sht_group_array = grouparray;
 2233|  1.18k|        psh->gh_sht_group_array_count = count;
 2234|  1.18k|    }
 2235|  1.18k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.18k|#define DW_DLV_OK         0
  ------------------
 2236|  1.45k|}
dwarf_elf_load_headers.c:string_endswith:
 2038|  13.6k|{
 2039|  13.6k|    size_t len = strlen(n);
 2040|  13.6k|    size_t qlen = strlen(q);
 2041|  13.6k|    const char *startpt = 0;
 2042|       |
 2043|  13.6k|    if ( len < qlen) {
  ------------------
  |  Branch (2043:10): [True: 1.32k, False: 12.3k]
  ------------------
 2044|  1.32k|        return FALSE;
  ------------------
  |  |   36|  1.32k|#define FALSE 0
  ------------------
 2045|  1.32k|    }
 2046|  12.3k|    startpt = n + (len-qlen);
 2047|  12.3k|    if (strcmp(startpt,q)) {
  ------------------
  |  Branch (2047:9): [True: 11.1k, False: 1.18k]
  ------------------
 2048|  11.1k|        return FALSE;
  ------------------
  |  |   36|  11.1k|#define FALSE 0
  ------------------
 2049|  11.1k|    }
 2050|  1.18k|    return TRUE;
  ------------------
  |  |   33|  1.18k|#define TRUE 1
  ------------------
 2051|  12.3k|}
dwarf_elf_load_headers.c:_dwarf_load_elf_section_is_dwarf:
  310|  12.4k|{
  311|  12.4k|    *is_rel = FALSE;
  ------------------
  |  |   36|  12.4k|#define FALSE 0
  ------------------
  312|  12.4k|    *is_rela = FALSE;
  ------------------
  |  |   36|  12.4k|#define FALSE 0
  ------------------
  313|  12.4k|    if (_dwarf_ignorethissection(sname)) {
  ------------------
  |  Branch (313:9): [True: 1.20k, False: 11.2k]
  ------------------
  314|  1.20k|        return FALSE;
  ------------------
  |  |   36|  1.20k|#define FALSE 0
  ------------------
  315|  1.20k|    }
  316|  11.2k|    if (sectype == SHT_REL) {
  ------------------
  |  |   59|  11.2k|#define SHT_REL 9
  ------------------
  |  Branch (316:9): [True: 1.33k, False: 9.95k]
  ------------------
  317|  1.33k|        return TRUE;
  ------------------
  |  |   33|  1.33k|#define TRUE 1
  ------------------
  318|  1.33k|    }
  319|  9.95k|    if (sectype == SHT_RELA) {
  ------------------
  |  |   56|  9.95k|#define SHT_RELA 4
  ------------------
  |  Branch (319:9): [True: 1.82k, False: 8.12k]
  ------------------
  320|  1.82k|        *is_rela = TRUE;
  ------------------
  |  |   33|  1.82k|#define TRUE 1
  ------------------
  321|  1.82k|        return TRUE;
  ------------------
  |  |   33|  1.82k|#define TRUE 1
  ------------------
  322|  1.82k|    }
  323|  8.12k|    if (!strncmp(sname,".rel",4)) {
  ------------------
  |  Branch (323:9): [True: 1.35k, False: 6.77k]
  ------------------
  324|  1.35k|        if (!strncmp(sname,".rela.",6)) {
  ------------------
  |  Branch (324:13): [True: 524, False: 832]
  ------------------
  325|    524|            *is_rela = TRUE;
  ------------------
  |  |   33|    524|#define TRUE 1
  ------------------
  326|    524|            return TRUE;
  ------------------
  |  |   33|    524|#define TRUE 1
  ------------------
  327|    524|        }
  328|    832|        if (!strncmp(sname,".rel.",5)) {
  ------------------
  |  Branch (328:13): [True: 514, False: 318]
  ------------------
  329|    514|            *is_rela = TRUE;
  ------------------
  |  |   33|    514|#define TRUE 1
  ------------------
  330|    514|            return TRUE;
  ------------------
  |  |   33|    514|#define TRUE 1
  ------------------
  331|    514|        }
  332|       |        /*  Else something is goofy/Impossible */
  333|    318|        return FALSE;
  ------------------
  |  |   36|    318|#define FALSE 0
  ------------------
  334|    832|    }
  335|  6.77k|    if (!strncmp(sname,".debug_",7)) {
  ------------------
  |  Branch (335:9): [True: 1.34k, False: 5.43k]
  ------------------
  336|  1.34k|        return TRUE;
  ------------------
  |  |   33|  1.34k|#define TRUE 1
  ------------------
  337|  1.34k|    }
  338|  5.43k|    if (!strncmp(sname,".zdebug_",8)) {
  ------------------
  |  Branch (338:9): [True: 473, False: 4.95k]
  ------------------
  339|    473|        return TRUE;
  ------------------
  |  |   33|    473|#define TRUE 1
  ------------------
  340|    473|    }
  341|  4.95k|    if (!strcmp(sname,".eh_frame")) {
  ------------------
  |  Branch (341:9): [True: 324, False: 4.63k]
  ------------------
  342|    324|        return TRUE;
  ------------------
  |  |   33|    324|#define TRUE 1
  ------------------
  343|    324|    }
  344|  4.63k|    if (!strncmp(sname,".gdb_index",10)) {
  ------------------
  |  Branch (344:9): [True: 271, False: 4.36k]
  ------------------
  345|    271|        return TRUE;
  ------------------
  |  |   33|    271|#define TRUE 1
  ------------------
  346|    271|    }
  347|  4.36k|    return FALSE;
  ------------------
  |  |   36|  4.36k|#define FALSE 0
  ------------------
  348|  4.63k|}

_dwarf_elf_nlsetup:
  917|  4.57k|{
  918|  4.57k|    Dwarf_Obj_Access_Interface_a *binary_interface = 0;
  919|  4.57k|    dwarf_elf_object_access_internals_t *intfc = 0;
  920|  4.57k|    int res = DW_DLV_OK;
  ------------------
  |  |   59|  4.57k|#define DW_DLV_OK         0
  ------------------
  921|  4.57k|    int localerrnum = 0;
  922|       |
  923|  4.57k|    res = _dwarf_elf_object_access_init(
  924|  4.57k|        fd,
  925|  4.57k|        ftype,endian,offsetsize,filesize,
  926|  4.57k|        &binary_interface,
  927|  4.57k|        &localerrnum);
  928|  4.57k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  4.57k|#define DW_DLV_OK         0
  ------------------
  |  Branch (928:9): [True: 2.05k, False: 2.52k]
  ------------------
  929|  2.05k|        if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |   58|  2.05k|#define DW_DLV_NO_ENTRY  -1
  ------------------
  |  Branch (929:13): [True: 2, False: 2.04k]
  ------------------
  930|      2|            return res;
  931|      2|        }
  932|  2.04k|        _dwarf_error(NULL, error, localerrnum);
  933|  2.04k|        return DW_DLV_ERROR;
  ------------------
  |  |   60|  2.04k|#define DW_DLV_ERROR      1
  ------------------
  934|  2.05k|    }
  935|       |    /*  allocates and initializes Dwarf_Debug,
  936|       |        generic code */
  937|  2.52k|    res = dwarf_object_init_b(binary_interface, errhand, errarg,
  938|  2.52k|        groupnumber, dbg, error);
  939|  2.52k|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|  2.52k|#define DW_DLV_OK         0
  ------------------
  |  Branch (939:9): [True: 1.84k, False: 677]
  ------------------
  940|  1.84k|        _dwarf_destruct_elf_nlaccess(binary_interface);
  941|  1.84k|        return res;
  942|  1.84k|    }
  943|    677|    intfc = binary_interface->ai_object;
  944|    677|    intfc->f_path = strdup(true_path);
  945|    677|    (*dbg)->de_obj_machine = intfc->f_machine;
  946|    677|    (*dbg)->de_obj_type = intfc->f_ftype; /* ET_REL etc */
  947|    677|    (*dbg)->de_obj_flags = intfc->f_flags;
  948|    677|    return res;
  949|  2.52k|}
dwarf_elfread.c:_dwarf_destruct_elf_nlaccess:
  821|  4.57k|{
  822|  4.57k|    struct Dwarf_Obj_Access_Interface_a_s *aip =
  823|  4.57k|        (struct Dwarf_Obj_Access_Interface_a_s *)obj;
  824|  4.57k|    dwarf_elf_object_access_internals_t *ep = 0;
  825|  4.57k|    struct generic_shdr *shp = 0;
  826|  4.57k|    Dwarf_Unsigned shcount = 0;
  827|  4.57k|    Dwarf_Unsigned i = 0;
  828|       |
  829|  4.57k|    ep = (dwarf_elf_object_access_internals_t *)aip->ai_object;
  830|  4.57k|    shp = ep->f_shdr;
  831|  4.57k|    shcount = ep->f_loc_shdr.g_count;
  832|   198k|    for (i = 0; i < shcount; ++i,++shp) {
  ------------------
  |  Branch (832:17): [True: 193k, False: 4.57k]
  ------------------
  833|   193k|        enum Dwarf_Sec_Alloc_Pref alloc = shp->gh_load_type;
  834|   193k|        free(shp->gh_rels);
  835|   193k|        shp->gh_rels = 0;
  836|   193k|        switch(alloc) {
  837|  6.25k|        case Dwarf_Alloc_Malloc:
  ------------------
  |  Branch (837:9): [True: 6.25k, False: 187k]
  ------------------
  838|  6.25k|            if (shp->gh_was_alloc) {
  ------------------
  |  Branch (838:17): [True: 6.23k, False: 17]
  ------------------
  839|  6.23k|                free(shp->gh_content);
  840|  6.23k|                shp->gh_content = 0;
  841|  6.23k|            }
  842|  6.25k|            break;
  843|      0|#ifdef HAVE_FULL_MMAP
  844|      0|        case Dwarf_Alloc_Mmap: {
  ------------------
  |  Branch (844:9): [True: 0, False: 193k]
  ------------------
  845|      0|            if (shp->gh_was_alloc) {
  ------------------
  |  Branch (845:17): [True: 0, False: 0]
  ------------------
  846|      0|                munmap(shp->gh_mmap_realarea,
  847|      0|                    (size_t)shp->gh_computed_mmaplen);
  848|       |                /* If returned non-zero unmap failed */
  849|      0|                shp->gh_was_alloc = FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  850|      0|                shp->gh_mmap_realarea =0;
  851|      0|                shp->gh_computed_mmaplen = 0;
  852|      0|            }
  853|      0|        } break;
  854|      0|#endif /* HAVE_FULL_MMAP */
  855|   187k|        default: break;
  ------------------
  |  Branch (855:9): [True: 187k, False: 6.25k]
  ------------------
  856|       |            /*  something disastrously wrong. No free/mmap */
  857|   193k|        } /* end switch on alloc */
  858|   193k|        shp->gh_content = 0;
  859|   193k|        shp->gh_mmap_realarea = (char *)-1;
  860|   193k|        shp->gh_computed_mmaplen = 0;
  861|   193k|        free(shp->gh_sht_group_array);
  862|   193k|        shp->gh_sht_group_array = 0;
  863|   193k|        shp->gh_sht_group_array_count = 0;
  864|   193k|    }
  865|  4.57k|    free(ep->f_ehdr);
  866|  4.57k|    ep->f_ehdr = 0;
  867|  4.57k|    ep->f_loc_shdr.g_count = 0;
  868|  4.57k|    free(ep->f_phdr);
  869|  4.57k|    ep->f_phdr = 0;
  870|       |
  871|       |    /*  Whether elf shstrings and symtab strings
  872|       |        share the same section or not, we do
  873|       |        not need to free these. Section frees
  874|       |        of gh_content already did it. */
  875|  4.57k|    ep->f_elf_shstrings_data = 0;
  876|  4.57k|    ep->f_elf_shstrings_length = 0;
  877|  4.57k|    ep->f_elf_shstrings_max = 0;
  878|  4.57k|    ep->f_elf_shstrings_index = 0;
  879|  4.57k|    ep->f_symtab_sect_strings = 0;
  880|  4.57k|    ep->f_symtab_sect_strings_max = 0;
  881|  4.57k|    ep->f_symtab_sect_strings_sect_index = 0;
  882|       |
  883|  4.57k|    free(ep->f_dynsym_sect_strings);
  884|  4.57k|    ep->f_dynsym_sect_strings = 0;
  885|  4.57k|    free(ep->f_dynamic);
  886|  4.57k|    ep->f_dynamic = 0;
  887|  4.57k|    free(ep->f_symtab);
  888|  4.57k|    ep->f_symtab = 0;
  889|  4.57k|    free(ep->f_dynsym);
  890|  4.57k|    ep->f_dynsym = 0;
  891|  4.57k|    free(ep->f_shdr);
  892|  4.57k|    ep->f_shdr = 0;
  893|       |    /* if TRUE close f_fd on destruct.*/
  894|  4.57k|    if (ep->f_destruct_close_fd) {
  ------------------
  |  Branch (894:9): [True: 0, False: 4.57k]
  ------------------
  895|      0|        _dwarf_closer(ep->f_fd);
  896|      0|    }
  897|  4.57k|    ep->f_ident[0] = 'X';
  898|  4.57k|    free(ep->f_path);
  899|  4.57k|    ep->f_path = 0;
  900|  4.57k|    free(ep);
  901|  4.57k|    ep = 0;
  902|  4.57k|    free(aip);
  903|  4.57k|    aip = 0;
  904|  4.57k|}
dwarf_elfread.c:_dwarf_elf_object_access_init:
 1115|  4.57k|{
 1116|       |
 1117|  4.57k|    int res = 0;
 1118|  4.57k|    dwarf_elf_object_access_internals_t *internals = 0;
 1119|  4.57k|    Dwarf_Obj_Access_Interface_a *intfc = 0;
 1120|       |
 1121|  4.57k|    internals = malloc(sizeof(dwarf_elf_object_access_internals_t));
 1122|  4.57k|    if (!internals) {
  ------------------
  |  Branch (1122:9): [True: 0, False: 4.57k]
  ------------------
 1123|      0|        *localerrnum = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1124|       |        /* Impossible case, we hope. Give up. */
 1125|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1126|      0|    }
 1127|  4.57k|    memset(internals,0,sizeof(*internals));
 1128|  4.57k|    res = _dwarf_elf_object_access_internals_init(internals,
 1129|  4.57k|        fd,
 1130|  4.57k|        ftype, endian, offsetsize, filesize,
 1131|  4.57k|        localerrnum);
 1132|  4.57k|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|  4.57k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1132:9): [True: 2.05k, False: 2.52k]
  ------------------
 1133|  2.05k|        return res;
 1134|  2.05k|    }
 1135|       |
 1136|  2.52k|    intfc = malloc(sizeof(Dwarf_Obj_Access_Interface_a));
 1137|  2.52k|    if (!intfc) {
  ------------------
  |  Branch (1137:9): [True: 0, False: 2.52k]
  ------------------
 1138|       |        /* Impossible case, we hope. Give up. */
 1139|      0|        free(internals);
 1140|      0|        *localerrnum = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1141|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1142|      0|    }
 1143|  2.52k|    memset(intfc,0,sizeof(*intfc));
 1144|       |
 1145|       |    /* Initialize the interface struct */
 1146|  2.52k|    intfc->ai_object = internals;
 1147|  2.52k|    intfc->ai_methods = &elf_nlmethods;
 1148|  2.52k|    *binary_interface = intfc;
 1149|  2.52k|    return DW_DLV_OK;
  ------------------
  |  |   59|  2.52k|#define DW_DLV_OK         0
  ------------------
 1150|  2.52k|}
dwarf_elfread.c:_dwarf_elf_object_access_internals_init:
  981|  4.57k|{
  982|  4.57k|    dwarf_elf_object_access_internals_t * intfc = internals;
  983|  4.57k|    Dwarf_Unsigned i  = 0;
  984|  4.57k|    struct Dwarf_Obj_Access_Interface_a_s *localdoas;
  985|  4.57k|    int res = 0;
  986|       |
  987|       |    /*  Must malloc as _dwarf_destruct_elf_access()
  988|       |        forces that due to other uses. */
  989|  4.57k|    localdoas = (struct Dwarf_Obj_Access_Interface_a_s *)
  990|  4.57k|        malloc(sizeof(struct Dwarf_Obj_Access_Interface_a_s));
  991|  4.57k|    if (!localdoas) {
  ------------------
  |  Branch (991:9): [True: 0, False: 4.57k]
  ------------------
  992|      0|        free(internals);
  993|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  994|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  995|      0|    }
  996|  4.57k|    memset(localdoas,0,sizeof(struct Dwarf_Obj_Access_Interface_a_s));
  997|       |    /*  E is used with libelf. F with this elf reader. */
  998|  4.57k|    intfc->f_ident[0]    = 'F';
  999|  4.57k|    intfc->f_ident[1]    = '1';
 1000|  4.57k|    intfc->f_fd          = fd;
 1001|  4.57k|    intfc->f_is_64bit    = ((offsetsize==64)?TRUE:FALSE);
  ------------------
  |  |   33|  1.52k|#define TRUE 1
  ------------------
                  intfc->f_is_64bit    = ((offsetsize==64)?TRUE:FALSE);
  ------------------
  |  |   36|  3.04k|#define FALSE 0
  ------------------
  |  Branch (1001:29): [True: 1.52k, False: 3.04k]
  ------------------
 1002|  4.57k|    intfc->f_offsetsize  = (Dwarf_Small)offsetsize;
 1003|  4.57k|    intfc->f_pointersize = (Dwarf_Small)offsetsize;
 1004|  4.57k|    intfc->f_filesize    = filesize;
 1005|  4.57k|    intfc->f_ftype       = ftype;
 1006|  4.57k|    intfc->f_destruct_close_fd = FALSE;
  ------------------
  |  |   36|  4.57k|#define FALSE 0
  ------------------
 1007|       |
 1008|       |#ifdef WORDS_BIGENDIAN
 1009|       |    if (endian == DW_END_little ) {
 1010|       |        intfc->f_copy_word = _dwarf_memcpy_swap_bytes;
 1011|       |        intfc->f_endian = DW_END_little;
 1012|       |    } else {
 1013|       |        intfc->f_copy_word = _dwarf_memcpy_noswap_bytes;
 1014|       |        intfc->f_endian = DW_END_big;
 1015|       |    }
 1016|       |#else  /* LITTLE ENDIAN */
 1017|  4.57k|    if (endian == DW_END_little ) {
  ------------------
  |  | 1115|  4.57k|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  |  Branch (1017:9): [True: 1.40k, False: 3.16k]
  ------------------
 1018|  1.40k|        intfc->f_copy_word = _dwarf_memcpy_noswap_bytes;
 1019|  1.40k|        intfc->f_endian = DW_END_little;
  ------------------
  |  | 1115|  1.40k|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1020|  3.16k|    } else {
 1021|  3.16k|        intfc->f_copy_word = _dwarf_memcpy_swap_bytes;
 1022|  3.16k|        intfc->f_endian = DW_END_big;
  ------------------
  |  | 1114|  3.16k|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
 1023|  3.16k|    }
 1024|  4.57k|#endif /* LITTLE- BIG-ENDIAN */
 1025|       |    /*  The following sets f_machine. */
 1026|  4.57k|    res = _dwarf_load_elf_header(intfc,errcode);
 1027|  4.57k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  4.57k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1027:9): [True: 68, False: 4.50k]
  ------------------
 1028|     68|        localdoas->ai_object = intfc;
 1029|     68|        localdoas->ai_methods = 0;
 1030|     68|        _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1031|     68|        localdoas = 0;
 1032|     68|        return res;
 1033|     68|    }
 1034|       |    /* Not loading progheaders */
 1035|  4.50k|    res = _dwarf_load_elf_sectheaders(intfc,errcode);
 1036|  4.50k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  4.50k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1036:9): [True: 1.61k, False: 2.89k]
  ------------------
 1037|  1.61k|        localdoas->ai_object = intfc;
 1038|  1.61k|        localdoas->ai_methods = 0;
 1039|  1.61k|        _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1040|  1.61k|        localdoas = 0;
 1041|  1.61k|        return res;
 1042|       |
 1043|  1.61k|    }
 1044|       |    /* We are not looking at symbol strings for now. */
 1045|  2.89k|    res = _dwarf_load_elf_symstr(intfc,errcode);
 1046|  2.89k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  2.89k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1046:9): [True: 124, False: 2.76k]
  ------------------
 1047|    124|        localdoas->ai_object = intfc;
 1048|    124|        localdoas->ai_methods = 0;
 1049|    124|        _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1050|    124|        localdoas = 0;
 1051|    124|        return res;
 1052|    124|    }
 1053|  2.76k|    res  = _dwarf_load_elf_symtab_symbols(intfc,errcode);
 1054|  2.76k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  2.76k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1054:9): [True: 19, False: 2.74k]
  ------------------
 1055|     19|        localdoas->ai_object = intfc;
 1056|     19|        localdoas->ai_methods = 0;
 1057|     19|        _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1058|     19|        localdoas = 0;
 1059|     19|        return res;
 1060|     19|    }
 1061|   160k|    for ( i = 1; i < intfc->f_loc_shdr.g_count; ++i) {
  ------------------
  |  Branch (1061:18): [True: 158k, False: 2.52k]
  ------------------
 1062|   158k|        struct generic_shdr *shp = 0;
 1063|   158k|        Dwarf_Unsigned section_type = 0;
 1064|   158k|        enum RelocRela localrel = RelocIsRela;
 1065|       |
 1066|   158k|        shp = intfc->f_shdr +i;
 1067|   158k|        section_type = shp->gh_type;
 1068|       |        /*  An empty namestring is a suggestion
 1069|       |            of corrupt Elf, and useless PE/Mach-o
 1070|       |            10 May 2026. */
 1071|   158k|        if (!shp->gh_namestring || !shp->gh_namestring[0]) {
  ------------------
  |  Branch (1071:13): [True: 0, False: 158k]
  |  Branch (1071:36): [True: 1.40k, False: 156k]
  ------------------
 1072|       |            /*  A serious error which we ignore here
 1073|       |                as it will be caught elsewhere
 1074|       |                if necessary. */
 1075|  1.40k|            continue;
 1076|   156k|        } else if (section_type == SHT_REL) {
  ------------------
  |  |   59|   156k|#define SHT_REL 9
  ------------------
  |  Branch (1076:20): [True: 1.47k, False: 155k]
  ------------------
 1077|  1.47k|            localrel = RelocIsRel;
 1078|   155k|        } else if (section_type == SHT_RELA) {
  ------------------
  |  |   56|   155k|#define SHT_RELA 4
  ------------------
  |  Branch (1078:20): [True: 2.23k, False: 152k]
  ------------------
 1079|  2.23k|            localrel = RelocIsRela;
 1080|   152k|        } else if (!strncmp(".rel.",shp->gh_namestring,5)) {
  ------------------
  |  Branch (1080:20): [True: 6.52k, False: 146k]
  ------------------
 1081|  6.52k|            localrel = RelocIsRel;
 1082|   146k|        } else if (!strncmp(".rela.",shp->gh_namestring,6)) {
  ------------------
  |  Branch (1082:20): [True: 8.98k, False: 137k]
  ------------------
 1083|  8.98k|            localrel = RelocIsRela;
 1084|   137k|        } else {
 1085|   137k|            continue;
 1086|   137k|        }
 1087|       |        /*  ASSERT: local rel is either RelocIsRel or
 1088|       |            RelocIsRela. Never any other value. */
 1089|       |        /*  Possibly we should check if the target section
 1090|       |            is one we care about before loading rela
 1091|       |            FIXME */
 1092|  19.2k|        res = _dwarf_load_elf_relx(intfc,i,localrel,errcode);
 1093|  19.2k|        if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  19.2k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1093:13): [True: 226, False: 18.9k]
  ------------------
 1094|    226|            localdoas->ai_object = intfc;
 1095|    226|            localdoas->ai_methods = 0;
 1096|    226|            _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1097|    226|            localdoas = 0;
 1098|    226|            return res;
 1099|    226|        }
 1100|  19.2k|    }
 1101|  2.52k|    free(localdoas);
 1102|  2.52k|    localdoas = 0;
 1103|  2.52k|    return DW_DLV_OK;
  ------------------
  |  |   59|  2.52k|#define DW_DLV_OK         0
  ------------------
 1104|  2.74k|}
dwarf_elfread.c:elf_get_nolibelf_section_info:
  185|   301k|{
  186|   301k|    dwarf_elf_object_access_internals_t *elf =
  187|   301k|        (dwarf_elf_object_access_internals_t*)(obj);
  188|       |
  189|   301k|    (void)error;
  190|   301k|    if (section_index < elf->f_loc_shdr.g_count) {
  ------------------
  |  Branch (190:9): [True: 301k, False: 0]
  ------------------
  191|   301k|        struct generic_shdr *sp = 0;
  192|       |
  193|   301k|        sp = elf->f_shdr + section_index;
  194|   301k|        return_section->as_addr      = sp->gh_addr;
  195|   301k|        return_section->as_type      = sp->gh_type;
  196|   301k|        return_section->as_size      = sp->gh_size;
  197|   301k|        return_section->as_name      = sp->gh_namestring;
  198|   301k|        return_section->as_link      = sp->gh_link;
  199|   301k|        return_section->as_info      = sp->gh_info;
  200|   301k|        return_section->as_flags     = sp->gh_flags;
  201|   301k|        return_section->as_entrysize = sp->gh_entsize;
  202|   301k|        return_section->as_offset    = sp->gh_offset;
  203|   301k|        return DW_DLV_OK;
  ------------------
  |  |   59|   301k|#define DW_DLV_OK         0
  ------------------
  204|   301k|    }
  205|      0|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  206|   301k|}
dwarf_elfread.c:elf_get_nolibelf_byte_order:
  147|  2.52k|{
  148|  2.52k|    dwarf_elf_object_access_internals_t *elf =
  149|  2.52k|        (dwarf_elf_object_access_internals_t*)(obj);
  150|  2.52k|    return (Dwarf_Small)elf->f_endian;
  151|  2.52k|}
dwarf_elfread.c:elf_get_nolibelf_length_size:
  154|  2.52k|{
  155|  2.52k|    dwarf_elf_object_access_internals_t *elf =
  156|  2.52k|        (dwarf_elf_object_access_internals_t*)(obj);
  157|  2.52k|    return elf->f_offsetsize/8;
  158|  2.52k|}
dwarf_elfread.c:elf_get_nolibelf_pointer_size:
  161|  2.52k|{
  162|  2.52k|    dwarf_elf_object_access_internals_t *elf =
  163|  2.52k|        (dwarf_elf_object_access_internals_t*)(obj);
  164|  2.52k|    return elf->f_pointersize/8;
  165|  2.52k|}
dwarf_elfread.c:elf_get_nolibelf_file_size:
  168|  2.52k|{
  169|  2.52k|    dwarf_elf_object_access_internals_t *elf =
  170|  2.52k|        (dwarf_elf_object_access_internals_t*)(obj);
  171|  2.52k|    return elf->f_filesize;
  172|  2.52k|}
dwarf_elfread.c:elf_get_nolibelf_section_count:
  175|  2.52k|{
  176|  2.52k|    dwarf_elf_object_access_internals_t *elf =
  177|  2.52k|        (dwarf_elf_object_access_internals_t*)(obj);
  178|  2.52k|    return elf->f_loc_shdr.g_count;
  179|  2.52k|}
dwarf_elfread.c:elf_load_nolibelf_section:
  250|  2.11k|{
  251|       |    /*  Linux kernel read size limit 0x7ffff000,
  252|       |        Without any good reason, limit our reads
  253|       |        to a bit less. */
  254|  2.11k|    const Dwarf_Unsigned read_size_limit = 0x7ff00000;
  255|  2.11k|    Dwarf_Unsigned read_offset = 0;
  256|  2.11k|    Dwarf_Unsigned read_size = 0;
  257|  2.11k|    Dwarf_Unsigned remaining_bytes = 0;
  258|  2.11k|    Dwarf_Small *  read_target = 0;
  259|  2.11k|    dwarf_elf_object_access_internals_t *elf =
  260|  2.11k|        (dwarf_elf_object_access_internals_t*)(obj);
  261|  2.11k|    struct generic_shdr *sp = 0;
  262|  2.11k|    int decompressme = FALSE;
  ------------------
  |  |   36|  2.11k|#define FALSE 0
  ------------------
  263|  2.11k|    int res = 0;
  264|       |
  265|  2.11k|    res = elf_load_find_sec_ptr(obj,section_index,&sp,
  266|  2.11k|        &decompressme,errorc);
  267|  2.11k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.11k|#define DW_DLV_OK         0
  ------------------
  |  Branch (267:9): [True: 0, False: 2.11k]
  ------------------
  268|      0|        return res;
  269|      0|    }
  270|  2.11k|    if (sp->gh_content) {
  ------------------
  |  Branch (270:9): [True: 1.25k, False: 854]
  ------------------
  271|  1.25k|        *return_data = (Dwarf_Small *)sp->gh_content;
  272|  1.25k|        return DW_DLV_OK;
  ------------------
  |  |   59|  1.25k|#define DW_DLV_OK         0
  ------------------
  273|  1.25k|    }
  274|       |    /*  Guarding against bad values and
  275|       |        against overflow */
  276|    854|    if (sp->gh_size > elf->f_filesize ||
  ------------------
  |  Branch (276:9): [True: 309, False: 545]
  ------------------
  277|    545|        sp->gh_offset > elf->f_filesize ||
  ------------------
  |  Branch (277:9): [True: 97, False: 448]
  ------------------
  278|    448|        (sp->gh_size + sp->gh_offset) >
  ------------------
  |  Branch (278:9): [True: 24, False: 424]
  ------------------
  279|    448|            elf->f_filesize) {
  280|    430|        *errorc = DW_DLE_ELF_SECTION_ERROR;
  ------------------
  |  | 1492|    430|#define DW_DLE_ELF_SECTION_ERROR               446
  ------------------
  281|    430|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    430|#define DW_DLV_ERROR      1
  ------------------
  282|    430|    }
  283|       |
  284|    424|    sp->gh_load_type = Dwarf_Alloc_Malloc;
  285|    424|    sp->gh_content = malloc((size_t)sp->gh_size);
  286|    424|    if (!sp->gh_content) {
  ------------------
  |  Branch (286:9): [True: 0, False: 424]
  ------------------
  287|      0|        *errorc = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  288|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  289|      0|    }
  290|       |    /*  Linux has a 2GB limit on read size.
  291|       |        So break this into 2gb pieces.  */
  292|    424|    remaining_bytes = sp->gh_size;
  293|    424|    read_size = remaining_bytes;
  294|    424|    read_offset = sp->gh_offset;
  295|    424|    read_target = (Dwarf_Small*)sp->gh_content;
  296|    848|    for ( ; remaining_bytes > 0; read_size = remaining_bytes ) {
  ------------------
  |  Branch (296:13): [True: 424, False: 424]
  ------------------
  297|    424|        if (read_size > read_size_limit) {
  ------------------
  |  Branch (297:13): [True: 0, False: 424]
  ------------------
  298|      0|            read_size = read_size_limit;
  299|      0|        }
  300|    424|        res = RRMOA(elf->f_fd,
  ------------------
  |  |   65|    424|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    424|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  301|    424|            (void *)read_target, read_offset,
  302|    424|            read_size,
  303|    424|            elf->f_filesize, errorc);
  304|    424|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    424|#define DW_DLV_OK         0
  ------------------
  |  Branch (304:13): [True: 0, False: 424]
  ------------------
  305|      0|            free(sp->gh_content);
  306|      0|            sp->gh_content = 0;
  307|      0|            return res;
  308|      0|        }
  309|    424|        remaining_bytes -= read_size;
  310|    424|        read_offset += read_size;
  311|    424|        read_target += read_size;
  312|    424|    }
  313|    424|    sp->gh_was_alloc = TRUE;
  ------------------
  |  |   33|    424|#define TRUE 1
  ------------------
  314|    424|    sp->gh_load_type = Dwarf_Alloc_Malloc;
  315|       |
  316|    424|    if (decompressme) {
  ------------------
  |  Branch (316:9): [True: 2, False: 422]
  ------------------
  317|      2|        Dwarf_Unsigned flags = sp->gh_flags;
  318|      2|        if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|      2|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (318:13): [True: 2, False: 0]
  ------------------
  319|       |#if defined(HAVE_ZLIB) && defined(HAVE_ZSTD)
  320|       |            *errorc = 0;
  321|       |            /* decompress and set new section size */
  322|       |            _dwarf_do_decompress_elf(elf,sp,errorc);
  323|       |            if (*errorc) {
  324|       |                free(sp->gh_content);
  325|       |                sp->gh_content = 0;
  326|       |                return DW_DLV_ERROR;
  327|       |            }
  328|       |#else /* COMPRESSED TEST */
  329|      2|            *errorc = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      2|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
  330|      2|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
  331|      2|#endif /* COMPRESSED TEST */
  332|      2|        }
  333|      2|    }
  334|    422|    *return_data = (Dwarf_Small *)sp->gh_content;
  335|    422|    return DW_DLV_OK;
  ------------------
  |  |   59|    422|#define DW_DLV_OK         0
  ------------------
  336|    424|}
dwarf_elfread.c:elf_load_find_sec_ptr:
  212|  4.22k|{
  213|  4.22k|    dwarf_elf_object_access_internals_t *elf =
  214|  4.22k|        (dwarf_elf_object_access_internals_t*)(obj);
  215|       |
  216|  4.22k|    (void)errorc;
  217|  4.22k|    if (0 < section_index &&
  ------------------
  |  Branch (217:9): [True: 4.22k, False: 3]
  ------------------
  218|  4.22k|        section_index < elf->f_loc_shdr.g_count) {
  ------------------
  |  Branch (218:9): [True: 4.22k, False: 0]
  ------------------
  219|  4.22k|        struct generic_shdr *sp =
  220|  4.22k|            elf->f_shdr + section_index;
  221|       |
  222|  4.22k|        if (!sp->gh_size) {
  ------------------
  |  Branch (222:13): [True: 0, False: 4.22k]
  ------------------
  223|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  224|      0|        }
  225|  4.22k|        *sp_inout = sp;
  226|  4.22k|        if (sp->gh_flags & SHF_COMPRESSED) {
  ------------------
  |  |  288|  4.22k|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (226:13): [True: 68, False: 4.15k]
  ------------------
  227|     68|            switch(sp->gh_type) {
  228|      6|            case SHT_STRTAB:
  ------------------
  |  |   53|      6|#define SHT_STRTAB 3
  ------------------
  |  Branch (228:13): [True: 6, False: 62]
  ------------------
  229|     10|            case SHT_SYMTAB:
  ------------------
  |  |   50|     10|#define SHT_SYMTAB 2
  ------------------
  |  Branch (229:13): [True: 4, False: 64]
  ------------------
  230|     14|            case SHT_REL:
  ------------------
  |  |   59|     14|#define SHT_REL 9
  ------------------
  |  Branch (230:13): [True: 4, False: 64]
  ------------------
  231|     24|            case SHT_RELA:
  ------------------
  |  |   56|     24|#define SHT_RELA 4
  ------------------
  |  Branch (231:13): [True: 10, False: 58]
  ------------------
  232|     24|                *decompressme = TRUE;
  ------------------
  |  |   33|     24|#define TRUE 1
  ------------------
  233|     24|                break;
  234|     24|            case SHT_NOBITS:
  ------------------
  |  |   87|     24|#define SHT_NOBITS 8
  ------------------
  |  Branch (234:13): [True: 24, False: 44]
  ------------------
  235|     44|            default:
  ------------------
  |  Branch (235:13): [True: 20, False: 48]
  ------------------
  236|     44|                break;
  237|     68|            }
  238|     68|        }
  239|  4.22k|        return DW_DLV_OK;
  ------------------
  |  |   59|  4.22k|#define DW_DLV_OK         0
  ------------------
  240|  4.22k|    }
  241|      3|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      3|#define DW_DLV_NO_ENTRY  -1
  ------------------
  242|  4.22k|}
dwarf_elfread.c:elf_relocations_nolibelf:
  762|    116|{
  763|    116|    int res = DW_DLV_ERROR;
  ------------------
  |  |   60|    116|#define DW_DLV_ERROR      1
  ------------------
  764|    116|    dwarf_elf_object_access_internals_t*obj = 0;
  765|    116|    struct Dwarf_Section_s * relocatablesec = 0;
  766|    116|    Dwarf_Unsigned section_with_reloc_records = 0;
  767|       |
  768|    116|    if (section_index == 0) {
  ------------------
  |  Branch (768:9): [True: 0, False: 116]
  ------------------
  769|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  770|      0|    }
  771|    116|    obj = (dwarf_elf_object_access_internals_t*)obj_in;
  772|       |
  773|       |    /*  The section to relocate must already be loaded into memory.
  774|       |        This just turns section_index into a pointer
  775|       |        to a de_debug_info or other  section record in
  776|       |        Dwarf_Debug. */
  777|    116|    res = find_section_to_relocate(dbg, section_index,
  778|    116|        &relocatablesec, errorc);
  779|    116|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    116|#define DW_DLV_OK         0
  ------------------
  |  Branch (779:9): [True: 116, False: 0]
  ------------------
  780|    116|        return res;
  781|    116|    }
  782|       |    /*  Now we know the  Dwarf_Section_s section
  783|       |        we need to relocate.
  784|       |        So lets find the rela section(s) targeting this.
  785|       |    */
  786|       |
  787|       |    /*  Sun and possibly others do not always set
  788|       |        sh_link in .debug_* sections.
  789|       |        So we cannot do full  consistency checks.
  790|       |        FIXME: This approach assumes there is only one
  791|       |        relocation section applying to section section_index! */
  792|      0|    section_with_reloc_records = relocatablesec->dss_reloc_index;
  793|      0|    if (!section_with_reloc_records) {
  ------------------
  |  Branch (793:9): [True: 0, False: 0]
  ------------------
  794|       |        /* Something is wrong. */
  795|      0|        *errorc = DW_DLE_RELOC_SECTION_MISSING_INDEX;
  ------------------
  |  | 1260|      0|#define DW_DLE_RELOC_SECTION_MISSING_INDEX     215
  ------------------
  796|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  797|      0|    }
  798|       |    /* The relocations, if they exist, have been loaded. */
  799|       |    /* The symtab was already loaded. */
  800|      0|    if (!obj->f_symtab || !obj->f_symtab_sect_strings) {
  ------------------
  |  Branch (800:9): [True: 0, False: 0]
  |  Branch (800:27): [True: 0, False: 0]
  ------------------
  801|      0|        *errorc = DW_DLE_DEBUG_SYMTAB_ERR;
  ------------------
  |  | 1254|      0|#define DW_DLE_DEBUG_SYMTAB_ERR                209
  ------------------
  802|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  803|      0|    }
  804|      0|    if (obj->f_symtab_sect_index != relocatablesec->dss_reloc_link) {
  ------------------
  |  Branch (804:9): [True: 0, False: 0]
  ------------------
  805|       |        /* Something is wrong. */
  806|      0|        *errorc = DW_DLE_RELOC_MISMATCH_RELOC_INDEX;
  ------------------
  |  | 1257|      0|#define DW_DLE_RELOC_MISMATCH_RELOC_INDEX      212
  ------------------
  807|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  808|      0|    }
  809|       |    /* We have all the data we need in memory. */
  810|       |    /*  Now we apply the relocs in section_with_reloc_records to the
  811|       |        target, relocablesec */
  812|      0|    res = apply_rela_entries(dbg,
  813|      0|        section_with_reloc_records,
  814|      0|        obj, relocatablesec,errorc);
  815|      0|    return res;
  816|      0|}
dwarf_elfread.c:find_section_to_relocate:
  560|    116|{
  561|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_info,relocatablesec);
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  562|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_abbrev,relocatablesec);
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  563|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_line,relocatablesec);
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  564|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_loc,relocatablesec);
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  565|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_aranges,relocatablesec);
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  566|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_macinfo,relocatablesec);
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  567|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_pubnames,
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  568|    116|        relocatablesec);
  569|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_names,
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  570|    116|        relocatablesec);
  571|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_ranges,relocatablesec);
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  572|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_frame,
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  573|    116|        relocatablesec);
  574|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_frame_eh_gnu,
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  575|    116|        relocatablesec);
  576|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_pubtypes,
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  577|    116|        relocatablesec);
  578|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_funcnames,
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  579|    116|        relocatablesec);
  580|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_typenames,
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  581|    116|        relocatablesec);
  582|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_varnames,
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  583|    116|        relocatablesec);
  584|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_weaknames,
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  585|    116|        relocatablesec);
  586|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_types,relocatablesec);
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  587|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_macro,relocatablesec);
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  588|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_rnglists,
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  589|    116|        relocatablesec);
  590|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_loclists,
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  591|    116|        relocatablesec);
  592|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_aranges,
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  593|    116|        relocatablesec);
  594|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_sup,
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  595|    116|        relocatablesec);
  596|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_str_offsets,
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  597|    116|        relocatablesec);
  598|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_addr,relocatablesec);
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  599|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_gnu_pubnames,
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  600|    116|        relocatablesec);
  601|    116|    MATCH_REL_SEC(section_index,dbg->de_debug_gnu_pubtypes,
  ------------------
  |  |  551|    116|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    116|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 116]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  602|    116|        relocatablesec);
  603|       |    /* dbg-> de_debug_tu_index,reloctablesec); */
  604|       |    /* dbg-> de_debug_cu_index,reloctablesec); */
  605|       |    /* dbg-> de_debug_gdbindex,reloctablesec); */
  606|       |    /* dbg-> de_debug_str,syms); */
  607|       |    /* de_elf_symtab,syms); */
  608|       |    /* de_elf_strtab,syms); */
  609|    116|    *errorc = DW_DLE_RELOC_SECTION_MISMATCH;
  ------------------
  |  | 1259|    116|#define DW_DLE_RELOC_SECTION_MISMATCH          214
  ------------------
  610|    116|    return DW_DLV_ERROR;
  ------------------
  |  |   60|    116|#define DW_DLV_ERROR      1
  ------------------
  611|    116|}
dwarf_elfread.c:elf_load_nolibelf_section_a:
  453|  2.11k|{
  454|  2.11k|    int res  = 0;
  455|  2.11k|    enum Dwarf_Sec_Alloc_Pref alloc_type_in = *dw_alloc_type;
  456|  2.11k|    struct generic_shdr *sp = 0;
  457|  2.11k|    int decompressme = FALSE;
  ------------------
  |  |   36|  2.11k|#define FALSE 0
  ------------------
  458|       |
  459|  2.11k|    res = elf_load_find_sec_ptr(obj,dw_section_index,&sp,
  460|  2.11k|        &decompressme,errc);
  461|  2.11k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.11k|#define DW_DLV_OK         0
  ------------------
  |  Branch (461:9): [True: 3, False: 2.11k]
  ------------------
  462|      3|        return res;
  463|      3|    }
  464|  2.11k|    if (alloc_type_in == Dwarf_Alloc_Malloc ||
  ------------------
  |  Branch (464:9): [True: 2.11k, False: 0]
  ------------------
  465|  2.11k|        TRUE == decompressme) {
  ------------------
  |  |   33|      0|#define TRUE 1
  ------------------
  |  Branch (465:9): [True: 0, False: 0]
  ------------------
  466|       |        /*  Does NOT alter *return_data_len
  467|       |            unless is symtab/symstr sec compressed*/
  468|  2.11k|        res = elf_load_nolibelf_section(obj,dw_section_index,
  469|  2.11k|            return_data_ptr,errc);
  470|  2.11k|        *return_mmap_base_ptr = 0;
  471|  2.11k|        *return_mmap_offset = 0;
  472|  2.11k|        *return_mmap_len = 0;
  473|  2.11k|        *dw_alloc_type = Dwarf_Alloc_Malloc;
  474|       |        /* *return_data_len =  not set */
  475|  2.11k|        return res;
  476|  2.11k|    }
  477|      0|    if (alloc_type_in == Dwarf_Alloc_Mmap) {
  ------------------
  |  Branch (477:9): [True: 0, False: 0]
  ------------------
  478|      0|        Dwarf_Unsigned baseoff = 0; /* for Macos might be non-zero
  479|       |            but not in Elf */
  480|      0|        Dwarf_Small   *realarea = (void*)-1;
  481|      0|        Dwarf_Unsigned computed_mmaplen = 0;
  482|      0|        Dwarf_Unsigned pageoff = 0;
  483|      0|        dwarf_elf_object_access_internals_t *elf =
  484|      0|            (dwarf_elf_object_access_internals_t*)(obj);
  485|      0|        void *         mmptr = 0;
  486|       |
  487|      0|        Dwarf_Unsigned seclen = 0;
  488|      0|        Dwarf_Unsigned secoffset = 0;
  489|      0|        int localerrc = 0;
  490|      0|        Dwarf_Unsigned pagesizebits = 0;
  491|       |
  492|      0|        seclen = sp->gh_size;
  493|      0|        secoffset = sp->gh_offset;
  494|      0|        res = _dwarf_mmap_calc(baseoff,secoffset,
  495|      0|            seclen,elf->f_filesize,
  496|      0|            &pageoff,&computed_mmaplen,
  497|      0|            &pagesizebits,&localerrc);
  498|      0|        if (res == DW_DLV_ERROR ) {
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (498:13): [True: 0, False: 0]
  ------------------
  499|       |            /* Does NOT alter *return_data_len */
  500|      0|            res = elf_load_nolibelf_section(obj,
  501|      0|                dw_section_index,
  502|      0|                return_data_ptr,errc);
  503|      0|            *return_mmap_base_ptr = 0;
  504|      0|            *return_mmap_offset = 0;
  505|      0|            *return_mmap_len = 0;
  506|      0|            *dw_alloc_type = Dwarf_Alloc_Malloc;
  507|       |            /* *return_data_len =  not set */
  508|      0|            return res;
  509|      0|        }
  510|       |
  511|       |        /*  Coverity Scan CID 531843. Possible overflow
  512|       |            computing computed_mmaplen.  This is
  513|       |            a false positive,  Marked as such
  514|       |            in Coverity scan 16 July 2025. */
  515|      0|        mmptr = mmap(0, (size_t)computed_mmaplen,
  516|      0|            PROT_READ|PROT_WRITE, MAP_PRIVATE,
  517|      0|            elf->f_fd,(off_t)pageoff);
  518|      0|        if (mmptr == (void *)-1) {
  ------------------
  |  Branch (518:13): [True: 0, False: 0]
  ------------------
  519|       |            /* Does NOT alter *return_data_len
  520|       |                unless is symtab/symstr sec compressed*/
  521|      0|            res = elf_load_nolibelf_section(obj,
  522|      0|                dw_section_index,
  523|      0|                return_data_ptr,errc);
  524|      0|            *return_mmap_base_ptr = 0;
  525|      0|            *return_mmap_offset = 0;
  526|      0|            *return_mmap_len = 0;
  527|      0|            *dw_alloc_type = Dwarf_Alloc_Malloc;
  528|       |            /* *return_data_len =  not set */
  529|      0|            return res;
  530|      0|        }
  531|      0|        sp->gh_load_type = Dwarf_Alloc_Mmap;
  532|      0|        realarea = (Dwarf_Small*)mmptr;
  533|      0|        sp->gh_mmap_realarea = (char*)realarea;
  534|      0|        sp->gh_computed_mmaplen = computed_mmaplen;
  535|      0|        sp->gh_content   = (char *)realarea +
  536|      0|            (secoffset&pagesizebits);
  537|      0|        sp->gh_was_alloc = TRUE;
  ------------------
  |  |   33|      0|#define TRUE 1
  ------------------
  538|      0|        *return_data_ptr = (Dwarf_Small *)sp->gh_content;
  539|      0|        *dw_alloc_type =  sp->gh_load_type;
  540|      0|        *return_data_len = seclen;
  541|      0|        *return_mmap_base_ptr = realarea;
  542|      0|        *return_mmap_offset = pageoff;
  543|      0|        *return_mmap_len = computed_mmaplen;
  544|      0|        return DW_DLV_OK;
  ------------------
  |  |   59|      0|#define DW_DLV_OK         0
  ------------------
  545|      0|    }
  546|      0|    *errc = DW_DLE_ELF_SECTION_ERROR;
  ------------------
  |  | 1492|      0|#define DW_DLE_ELF_SECTION_ERROR               446
  ------------------
  547|      0|    return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  548|      0|}

_dwarf_error:
  111|  5.55k|{
  112|  5.55k|    _dwarf_error_string(dbg,error,errval,0);
  113|  5.55k|}
_dwarf_error_string:
  120|  20.2k|{
  121|  20.2k|    Dwarf_Error errptr = 0;
  122|       |
  123|       |    /*  Allow NULL dbg on entry, since sometimes that
  124|       |        can happen and we want to report the upper-level
  125|       |        error, not the null dbg error. */
  126|  20.2k|    if (error) {
  ------------------
  |  Branch (126:9): [True: 0, False: 20.2k]
  ------------------
  127|       |        /*  If dbg is NULL, use the alternate error struct. However,
  128|       |            this will overwrite the earlier error. */
  129|      0|        if (dbg) {
  ------------------
  |  Branch (129:13): [True: 0, False: 0]
  ------------------
  130|       |            /*  ERRORs are always associated with
  131|       |                de_primary_dbg so they can be returned
  132|       |                up the tree of calls on the stack
  133|       |                safely.  */
  134|      0|            errptr =
  135|      0|                (Dwarf_Error) _dwarf_get_alloc(dbg->de_errors_dbg,
  136|      0|                    DW_DLA_ERROR, 1);
  ------------------
  |  |  995|      0|#define DW_DLA_ERROR           0x0e  /* Dwarf_Error */
  ------------------
  137|      0|            if (!errptr) {
  ------------------
  |  Branch (137:17): [True: 0, False: 0]
  ------------------
  138|      0|                errptr = &_dwarf_failsafe_error;
  139|      0|                errptr->er_static_alloc = DE_STATIC;
  ------------------
  |  |   46|      0|#define DE_STATIC 1   /* Using global static var */
  ------------------
  140|      0|            } else {
  141|      0|                errptr->er_static_alloc = DE_STANDARD;
  ------------------
  |  |   45|      0|#define DE_STANDARD 0 /* Normal alloc attached to dbg. */
  ------------------
  142|      0|            }
  143|      0|        } else {
  144|       |            /*  We have no dbg to work with. dwarf_init
  145|       |                failed. We hack
  146|       |                up a special area. */
  147|      0|            errptr = _dwarf_special_no_dbg_error_malloc();
  148|      0|            if (!errptr) {
  ------------------
  |  Branch (148:17): [True: 0, False: 0]
  ------------------
  149|      0|                errptr = &_dwarf_failsafe_error;
  150|      0|                errptr->er_static_alloc = DE_STATIC;
  ------------------
  |  |   46|      0|#define DE_STATIC 1   /* Using global static var */
  ------------------
  151|       |#ifdef DEBUG
  152|       |                printf("libdwarf no dbg to dwarf_error_string,"
  153|       |                    " fullystatic, "
  154|       |                    "using DE_STATIC alloc, addr"
  155|       |                    " 0x%lx line %d %s\n",
  156|       |                    (unsigned long)errptr,
  157|       |                    __LINE__,__FILE__);
  158|       |#endif /* DEBUG */
  159|      0|            } else {
  160|      0|                errptr->er_static_alloc = DE_MALLOC;
  ------------------
  |  |   47|      0|#define DE_MALLOC 2   /* Using malloc space */
  ------------------
  161|       |
  162|       |#ifdef DEBUG
  163|       |                printf("libdwarf no dbg, add to static_err_list "
  164|       |                    "static DE_MALLOC alloc, addr"
  165|       |                    " 0x%lx line %d %s\n",
  166|       |                    (unsigned long)errptr,
  167|       |                    __LINE__,__FILE__);
  168|       |#endif /* DEBUG */
  169|      0|                _dwarf_add_to_static_err_list(errptr);
  170|      0|            }
  171|      0|        }
  172|       |
  173|      0|        errptr->er_errval = errval;
  174|      0|        if (msg && errptr->er_static_alloc != DE_STATIC) {
  ------------------
  |  |   46|      0|#define DE_STATIC 1   /* Using global static var */
  ------------------
  |  Branch (174:13): [True: 0, False: 0]
  |  Branch (174:20): [True: 0, False: 0]
  ------------------
  175|      0|            dwarfstring *em = 0;
  176|       |
  177|       |#ifdef DEBUG
  178|       |            printf("libdwarf ALLOC creating error string"
  179|       |                " %s errval %ld errptr 0x%lx \n",
  180|       |                msg,(long)errval,(unsigned long)errptr);
  181|       |#endif /* DEBUG */
  182|      0|            em = (dwarfstring *)calloc(1,sizeof(dwarfstring));
  183|      0|            if (em) {
  ------------------
  |  Branch (183:17): [True: 0, False: 0]
  ------------------
  184|      0|                dwarfstring_constructor(em);
  185|      0|                dwarfstring_append(em,msg);
  186|      0|                errptr->er_msg = (void*)em;
  187|      0|            }
  188|      0|        }
  189|      0|        *error = errptr;
  190|      0|        return;
  191|      0|    }
  192|       |
  193|  20.2k|    if (dbg  && dbg->de_errhand != NULL) {
  ------------------
  |  Branch (193:9): [True: 1.48k, False: 18.8k]
  |  Branch (193:17): [True: 0, False: 1.48k]
  ------------------
  194|      0|        errptr = (Dwarf_Error) _dwarf_get_alloc(dbg->de_errors_dbg,
  195|      0|            DW_DLA_ERROR, 1);
  ------------------
  |  |  995|      0|#define DW_DLA_ERROR           0x0e  /* Dwarf_Error */
  ------------------
  196|      0|        if (errptr == NULL) {
  ------------------
  |  Branch (196:13): [True: 0, False: 0]
  ------------------
  197|      0|            errptr = &_dwarf_failsafe_error;
  198|      0|            errptr->er_static_alloc = DE_STATIC;
  ------------------
  |  |   46|      0|#define DE_STATIC 1   /* Using global static var */
  ------------------
  199|      0|        }
  200|      0|        errptr->er_errval = errval;
  201|      0|        dbg->de_errhand(errptr, dbg->de_errors_dbg->de_errarg);
  202|      0|        return;
  203|      0|    }
  204|  20.2k|    fflush(stderr);
  205|  20.2k|    fprintf(stderr,
  206|  20.2k|        "\nlibdwarf is unable to record error %s "
  207|  20.2k|        "No error argument or handler available\n",
  208|  20.2k|        dwarf_errmsg_by_number(errval));
  209|       |    fflush(stderr);
  210|  20.2k|    return;
  211|  20.2k|}
dwarf_errmsg_by_number:
  224|  20.2k|{
  225|  20.2k|    if (errornum > DW_DLE_LAST) {
  ------------------
  |  | 1566|  20.2k|#define DW_DLE_LAST        517
  ------------------
  |  Branch (225:9): [True: 0, False: 20.2k]
  ------------------
  226|      0|        return "Dwarf_Error value out of range";
  227|      0|    }
  228|  20.2k|    return ((char *) &_dwarf_errmsgs[errornum][0]);
  229|  20.2k|}

dwarf_init_b:
  453|  8.26k|{
  454|  8.26k|    unsigned ftype = 0;
  455|  8.26k|    unsigned endian = 0;
  456|  8.26k|    unsigned offsetsize = 0;
  457|  8.26k|    unsigned universalnumber = 0;
  458|  8.26k|    Dwarf_Unsigned   filesize = 0;
  459|  8.26k|    int res = 0;
  460|  8.26k|    int errcode = 0;
  461|       |
  462|  8.26k|    if (!ret_dbg) {
  ------------------
  |  Branch (462:9): [True: 0, False: 8.26k]
  ------------------
  463|      0|        DWARF_DBG_ERROR(NULL,DW_DLE_DWARF_INIT_DBG_NULL,DW_DLV_ERROR);
  ------------------
  |  |   43|      0|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
  464|      0|    }
  465|       |    /*  Non-null *ret_dbg will cause problems dealing with
  466|       |        DW_DLV_ERROR */
  467|  8.26k|    *ret_dbg = 0;
  468|       |
  469|  8.26k|    res = _dwarf_object_detector_fd_a(fd,
  470|  8.26k|        &ftype,
  471|  8.26k|        &endian,&offsetsize,0,
  472|  8.26k|        &filesize,&errcode);
  473|  8.26k|    if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|  8.26k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (473:9): [True: 433, False: 7.83k]
  ------------------
  474|    433|        return res;
  475|    433|    }
  476|  7.83k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|  7.83k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (476:9): [True: 21, False: 7.80k]
  ------------------
  477|       |        /* This macro does a return. */
  478|     21|        DWARF_DBG_ERROR(NULL, DW_DLE_FILE_WRONG_TYPE, DW_DLV_ERROR);
  ------------------
  |  |   43|     21|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
  479|      0|    }
  480|  7.80k|    switch(ftype) {
  481|  4.57k|    case DW_FTYPE_ELF: {
  ------------------
  |  |  114|  4.57k|#define DW_FTYPE_ELF        1  /* Unix/Linux/etc */
  ------------------
  |  Branch (481:5): [True: 4.57k, False: 3.23k]
  ------------------
  482|  4.57k|        int res2 = 0;
  483|       |
  484|  4.57k|        res2 = _dwarf_elf_nlsetup(fd,"",
  485|  4.57k|            ftype,endian,offsetsize,filesize,
  486|  4.57k|            group_number,errhand,errarg,ret_dbg,error);
  487|  4.57k|        if (res2 != DW_DLV_OK) {
  ------------------
  |  |  122|  4.57k|#define DW_DLV_OK        0
  ------------------
  |  Branch (487:13): [True: 3.89k, False: 677]
  ------------------
  488|  3.89k|            return res2;
  489|  3.89k|        }
  490|    677|        set_global_paths_init(*ret_dbg,error);
  491|    677|        return res2;
  492|  4.57k|        }
  493|    530|    case DW_FTYPE_APPLEUNIVERSAL:
  ------------------
  |  |  118|    530|#define DW_FTYPE_APPLEUNIVERSAL    5
  ------------------
  |  Branch (493:5): [True: 530, False: 7.27k]
  ------------------
  494|  2.54k|    case DW_FTYPE_MACH_O: {
  ------------------
  |  |  115|  2.54k|#define DW_FTYPE_MACH_O     2  /* Macos. */
  ------------------
  |  Branch (494:5): [True: 2.01k, False: 5.79k]
  ------------------
  495|  2.54k|        int resm = 0;
  496|       |
  497|  2.54k|        resm = _dwarf_macho_setup(fd,"",
  498|  2.54k|            universalnumber,
  499|  2.54k|            ftype,endian,offsetsize,filesize,
  500|  2.54k|            group_number,errhand,errarg,ret_dbg,error);
  501|  2.54k|        if (resm != DW_DLV_OK) {
  ------------------
  |  |  122|  2.54k|#define DW_DLV_OK        0
  ------------------
  |  Branch (501:13): [True: 2.33k, False: 208]
  ------------------
  502|  2.33k|            return resm;
  503|  2.33k|        }
  504|    208|        set_global_paths_init(*ret_dbg,error);
  505|    208|        return resm;
  506|  2.54k|        }
  507|       |
  508|    688|    case DW_FTYPE_PE: {
  ------------------
  |  |  116|    688|#define DW_FTYPE_PE         3  /* Windows */
  ------------------
  |  Branch (508:5): [True: 688, False: 7.12k]
  ------------------
  509|    688|        int resp = 0;
  510|       |
  511|    688|        resp = _dwarf_pe_setup(fd,
  512|    688|            "",
  513|    688|            ftype,endian,offsetsize,filesize,
  514|    688|            group_number,errhand,errarg,ret_dbg,error);
  515|    688|        if (resp != DW_DLV_OK) {
  ------------------
  |  |  122|    688|#define DW_DLV_OK        0
  ------------------
  |  Branch (515:13): [True: 498, False: 190]
  ------------------
  516|    498|            return resp;
  517|    498|        }
  518|    190|        set_global_paths_init(*ret_dbg,error);
  519|    190|        return resp;
  520|    688|        }
  521|      1|    default: break;
  ------------------
  |  Branch (521:5): [True: 1, False: 7.80k]
  ------------------
  522|  7.80k|    }
  523|  7.80k|    DWARF_DBG_ERROR(NULL, DW_DLE_FILE_WRONG_TYPE, DW_DLV_ERROR);
  ------------------
  |  |   43|      1|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
  524|       |    /* Macro above returns. cannot reach here. */
  525|      0|}
dwarf_finish:
  537|  8.26k|{
  538|       |#ifdef LIBDWARF_MALLOC
  539|       |    _libdwarf_finish();
  540|       |#endif
  541|  8.26k|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|  8.26k|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|  1.07k|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   33|  7.18k|#define TRUE 1
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   36|  1.07k|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 7.18k, False: 1.07k]
  |  |  |  Branch (159:7): [True: 7.18k, False: 1.07k]
  |  |  |  Branch (159:15): [True: 0, False: 1.07k]
  |  |  ------------------
  ------------------
  542|  7.18k|        _dwarf_free_static_errlist();
  543|  7.18k|        return DW_DLV_OK;
  ------------------
  |  |  122|  7.18k|#define DW_DLV_OK        0
  ------------------
  544|  7.18k|    }
  545|  1.07k|    if (dbg->de_obj_file) {
  ------------------
  |  Branch (545:9): [True: 1.07k, False: 0]
  ------------------
  546|       |        /*  The initial character of a valid
  547|       |            dbg->de_obj_file->object struct is a letter:
  548|       |            E, F, M, or P, but E will not happen. */
  549|  1.07k|        char otype  = *(char *)(dbg->de_obj_file->ai_object);
  550|       |
  551|  1.07k|        switch(otype) {
  552|      0|        case 'E': /* libelf. Impossible for years now. */
  ------------------
  |  Branch (552:9): [True: 0, False: 1.07k]
  ------------------
  553|      0|            break;
  554|    677|        case 'F':
  ------------------
  |  Branch (554:9): [True: 677, False: 398]
  ------------------
  555|       |            /* Non-libelf elf access */
  556|    885|        case 'M':
  ------------------
  |  Branch (556:9): [True: 208, False: 867]
  ------------------
  557|  1.07k|        case 'P':
  ------------------
  |  Branch (557:9): [True: 190, False: 885]
  ------------------
  558|       |            /* These take care of data alloc/mmap
  559|       |                by object type. */
  560|  1.07k|            dbg->de_obj_file->ai_methods->om_finish(dbg->de_obj_file);
  561|  1.07k|        default:
  ------------------
  |  Branch (561:9): [True: 0, False: 1.07k]
  ------------------
  562|       |            /*  Do nothing. A serious internal error */
  563|  1.07k|            break;
  564|  1.07k|        }
  565|  1.07k|    }
  566|  1.07k|    if (dbg->de_owns_fd) {
  ------------------
  |  Branch (566:9): [True: 0, False: 1.07k]
  ------------------
  567|      0|        _dwarf_closer(dbg->de_fd);
  568|      0|        dbg->de_owns_fd = FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  569|      0|    }
  570|  1.07k|    free((void *)dbg->de_path);
  571|  1.07k|    dbg->de_path = 0;
  572|       |    /*  dwarf_object_finish() also frees de_path,
  573|       |        but that is safe because we set it to zero
  574|       |        here so no duplicate free will occur.
  575|       |        It never returns DW_DLV_ERROR.
  576|       |        Not all code uses libdwarf exactly as we do
  577|       |        hence the free() there.
  578|       |        This free/munmap as appropriate from the
  579|       |        DWARF data point of view independent of
  580|       |        object details. */
  581|  1.07k|    return dwarf_object_finish(dbg);
  582|  1.07k|}
dwarf_generic_init.c:set_global_paths_init:
  132|  1.07k|{
  133|  1.07k|    int res = 0;
  134|       |
  135|  1.07k|    res = dwarf_add_debuglink_global_path(dbg,
  136|  1.07k|        "/usr/lib/debug",error);
  137|  1.07k|    return res;
  138|  1.07k|}

_dwarf_insert_in_group_map:
  119|  98.9k|{
  120|  98.9k|    struct Dwarf_Group_Data_s *grp = &dbg->de_groupnumbers;
  121|       |
  122|  98.9k|    void *entry2 = 0;
  123|  98.9k|    struct Dwarf_Group_Map_Entry_s * entry3 = 0;
  124|       |
  125|  98.9k|    if (!grp->gd_map) {
  ------------------
  |  Branch (125:9): [True: 2.18k, False: 96.7k]
  ------------------
  126|       |        /*  Number of sections is a kind of decent guess
  127|       |            as to how much space would be useful. */
  128|  2.18k|        dwarf_initialize_search_hash(&grp->gd_map,
  ------------------
  |  |   82|  2.18k|#define dwarf_initialize_search_hash _dwarf_initialize_search_hash
  ------------------
  129|  2.18k|            grp_data_hashfunc,grp->gd_number_of_sections);
  130|  2.18k|        if (!grp->gd_map) {
  ------------------
  |  Branch (130:13): [True: 0, False: 2.18k]
  ------------------
  131|       |            /*  It's really an error I suppose. */
  132|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
  133|      0|        }
  134|  2.18k|    }
  135|  98.9k|    entry3 = grp_make_entry(section_index,groupnum,name);
  136|  98.9k|    if (!entry3) {
  ------------------
  |  Branch (136:9): [True: 0, False: 98.9k]
  ------------------
  137|      0|        _dwarf_error(dbg, error, DW_DLE_GROUP_MAP_ALLOC);
  ------------------
  |  | 1433|      0|#define DW_DLE_GROUP_MAP_ALLOC                 387
  ------------------
  138|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  139|      0|    }
  140|  98.9k|    entry2 = dwarf_tsearch(entry3,&grp->gd_map,grp_compare_function);
  ------------------
  |  |   76|  98.9k|#define dwarf_tsearch  _dwarf_tsearch
  ------------------
  141|  98.9k|    if (!entry2) {
  ------------------
  |  Branch (141:9): [True: 0, False: 98.9k]
  ------------------
  142|      0|        free(entry3);
  143|      0|        _dwarf_error(dbg, error, DW_DLE_GROUP_MAP_ALLOC);
  ------------------
  |  | 1433|      0|#define DW_DLE_GROUP_MAP_ALLOC                 387
  ------------------
  144|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  145|  98.9k|    } else {
  146|  98.9k|        struct Dwarf_Group_Map_Entry_s *re = 0;
  147|  98.9k|        re = *(struct Dwarf_Group_Map_Entry_s **)entry2;
  148|  98.9k|        if (re != entry3) {
  ------------------
  |  Branch (148:13): [True: 9, False: 98.9k]
  ------------------
  149|      9|            free(entry3);
  150|      9|            _dwarf_error(dbg, error, DW_DLE_GROUP_MAP_DUPLICATE);
  ------------------
  |  | 1434|      9|#define DW_DLE_GROUP_MAP_DUPLICATE             388
  ------------------
  151|      9|            return DW_DLV_ERROR;
  ------------------
  |  |  123|      9|#define DW_DLV_ERROR     1
  ------------------
  152|  98.9k|        } else {
  153|  98.9k|            ++grp->gd_map_entry_count;
  154|       |            /* OK. Added. Fall thru */
  155|  98.9k|        }
  156|  98.9k|    }
  157|  98.9k|    return DW_DLV_OK;
  ------------------
  |  |  122|  98.9k|#define DW_DLV_OK        0
  ------------------
  158|  98.9k|}
_dwarf_section_get_target_group_from_map:
  165|   331k|{
  166|   331k|    struct Dwarf_Group_Map_Entry_s entry;
  167|   331k|    struct Dwarf_Group_Map_Entry_s *entry2;
  168|   331k|    struct Dwarf_Group_Data_s *grp = &dbg->de_groupnumbers;
  169|       |
  170|   331k|    (void)error;
  171|   331k|    if (!grp->gd_map) {
  ------------------
  |  Branch (171:9): [True: 29.5k, False: 301k]
  ------------------
  172|  29.5k|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|  29.5k|#define DW_DLV_NO_ENTRY -1
  ------------------
  173|  29.5k|    }
  174|   301k|    entry.gm_key = obj_section_index;
  175|   301k|    entry.gm_group_number = 0; /* FAKE */
  176|   301k|    entry.gm_section_name = ""; /* FAKE */
  177|       |
  178|   301k|    entry2 = dwarf_tfind(&entry, &grp->gd_map,grp_compare_function);
  ------------------
  |  |   77|   301k|#define dwarf_tfind    _dwarf_tfind
  ------------------
  179|   301k|    if (entry2) {
  ------------------
  |  Branch (179:9): [True: 88.4k, False: 213k]
  ------------------
  180|  88.4k|        struct Dwarf_Group_Map_Entry_s *e2 =
  181|  88.4k|            *(struct Dwarf_Group_Map_Entry_s **)entry2;;
  182|  88.4k|        *groupnumber_out = e2->gm_group_number;
  183|  88.4k|        return DW_DLV_OK;
  ------------------
  |  |  122|  88.4k|#define DW_DLV_OK        0
  ------------------
  184|  88.4k|    }
  185|   213k|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|   213k|#define DW_DLV_NO_ENTRY -1
  ------------------
  186|   301k|}
_dwarf_dwo_groupnumber_given_name:
  337|   242k|{
  338|   242k|    const char **s = 0;
  339|       |
  340|  2.95M|    for (s = dwo_secnames; *s; s++) {
  ------------------
  |  Branch (340:28): [True: 2.73M, False: 222k]
  ------------------
  341|  2.73M|        if (!strcmp(name,*s)) {
  ------------------
  |  Branch (341:13): [True: 19.8k, False: 2.71M]
  ------------------
  342|  19.8k|            *grpnum_out = DW_GROUPNUMBER_DWO;
  ------------------
  |  |  128|  19.8k|#define DW_GROUPNUMBER_DWO  2
  ------------------
  343|  19.8k|            return DW_DLV_OK;
  ------------------
  |  |  122|  19.8k|#define DW_DLV_OK        0
  ------------------
  344|  19.8k|        }
  345|  2.73M|    }
  346|   222k|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|   222k|#define DW_DLV_NO_ENTRY -1
  ------------------
  347|   242k|}
_dwarf_section_in_group_by_name:
  377|    253|{
  378|    253|    struct Dwarf_Group_Data_s *grp = 0;
  379|       |
  380|    253|    grp = &dbg->de_groupnumbers;
  381|    253|    found_name_in_group = FALSE;
  ------------------
  |  |   36|    253|#define FALSE 0
  ------------------
  382|    253|    target_group = groupnum;
  383|    253|    lookfor_name = scn_name;
  384|    253|    dwarf_twalk(grp->gd_map,grp_walk_for_name);
  ------------------
  |  |   79|    253|#define dwarf_twalk    _dwarf_twalk
  ------------------
  385|    253|    return found_name_in_group;
  386|    253|}
_dwarf_destroy_group_map:
  398|  3.37k|{
  399|  3.37k|    dwarf_tdestroy(dbg->de_groupnumbers.gd_map,
  ------------------
  |  |   80|  3.37k|#define dwarf_tdestroy _dwarf_tdestroy
  ------------------
  400|  3.37k|        _dwarf_grp_destroy_free_node);
  401|  3.37k|    dbg->de_groupnumbers.gd_map = 0;
  402|  3.37k|}
dwarf_groups.c:grp_data_hashfunc:
   88|   471k|{
   89|   471k|    const struct Dwarf_Group_Map_Entry_s * enp = keyp;
   90|   471k|    DW_TSHASHTYPE hashv = 0;
  ------------------
  |  |   54|   471k|#define DW_TSHASHTYPE uintptr_t
  ------------------
   91|       |
   92|   471k|    hashv = enp->gm_key;
   93|   471k|    return hashv;
   94|   471k|}
dwarf_groups.c:grp_make_entry:
   75|  98.9k|{
   76|  98.9k|    struct Dwarf_Group_Map_Entry_s *e = 0;
   77|  98.9k|    e = calloc(1,sizeof(struct Dwarf_Group_Map_Entry_s));
   78|  98.9k|    if (e) {
  ------------------
  |  Branch (78:9): [True: 98.9k, False: 0]
  ------------------
   79|  98.9k|        e->gm_key =    section;
   80|  98.9k|        e->gm_group_number = group;
   81|  98.9k|        e->gm_section_name = name;
   82|  98.9k|    }
   83|  98.9k|    return e;
   84|  98.9k|}
dwarf_groups.c:grp_compare_function:
   98|  88.4k|{
   99|  88.4k|    const struct Dwarf_Group_Map_Entry_s * lp = l;
  100|  88.4k|    const struct Dwarf_Group_Map_Entry_s * rp = r;
  101|       |
  102|  88.4k|    if (lp->gm_key < rp->gm_key) {
  ------------------
  |  Branch (102:9): [True: 0, False: 88.4k]
  ------------------
  103|      0|        return -1;
  104|      0|    }
  105|  88.4k|    if (lp->gm_key > rp->gm_key) {
  ------------------
  |  Branch (105:9): [True: 0, False: 88.4k]
  ------------------
  106|      0|        return 1;
  107|      0|    }
  108|       |
  109|       |    /* match. */
  110|  88.4k|    return 0;
  111|  88.4k|}
dwarf_groups.c:grp_walk_for_name:
  357|    301|{
  358|    301|    struct Dwarf_Group_Map_Entry_s *re = 0;
  359|       |
  360|    301|    (void)depth;
  361|    301|    re = *(struct Dwarf_Group_Map_Entry_s **)nodep;
  362|    301|    if (which == dwarf_postorder || which == dwarf_endorder) {
  ------------------
  |  Branch (362:9): [True: 0, False: 301]
  |  Branch (362:37): [True: 0, False: 301]
  ------------------
  363|      0|        return;
  364|      0|    }
  365|    301|    if (re->gm_group_number == target_group) {
  ------------------
  |  Branch (365:9): [True: 280, False: 21]
  ------------------
  366|    280|        if (!strcmp(lookfor_name,re->gm_section_name)) {
  ------------------
  |  Branch (366:13): [True: 66, False: 214]
  ------------------
  367|     66|            found_name_in_group = TRUE;
  ------------------
  |  |   33|     66|#define TRUE 1
  ------------------
  368|     66|        }
  369|    280|    }
  370|    301|}
dwarf_groups.c:_dwarf_grp_destroy_free_node:
  390|  98.9k|{
  391|  98.9k|    struct Dwarf_Group_Map_Entry_s * enp = nodep;
  392|  98.9k|    free(enp);
  393|  98.9k|    return;
  394|  98.9k|}

_dwarf_harmless_init:
  226|  1.07k|{
  227|  1.07k|    unsigned i = 0;
  228|  1.07k|    memset(dhp,0,sizeof(*dhp));
  229|  1.07k|    dhp->dh_maxcount = size +1;
  230|  1.07k|    dhp->dh_errors = (char **)calloc(dhp->dh_maxcount,
  231|  1.07k|        sizeof(char *));
  232|  1.07k|    if (!dhp->dh_errors) {
  ------------------
  |  Branch (232:9): [True: 0, False: 1.07k]
  ------------------
  233|      0|        dhp->dh_maxcount = 0;
  234|      0|        return;
  235|      0|    }
  236|  6.45k|    for (i = 0; i < dhp->dh_maxcount; ++i) {
  ------------------
  |  Branch (236:17): [True: 5.37k, False: 1.07k]
  ------------------
  237|  5.37k|        char *newstr =
  238|  5.37k|            (char *)calloc(1, DW_HARMLESS_ERROR_MSG_STRING_SIZE);
  ------------------
  |  |   76|  5.37k|#define DW_HARMLESS_ERROR_MSG_STRING_SIZE 300
  ------------------
  239|  5.37k|        dhp->dh_errors[i] = newstr;
  240|       |#if 0 /* Commentary about avoiding leak */
  241|       |        /*  BAD IDEA. just use the NULL pointer,
  242|       |            so we avoid problems later with
  243|       |            freeing.  */
  244|       |        if (!newstr) {
  245|       |            dhp->dh_maxcount = 0;
  246|       |            /* Let it leak, the leak is a constrained amount. */
  247|       |            free(dhp->dh_errors);
  248|       |            dhp->dh_errors = 0;
  249|       |            return;
  250|       |        }
  251|       |#endif /* 0 */
  252|  5.37k|        dhp->dh_errors[i] = newstr;
  253|  5.37k|    }
  254|  1.07k|}
_dwarf_harmless_cleanout:
  258|  4.45k|{
  259|  4.45k|    unsigned i = 0;
  260|  4.45k|    if (!dhp->dh_errors) {
  ------------------
  |  Branch (260:9): [True: 3.37k, False: 1.07k]
  ------------------
  261|  3.37k|        return;
  262|  3.37k|    }
  263|  6.45k|    for (i = 0; i < dhp->dh_maxcount; ++i) {
  ------------------
  |  Branch (263:17): [True: 5.37k, False: 1.07k]
  ------------------
  264|  5.37k|        free(dhp->dh_errors[i]);
  265|  5.37k|        dhp->dh_errors[i] = 0;
  266|  5.37k|    }
  267|  1.07k|    free(dhp->dh_errors);
  268|  1.07k|    dhp->dh_errors = 0;
  269|  1.07k|    dhp->dh_maxcount = 0;
  270|  1.07k|}

dwarf_object_init_b:
 1064|  3.37k|{
 1065|  3.37k|    Dwarf_Debug dbg = 0;
 1066|  3.37k|    int setup_result = DW_DLV_OK;
  ------------------
  |  |  122|  3.37k|#define DW_DLV_OK        0
  ------------------
 1067|  3.37k|    Dwarf_Unsigned filesize = 0;
 1068|       |
 1069|  3.37k|    if (!ret_dbg) {
  ------------------
  |  Branch (1069:9): [True: 0, False: 3.37k]
  ------------------
 1070|      0|        DWARF_DBG_ERROR(NULL,DW_DLE_DWARF_INIT_DBG_NULL,
  ------------------
  |  |   43|      0|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
 1071|      0|            DW_DLV_ERROR);
 1072|      0|    }
 1073|       |    /*  Non-null *ret_dbg will cause problems dealing with
 1074|       |        DW_DLV_ERROR */
 1075|  3.37k|    *ret_dbg = 0;
 1076|  3.37k|    filesize = obj->ai_methods->om_get_filesize(obj->ai_object);
 1077|       |    /*  Initializes  Dwarf_Debug struct and returns
 1078|       |        a pointer to that empty record.
 1079|       |        Filesize is to set up a sensible default hash tree
 1080|       |        size. */
 1081|  3.37k|    dbg = _dwarf_get_debug(filesize);
 1082|  3.37k|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|  3.37k|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|  3.37k|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   33|      0|#define TRUE 1
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   36|  3.37k|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 0, False: 3.37k]
  |  |  |  Branch (159:7): [True: 0, False: 3.37k]
  |  |  |  Branch (159:15): [True: 0, False: 3.37k]
  |  |  ------------------
  ------------------
 1083|      0|        dwarf_finish(dbg);
 1084|      0|        dbg = 0;
 1085|      0|        DWARF_DBG_ERROR(dbg, DW_DLE_DBG_ALLOC, DW_DLV_ERROR);
  ------------------
  |  |   43|      0|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
 1086|      0|    }
 1087|  3.37k|    dbg->de_errhand = errhand;
 1088|  3.37k|    dbg->de_errarg = errarg;
 1089|  3.37k|    dbg->de_frame_rule_initial_value = DW_FRAME_REG_INITIAL_VALUE;
  ------------------
  |  |  961|  3.37k|#define DW_FRAME_REG_INITIAL_VALUE DW_FRAME_SAME_VAL
  |  |  ------------------
  |  |  |  |  142|  3.37k|#define DW_FRAME_SAME_VAL               12289
  |  |  ------------------
  ------------------
 1090|  3.37k|    dbg->de_frame_reg_rules_entry_count = DW_FRAME_LAST_REG_NUM;
  ------------------
  |  | 1681|  3.37k|#define DW_FRAME_LAST_REG_NUM   (DW_FRAME_HIGHEST_NORMAL_REGISTER + 1)
  |  |  ------------------
  |  |  |  | 1676|  3.37k|#define DW_FRAME_HIGHEST_NORMAL_REGISTER 188
  |  |  ------------------
  ------------------
 1091|  3.37k|    dbg->de_frame_cfa_col_number = DW_FRAME_CFA_COL3;
  ------------------
  |  |  149|  3.37k|#define DW_FRAME_CFA_COL3 DW_FRAME_CFA_COL /*compatibility name*/
  |  |  ------------------
  |  |  |  |  147|  3.37k|#define DW_FRAME_CFA_COL                12290
  |  |  ------------------
  ------------------
 1092|  3.37k|    dbg->de_frame_same_value_number = DW_FRAME_SAME_VAL;
  ------------------
  |  |  142|  3.37k|#define DW_FRAME_SAME_VAL               12289
  ------------------
 1093|  3.37k|    dbg->de_frame_undefined_value_number  = DW_FRAME_UNDEFINED_VAL;
  ------------------
  |  |  137|  3.37k|#define DW_FRAME_UNDEFINED_VAL          12288
  ------------------
 1094|  3.37k|    dbg->de_dbg = dbg;
 1095|       |    /*  See  dwarf_set_tied_dbg()  dwarf_get_tied_dbg()
 1096|       |        and comments in dwarf_opaque.h*/
 1097|  3.37k|    dbg->de_primary_dbg = dbg;
 1098|  3.37k|    dbg->de_secondary_dbg = 0;
 1099|  3.37k|    dbg->de_errors_dbg = dbg;
 1100|       |
 1101|  3.37k|    dbg->de_obj_file = obj;
 1102|  3.37k|    dbg->de_filesize = filesize;
 1103|  3.37k|    dbg->de_groupnumber = groupnumber;
 1104|  3.37k|    setup_result = _dwarf_setup(dbg, error);
 1105|  3.37k|    if (setup_result == DW_DLV_OK) {
  ------------------
  |  |  122|  3.37k|#define DW_DLV_OK        0
  ------------------
  |  Branch (1105:9): [True: 1.60k, False: 1.76k]
  ------------------
 1106|  1.60k|        int fission_result = load_debugfission_tables(dbg,error);
 1107|       |        /*  In most cases we get
 1108|       |            setup_result == DW_DLV_NO_ENTRY here
 1109|       |            as having debugfission (.dwp objects)
 1110|       |            is fairly rare. */
 1111|  1.60k|        if (fission_result == DW_DLV_ERROR) {
  ------------------
  |  |  123|  1.60k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (1111:13): [True: 531, False: 1.07k]
  ------------------
 1112|       |            /*  Something is very wrong. */
 1113|    531|            setup_result = fission_result;
 1114|    531|        }
 1115|  1.60k|        if (setup_result == DW_DLV_OK) {
  ------------------
  |  |  122|  1.60k|#define DW_DLV_OK        0
  ------------------
  |  Branch (1115:13): [True: 1.07k, False: 531]
  ------------------
 1116|       |            /*  Defaults OFF as of 25 Nov 2025. V2.2.1 */
 1117|  1.07k|            dbg->de_harmless_errors_on = 0;
 1118|  1.07k|            _dwarf_harmless_init(&dbg->de_harmless_errors,
 1119|  1.07k|                DW_HARMLESS_ERROR_CIRCULAR_LIST_DEFAULT_SIZE);
  ------------------
  |  | 8985|  1.07k|#define DW_HARMLESS_ERROR_CIRCULAR_LIST_DEFAULT_SIZE 4
  ------------------
 1120|  1.07k|            *ret_dbg = dbg;
 1121|       |            /*  This is the normal return. */
 1122|  1.07k|            return setup_result;
 1123|  1.07k|        }
 1124|  1.60k|    }
 1125|  2.30k|    if (setup_result == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|  2.30k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (1125:9): [True: 1.56k, False: 735]
  ------------------
 1126|  1.56k|        _dwarf_free_all_of_one_debug(dbg);
 1127|  1.56k|        dbg = 0;
 1128|       |        /*  ASSERT: _dwarf_free_all_of_one_debug() never returns
 1129|       |            DW_DLV_ERROR */
 1130|  1.56k|        return setup_result;
 1131|  1.56k|    }
 1132|       |    /*  An error of some sort. Report it as well as
 1133|       |        possible.
 1134|       |        ASSERT: setup_result == DW_DLV_ERROR
 1135|       |        here  */
 1136|    735|    {
 1137|    735|        Dwarf_Unsigned myerr = 0;
 1138|    735|        dwarfstring msg;
 1139|       |
 1140|    735|        dwarfstring_constructor(&msg);
 1141|       |        /* We cannot use any _dwarf_setup()
 1142|       |            error here as
 1143|       |            we are freeing dbg, making that error (setup
 1144|       |            as part of dbg) stale.
 1145|       |            Hence we have to make a new error without a dbg.
 1146|       |            But error might be NULL and the init call
 1147|       |            error-handler function might be set.
 1148|       |        */
 1149|    735|        if (error && *error) {
  ------------------
  |  Branch (1149:13): [True: 0, False: 735]
  |  Branch (1149:22): [True: 0, False: 0]
  ------------------
 1150|       |            /*  Preserve our _dwarf_setup error number, but
 1151|       |                this does not apply if error NULL. */
 1152|       |            /* *error safe */
 1153|      0|            myerr = dwarf_errno(*error);
 1154|       |            /* *error safe */
 1155|      0|            dwarfstring_append(&msg,dwarf_errmsg(*error));
 1156|       |            /*  deallocate the soon-stale error pointer. */
 1157|      0|            dwarf_dealloc_error(dbg,*error);
 1158|       |            /* *error safe */
 1159|      0|            *error = 0;
 1160|      0|        }
 1161|       |        /*  The status we want to return  here is of _dwarf_setup,
 1162|       |            not of the  _dwarf_free_all_of_one_debug(dbg) call.
 1163|       |            So use a local status variable for the free.  */
 1164|    735|        _dwarf_free_all_of_one_debug(dbg);
 1165|    735|        dbg = 0;
 1166|    735|        if (myerr) {
  ------------------
  |  Branch (1166:13): [True: 0, False: 735]
  ------------------
 1167|       |            /*  Use the _dwarf_setup error number.
 1168|       |                If error is NULL the following will issue
 1169|       |                a message on stderr, as without
 1170|       |                dbg there is no error-handler function.
 1171|       |                */
 1172|      0|            _dwarf_error_string(dbg,error,myerr,
 1173|      0|                dwarfstring_string(&msg));
 1174|      0|            dwarfstring_destructor(&msg);
 1175|      0|        } /* else return quietly, a serious error
 1176|       |            was already reported. */
 1177|    735|    }
 1178|    735|    return setup_result;
 1179|  2.30k|}
dwarf_object_finish:
 1190|  1.07k|{
 1191|  1.07k|    int res = 0;
 1192|       |    /* do not use CHECK_DBG */
 1193|  1.07k|    _dwarf_harmless_cleanout(&dbg->de_harmless_errors);
 1194|  1.07k|    res = _dwarf_free_all_of_one_debug(dbg);
 1195|       |    /*  see dwarf_error.h dwarf_error.c  Relevant
 1196|       |        to trying and failing to open/read corrupt
 1197|       |        object files.  */
 1198|  1.07k|    return res;
 1199|  1.07k|}
_dwarf_load_section:
 1472|  2.51k|{
 1473|  2.51k|    int res  = DW_DLV_ERROR;
  ------------------
  |  |  123|  2.51k|#define DW_DLV_ERROR     1
  ------------------
 1474|  2.51k|    struct Dwarf_Obj_Access_Interface_a_s *o = 0;
 1475|  2.51k|    int            errc = 0;
 1476|  2.51k|    Dwarf_Unsigned data_len = 0;
 1477|  2.51k|    Dwarf_Small   *mmap_real_area = 0;
 1478|  2.51k|    Dwarf_Unsigned mmap_offset = 0;
 1479|  2.51k|    Dwarf_Unsigned mmap_len = 0;
 1480|  2.51k|    Dwarf_Small   *data_ptr = 0;
 1481|  2.51k|    enum Dwarf_Sec_Alloc_Pref pref =
 1482|  2.51k|        _dwarf_determine_section_allocation_type();
 1483|  2.51k|    enum Dwarf_Sec_Alloc_Pref finaltype = pref;
 1484|       |
 1485|       |    /* check to see if the section is already loaded */
 1486|  2.51k|    if (section->dss_data !=  NULL) {
  ------------------
  |  Branch (1486:9): [True: 0, False: 2.51k]
  ------------------
 1487|      0|        return DW_DLV_OK;
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
 1488|      0|    }
 1489|  2.51k|    o = dbg->de_obj_file;
 1490|       |    /*  There is an elf convention that section index 0
 1491|       |        is reserved, and that section is always empty.
 1492|       |        Non-elf object formats must honor
 1493|       |        that by ensuring that (when they
 1494|       |        assign numbers to 'sections' or
 1495|       |        'section-like-things') they never
 1496|       |        assign a real section section-number
 1497|       |        0 to dss_index.
 1498|       |
 1499|       |        There is also a convention for 'bss' that that section
 1500|       |        and its like sections have no data but do have a size.
 1501|       |        That is never true of DWARF sections  */
 1502|  2.51k|    data_len = section->dss_size;
 1503|  2.51k|#ifdef HAVE_FULL_MMAP
 1504|  2.51k|    if (o->ai_methods->om_load_section_a) {
  ------------------
  |  Branch (1504:9): [True: 2.11k, False: 401]
  ------------------
 1505|  2.11k|        res = o->ai_methods->om_load_section_a(o->ai_object,
 1506|  2.11k|            section->dss_index,
 1507|  2.11k|            &finaltype,
 1508|  2.11k|            &data_ptr, &data_len,
 1509|  2.11k|            &mmap_real_area,&mmap_offset,&mmap_len,
 1510|  2.11k|            &errc);
 1511|  2.11k|    } else
 1512|    401|#endif /* HAVE_FULL_MMAP */
 1513|    401|    {
 1514|    401|        if (o->ai_methods->om_load_section) {
  ------------------
  |  Branch (1514:13): [True: 401, False: 0]
  ------------------
 1515|    401|            res = o->ai_methods->om_load_section(o->ai_object,
 1516|    401|                section->dss_index,
 1517|    401|                &data_ptr,
 1518|    401|                &errc);
 1519|    401|            finaltype = Dwarf_Alloc_Malloc;
 1520|    401|        } else {
 1521|      0|            _dwarf_error_string(dbg, error,
 1522|      0|                DW_DLE_SECTION_ERROR,
  ------------------
  |  | 1293|      0|#define DW_DLE_SECTION_ERROR                   248
  ------------------
 1523|      0|                "DW_DLE_SECTION_ERROR: "
 1524|      0|                " struct Dwarf_Obj_Access_Interface_a_s "
 1525|      0|                "is missing an om_load_section function "
 1526|      0|                "pointer. Corrupt user setup.");
 1527|      0|            return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1528|      0|        }
 1529|    401|    }
 1530|  2.51k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|  2.51k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (1530:9): [True: 715, False: 1.79k]
  ------------------
 1531|    715|        DWARF_DBG_ERROR(dbg, errc, DW_DLV_ERROR);
  ------------------
  |  |   43|    715|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
 1532|      0|    }
 1533|       |#if 0 /* Not changing error, to disruptive of regression tests. */
 1534|       |Hold off on this, keep old error for the moment
 1535|       |    if (res == DW_DLV_ERROR) {
 1536|       |        _dwarf_error_string(dbg, error,
 1537|       |            errc," Error in attempting to load section into"
 1538|       |            " memory, possibly corrupt DWARF.");
 1539|       |        return res;
 1540|       |    }
 1541|       |#endif
 1542|  1.79k|    if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|  1.79k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (1542:9): [True: 3, False: 1.79k]
  ------------------
 1543|       |        /*  Gets this for section->dss_index 0.
 1544|       |            Which by ELF definition is a section index
 1545|       |            which is not used (reserved by Elf to
 1546|       |            mean no-section-index).
 1547|       |            Otherwise NULL dss_data gets error.
 1548|       |            BSS would legitimately have no data, but
 1549|       |            no DWARF related section could possibly be bss.
 1550|       |            We also get it if the section is present but
 1551|       |            zero-size. */
 1552|      3|        return res;
 1553|      3|    }
 1554|  1.79k|    section->dss_was_alloc = FALSE;
  ------------------
  |  |   36|  1.79k|#define FALSE 0
  ------------------
 1555|  1.79k|    section->dss_computed_mmap_offset = mmap_offset;
 1556|  1.79k|    section->dss_computed_mmap_len = mmap_len;
 1557|  1.79k|    section->dss_mmap_realarea = mmap_real_area;
 1558|  1.79k|    section->dss_size = data_len;
 1559|  1.79k|    section->dss_data = data_ptr;
 1560|  1.79k|    section->dss_load_preference = pref;
 1561|  1.79k|    section->dss_actual_load_type = finaltype;
 1562|       |
 1563|  1.79k|    if (section->dss_ignore_reloc_group_sec) {
  ------------------
  |  Branch (1563:9): [True: 1.08k, False: 715]
  ------------------
 1564|       |        /* Neither zdebug nor reloc apply to .group sections. */
 1565|  1.08k|        return res;
 1566|  1.08k|    }
 1567|       |    /*  We delay decompress of dwarfdump-important sections
 1568|       |        to here, not decompress in elf-specific reader. */
 1569|    715|    if ((section->dss_zdebug_requires_decompress ||
  ------------------
  |  Branch (1569:10): [True: 3, False: 712]
  ------------------
 1570|    712|        section->dss_shf_compressed ||
  ------------------
  |  Branch (1570:9): [True: 14, False: 698]
  ------------------
 1571|    698|        section->dss_ZLIB_compressed) &&
  ------------------
  |  Branch (1571:9): [True: 0, False: 698]
  ------------------
 1572|     17|        !section->dss_did_decompress) {
  ------------------
  |  Branch (1572:9): [True: 17, False: 0]
  ------------------
 1573|     17|        if (!section->dss_data) {
  ------------------
  |  Branch (1573:13): [True: 0, False: 17]
  ------------------
 1574|       |            /*  Impossible. This makes no sense.
 1575|       |                Corrupt object. */
 1576|      0|            DWARF_DBG_ERROR(dbg, DW_DLE_COMPRESSED_EMPTY_SECTION,
  ------------------
  |  |   43|      0|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
 1577|      0|                DW_DLV_ERROR);
 1578|      0|        }
 1579|       |#if defined(HAVE_ZLIB) && defined(HAVE_ZSTD)
 1580|       |        /*  This handles both malloc and mmap case.
 1581|       |            Possibly updating dss_was_malloc if required,
 1582|       |            and setting pref to Dwarf_Alloc_Malloc if
 1583|       |            required. */
 1584|       |        res = do_decompress(dbg,section,error);
 1585|       |        if (res != DW_DLV_OK) {
 1586|       |            return res;
 1587|       |        }
 1588|       |#else /* !defined(HAVE_ZLIB) && defined(HAVE_ZSTD) */
 1589|     17|        _dwarf_error_string(dbg, error,
 1590|     17|            DW_DLE_ZDEBUG_REQUIRES_ZLIB,
  ------------------
  |  | 1360|     17|#define DW_DLE_ZDEBUG_REQUIRES_ZLIB            314
  ------------------
 1591|     17|            "DW_DLE_ZDEBUG_REQUIRES_ZLIB: "
 1592|     17|            " zlib and zstd are missing, cannot"
 1593|     17|            " decompress section.");
 1594|     17|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     17|#define DW_DLV_ERROR     1
  ------------------
 1595|      0|#endif /* defined(HAVE_ZLIB) && defined(HAVE_ZSTD) */
 1596|      0|        section->dss_did_decompress = TRUE;
  ------------------
  |  |   33|      0|#define TRUE 1
  ------------------
 1597|      0|        section->dss_actual_load_type = Dwarf_Alloc_Malloc;
 1598|      0|        section->dss_was_alloc = TRUE;
  ------------------
  |  |   33|      0|#define TRUE 1
  ------------------
 1599|      0|    }
 1600|    698|    if (_dwarf_apply_relocs == 0) {
  ------------------
  |  Branch (1600:9): [True: 0, False: 698]
  ------------------
 1601|      0|        return res;
 1602|      0|    }
 1603|    698|    if (section->dss_reloc_size == 0) {
  ------------------
  |  Branch (1603:9): [True: 582, False: 116]
  ------------------
 1604|    582|        return res;
 1605|    582|    }
 1606|    116|    if (!o->ai_methods->om_relocate_a_section) {
  ------------------
  |  Branch (1606:9): [True: 0, False: 116]
  ------------------
 1607|      0|        return res;
 1608|      0|    }
 1609|       |    /*apply relocations */
 1610|    116|    res = o->ai_methods->om_relocate_a_section(o->ai_object,
 1611|    116|        section->dss_index, dbg, &errc);
 1612|    116|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|    116|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (1612:9): [True: 116, False: 0]
  ------------------
 1613|    116|        DWARF_DBG_ERROR(dbg, errc, DW_DLV_ERROR);
  ------------------
  |  |   43|    116|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
 1614|      0|    }
 1615|      0|    return res;
 1616|    116|}
dwarf_init_finish.c:_dwarf_setup:
  750|  3.37k|{
  751|  3.37k|    const char    *scn_name = 0;
  752|  3.37k|    struct Dwarf_Obj_Access_Interface_a_s * obj = 0;
  753|  3.37k|    int            resn = 0;
  754|  3.37k|    struct Dwarf_Section_s **sections = 0;
  755|  3.37k|    Dwarf_Small    endianness = 0;
  756|  3.37k|    Dwarf_Unsigned section_count = 0;
  757|  3.37k|    unsigned       default_group_number = 0;
  758|  3.37k|    unsigned       foundDwarf = FALSE;
  ------------------
  |  |   36|  3.37k|#define FALSE 0
  ------------------
  759|  3.37k|    Dwarf_Unsigned obj_section_index = 0;
  760|       |
  761|  3.37k|    dbg->de_assume_string_in_bounds =
  762|  3.37k|        _dwarf_assume_string_in_bounds;
  763|       |    /* First make an arbitrary assumption. */
  764|  3.37k|    dbg->de_copy_word = _dwarf_memcpy_noswap_bytes;
  765|  3.37k|    obj = dbg->de_obj_file;
  766|  3.37k|    endianness = obj->ai_methods->om_get_byte_order(obj->ai_object);
  767|       |    /* Then adjust any changes we need. */
  768|       |#ifdef WORDS_BIGENDIAN
  769|       |    dbg->de_big_endian_object = 1;
  770|       |    if (endianness == DW_END_little) {
  771|       |        dbg->de_big_endian_object = 0;
  772|       |        dbg->de_copy_word = _dwarf_memcpy_swap_bytes;
  773|       |    }
  774|       |#else /* little endian */
  775|  3.37k|    dbg->de_big_endian_object = 0;
  776|  3.37k|    if (endianness == DW_END_big ) {
  ------------------
  |  | 1114|  3.37k|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  |  Branch (776:9): [True: 2.21k, False: 1.16k]
  ------------------
  777|  2.21k|        dbg->de_big_endian_object = 1;
  778|  2.21k|        dbg->de_copy_word = _dwarf_memcpy_swap_bytes;
  779|  2.21k|    }
  780|  3.37k|#endif /* !WORDS_BIGENDIAN */
  781|       |
  782|       |    /*  The following de_length_size is Not Too Significant.
  783|       |        Only used one calculation, and an approximate one
  784|       |        at that. */
  785|  3.37k|    dbg->de_length_size = obj->ai_methods->
  786|  3.37k|        om_get_length_size(obj->ai_object);
  787|  3.37k|    dbg->de_pointer_size =
  788|  3.37k|        obj->ai_methods->om_get_pointer_size(obj->ai_object);
  789|  3.37k|    section_count = obj->ai_methods->
  790|  3.37k|        om_get_section_count(obj->ai_object);
  791|  3.37k|    resn = determine_target_group(section_count,obj,
  792|  3.37k|        &default_group_number,dbg,error);
  793|  3.37k|    if (resn == DW_DLV_ERROR) {
  ------------------
  |  |  123|  3.37k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (793:9): [True: 9, False: 3.36k]
  ------------------
  794|      9|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      9|#define DW_DLV_ERROR     1
  ------------------
  795|      9|    }
  796|  3.36k|    if (dbg->de_groupnumber == DW_GROUPNUMBER_ANY) {
  ------------------
  |  |  126|  3.36k|#define DW_GROUPNUMBER_ANY  0
  ------------------
  |  Branch (796:9): [True: 3.36k, False: 0]
  ------------------
  797|  3.36k|        dbg->de_groupnumber = default_group_number;
  798|  3.36k|    }
  799|       |    /*  Allocate space to record references to debug sections
  800|       |        that can be referenced by RELA sections in
  801|       |        the 'sh_info' field. */
  802|  3.36k|    sections = (struct Dwarf_Section_s **)calloc(section_count + 1,
  803|  3.36k|        sizeof(struct Dwarf_Section_s *));
  804|  3.36k|    if (!sections) {
  ------------------
  |  Branch (804:9): [True: 0, False: 3.36k]
  ------------------
  805|       |        /* Impossible case, we hope. Give up. */
  806|      0|        _dwarf_error(dbg, error, DW_DLE_SECTION_ERROR);
  ------------------
  |  | 1293|      0|#define DW_DLE_SECTION_ERROR                   248
  ------------------
  807|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  808|      0|    }
  809|       |
  810|       |    /*  We can skip index 0 when considering ELF files, but not other
  811|       |        object types.  Indeed regardless of the object type we should
  812|       |        skip section 0 here.
  813|       |        This is a convention.  We depend on it.
  814|       |        Non-elf object access code should
  815|       |        (in itself) understand we will index beginning at 1 and adjust
  816|       |        itself to deal with this Elf convention.    Without this
  817|       |        convention various parts of the code in this file won't
  818|       |        work correctly.
  819|       |        A dss_index of 0 must not be used, even though we start at 0
  820|       |        here.  So the get_section_info() must adapt to the situation
  821|       |        (the elf version does automatically as a result of Elf having
  822|       |        a section zero with zero length and an empty name). */
  823|       |
  824|       |    /* ASSERT: all group map entries set up. */
  825|       |
  826|   181k|    for (obj_section_index = 0; obj_section_index < section_count;
  ------------------
  |  Branch (826:33): [True: 178k, False: 3.17k]
  ------------------
  827|   178k|        ++obj_section_index) {
  828|       |
  829|   178k|        struct Dwarf_Obj_Access_Section_a_s doas;
  830|   178k|        int res = DW_DLV_ERROR;
  ------------------
  |  |  123|   178k|#define DW_DLV_ERROR     1
  ------------------
  831|   178k|        int err = 0;
  832|   178k|        unsigned groupnumber = 0;
  833|   178k|        unsigned mapgroupnumber = 0;
  834|   178k|        int is_rela = FALSE;
  ------------------
  |  |   36|   178k|#define FALSE 0
  ------------------
  835|       |
  836|   178k|        res = _dwarf_section_get_target_group_from_map(dbg,
  837|   178k|            (unsigned int)obj_section_index, &groupnumber,error);
  838|   178k|        if (res == DW_DLV_OK ) {
  ------------------
  |  |  122|   178k|#define DW_DLV_OK        0
  ------------------
  |  Branch (838:13): [True: 88.2k, False: 89.9k]
  ------------------
  839|       |            /* groupnumber is set. Fall through */
  840|  88.2k|            mapgroupnumber = groupnumber;
  841|  89.9k|        } else if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|  89.9k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (841:20): [True: 0, False: 89.9k]
  ------------------
  842|      0|            free(sections);
  843|      0|            return res;
  844|  89.9k|        } else { /* DW_DLV_NO_ENTRY */
  845|       |            /* fall through, a BASE or DWO group, possibly */
  846|  89.9k|        }
  847|   178k|        memset(&doas,0,sizeof(doas));
  848|       |
  849|   178k|        res = obj->ai_methods->om_get_section_info(obj->ai_object,
  850|   178k|            obj_section_index,
  851|   178k|            &doas, &err);
  852|   178k|        if (res == DW_DLV_NO_ENTRY){
  ------------------
  |  |  121|   178k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (852:13): [True: 0, False: 178k]
  ------------------
  853|      0|            free(sections);
  854|      0|            return res;
  855|      0|        }
  856|   178k|        if (res == DW_DLV_ERROR){
  ------------------
  |  |  123|   178k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (856:13): [True: 0, False: 178k]
  ------------------
  857|      0|            free(sections);
  858|      0|            DWARF_DBG_ERROR(dbg, err, DW_DLV_ERROR);
  ------------------
  |  |   43|      0|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
  859|      0|        }
  860|   178k|        scn_name = doas.as_name;
  861|   178k|        if (!groupnumber) {
  ------------------
  |  Branch (861:13): [True: 89.9k, False: 88.2k]
  ------------------
  862|       |            /* This finds dwo sections, group 2 */
  863|  89.9k|            res = _dwarf_dwo_groupnumber_given_name(scn_name,
  864|  89.9k|                &groupnumber);
  865|  89.9k|            if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|  89.9k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (865:17): [True: 89.3k, False: 648]
  ------------------
  866|       |                /* No, must be group 1 */
  867|  89.3k|                groupnumber = DW_GROUPNUMBER_BASE;
  ------------------
  |  |  127|  89.3k|#define DW_GROUPNUMBER_BASE 1
  ------------------
  868|  89.3k|            }
  869|  89.9k|        }
  870|   178k|        if (!this_section_dwarf_relevant(scn_name,
  ------------------
  |  Branch (870:13): [True: 45.7k, False: 132k]
  ------------------
  871|   178k|            (int)doas.as_type,
  872|   178k|            &is_rela) ) {
  873|  45.7k|            continue;
  874|  45.7k|        }
  875|   132k|        if (!is_a_relx_section(scn_name,(int)doas.as_type,
  ------------------
  |  Branch (875:13): [True: 125k, False: 7.14k]
  ------------------
  876|   132k|            &is_rela)
  877|   125k|            && !is_a_special_section_semi_dwarf(scn_name)) {
  ------------------
  |  Branch (877:16): [True: 88.3k, False: 36.9k]
  ------------------
  878|       |            /*  We do these actions only for group-related
  879|       |                sections.  Do for .debug_info etc,
  880|       |                never for .strtab or .rela.*
  881|       |                We already tested for relevance, so that part
  882|       |                is not news. */
  883|  88.3k|            if (mapgroupnumber == dbg->de_groupnumber) {
  ------------------
  |  Branch (883:17): [True: 81.8k, False: 6.56k]
  ------------------
  884|       |                /*  OK. Mapped. Part of the group.. This will
  885|       |                    catch the cases where there are versions of
  886|       |                    a section in multiple COMDATs and in BASE
  887|       |                    an DWO to get the right one */
  888|  81.8k|            } else {
  889|       |                /* This section not mapped into this group. */
  890|  6.56k|                if (groupnumber == 1 && dbg->de_groupnumber > 2 &&
  ------------------
  |  Branch (890:21): [True: 376, False: 6.18k]
  |  Branch (890:41): [True: 253, False: 123]
  ------------------
  891|    253|                    !_dwarf_section_in_group_by_name(dbg,scn_name,
  ------------------
  |  Branch (891:21): [True: 204, False: 49]
  ------------------
  892|    253|                        dbg->de_groupnumber)) {
  893|       |                    /* Load the section (but as group 1) */
  894|  6.36k|                } else {
  895|  6.36k|                    continue;
  896|  6.36k|                }
  897|  6.56k|            }
  898|  88.3k|        }
  899|       |        /* BUILDING_SECTIONS.  See also BUILDING_MAP, SETUP_SECTION */
  900|   126k|        {
  901|       |            /*  Build up the sections table and the
  902|       |                de_debug* etc pointers in Dwarf_Debug. */
  903|   126k|            struct Dwarf_dbg_sect_s *section = 0;
  904|   126k|            int found_match = FALSE;
  ------------------
  |  |   36|   126k|#define FALSE 0
  ------------------
  905|       |
  906|   126k|            res = is_section_name_known_already(dbg,scn_name);
  907|   126k|            if (res == DW_DLV_OK) {
  ------------------
  |  |  122|   126k|#define DW_DLV_OK        0
  ------------------
  |  Branch (907:17): [True: 46.4k, False: 79.6k]
  ------------------
  908|       |#if 0 /* Removed check for section duplication */
  909|       |                /* DUPLICATE */
  910|       |                DWARF_DBG_ERROR(dbg, DW_DLE_SECTION_DUPLICATION,
  911|       |                    DW_DLV_ERROR);
  912|       |                /* Metrowerks does this nonsense */
  913|       |#endif
  914|  46.4k|                continue;
  915|  46.4k|            }
  916|  79.6k|            if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|  79.6k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (916:17): [True: 0, False: 79.6k]
  ------------------
  917|      0|                free(sections);
  918|      0|                DWARF_DBG_ERROR(dbg, err, DW_DLV_ERROR);
  ------------------
  |  |   43|      0|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
  919|      0|            }
  920|       |            /* No entry: new-to-us section, the normal case. */
  921|  79.6k|            res = _dwarf_enter_section_in_de_debug_sections_array(dbg,
  922|  79.6k|                scn_name, obj_section_index, groupnumber,&err);
  923|  79.6k|            if (res == DW_DLV_OK) {
  ------------------
  |  |  122|  79.6k|#define DW_DLV_OK        0
  ------------------
  |  Branch (923:17): [True: 2.75k, False: 76.9k]
  ------------------
  924|  2.75k|                section = &dbg->de_debug_sections[
  925|  2.75k|                    dbg->de_debug_sections_total_entries-1];
  926|  2.75k|                res = get_basic_section_data(dbg,
  927|  2.75k|                    section->ds_secdata, &doas,
  928|  2.75k|                    obj_section_index,
  929|  2.75k|                    groupnumber,
  930|  2.75k|                    error,
  931|  2.75k|                    section->ds_duperr,
  932|  2.75k|                    section->ds_emptyerr);
  933|  2.75k|                if (res != DW_DLV_OK) {
  ------------------
  |  |  122|  2.75k|#define DW_DLV_OK        0
  ------------------
  |  Branch (933:21): [True: 22, False: 2.72k]
  ------------------
  934|     22|                    free(sections);
  935|     22|                    return res;
  936|     22|                }
  937|  2.72k|                sections[obj_section_index] = section->ds_secdata;
  938|  2.72k|                foundDwarf += section->ds_have_dwarf;
  939|  2.72k|                found_match = TRUE;
  ------------------
  |  |   33|  2.72k|#define TRUE 1
  ------------------
  940|       |                /*  Normal section set up.
  941|       |                    Fall through. */
  942|  76.9k|            } else if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|  76.9k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (942:24): [True: 76.8k, False: 45]
  ------------------
  943|       |                /*  We get here for relocation sections.
  944|       |                    Fall through. */
  945|  76.8k|            } else {
  946|     45|                free(sections);
  947|     45|                DWARF_DBG_ERROR(dbg, err, DW_DLV_ERROR);
  ------------------
  |  |   43|     45|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
  948|      0|            }
  949|       |
  950|  79.6k|            if (!found_match) {
  ------------------
  |  Branch (950:17): [True: 76.8k, False: 2.72k]
  ------------------
  951|       |                /*  For an object file with incorrect rel[a]
  952|       |                    section name, the 'readelf' tool,
  953|       |                    prints correct debug information,
  954|       |                    as the tool takes the section type instead
  955|       |                    of the section name. If the current section
  956|       |                    is a RELA one and the 'sh_info'
  957|       |                    refers to a debug section, add the
  958|       |                    relocation data. */
  959|  76.8k|                if (is_a_relx_section(scn_name,
  ------------------
  |  Branch (959:21): [True: 6.30k, False: 70.5k]
  ------------------
  960|  76.8k|                    (int)doas.as_type, &is_rela)) {
  961|  6.30k|                    if ( doas.as_info < section_count) {
  ------------------
  |  Branch (961:26): [True: 6.17k, False: 128]
  ------------------
  962|  6.17k|                        if (sections[doas.as_info]) {
  ------------------
  |  Branch (962:29): [True: 518, False: 5.66k]
  ------------------
  963|    518|                            add_relx_data_to_secdata(
  964|    518|                                sections[doas.as_info],
  965|    518|                                &doas,
  966|    518|                                obj_section_index,is_rela);
  967|    518|                        }
  968|  6.17k|                    } else {
  969|       |                        /* Something is wrong with the object file. */
  970|    128|                        free(sections);
  971|    128|                        DWARF_DBG_ERROR(dbg, DW_DLE_ELF_SECT_ERR,
  ------------------
  |  |   43|    128|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
  972|    128|                            DW_DLV_ERROR);
  973|      0|                    }
  974|  6.30k|                }
  975|  76.8k|            }
  976|       |            /* Fetch next section */
  977|  79.6k|        }
  978|  79.6k|    }
  979|       |
  980|       |    /* Free table with section information. */
  981|  3.17k|    free(sections);
  982|  3.17k|    if (foundDwarf) {
  ------------------
  |  Branch (982:9): [True: 1.60k, False: 1.56k]
  ------------------
  983|  1.60k|        return DW_DLV_OK;
  ------------------
  |  |  122|  1.60k|#define DW_DLV_OK        0
  ------------------
  984|  1.60k|    }
  985|  1.56k|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|  1.56k|#define DW_DLV_NO_ENTRY -1
  ------------------
  986|  3.17k|}
dwarf_init_finish.c:determine_target_group:
  603|  3.37k|{
  604|  3.37k|    unsigned obj_section_index = 0;
  605|  3.37k|    int found_group_one = 0;
  606|  3.37k|    int found_group_two = 0;
  607|  3.37k|    struct Dwarf_Group_Data_s *grp = 0;
  608|  3.37k|    unsigned comdat_group_next = 3;
  609|  3.37k|    unsigned lowest_comdat_groupnum = 0;
  610|       |
  611|  3.37k|    grp = &dbg->de_groupnumbers;
  612|  3.37k|    grp->gd_number_of_groups = 0;
  613|  3.37k|    grp->gd_number_of_sections = (unsigned int)section_count;
  614|  3.37k|    if (grp->gd_map) {
  ------------------
  |  Branch (614:9): [True: 0, False: 3.37k]
  ------------------
  615|      0|        _dwarf_error(dbg,error,DW_DLE_GROUP_INTERNAL_ERROR);
  ------------------
  |  | 1436|      0|#define DW_DLE_GROUP_INTERNAL_ERROR            390
  ------------------
  616|      0|        return DW_DLV_OK;
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
  617|      0|    }
  618|   202k|    for (obj_section_index = 0; obj_section_index < section_count;
  ------------------
  |  Branch (618:33): [True: 199k, False: 3.36k]
  ------------------
  619|   199k|        ++obj_section_index) {
  620|       |
  621|   199k|        struct Dwarf_Obj_Access_Section_a_s doas;
  622|   199k|        int res = DW_DLV_ERROR;
  ------------------
  |  |  123|   199k|#define DW_DLV_ERROR     1
  ------------------
  623|   199k|        int err = 0;
  624|   199k|        const char *scn_name = 0;
  625|   199k|        unsigned groupnumber = 0;
  626|   199k|        unsigned mapgroupnumber = 0;
  627|   199k|        int is_rela = FALSE;
  ------------------
  |  |   36|   199k|#define FALSE 0
  ------------------
  628|       |
  629|   199k|        memset(&doas,0,sizeof(doas));
  630|   199k|        res = obj->ai_methods->om_get_section_info(obj->ai_object,
  631|   199k|            obj_section_index,
  632|   199k|            &doas, &err);
  633|   199k|        if (res == DW_DLV_NO_ENTRY){
  ------------------
  |  |  121|   199k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (633:13): [True: 0, False: 199k]
  ------------------
  634|      0|            return res;
  635|      0|        }
  636|   199k|        if (res == DW_DLV_ERROR){
  ------------------
  |  |  123|   199k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (636:13): [True: 0, False: 199k]
  ------------------
  637|      0|            _dwarf_error(dbg, error,err);
  638|      0|            return res;
  639|      0|        }
  640|       |
  641|   199k|        if (doas.as_type == SHT_GROUP) {
  ------------------
  |  |   86|   199k|#define SHT_GROUP 17
  ------------------
  |  Branch (641:13): [True: 1.08k, False: 198k]
  ------------------
  642|       |            /*  See assumptions in function comment above. */
  643|  1.08k|            unsigned did_add_map = 0;
  644|       |            /*  Add to our map. Here we
  645|       |                are assuming SHT_GROUP records come first.
  646|       |                Till proven wrong. */
  647|  1.08k|            res = insert_sht_list_in_group_map(dbg,&doas,
  648|  1.08k|                comdat_group_next,
  649|  1.08k|                obj_section_index,
  650|  1.08k|                section_count,
  651|  1.08k|                obj,
  652|  1.08k|                &did_add_map,error);
  653|  1.08k|            if (res != DW_DLV_OK) {
  ------------------
  |  |  122|  1.08k|#define DW_DLV_OK        0
  ------------------
  |  Branch (653:17): [True: 9, False: 1.07k]
  ------------------
  654|      9|                return res;
  655|      9|            }
  656|  1.07k|            if (!lowest_comdat_groupnum) {
  ------------------
  |  Branch (656:17): [True: 296, False: 776]
  ------------------
  657|    296|                lowest_comdat_groupnum = comdat_group_next;
  658|    296|            }
  659|  1.07k|            if (did_add_map) {
  ------------------
  |  Branch (659:17): [True: 235, False: 837]
  ------------------
  660|    235|                ++grp->gd_number_of_groups;
  661|    235|                ++comdat_group_next;
  662|    235|            }
  663|  1.07k|            continue;
  664|  1.08k|        }
  665|   198k|        scn_name = doas.as_name;
  666|   198k|        if (!this_section_dwarf_relevant(scn_name,
  ------------------
  |  Branch (666:13): [True: 45.2k, False: 153k]
  ------------------
  667|   198k|            (int)doas.as_type,
  668|   198k|            &is_rela) ) {
  669|  45.2k|            continue;
  670|  45.2k|        }
  671|       |
  672|       |        /*  Now at a 'normal' section, though we do not
  673|       |            quite know what group it is. */
  674|       |
  675|   153k|        res = _dwarf_section_get_target_group_from_map(dbg,
  676|   153k|            obj_section_index,&groupnumber,error);
  677|   153k|        if (res == DW_DLV_OK ) {
  ------------------
  |  |  122|   153k|#define DW_DLV_OK        0
  ------------------
  |  Branch (677:13): [True: 209, False: 152k]
  ------------------
  678|       |            /*  groupnumber is set. Fall through.
  679|       |                All COMDAT group should get here. */
  680|    209|            mapgroupnumber = groupnumber;
  681|   152k|        } else if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|   152k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (681:20): [True: 0, False: 152k]
  ------------------
  682|      0|            return res;
  683|   152k|        } else { /* DW_DLV_NO_ENTRY */
  684|       |            /* Normal non-COMDAT. groupnumber is zero.  */
  685|   152k|        }
  686|       |
  687|       |        /* BUILDING_MAP.  See also BUILDING_SECTIONS, SETUP_SECTION */
  688|   153k|        if (!groupnumber) {
  ------------------
  |  Branch (688:13): [True: 152k, False: 209]
  ------------------
  689|   152k|            res =_dwarf_dwo_groupnumber_given_name(scn_name,
  690|   152k|                &groupnumber);
  691|       |            /* DW_DLV_ERROR impossible here. */
  692|   152k|            if (res == DW_DLV_OK) {
  ------------------
  |  |  122|   152k|#define DW_DLV_OK        0
  ------------------
  |  Branch (692:17): [True: 19.1k, False: 133k]
  ------------------
  693|       |                /* groupnumber set 2 */
  694|   133k|            } else {
  695|       |                /*  This is what it has to be.
  696|       |                    .rela in here too.  */
  697|   133k|                groupnumber = DW_GROUPNUMBER_BASE;
  ------------------
  |  |  127|   133k|#define DW_GROUPNUMBER_BASE 1
  ------------------
  698|   133k|            }
  699|   152k|        }
  700|   153k|        if (is_a_relx_section(scn_name,(int)doas.as_type,
  ------------------
  |  Branch (700:13): [True: 17.3k, False: 135k]
  ------------------
  701|   153k|            &is_rela)) {
  702|  17.3k|            continue;
  703|  17.3k|        }
  704|       |
  705|       |        /*  ASSERT: groupnumber non-zero now */
  706|   135k|        if (!is_a_special_section_semi_dwarf(scn_name)) {
  ------------------
  |  Branch (706:13): [True: 98.6k, False: 36.9k]
  ------------------
  707|  98.6k|            if (mapgroupnumber) {
  ------------------
  |  Branch (707:17): [True: 114, False: 98.5k]
  ------------------
  708|       |                /* Already in group map */
  709|    114|                continue;
  710|    114|            }
  711|       |            /* !mapgroupnumber */
  712|  98.5k|            res = _dwarf_insert_in_group_map(dbg,
  713|  98.5k|                (unsigned)groupnumber,
  714|  98.5k|                (unsigned)obj_section_index,
  715|  98.5k|                scn_name,
  716|  98.5k|                error);
  717|  98.5k|            if (res != DW_DLV_OK) {
  ------------------
  |  |  122|  98.5k|#define DW_DLV_OK        0
  ------------------
  |  Branch (717:17): [True: 0, False: 98.5k]
  ------------------
  718|      0|                return res;
  719|      0|            }
  720|  98.5k|            if (groupnumber == 1) {
  ------------------
  |  Branch (720:17): [True: 80.0k, False: 18.5k]
  ------------------
  721|  80.0k|                found_group_one++;
  722|  80.0k|            } else if (groupnumber == 2) {
  ------------------
  |  Branch (722:24): [True: 18.5k, False: 0]
  ------------------
  723|  18.5k|                found_group_two++;
  724|  18.5k|            } else { /* fall through to continue */ }
  725|  98.5k|            continue;
  726|  98.5k|        }
  727|   135k|    }
  728|  3.36k|    if (found_group_two) {
  ------------------
  |  Branch (728:9): [True: 496, False: 2.87k]
  ------------------
  729|    496|        ++grp->gd_number_of_groups;
  730|    496|    }
  731|  3.36k|    if (found_group_one) {
  ------------------
  |  Branch (731:9): [True: 1.78k, False: 1.57k]
  ------------------
  732|  1.78k|        *group_number_out = DW_GROUPNUMBER_BASE;
  ------------------
  |  |  127|  1.78k|#define DW_GROUPNUMBER_BASE 1
  ------------------
  733|  1.78k|        ++grp->gd_number_of_groups;
  734|  1.78k|    } else {
  735|  1.57k|        if (found_group_two) {
  ------------------
  |  Branch (735:13): [True: 190, False: 1.38k]
  ------------------
  736|    190|            *group_number_out = DW_GROUPNUMBER_DWO;
  ------------------
  |  |  128|    190|#define DW_GROUPNUMBER_DWO  2
  ------------------
  737|  1.38k|        } else {
  738|  1.38k|            if (lowest_comdat_groupnum) {
  ------------------
  |  Branch (738:17): [True: 251, False: 1.13k]
  ------------------
  739|    251|                *group_number_out = lowest_comdat_groupnum;
  740|  1.13k|            } else {
  741|  1.13k|                *group_number_out = DW_GROUPNUMBER_BASE;
  ------------------
  |  |  127|  1.13k|#define DW_GROUPNUMBER_BASE 1
  ------------------
  742|  1.13k|            }
  743|  1.38k|        }
  744|  1.57k|    }
  745|  3.36k|    return DW_DLV_OK;
  ------------------
  |  |  122|  3.36k|#define DW_DLV_OK        0
  ------------------
  746|  3.37k|}
dwarf_init_finish.c:insert_sht_list_in_group_map:
  430|  1.08k|{
  431|  1.08k|    struct Dwarf_Section_s secdata;
  432|  1.08k|    Dwarf_Small * data = 0;
  433|  1.08k|    int           res = 0;
  434|  1.08k|    Dwarf_Small*  secend = 0;
  435|       |
  436|  1.08k|    memset(&secdata,0,sizeof(secdata));
  437|  1.08k|    secdata.dss_size =      doas->as_size;
  438|  1.08k|    secdata.dss_entrysize = doas->as_entrysize;
  439|  1.08k|    secdata.dss_group_number = 1; /* arbitrary. */
  440|  1.08k|    secdata.dss_index     = section_number;
  441|  1.08k|    secdata.dss_name      = ".group";
  442|  1.08k|    secdata.dss_standard_name = ".group";
  443|  1.08k|    secdata.dss_number = section_number;
  444|  1.08k|    secdata.dss_ignore_reloc_group_sec = TRUE;
  ------------------
  |  |   33|  1.08k|#define TRUE 1
  ------------------
  445|  1.08k|    res = _dwarf_load_section(dbg,&secdata,error);
  446|  1.08k|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|  1.08k|#define DW_DLV_OK        0
  ------------------
  |  Branch (446:9): [True: 0, False: 1.08k]
  ------------------
  447|      0|        _dwarf_malloc_section_free(&secdata);
  448|      0|        return res;
  449|      0|    }
  450|  1.08k|    if (!secdata.dss_data) {
  ------------------
  |  Branch (450:9): [True: 0, False: 1.08k]
  ------------------
  451|      0|        _dwarf_error(dbg,error,DW_DLE_GROUP_INTERNAL_ERROR);
  ------------------
  |  | 1436|      0|#define DW_DLE_GROUP_INTERNAL_ERROR            390
  ------------------
  452|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  453|      0|    }
  454|  1.08k|    if (doas->as_entrysize != 4) {
  ------------------
  |  Branch (454:9): [True: 0, False: 1.08k]
  ------------------
  455|      0|        _dwarf_malloc_section_free(&secdata);
  456|      0|        _dwarf_error(dbg,error,DW_DLE_GROUP_INTERNAL_ERROR);
  ------------------
  |  | 1436|      0|#define DW_DLE_GROUP_INTERNAL_ERROR            390
  ------------------
  457|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  458|      0|    }
  459|       |    /*  So now pick up the data in dss_data.
  460|       |        It is an array of 32 bit fields.
  461|       |        Entry zero is just a constant 1.
  462|       |        Each additional is a section number. */
  463|  1.08k|    data = secdata.dss_data;
  464|  1.08k|    secend = data + secdata.dss_size;
  465|  1.08k|    {
  466|  1.08k|        Dwarf_Unsigned i = 1;
  467|  1.08k|        Dwarf_Unsigned count = doas->as_size/doas->as_entrysize;
  468|  1.08k|        Dwarf_Unsigned  fval = 0;
  469|       |
  470|       |        /*  The fields treatments with  regard
  471|       |            to endianness is unclear.  In any case a single
  472|       |            bit should be on, as 0x01000000
  473|       |            without any endianness swapping.
  474|       |            Or so it seems given limited evidence.
  475|       |            We read with length checking and allow the
  476|       |            reader to byte swap and then fix things.
  477|       |            At least one test case has big-endian
  478|       |            data but little-endian SHT_GROUP data. */
  479|  1.08k|        if ((data+DWARF_32BIT_SIZE) > secend) {
  ------------------
  |  |  133|  1.08k|#define DWARF_32BIT_SIZE 4
  ------------------
  |  Branch (479:13): [True: 0, False: 1.08k]
  ------------------
  480|       |            /* Duplicates the check in READ_UNALIGNED_CK
  481|       |                so we can free allocated memory bere. */
  482|      0|            _dwarf_malloc_section_free(&secdata);
  483|      0|            _dwarf_error(dbg,error,DW_DLE_GROUP_INTERNAL_ERROR);
  ------------------
  |  | 1436|      0|#define DW_DLE_GROUP_INTERNAL_ERROR            390
  ------------------
  484|      0|            return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  485|      0|        }
  486|  1.08k|        READ_UNALIGNED_CK(dbg,fval,Dwarf_Unsigned,
  ------------------
  |  |  245|  1.08k|    do  {                                        \
  |  |  246|  1.08k|        desttype _ltmp = 0;                      \
  |  |  247|  1.08k|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|  1.08k|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 1.08k]
  |  |  ------------------
  |  |  249|      0|            _dwarf_error_string((dbg), (error),  \
  |  |  250|      0|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      0|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  251|      0|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  252|      0|                "Read starts past the end of section");\
  |  |  253|      0|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  254|      0|        }                                        \
  |  |  255|  1.08k|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 0, False: 1.08k]
  |  |  ------------------
  |  |  256|      0|            _dwarf_error_string((dbg), (error),  \
  |  |  257|      0|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      0|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  258|      0|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  259|      0|                "Read would end past the end of section");\
  |  |  260|      0|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  261|      0|        }                                        \
  |  |  262|  1.08k|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|  1.08k|            (source), (unsigned long)(length)) ; \
  |  |  264|  1.08k|        (dest) = _ltmp;                          \
  |  |  265|  1.08k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 1.08k]
  |  |  ------------------
  ------------------
  487|  1.08k|            data,
  488|  1.08k|            DWARF_32BIT_SIZE,
  489|  1.08k|            error,
  490|  1.08k|            secend);
  491|  1.08k|        if (fval != 1 && fval != 0x1000000) {
  ------------------
  |  Branch (491:13): [True: 673, False: 408]
  |  Branch (491:26): [True: 0, False: 673]
  ------------------
  492|       |            /*  Could be corrupted elf object. */
  493|      0|            _dwarf_malloc_section_free(&secdata);
  494|      0|            _dwarf_error(dbg,error,DW_DLE_GROUP_INTERNAL_ERROR);
  ------------------
  |  | 1436|      0|#define DW_DLE_GROUP_INTERNAL_ERROR            390
  ------------------
  495|      0|            return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  496|      0|        }
  497|       |
  498|  1.08k|        data = data + doas->as_entrysize;
  499|  4.53k|        for (i = 1 ; i < count ; ++i) {
  ------------------
  |  Branch (499:22): [True: 3.45k, False: 1.07k]
  ------------------
  500|  3.45k|            Dwarf_Unsigned  val = 0;
  501|       |
  502|  3.45k|            if ((data+DWARF_32BIT_SIZE) > secend) {
  ------------------
  |  |  133|  3.45k|#define DWARF_32BIT_SIZE 4
  ------------------
  |  Branch (502:17): [True: 0, False: 3.45k]
  ------------------
  503|       |                /* Duplicates the check in READ_UNALIGNED_CK
  504|       |                    so we can free allocated memory bere. */
  505|      0|                _dwarf_malloc_section_free(&secdata);
  506|      0|                _dwarf_error(dbg,error,DW_DLE_GROUP_INTERNAL_ERROR);
  ------------------
  |  | 1436|      0|#define DW_DLE_GROUP_INTERNAL_ERROR            390
  ------------------
  507|      0|                return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  508|      0|            }
  509|  3.45k|            READ_UNALIGNED_CK(dbg,val,Dwarf_Unsigned,
  ------------------
  |  |  245|  3.45k|    do  {                                        \
  |  |  246|  3.45k|        desttype _ltmp = 0;                      \
  |  |  247|  3.45k|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|  3.45k|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 3.45k]
  |  |  ------------------
  |  |  249|      0|            _dwarf_error_string((dbg), (error),  \
  |  |  250|      0|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      0|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  251|      0|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  252|      0|                "Read starts past the end of section");\
  |  |  253|      0|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  254|      0|        }                                        \
  |  |  255|  3.45k|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 0, False: 3.45k]
  |  |  ------------------
  |  |  256|      0|            _dwarf_error_string((dbg), (error),  \
  |  |  257|      0|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      0|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  258|      0|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  259|      0|                "Read would end past the end of section");\
  |  |  260|      0|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  261|      0|        }                                        \
  |  |  262|  3.45k|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|  3.45k|            (source), (unsigned long)(length)) ; \
  |  |  264|  3.45k|        (dest) = _ltmp;                          \
  |  |  265|  3.45k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 3.45k]
  |  |  ------------------
  ------------------
  510|  3.45k|                data,
  511|  3.45k|                DWARF_32BIT_SIZE,
  512|  3.45k|                error,
  513|  3.45k|                secend);
  514|  3.45k|            if (val > section_count) {
  ------------------
  |  Branch (514:17): [True: 2.87k, False: 580]
  ------------------
  515|       |                /*  Might be confused endianness by
  516|       |                    the compiler generating the SHT_GROUP.
  517|       |                    This is pretty horrible. */
  518|  2.87k|                Dwarf_Unsigned valr = 0;
  519|  2.87k|                _dwarf_memcpy_swap_bytes(&valr,&val,
  520|  2.87k|                    DWARF_32BIT_SIZE);
  ------------------
  |  |  133|  2.87k|#define DWARF_32BIT_SIZE 4
  ------------------
  521|  2.87k|                if (valr > section_count) {
  ------------------
  |  Branch (521:21): [True: 0, False: 2.87k]
  ------------------
  522|      0|                    _dwarf_malloc_section_free(&secdata);
  523|      0|                    _dwarf_error(dbg,error,
  524|      0|                        DW_DLE_GROUP_INTERNAL_ERROR);
  ------------------
  |  | 1436|      0|#define DW_DLE_GROUP_INTERNAL_ERROR            390
  ------------------
  525|      0|                    return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  526|      0|                }
  527|       |                /* Ok. Yes, ugly. */
  528|  2.87k|                val = valr;
  529|  2.87k|            }
  530|  3.45k|            {
  531|       |                /*  Ensure this group entry DWARF relevant before
  532|       |                    adding to group map */
  533|  3.45k|                struct Dwarf_Obj_Access_Section_a_s doasx;
  534|  3.45k|                int resx = DW_DLV_ERROR;
  ------------------
  |  |  123|  3.45k|#define DW_DLV_ERROR     1
  ------------------
  535|  3.45k|                int err = 0;
  536|  3.45k|                int is_rela = FALSE;
  ------------------
  |  |   36|  3.45k|#define FALSE 0
  ------------------
  537|       |
  538|  3.45k|                memset(&doasx,0,sizeof(doasx));
  539|  3.45k|                resx = obj->ai_methods->
  540|  3.45k|                    om_get_section_info(obj->ai_object,
  541|  3.45k|                    val,
  542|  3.45k|                    &doasx, &err);
  543|  3.45k|                if (resx == DW_DLV_NO_ENTRY){
  ------------------
  |  |  121|  3.45k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (543:21): [True: 0, False: 3.45k]
  ------------------
  544|       |                    /*  Should we really ignore this? */
  545|      0|                    continue;
  546|      0|                }
  547|  3.45k|                if (resx == DW_DLV_ERROR){
  ------------------
  |  |  123|  3.45k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (547:21): [True: 0, False: 3.45k]
  ------------------
  548|      0|                    _dwarf_malloc_section_free(&secdata);
  549|      0|                    _dwarf_error(dbg,error,err);
  550|      0|                    return resx;
  551|      0|                }
  552|  3.45k|                if (!this_section_dwarf_relevant(doasx.as_name,
  ------------------
  |  Branch (552:21): [True: 3.09k, False: 366]
  ------------------
  553|  3.45k|                    (int)doasx.as_type,&is_rela) ) {
  554|  3.09k|                    continue;
  555|  3.09k|                }
  556|    366|                data += DWARF_32BIT_SIZE;
  ------------------
  |  |  133|    366|#define DWARF_32BIT_SIZE 4
  ------------------
  557|    366|                *did_add_map = TRUE;
  ------------------
  |  |   33|    366|#define TRUE 1
  ------------------
  558|    366|                res = _dwarf_insert_in_group_map(dbg,
  559|    366|                    (unsigned)comdat_group_number,
  560|    366|                    (unsigned)val,
  561|    366|                    doasx.as_name,
  562|    366|                    error);
  563|    366|                if (res != DW_DLV_OK) {
  ------------------
  |  |  122|    366|#define DW_DLV_OK        0
  ------------------
  |  Branch (563:21): [True: 9, False: 357]
  ------------------
  564|      9|                    _dwarf_malloc_section_free(&secdata);
  565|      9|                    return res;
  566|      9|                }
  567|    366|            }
  568|    366|        }
  569|  1.08k|    }
  570|  1.07k|    _dwarf_malloc_section_free(&secdata);
  571|  1.07k|    return DW_DLV_OK;
  ------------------
  |  |  122|  1.07k|#define DW_DLV_OK        0
  ------------------
  572|  1.08k|}
dwarf_init_finish.c:this_section_dwarf_relevant:
  376|   379k|{
  377|       |    /* A small helper function for _dwarf_setup(). */
  378|   379k|    if (_dwarf_startswith(scn_name, ".zdebug_") ||
  ------------------
  |  Branch (378:9): [True: 85.1k, False: 294k]
  ------------------
  379|   294k|        _dwarf_startswith(scn_name, ".debug_")) {
  ------------------
  |  Branch (379:9): [True: 88.4k, False: 206k]
  ------------------
  380|       |        /* standard debug */
  381|   173k|        return TRUE;
  ------------------
  |  |   33|   173k|#define TRUE 1
  ------------------
  382|   173k|    }
  383|   206k|    if (_dwarf_ignorethissection(scn_name)) {
  ------------------
  |  Branch (383:9): [True: 8.93k, False: 197k]
  ------------------
  384|  8.93k|        return FALSE;
  ------------------
  |  |   36|  8.93k|#define FALSE 0
  ------------------
  385|  8.93k|    }
  386|       |    /* Now check if a special section could be
  387|       |        in a section_group, but though seems unlikely. */
  388|   197k|    if (!strcmp(scn_name, ".eh_frame")) {
  ------------------
  |  Branch (388:9): [True: 2.47k, False: 194k]
  ------------------
  389|       |        /*  This is not really a group related file, but
  390|       |            it is harmless to consider it such. */
  391|  2.47k|        return TRUE;
  ------------------
  |  |   33|  2.47k|#define TRUE 1
  ------------------
  392|  2.47k|    }
  393|   194k|    if (!strcmp(scn_name, ".gnu_debuglink")) {
  ------------------
  |  Branch (393:9): [True: 934, False: 193k]
  ------------------
  394|       |        /*  This is not a group or DWARF related file, but
  395|       |            it is useful for split dwarf. */
  396|    934|        return TRUE;
  ------------------
  |  |   33|    934|#define TRUE 1
  ------------------
  397|    934|    }
  398|   193k|    if (!strcmp(scn_name, ".note.gnu.build-id")) {
  ------------------
  |  Branch (398:9): [True: 11.5k, False: 182k]
  ------------------
  399|       |        /*  This is not a group or DWARF related file, but
  400|       |            it is useful for split dwarf. */
  401|  11.5k|        return TRUE;
  ------------------
  |  |   33|  11.5k|#define TRUE 1
  ------------------
  402|  11.5k|    }
  403|   182k|    if (!strcmp(scn_name, ".gdb_index")) {
  ------------------
  |  Branch (403:9): [True: 544, False: 181k]
  ------------------
  404|    544|        return TRUE;
  ------------------
  |  |   33|    544|#define TRUE 1
  ------------------
  405|    544|    }
  406|   181k|    if (is_a_special_section_semi_dwarf(scn_name)) {
  ------------------
  |  Branch (406:9): [True: 73.9k, False: 107k]
  ------------------
  407|  73.9k|        return TRUE;
  ------------------
  |  |   33|  73.9k|#define TRUE 1
  ------------------
  408|  73.9k|    }
  409|   107k|    if (is_a_relx_section(scn_name,type,is_rela)) {
  ------------------
  |  Branch (409:9): [True: 22.7k, False: 85.1k]
  ------------------
  410|  22.7k|        return TRUE;
  ------------------
  |  |   33|  22.7k|#define TRUE 1
  ------------------
  411|  22.7k|    }
  412|       |    /*  All sorts of sections are of no interest: .text
  413|       |        .rel. and many others. */
  414|  85.1k|    return FALSE;
  ------------------
  |  |   36|  85.1k|#define FALSE 0
  ------------------
  415|   107k|}
dwarf_init_finish.c:is_a_relx_section:
  338|   470k|{
  339|   470k|    if (type == SHT_RELA) {
  ------------------
  |  |   79|   470k|#define SHT_RELA 4
  ------------------
  |  Branch (339:9): [True: 6.46k, False: 463k]
  ------------------
  340|  6.46k|        *is_rela = TRUE;
  ------------------
  |  |   33|  6.46k|#define TRUE 1
  ------------------
  341|  6.46k|        return TRUE;
  ------------------
  |  |   33|  6.46k|#define TRUE 1
  ------------------
  342|  6.46k|    }
  343|   463k|    if (_dwarf_startswith(scn_name,".rela.")) {
  ------------------
  |  Branch (343:9): [True: 21.5k, False: 442k]
  ------------------
  344|  21.5k|        *is_rela = TRUE;
  ------------------
  |  |   33|  21.5k|#define TRUE 1
  ------------------
  345|  21.5k|        return TRUE;
  ------------------
  |  |   33|  21.5k|#define TRUE 1
  ------------------
  346|  21.5k|    }
  347|   442k|    if (_dwarf_startswith(scn_name,".rel.")) {
  ------------------
  |  Branch (347:9): [True: 20.8k, False: 421k]
  ------------------
  348|  20.8k|        *is_rela = FALSE;
  ------------------
  |  |   36|  20.8k|#define FALSE 0
  ------------------
  349|  20.8k|        return TRUE;
  ------------------
  |  |   33|  20.8k|#define TRUE 1
  ------------------
  350|  20.8k|    }
  351|   421k|    if (type == SHT_REL) {
  ------------------
  |  |   82|   421k|#define SHT_REL 9
  ------------------
  |  Branch (351:9): [True: 4.69k, False: 416k]
  ------------------
  352|  4.69k|        *is_rela = FALSE;
  ------------------
  |  |   36|  4.69k|#define FALSE 0
  ------------------
  353|  4.69k|        return TRUE;
  ------------------
  |  |   33|  4.69k|#define TRUE 1
  ------------------
  354|  4.69k|    }
  355|   416k|    *is_rela = FALSE;
  ------------------
  |  |   36|   416k|#define FALSE 0
  ------------------
  356|   416k|    return FALSE;
  ------------------
  |  |   36|   416k|#define FALSE 0
  ------------------
  357|   421k|}
dwarf_init_finish.c:is_a_special_section_semi_dwarf:
  362|   442k|{
  363|   442k|    if (!strcmp(scn_name,".strtab") ||
  ------------------
  |  Branch (363:9): [True: 146k, False: 296k]
  ------------------
  364|   296k|        !strcmp(scn_name,".symtab")) {
  ------------------
  |  Branch (364:9): [True: 1.49k, False: 295k]
  ------------------
  365|   147k|        return TRUE;
  ------------------
  |  |   33|   147k|#define TRUE 1
  ------------------
  366|   147k|    }
  367|       |    /*  It's not one of these special sections referenced in
  368|       |        the test. */
  369|   295k|    return FALSE;
  ------------------
  |  |   36|   295k|#define FALSE 0
  ------------------
  370|   442k|}
dwarf_init_finish.c:is_section_name_known_already:
  285|   126k|{
  286|   126k|    unsigned i = 0;
  287|   154k|    for ( ; i < dbg->de_debug_sections_total_entries; ++i) {
  ------------------
  |  Branch (287:13): [True: 74.9k, False: 79.6k]
  ------------------
  288|  74.9k|        struct Dwarf_dbg_sect_s *section = &dbg->de_debug_sections[i];
  289|  74.9k|        if (!strcmp(scn_name, section->ds_name)) {
  ------------------
  |  Branch (289:13): [True: 46.4k, False: 28.4k]
  ------------------
  290|       |            /*  The caller will declare this a duplicate, an error. */
  291|  46.4k|            return DW_DLV_OK;
  ------------------
  |  |  122|  46.4k|#define DW_DLV_OK        0
  ------------------
  292|  46.4k|        }
  293|  74.9k|    }
  294|       |    /*  This is normal, we expect we've not accepted
  295|       |        scn_name already. */
  296|  79.6k|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|  79.6k|#define DW_DLV_NO_ENTRY -1
  ------------------
  297|   126k|}
dwarf_init_finish.c:get_basic_section_data:
  205|  2.75k|{
  206|       |    /*  There is an elf convention that section index 0  is reserved,
  207|       |        and that section is always empty.
  208|       |        Non-elf object formats must honor that by ensuring that
  209|       |        (when they assign numbers to 'sections' or
  210|       |        'section-like-things')
  211|       |        they never assign a real section section-number
  212|       |        0 to dss_index. */
  213|  2.75k|    if (secdata->dss_index != 0) {
  ------------------
  |  Branch (213:9): [True: 0, False: 2.75k]
  ------------------
  214|      0|        DWARF_DBG_ERROR(dbg, duperr, DW_DLV_ERROR);
  ------------------
  |  |   43|      0|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
  215|      0|    }
  216|  2.75k|    if (doas->as_size == 0) {
  ------------------
  |  Branch (216:9): [True: 322, False: 2.42k]
  ------------------
  217|       |        /*  As of 2018 it seems impossible to detect
  218|       |            (via dwarfdump) whether emptyerr has any
  219|       |            practical effect, whether TRUE or FALSE.  */
  220|    322|        if (emptyerr == 0 ) {
  ------------------
  |  Branch (220:13): [True: 300, False: 22]
  ------------------
  221|       |            /*  Allow empty section. */
  222|    300|            return DW_DLV_OK;
  ------------------
  |  |  122|    300|#define DW_DLV_OK        0
  ------------------
  223|    300|        }
  224|       |        /* Know no reason to allow section */
  225|    322|        DWARF_DBG_ERROR(dbg, emptyerr, DW_DLV_ERROR);
  ------------------
  |  |   43|     22|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
  226|      0|    }
  227|  2.42k|    secdata->dss_index = section_index;
  228|  2.42k|    secdata->dss_size  = doas->as_size;
  229|  2.42k|    secdata->dss_group_number = group_number;
  230|  2.42k|    secdata->dss_addr  = doas->as_addr;
  231|  2.42k|    secdata->dss_link  = doas->as_link;
  232|  2.42k|    secdata->dss_flags = doas->as_flags;
  233|  2.42k|    if (secdata->dss_flags & SHF_COMPRESSED) {
  ------------------
  |  |   92|  2.42k|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (233:9): [True: 155, False: 2.27k]
  ------------------
  234|    155|        secdata->dss_shf_compressed = TRUE;
  ------------------
  |  |   33|    155|#define TRUE 1
  ------------------
  235|    155|    }
  236|  2.42k|    secdata->dss_entrysize = doas->as_entrysize;
  237|  2.42k|    secdata->dss_addralign = doas->as_addralign;
  238|  2.42k|    return DW_DLV_OK;
  ------------------
  |  |  122|  2.42k|#define DW_DLV_OK        0
  ------------------
  239|  2.75k|}
dwarf_init_finish.c:add_relx_data_to_secdata:
  246|    518|{
  247|    518|    secdata->dss_reloc_index = section_index;
  248|    518|    secdata->dss_reloc_size = doas->as_size;
  249|    518|    secdata->dss_reloc_entrysize = doas->as_entrysize;
  250|    518|    secdata->dss_reloc_addr = doas->as_addr;
  251|    518|    secdata->dss_reloc_symtab = doas->as_link;
  252|    518|    secdata->dss_reloc_link = doas->as_link;
  253|    518|    secdata->dss_is_rela = (char)is_rela;
  254|    518|}
dwarf_init_finish.c:load_debugfission_tables:
  999|  1.60k|{
 1000|  1.60k|    int i = 0;
 1001|  1.60k|    if (dbg->de_debug_cu_index.dss_size ==0 &&
  ------------------
  |  Branch (1001:9): [True: 1.22k, False: 380]
  ------------------
 1002|  1.22k|        dbg->de_debug_tu_index.dss_size ==0) {
  ------------------
  |  Branch (1002:9): [True: 1.04k, False: 177]
  ------------------
 1003|       |        /*  This is the normal case.
 1004|       |            No debug fission. Not a .dwp object. */
 1005|  1.04k|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|  1.04k|#define DW_DLV_NO_ENTRY -1
  ------------------
 1006|  1.04k|    }
 1007|       |
 1008|    772|    for (i = 0; i < 2; ++i) {
  ------------------
  |  Branch (1008:17): [True: 746, False: 26]
  ------------------
 1009|    746|        Dwarf_Xu_Index_Header xuptr = 0;
 1010|    746|        struct Dwarf_Section_s* dwsect = 0;
 1011|    746|        Dwarf_Unsigned version = 0;
 1012|    746|        Dwarf_Unsigned number_of_cols /* L */ = 0;
 1013|    746|        Dwarf_Unsigned number_of_CUs /* N */ = 0;
 1014|    746|        Dwarf_Unsigned number_of_slots /* M */ = 0;
 1015|    746|        const char *secname = 0;
 1016|    746|        int res = 0;
 1017|    746|        const char *type = 0;
 1018|       |
 1019|    746|        if (i == 0) {
  ------------------
  |  Branch (1019:13): [True: 557, False: 189]
  ------------------
 1020|    557|            dwsect = &dbg->de_debug_cu_index;
 1021|    557|            type = "cu";
 1022|    557|        } else {
 1023|    189|            dwsect = &dbg->de_debug_tu_index;
 1024|    189|            type = "tu";
 1025|    189|        }
 1026|    746|        if ( !dwsect->dss_size ) {
  ------------------
  |  Branch (1026:14): [True: 187, False: 559]
  ------------------
 1027|    187|            continue;
 1028|    187|        }
 1029|    559|        res = dwarf_get_xu_index_header(dbg,type,
 1030|    559|            &xuptr,&version,&number_of_cols,
 1031|    559|            &number_of_CUs,&number_of_slots,
 1032|    559|            &secname,error);
 1033|    559|        if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|    559|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (1033:13): [True: 1, False: 558]
  ------------------
 1034|      1|            continue;
 1035|      1|        }
 1036|    558|        if (res != DW_DLV_OK) {
  ------------------
  |  |  122|    558|#define DW_DLV_OK        0
  ------------------
  |  Branch (1036:13): [True: 531, False: 27]
  ------------------
 1037|    531|            return res;
 1038|    531|        }
 1039|     27|        if (i == 0) {
  ------------------
  |  Branch (1039:13): [True: 11, False: 16]
  ------------------
 1040|     11|            dbg->de_cu_hashindex_data = xuptr;
 1041|     16|        } else {
 1042|     16|            dbg->de_tu_hashindex_data = xuptr;
 1043|     16|        }
 1044|     27|    }
 1045|     26|    return DW_DLV_OK;
  ------------------
  |  |  122|     26|#define DW_DLV_OK        0
  ------------------
 1046|    557|}

_dwarf_dealloc_loclists_context:
  674|  3.37k|{
  675|  3.37k|    Dwarf_Unsigned i = 0;
  676|  3.37k|    Dwarf_Loclists_Context * loccon = 0;
  677|       |
  678|  3.37k|    if (!dbg->de_loclists_context) {
  ------------------
  |  Branch (678:9): [True: 3.37k, False: 0]
  ------------------
  679|  3.37k|        return;
  680|  3.37k|    }
  681|      0|    loccon = dbg->de_loclists_context;
  682|      0|    for ( ; i < dbg->de_loclists_context_count; ++i) {
  ------------------
  |  Branch (682:13): [True: 0, False: 0]
  ------------------
  683|      0|        Dwarf_Loclists_Context con = loccon[i];
  684|      0|        free_loclists_context(con);
  685|      0|        loccon[i] = 0;
  686|      0|    }
  687|      0|    free(dbg->de_loclists_context);
  688|      0|    dbg->de_loclists_context = 0;
  689|      0|    dbg->de_loclists_context_count = 0;
  690|      0|}

_dwarf_not_ascii:
  131|  55.8k|{
  132|  55.8k|    unsigned char *cp = (unsigned char *)s;
  133|   315k|    for (  ; *cp ; ++cp) {
  ------------------
  |  Branch (133:14): [True: 259k, False: 55.8k]
  ------------------
  134|   259k|        if (*cp < 0x20 || *cp > 0x7e) {
  ------------------
  |  Branch (134:13): [True: 12, False: 259k]
  |  Branch (134:27): [True: 34, False: 259k]
  ------------------
  135|     46|            return TRUE;
  ------------------
  |  |   33|     46|#define TRUE 1
  ------------------
  136|     46|        }
  137|   259k|    }
  138|  55.8k|    return FALSE;
  ------------------
  |  |   36|  55.8k|#define FALSE 0
  ------------------
  139|  55.8k|}
_dwarf_load_macho_header:
  407|  2.07k|{
  408|  2.07k|    int res = 0;
  409|       |
  410|  2.07k|    if (mfp->mo_offsetsize == 32) {
  ------------------
  |  Branch (410:9): [True: 1.24k, False: 829]
  ------------------
  411|  1.24k|        res = load_macho_header32(mfp,errcode);
  412|  1.24k|    } else if (mfp->mo_offsetsize == 64) {
  ------------------
  |  Branch (412:16): [True: 829, False: 0]
  ------------------
  413|    829|        res = _dwarf_load_macho_header64(mfp,errcode);
  414|    829|    } else {
  415|      0|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|      0|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
  416|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  417|      0|    }
  418|  2.07k|    return res;
  419|  2.07k|}
_dwarf_load_macho_commands:
  785|  1.92k|{
  786|  1.92k|    Dwarf_Unsigned cmdi = 0;
  787|  1.92k|    Dwarf_Unsigned curoff = mfp->mo_command_start_offset;
  788|  1.92k|    struct load_command mc;
  789|  1.92k|    struct generic_macho_command *mcp = 0;
  790|  1.92k|    unsigned segment_command_count = 0;
  791|  1.92k|    int res = 0;
  792|  1.92k|    Dwarf_Unsigned inner = mfp->mo_inner_offset;
  793|  1.92k|    Dwarf_Unsigned commandsizetotal = 0;
  794|       |
  795|  1.92k|    if (mfp->mo_command_count >= mfp->mo_filesize) {
  ------------------
  |  Branch (795:9): [True: 37, False: 1.88k]
  ------------------
  796|       |        /* corrupt object. */
  797|     37|        *errcode = DW_DLE_MACH_O_SEGOFFSET_BAD;
  ------------------
  |  | 1462|     37|#define DW_DLE_MACH_O_SEGOFFSET_BAD            416
  ------------------
  798|     37|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     37|#define DW_DLV_ERROR      1
  ------------------
  799|     37|    }
  800|  1.88k|    if ((curoff + mfp->mo_command_count * sizeof(mc)) >=
  ------------------
  |  Branch (800:9): [True: 22, False: 1.86k]
  ------------------
  801|  1.88k|        mfp->mo_filesize) {
  802|       |        /* corrupt object. */
  803|     22|        *errcode = DW_DLE_MACH_O_SEGOFFSET_BAD;
  ------------------
  |  | 1462|     22|#define DW_DLE_MACH_O_SEGOFFSET_BAD            416
  ------------------
  804|     22|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     22|#define DW_DLV_ERROR      1
  ------------------
  805|     22|    }
  806|       |
  807|  1.86k|    mfp->mo_commands = (struct generic_macho_command *) calloc(
  808|  1.86k|        mfp->mo_command_count,sizeof(struct generic_macho_command));
  809|  1.86k|    if (!mfp->mo_commands) {
  ------------------
  |  Branch (809:9): [True: 0, False: 1.86k]
  ------------------
  810|       |        /* out of memory */
  811|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  812|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  813|      0|    }
  814|  1.86k|    mcp = mfp->mo_commands;
  815|   590k|    for ( ; cmdi < mfp->mo_header.ncmds; ++cmdi,++mcp ) {
  ------------------
  |  Branch (815:13): [True: 589k, False: 1.79k]
  ------------------
  816|   589k|        res = RRMOA(mfp->mo_fd, &mc,
  ------------------
  |  |   65|   589k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|   589k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  817|   589k|            inner+curoff, sizeof(mc),
  818|   589k|            inner+mfp->mo_filesize, errcode);
  819|   589k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|   589k|#define DW_DLV_OK         0
  ------------------
  |  Branch (819:13): [True: 3, False: 589k]
  ------------------
  820|      3|            free(mfp->mo_commands);
  821|      3|            mfp->mo_commands = 0;
  822|      3|            return res;
  823|      3|        }
  824|   589k|        ASNAR(mfp->mo_copy_word,mcp->cmd,mc.cmd);
  ------------------
  |  |   53|   589k|    do {                                        \
  |  |   54|   589k|        (t) = 0;                                \
  |  |   55|   589k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   589k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 589k]
  |  |  ------------------
  ------------------
  825|   589k|        ASNAR(mfp->mo_copy_word,mcp->cmdsize,mc.cmdsize);
  ------------------
  |  |   53|   589k|    do {                                        \
  |  |   54|   589k|        (t) = 0;                                \
  |  |   55|   589k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   589k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 589k]
  |  |  ------------------
  ------------------
  826|   589k|        commandsizetotal += mcp->cmdsize;
  827|   589k|        mcp->offset_this_command = curoff;
  828|   589k|        curoff += mcp->cmdsize;
  829|   589k|        if (mcp->cmdsize > mfp->mo_filesize ||
  ------------------
  |  Branch (829:13): [True: 50, False: 589k]
  ------------------
  830|   589k|            curoff > mfp->mo_filesize) {
  ------------------
  |  Branch (830:13): [True: 20, False: 589k]
  ------------------
  831|       |            /* corrupt object */
  832|     70|            free(mfp->mo_commands);
  833|     70|            mfp->mo_commands = 0;
  834|     70|            *errcode = DW_DLE_FILE_OFFSET_BAD;
  ------------------
  |  | 1463|     70|#define DW_DLE_FILE_OFFSET_BAD                 417
  ------------------
  835|     70|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     70|#define DW_DLV_ERROR      1
  ------------------
  836|     70|        }
  837|   589k|        if (mcp->cmd == LC_SEGMENT || mcp->cmd == LC_SEGMENT_64) {
  ------------------
  |  |  360|  1.17M|#define LC_SEGMENT    0x1    /* segment of this file to be mapped */
  ------------------
                      if (mcp->cmd == LC_SEGMENT || mcp->cmd == LC_SEGMENT_64) {
  ------------------
  |  |  407|   300k|#define    LC_SEGMENT_64    0x19
  ------------------
  |  Branch (837:13): [True: 288k, False: 300k]
  |  Branch (837:39): [True: 202k, False: 97.7k]
  ------------------
  838|   491k|            segment_command_count++;
  839|   491k|        }
  840|   589k|    }
  841|  1.79k|    mfp->mo_segment_count = segment_command_count;
  842|  1.79k|    mfp->mo_segment_size_total = commandsizetotal;
  843|  1.79k|    res = _dwarf_macho_load_segment_commands(mfp,errcode);
  844|  1.79k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.79k|#define DW_DLV_OK         0
  ------------------
  |  Branch (844:9): [True: 519, False: 1.27k]
  ------------------
  845|    519|        free(mfp->mo_commands);
  846|    519|        mfp->mo_commands = 0;
  847|    519|        return res;
  848|    519|    }
  849|  1.27k|    res = _dwarf_macho_load_dwarf_sections(mfp,errcode);
  850|  1.27k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.27k|#define DW_DLV_OK         0
  ------------------
  |  Branch (850:9): [True: 682, False: 589]
  ------------------
  851|    682|        free(mfp->mo_commands);
  852|    682|        mfp->mo_commands = 0;
  853|    682|    }
  854|  1.27k|    return res;
  855|  1.79k|}
_dwarf_macho_setup:
  868|  2.54k|{
  869|  2.54k|    Dwarf_Obj_Access_Interface_a *binary_interface = 0;
  870|  2.54k|    dwarf_macho_object_access_internals_t *intfc = 0;
  871|  2.54k|    int res = DW_DLV_OK;
  ------------------
  |  |   59|  2.54k|#define DW_DLV_OK         0
  ------------------
  872|  2.54k|    int localerrnum = 0;
  873|  2.54k|    unsigned universalbinary_count = 0;
  874|       |
  875|  2.54k|    res = _dwarf_macho_object_access_init(
  876|  2.54k|        fd,
  877|  2.54k|        universalnumber,
  878|  2.54k|        ftype,endian,offsetsize,
  879|  2.54k|        &universalbinary_count,
  880|  2.54k|        filesize,
  881|  2.54k|        &binary_interface,
  882|  2.54k|        &localerrnum);
  883|  2.54k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.54k|#define DW_DLV_OK         0
  ------------------
  |  Branch (883:9): [True: 1.95k, False: 589]
  ------------------
  884|  1.95k|        if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |   58|  1.95k|#define DW_DLV_NO_ENTRY  -1
  ------------------
  |  Branch (884:13): [True: 22, False: 1.93k]
  ------------------
  885|     22|            return res;
  886|     22|        }
  887|  1.93k|        _dwarf_error(NULL, error, localerrnum);
  888|  1.93k|        return DW_DLV_ERROR;
  ------------------
  |  |   60|  1.93k|#define DW_DLV_ERROR      1
  ------------------
  889|  1.95k|    }
  890|       |    /*  allocates and initializes Dwarf_Debug,
  891|       |        generic code */
  892|    589|    res = dwarf_object_init_b(binary_interface, errhand, errarg,
  893|    589|        groupnumber, dbg, error);
  894|    589|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|    589|#define DW_DLV_OK         0
  ------------------
  |  Branch (894:9): [True: 381, False: 208]
  ------------------
  895|    381|        _dwarf_destruct_macho_access(binary_interface);
  896|    381|        return res;
  897|    381|    }
  898|    208|    intfc = binary_interface->ai_object;
  899|    208|    intfc->mo_path = strdup(true_path);
  900|    208|    (*dbg)->de_obj_flags = intfc->mo_flags;
  901|    208|    (*dbg)->de_obj_machine = intfc->mo_machine;
  902|    208|    (*dbg)->de_universalbinary_index = universalnumber;
  903|    208|    (*dbg)->de_universalbinary_count = universalbinary_count;
  904|    208|    return res;
  905|    589|}
_dwarf_dealloc_universal_head:
 1372|     94|{
 1373|     94|    if (!dw_head) {
  ------------------
  |  Branch (1373:9): [True: 0, False: 94]
  ------------------
 1374|      0|        return;
 1375|      0|    }
 1376|     94|    free(dw_head->au_arches);
 1377|     94|    dw_head->au_arches = 0;
 1378|     94|    free(dw_head);
 1379|     94|}
dwarf_machoread.c:load_macho_header32:
  367|  1.24k|{
  368|  1.24k|    struct mach_header mh32;
  369|  1.24k|    int res = 0;
  370|  1.24k|    Dwarf_Unsigned inner = mfp->mo_inner_offset;
  371|       |
  372|  1.24k|    if (sizeof(mh32) > mfp->mo_filesize) {
  ------------------
  |  Branch (372:9): [True: 17, False: 1.22k]
  ------------------
  373|     17|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     17|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  374|     17|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     17|#define DW_DLV_ERROR      1
  ------------------
  375|     17|    }
  376|  1.22k|    res = RRMOA(mfp->mo_fd, &mh32, inner, sizeof(mh32),
  ------------------
  |  |   65|  1.22k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  1.22k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  377|  1.22k|        (inner+mfp->mo_filesize), errcode);
  378|  1.22k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.22k|#define DW_DLV_OK         0
  ------------------
  |  Branch (378:9): [True: 0, False: 1.22k]
  ------------------
  379|      0|        return res;
  380|      0|    }
  381|       |    /* Do not adjust endianness of magic, leave as-is. */
  382|  1.22k|    ASNAR(memcpy,mfp->mo_header.magic,mh32.magic);
  ------------------
  |  |   53|  1.22k|    do {                                        \
  |  |   54|  1.22k|        (t) = 0;                                \
  |  |   55|  1.22k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.22k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.22k]
  |  |  ------------------
  ------------------
  383|  1.22k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.cputype,mh32.cputype);
  ------------------
  |  |   53|  1.22k|    do {                                        \
  |  |   54|  1.22k|        (t) = 0;                                \
  |  |   55|  1.22k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.22k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.22k]
  |  |  ------------------
  ------------------
  384|  1.22k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.cpusubtype,
  ------------------
  |  |   53|  1.22k|    do {                                        \
  |  |   54|  1.22k|        (t) = 0;                                \
  |  |   55|  1.22k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.22k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.22k]
  |  |  ------------------
  ------------------
  385|  1.22k|        mh32.cpusubtype);
  386|  1.22k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.filetype,mh32.filetype);
  ------------------
  |  |   53|  1.22k|    do {                                        \
  |  |   54|  1.22k|        (t) = 0;                                \
  |  |   55|  1.22k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.22k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.22k]
  |  |  ------------------
  ------------------
  387|  1.22k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.ncmds,mh32.ncmds);
  ------------------
  |  |   53|  1.22k|    do {                                        \
  |  |   54|  1.22k|        (t) = 0;                                \
  |  |   55|  1.22k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.22k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.22k]
  |  |  ------------------
  ------------------
  388|  1.22k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.sizeofcmds,
  ------------------
  |  |   53|  1.22k|    do {                                        \
  |  |   54|  1.22k|        (t) = 0;                                \
  |  |   55|  1.22k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.22k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.22k]
  |  |  ------------------
  ------------------
  389|  1.22k|        mh32.sizeofcmds);
  390|  1.22k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.flags,mh32.flags);
  ------------------
  |  |   53|  1.22k|    do {                                        \
  |  |   54|  1.22k|        (t) = 0;                                \
  |  |   55|  1.22k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.22k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.22k]
  |  |  ------------------
  ------------------
  391|  1.22k|    mfp->mo_header.reserved = 0;
  392|  1.22k|    mfp->mo_command_count = (unsigned int)mfp->mo_header.ncmds;
  393|  1.22k|    if (mfp->mo_header.sizeofcmds >= mfp->mo_filesize ||
  ------------------
  |  Branch (393:9): [True: 57, False: 1.17k]
  ------------------
  394|  1.17k|        mfp->mo_header.sizeofcmds >= MAX_COMMANDS_SIZE ) {
  ------------------
  |  |   42|  1.17k|#define MAX_COMMANDS_SIZE  30000
  ------------------
  |  Branch (394:9): [True: 1, False: 1.17k]
  ------------------
  395|     58|        *errcode = DW_DLE_MACHO_CORRUPT_HEADER;
  ------------------
  |  | 1532|     58|#define DW_DLE_MACHO_CORRUPT_HEADER            486
  ------------------
  396|     58|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     58|#define DW_DLV_ERROR      1
  ------------------
  397|     58|    }
  398|  1.17k|    mfp->mo_machine = mfp->mo_header.cputype;
  399|  1.17k|    mfp->mo_flags = mfp->mo_header.flags;
  400|  1.17k|    mfp->mo_command_start_offset = sizeof(mh32);
  401|  1.17k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.17k|#define DW_DLV_OK         0
  ------------------
  402|  1.22k|}
dwarf_machoread.c:_dwarf_macho_load_segment_commands:
  493|  1.79k|{
  494|  1.79k|    Dwarf_Unsigned i = 0;
  495|  1.79k|    Dwarf_Unsigned segtotsize = 0;
  496|  1.79k|    int            res = 0;
  497|  1.79k|    struct generic_macho_command *mmp = 0;
  498|  1.79k|    struct generic_macho_segment_command *msp = 0;
  499|       |
  500|  1.79k|    if (mfp->mo_segment_count < 1) {
  ------------------
  |  Branch (500:9): [True: 115, False: 1.67k]
  ------------------
  501|    115|        return DW_DLV_OK;
  ------------------
  |  |   59|    115|#define DW_DLV_OK         0
  ------------------
  502|    115|    }
  503|  1.67k|    res = _dwarf_uint64_mult(mfp->mo_segment_count,
  504|  1.67k|        sizeof(struct generic_macho_segment_command),
  505|  1.67k|        &segtotsize);
  506|  1.67k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  1.67k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (506:9): [True: 0, False: 1.67k]
  ------------------
  507|      0|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|      0|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  508|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  509|      0|    }
  510|       |
  511|  1.67k|    mfp->mo_segment_commands =
  512|  1.67k|        (struct generic_macho_segment_command *)
  513|  1.67k|        calloc(1, segtotsize);
  514|  1.67k|    if (!mfp->mo_segment_commands) {
  ------------------
  |  Branch (514:9): [True: 0, False: 1.67k]
  ------------------
  515|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  516|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  517|      0|    }
  518|       |
  519|  1.67k|    mmp = mfp->mo_commands;
  520|  1.67k|    msp = mfp->mo_segment_commands;
  521|       |
  522|       |    /*  This is a heuristic sanity check for a badly
  523|       |        damaged object.
  524|       |        See dwarfbug DW202412-009. */
  525|  1.67k|    if ( mfp->mo_header.sizeofcmds > MAX_COMMANDS_SIZE) {
  ------------------
  |  |   42|  1.67k|#define MAX_COMMANDS_SIZE  30000
  ------------------
  |  Branch (525:10): [True: 0, False: 1.67k]
  ------------------
  526|      0|        *errcode = DW_DLE_MACHO_SEGMENT_COUNT_HEURISTIC_FAIL;
  ------------------
  |  | 1553|      0|#define DW_DLE_MACHO_SEGMENT_COUNT_HEURISTIC_FAIL 507
  ------------------
  527|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  528|      0|    }
  529|   558k|    for (i = 0 ; i < mfp->mo_command_count; ++i,++mmp) {
  ------------------
  |  Branch (529:18): [True: 557k, False: 1.15k]
  ------------------
  530|   557k|        unsigned cmd = (unsigned)mmp->cmd;
  531|       |
  532|   557k|        if (cmd == LC_SEGMENT) {
  ------------------
  |  |  360|   557k|#define LC_SEGMENT    0x1    /* segment of this file to be mapped */
  ------------------
  |  Branch (532:13): [True: 288k, False: 269k]
  ------------------
  533|   288k|            res = load_segment_command_content32(mfp,mmp,msp,
  534|   288k|                i,errcode);
  535|   288k|            ++msp;
  536|   288k|        } else if (cmd == LC_SEGMENT_64) {
  ------------------
  |  |  407|   269k|#define    LC_SEGMENT_64    0x19
  ------------------
  |  Branch (536:20): [True: 201k, False: 67.7k]
  ------------------
  537|   201k|            res = _dwarf_load_segment_command_content64(mfp,mmp,msp,
  538|   201k|                i,errcode);
  539|   201k|            ++msp;
  540|   201k|        } else { /* fall through, not a command of interest */ }
  541|   557k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|   557k|#define DW_DLV_OK         0
  ------------------
  |  Branch (541:13): [True: 519, False: 556k]
  ------------------
  542|    519|            free(mfp->mo_segment_commands);
  543|    519|            mfp->mo_segment_commands = 0;
  544|    519|            return res;
  545|    519|        }
  546|   557k|    }
  547|  1.15k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.15k|#define DW_DLV_OK         0
  ------------------
  548|  1.67k|}
dwarf_machoread.c:load_segment_command_content32:
  428|   288k|{
  429|   288k|    struct segment_command sc;
  430|   288k|    int res = 0;
  431|   288k|    Dwarf_Unsigned filesize = mfp->mo_filesize;
  432|   288k|    Dwarf_Unsigned segoffset = mmp->offset_this_command;
  433|   288k|    Dwarf_Unsigned afterseghdr = segoffset + sizeof(sc);
  434|   288k|    Dwarf_Unsigned inner = mfp->mo_inner_offset;
  435|   288k|    Dwarf_Unsigned fulloffset = mfp->mo_inner_offset;
  436|       |
  437|   288k|    if (segoffset > filesize ||
  ------------------
  |  Branch (437:9): [True: 0, False: 288k]
  ------------------
  438|   288k|        mmp->cmdsize > filesize ||
  ------------------
  |  Branch (438:9): [True: 0, False: 288k]
  ------------------
  439|   288k|        (mmp->cmdsize + segoffset) > filesize ) {
  ------------------
  |  Branch (439:9): [True: 0, False: 288k]
  ------------------
  440|      0|        *errcode = DW_DLE_MACH_O_SEGOFFSET_BAD;
  ------------------
  |  | 1462|      0|#define DW_DLE_MACH_O_SEGOFFSET_BAD            416
  ------------------
  441|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  442|      0|    }
  443|   288k|    fulloffset = segoffset+inner;
  444|   288k|    if (fulloffset <segoffset || fulloffset < inner) { 
  ------------------
  |  Branch (444:9): [True: 0, False: 288k]
  |  Branch (444:34): [True: 0, False: 288k]
  ------------------
  445|       |        /* overflow */
  446|      0|        *errcode = DW_DLE_ARITHMETIC_OVERFLOW;
  ------------------
  |  | 1547|      0|#define DW_DLE_ARITHMETIC_OVERFLOW             501
  ------------------
  447|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  448|      0|    }
  449|   288k|    if (afterseghdr > filesize ) {
  ------------------
  |  Branch (449:9): [True: 65, False: 288k]
  ------------------
  450|     65|        *errcode = DW_DLE_MACH_O_SEGOFFSET_BAD;
  ------------------
  |  | 1462|     65|#define DW_DLE_MACH_O_SEGOFFSET_BAD            416
  ------------------
  451|     65|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     65|#define DW_DLV_ERROR      1
  ------------------
  452|     65|    }
  453|   288k|    res = RRMOA(mfp->mo_fd, &sc, (inner+segoffset),
  ------------------
  |  |   65|   288k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|   288k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  454|   288k|        sizeof(sc), (inner+filesize), errcode);
  455|   288k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|   288k|#define DW_DLV_OK         0
  ------------------
  |  Branch (455:9): [True: 0, False: 288k]
  ------------------
  456|      0|        return res;
  457|      0|    }
  458|   288k|    ASNAR(mfp->mo_copy_word,msp->cmd,sc.cmd);
  ------------------
  |  |   53|   288k|    do {                                        \
  |  |   54|   288k|        (t) = 0;                                \
  |  |   55|   288k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   288k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 288k]
  |  |  ------------------
  ------------------
  459|   288k|    ASNAR(mfp->mo_copy_word,msp->cmdsize,sc.cmdsize);
  ------------------
  |  |   53|   288k|    do {                                        \
  |  |   54|   288k|        (t) = 0;                                \
  |  |   55|   288k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   288k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 288k]
  |  |  ------------------
  ------------------
  460|   288k|    _dwarf_safe_strcpy(msp->segname,sizeof(msp->segname),
  461|   288k|        sc.segname,sizeof(sc.segname));
  462|   288k|    ASNAR(mfp->mo_copy_word,msp->vmaddr,sc.vmaddr);
  ------------------
  |  |   53|   288k|    do {                                        \
  |  |   54|   288k|        (t) = 0;                                \
  |  |   55|   288k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   288k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 288k]
  |  |  ------------------
  ------------------
  463|   288k|    ASNAR(mfp->mo_copy_word,msp->vmsize,sc.vmsize);
  ------------------
  |  |   53|   288k|    do {                                        \
  |  |   54|   288k|        (t) = 0;                                \
  |  |   55|   288k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   288k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 288k]
  |  |  ------------------
  ------------------
  464|   288k|    ASNAR(mfp->mo_copy_word,msp->fileoff,sc.fileoff);
  ------------------
  |  |   53|   288k|    do {                                        \
  |  |   54|   288k|        (t) = 0;                                \
  |  |   55|   288k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   288k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 288k]
  |  |  ------------------
  ------------------
  465|   288k|    ASNAR(mfp->mo_copy_word,msp->filesize,sc.filesize);
  ------------------
  |  |   53|   288k|    do {                                        \
  |  |   54|   288k|        (t) = 0;                                \
  |  |   55|   288k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   288k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 288k]
  |  |  ------------------
  ------------------
  466|   288k|    if (msp->fileoff > mfp->mo_filesize ||
  ------------------
  |  Branch (466:9): [True: 48, False: 288k]
  ------------------
  467|   288k|        msp->filesize > mfp->mo_filesize) {
  ------------------
  |  Branch (467:9): [True: 57, False: 287k]
  ------------------
  468|       |        /* corrupt */
  469|    105|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|    105|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  470|    105|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    105|#define DW_DLV_ERROR      1
  ------------------
  471|    105|    }
  472|   287k|    if ((msp->fileoff+msp->filesize ) > filesize) {
  ------------------
  |  Branch (472:9): [True: 29, False: 287k]
  ------------------
  473|       |        /* corrupt */
  474|     29|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|     29|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  475|     29|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     29|#define DW_DLV_ERROR      1
  ------------------
  476|     29|    }
  477|   287k|    ASNAR(mfp->mo_copy_word,msp->maxprot,sc.maxprot);
  ------------------
  |  |   53|   287k|    do {                                        \
  |  |   54|   287k|        (t) = 0;                                \
  |  |   55|   287k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   287k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 287k]
  |  |  ------------------
  ------------------
  478|   287k|    ASNAR(mfp->mo_copy_word,msp->initprot,sc.initprot);
  ------------------
  |  |   53|   287k|    do {                                        \
  |  |   54|   287k|        (t) = 0;                                \
  |  |   55|   287k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   287k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 287k]
  |  |  ------------------
  ------------------
  479|   287k|    ASNAR(mfp->mo_copy_word,msp->nsects,sc.nsects);
  ------------------
  |  |   53|   287k|    do {                                        \
  |  |   54|   287k|        (t) = 0;                                \
  |  |   55|   287k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   287k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 287k]
  |  |  ------------------
  ------------------
  480|   287k|    if (msp->nsects >= mfp->mo_filesize) {
  ------------------
  |  Branch (480:9): [True: 52, False: 287k]
  ------------------
  481|     52|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|     52|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  482|     52|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     52|#define DW_DLV_ERROR      1
  ------------------
  483|     52|    }
  484|   287k|    ASNAR(mfp->mo_copy_word,msp->flags,sc.flags);
  ------------------
  |  |   53|   287k|    do {                                        \
  |  |   54|   287k|        (t) = 0;                                \
  |  |   55|   287k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   287k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 287k]
  |  |  ------------------
  ------------------
  485|   287k|    msp->macho_command_index = mmpindex;
  486|   287k|    msp->sectionsoffset = afterseghdr;
  487|   287k|    return DW_DLV_OK;
  ------------------
  |  |   59|   287k|#define DW_DLV_OK         0
  ------------------
  488|   287k|}
dwarf_machoread.c:_dwarf_macho_load_dwarf_sections:
  743|  1.27k|{
  744|  1.27k|    Dwarf_Unsigned segi = 0;
  745|  1.27k|    Dwarf_Unsigned ftype = mfp->mo_header.filetype;
  746|       |
  747|  1.27k|    struct generic_macho_segment_command *segp =
  748|  1.27k|        mfp->mo_segment_commands;
  749|  1.27k|    if (ftype != MH_DSYM &&
  ------------------
  |  |  198|  2.54k|#define    MH_DSYM        0xa /* companion file with only debug */
  ------------------
  |  Branch (749:9): [True: 1.04k, False: 227]
  ------------------
  750|  1.04k|        ftype != MH_EXECUTE &&
  ------------------
  |  |  189|  2.31k|#define    MH_EXECUTE    0x2        /* demand paged executable file */
  ------------------
  |  Branch (750:9): [True: 1.01k, False: 25]
  ------------------
  751|  1.01k|        ftype != MH_OBJECT) {
  ------------------
  |  |  188|  1.01k|#define    MH_OBJECT    0x1        /* relocatable object file */
  ------------------
  |  Branch (751:9): [True: 101, False: 918]
  ------------------
  752|       |        /* We do not think it can have DWARF */
  753|    101|        return DW_DLV_OK;
  ------------------
  |  |   59|    101|#define DW_DLV_OK         0
  ------------------
  754|    101|    }
  755|  1.17k|    if (mfp->mo_segment_count > MAX_COMMANDS_SIZE) {
  ------------------
  |  |   42|  1.17k|#define MAX_COMMANDS_SIZE  30000
  ------------------
  |  Branch (755:9): [True: 2, False: 1.16k]
  ------------------
  756|       |        /*  It's really bad, the size is supposed to be size on disk,
  757|       |            so this is a likely silly check. */
  758|      2|        *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      2|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  759|      2|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
  760|      2|    }
  761|  64.1k|    for ( ; segi < mfp->mo_segment_count; ++segi,++segp) {
  ------------------
  |  Branch (761:13): [True: 63.6k, False: 488]
  ------------------
  762|  63.6k|        int res = 0;
  763|  63.6k|        if (0 == strcmp(segp->segname,"__PAGEZERO")) {
  ------------------
  |  Branch (763:13): [True: 585, False: 63.0k]
  ------------------
  764|    585|            continue;
  765|    585|        }
  766|  63.0k|        if (0 ==strcmp(segp->segname,"__LINKEDIT")) {
  ------------------
  |  Branch (766:13): [True: 4.30k, False: 58.7k]
  ------------------
  767|  4.30k|            continue;
  768|  4.30k|        }
  769|  58.7k|        if (0 ==strcmp(segp->segname,"__DATA")) {
  ------------------
  |  Branch (769:13): [True: 219, False: 58.5k]
  ------------------
  770|    219|            continue;
  771|    219|        }
  772|  58.5k|        res = _dwarf_macho_load_dwarf_section_details(mfp,
  773|  58.5k|            segp,segi,errcode);
  774|  58.5k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  58.5k|#define DW_DLV_OK         0
  ------------------
  |  Branch (774:13): [True: 680, False: 57.8k]
  ------------------
  775|    680|            return res;
  776|    680|        }
  777|  58.5k|    }
  778|    488|    return DW_DLV_OK;
  ------------------
  |  |   59|    488|#define DW_DLV_OK         0
  ------------------
  779|  1.16k|}
dwarf_machoread.c:_dwarf_macho_load_dwarf_section_details:
  724|  58.5k|{
  725|  58.5k|    int res = 0;
  726|       |
  727|  58.5k|    if (mfp->mo_offsetsize == 32) {
  ------------------
  |  Branch (727:9): [True: 13.1k, False: 45.4k]
  ------------------
  728|  13.1k|        res = _dwarf_macho_load_dwarf_section_details32(mfp,
  729|  13.1k|            segp,segi,errcode);
  730|  45.4k|    } else if (mfp->mo_offsetsize == 64) {
  ------------------
  |  Branch (730:16): [True: 45.4k, False: 0]
  ------------------
  731|  45.4k|        res = _dwarf_macho_load_dwarf_section_details64(mfp,
  732|  45.4k|            segp,segi,errcode);
  733|  45.4k|    } else {
  734|      0|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|      0|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
  735|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  736|      0|    }
  737|  58.5k|    return res;
  738|  58.5k|}
dwarf_machoread.c:_dwarf_macho_load_dwarf_section_details32:
  555|  13.1k|{
  556|  13.1k|    int res = 0;
  557|  13.1k|    Dwarf_Unsigned seci = 0;
  558|  13.1k|    Dwarf_Unsigned seccount = segp->nsects;
  559|  13.1k|    Dwarf_Unsigned secalloc = seccount+1;
  560|       |
  561|       |    /* offset of sections being added */
  562|  13.1k|    Dwarf_Unsigned curoff = segp->sectionsoffset;
  563|  13.1k|    Dwarf_Unsigned shdrlen = sizeof(struct section);
  564|  13.1k|    Dwarf_Unsigned newcount = 0;
  565|  13.1k|    struct generic_macho_section *secs = 0;
  566|       |
  567|  13.1k|    if (mfp->mo_dwarf_sections) {
  ------------------
  |  Branch (567:9): [True: 12.6k, False: 461]
  ------------------
  568|  12.6k|        Dwarf_Unsigned secssizetot = 0;
  569|  12.6k|        struct generic_macho_section * originalsections =
  570|  12.6k|            mfp->mo_dwarf_sections;
  571|       |
  572|  12.6k|        if (!seccount) {
  ------------------
  |  Branch (572:13): [True: 584, False: 12.0k]
  ------------------
  573|       |            /* No sections. Odd. Unexpected. */
  574|    584|            return DW_DLV_OK;
  ------------------
  |  |   59|    584|#define DW_DLV_OK         0
  ------------------
  575|    584|        }
  576|  12.0k|        newcount = mfp->mo_dwarf_sectioncount + seccount;
  577|  12.0k|        res = _dwarf_uint64_mult(newcount,
  578|  12.0k|            sizeof(struct generic_macho_section),
  579|  12.0k|            &secssizetot);
  580|  12.0k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  12.0k|#define DW_DLV_OK         0
  ------------------
  |  Branch (580:13): [True: 0, False: 12.0k]
  ------------------
  581|       |            /* overflow */
  582|      0|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      0|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  583|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  584|      0|        }
  585|  12.0k|        if (secssizetot > mfp->mo_filesize ) {
  ------------------
  |  Branch (585:13): [True: 62, False: 11.9k]
  ------------------
  586|       |
  587|       |            /*  Really supposed to refer to size on disk, this
  588|       |                is therefore approximate test. */
  589|     62|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|     62|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  590|     62|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     62|#define DW_DLV_ERROR      1
  ------------------
  591|     62|        }
  592|       |
  593|  11.9k|        secs = (struct generic_macho_section *)calloc(
  594|  11.9k|            1,secssizetot);
  595|  11.9k|        if (!secs) {
  ------------------
  |  Branch (595:13): [True: 0, False: 11.9k]
  ------------------
  596|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  597|      0|            return DW_DLV_OK;
  ------------------
  |  |   59|      0|#define DW_DLV_OK         0
  ------------------
  598|      0|        }
  599|  11.9k|        memcpy(secs,mfp->mo_dwarf_sections,
  600|  11.9k|            mfp->mo_dwarf_sectioncount*
  601|  11.9k|            sizeof(struct generic_macho_section));
  602|  11.9k|        mfp->mo_dwarf_sections = secs;
  603|  11.9k|        seci =  mfp->mo_dwarf_sectioncount ;
  604|  11.9k|        mfp->mo_dwarf_sectioncount = newcount;
  605|  11.9k|        free(originalsections);
  606|  11.9k|        secs += seci;
  607|  11.9k|        secs->offset_of_sec_rec = curoff;
  608|  11.9k|        secalloc = newcount;
  609|  11.9k|    } else {
  610|    461|        Dwarf_Unsigned secssizetot = 0;
  611|       |
  612|    461|        newcount = secalloc;
  613|    461|        res = _dwarf_uint64_mult(newcount,
  614|    461|            sizeof(struct generic_macho_section),
  615|    461|            &secssizetot);
  616|    461|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    461|#define DW_DLV_OK         0
  ------------------
  |  Branch (616:13): [True: 0, False: 461]
  ------------------
  617|       |            /* overflow */
  618|      0|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      0|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  619|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  620|      0|        }
  621|    461|        if (secssizetot > mfp->mo_filesize ) {
  ------------------
  |  Branch (621:13): [True: 205, False: 256]
  ------------------
  622|       |            /*  Really supposed to refer to size on disk, this
  623|       |                is therefore approximate sanity test. */
  624|    205|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|    205|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  625|    205|            return DW_DLV_ERROR;
  ------------------
  |  |   60|    205|#define DW_DLV_ERROR      1
  ------------------
  626|    205|        }
  627|    256|        secs = (struct generic_macho_section *)calloc(
  628|    256|            1,secssizetot);
  629|    256|        if (!secs) {
  ------------------
  |  Branch (629:13): [True: 0, False: 256]
  ------------------
  630|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  631|      0|            return DW_DLV_OK;
  ------------------
  |  |   59|      0|#define DW_DLV_OK         0
  ------------------
  632|      0|        }
  633|    256|        mfp->mo_dwarf_sections = secs;
  634|    256|        mfp->mo_dwarf_sectioncount = secalloc;
  635|    256|        secs->offset_of_sec_rec = curoff;
  636|       |        /*  Leave 0 section all zeros except our offset,
  637|       |            elf-like in a sense */
  638|    256|        secs->dwarfsectname = "";
  639|    256|        seci = 1;
  640|    256|        ++secs;
  641|    256|    }
  642|       |
  643|  32.0k|    for (; seci < secalloc; ++seci,++secs,curoff += shdrlen ) {
  ------------------
  |  Branch (643:12): [True: 19.8k, False: 12.1k]
  ------------------
  644|  19.8k|        struct section mosec;
  645|  19.8k|        Dwarf_Unsigned endoffset = 0;
  646|  19.8k|        Dwarf_Unsigned inner = mfp->mo_inner_offset;
  647|  19.8k|        Dwarf_Unsigned offplussize = 0;
  648|  19.8k|        Dwarf_Unsigned innercur = 0;
  649|       |
  650|  19.8k|        endoffset = curoff + sizeof(mosec);
  651|  19.8k|        if (curoff >=  mfp->mo_filesize ||
  ------------------
  |  Branch (651:13): [True: 2, False: 19.8k]
  ------------------
  652|  19.8k|            endoffset > mfp->mo_filesize) {
  ------------------
  |  Branch (652:13): [True: 11, False: 19.8k]
  ------------------
  653|     13|            *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|     13|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  654|     13|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     13|#define DW_DLV_ERROR      1
  ------------------
  655|     13|        }
  656|  19.8k|        innercur = inner+curoff;
  657|  19.8k|        if (innercur < inner || innercur <curoff) {
  ------------------
  |  Branch (657:13): [True: 0, False: 19.8k]
  |  Branch (657:33): [True: 0, False: 19.8k]
  ------------------
  658|       |            /* overflow */
  659|      0|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      0|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  660|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  661|      0|        }
  662|  19.8k|        offplussize = inner+mfp->mo_filesize;
  663|  19.8k|        if (offplussize < inner || offplussize <mfp->mo_filesize) {
  ------------------
  |  Branch (663:13): [True: 0, False: 19.8k]
  |  Branch (663:36): [True: 0, False: 19.8k]
  ------------------
  664|       |            /* overflow */
  665|      0|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      0|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  666|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  667|      0|        }
  668|  19.8k|        res = RRMOA(mfp->mo_fd, &mosec,
  ------------------
  |  |   65|  19.8k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  19.8k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  669|  19.8k|            innercur, sizeof(mosec),
  670|  19.8k|            offplussize, errcode);
  671|  19.8k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  19.8k|#define DW_DLV_OK         0
  ------------------
  |  Branch (671:13): [True: 0, False: 19.8k]
  ------------------
  672|      0|            return res;
  673|      0|        }
  674|  19.8k|        _dwarf_safe_strcpy(secs->sectname,
  675|  19.8k|            sizeof(secs->sectname),
  676|  19.8k|            mosec.sectname,sizeof(mosec.sectname));
  677|  19.8k|        if (_dwarf_not_ascii(secs->sectname) ) {
  ------------------
  |  Branch (677:13): [True: 21, False: 19.8k]
  ------------------
  678|     21|            *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|     21|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  679|     21|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     21|#define DW_DLV_ERROR      1
  ------------------
  680|     21|        }
  681|  19.8k|        _dwarf_safe_strcpy(secs->segname, sizeof(secs->segname),
  682|  19.8k|            mosec.segname,sizeof(mosec.segname));
  683|  19.8k|        ASNAR(mfp->mo_copy_word,secs->addr,mosec.addr);
  ------------------
  |  |   53|  19.8k|    do {                                        \
  |  |   54|  19.8k|        (t) = 0;                                \
  |  |   55|  19.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  19.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 19.8k]
  |  |  ------------------
  ------------------
  684|  19.8k|        ASNAR(mfp->mo_copy_word,secs->size,mosec.size);
  ------------------
  |  |   53|  19.8k|    do {                                        \
  |  |   54|  19.8k|        (t) = 0;                                \
  |  |   55|  19.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  19.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 19.8k]
  |  |  ------------------
  ------------------
  685|  19.8k|        ASNAR(mfp->mo_copy_word,secs->offset,mosec.offset);
  ------------------
  |  |   53|  19.8k|    do {                                        \
  |  |   54|  19.8k|        (t) = 0;                                \
  |  |   55|  19.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  19.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 19.8k]
  |  |  ------------------
  ------------------
  686|  19.8k|        ASNAR(mfp->mo_copy_word,secs->align,mosec.align);
  ------------------
  |  |   53|  19.8k|    do {                                        \
  |  |   54|  19.8k|        (t) = 0;                                \
  |  |   55|  19.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  19.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 19.8k]
  |  |  ------------------
  ------------------
  687|  19.8k|        ASNAR(mfp->mo_copy_word,secs->reloff,mosec.reloff);
  ------------------
  |  |   53|  19.8k|    do {                                        \
  |  |   54|  19.8k|        (t) = 0;                                \
  |  |   55|  19.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  19.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 19.8k]
  |  |  ------------------
  ------------------
  688|  19.8k|        ASNAR(mfp->mo_copy_word,secs->nreloc,mosec.nreloc);
  ------------------
  |  |   53|  19.8k|    do {                                        \
  |  |   54|  19.8k|        (t) = 0;                                \
  |  |   55|  19.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  19.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 19.8k]
  |  |  ------------------
  ------------------
  689|  19.8k|        ASNAR(mfp->mo_copy_word,secs->flags,mosec.flags);
  ------------------
  |  |   53|  19.8k|    do {                                        \
  |  |   54|  19.8k|        (t) = 0;                                \
  |  |   55|  19.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  19.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 19.8k]
  |  |  ------------------
  ------------------
  690|       |        /*offplussize = secs->offset+secs->size; */
  691|  19.8k|        res = _dwarf_uint64_add(secs->offset,secs->size,
  692|  19.8k|            &offplussize);
  693|  19.8k|        if (res == DW_DLV_ERROR){
  ------------------
  |  |   60|  19.8k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (693:13): [True: 0, False: 19.8k]
  ------------------
  694|       |            /* overflow in add */
  695|      0|            *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      0|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  696|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  697|      0|        }
  698|       |        /*  __text section size apparently refers to executable,
  699|       |            not dSYM, so do not check here:
  700|       |            No check for __text.
  701|       |            So all sections in __DWARF checked  */
  702|  19.8k|        if (0 == strcmp(secs->segname,"__DWARF")) {
  ------------------
  |  Branch (702:13): [True: 6.30k, False: 13.5k]
  ------------------
  703|  6.30k|            if (secs->offset > mfp->mo_filesize ||
  ------------------
  |  Branch (703:17): [True: 42, False: 6.25k]
  ------------------
  704|  6.25k|                secs->size > mfp->mo_filesize ||
  ------------------
  |  Branch (704:17): [True: 4, False: 6.25k]
  ------------------
  705|  6.25k|                offplussize > mfp->mo_filesize) {
  ------------------
  |  Branch (705:17): [True: 25, False: 6.22k]
  ------------------
  706|     71|                *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|     71|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  707|     71|                return DW_DLV_ERROR;
  ------------------
  |  |   60|     71|#define DW_DLV_ERROR      1
  ------------------
  708|     71|            }
  709|  6.30k|        }
  710|  19.7k|        secs->reserved1 = 0;
  711|  19.7k|        secs->reserved2 = 0;
  712|  19.7k|        secs->reserved3 = 0;
  713|  19.7k|        secs->generic_segment_num  = segi;
  714|  19.7k|        secs->offset_of_sec_rec = curoff;
  715|  19.7k|    }
  716|  12.1k|    return DW_DLV_OK;
  ------------------
  |  |   59|  12.1k|#define DW_DLV_OK         0
  ------------------
  717|  12.2k|}
dwarf_machoread.c:_dwarf_destruct_macho_access:
  347|    589|{
  348|    589|    struct Dwarf_Obj_Access_Interface_a_s * aip =
  349|    589|        (struct Dwarf_Obj_Access_Interface_a_s *)obj;
  350|       |
  351|    589|    dwarf_macho_object_access_internals_t *mp = 0;
  352|       |
  353|    589|    if (!aip) {
  ------------------
  |  Branch (353:9): [True: 0, False: 589]
  ------------------
  354|      0|        return;
  355|      0|    }
  356|    589|    mp = (dwarf_macho_object_access_internals_t *)aip->ai_object;
  357|    589|    _dwarf_destruct_macho_internals(mp);
  358|    589|    aip->ai_object = 0;
  359|    589|    free(aip);
  360|    589|    return;
  361|    589|}
dwarf_machoread.c:_dwarf_destruct_macho_internals:
  312|  2.54k|{
  313|  2.54k|    Dwarf_Unsigned i = 0;
  314|       |
  315|  2.54k|    if (mp->mo_destruct_close_fd) {
  ------------------
  |  Branch (315:9): [True: 0, False: 2.54k]
  ------------------
  316|      0|        _dwarf_closer(mp->mo_fd);
  317|      0|        mp->mo_fd = -1;
  318|      0|    }
  319|  2.54k|    if (mp->mo_commands){
  ------------------
  |  Branch (319:9): [True: 589, False: 1.95k]
  ------------------
  320|    589|        free(mp->mo_commands);
  321|    589|        mp->mo_commands = 0;
  322|    589|    }
  323|  2.54k|    if (mp->mo_segment_commands){
  ------------------
  |  Branch (323:9): [True: 1.15k, False: 1.39k]
  ------------------
  324|  1.15k|        free(mp->mo_segment_commands);
  325|  1.15k|        mp->mo_segment_commands = 0;
  326|  1.15k|    }
  327|  2.54k|    free((char *)mp->mo_path);
  328|  2.54k|    if (mp->mo_dwarf_sections) {
  ------------------
  |  Branch (328:9): [True: 836, False: 1.71k]
  ------------------
  329|    836|        struct generic_macho_section *sp = 0;
  330|       |
  331|    836|        sp = mp->mo_dwarf_sections;
  332|  60.7k|        for ( i=0; i < mp->mo_dwarf_sectioncount; ++i,++sp) {
  ------------------
  |  Branch (332:20): [True: 59.9k, False: 836]
  ------------------
  333|  59.9k|            if (sp->loaded_data) {
  ------------------
  |  Branch (333:17): [True: 14, False: 59.9k]
  ------------------
  334|     14|                free(sp->loaded_data);
  335|     14|                sp->loaded_data = 0;
  336|     14|            }
  337|  59.9k|        }
  338|    836|        free(mp->mo_dwarf_sections);
  339|    836|        mp->mo_dwarf_sections = 0;
  340|    836|    }
  341|  2.54k|    free(mp);
  342|  2.54k|    return;
  343|  2.54k|}
dwarf_machoread.c:_dwarf_macho_object_access_init:
 1114|  2.54k|{
 1115|  2.54k|    int res = 0;
 1116|  2.54k|    dwarf_macho_object_access_internals_t *internals = 0;
 1117|  2.54k|    Dwarf_Obj_Access_Interface_a *intfc = 0;
 1118|       |
 1119|  2.54k|    internals = malloc(
 1120|  2.54k|        sizeof(dwarf_macho_object_access_internals_t));
 1121|  2.54k|    if (!internals) {
  ------------------
  |  Branch (1121:9): [True: 0, False: 2.54k]
  ------------------
 1122|      0|        *localerrnum = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1123|       |        /* Impossible case, we hope. Give up. */
 1124|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1125|      0|    }
 1126|  2.54k|    memset(internals,0,sizeof(*internals));
 1127|  2.54k|    res = _dwarf_macho_object_access_internals_init(internals,
 1128|  2.54k|        fd,
 1129|  2.54k|        uninumber,
 1130|  2.54k|        ftype, endian, offsetsize,
 1131|  2.54k|        universalbinary_count,
 1132|  2.54k|        filesize,
 1133|  2.54k|        localerrnum);
 1134|  2.54k|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|  2.54k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1134:9): [True: 1.95k, False: 589]
  ------------------
 1135|  1.95k|        _dwarf_destruct_macho_internals(internals);
 1136|  1.95k|        return res;
 1137|  1.95k|    }
 1138|    589|    intfc = malloc(sizeof(Dwarf_Obj_Access_Interface_a));
 1139|    589|    if (!intfc) {
  ------------------
  |  Branch (1139:9): [True: 0, False: 589]
  ------------------
 1140|       |        /* Impossible case, we hope. Give up. */
 1141|      0|        _dwarf_destruct_macho_internals(internals);
 1142|      0|        *localerrnum = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1143|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1144|      0|    }
 1145|       |    /* Initialize the interface struct */
 1146|    589|    intfc->ai_object = internals;
 1147|    589|    intfc->ai_methods = &macho_methods;
 1148|    589|    *binary_interface = intfc;
 1149|    589|    return DW_DLV_OK;
  ------------------
  |  |   59|    589|#define DW_DLV_OK         0
  ------------------
 1150|    589|}
dwarf_machoread.c:_dwarf_macho_object_access_internals_init:
 1006|  2.54k|{
 1007|  2.54k|    Dwarf_Unsigned i  = 0;
 1008|  2.54k|    struct generic_macho_section *sp = 0;
 1009|  2.54k|    int res = 0;
 1010|  2.54k|    unsigned int   ftypei = ftype;
 1011|  2.54k|    unsigned int   endiani = endian;
 1012|  2.54k|    unsigned int   offsetsizei = offsetsize;
 1013|  2.54k|    Dwarf_Unsigned filesizei = filesize;
 1014|  2.54k|    Dwarf_Unsigned fileoffseti = 0;
 1015|  2.54k|    unsigned int unibinarycounti = 0;
 1016|       |
 1017|  2.54k|    if (ftype == DW_FTYPE_APPLEUNIVERSAL) {
  ------------------
  |  |  118|  2.54k|#define DW_FTYPE_APPLEUNIVERSAL    5
  ------------------
  |  Branch (1017:9): [True: 530, False: 2.01k]
  ------------------
 1018|    530|        Dwarf_Unsigned endoffset = 0;
 1019|    530|        res = _dwarf_macho_inner_object_fd(fd,
 1020|    530|            uninumber,
 1021|    530|            filesize,
 1022|    530|            &ftypei,&unibinarycounti,&endiani,
 1023|    530|            &offsetsizei,&fileoffseti,&filesizei,errcode);
 1024|    530|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    530|#define DW_DLV_OK         0
  ------------------
  |  Branch (1024:13): [True: 473, False: 57]
  ------------------
 1025|    473|            return res;
 1026|    473|        }
 1027|       |        /*  At this point filesize is of the entire universal binary
 1028|       |            file, filesizei is size of the uninumber-th macho binary 
 1029|       |            in the overall file. 
 1030|       |            fileoffseti is the offset of the uninumber-th
 1031|       |            macho binary in the overall file */
 1032|     57|        endoffset = fileoffseti+filesizei;
 1033|     57|        if (endoffset < fileoffseti ||
  ------------------
  |  Branch (1033:13): [True: 0, False: 57]
  ------------------
 1034|     57|            endoffset < filesizei) {
  ------------------
  |  Branch (1034:13): [True: 0, False: 57]
  ------------------
 1035|       |            /* overflow */
 1036|      0|            *errcode = DW_DLE_UNIVERSAL_BINARY_ERROR;
  ------------------
  |  | 1548|      0|#define DW_DLE_UNIVERSAL_BINARY_ERROR          502
  ------------------
 1037|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1038|      0|        }
 1039|     57|        *unibinarycount = unibinarycounti;
 1040|     57|        endian = endiani;
 1041|     57|    }
 1042|       |
 1043|  2.07k|    internals->mo_ident[0]    = 'M';
 1044|  2.07k|    internals->mo_ident[1]    = '1';
 1045|  2.07k|    internals->mo_fd          = fd;
 1046|  2.07k|    internals->mo_offsetsize  = offsetsizei;
 1047|  2.07k|    internals->mo_pointersize = offsetsizei;
 1048|  2.07k|    internals->mo_inner_offset  = fileoffseti;
 1049|  2.07k|    internals->mo_filesize    = filesizei;
 1050|  2.07k|    internals->mo_ftype       = ftypei;
 1051|  2.07k|    internals->mo_uninumber   = uninumber;
 1052|  2.07k|    internals->mo_universal_count = unibinarycounti;
 1053|       |
 1054|       |#ifdef WORDS_BIGENDIAN
 1055|       |    if (endian == DW_END_little ) {
 1056|       |        internals->mo_copy_word = _dwarf_memcpy_swap_bytes;
 1057|       |        internals->mo_endian = DW_END_little;
 1058|       |    } else {
 1059|       |        internals->mo_copy_word = _dwarf_memcpy_noswap_bytes;
 1060|       |        internals->mo_endian = DW_END_big;
 1061|       |    }
 1062|       |#else  /* LITTLE ENDIAN */
 1063|  2.07k|    if (endian == DW_END_little ) {
  ------------------
  |  | 1115|  2.07k|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  |  Branch (1063:9): [True: 586, False: 1.48k]
  ------------------
 1064|    586|        internals->mo_copy_word = _dwarf_memcpy_noswap_bytes;
 1065|    586|        internals->mo_endian = DW_END_little;
  ------------------
  |  | 1115|    586|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1066|  1.48k|    } else {
 1067|  1.48k|        internals->mo_copy_word = _dwarf_memcpy_swap_bytes;
 1068|  1.48k|        internals->mo_endian = DW_END_big;
  ------------------
  |  | 1114|  1.48k|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
 1069|  1.48k|    }
 1070|  2.07k|#endif /* LITTLE- BIG-ENDIAN */
 1071|  2.07k|    res = _dwarf_load_macho_header(internals,errcode);
 1072|  2.07k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.07k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1072:9): [True: 152, False: 1.92k]
  ------------------
 1073|    152|        return res;
 1074|    152|    }
 1075|       |    /* Load sections */
 1076|  1.92k|    res = _dwarf_load_macho_commands(internals,errcode);
 1077|  1.92k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.92k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1077:9): [True: 1.33k, False: 589]
  ------------------
 1078|  1.33k|        return res;
 1079|  1.33k|    }
 1080|    589|    if (internals->mo_dwarf_sections) {
  ------------------
  |  Branch (1080:9): [True: 434, False: 155]
  ------------------
 1081|    434|        sp = internals->mo_dwarf_sections+1;
 1082|    434|    } else {
 1083|       |        /*  There are no dwarf sections, but could be .text */
 1084|    155|    }
 1085|  16.3k|    for (i = 1; i < internals->mo_dwarf_sectioncount ; ++i,++sp) {
  ------------------
  |  Branch (1085:17): [True: 15.7k, False: 589]
  ------------------
 1086|  15.7k|        int j = 1;
 1087|  15.7k|        int lim = sizeof(SectionNames)/sizeof(SectionNames[0]);
 1088|  15.7k|        sp->dwarfsectname = "";
 1089|   335k|        for ( ; j < lim; ++j) {
  ------------------
  |  Branch (1089:17): [True: 320k, False: 14.8k]
  ------------------
 1090|   320k|            if (!strcmp(sp->sectname,SectionNames[j].ms_moname)) {
  ------------------
  |  Branch (1090:17): [True: 907, False: 320k]
  ------------------
 1091|    907|                sp->dwarfsectname = SectionNames[j].ms_dwname;
 1092|    907|                break;
 1093|    907|            }
 1094|   320k|        }
 1095|  15.7k|        if (sp->dwarfsectname[0] == 0) {
  ------------------
  |  Branch (1095:13): [True: 14.8k, False: 907]
  ------------------
 1096|       |            /* if not matched, keep the apple section name */
 1097|  14.8k|            sp->dwarfsectname = sp->sectname;
 1098|  14.8k|        }
 1099|  15.7k|    }
 1100|    589|    return DW_DLV_OK;
  ------------------
  |  |   59|    589|#define DW_DLV_OK         0
  ------------------
 1101|  1.92k|}
dwarf_machoread.c:_dwarf_macho_inner_object_fd:
  944|    530|{
  945|    530|    int res = 0;
  946|    530|    Dwarf_Universal_Head  head = 0;
  947|    530|    Dwarf_Unsigned innerbase = 0;
  948|    530|    Dwarf_Unsigned innersize = 0;
  949|       |
  950|    530|    res =  _dwarf_object_detector_universal_head_fd(
  951|    530|        fd, outer_filesize, unibinarycount,
  952|    530|        &head, errcode);
  953|    530|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    530|#define DW_DLV_OK         0
  ------------------
  |  Branch (953:9): [True: 436, False: 94]
  ------------------
  954|    436|        return res;
  955|    436|    }
  956|     94|    if (uninumber >= *unibinarycount) {
  ------------------
  |  Branch (956:9): [True: 4, False: 90]
  ------------------
  957|      4|        *errcode = DW_DLE_UNIVERSAL_BINARY_ERROR;
  ------------------
  |  | 1548|      4|#define DW_DLE_UNIVERSAL_BINARY_ERROR          502
  ------------------
  958|      4|        _dwarf_dealloc_universal_head(head);
  959|      4|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
  960|      4|    }
  961|       |    /*  Now find the precise details of uninumber
  962|       |        instance we want */
  963|       |
  964|     90|    innerbase = head->au_arches[uninumber].au_offset;
  965|     90|    innersize = head->au_arches[uninumber].au_size;
  966|     90|    if (innersize >= outer_filesize ||
  ------------------
  |  Branch (966:9): [True: 0, False: 90]
  ------------------
  967|     90|        innerbase >= outer_filesize) {
  ------------------
  |  Branch (967:9): [True: 0, False: 90]
  ------------------
  968|      0|        *errcode = DW_DLE_UNIVERSAL_BINARY_ERROR;
  ------------------
  |  | 1548|      0|#define DW_DLE_UNIVERSAL_BINARY_ERROR          502
  ------------------
  969|      0|        _dwarf_dealloc_universal_head(head);
  970|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  971|      0|    }
  972|       |    /* Now access inner to return its specs */
  973|     90|    {
  974|       |        /*  But ignore the size this returns!
  975|       |            we determined that above. the following call
  976|       |            does not get the inner size, we got that
  977|       |            just above here! */
  978|     90|        Dwarf_Unsigned fake_size = 0;
  979|       |
  980|     90|        res = _dwarf_object_detector_fd_a(fd,
  981|     90|            ftype,endian,offsetsize,innerbase,&fake_size,
  982|     90|            errcode);
  983|     90|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     90|#define DW_DLV_OK         0
  ------------------
  |  Branch (983:13): [True: 33, False: 57]
  ------------------
  984|     33|            _dwarf_dealloc_universal_head(head);
  985|     33|            return res;
  986|     33|        }
  987|     90|    }
  988|     57|    *fileoffset = innerbase;
  989|     57|    *filesize = innersize;
  990|     57|    _dwarf_dealloc_universal_head(head);
  991|     57|    return DW_DLV_OK;
  ------------------
  |  |   59|     57|#define DW_DLV_OK         0
  ------------------
  992|     90|}
dwarf_machoread.c:_dwarf_object_detector_universal_head_fd:
 1217|    530|{
 1218|    530|    struct Dwarf_Universal_Head_s  duhd;
 1219|    530|    struct Dwarf_Universal_Head_s *duhdp = 0;
 1220|    530|    struct  fat_header fh;
 1221|    530|    int     res = 0;
 1222|    530|    void (*word_swap) (void *, const void *, unsigned long);
 1223|    530|    int     locendian = 0;
 1224|    530|    int     locoffsetsize = 0;
 1225|       |
 1226|    530|    duhd = duhzero;
 1227|    530|    fh = fhzero;
 1228|       |    /*  A universal head is always at offset zero. */
 1229|    530|    duhd.au_filesize = dw_filesize;
 1230|    530|    if (sizeof(fh) >= dw_filesize) {
  ------------------
  |  Branch (1230:9): [True: 0, False: 530]
  ------------------
 1231|      0|        *errcode = DW_DLE_UNIVERSAL_BINARY_ERROR;
  ------------------
  |  | 1548|      0|#define DW_DLE_UNIVERSAL_BINARY_ERROR          502
  ------------------
 1232|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1233|      0|    }
 1234|    530|    res = RRMOA(fd,&fh,0,sizeof(fh), dw_filesize,errcode);
  ------------------
  |  |   65|    530|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    530|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1235|    530|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    530|#define DW_DLV_OK         0
  ------------------
  |  Branch (1235:9): [True: 0, False: 530]
  ------------------
 1236|      0|        return res;
 1237|       |
 1238|      0|    }
 1239|    530|    duhd.au_magic = magic_copy((unsigned char *)&fh.magic[0],4);
 1240|    530|    if (duhd.au_magic == FAT_MAGIC) {
  ------------------
  |  |   84|    530|#define FAT_MAGIC   0xcafebabe
  ------------------
  |  Branch (1240:9): [True: 68, False: 462]
  ------------------
 1241|     68|        locendian = DW_END_big;
  ------------------
  |  | 1114|     68|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
 1242|     68|        locoffsetsize = 32;
 1243|    462|    } else if (duhd.au_magic == FAT_CIGAM) {
  ------------------
  |  |   85|    462|#define FAT_CIGAM   0xbebafeca
  ------------------
  |  Branch (1243:16): [True: 124, False: 338]
  ------------------
 1244|    124|        locendian = DW_END_little;
  ------------------
  |  | 1115|    124|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1245|    124|        locoffsetsize = 32;
 1246|    338|    }else if (duhd.au_magic == FAT_MAGIC_64) {
  ------------------
  |  |   86|    338|#define FAT_MAGIC_64    0xcafebabf
  ------------------
  |  Branch (1246:15): [True: 123, False: 215]
  ------------------
 1247|    123|        locendian = DW_END_big;
  ------------------
  |  | 1114|    123|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
 1248|    123|        locoffsetsize = 64;
 1249|    215|    } else if (duhd.au_magic == FAT_CIGAM_64) {
  ------------------
  |  |   87|    215|#define FAT_CIGAM_64    0xbfbafeca
  ------------------
  |  Branch (1249:16): [True: 215, False: 0]
  ------------------
 1250|    215|        locendian = DW_END_little;
  ------------------
  |  | 1115|    215|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1251|    215|        locoffsetsize = 64;
 1252|    215|    } else {
 1253|      0|        *errcode = DW_DLE_FILE_WRONG_TYPE;
  ------------------
  |  | 1458|      0|#define DW_DLE_FILE_WRONG_TYPE                 412
  ------------------
 1254|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1255|      0|    }
 1256|       |#ifdef WORDS_BIGENDIAN
 1257|       |    if (locendian == DW_END_little) {
 1258|       |        word_swap = _dwarf_memcpy_swap_bytes;
 1259|       |    } else {
 1260|       |        word_swap = _dwarf_memcpy_noswap_bytes;
 1261|       |    }
 1262|       |#else  /* LITTLE ENDIAN */
 1263|    530|    if (locendian == DW_END_little) {
  ------------------
  |  | 1115|    530|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  |  Branch (1263:9): [True: 339, False: 191]
  ------------------
 1264|    339|        word_swap = _dwarf_memcpy_noswap_bytes;
 1265|    339|    } else {
 1266|    191|        word_swap = _dwarf_memcpy_swap_bytes;
 1267|    191|    }
 1268|    530|#endif /* LITTLE- BIG-ENDIAN */
 1269|    530|    ASNAR(word_swap,duhd.au_count,fh.nfat_arch);
  ------------------
  |  |   53|    530|    do {                                        \
  |  |   54|    530|        (t) = 0;                                \
  |  |   55|    530|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    530|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 530]
  |  |  ------------------
  ------------------
 1270|       |    /*  The limit is a first-cut safe heuristic. */
 1271|    530|    if (duhd.au_count >= (dw_filesize/2) ) {
  ------------------
  |  Branch (1271:9): [True: 46, False: 484]
  ------------------
 1272|     46|        *errcode = DW_DLE_UNIVERSAL_BINARY_ERROR ;
  ------------------
  |  | 1548|     46|#define DW_DLE_UNIVERSAL_BINARY_ERROR          502
  ------------------
 1273|     46|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     46|#define DW_DLV_ERROR      1
  ------------------
 1274|     46|    }
 1275|    484|    duhd.au_arches = (struct  Dwarf_Universal_Arch_s*)
 1276|    484|        calloc(duhd.au_count, sizeof(struct Dwarf_Universal_Arch_s));
 1277|    484|    if (!duhd.au_arches) {
  ------------------
  |  Branch (1277:9): [True: 0, False: 484]
  ------------------
 1278|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1279|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1280|      0|    }
 1281|    484|    if (locoffsetsize == 32) {
  ------------------
  |  Branch (1281:9): [True: 173, False: 311]
  ------------------
 1282|    173|        struct fat_arch * fa = 0;
 1283|       |
 1284|    173|        fa = (struct fat_arch *)calloc(duhd.au_count,
 1285|    173|            sizeof(struct fat_arch));
 1286|    173|        if (!fa) {
  ------------------
  |  Branch (1286:13): [True: 0, False: 173]
  ------------------
 1287|      0|            free(duhd.au_arches);
 1288|      0|            duhd.au_arches = 0;
 1289|      0|            free(fa);
 1290|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1291|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1292|      0|        }
 1293|    173|        if (sizeof(fh)+duhd.au_count*sizeof(*fa) >= dw_filesize) {
  ------------------
  |  Branch (1293:13): [True: 20, False: 153]
  ------------------
 1294|     20|            free(duhd.au_arches);
 1295|     20|            duhd.au_arches = 0;
 1296|     20|            free(fa);
 1297|     20|            *errcode = DW_DLE_FILE_OFFSET_BAD;
  ------------------
  |  | 1463|     20|#define DW_DLE_FILE_OFFSET_BAD                 417
  ------------------
 1298|     20|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     20|#define DW_DLV_ERROR      1
  ------------------
 1299|     20|        }
 1300|    153|        res = RRMOA(fd,fa,/*offset=*/sizeof(fh),
  ------------------
  |  |   65|    153|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    153|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1301|    153|            duhd.au_count*sizeof(*fa),
 1302|    153|            dw_filesize,errcode);
 1303|    153|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    153|#define DW_DLV_OK         0
  ------------------
  |  Branch (1303:13): [True: 0, False: 153]
  ------------------
 1304|      0|            free(duhd.au_arches);
 1305|      0|            duhd.au_arches = 0;
 1306|      0|            free(fa);
 1307|      0|            return res;
 1308|      0|        }
 1309|    153|        res = fill_in_uni_arch_32(fa,&duhd,word_swap,
 1310|    153|            errcode);
 1311|    153|        free(fa);
 1312|    153|        fa = 0;
 1313|    153|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    153|#define DW_DLV_OK         0
  ------------------
  |  Branch (1313:13): [True: 106, False: 47]
  ------------------
 1314|    106|            free(duhd.au_arches);
 1315|    106|            duhd.au_arches = 0;
 1316|    106|            return res;
 1317|    106|        }
 1318|    311|    } else { /* 64 */
 1319|    311|        struct fat_arch_64 * fa = 0;
 1320|    311|        fa = (struct fat_arch_64 *)calloc(duhd.au_count,
 1321|    311|            sizeof(struct fat_arch_64));
 1322|    311|        if (!fa) {
  ------------------
  |  Branch (1322:13): [True: 0, False: 311]
  ------------------
 1323|      0|            free(duhd.au_arches);
 1324|      0|            duhd.au_arches = 0;
 1325|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1326|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1327|      0|        }
 1328|    311|        if (sizeof(fh)+duhd.au_count*sizeof(*fa) >= dw_filesize) {
  ------------------
  |  Branch (1328:13): [True: 41, False: 270]
  ------------------
 1329|     41|            free(duhd.au_arches);
 1330|     41|            duhd.au_arches = 0;
 1331|     41|            free(fa);
 1332|     41|            *errcode = DW_DLE_FILE_OFFSET_BAD ;
  ------------------
  |  | 1463|     41|#define DW_DLE_FILE_OFFSET_BAD                 417
  ------------------
 1333|     41|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     41|#define DW_DLV_ERROR      1
  ------------------
 1334|     41|        }
 1335|    270|        res = RRMOA(fd,fa,/*offset*/sizeof(fh),
  ------------------
  |  |   65|    270|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    270|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1336|    270|            duhd.au_count*sizeof(fa),
 1337|    270|            dw_filesize,errcode);
 1338|    270|        if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|    270|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1338:13): [True: 0, False: 270]
  ------------------
 1339|       |            /* *errcode set by RRMOA */
 1340|      0|            free(duhd.au_arches);
 1341|      0|            duhd.au_arches = 0;
 1342|      0|            free(fa);
 1343|      0|            return res;
 1344|      0|        }
 1345|    270|        res = _dwarf_fill_in_uni_arch_64(fa,&duhd,word_swap,
 1346|    270|            errcode);
 1347|    270|        free(fa);
 1348|    270|        fa = 0;
 1349|    270|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    270|#define DW_DLV_OK         0
  ------------------
  |  Branch (1349:13): [True: 223, False: 47]
  ------------------
 1350|    223|            free(duhd.au_arches);
 1351|    223|            duhd.au_arches = 0;
 1352|    223|            return res;
 1353|    223|        }
 1354|    270|    }
 1355|       |
 1356|     94|    duhdp = malloc(sizeof(*duhdp));
 1357|     94|    if (!duhdp) {
  ------------------
  |  Branch (1357:9): [True: 0, False: 94]
  ------------------
 1358|      0|        free(duhd.au_arches);
 1359|      0|        duhd.au_arches = 0;
 1360|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1361|      0|        return res;
 1362|      0|    }
 1363|     94|    memcpy(duhdp,&duhd,sizeof(duhd));
 1364|     94|    *dw_contentcount = (unsigned int)duhd.au_count;
 1365|     94|    duhdp->au_arches = duhd.au_arches;
 1366|     94|    *dw_head = duhdp;
 1367|     94|    return DW_DLV_OK;
  ------------------
  |  |   59|     94|#define DW_DLV_OK         0
  ------------------
 1368|     94|}
dwarf_machoread.c:magic_copy:
 1154|    530|{
 1155|    530|    unsigned i = 0;
 1156|    530|    unsigned long v = 0;
 1157|       |
 1158|    530|    v = d[0];
 1159|  2.12k|    for (i = 1 ; i < len; ++i) {
  ------------------
  |  Branch (1159:18): [True: 1.59k, False: 530]
  ------------------
 1160|  1.59k|        v <<= 8;
 1161|  1.59k|        v |=  d[i];
 1162|  1.59k|    }
 1163|    530|    return v;
 1164|    530|}
dwarf_machoread.c:fill_in_uni_arch_32:
 1175|    153|{
 1176|    153|    Dwarf_Unsigned i = 0;
 1177|    153|    struct Dwarf_Universal_Arch_s * dua = 0;
 1178|       |
 1179|    153|    dua = duhd->au_arches;
 1180|    474|    for ( ; i < duhd->au_count; ++i,++fa,++dua) {
  ------------------
  |  Branch (1180:13): [True: 427, False: 47]
  ------------------
 1181|    427|        ASNAR(word_swap,dua->au_cputype,fa->cputype);
  ------------------
  |  |   53|    427|    do {                                        \
  |  |   54|    427|        (t) = 0;                                \
  |  |   55|    427|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    427|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 427]
  |  |  ------------------
  ------------------
 1182|    427|        ASNAR(word_swap,dua->au_cpusubtype,fa->cpusubtype);
  ------------------
  |  |   53|    427|    do {                                        \
  |  |   54|    427|        (t) = 0;                                \
  |  |   55|    427|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    427|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 427]
  |  |  ------------------
  ------------------
 1183|    427|        ASNAR(word_swap,dua->au_offset,fa->offset);
  ------------------
  |  |   53|    427|    do {                                        \
  |  |   54|    427|        (t) = 0;                                \
  |  |   55|    427|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    427|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 427]
  |  |  ------------------
  ------------------
 1184|    427|        if (dua->au_offset >= duhd->au_filesize) {
  ------------------
  |  Branch (1184:13): [True: 52, False: 375]
  ------------------
 1185|     52|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|     52|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
 1186|     52|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     52|#define DW_DLV_ERROR      1
  ------------------
 1187|     52|        }
 1188|    375|        ASNAR(word_swap,dua->au_size,fa->size);
  ------------------
  |  |   53|    375|    do {                                        \
  |  |   54|    375|        (t) = 0;                                \
  |  |   55|    375|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    375|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 375]
  |  |  ------------------
  ------------------
 1189|    375|        if (dua->au_size >= duhd->au_filesize) {
  ------------------
  |  Branch (1189:13): [True: 7, False: 368]
  ------------------
 1190|      7|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|      7|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
 1191|      7|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      7|#define DW_DLV_ERROR      1
  ------------------
 1192|      7|        }
 1193|    368|        if ((dua->au_size+dua->au_offset) > duhd->au_filesize) {
  ------------------
  |  Branch (1193:13): [True: 16, False: 352]
  ------------------
 1194|     16|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|     16|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
 1195|     16|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     16|#define DW_DLV_ERROR      1
  ------------------
 1196|     16|        }
 1197|       |
 1198|    352|        ASNAR(word_swap,dua->au_align,fa->align);
  ------------------
  |  |   53|    352|    do {                                        \
  |  |   54|    352|        (t) = 0;                                \
  |  |   55|    352|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    352|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 352]
  |  |  ------------------
  ------------------
 1199|    352|        if (dua->au_align >= 32) {
  ------------------
  |  Branch (1199:13): [True: 31, False: 321]
  ------------------
 1200|     31|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|     31|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
 1201|     31|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     31|#define DW_DLV_ERROR      1
  ------------------
 1202|     31|        }
 1203|    321|        dua->au_reserved = 0;
 1204|    321|    }
 1205|     47|    return DW_DLV_OK;
  ------------------
  |  |   59|     47|#define DW_DLV_OK         0
  ------------------
 1206|    153|}
dwarf_machoread.c:macho_get_section_info:
  227|  31.8k|{
  228|  31.8k|    dwarf_macho_object_access_internals_t *macho =
  229|  31.8k|        (dwarf_macho_object_access_internals_t*)(obj);
  230|       |
  231|  31.8k|    (void)error;
  232|  31.8k|    if (section_index < macho->mo_dwarf_sectioncount) {
  ------------------
  |  Branch (232:9): [True: 31.8k, False: 0]
  ------------------
  233|  31.8k|        struct generic_macho_section *sp = 0;
  234|       |
  235|  31.8k|        sp = macho->mo_dwarf_sections + section_index;
  236|  31.8k|        return_section->as_name   = sp->dwarfsectname;
  237|  31.8k|        return_section->as_type   = 0;
  238|  31.8k|        return_section->as_flags  = sp->flags;
  239|  31.8k|        return_section->as_addr   = sp->addr;
  240|  31.8k|        return_section->as_offset = sp->offset;
  241|  31.8k|        return_section->as_size   = sp->size;
  242|  31.8k|        return_section->as_link   = 0;
  243|  31.8k|        return_section->as_info   = 0;
  244|  31.8k|        return_section->as_addralign = 0;
  245|  31.8k|        return_section->as_entrysize = 0;
  246|  31.8k|        return DW_DLV_OK;
  ------------------
  |  |   59|  31.8k|#define DW_DLV_OK         0
  ------------------
  247|  31.8k|    }
  248|      0|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  249|  31.8k|}
dwarf_machoread.c:macho_get_byte_order:
  190|    589|{
  191|    589|    dwarf_macho_object_access_internals_t *macho =
  192|    589|        (dwarf_macho_object_access_internals_t*)(obj);
  193|    589|    return macho->mo_endian;
  194|    589|}
dwarf_machoread.c:macho_get_length_size:
  197|    589|{
  198|    589|    dwarf_macho_object_access_internals_t *macho =
  199|    589|        (dwarf_macho_object_access_internals_t*)(obj);
  200|    589|    return macho->mo_offsetsize/8;
  201|    589|}
dwarf_machoread.c:macho_get_pointer_size:
  204|    589|{
  205|    589|    dwarf_macho_object_access_internals_t *macho =
  206|    589|        (dwarf_macho_object_access_internals_t*)(obj);
  207|    589|    return macho->mo_pointersize/8;
  208|    589|}
dwarf_machoread.c:macho_get_file_size:
  210|    589|{
  211|    589|    dwarf_macho_object_access_internals_t *macho =
  212|    589|        (dwarf_macho_object_access_internals_t*)(obj);
  213|    589|    return macho->mo_filesize;
  214|    589|}
dwarf_machoread.c:macho_get_section_count:
  217|    589|{
  218|    589|    dwarf_macho_object_access_internals_t *macho =
  219|    589|        (dwarf_macho_object_access_internals_t*)(obj);
  220|    589|    return macho->mo_dwarf_sectioncount;
  221|    589|}
dwarf_machoread.c:macho_load_section:
  254|    196|{
  255|    196|    dwarf_macho_object_access_internals_t *macho =
  256|    196|        (dwarf_macho_object_access_internals_t*)(obj);
  257|       |
  258|    196|    if (0 < section_index &&
  ------------------
  |  Branch (258:9): [True: 196, False: 0]
  ------------------
  259|    196|        section_index < macho->mo_dwarf_sectioncount) {
  ------------------
  |  Branch (259:9): [True: 196, False: 0]
  ------------------
  260|    196|        int res = 0;
  261|       |        /*   inner is zero except if unified binary.
  262|       |             If unified, mo_filesize does not include
  263|       |             inner (inner is the distance from zero
  264|       |             to the present macho header in the overall
  265|       |             universal binary). */
  266|    196|        Dwarf_Unsigned inner = macho->mo_inner_offset;
  267|    196|        Dwarf_Unsigned full_offset = 0;
  268|       |
  269|    196|        struct generic_macho_section *sp =
  270|    196|            macho->mo_dwarf_sections + section_index;
  271|    196|        if (sp->loaded_data) {
  ------------------
  |  Branch (271:13): [True: 0, False: 196]
  ------------------
  272|      0|            *return_data = sp->loaded_data;
  273|      0|            return DW_DLV_OK;
  ------------------
  |  |   59|      0|#define DW_DLV_OK         0
  ------------------
  274|      0|        }
  275|    196|        if (!sp->size) {
  ------------------
  |  Branch (275:13): [True: 0, False: 196]
  ------------------
  276|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  277|      0|        }
  278|    196|        full_offset = sp->size + sp->offset + inner;
  279|    196|        if (full_offset < sp->size ||
  ------------------
  |  Branch (279:13): [True: 5, False: 191]
  ------------------
  280|    191|            full_offset < sp->offset ||
  ------------------
  |  Branch (280:13): [True: 0, False: 191]
  ------------------
  281|    191|            full_offset < inner) {
  ------------------
  |  Branch (281:13): [True: 0, False: 191]
  ------------------
  282|      5|            *error = DW_DLE_ARITHMETIC_OVERFLOW;
  ------------------
  |  | 1547|      5|#define DW_DLE_ARITHMETIC_OVERFLOW             501
  ------------------
  283|      5|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      5|#define DW_DLV_ERROR      1
  ------------------
  284|      5|        }
  285|    191|        if ((sp->size + sp->offset) > macho->mo_filesize) {
  ------------------
  |  Branch (285:13): [True: 177, False: 14]
  ------------------
  286|    177|            *error = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|    177|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  287|    177|            return DW_DLV_ERROR;
  ------------------
  |  |   60|    177|#define DW_DLV_ERROR      1
  ------------------
  288|    177|        }
  289|     14|        sp->loaded_data = malloc((size_t)sp->size);
  290|     14|        if (!sp->loaded_data) {
  ------------------
  |  Branch (290:13): [True: 0, False: 14]
  ------------------
  291|      0|            *error = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  292|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  293|      0|        }
  294|     14|        res = RRMOA(macho->mo_fd,
  ------------------
  |  |   65|     14|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     14|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  295|     14|            sp->loaded_data, (inner+sp->offset),
  296|     14|            sp->size,
  297|     14|            (inner+macho->mo_filesize), error);
  298|     14|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     14|#define DW_DLV_OK         0
  ------------------
  |  Branch (298:13): [True: 0, False: 14]
  ------------------
  299|      0|            free(sp->loaded_data);
  300|      0|            sp->loaded_data = 0;
  301|      0|            return res;
  302|      0|        }
  303|     14|        *return_data = sp->loaded_data;
  304|     14|        return DW_DLV_OK;
  ------------------
  |  |   59|     14|#define DW_DLV_OK         0
  ------------------
  305|     14|    }
  306|      0|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  307|    196|}

_dwarf_memcpy_noswap_bytes:
   48|  3.42M|{
   49|  3.42M|    memcpy(s1,s2,(size_t)len);
   50|  3.42M|    return;
   51|  3.42M|}
_dwarf_memcpy_swap_bytes:
   57|  5.75M|{
   58|  5.75M|    unsigned char       *targ = (unsigned char *) s1;
   59|  5.75M|    const unsigned char *src = (const unsigned char *) s2;
   60|  5.75M|    unsigned long        i = 0;
   61|  5.75M|    unsigned long        n = (long)(len-1);
   62|       |
   63|  5.75M|    if (len > 8) {
  ------------------
  |  Branch (63:9): [True: 0, False: 5.75M]
  ------------------
   64|       |        /*  Really we should not be here!
   65|       |            Not writing an integer, we think, so
   66|       |            best to not swap bytes! */
   67|      0|        memcpy(s1,s2,(size_t)len);
   68|      0|        return;
   69|      0|    }
   70|  32.1M|    for ( ; i < len; ++i,--n) {
  ------------------
  |  Branch (70:13): [True: 26.4M, False: 5.75M]
  ------------------
   71|  26.4M|        targ[n]  = src[i];
   72|  26.4M|    }
   73|  5.75M|    return;
   74|  5.75M|}

_dwarf_object_detector_fd_a:
  526|  8.35k|{
  527|  8.35k|    struct elf_header h;
  528|  8.35k|    Dwarf_Unsigned readlen = sizeof(h);
  529|  8.35k|    Dwarf_Unsigned filesize = 0;
  530|  8.35k|    Dwarf_Unsigned remaininglen  = 0;
  531|  8.35k|    int            res = 0;
  532|       |
  533|  8.35k|    h = h_zero;
  534|  8.35k|    {
  535|  8.35k|        res = _dwarf_seekr(fd,0,SEEK_END,&filesize);
  536|  8.35k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   64|  8.35k|#define DW_DLV_OK        0
  ------------------
  |  Branch (536:13): [True: 0, False: 8.35k]
  ------------------
  537|      0|            *errcode = DW_DLE_SEEK_ERROR;
  ------------------
  |  | 1464|      0|#define DW_DLE_SEEK_ERROR                      418
  ------------------
  538|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   65|      0|#define DW_DLV_ERROR     1
  ------------------
  539|      0|        }
  540|  8.35k|    }
  541|  8.35k|    if (filesize <= readlen) {
  ------------------
  |  Branch (541:9): [True: 11, False: 8.34k]
  ------------------
  542|       |        /* Not a real object file */
  543|     11|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     11|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  544|     11|        return DW_DLV_ERROR;
  ------------------
  |  |   65|     11|#define DW_DLV_ERROR     1
  ------------------
  545|     11|    }
  546|  8.34k|    if (filesize <= fileoffsetbase) {
  ------------------
  |  Branch (546:9): [True: 0, False: 8.34k]
  ------------------
  547|      0|        *errcode = DW_DLE_SEEK_ERROR;
  ------------------
  |  | 1464|      0|#define DW_DLE_SEEK_ERROR                      418
  ------------------
  548|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   65|      0|#define DW_DLV_ERROR     1
  ------------------
  549|      0|    }
  550|  8.34k|    remaininglen = filesize - fileoffsetbase;
  551|  8.34k|    if (remaininglen <= readlen) {
  ------------------
  |  Branch (551:9): [True: 11, False: 8.33k]
  ------------------
  552|       |        /* Not a real object file */
  553|     11|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     11|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  554|     11|        return DW_DLV_ERROR;
  ------------------
  |  |   65|     11|#define DW_DLV_ERROR     1
  ------------------
  555|     11|    }
  556|       |    /*  fileoffsetbase is non zero iff we have
  557|       |        an Apple Universal Binary. */
  558|  8.33k|    if (readlen > remaininglen) {
  ------------------
  |  Branch (558:9): [True: 0, False: 8.33k]
  ------------------
  559|       |        /* Not a real object file */
  560|      0|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|      0|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  561|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   65|      0|#define DW_DLV_ERROR     1
  ------------------
  562|      0|    }
  563|  8.33k|    res = _dwarf_object_read_random(fd, (char *)&h,
  564|  8.33k|        fileoffsetbase,
  565|  8.33k|        readlen, filesize,errcode);
  566|  8.33k|    if (h.e_ident[0] == 0x7f &&
  ------------------
  |  Branch (566:9): [True: 4.61k, False: 3.71k]
  ------------------
  567|  4.61k|        h.e_ident[1] == 'E' &&
  ------------------
  |  Branch (567:9): [True: 4.60k, False: 11]
  ------------------
  568|  4.60k|        h.e_ident[2] == 'L' &&
  ------------------
  |  Branch (568:9): [True: 4.59k, False: 11]
  ------------------
  569|  4.59k|        h.e_ident[3] == 'F') {
  ------------------
  |  Branch (569:9): [True: 4.58k, False: 9]
  ------------------
  570|       |        /* is ELF */
  571|       |
  572|  4.58k|        res = fill_in_elf_fields(&h,endian,offsetsize,errcode);
  573|  4.58k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   64|  4.58k|#define DW_DLV_OK        0
  ------------------
  |  Branch (573:13): [True: 10, False: 4.57k]
  ------------------
  574|     10|            return res;
  575|     10|        }
  576|  4.57k|        *ftype = DW_FTYPE_ELF;
  ------------------
  |  |  114|  4.57k|#define DW_FTYPE_ELF        1  /* Unix/Linux/etc */
  ------------------
  577|  4.57k|        *filesize_out = (Dwarf_Unsigned)filesize;
  578|  4.57k|        return DW_DLV_OK;
  ------------------
  |  |   64|  4.57k|#define DW_DLV_OK        0
  ------------------
  579|  4.58k|    }
  580|  3.74k|    if (is_mach_o_universal(&h,endian,offsetsize)) {
  ------------------
  |  Branch (580:9): [True: 578, False: 3.16k]
  ------------------
  581|    578|        *ftype = DW_FTYPE_APPLEUNIVERSAL;
  ------------------
  |  |  118|    578|#define DW_FTYPE_APPLEUNIVERSAL    5
  ------------------
  582|    578|        *filesize_out = (Dwarf_Unsigned)filesize;
  583|    578|        return DW_DLV_OK;
  ------------------
  |  |   64|    578|#define DW_DLV_OK        0
  ------------------
  584|    578|    }
  585|  3.16k|    if (is_mach_o_magic(&h,endian,offsetsize)) {
  ------------------
  |  Branch (585:9): [True: 2.02k, False: 1.14k]
  ------------------
  586|  2.02k|        *ftype = DW_FTYPE_MACH_O;
  ------------------
  |  |  115|  2.02k|#define DW_FTYPE_MACH_O     2  /* Macos. */
  ------------------
  587|  2.02k|        *filesize_out = (Dwarf_Unsigned)filesize;
  588|  2.02k|        return DW_DLV_OK;
  ------------------
  |  |   64|  2.02k|#define DW_DLV_OK        0
  ------------------
  589|  2.02k|    }
  590|  1.14k|    if (is_archive_magic(&h)) {
  ------------------
  |  Branch (590:9): [True: 1, False: 1.14k]
  ------------------
  591|      1|        *ftype = DW_FTYPE_ARCHIVE;
  ------------------
  |  |  117|      1|#define DW_FTYPE_ARCHIVE    4  /* unix archive */
  ------------------
  592|      1|        *filesize_out = (Dwarf_Unsigned)filesize;
  593|      1|        return DW_DLV_OK;
  ------------------
  |  |   64|      1|#define DW_DLV_OK        0
  ------------------
  594|      1|    }
  595|  1.14k|    res = is_pe_object(fd,filesize,endian,offsetsize,errcode);
  596|  1.14k|    if (res == DW_DLV_OK ) {
  ------------------
  |  |   64|  1.14k|#define DW_DLV_OK        0
  ------------------
  |  Branch (596:9): [True: 688, False: 455]
  ------------------
  597|    688|        *ftype = DW_FTYPE_PE;
  ------------------
  |  |  116|    688|#define DW_FTYPE_PE         3  /* Windows */
  ------------------
  598|    688|        *filesize_out = (Dwarf_Unsigned)filesize;
  599|    688|        return DW_DLV_OK;
  ------------------
  |  |   64|    688|#define DW_DLV_OK        0
  ------------------
  600|    688|    }
  601|       |    /* Unknown object format. */
  602|    455|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   63|    455|#define DW_DLV_NO_ENTRY -1
  ------------------
  603|  1.14k|}
dwarf_object_detector.c:fill_in_elf_fields:
  266|  4.58k|{
  267|  4.58k|    unsigned locendian = 0;
  268|  4.58k|    unsigned locoffsetsize = 0;
  269|       |
  270|  4.58k|    switch(h->e_ident[EI_CLASS]) {
  ------------------
  |  |   69|  4.58k|#define EI_CLASS  4
  ------------------
  271|  3.05k|    case ELFCLASS32:
  ------------------
  |  |   72|  3.05k|#define ELFCLASS32 1
  ------------------
  |  Branch (271:5): [True: 3.05k, False: 1.53k]
  ------------------
  272|  3.05k|        locoffsetsize = 32;
  273|  3.05k|        break;
  274|  1.53k|    case ELFCLASS64:
  ------------------
  |  |   73|  1.53k|#define ELFCLASS64 2
  ------------------
  |  Branch (274:5): [True: 1.53k, False: 3.05k]
  ------------------
  275|  1.53k|        locoffsetsize = 64;
  276|  1.53k|        break;
  277|      1|    default:
  ------------------
  |  Branch (277:5): [True: 1, False: 4.58k]
  ------------------
  278|      1|        *errcode = DW_DLE_ELF_CLASS_BAD;
  ------------------
  |  | 1466|      1|#define DW_DLE_ELF_CLASS_BAD                   420
  ------------------
  279|      1|        return DW_DLV_ERROR;
  ------------------
  |  |   65|      1|#define DW_DLV_ERROR     1
  ------------------
  280|  4.58k|    }
  281|  4.58k|    switch(h->e_ident[EI_DATA]) {
  ------------------
  |  |   70|  4.58k|#define EI_DATA   5
  ------------------
  282|  1.41k|    case ELFDATA2LSB:
  ------------------
  |  |   74|  1.41k|#define ELFDATA2LSB 1
  ------------------
  |  Branch (282:5): [True: 1.41k, False: 3.17k]
  ------------------
  283|  1.41k|        locendian = DW_END_little;
  ------------------
  |  | 1115|  1.41k|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  284|  1.41k|        break;
  285|  3.17k|    case ELFDATA2MSB:
  ------------------
  |  |   75|  3.17k|#define ELFDATA2MSB 2
  ------------------
  |  Branch (285:5): [True: 3.17k, False: 1.41k]
  ------------------
  286|  3.17k|        locendian = DW_END_big;
  ------------------
  |  | 1114|  3.17k|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  287|  3.17k|        break;
  288|      1|    default:
  ------------------
  |  Branch (288:5): [True: 1, False: 4.58k]
  ------------------
  289|      1|        *errcode = DW_DLE_ELF_ENDIAN_BAD;
  ------------------
  |  | 1467|      1|#define DW_DLE_ELF_ENDIAN_BAD                  421
  ------------------
  290|      1|        return DW_DLV_ERROR;
  ------------------
  |  |   65|      1|#define DW_DLV_ERROR     1
  ------------------
  291|  4.58k|    }
  292|  4.58k|    if (h->e_ident[EI_VERSION] != 1 /* EV_CURRENT */) {
  ------------------
  |  |   71|  4.58k|#define EI_VERSION 6
  ------------------
  |  Branch (292:9): [True: 8, False: 4.57k]
  ------------------
  293|      8|        *errcode = DW_DLE_ELF_VERSION_BAD;
  ------------------
  |  | 1468|      8|#define DW_DLE_ELF_VERSION_BAD                 422
  ------------------
  294|      8|        return DW_DLV_ERROR;
  ------------------
  |  |   65|      8|#define DW_DLV_ERROR     1
  ------------------
  295|      8|    }
  296|  4.57k|    *endian = locendian;
  297|  4.57k|    *objoffsetsize = locoffsetsize;
  298|  4.57k|    return DW_DLV_OK;
  ------------------
  |  |   64|  4.57k|#define DW_DLV_OK        0
  ------------------
  299|  4.58k|}
dwarf_object_detector.c:is_mach_o_universal:
  432|  3.74k|{
  433|  3.74k|    unsigned long magicval = 0;
  434|  3.74k|    unsigned locendian = 0;
  435|  3.74k|    unsigned locoffsetsize = 0;
  436|       |
  437|       |    /*  No swapping here. Need to match size of
  438|       |        the universal-object  magic field. */
  439|  3.74k|    magicval = magic_copy(h->e_ident,4);
  440|  3.74k|    if (magicval == FAT_MAGIC) {
  ------------------
  |  |   84|  3.74k|#define FAT_MAGIC   0xcafebabe
  ------------------
  |  Branch (440:9): [True: 75, False: 3.66k]
  ------------------
  441|     75|        locendian = DW_END_big;
  ------------------
  |  | 1114|     75|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  442|     75|        locoffsetsize = 32;
  443|  3.66k|    } else if (magicval == FAT_CIGAM) {
  ------------------
  |  |   85|  3.66k|#define FAT_CIGAM   0xbebafeca
  ------------------
  |  Branch (443:16): [True: 140, False: 3.52k]
  ------------------
  444|    140|        locendian = DW_END_little;
  ------------------
  |  | 1115|    140|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  445|    140|        locoffsetsize = 32;
  446|  3.52k|    }else if (magicval == FAT_MAGIC_64) {
  ------------------
  |  |   86|  3.52k|#define FAT_MAGIC_64    0xcafebabf
  ------------------
  |  Branch (446:15): [True: 135, False: 3.39k]
  ------------------
  447|    135|        locendian = DW_END_big;
  ------------------
  |  | 1114|    135|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  448|    135|        locoffsetsize = 64;
  449|  3.39k|    } else if (magicval == FAT_CIGAM_64) {
  ------------------
  |  |   87|  3.39k|#define FAT_CIGAM_64    0xbfbafeca
  ------------------
  |  Branch (449:16): [True: 228, False: 3.16k]
  ------------------
  450|    228|        locendian = DW_END_little;
  ------------------
  |  | 1115|    228|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  451|    228|        locoffsetsize = 64;
  452|  3.16k|    } else {
  453|  3.16k|        return FALSE;
  ------------------
  |  |   36|  3.16k|#define FALSE 0
  ------------------
  454|  3.16k|    }
  455|    578|    *endian = locendian;
  456|    578|    *offsetsize = locoffsetsize;
  457|    578|    return TRUE;
  ------------------
  |  |   33|    578|#define TRUE 1
  ------------------
  458|  3.74k|}
dwarf_object_detector.c:magic_copy:
  126|  7.80k|{
  127|  7.80k|    unsigned i = 0;
  128|  7.80k|    unsigned long v = 0;
  129|       |
  130|  7.80k|    v = d[0];
  131|  29.4k|    for (i = 1 ; i < len; ++i) {
  ------------------
  |  Branch (131:18): [True: 21.6k, False: 7.80k]
  ------------------
  132|  21.6k|        v <<= 8;
  133|  21.6k|        v |=  d[i];
  134|  21.6k|    }
  135|  7.80k|    return v;
  136|  7.80k|}
dwarf_object_detector.c:is_mach_o_magic:
  464|  3.16k|{
  465|  3.16k|    unsigned long magicval = 0;
  466|  3.16k|    unsigned locendian = 0;
  467|  3.16k|    unsigned locoffsetsize = 0;
  468|       |
  469|       |    /*  No swapping here. Need to match size of
  470|       |        Mach-o magic field. */
  471|  3.16k|    magicval = magic_copy(h->e_ident,4);
  472|  3.16k|    if (magicval == MH_MAGIC) {
  ------------------
  |  |  130|  3.16k|#define    MH_MAGIC    0xfeedface    /* the mach magic number */
  ------------------
  |  Branch (472:9): [True: 743, False: 2.42k]
  ------------------
  473|    743|        locendian = DW_END_big;
  ------------------
  |  | 1114|    743|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  474|    743|        locoffsetsize = 32;
  475|  2.42k|    } else if (magicval == MH_CIGAM) {
  ------------------
  |  |  131|  2.42k|#define MH_CIGAM    0xcefaedfe    /* NXSwapInt(MH_MAGIC) */
  ------------------
  |  Branch (475:16): [True: 477, False: 1.94k]
  ------------------
  476|    477|        locendian = DW_END_little;
  ------------------
  |  | 1115|    477|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  477|    477|        locoffsetsize = 32;
  478|  1.94k|    }else if (magicval == MH_MAGIC_64) {
  ------------------
  |  |  151|  1.94k|#define MH_MAGIC_64 0xfeedfacf /* the 64-bit mach magic number */
  ------------------
  |  Branch (478:15): [True: 725, False: 1.22k]
  ------------------
  479|    725|        locendian = DW_END_big;
  ------------------
  |  | 1114|    725|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  480|    725|        locoffsetsize = 64;
  481|  1.22k|    } else if (magicval == MH_CIGAM_64) {
  ------------------
  |  |  152|  1.22k|#define MH_CIGAM_64 0xcffaedfe /* NXSwapInt(MH_MAGIC_64) */
  ------------------
  |  Branch (481:16): [True: 77, False: 1.14k]
  ------------------
  482|     77|        locendian = DW_END_little;
  ------------------
  |  | 1115|     77|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  483|     77|        locoffsetsize = 64;
  484|  1.14k|    } else {
  485|  1.14k|        return FALSE;
  ------------------
  |  |   36|  1.14k|#define FALSE 0
  ------------------
  486|  1.14k|    }
  487|  2.02k|    *endian = locendian;
  488|  2.02k|    *offsetsize = locoffsetsize;
  489|  2.02k|    return TRUE;
  ------------------
  |  |   33|  2.02k|#define TRUE 1
  ------------------
  490|  3.16k|}
dwarf_object_detector.c:is_archive_magic:
  304|  1.14k|is_archive_magic(struct elf_header *h) {
  305|  1.14k|    int i = 0;
  306|  1.14k|    int len = sizeof(archive_magic);
  307|  1.14k|    const char *cp = (const char *)h;
  308|  1.17k|    for ( ; i < len; ++i) {
  ------------------
  |  Branch (308:13): [True: 1.17k, False: 1]
  ------------------
  309|  1.17k|        if (cp[i] != archive_magic[i]) {
  ------------------
  |  Branch (309:13): [True: 1.14k, False: 27]
  ------------------
  310|  1.14k|            return FALSE;
  ------------------
  |  |   36|  1.14k|#define FALSE 0
  ------------------
  311|  1.14k|        }
  312|  1.17k|    }
  313|      1|    return TRUE;
  ------------------
  |  |   33|      1|#define TRUE 1
  ------------------
  314|  1.14k|}
dwarf_object_detector.c:is_pe_object:
  324|  1.14k|{
  325|  1.14k|    unsigned dos_sig = 0;
  326|  1.14k|    unsigned locendian = 0;
  327|  1.14k|    void (*word_swap) (void *, const void *, unsigned long);
  328|  1.14k|    unsigned long nt_address = 0;
  329|  1.14k|    struct dos_header dhinmem;
  330|  1.14k|    char nt_sig_array[4];
  331|  1.14k|    unsigned long nt_sig = 0;
  332|  1.14k|    struct pe_image_file_header ifh;
  333|  1.14k|    int res = 0;
  334|       |
  335|  1.14k|    if (filesize < (sizeof (struct dos_header) +
  ------------------
  |  Branch (335:9): [True: 244, False: 899]
  ------------------
  336|  1.14k|        SIZEOFT32 + sizeof(struct pe_image_file_header))) {
  ------------------
  |  |   61|  1.14k|#define SIZEOFT32 4
  ------------------
  337|    244|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|    244|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  338|    244|        return DW_DLV_ERROR;
  ------------------
  |  |   65|    244|#define DW_DLV_ERROR     1
  ------------------
  339|    244|    }
  340|    899|    res = _dwarf_object_read_random(fd,(char *)&dhinmem,
  341|    899|        0,sizeof(dhinmem),filesize,errcode);
  342|    899|    if (res != DW_DLV_OK) {
  ------------------
  |  |   64|    899|#define DW_DLV_OK        0
  ------------------
  |  Branch (342:9): [True: 0, False: 899]
  ------------------
  343|      0|        return res;
  344|      0|    }
  345|       |    /* No swap here, want it as in the file */
  346|    899|    dos_sig = magic_copy((unsigned char *)dhinmem.dh_mz,
  347|    899|        sizeof(dhinmem.dh_mz));
  348|    899|    if (dos_sig == IMAGE_DOS_SIGNATURE_dw) {
  ------------------
  |  |  191|    899|#define IMAGE_DOS_SIGNATURE_dw      0x5A4D
  ------------------
  |  Branch (348:9): [True: 581, False: 318]
  ------------------
  349|       |        /*  IMAGE_DOS_SIGNATURE_dw assumes bytes
  350|       |            reversed by little-endian
  351|       |            load, so we intrepet a match the other way. */
  352|       |        /* BIG ENDIAN. From looking at hex characters in object  */
  353|       |#ifdef WORDS_BIGENDIAN
  354|       |        word_swap = _dwarf_memcpy_noswap_bytes;
  355|       |#else  /* LITTLE ENDIAN */
  356|    581|        word_swap =  _dwarf_memcpy_swap_bytes;
  357|    581|#endif /* LITTLE- BIG-ENDIAN */
  358|    581|        locendian = DW_END_big;
  ------------------
  |  | 1114|    581|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  359|    581|    } else if (dos_sig == IMAGE_DOS_REVSIGNATURE_dw) {
  ------------------
  |  |  192|    318|#define IMAGE_DOS_REVSIGNATURE_dw   0x4D5A
  ------------------
  |  Branch (359:16): [True: 261, False: 57]
  ------------------
  360|       |        /* raw load, so  intrepet a match the other way. */
  361|       |        /* LITTLE ENDIAN */
  362|       |#ifdef WORDS_BIGENDIAN
  363|       |        word_swap =  _dwarf_memcpy_swap_bytes;
  364|       |#else  /* LITTLE ENDIAN */
  365|    261|        word_swap = _dwarf_memcpy_noswap_bytes;
  366|    261|#endif /* LITTLE- BIG-ENDIAN */
  367|    261|        locendian = DW_END_little;
  ------------------
  |  | 1115|    261|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  368|    261|    } else {
  369|       |        /* Not dos header not a PE file we recognize */
  370|     57|        *errcode = DW_DLE_FILE_WRONG_TYPE;
  ------------------
  |  | 1458|     57|#define DW_DLE_FILE_WRONG_TYPE                 412
  ------------------
  371|     57|        return DW_DLV_ERROR;
  ------------------
  |  |   65|     57|#define DW_DLV_ERROR     1
  ------------------
  372|     57|    }
  373|    842|    ASNAR(word_swap,nt_address, dhinmem.dh_image_offset);
  ------------------
  |  |   53|    842|    do {                                        \
  |  |   54|    842|        (t) = 0;                                \
  |  |   55|    842|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    842|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 842]
  |  |  ------------------
  ------------------
  374|    842|    if (filesize < nt_address) {
  ------------------
  |  Branch (374:9): [True: 26, False: 816]
  ------------------
  375|       |        /* Not dos header not a PE file we recognize */
  376|     26|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     26|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  377|     26|        return DW_DLV_ERROR;
  ------------------
  |  |   65|     26|#define DW_DLV_ERROR     1
  ------------------
  378|     26|    }
  379|    816|    if (filesize < (nt_address + SIZEOFT32 +
  ------------------
  |  |   61|    816|#define SIZEOFT32 4
  ------------------
  |  Branch (379:9): [True: 5, False: 811]
  ------------------
  380|    816|        sizeof(struct pe_image_file_header))) {
  381|      5|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|      5|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  382|       |        /* Not dos header not a PE file we recognize */
  383|      5|        return DW_DLV_ERROR;
  ------------------
  |  |   65|      5|#define DW_DLV_ERROR     1
  ------------------
  384|      5|    }
  385|    811|    res =  _dwarf_object_read_random(fd,(char *)&nt_sig_array[0],
  386|    811|        nt_address, sizeof(nt_sig_array),filesize,errcode);
  387|    811|    if (res != DW_DLV_OK) {
  ------------------
  |  |   64|    811|#define DW_DLV_OK        0
  ------------------
  |  Branch (387:9): [True: 0, False: 811]
  ------------------
  388|      0|        return res;
  389|      0|    }
  390|    811|    {   unsigned long lsig = 0;
  391|       |
  392|    811|        ASNAR(word_swap,lsig,nt_sig_array);
  ------------------
  |  |   53|    811|    do {                                        \
  |  |   54|    811|        (t) = 0;                                \
  |  |   55|    811|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    811|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 811]
  |  |  ------------------
  ------------------
  393|    811|        nt_sig = lsig;
  394|    811|    }
  395|    811|    if (nt_sig != IMAGE_NT_SIGNATURE_dw) {
  ------------------
  |  |  193|    811|#define IMAGE_NT_SIGNATURE_dw       0x00004550
  ------------------
  |  Branch (395:9): [True: 58, False: 753]
  ------------------
  396|     58|        *errcode = DW_DLE_FILE_WRONG_TYPE;
  ------------------
  |  | 1458|     58|#define DW_DLE_FILE_WRONG_TYPE                 412
  ------------------
  397|     58|        return DW_DLV_ERROR;
  ------------------
  |  |   65|     58|#define DW_DLV_ERROR     1
  ------------------
  398|     58|    }
  399|    753|    res = _dwarf_object_read_random(fd,(char *)&ifh,
  400|    753|        nt_address + SIZEOFT32,
  ------------------
  |  |   61|    753|#define SIZEOFT32 4
  ------------------
  401|    753|        sizeof(struct pe_image_file_header),
  402|    753|        filesize,
  403|    753|        errcode);
  404|    753|    if (res != DW_DLV_OK) {
  ------------------
  |  |   64|    753|#define DW_DLV_OK        0
  ------------------
  |  Branch (404:9): [True: 0, False: 753]
  ------------------
  405|      0|        return res;
  406|      0|    }
  407|    753|    {
  408|    753|        unsigned long machine = 0;
  409|       |
  410|    753|        ASNAR(word_swap,machine,ifh.im_machine);
  ------------------
  |  |   53|    753|    do {                                        \
  |  |   54|    753|        (t) = 0;                                \
  |  |   55|    753|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    753|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 753]
  |  |  ------------------
  ------------------
  411|    753|        switch(machine) {
  412|    551|        case IMAGE_FILE_MACHINE_I386_dw:
  ------------------
  |  |  194|    551|#define IMAGE_FILE_MACHINE_I386_dw  0x14c
  ------------------
  |  Branch (412:9): [True: 551, False: 202]
  ------------------
  413|    551|            *offsetsize = 32;
  414|    551|            *endian = locendian;
  415|    551|            return DW_DLV_OK;
  ------------------
  |  |   64|    551|#define DW_DLV_OK        0
  ------------------
  416|     26|        case IMAGE_FILE_MACHINE_IA64_dw:
  ------------------
  |  |  195|     26|#define IMAGE_FILE_MACHINE_IA64_dw  0x200
  ------------------
  |  Branch (416:9): [True: 26, False: 727]
  ------------------
  417|    137|        case IMAGE_FILE_MACHINE_AMD64_dw:
  ------------------
  |  |  196|    137|#define IMAGE_FILE_MACHINE_AMD64_dw 0x8664
  ------------------
  |  Branch (417:9): [True: 111, False: 642]
  ------------------
  418|    137|            *offsetsize = 64;
  419|    137|            *endian = locendian;
  420|    137|            return DW_DLV_OK;
  ------------------
  |  |   64|    137|#define DW_DLV_OK        0
  ------------------
  421|     65|        default: break;
  ------------------
  |  Branch (421:9): [True: 65, False: 688]
  ------------------
  422|    753|        }
  423|    753|    }
  424|     65|    *errcode = DW_DLE_IMAGE_FILE_UNKNOWN_TYPE;
  ------------------
  |  | 1475|     65|#define DW_DLE_IMAGE_FILE_UNKNOWN_TYPE         429
  ------------------
  425|     65|    return DW_DLV_ERROR;
  ------------------
  |  |   65|     65|#define DW_DLV_ERROR     1
  ------------------
  426|    753|}

_dwarf_object_read_random:
   56|  1.19M|{
   57|  1.19M|    Dwarf_Unsigned endpoint = 0;
   58|  1.19M|    int res = 0;
   59|       |
   60|  1.19M|    if (loc >= filesize) {
  ------------------
  |  Branch (60:9): [True: 107, False: 1.19M]
  ------------------
   61|       |        /*  Seek can seek off the end. Lets not allow that.
   62|       |            The object is corrupt. */
   63|    107|        *errc = DW_DLE_SEEK_OFF_END;
  ------------------
  |  | 1490|    107|#define DW_DLE_SEEK_OFF_END                    444
  ------------------
   64|    107|        return DW_DLV_ERROR;
  ------------------
  |  |  123|    107|#define DW_DLV_ERROR     1
  ------------------
   65|    107|    }
   66|  1.19M|    endpoint = loc+size;
   67|  1.19M|    if (endpoint < loc) {
  ------------------
  |  Branch (67:9): [True: 0, False: 1.19M]
  ------------------
   68|       |        /*  Overflow!  The object is corrupt. */
   69|      0|        *errc = DW_DLE_READ_OFF_END;
  ------------------
  |  | 1491|      0|#define DW_DLE_READ_OFF_END                    445
  ------------------
   70|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
   71|      0|    }
   72|  1.19M|    if (endpoint > filesize) {
  ------------------
  |  Branch (72:9): [True: 37, False: 1.19M]
  ------------------
   73|       |        /*  Let us -not- try to read past end of object.
   74|       |            The object is corrupt. */
   75|     37|        *errc = DW_DLE_READ_OFF_END;
  ------------------
  |  | 1491|     37|#define DW_DLE_READ_OFF_END                    445
  ------------------
   76|     37|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     37|#define DW_DLV_ERROR     1
  ------------------
   77|     37|    }
   78|  1.19M|    res = _dwarf_seekr(fd,loc,SEEK_SET,0);
   79|  1.19M|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|  1.19M|#define DW_DLV_OK        0
  ------------------
  |  Branch (79:9): [True: 0, False: 1.19M]
  ------------------
   80|      0|        *errc = DW_DLE_SEEK_ERROR;
  ------------------
  |  | 1464|      0|#define DW_DLE_SEEK_ERROR                      418
  ------------------
   81|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
   82|      0|    }
   83|  1.19M|    res = _dwarf_readr(fd,out_buf,size,0);
   84|  1.19M|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|  1.19M|#define DW_DLV_OK        0
  ------------------
  |  Branch (84:9): [True: 0, False: 1.19M]
  ------------------
   85|      0|        *errc = DW_DLE_READ_ERROR;
  ------------------
  |  | 1465|      0|#define DW_DLE_READ_ERROR                      419
  ------------------
   86|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
   87|      0|    }
   88|  1.19M|    return DW_DLV_OK;
  ------------------
  |  |  122|  1.19M|#define DW_DLV_OK        0
  ------------------
   89|  1.19M|}

_dwarf_pe_setup:
  838|    688|{
  839|    688|    Dwarf_Obj_Access_Interface_a *binary_interface = 0;
  840|    688|    dwarf_pe_object_access_internals_t *pep = 0;
  841|    688|    int res = DW_DLV_OK;
  ------------------
  |  |   59|    688|#define DW_DLV_OK         0
  ------------------
  842|    688|    int localerrnum = 0;
  843|       |
  844|    688|    res = _dwarf_pe_object_access_init(
  845|    688|        fd,
  846|    688|        ftype,endian,offsetsize,filesize,
  847|    688|        &binary_interface,
  848|    688|        &localerrnum);
  849|    688|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    688|#define DW_DLV_OK         0
  ------------------
  |  Branch (849:9): [True: 424, False: 264]
  ------------------
  850|    424|        if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |   58|    424|#define DW_DLV_NO_ENTRY  -1
  ------------------
  |  Branch (850:13): [True: 0, False: 424]
  ------------------
  851|      0|            return res;
  852|      0|        }
  853|    424|        _dwarf_error(NULL, error, localerrnum);
  854|    424|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    424|#define DW_DLV_ERROR      1
  ------------------
  855|    424|    }
  856|       |    /*  allocates and initializes Dwarf_Debug,
  857|       |        generic code */
  858|    264|    res = dwarf_object_init_b(binary_interface, errhand, errarg,
  859|    264|        groupnumber, dbg, error);
  860|    264|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|    264|#define DW_DLV_OK         0
  ------------------
  |  Branch (860:9): [True: 74, False: 190]
  ------------------
  861|     74|        _dwarf_destruct_pe_access(binary_interface);
  862|     74|        return res;
  863|     74|    }
  864|    190|    pep = binary_interface->ai_object;
  865|    190|    (*dbg)->de_obj_flags = pep->pe_flags;
  866|    190|    (*dbg)->de_obj_machine = pep->pe_machine;
  867|    190|    pep->pe_path = strdup(true_path);
  868|    190|    return res;
  869|    264|}
dwarf_peread.c:_dwarf_destruct_pe_access:
  431|    688|{
  432|    688|    struct Dwarf_Obj_Access_Interface_a_s * aip =
  433|    688|        (struct Dwarf_Obj_Access_Interface_a_s * )obj;
  434|    688|    dwarf_pe_object_access_internals_t *pep = 0;
  435|    688|    Dwarf_Unsigned i = 0;
  436|       |
  437|    688|    if (!aip) {
  ------------------
  |  Branch (437:9): [True: 0, False: 688]
  ------------------
  438|      0|        return;
  439|      0|    }
  440|    688|    pep = (dwarf_pe_object_access_internals_t*)(aip->ai_object);
  441|    688|    if (pep->pe_destruct_close_fd && pep->pe_fd !=-1) {
  ------------------
  |  Branch (441:9): [True: 0, False: 688]
  |  Branch (441:38): [True: 0, False: 0]
  ------------------
  442|      0|        _dwarf_closer(pep->pe_fd);
  443|      0|        pep->pe_fd = -1;
  444|      0|    }
  445|    688|    free((char *)pep->pe_path);
  446|    688|    pep->pe_path = 0;
  447|    688|    if (pep->pe_sectionptr) {
  ------------------
  |  Branch (447:9): [True: 471, False: 217]
  ------------------
  448|    471|        struct dwarf_pe_generic_image_section_header  *sp = 0;
  449|       |
  450|    471|        sp = pep->pe_sectionptr;
  451|   122k|        for (i=0; i < pep->pe_section_count; ++i,++sp) {
  ------------------
  |  Branch (451:19): [True: 122k, False: 471]
  ------------------
  452|   122k|            if (sp->loaded_data) {
  ------------------
  |  Branch (452:17): [True: 104, False: 122k]
  ------------------
  453|    104|                free(sp->loaded_data);
  454|    104|                sp->loaded_data = 0;
  455|    104|            }
  456|   122k|            free(sp->name);
  457|   122k|            sp->name = 0;
  458|   122k|            free(sp->dwarfsectname);
  459|   122k|            sp->dwarfsectname = 0;
  460|   122k|        }
  461|    471|        free(pep->pe_sectionptr);
  462|    471|        pep->pe_section_count = 0;
  463|    471|    }
  464|    688|    free(pep->pe_string_table);
  465|    688|    pep->pe_string_table = 0;
  466|    688|    free(pep);
  467|    688|    free(aip);
  468|    688|    return;
  469|    688|}
dwarf_peread.c:_dwarf_pe_object_access_init:
  958|    688|{
  959|       |
  960|    688|    int res = 0;
  961|    688|    dwarf_pe_object_access_internals_t *internals = 0;
  962|    688|    Dwarf_Obj_Access_Interface_a *intfc = 0;
  963|       |
  964|    688|    internals = malloc(sizeof(dwarf_pe_object_access_internals_t));
  965|    688|    if (!internals) {
  ------------------
  |  Branch (965:9): [True: 0, False: 688]
  ------------------
  966|      0|        *localerrnum = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  967|       |        /* Impossible case, we hope. Give up. */
  968|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  969|      0|    }
  970|    688|    memset(internals,0,sizeof(*internals));
  971|    688|    res = _dwarf_pe_object_access_internals_init(internals,
  972|    688|        fd,
  973|    688|        ftype, endian, offsetsize, filesize,
  974|    688|        localerrnum);
  975|    688|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|    688|#define DW_DLV_OK         0
  ------------------
  |  Branch (975:9): [True: 424, False: 264]
  ------------------
  976|       |        /* *err is already set. and the call freed internals */
  977|    424|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    424|#define DW_DLV_ERROR      1
  ------------------
  978|    424|    }
  979|       |
  980|    264|    intfc = malloc(sizeof(Dwarf_Obj_Access_Interface_a));
  981|    264|    if (!intfc) {
  ------------------
  |  Branch (981:9): [True: 0, False: 264]
  ------------------
  982|       |        /* Impossible case, we hope. Give up. */
  983|      0|        free(internals);
  984|      0|        *localerrnum = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  985|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  986|      0|    }
  987|       |    /* Initialize the interface struct */
  988|    264|    intfc->ai_object = internals;
  989|    264|    intfc->ai_methods = &pe_methods;
  990|    264|    *binary_interface = intfc;
  991|    264|    return DW_DLV_OK;
  ------------------
  |  |   59|    264|#define DW_DLV_OK         0
  ------------------
  992|    264|}
dwarf_peread.c:_dwarf_pe_object_access_internals_init:
  894|    688|{
  895|    688|    dwarf_pe_object_access_internals_t * intfc = internals;
  896|    688|    struct Dwarf_Obj_Access_Interface_a_s *localdoas = 0;
  897|    688|    int res = 0;
  898|       |
  899|       |    /*  Must malloc as _dwarf_destruct_pe_access()
  900|       |        forces that due to other uses. */
  901|    688|    localdoas = (struct Dwarf_Obj_Access_Interface_a_s *)
  902|    688|        malloc(sizeof(struct Dwarf_Obj_Access_Interface_a_s));
  903|    688|    if (!localdoas) {
  ------------------
  |  Branch (903:9): [True: 0, False: 688]
  ------------------
  904|      0|        free(internals);
  905|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  906|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  907|      0|    }
  908|    688|    memset(localdoas,0,sizeof(struct Dwarf_Obj_Access_Interface_a_s));
  909|    688|    intfc->pe_ident[0]    = 'P';
  910|    688|    intfc->pe_ident[1]    = '1';
  911|    688|    intfc->pe_fd          = fd;
  912|    688|    intfc->pe_is_64bit    = ((offsetsize==64)?TRUE:FALSE);
  ------------------
  |  |   33|    137|#define TRUE 1
  ------------------
                  intfc->pe_is_64bit    = ((offsetsize==64)?TRUE:FALSE);
  ------------------
  |  |   36|    551|#define FALSE 0
  ------------------
  |  Branch (912:30): [True: 137, False: 551]
  ------------------
  913|    688|    intfc->pe_offsetsize  = offsetsize;
  914|    688|    intfc->pe_pointersize = offsetsize;
  915|    688|    intfc->pe_filesize    = filesize;
  916|    688|    intfc->pe_ftype       = ftype;
  917|       |    /* pe_path set by caller */
  918|       |
  919|       |#ifdef WORDS_BIGENDIAN
  920|       |    if (endian == DW_END_little) {
  921|       |        intfc->pe_copy_word = _dwarf_memcpy_swap_bytes;
  922|       |        intfc->pe_endian = DW_END_little;
  923|       |    } else {
  924|       |        intfc->pe_copy_word = _dwarf_memcpy_noswap_bytes;
  925|       |        intfc->pe_endian = DW_END_big;
  926|       |    }
  927|       |#else  /* LITTLE ENDIAN */
  928|    688|    if (endian == DW_END_little) {
  ------------------
  |  | 1115|    688|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  |  Branch (928:9): [True: 203, False: 485]
  ------------------
  929|    203|        intfc->pe_copy_word = _dwarf_memcpy_noswap_bytes;
  930|    203|        intfc->pe_endian = DW_END_little;
  ------------------
  |  | 1115|    203|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  931|    485|    } else {
  932|    485|        intfc->pe_copy_word = _dwarf_memcpy_swap_bytes;
  933|    485|        intfc->pe_endian = DW_END_big;
  ------------------
  |  | 1114|    485|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  934|    485|    }
  935|    688|#endif /* LITTLE- BIG-ENDIAN */
  936|    688|    res = _dwarf_load_pe_sections(intfc,errcode);
  937|    688|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    688|#define DW_DLV_OK         0
  ------------------
  |  Branch (937:9): [True: 424, False: 264]
  ------------------
  938|    424|        localdoas->ai_object = intfc;
  939|    424|        localdoas->ai_methods = 0;
  940|    424|        _dwarf_destruct_pe_access(localdoas);
  941|    424|        localdoas = 0;
  942|    424|        return res;
  943|    424|    }
  944|    264|    free(localdoas);
  945|    264|    localdoas = 0;
  946|    264|    return DW_DLV_OK;
  ------------------
  |  |   59|    264|#define DW_DLV_OK         0
  ------------------
  947|    688|}
dwarf_peread.c:_dwarf_load_pe_sections:
  619|    688|{
  620|    688|    struct dos_header_dw dhinmem;
  621|    688|    IMAGE_FILE_HEADER_dw ifh;
  622|    688|    void (*word_swap) (void *, const void *, unsigned long);
  623|    688|    unsigned locendian = 0;
  624|    688|    int res = 0;
  625|    688|    Dwarf_Unsigned dos_sig = 0;
  626|    688|    Dwarf_Unsigned nt_address = 0;
  627|    688|    char nt_sig_array[4];
  628|    688|    unsigned long nt_signature = 0;
  629|       |
  630|    688|    if ( (sizeof(ifh) + sizeof(dhinmem))  >= pep->pe_filesize) {
  ------------------
  |  Branch (630:10): [True: 0, False: 688]
  ------------------
  631|       |        /* corrupt object. */
  632|      0|        *errcode = DW_DLE_PE_SIZE_SMALL;
  ------------------
  |  | 1472|      0|#define DW_DLE_PE_SIZE_SMALL                   426
  ------------------
  633|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  634|      0|    }
  635|    688|    res = _dwarf_object_read_random(pep->pe_fd,(char *)&dhinmem,
  636|    688|        0, sizeof(dhinmem),pep->pe_filesize, errcode);
  637|    688|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    688|#define DW_DLV_OK         0
  ------------------
  |  Branch (637:9): [True: 0, False: 688]
  ------------------
  638|      0|        return res;
  639|      0|    }
  640|    688|    dos_sig = magic_copy((char *)dhinmem.dh_mz,
  641|    688|        sizeof(dhinmem.dh_mz));
  642|    688|    if (dos_sig == IMAGE_DOS_SIGNATURE_dw) {
  ------------------
  |  |   38|    688|#define IMAGE_DOS_SIGNATURE_dw    0x5a4d /* le on disk 'M' 'Z' */
  ------------------
  |  Branch (642:9): [True: 485, False: 203]
  ------------------
  643|       |        /*  IMAGE_DOS_SIGNATURE_dw assumes bytes
  644|       |            reversed by little-endian
  645|       |            load, so we intrepet a match the other way. */
  646|       |        /* BIG ENDIAN. From looking at hex characters in object  */
  647|       |#ifdef WORDS_BIGENDIAN
  648|       |        word_swap = _dwarf_memcpy_noswap_bytes;
  649|       |#else  /* LITTLE ENDIAN */
  650|    485|        word_swap = _dwarf_memcpy_swap_bytes;
  651|    485|#endif /* LITTLE- BIG-ENDIAN */
  652|    485|        locendian = DW_END_big;
  ------------------
  |  | 1114|    485|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  653|    485|    } else if (dos_sig == IMAGE_DOS_REVSIGNATURE_dw) {
  ------------------
  |  |   39|    203|#define IMAGE_DOS_REVSIGNATURE_dw 0x4d5a /* be on disk */
  ------------------
  |  Branch (653:16): [True: 203, False: 0]
  ------------------
  654|       |        /* raw load, so  intrepet a match the other way. */
  655|       |        /* LITTLE ENDIAN */
  656|       |#ifdef WORDS_BIGENDIAN
  657|       |        word_swap = _dwarf_memcpy_swap_bytes;
  658|       |#else  /* LITTLE ENDIAN */
  659|    203|        word_swap = _dwarf_memcpy_noswap_bytes;
  660|    203|#endif /* LITTLE- BIG-ENDIAN */
  661|    203|        locendian = DW_END_little;
  ------------------
  |  | 1115|    203|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  662|    203|    } else {
  663|       |        /* Not dos header not a PE file we recognize */
  664|      0|        *errcode = DW_DLE_FILE_WRONG_TYPE;
  ------------------
  |  | 1458|      0|#define DW_DLE_FILE_WRONG_TYPE                 412
  ------------------
  665|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  666|      0|    }
  667|    688|    if (locendian != pep->pe_endian) {
  ------------------
  |  Branch (667:9): [True: 0, False: 688]
  ------------------
  668|       |        /*  Really this is a coding botch somewhere here,
  669|       |            not an object corruption. */
  670|      0|        *errcode = DW_DLE_FILE_WRONG_TYPE;
  ------------------
  |  | 1458|      0|#define DW_DLE_FILE_WRONG_TYPE                 412
  ------------------
  671|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  672|      0|    }
  673|    688|    pep->pe_copy_word = word_swap;
  674|    688|    ASNAR(word_swap,nt_address,dhinmem.dh_image_offset);
  ------------------
  |  |   53|    688|    do {                                        \
  |  |   54|    688|        (t) = 0;                                \
  |  |   55|    688|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    688|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 688]
  |  |  ------------------
  ------------------
  675|    688|    if (pep->pe_filesize < (nt_address + sizeof(nt_sig_array))) {
  ------------------
  |  Branch (675:9): [True: 0, False: 688]
  ------------------
  676|       |        /*  The nt_address is really a file offset. */
  677|      0|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|      0|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  678|       |        /* Not dos header not a PE file we recognize */
  679|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  680|      0|    }
  681|       |
  682|    688|    res =  _dwarf_object_read_random(pep->pe_fd,
  683|    688|        (char *)&nt_sig_array[0],
  684|    688|        nt_address, sizeof(nt_sig_array),
  685|    688|        pep->pe_filesize,errcode);
  686|    688|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    688|#define DW_DLV_OK         0
  ------------------
  |  Branch (686:9): [True: 0, False: 688]
  ------------------
  687|      0|        return res;
  688|      0|    }
  689|    688|    {   unsigned long lsig = 0;
  690|       |
  691|    688|        ASNAR(word_swap,lsig,nt_sig_array);
  ------------------
  |  |   53|    688|    do {                                        \
  |  |   54|    688|        (t) = 0;                                \
  |  |   55|    688|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    688|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 688]
  |  |  ------------------
  ------------------
  692|    688|        nt_signature = lsig;
  693|    688|    }
  694|    688|    if (nt_signature != IMAGE_NT_SIGNATURE_dw) {
  ------------------
  |  |   40|    688|#define IMAGE_NT_SIGNATURE_dw     0x00004550
  ------------------
  |  Branch (694:9): [True: 0, False: 688]
  ------------------
  695|      0|        *errcode = DW_DLE_FILE_WRONG_TYPE;
  ------------------
  |  | 1458|      0|#define DW_DLE_FILE_WRONG_TYPE                 412
  ------------------
  696|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  697|      0|    }
  698|       |
  699|    688|    pep->pe_nt_header_offset = nt_address  + SIZEOFT32;
  ------------------
  |  |   41|    688|#define SIZEOFT32 4
  ------------------
  700|    688|    if (pep->pe_filesize < (pep->pe_nt_header_offset +
  ------------------
  |  Branch (700:9): [True: 0, False: 688]
  ------------------
  701|    688|        sizeof(ifh))) {
  702|      0|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|      0|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  703|       |        /* Not image header not a PE file we recognize */
  704|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  705|      0|    }
  706|    688|    res = _dwarf_object_read_random(pep->pe_fd,(char *)&ifh,
  707|    688|        pep->pe_nt_header_offset, sizeof(ifh),
  708|    688|        pep->pe_filesize,errcode);
  709|    688|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    688|#define DW_DLV_OK         0
  ------------------
  |  Branch (709:9): [True: 0, False: 688]
  ------------------
  710|      0|        return res;
  711|      0|    }
  712|    688|    ASNAR(word_swap,pep->pe_FileHeader.Machine,ifh.Machine);
  ------------------
  |  |   53|    688|    do {                                        \
  |  |   54|    688|        (t) = 0;                                \
  |  |   55|    688|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    688|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 688]
  |  |  ------------------
  ------------------
  713|    688|    ASNAR(word_swap,pep->pe_FileHeader.NumberOfSections,
  ------------------
  |  |   53|    688|    do {                                        \
  |  |   54|    688|        (t) = 0;                                \
  |  |   55|    688|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    688|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 688]
  |  |  ------------------
  ------------------
  714|    688|        ifh.NumberOfSections);
  715|    688|    ASNAR(word_swap,pep->pe_FileHeader.TimeDateStamp,
  ------------------
  |  |   53|    688|    do {                                        \
  |  |   54|    688|        (t) = 0;                                \
  |  |   55|    688|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    688|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 688]
  |  |  ------------------
  ------------------
  716|    688|        ifh.TimeDateStamp);
  717|    688|    ASNAR(word_swap,pep->pe_FileHeader.PointerToSymbolTable,
  ------------------
  |  |   53|    688|    do {                                        \
  |  |   54|    688|        (t) = 0;                                \
  |  |   55|    688|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    688|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 688]
  |  |  ------------------
  ------------------
  718|    688|        ifh.PointerToSymbolTable);
  719|    688|    ASNAR(word_swap,pep->pe_FileHeader.NumberOfSymbols,
  ------------------
  |  |   53|    688|    do {                                        \
  |  |   54|    688|        (t) = 0;                                \
  |  |   55|    688|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    688|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 688]
  |  |  ------------------
  ------------------
  720|    688|        ifh.NumberOfSymbols);
  721|    688|    ASNAR(word_swap,pep->pe_FileHeader.SizeOfOptionalHeader,
  ------------------
  |  |   53|    688|    do {                                        \
  |  |   54|    688|        (t) = 0;                                \
  |  |   55|    688|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    688|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 688]
  |  |  ------------------
  ------------------
  722|    688|        ifh.SizeOfOptionalHeader);
  723|    688|    ASNAR(word_swap,pep->pe_FileHeader.Characteristics,
  ------------------
  |  |   53|    688|    do {                                        \
  |  |   54|    688|        (t) = 0;                                \
  |  |   55|    688|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    688|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 688]
  |  |  ------------------
  ------------------
  724|    688|        ifh.Characteristics);
  725|    688|    pep->pe_machine = pep->pe_FileHeader.Machine;
  726|    688|    pep->pe_flags = pep->pe_FileHeader.Characteristics;
  727|    688|    pep->pe_optional_header_offset = pep->pe_nt_header_offset+
  728|    688|        sizeof(ifh);
  729|    688|    if (pep->pe_offsetsize == 32) {
  ------------------
  |  Branch (729:9): [True: 551, False: 137]
  ------------------
  730|    551|        res = load_optional_header32(pep,
  731|    551|            pep->pe_optional_header_offset,errcode);
  732|    551|        pep->pe_optional_header_size =
  733|    551|            sizeof(IMAGE_OPTIONAL_HEADER32_dw);
  734|    551|    } else if (pep->pe_offsetsize == 64) {
  ------------------
  |  Branch (734:16): [True: 137, False: 0]
  ------------------
  735|    137|        res = load_optional_header64(pep,
  736|    137|            pep->pe_optional_header_offset,errcode);
  737|    137|        pep->pe_optional_header_size =
  738|    137|            sizeof(IMAGE_OPTIONAL_HEADER64_dw);
  739|    137|    } else {
  740|      0|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|      0|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
  741|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  742|      0|    }
  743|    688|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    688|#define DW_DLV_OK         0
  ------------------
  |  Branch (743:9): [True: 37, False: 651]
  ------------------
  744|     37|        return res;
  745|     37|    }
  746|       |
  747|    651|    pep->pe_section_table_offset = pep->pe_optional_header_offset
  748|    651|        + pep->pe_optional_header_size;
  749|    651|    pep->pe_symbol_table_offset =
  750|    651|        pep->pe_FileHeader.PointerToSymbolTable;
  751|    651|    if (pep->pe_symbol_table_offset >= pep->pe_filesize) {
  ------------------
  |  Branch (751:9): [True: 48, False: 603]
  ------------------
  752|     48|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|     48|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
  753|     48|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     48|#define DW_DLV_ERROR      1
  ------------------
  754|     48|    }
  755|    603|    if (pep->pe_symbol_table_offset) {
  ------------------
  |  Branch (755:9): [True: 524, False: 79]
  ------------------
  756|    524|        pep->pe_string_table_offset  =
  757|    524|            pep->pe_symbol_table_offset +
  758|    524|            (pep->pe_FileHeader.NumberOfSymbols *
  759|    524|            IMAGE_SIZEOF_SYMBOL);
  ------------------
  |  |   53|    524|#define IMAGE_SIZEOF_SYMBOL 18
  ------------------
  760|    524|    }
  761|       |
  762|    603|    if (pep->pe_string_table_offset >= pep->pe_filesize) {
  ------------------
  |  Branch (762:9): [True: 29, False: 574]
  ------------------
  763|     29|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|     29|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
  764|     29|        pep->pe_string_table_size = 0;
  765|     29|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     29|#define DW_DLV_ERROR      1
  ------------------
  766|     29|    }
  767|    574|    if (pep->pe_string_table_offset) {
  ------------------
  |  Branch (767:9): [True: 495, False: 79]
  ------------------
  768|       |        /*  https://docs.microsoft.com/en-us/\
  769|       |            windows/desktop/debug/pe-format#coff-string-table  */
  770|       |        /* The first 4 bytes of the string table contain
  771|       |            the size of the string table. */
  772|    495|        char size_field[4];
  773|       |
  774|    495|        if ((pep->pe_string_table_offset+sizeof(size_field)) >
  ------------------
  |  Branch (774:13): [True: 10, False: 485]
  ------------------
  775|    495|            pep->pe_filesize) {
  776|     10|            *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     10|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  777|     10|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     10|#define DW_DLV_ERROR      1
  ------------------
  778|     10|        }
  779|    485|        memset(size_field,0,sizeof(size_field));
  780|    485|        res =  _dwarf_object_read_random(pep->pe_fd,
  781|    485|            (char *)size_field, pep->pe_string_table_offset,
  782|    485|            sizeof(size_field),
  783|    485|            pep->pe_filesize,errcode);
  784|    485|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    485|#define DW_DLV_OK         0
  ------------------
  |  Branch (784:13): [True: 0, False: 485]
  ------------------
  785|      0|            return res;
  786|      0|        }
  787|    485|        ASNAR(pep->pe_copy_word,pep->pe_string_table_size,
  ------------------
  |  |   53|    485|    do {                                        \
  |  |   54|    485|        (t) = 0;                                \
  |  |   55|    485|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    485|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 485]
  |  |  ------------------
  ------------------
  788|    485|            size_field);
  789|    485|        if (pep->pe_string_table_size >= pep->pe_filesize ) {
  ------------------
  |  Branch (789:13): [True: 61, False: 424]
  ------------------
  790|     61|            *errcode = DW_DLE_PE_OFFSET_BAD;
  ------------------
  |  | 1473|     61|#define DW_DLE_PE_OFFSET_BAD                   427
  ------------------
  791|     61|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     61|#define DW_DLV_ERROR      1
  ------------------
  792|     61|        }
  793|    424|        if ((pep->pe_string_table_offset+pep->pe_string_table_size) >
  ------------------
  |  Branch (793:13): [True: 4, False: 420]
  ------------------
  794|    424|            pep->pe_filesize) {
  795|      4|            *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|      4|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  796|      4|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
  797|      4|        }
  798|       |        /*  size+1 to ensure there is a terminating null character
  799|       |            in memory so CoverityScan knows there is always a
  800|       |            final null.  CoverityScan is not aware
  801|       |            there may be multiple strings in the table.
  802|       |            If there is a compiler bug the final string
  803|       |            might be missing its intended null terminator! */
  804|    420|        pep->pe_string_table =
  805|    420|            (char *)calloc(1,(size_t)pep->pe_string_table_size+1);
  806|    420|        if (!pep->pe_string_table) {
  ------------------
  |  Branch (806:13): [True: 0, False: 420]
  ------------------
  807|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  808|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  809|      0|        }
  810|    420|        res = _dwarf_object_read_random(pep->pe_fd,
  811|    420|            (char *)pep->pe_string_table,
  812|    420|            pep->pe_string_table_offset,
  813|    420|            (size_t)pep->pe_string_table_size,
  814|    420|            pep->pe_filesize,errcode);
  815|    420|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    420|#define DW_DLV_OK         0
  ------------------
  |  Branch (815:13): [True: 0, False: 420]
  ------------------
  816|      0|            free(pep->pe_string_table);
  817|      0|            pep->pe_string_table = 0;
  818|      0|            return res;
  819|      0|        }
  820|       |        /*  Should pass coverity now. */
  821|    420|        pep->pe_string_table[pep->pe_string_table_size] = 0;
  822|    420|    }
  823|    499|    res = _dwarf_pe_load_dwarf_section_headers(pep,errcode);
  824|    499|    return res;
  825|    574|}
dwarf_peread.c:magic_copy:
   84|    688|{
   85|    688|    unsigned i = 0;
   86|    688|    unsigned long v = 0;
   87|       |
   88|    688|    v = d[0];
   89|  1.37k|    for (i = 1 ; i < len; ++i) {
  ------------------
  |  Branch (89:18): [True: 688, False: 688]
  ------------------
   90|    688|        v <<= 8;
   91|    688|        v |=  0xff&d[i];
   92|    688|    }
   93|    688|    return v;
   94|    688|}
dwarf_peread.c:load_optional_header32:
  234|    551|{
  235|    551|    int res = 0;
  236|    551|    IMAGE_OPTIONAL_HEADER32_dw hdr;
  237|       |
  238|    551|    pep->pe_optional_header_size = sizeof(IMAGE_OPTIONAL_HEADER32_dw);
  239|       |
  240|    551|    if ((pep->pe_optional_header_size + offset) >
  ------------------
  |  Branch (240:9): [True: 24, False: 527]
  ------------------
  241|    551|        pep->pe_filesize) {
  242|     24|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     24|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  243|     24|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     24|#define DW_DLV_ERROR      1
  ------------------
  244|     24|    }
  245|       |
  246|    527|    res =  _dwarf_object_read_random(pep->pe_fd,
  247|    527|        (char *)&hdr,
  248|    527|        offset, sizeof(IMAGE_OPTIONAL_HEADER32_dw),
  249|    527|        pep->pe_filesize,
  250|    527|        errcode);
  251|    527|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    527|#define DW_DLV_OK         0
  ------------------
  |  Branch (251:9): [True: 0, False: 527]
  ------------------
  252|      0|        return res;
  253|      0|    }
  254|       |
  255|       |    /* This is a subset of fields. */
  256|    527|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.Magic,
  ------------------
  |  |   53|    527|    do {                                        \
  |  |   54|    527|        (t) = 0;                                \
  |  |   55|    527|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    527|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 527]
  |  |  ------------------
  ------------------
  257|    527|        hdr.Magic);
  258|    527|    pep->pe_OptionalHeader.MajorLinkerVersion= hdr.MajorLinkerVersion;
  259|    527|    pep->pe_OptionalHeader.MinorLinkerVersion= hdr.MinorLinkerVersion;
  260|    527|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.ImageBase,
  ------------------
  |  |   53|    527|    do {                                        \
  |  |   54|    527|        (t) = 0;                                \
  |  |   55|    527|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    527|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 527]
  |  |  ------------------
  ------------------
  261|    527|        hdr.ImageBase);
  262|    527|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.SizeOfCode,
  ------------------
  |  |   53|    527|    do {                                        \
  |  |   54|    527|        (t) = 0;                                \
  |  |   55|    527|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    527|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 527]
  |  |  ------------------
  ------------------
  263|    527|        hdr.SizeOfCode);
  264|    527|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.SizeOfImage,
  ------------------
  |  |   53|    527|    do {                                        \
  |  |   54|    527|        (t) = 0;                                \
  |  |   55|    527|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    527|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 527]
  |  |  ------------------
  ------------------
  265|    527|        hdr.SizeOfImage);
  266|    527|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.SizeOfHeaders,
  ------------------
  |  |   53|    527|    do {                                        \
  |  |   54|    527|        (t) = 0;                                \
  |  |   55|    527|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    527|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 527]
  |  |  ------------------
  ------------------
  267|    527|        hdr.SizeOfHeaders);
  268|    527|    pep->pe_OptionalHeader.SizeOfDataDirEntry =
  269|    527|        sizeof(IMAGE_DATA_DIRECTORY_dw);
  270|    527|    return DW_DLV_OK;
  ------------------
  |  |   59|    527|#define DW_DLV_OK         0
  ------------------
  271|    527|}
dwarf_peread.c:load_optional_header64:
  275|    137|{
  276|    137|    IMAGE_OPTIONAL_HEADER64_dw hdr;
  277|    137|    int res = 0;
  278|       |
  279|    137|    pep->pe_optional_header_size = sizeof(IMAGE_OPTIONAL_HEADER64_dw);
  280|    137|    if ((pep->pe_optional_header_size + offset) >
  ------------------
  |  Branch (280:9): [True: 13, False: 124]
  ------------------
  281|    137|        pep->pe_filesize) {
  282|     13|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     13|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  283|     13|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     13|#define DW_DLV_ERROR      1
  ------------------
  284|     13|    }
  285|    124|    res =  _dwarf_object_read_random(pep->pe_fd,
  286|    124|        (char *)&hdr,
  287|    124|        offset, sizeof(IMAGE_OPTIONAL_HEADER64_dw),
  288|    124|        pep->pe_filesize,
  289|    124|        errcode);
  290|    124|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    124|#define DW_DLV_OK         0
  ------------------
  |  Branch (290:9): [True: 0, False: 124]
  ------------------
  291|      0|        return res;
  292|      0|    }
  293|       |
  294|       |    /* This is a subset of fields. */
  295|    124|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.Magic,
  ------------------
  |  |   53|    124|    do {                                        \
  |  |   54|    124|        (t) = 0;                                \
  |  |   55|    124|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    124|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 124]
  |  |  ------------------
  ------------------
  296|    124|        hdr.Magic);
  297|    124|    pep->pe_OptionalHeader.MajorLinkerVersion= hdr.MajorLinkerVersion;
  298|    124|    pep->pe_OptionalHeader.MinorLinkerVersion= hdr.MinorLinkerVersion;
  299|    124|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.ImageBase,
  ------------------
  |  |   53|    124|    do {                                        \
  |  |   54|    124|        (t) = 0;                                \
  |  |   55|    124|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    124|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 124]
  |  |  ------------------
  ------------------
  300|    124|        hdr.ImageBase);
  301|    124|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.SizeOfCode,
  ------------------
  |  |   53|    124|    do {                                        \
  |  |   54|    124|        (t) = 0;                                \
  |  |   55|    124|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    124|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 124]
  |  |  ------------------
  ------------------
  302|    124|        hdr.SizeOfCode);
  303|    124|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.SizeOfImage,
  ------------------
  |  |   53|    124|    do {                                        \
  |  |   54|    124|        (t) = 0;                                \
  |  |   55|    124|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    124|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 124]
  |  |  ------------------
  ------------------
  304|    124|        hdr.SizeOfImage);
  305|    124|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.SizeOfHeaders,
  ------------------
  |  |   53|    124|    do {                                        \
  |  |   54|    124|        (t) = 0;                                \
  |  |   55|    124|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    124|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 124]
  |  |  ------------------
  ------------------
  306|    124|        hdr.SizeOfHeaders);
  307|    124|    pep->pe_OptionalHeader.SizeOfDataDirEntry =
  308|    124|        sizeof(IMAGE_DATA_DIRECTORY_dw);
  309|    124|    return DW_DLV_OK;
  ------------------
  |  |   59|    124|#define DW_DLV_OK         0
  ------------------
  310|    124|}
dwarf_peread.c:_dwarf_pe_load_dwarf_section_headers:
  474|    499|{
  475|    499|    Dwarf_Unsigned i = 0;
  476|    499|    Dwarf_Unsigned input_count =
  477|    499|        pep->pe_FileHeader.NumberOfSections;
  478|    499|    Dwarf_Unsigned offset_in_input = pep->pe_section_table_offset;
  479|    499|    Dwarf_Unsigned section_hdr_size = sizeof(IMAGE_SECTION_HEADER_dw);
  480|    499|    struct dwarf_pe_generic_image_section_header *sec_outp = 0;
  481|    499|    Dwarf_Unsigned cur_offset = offset_in_input;
  482|    499|    Dwarf_Unsigned past_end_hdrs = offset_in_input +
  483|    499|        section_hdr_size*input_count;
  484|       |
  485|       |    /* internal sections include null initial section */
  486|    499|    pep->pe_section_count = input_count+1;
  487|       |
  488|    499|    if (past_end_hdrs > pep->pe_filesize) {
  ------------------
  |  Branch (488:9): [True: 28, False: 471]
  ------------------
  489|     28|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     28|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  490|     28|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     28|#define DW_DLV_ERROR      1
  ------------------
  491|     28|    }
  492|       |
  493|    471|    if (!offset_in_input) {
  ------------------
  |  Branch (493:9): [True: 0, False: 471]
  ------------------
  494|      0|        *errcode = DW_DLE_PE_OFFSET_BAD;
  ------------------
  |  | 1473|      0|#define DW_DLE_PE_OFFSET_BAD                   427
  ------------------
  495|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  496|      0|    }
  497|    471|    pep->pe_sectionptr =
  498|    471|        (struct dwarf_pe_generic_image_section_header * )
  499|    471|        calloc((size_t)pep->pe_section_count,
  500|    471|        sizeof(struct dwarf_pe_generic_image_section_header));
  501|    471|    if (!pep->pe_sectionptr) {
  ------------------
  |  Branch (501:9): [True: 0, False: 471]
  ------------------
  502|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  503|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  504|      0|    }
  505|    471|    sec_outp = pep->pe_sectionptr;
  506|    471|    sec_outp->name = strdup("");
  507|    471|    sec_outp->dwarfsectname = strdup("");
  508|    471|    sec_outp++;
  509|  28.7k|    for ( ;  i < input_count;
  ------------------
  |  Branch (509:14): [True: 28.5k, False: 264]
  ------------------
  510|  28.5k|        ++i, cur_offset += section_hdr_size, sec_outp++) {
  511|       |
  512|  28.5k|        int res = 0;
  513|  28.5k|        IMAGE_SECTION_HEADER_dw filesect;
  514|  28.5k|        char        safe_name[IMAGE_SIZEOF_SHORT_NAME +1];
  515|  28.5k|        const char *expname = 0;
  516|  28.5k|        int irrelevant = 0;
  517|       |
  518|  28.5k|        res =  _dwarf_object_read_random(pep->pe_fd,
  519|  28.5k|            (char *)&filesect,cur_offset,
  520|  28.5k|            sizeof(filesect),
  521|  28.5k|            pep->pe_filesize,
  522|  28.5k|            errcode);
  523|  28.5k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  28.5k|#define DW_DLV_OK         0
  ------------------
  |  Branch (523:13): [True: 0, False: 28.5k]
  ------------------
  524|      0|            return res;
  525|      0|        }
  526|       |        /*  The following is safe. filesect.Name is
  527|       |            IMAGE_SIZEOF_SHORT_NAME bytes long and may
  528|       |            not (not sure) have a NUL terminator. */
  529|  28.5k|        _dwarf_safe_strcpy(safe_name,
  530|  28.5k|            sizeof(safe_name),
  531|  28.5k|            filesect.Name,
  532|  28.5k|            IMAGE_SIZEOF_SHORT_NAME);
  ------------------
  |  |  193|  28.5k|#define IMAGE_SIZEOF_SHORT_NAME 8
  ------------------
  533|       |        /* Have NUL terminator now. */
  534|  28.5k|        sec_outp->name = strdup(safe_name);
  535|  28.5k|        res = pe_section_name_get(pep,
  536|  28.5k|            safe_name,(unsigned int)strlen(safe_name),
  537|  28.5k|            &expname,errcode);
  538|  28.5k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  28.5k|#define DW_DLV_OK         0
  ------------------
  |  Branch (538:13): [True: 11, False: 28.4k]
  ------------------
  539|     11|            return res;
  540|     11|        }
  541|  28.4k|        if (expname) {
  ------------------
  |  Branch (541:13): [True: 28.4k, False: 0]
  ------------------
  542|  28.4k|            sec_outp->dwarfsectname = strdup(expname);
  543|  28.4k|        } else {
  544|      0|            sec_outp->dwarfsectname = strdup("<sec name missing>");
  545|      0|        }
  546|  28.4k|        if ( !sec_outp->name || !sec_outp->dwarfsectname) {
  ------------------
  |  Branch (546:14): [True: 0, False: 28.4k]
  |  Branch (546:33): [True: 0, False: 28.4k]
  ------------------
  547|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  548|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  549|      0|        }
  550|  28.4k|        sec_outp->SecHeaderOffset = cur_offset;
  551|  28.4k|        ASNAR(pep->pe_copy_word,sec_outp->VirtualSize,
  ------------------
  |  |   53|  28.4k|    do {                                        \
  |  |   54|  28.4k|        (t) = 0;                                \
  |  |   55|  28.4k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  28.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 28.4k]
  |  |  ------------------
  ------------------
  552|  28.4k|            filesect.Misc.VirtualSize);
  553|  28.4k|        ASNAR(pep->pe_copy_word,sec_outp->VirtualAddress,
  ------------------
  |  |   53|  28.4k|    do {                                        \
  |  |   54|  28.4k|        (t) = 0;                                \
  |  |   55|  28.4k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  28.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 28.4k]
  |  |  ------------------
  ------------------
  554|  28.4k|            filesect.VirtualAddress);
  555|  28.4k|        ASNAR(pep->pe_copy_word,sec_outp->SizeOfRawData,
  ------------------
  |  |   53|  28.4k|    do {                                        \
  |  |   54|  28.4k|        (t) = 0;                                \
  |  |   55|  28.4k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  28.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 28.4k]
  |  |  ------------------
  ------------------
  556|  28.4k|            filesect.SizeOfRawData);
  557|  28.4k|        irrelevant = is_irrelevant_section(sec_outp->dwarfsectname,
  558|  28.4k|            sec_outp->VirtualSize);
  559|  28.4k|        sec_outp->section_irrelevant_to_dwarf = irrelevant;
  560|  28.4k|        if (irrelevant) {
  ------------------
  |  Branch (560:13): [True: 23.5k, False: 4.90k]
  ------------------
  561|  23.5k|            continue;
  562|  23.5k|        }
  563|  4.90k|        {
  564|       |            /*  A Heuristic, allowing large virtual size
  565|       |                but not unlimited as we will malloc it
  566|       |                later, as Virtualsize. */
  567|  4.90k|            Dwarf_Unsigned limit = 100*pep->pe_filesize;
  568|  4.90k|            if (limit < pep->pe_filesize) {
  ------------------
  |  Branch (568:17): [True: 0, False: 4.90k]
  ------------------
  569|       |                /* An overflow. Bad. */
  570|      0|                *errcode = DW_DLE_PE_SECTION_SIZE_HEURISTIC_FAIL;
  ------------------
  |  | 1550|      0|#define DW_DLE_PE_SECTION_SIZE_HEURISTIC_FAIL  504
  ------------------
  571|      0|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  572|      0|            }
  573|  4.90k|            if (sec_outp->VirtualSize >
  ------------------
  |  Branch (573:17): [True: 32, False: 4.86k]
  ------------------
  574|  4.90k|                ((Dwarf_Unsigned)2000*
  575|  4.90k|                (Dwarf_Unsigned)1000*
  576|  4.90k|                (Dwarf_Unsigned)1000) &&
  577|     32|                (sec_outp->VirtualSize > pep->pe_filesize)) {
  ------------------
  |  Branch (577:17): [True: 32, False: 0]
  ------------------
  578|       |                /*  Likely unreasonable.
  579|       |                    the hard limit written this way
  580|       |                    simply for clarity.
  581|       |                    Hard to know what to set it to. */
  582|     32|                *errcode = DW_DLE_PE_SECTION_SIZE_HEURISTIC_FAIL;
  ------------------
  |  | 1550|     32|#define DW_DLE_PE_SECTION_SIZE_HEURISTIC_FAIL  504
  ------------------
  583|     32|                return DW_DLV_ERROR;
  ------------------
  |  |   60|     32|#define DW_DLV_ERROR      1
  ------------------
  584|     32|            }
  585|  4.86k|            if (sec_outp->VirtualSize > limit &&
  ------------------
  |  Branch (585:17): [True: 519, False: 4.34k]
  ------------------
  586|    519|                0 == pep->pe_is_64bit ) {
  ------------------
  |  Branch (586:17): [True: 65, False: 454]
  ------------------
  587|       |                /* Likely totally unreasonable. Bad. */
  588|     65|                *errcode = DW_DLE_PE_SECTION_SIZE_HEURISTIC_FAIL;
  ------------------
  |  | 1550|     65|#define DW_DLE_PE_SECTION_SIZE_HEURISTIC_FAIL  504
  ------------------
  589|     65|                return DW_DLV_ERROR;
  ------------------
  |  |   60|     65|#define DW_DLV_ERROR      1
  ------------------
  590|     65|            }
  591|  4.86k|        }
  592|  4.80k|        ASNAR(pep->pe_copy_word,sec_outp->PointerToRawData,
  ------------------
  |  |   53|  4.80k|    do {                                        \
  |  |   54|  4.80k|        (t) = 0;                                \
  |  |   55|  4.80k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.80k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.80k]
  |  |  ------------------
  ------------------
  593|  4.80k|            filesect.PointerToRawData);
  594|  4.80k|        if (sec_outp->SizeOfRawData > pep->pe_filesize ||
  ------------------
  |  Branch (594:13): [True: 55, False: 4.74k]
  ------------------
  595|  4.74k|            sec_outp->PointerToRawData > pep->pe_filesize ||
  ------------------
  |  Branch (595:13): [True: 37, False: 4.71k]
  ------------------
  596|  4.71k|            (sec_outp->SizeOfRawData+
  ------------------
  |  Branch (596:13): [True: 7, False: 4.70k]
  ------------------
  597|  4.71k|                sec_outp->PointerToRawData > pep->pe_filesize)) {
  598|     99|            *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     99|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  599|     99|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     99|#define DW_DLV_ERROR      1
  ------------------
  600|     99|        }
  601|  4.70k|        ASNAR(pep->pe_copy_word,sec_outp->PointerToRelocations,
  ------------------
  |  |   53|  4.70k|    do {                                        \
  |  |   54|  4.70k|        (t) = 0;                                \
  |  |   55|  4.70k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.70k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.70k]
  |  |  ------------------
  ------------------
  602|  4.70k|            filesect.PointerToRelocations);
  603|  4.70k|        ASNAR(pep->pe_copy_word,sec_outp->PointerToLinenumbers,
  ------------------
  |  |   53|  4.70k|    do {                                        \
  |  |   54|  4.70k|        (t) = 0;                                \
  |  |   55|  4.70k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.70k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.70k]
  |  |  ------------------
  ------------------
  604|  4.70k|            filesect.PointerToLinenumbers);
  605|  4.70k|        ASNAR(pep->pe_copy_word,sec_outp->NumberOfRelocations,
  ------------------
  |  |   53|  4.70k|    do {                                        \
  |  |   54|  4.70k|        (t) = 0;                                \
  |  |   55|  4.70k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.70k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.70k]
  |  |  ------------------
  ------------------
  606|  4.70k|            filesect.NumberOfRelocations);
  607|  4.70k|        ASNAR(pep->pe_copy_word,sec_outp->NumberOfLinenumbers,
  ------------------
  |  |   53|  4.70k|    do {                                        \
  |  |   54|  4.70k|        (t) = 0;                                \
  |  |   55|  4.70k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.70k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.70k]
  |  |  ------------------
  ------------------
  608|  4.70k|            filesect.NumberOfLinenumbers);
  609|  4.70k|        ASNAR(pep->pe_copy_word,sec_outp->Characteristics,
  ------------------
  |  |   53|  4.70k|    do {                                        \
  |  |   54|  4.70k|        (t) = 0;                                \
  |  |   55|  4.70k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.70k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.70k]
  |  |  ------------------
  ------------------
  610|  4.70k|            filesect.Characteristics);
  611|       |        /* sec_outp->loaded data set when we load a section */
  612|  4.70k|    }
  613|    264|    return DW_DLV_OK;
  ------------------
  |  |   59|    264|#define DW_DLV_OK         0
  ------------------
  614|    471|}
dwarf_peread.c:pe_section_name_get:
  119|  28.5k|{
  120|  28.5k|    if (name_array[0] == '/') {
  ------------------
  |  Branch (120:9): [True: 1.55k, False: 26.9k]
  ------------------
  121|  1.55k|        long v = 0;
  122|  1.55k|        unsigned long u = 0;
  123|  1.55k|        const char *s = 0;
  124|  1.55k|        char temp_array[9];
  125|  1.55k|        int res = 0;
  126|       |
  127|       |        /*  The value is an integer after the /,
  128|       |            and we want the value */
  129|  1.55k|        _dwarf_safe_strcpy(temp_array,sizeof(temp_array),
  130|  1.55k|            name_array+1,size_name-1);
  131|  1.55k|        v = atoi(temp_array);
  132|  1.55k|        if (v < 0) {
  ------------------
  |  Branch (132:13): [True: 1, False: 1.55k]
  ------------------
  133|      1|            *errcode = DW_DLE_STRING_OFFSET_BAD;
  ------------------
  |  | 1098|      1|#define DW_DLE_STRING_OFFSET_BAD                53
  ------------------
  134|      1|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
  135|      1|        }
  136|  1.55k|        u = v;
  137|  1.55k|        if (!pep->pe_string_table) {
  ------------------
  |  Branch (137:13): [True: 1, False: 1.55k]
  ------------------
  138|      1|            *errcode = DW_DLE_STRING_OFFSET_BAD;
  ------------------
  |  | 1098|      1|#define DW_DLE_STRING_OFFSET_BAD                53
  ------------------
  139|      1|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
  140|      1|        }
  141|  1.55k|        if (u >= pep->pe_string_table_size) {
  ------------------
  |  Branch (141:13): [True: 7, False: 1.54k]
  ------------------
  142|      7|            *errcode = DW_DLE_STRING_OFFSET_BAD;
  ------------------
  |  | 1098|      7|#define DW_DLE_STRING_OFFSET_BAD                53
  ------------------
  143|      7|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      7|#define DW_DLV_ERROR      1
  ------------------
  144|      7|        }
  145|  1.54k|        res = check_valid_string(pep->pe_string_table,
  146|  1.54k|            pep->pe_string_table_size,u);
  147|  1.54k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.54k|#define DW_DLV_OK         0
  ------------------
  |  Branch (147:13): [True: 2, False: 1.54k]
  ------------------
  148|      2|            *errcode = DW_DLE_STRING_OFFSET_BAD;
  ------------------
  |  | 1098|      2|#define DW_DLE_STRING_OFFSET_BAD                53
  ------------------
  149|      2|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
  150|      2|        }
  151|  1.54k|        s = pep->pe_string_table +u;
  152|  1.54k|        *name_out = s;
  153|  1.54k|        return DW_DLV_OK;
  ------------------
  |  |   59|  1.54k|#define DW_DLV_OK         0
  ------------------
  154|  1.54k|    }
  155|  26.9k|    *name_out = name_array;
  156|  26.9k|    return DW_DLV_OK;
  ------------------
  |  |   59|  26.9k|#define DW_DLV_OK         0
  ------------------
  157|  28.5k|}
dwarf_peread.c:check_valid_string:
   99|  1.54k|{
  100|  1.54k|    Dwarf_Unsigned i = startindex;
  101|  16.9k|    for ( ; i < size; ++i) {
  ------------------
  |  Branch (101:13): [True: 16.9k, False: 2]
  ------------------
  102|  16.9k|        if (!tab[i]) {
  ------------------
  |  Branch (102:13): [True: 1.54k, False: 15.3k]
  ------------------
  103|  1.54k|            return DW_DLV_OK;
  ------------------
  |  |   59|  1.54k|#define DW_DLV_OK         0
  ------------------
  104|  1.54k|        }
  105|  16.9k|    }
  106|      2|    return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
  107|  1.54k|}
dwarf_peread.c:is_irrelevant_section:
  342|  28.4k|{
  343|  28.4k|    int res = FALSE;
  ------------------
  |  |   36|  28.4k|#define FALSE 0
  ------------------
  344|       |
  345|  28.4k|    res = in_name_list(name);
  346|  28.4k|    if (res) {
  ------------------
  |  Branch (346:9): [True: 529, False: 27.9k]
  ------------------
  347|    529|        return TRUE;
  ------------------
  |  |   33|    529|#define TRUE 1
  ------------------
  348|    529|    }
  349|  27.9k|    if (!virtsz) {
  ------------------
  |  Branch (349:9): [True: 23.0k, False: 4.90k]
  ------------------
  350|  23.0k|        return TRUE;
  ------------------
  |  |   33|  23.0k|#define TRUE 1
  ------------------
  351|  23.0k|    }
  352|  4.90k|    return FALSE;
  ------------------
  |  |   36|  4.90k|#define FALSE 0
  ------------------
  353|  27.9k|}
dwarf_peread.c:in_name_list:
  322|  28.4k|{
  323|  28.4k|    int i = 0;
  324|       |
  325|  28.4k|    if (!name) {
  ------------------
  |  Branch (325:9): [True: 0, False: 28.4k]
  ------------------
  326|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  327|      0|    }
  328|   141k|    for ( ; ; ++i) {
  329|   141k|        if (!boringname[i]) {
  ------------------
  |  Branch (329:13): [True: 27.9k, False: 113k]
  ------------------
  330|  27.9k|            break;
  331|  27.9k|        }
  332|   113k|        if (!strcmp(name,boringname[i])) {
  ------------------
  |  Branch (332:13): [True: 529, False: 112k]
  ------------------
  333|    529|            return TRUE;
  ------------------
  |  |   33|    529|#define TRUE 1
  ------------------
  334|    529|        }
  335|   113k|    }
  336|  27.9k|    return FALSE;
  ------------------
  |  |   36|  27.9k|#define FALSE 0
  ------------------
  337|  28.4k|}
dwarf_peread.c:pe_get_section_info:
  204|  47.5k|{
  205|  47.5k|    dwarf_pe_object_access_internals_t *pep =
  206|  47.5k|        (dwarf_pe_object_access_internals_t*)(obj);
  207|       |
  208|  47.5k|    (void)error;
  209|  47.5k|    if (section_index < pep->pe_section_count) {
  ------------------
  |  Branch (209:9): [True: 47.5k, False: 0]
  ------------------
  210|  47.5k|        struct dwarf_pe_generic_image_section_header *sp = 0;
  211|  47.5k|        sp = pep->pe_sectionptr + section_index;
  212|  47.5k|        return_section->as_name = sp->dwarfsectname;
  213|  47.5k|        return_section->as_type = 0;
  214|  47.5k|        return_section->as_flags = sp->Characteristics;
  215|  47.5k|        return_section->as_addr = pep->pe_OptionalHeader.ImageBase +
  216|  47.5k|            sp->VirtualAddress;
  217|  47.5k|        return_section->as_offset = sp->PointerToRawData;
  218|       |        /*  SizeOfRawData can be rounded or truncated,
  219|       |            use VirtualSize for the real analog of Elf
  220|       |            section size. */
  221|  47.5k|        return_section->as_size = sp->VirtualSize;
  222|  47.5k|        return_section->as_link = 0;
  223|  47.5k|        return_section->as_info = 0;
  224|  47.5k|        return_section->as_addralign = 0;
  225|  47.5k|        return_section->as_entrysize = 0;
  226|  47.5k|        return DW_DLV_OK;
  ------------------
  |  |   59|  47.5k|#define DW_DLV_OK         0
  ------------------
  227|  47.5k|    }
  228|      0|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  229|  47.5k|}
dwarf_peread.c:pe_get_byte_order:
  161|    264|{
  162|    264|    dwarf_pe_object_access_internals_t *pep =
  163|    264|        (dwarf_pe_object_access_internals_t*)(obj);
  164|    264|    return pep->pe_endian;
  165|    264|}
dwarf_peread.c:pe_get_length_size:
  169|    264|{
  170|    264|    dwarf_pe_object_access_internals_t *pep =
  171|    264|        (dwarf_pe_object_access_internals_t*)(obj);
  172|    264|    return pep->pe_offsetsize/8;
  173|    264|}
dwarf_peread.c:pe_get_pointer_size:
  185|    264|{
  186|    264|    dwarf_pe_object_access_internals_t *pep =
  187|    264|        (dwarf_pe_object_access_internals_t*)(obj);
  188|    264|    return pep->pe_pointersize/8;
  189|    264|}
dwarf_peread.c:pe_get_file_size:
  177|    264|{
  178|    264|    dwarf_pe_object_access_internals_t *pep =
  179|    264|        (dwarf_pe_object_access_internals_t*)(obj);
  180|    264|    return pep->pe_filesize;
  181|    264|}
dwarf_peread.c:pe_get_section_count:
  193|    264|{
  194|    264|    dwarf_pe_object_access_internals_t *pep =
  195|    264|        (dwarf_pe_object_access_internals_t*)(obj);
  196|    264|    return pep->pe_section_count;
  197|    264|}
dwarf_peread.c:pe_load_section:
  358|    205|{
  359|    205|    dwarf_pe_object_access_internals_t *pep =
  360|    205|        (dwarf_pe_object_access_internals_t*)(obj);
  361|       |
  362|    205|    if (0 < section_index &&
  ------------------
  |  Branch (362:9): [True: 205, False: 0]
  ------------------
  363|    205|        section_index < pep->pe_section_count) {
  ------------------
  |  Branch (363:9): [True: 205, False: 0]
  ------------------
  364|    205|        int res = 0;
  365|    205|        struct dwarf_pe_generic_image_section_header *sp =
  366|    205|            pep->pe_sectionptr + section_index;
  367|    205|        Dwarf_Unsigned read_length = 0;
  368|       |
  369|    205|        if (sp->loaded_data) {
  ------------------
  |  Branch (369:13): [True: 0, False: 205]
  ------------------
  370|      0|            *return_data = sp->loaded_data;
  371|      0|            return DW_DLV_OK;
  ------------------
  |  |   59|      0|#define DW_DLV_OK         0
  ------------------
  372|      0|        }
  373|    205|        if (sp->section_irrelevant_to_dwarf) {
  ------------------
  |  Branch (373:13): [True: 0, False: 205]
  ------------------
  374|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  375|      0|        }
  376|    205|        if (!sp->VirtualSize) {
  ------------------
  |  Branch (376:13): [True: 0, False: 205]
  ------------------
  377|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  378|      0|        }
  379|    205|        if (sp->SizeOfRawData >= pep->pe_filesize) {
  ------------------
  |  Branch (379:13): [True: 1, False: 204]
  ------------------
  380|      1|            *error = DW_DLE_PE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1537|      1|#define DW_DLE_PE_SECTION_SIZE_ERROR           491
  ------------------
  381|      1|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
  382|      1|        }
  383|    204|        read_length = sp->SizeOfRawData;
  384|    204|        if (sp->VirtualSize < read_length) {
  ------------------
  |  Branch (384:13): [True: 8, False: 196]
  ------------------
  385|       |            /* Don't read padding that wasn't allocated in memory */
  386|      8|            read_length = sp->VirtualSize;
  387|      8|        }
  388|    204|        if ((read_length + sp->PointerToRawData) >
  ------------------
  |  Branch (388:13): [True: 0, False: 204]
  ------------------
  389|    204|            pep->pe_filesize) {
  390|      0|            *error = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|      0|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  391|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  392|      0|        }
  393|       |        /*  VirtualSize > SizeOfRawData  if trailing zeros
  394|       |            in the section were not written to disc.
  395|       |            Malloc enough for the whole section, read in
  396|       |            the bytes we have. */
  397|       |        /*  A heuristic for corrupt data */
  398|    204|        if (sp->VirtualSize >= 2*pep->pe_filesize) {
  ------------------
  |  Branch (398:13): [True: 99, False: 105]
  ------------------
  399|     99|            *error = DW_DLE_PE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1537|     99|#define DW_DLE_PE_SECTION_SIZE_ERROR           491
  ------------------
  400|     99|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     99|#define DW_DLV_ERROR      1
  ------------------
  401|     99|        }
  402|    105|        sp->loaded_data = malloc((size_t)sp->VirtualSize);
  403|    105|        if (!sp->loaded_data) {
  ------------------
  |  Branch (403:13): [True: 0, False: 105]
  ------------------
  404|      0|            *error = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  405|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  406|      0|        }
  407|    105|        res = _dwarf_object_read_random(pep->pe_fd,
  408|    105|            (char *)sp->loaded_data,
  409|    105|            sp->PointerToRawData, (size_t)read_length,
  410|    105|            pep->pe_filesize,
  411|    105|            error);
  412|    105|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    105|#define DW_DLV_OK         0
  ------------------
  |  Branch (412:13): [True: 1, False: 104]
  ------------------
  413|      1|            free(sp->loaded_data);
  414|      1|            sp->loaded_data = 0;
  415|      1|            return res;
  416|      1|        }
  417|    104|        if (sp->VirtualSize > read_length) {
  ------------------
  |  Branch (417:13): [True: 96, False: 8]
  ------------------
  418|       |            /*  Zero space that was allocated but
  419|       |                truncated from the file */
  420|     96|            memset(sp->loaded_data + read_length, 0,
  421|     96|                (size_t)(sp->VirtualSize - read_length));
  422|     96|        }
  423|    104|        *return_data = sp->loaded_data;
  424|    104|        return DW_DLV_OK;
  ------------------
  |  |   59|    104|#define DW_DLV_OK         0
  ------------------
  425|    105|    }
  426|      0|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  427|    205|}

_dwarf_dealloc_rnglists_context:
  720|  3.37k|{
  721|  3.37k|    Dwarf_Unsigned i = 0;
  722|  3.37k|    Dwarf_Rnglists_Context * rngcon = 0;
  723|       |
  724|  3.37k|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|  3.37k|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|  3.37k|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   33|      0|#define TRUE 1
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   36|  3.37k|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 0, False: 3.37k]
  |  |  |  Branch (159:7): [True: 0, False: 3.37k]
  |  |  |  Branch (159:15): [True: 0, False: 3.37k]
  |  |  ------------------
  ------------------
  725|      0|        return;
  726|      0|    }
  727|  3.37k|    if (!dbg->de_rnglists_context) {
  ------------------
  |  Branch (727:9): [True: 3.37k, False: 0]
  ------------------
  728|  3.37k|        return;
  729|  3.37k|    }
  730|      0|    rngcon = dbg->de_rnglists_context;
  731|      0|    for ( ; i < dbg->de_rnglists_context_count; ++i) {
  ------------------
  |  Branch (731:13): [True: 0, False: 0]
  ------------------
  732|      0|        Dwarf_Rnglists_Context con = rngcon[i];
  733|      0|        free_rnglists_context(con);
  734|      0|        rngcon[i] = 0;
  735|      0|    }
  736|      0|    free(dbg->de_rnglists_context);
  737|      0|    dbg->de_rnglists_context = 0;
  738|      0|    dbg->de_rnglists_context_count = 0;
  739|      0|}

_dwarf_uint64_mult:
  124|  32.4k|{
  125|       |#if 0
  126|       |    This attempts to avoid doing the mult if overflow,
  127|       |    but for C this is unnecessary.
  128|       |    if (y && (x > (ULLONG_MAX/y))) {
  129|       |        _dwarf_error_string(dbg,error,
  130|       |            DW_DLE_ARITHMETIC_OVERFLOW,
  131|       |            "DW_DLE_ARITHMETIC_OVERFLOW "
  132|       |            "unsigned 64bit multiply overflow");
  133|       |        return DW_DLV_ERROR;
  134|       |    }
  135|       |    *result = x*y;
  136|       |#endif /*  */
  137|  32.4k|    Dwarf_Unsigned computed = x * y;
  138|  32.4k|    Dwarf_Unsigned bigger = 0;
  139|       |
  140|  32.4k|    *result = computed;
  141|  32.4k|    if (!x || !y) {
  ------------------
  |  Branch (141:9): [True: 0, False: 32.4k]
  |  Branch (141:15): [True: 0, False: 32.4k]
  ------------------
  142|      0|        return DW_DLV_OK;
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
  143|      0|    }
  144|  32.4k|    bigger = (x > y)?x:y;
  ------------------
  |  Branch (144:14): [True: 21.8k, False: 10.5k]
  ------------------
  145|  32.4k|    if (computed < bigger)  {
  ------------------
  |  Branch (145:9): [True: 0, False: 32.4k]
  ------------------
  146|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  147|      0|    }
  148|  32.4k|    return DW_DLV_OK;
  ------------------
  |  |  122|  32.4k|#define DW_DLV_OK        0
  ------------------
  149|  32.4k|}
_dwarf_uint64_add:
  158|  55.8k|{
  159|  55.8k|    Dwarf_Unsigned computed = dw_lhs + dw_rhs;
  160|  55.8k|    Dwarf_Unsigned bigger = 0;
  161|       |
  162|  55.8k|    if (!dw_lhs || !dw_rhs) {
  ------------------
  |  Branch (162:9): [True: 39.0k, False: 16.7k]
  |  Branch (162:20): [True: 1.13k, False: 15.5k]
  ------------------
  163|  40.2k|        *result = computed;
  164|  40.2k|        return DW_DLV_OK;
  ------------------
  |  |  122|  40.2k|#define DW_DLV_OK        0
  ------------------
  165|  40.2k|    }
  166|  15.5k|    bigger = (dw_lhs > dw_rhs)?dw_lhs:dw_rhs;
  ------------------
  |  Branch (166:14): [True: 4.22k, False: 11.3k]
  ------------------
  167|  15.5k|    if (computed && computed < bigger)  {
  ------------------
  |  Branch (167:9): [True: 15.3k, False: 224]
  |  Branch (167:21): [True: 7, False: 15.3k]
  ------------------
  168|      7|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      7|#define DW_DLV_ERROR     1
  ------------------
  169|      7|    }
  170|  15.5k|    *result = computed;
  171|  15.5k|    return DW_DLV_OK;
  ------------------
  |  |  122|  15.5k|#define DW_DLV_OK        0
  ------------------
  172|  15.5k|}

_dwarf_safe_strcpy:
   76|   631k|{
   77|   631k|    size_t      full_inlen = inlen+1;
   78|   631k|    char       *cpo = 0;
   79|   631k|    const char *cpi= 0;
   80|   631k|    const char *cpiend = 0;
   81|       |
   82|   631k|    if (full_inlen >= outlen) {
  ------------------
  |  Branch (82:9): [True: 28.5k, False: 602k]
  ------------------
   83|  28.5k|        if (!outlen) {
  ------------------
  |  Branch (83:13): [True: 0, False: 28.5k]
  ------------------
   84|      0|            return;
   85|      0|        }
   86|  28.5k|        cpo = out;
   87|  28.5k|        cpi= in_s;
   88|  28.5k|        cpiend = in_s +(outlen-1);
   89|   602k|    } else {
   90|       |        /*  If outlen is very large
   91|       |            strncpy is very wasteful. */
   92|   602k|        cpo = out;
   93|   602k|        cpi= in_s;
   94|   602k|        cpiend = in_s +inlen;
   95|   602k|    }
   96|  4.60M|    for ( ; *cpi && cpi < cpiend ; ++cpo, ++cpi) {
  ------------------
  |  Branch (96:13): [True: 3.99M, False: 610k]
  |  Branch (96:21): [True: 3.97M, False: 20.4k]
  ------------------
   97|  3.97M|        *cpo = *cpi;
   98|  3.97M|    }
   99|   631k|    *cpo = 0;
  100|   631k|}

_dwarf_startswith:
   49|  1.58M|{
   50|  1.58M|    size_t cklen = strlen(ckfor);
   51|       |
   52|  1.58M|    if (! strncmp(input,ckfor,cklen)) {
  ------------------
  |  Branch (52:9): [True: 216k, False: 1.36M]
  ------------------
   53|   216k|        return TRUE;
  ------------------
  |  |   33|   216k|#define TRUE 1
  ------------------
   54|   216k|    }
   55|  1.36M|    return FALSE;
  ------------------
  |  |   36|  1.36M|#define FALSE 0
  ------------------
   56|  1.58M|}
_dwarf_ignorethissection:
  100|   222k|{
  101|   222k|    int l = 0;
  102|   222k|    int h = sizeof(nonsec)/sizeof(const char *) -1;
  103|   222k|    int res = 0;
  104|       |
  105|  1.21M|    while (l <= h) {
  ------------------
  |  Branch (105:12): [True: 1.00M, False: 209k]
  ------------------
  106|  1.00M|        int m = (l+h)/2;
  107|  1.00M|        const char *s = nonsec[m];
  108|       |
  109|  1.00M|        res  = _dwarf_startswithx(scn_name,s);
  110|  1.00M|        if (res < 0) {
  ------------------
  |  Branch (110:13): [True: 447k, False: 562k]
  ------------------
  111|   447k|            h =  m -1;
  112|   562k|        } else if (res > 0) {
  ------------------
  |  Branch (112:20): [True: 549k, False: 13.1k]
  ------------------
  113|   549k|            l =  m + 1;
  114|   549k|        } else {
  115|  13.1k|            return TRUE;
  ------------------
  |  |   33|  13.1k|#define TRUE 1
  ------------------
  116|  13.1k|        }
  117|  1.00M|    }
  118|   209k|    return FALSE;
  ------------------
  |  |   36|   209k|#define FALSE 0
  ------------------
  119|   222k|}
dwarf_secname_ck.c:_dwarf_startswithx:
   60|  1.00M|{
   61|  1.00M|    size_t cklen =  strlen(ckfor);
   62|  1.00M|    int res = 0;
   63|       |
   64|  1.00M|    res = strncmp(input,ckfor,cklen);
   65|  1.00M|    return res;
   66|  1.00M|}

_dwarf_readr:
  107|  1.19M|{
  108|       |
  109|  1.19M|    Dwarf_Signed rcode = 0;
  110|       |#ifdef _WIN64
  111|       |    Dwarf_Unsigned max_single_read = 0x1ffff000;
  112|       |#elif defined(_WIN32)
  113|       |    Dwarf_Unsigned max_single_read = 0xffff;
  114|       |#else
  115|  1.19M|    Dwarf_Unsigned max_single_read = 0x1ffff000;
  116|  1.19M|#endif
  117|  1.19M|    Dwarf_Unsigned remaining_bytes = 0;
  118|  1.19M|    Dwarf_Unsigned totalsize = size;
  119|       |
  120|  1.19M|    remaining_bytes = size;
  121|  2.39M|    while(remaining_bytes > 0) {
  ------------------
  |  Branch (121:11): [True: 1.19M, False: 1.19M]
  ------------------
  122|  1.19M|        if (remaining_bytes > max_single_read) {
  ------------------
  |  Branch (122:13): [True: 0, False: 1.19M]
  ------------------
  123|      0|            size = max_single_read;
  124|      0|        }
  125|       |#ifdef _WIN64
  126|       |        rcode = (Dwarf_Signed)_read(fd,buf,(unsigned const)size);
  127|       |#elif defined(_WIN32)
  128|       |        rcode = (Dwarf_Signed)_read(fd,buf,(unsigned const)size);
  129|       |#else /* linux */
  130|  1.19M|        rcode = (Dwarf_Signed)read(fd,buf,(size_t)size);
  131|  1.19M|#endif
  132|  1.19M|        if (rcode < 0 || rcode != (Dwarf_Signed)size) {
  ------------------
  |  Branch (132:13): [True: 0, False: 1.19M]
  |  Branch (132:26): [True: 0, False: 1.19M]
  ------------------
  133|      0|            return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  134|      0|        }
  135|  1.19M|        remaining_bytes -= size;
  136|  1.19M|        buf += size;
  137|  1.19M|        size = remaining_bytes;
  138|  1.19M|    }
  139|  1.19M|    if (sizeread_out) {
  ------------------
  |  Branch (139:9): [True: 0, False: 1.19M]
  ------------------
  140|      0|        *sizeread_out = totalsize;
  141|      0|    }
  142|  1.19M|    return DW_DLV_OK;
  ------------------
  |  |  122|  1.19M|#define DW_DLV_OK        0
  ------------------
  143|  1.19M|}
_dwarf_seekr:
  150|  1.20M|{
  151|  1.20M|    Dwarf_Signed fsize = 0;
  152|  1.20M|    Dwarf_Signed sloc = 0;
  153|       |
  154|  1.20M|    sloc = (Dwarf_Signed)loc;
  155|  1.20M|    if (sloc < 0) {
  ------------------
  |  Branch (155:9): [True: 0, False: 1.20M]
  ------------------
  156|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  157|      0|    }
  158|       |#ifdef _WIN64
  159|       |    fsize = (Dwarf_Signed)lseek(fd,(__int64)loc,seektype);
  160|       |#elif defined(_WIN32)
  161|       |    fsize = (Dwarf_Signed)lseek(fd,(off_t)loc,seektype);
  162|       |#else /* linux */
  163|  1.20M|    fsize = (Dwarf_Signed)lseek(fd,(off_t)loc,seektype);
  164|  1.20M|#endif
  165|  1.20M|    if (fsize < 0) {
  ------------------
  |  Branch (165:9): [True: 0, False: 1.20M]
  ------------------
  166|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  167|      0|    }
  168|  1.20M|    if (out_loc) {
  ------------------
  |  Branch (168:9): [True: 8.35k, False: 1.19M]
  ------------------
  169|  8.35k|        *out_loc = (Dwarf_Unsigned)fsize;
  170|  8.35k|    }
  171|  1.20M|    return DW_DLV_OK;
  ------------------
  |  |  122|  1.20M|#define DW_DLV_OK        0
  ------------------
  172|  1.20M|}

_dwarf_enter_section_in_de_debug_sections_array:
  270|  79.6k|{
  271|       |    /*  Setup the table that contains the basic information about the
  272|       |        sections that are DWARF related. The entries are very unlikely
  273|       |        to change very often. */
  274|  79.6k|    SET_UP_SECTION(dbg,scn_name,".debug_info",
  ------------------
  |  |  243|  79.6k|    {                                           \
  |  |  244|  79.6k|    int lerr = 0;                               \
  |  |  245|  79.6k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.6k|        (mname),  /* actual section name */     \
  |  |  247|  79.6k|        (mtarg),    /* std section name */      \
  |  |  248|  79.6k|        /* scn_number from macro use context */ \
  |  |  249|  79.6k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.6k|        (minfo),                                \
  |  |  251|  79.6k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.6k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.6k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 18, False: 79.6k]
  |  |  ------------------
  |  |  253|     18|        return lerr;                            \
  |  |  254|     18|    }    /* else fall through. */               \
  |  |  255|  79.6k|    }
  ------------------
  275|  79.6k|        group_number,
  276|  79.6k|        &dbg->de_debug_info,
  277|  79.6k|        DW_DLE_DEBUG_INFO_DUPLICATE,DW_DLE_DEBUG_INFO_NULL,
  278|  79.6k|        TRUE,err);
  279|  79.6k|    SET_UP_SECTION(dbg,scn_name,".debug_info.dwo",
  ------------------
  |  |  243|  79.6k|    {                                           \
  |  |  244|  79.6k|    int lerr = 0;                               \
  |  |  245|  79.6k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.6k|        (mname),  /* actual section name */     \
  |  |  247|  79.6k|        (mtarg),    /* std section name */      \
  |  |  248|  79.6k|        /* scn_number from macro use context */ \
  |  |  249|  79.6k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.6k|        (minfo),                                \
  |  |  251|  79.6k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.6k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.6k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 8, False: 79.6k]
  |  |  ------------------
  |  |  253|      8|        return lerr;                            \
  |  |  254|      8|    }    /* else fall through. */               \
  |  |  255|  79.6k|    }
  ------------------
  280|  79.6k|        DW_GROUPNUMBER_DWO,
  281|  79.6k|        &dbg->de_debug_info,
  282|  79.6k|        DW_DLE_DEBUG_INFO_DUPLICATE,DW_DLE_DEBUG_INFO_NULL,
  283|  79.6k|        TRUE,err);
  284|  79.6k|    SET_UP_SECTION(dbg,scn_name,".debug_types",
  ------------------
  |  |  243|  79.6k|    {                                           \
  |  |  244|  79.6k|    int lerr = 0;                               \
  |  |  245|  79.6k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.6k|        (mname),  /* actual section name */     \
  |  |  247|  79.6k|        (mtarg),    /* std section name */      \
  |  |  248|  79.6k|        /* scn_number from macro use context */ \
  |  |  249|  79.6k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.6k|        (minfo),                                \
  |  |  251|  79.6k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.6k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.6k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 9, False: 79.6k]
  |  |  ------------------
  |  |  253|      9|        return lerr;                            \
  |  |  254|      9|    }    /* else fall through. */               \
  |  |  255|  79.6k|    }
  ------------------
  285|  79.6k|        group_number,
  286|  79.6k|        &dbg->de_debug_types,
  287|  79.6k|        DW_DLE_DEBUG_TYPES_DUPLICATE,DW_DLE_DEBUG_TYPES_NULL,
  288|  79.6k|        TRUE,err);
  289|       |    /* types.dwo  is non-standard. DWARF4 GNU maybe. */
  290|  79.6k|    SET_UP_SECTION(dbg,scn_name,".debug_types.dwo",
  ------------------
  |  |  243|  79.6k|    {                                           \
  |  |  244|  79.6k|    int lerr = 0;                               \
  |  |  245|  79.6k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.6k|        (mname),  /* actual section name */     \
  |  |  247|  79.6k|        (mtarg),    /* std section name */      \
  |  |  248|  79.6k|        /* scn_number from macro use context */ \
  |  |  249|  79.6k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.6k|        (minfo),                                \
  |  |  251|  79.6k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.6k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.6k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 15, False: 79.6k]
  |  |  ------------------
  |  |  253|     15|        return lerr;                            \
  |  |  254|     15|    }    /* else fall through. */               \
  |  |  255|  79.6k|    }
  ------------------
  291|  79.6k|        DW_GROUPNUMBER_DWO,
  292|  79.6k|        &dbg->de_debug_types,
  293|  79.6k|        DW_DLE_DEBUG_TYPES_DUPLICATE,DW_DLE_DEBUG_TYPES_NULL,
  294|  79.6k|        TRUE,err);
  295|  79.6k|    SET_UP_SECTION(dbg,scn_name,".debug_abbrev",
  ------------------
  |  |  243|  79.6k|    {                                           \
  |  |  244|  79.6k|    int lerr = 0;                               \
  |  |  245|  79.6k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.6k|        (mname),  /* actual section name */     \
  |  |  247|  79.6k|        (mtarg),    /* std section name */      \
  |  |  248|  79.6k|        /* scn_number from macro use context */ \
  |  |  249|  79.6k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.6k|        (minfo),                                \
  |  |  251|  79.6k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.6k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.6k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 13, False: 79.6k]
  |  |  ------------------
  |  |  253|     13|        return lerr;                            \
  |  |  254|     13|    }    /* else fall through. */               \
  |  |  255|  79.6k|    }
  ------------------
  296|  79.6k|        group_number,
  297|  79.6k|        &dbg->de_debug_abbrev, /*03*/
  298|  79.6k|        DW_DLE_DEBUG_ABBREV_DUPLICATE,DW_DLE_DEBUG_ABBREV_NULL,
  299|  79.6k|        TRUE,err);
  300|  79.6k|    SET_UP_SECTION(dbg,scn_name,".debug_abbrev.dwo",
  ------------------
  |  |  243|  79.6k|    {                                           \
  |  |  244|  79.6k|    int lerr = 0;                               \
  |  |  245|  79.6k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.6k|        (mname),  /* actual section name */     \
  |  |  247|  79.6k|        (mtarg),    /* std section name */      \
  |  |  248|  79.6k|        /* scn_number from macro use context */ \
  |  |  249|  79.6k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.6k|        (minfo),                                \
  |  |  251|  79.6k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.6k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.6k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 7, False: 79.6k]
  |  |  ------------------
  |  |  253|      7|        return lerr;                            \
  |  |  254|      7|    }    /* else fall through. */               \
  |  |  255|  79.6k|    }
  ------------------
  301|  79.6k|        DW_GROUPNUMBER_DWO,
  302|  79.6k|        &dbg->de_debug_abbrev, /*03*/
  303|  79.6k|        DW_DLE_DEBUG_ABBREV_DUPLICATE,DW_DLE_DEBUG_ABBREV_NULL,
  304|  79.6k|        TRUE,err);
  305|  79.6k|    SET_UP_SECTION(dbg,scn_name,".debug_aranges",
  ------------------
  |  |  243|  79.6k|    {                                           \
  |  |  244|  79.6k|    int lerr = 0;                               \
  |  |  245|  79.6k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.6k|        (mname),  /* actual section name */     \
  |  |  247|  79.6k|        (mtarg),    /* std section name */      \
  |  |  248|  79.6k|        /* scn_number from macro use context */ \
  |  |  249|  79.6k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.6k|        (minfo),                                \
  |  |  251|  79.6k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.6k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.6k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 15, False: 79.6k]
  |  |  ------------------
  |  |  253|     15|        return lerr;                            \
  |  |  254|     15|    }    /* else fall through. */               \
  |  |  255|  79.6k|    }
  ------------------
  306|  79.6k|        group_number,
  307|  79.6k|        &dbg->de_debug_aranges,
  308|  79.6k|        DW_DLE_DEBUG_ARANGES_DUPLICATE,0,
  309|  79.6k|        FALSE,err);
  310|  79.6k|    SET_UP_SECTION(dbg,scn_name,".debug_line",
  ------------------
  |  |  243|  79.6k|    {                                           \
  |  |  244|  79.6k|    int lerr = 0;                               \
  |  |  245|  79.6k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.6k|        (mname),  /* actual section name */     \
  |  |  247|  79.6k|        (mtarg),    /* std section name */      \
  |  |  248|  79.6k|        /* scn_number from macro use context */ \
  |  |  249|  79.6k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.6k|        (minfo),                                \
  |  |  251|  79.6k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.6k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.6k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 15, False: 79.5k]
  |  |  ------------------
  |  |  253|     15|        return lerr;                            \
  |  |  254|     15|    }    /* else fall through. */               \
  |  |  255|  79.6k|    }
  ------------------
  311|  79.6k|        group_number,
  312|  79.6k|        &dbg->de_debug_line,
  313|  79.6k|        DW_DLE_DEBUG_LINE_DUPLICATE,0,
  314|  79.6k|        TRUE,err);
  315|       |    /* DWARF5 */
  316|  79.5k|    SET_UP_SECTION(dbg,scn_name,".debug_line_str",
  ------------------
  |  |  243|  79.5k|    {                                           \
  |  |  244|  79.5k|    int lerr = 0;                               \
  |  |  245|  79.5k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.5k|        (mname),  /* actual section name */     \
  |  |  247|  79.5k|        (mtarg),    /* std section name */      \
  |  |  248|  79.5k|        /* scn_number from macro use context */ \
  |  |  249|  79.5k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.5k|        (minfo),                                \
  |  |  251|  79.5k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.5k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.5k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 14, False: 79.5k]
  |  |  ------------------
  |  |  253|     14|        return lerr;                            \
  |  |  254|     14|    }    /* else fall through. */               \
  |  |  255|  79.5k|    }
  ------------------
  317|  79.5k|        group_number,
  318|  79.5k|        &dbg->de_debug_line_str,
  319|  79.5k|        DW_DLE_DEBUG_LINE_DUPLICATE,0,
  320|  79.5k|        FALSE,err);
  321|  79.5k|    SET_UP_SECTION(dbg,scn_name,".debug_line.dwo",
  ------------------
  |  |  243|  79.5k|    {                                           \
  |  |  244|  79.5k|    int lerr = 0;                               \
  |  |  245|  79.5k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.5k|        (mname),  /* actual section name */     \
  |  |  247|  79.5k|        (mtarg),    /* std section name */      \
  |  |  248|  79.5k|        /* scn_number from macro use context */ \
  |  |  249|  79.5k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.5k|        (minfo),                                \
  |  |  251|  79.5k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.5k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.5k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 20, False: 79.5k]
  |  |  ------------------
  |  |  253|     20|        return lerr;                            \
  |  |  254|     20|    }    /* else fall through. */               \
  |  |  255|  79.5k|    }
  ------------------
  322|  79.5k|        DW_GROUPNUMBER_DWO,
  323|  79.5k|        &dbg->de_debug_line,
  324|  79.5k|        DW_DLE_DEBUG_LINE_DUPLICATE,0,
  325|  79.5k|        TRUE,err);
  326|  79.5k|    SET_UP_SECTION(dbg,scn_name,".debug_frame",
  ------------------
  |  |  243|  79.5k|    {                                           \
  |  |  244|  79.5k|    int lerr = 0;                               \
  |  |  245|  79.5k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.5k|        (mname),  /* actual section name */     \
  |  |  247|  79.5k|        (mtarg),    /* std section name */      \
  |  |  248|  79.5k|        /* scn_number from macro use context */ \
  |  |  249|  79.5k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.5k|        (minfo),                                \
  |  |  251|  79.5k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.5k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.5k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 10, False: 79.5k]
  |  |  ------------------
  |  |  253|     10|        return lerr;                            \
  |  |  254|     10|    }    /* else fall through. */               \
  |  |  255|  79.5k|    }
  ------------------
  327|  79.5k|        group_number,
  328|  79.5k|        &dbg->de_debug_frame,
  329|  79.5k|        DW_DLE_DEBUG_FRAME_DUPLICATE,0,
  330|  79.5k|        TRUE,err);
  331|       |    /* gnu egcs-1.1.2 data */
  332|  79.5k|    SET_UP_SECTION(dbg,scn_name,".eh_frame",
  ------------------
  |  |  243|  79.5k|    {                                           \
  |  |  244|  79.5k|    int lerr = 0;                               \
  |  |  245|  79.5k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.5k|        (mname),  /* actual section name */     \
  |  |  247|  79.5k|        (mtarg),    /* std section name */      \
  |  |  248|  79.5k|        /* scn_number from macro use context */ \
  |  |  249|  79.5k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.5k|        (minfo),                                \
  |  |  251|  79.5k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.5k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.5k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 221, False: 79.3k]
  |  |  ------------------
  |  |  253|    221|        return lerr;                            \
  |  |  254|    221|    }    /* else fall through. */               \
  |  |  255|  79.5k|    }
  ------------------
  333|  79.5k|        group_number,
  334|  79.5k|        &dbg->de_debug_frame_eh_gnu,
  335|  79.5k|        DW_DLE_DEBUG_FRAME_DUPLICATE,0,
  336|  79.5k|        TRUE,err);
  337|  79.3k|    SET_UP_SECTION(dbg,scn_name,".debug_loc",
  ------------------
  |  |  243|  79.3k|    {                                           \
  |  |  244|  79.3k|    int lerr = 0;                               \
  |  |  245|  79.3k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.3k|        (mname),  /* actual section name */     \
  |  |  247|  79.3k|        (mtarg),    /* std section name */      \
  |  |  248|  79.3k|        /* scn_number from macro use context */ \
  |  |  249|  79.3k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.3k|        (minfo),                                \
  |  |  251|  79.3k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.3k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.3k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 18, False: 79.3k]
  |  |  ------------------
  |  |  253|     18|        return lerr;                            \
  |  |  254|     18|    }    /* else fall through. */               \
  |  |  255|  79.3k|    }
  ------------------
  338|  79.3k|        group_number,
  339|  79.3k|        &dbg->de_debug_loc,
  340|  79.3k|        DW_DLE_DEBUG_LOC_DUPLICATE,0,
  341|  79.3k|        FALSE,err);
  342|       |    /*  .debug_loc.dwo would be non-standard. */
  343|  79.3k|    SET_UP_SECTION(dbg,scn_name,".debug_loc.dwo",
  ------------------
  |  |  243|  79.3k|    {                                           \
  |  |  244|  79.3k|    int lerr = 0;                               \
  |  |  245|  79.3k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.3k|        (mname),  /* actual section name */     \
  |  |  247|  79.3k|        (mtarg),    /* std section name */      \
  |  |  248|  79.3k|        /* scn_number from macro use context */ \
  |  |  249|  79.3k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.3k|        (minfo),                                \
  |  |  251|  79.3k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.3k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.3k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 7, False: 79.3k]
  |  |  ------------------
  |  |  253|      7|        return lerr;                            \
  |  |  254|      7|    }    /* else fall through. */               \
  |  |  255|  79.3k|    }
  ------------------
  344|  79.3k|        DW_GROUPNUMBER_DWO,
  345|  79.3k|        &dbg->de_debug_loc,
  346|  79.3k|        DW_DLE_DEBUG_LOC_DUPLICATE,0,
  347|  79.3k|        FALSE,err);
  348|  79.3k|    SET_UP_SECTION(dbg,scn_name,".debug_pubnames",
  ------------------
  |  |  243|  79.3k|    {                                           \
  |  |  244|  79.3k|    int lerr = 0;                               \
  |  |  245|  79.3k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.3k|        (mname),  /* actual section name */     \
  |  |  247|  79.3k|        (mtarg),    /* std section name */      \
  |  |  248|  79.3k|        /* scn_number from macro use context */ \
  |  |  249|  79.3k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.3k|        (minfo),                                \
  |  |  251|  79.3k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.3k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.3k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 8, False: 79.2k]
  |  |  ------------------
  |  |  253|      8|        return lerr;                            \
  |  |  254|      8|    }    /* else fall through. */               \
  |  |  255|  79.3k|    }
  ------------------
  349|  79.3k|        group_number,
  350|  79.3k|        &dbg->de_debug_pubnames,
  351|  79.3k|        DW_DLE_DEBUG_PUBNAMES_DUPLICATE,0,
  352|  79.3k|        FALSE,err);
  353|  79.2k|    SET_UP_SECTION(dbg,scn_name,".debug_str",
  ------------------
  |  |  243|  79.2k|    {                                           \
  |  |  244|  79.2k|    int lerr = 0;                               \
  |  |  245|  79.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.2k|        (mname),  /* actual section name */     \
  |  |  247|  79.2k|        (mtarg),    /* std section name */      \
  |  |  248|  79.2k|        /* scn_number from macro use context */ \
  |  |  249|  79.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.2k|        (minfo),                                \
  |  |  251|  79.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 29, False: 79.2k]
  |  |  ------------------
  |  |  253|     29|        return lerr;                            \
  |  |  254|     29|    }    /* else fall through. */               \
  |  |  255|  79.2k|    }
  ------------------
  354|  79.2k|        group_number,
  355|  79.2k|        &dbg->de_debug_str,
  356|  79.2k|        DW_DLE_DEBUG_STR_DUPLICATE,0,
  357|  79.2k|        FALSE,err);
  358|  79.2k|    SET_UP_SECTION(dbg,scn_name,".debug_str.dwo",
  ------------------
  |  |  243|  79.2k|    {                                           \
  |  |  244|  79.2k|    int lerr = 0;                               \
  |  |  245|  79.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.2k|        (mname),  /* actual section name */     \
  |  |  247|  79.2k|        (mtarg),    /* std section name */      \
  |  |  248|  79.2k|        /* scn_number from macro use context */ \
  |  |  249|  79.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.2k|        (minfo),                                \
  |  |  251|  79.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 7, False: 79.2k]
  |  |  ------------------
  |  |  253|      7|        return lerr;                            \
  |  |  254|      7|    }    /* else fall through. */               \
  |  |  255|  79.2k|    }
  ------------------
  359|  79.2k|        DW_GROUPNUMBER_DWO,
  360|  79.2k|        &dbg->de_debug_str,
  361|  79.2k|        DW_DLE_DEBUG_STR_DUPLICATE,0,
  362|  79.2k|        FALSE,err);
  363|       |    /* Section new in DWARF3.  */
  364|  79.2k|    SET_UP_SECTION(dbg,scn_name,".debug_pubtypes",
  ------------------
  |  |  243|  79.2k|    {                                           \
  |  |  244|  79.2k|    int lerr = 0;                               \
  |  |  245|  79.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.2k|        (mname),  /* actual section name */     \
  |  |  247|  79.2k|        (mtarg),    /* std section name */      \
  |  |  248|  79.2k|        /* scn_number from macro use context */ \
  |  |  249|  79.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.2k|        (minfo),                                \
  |  |  251|  79.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 7, False: 79.2k]
  |  |  ------------------
  |  |  253|      7|        return lerr;                            \
  |  |  254|      7|    }    /* else fall through. */               \
  |  |  255|  79.2k|    }
  ------------------
  365|  79.2k|        group_number,
  366|  79.2k|        &dbg->de_debug_pubtypes,
  367|  79.2k|        /*13*/ DW_DLE_DEBUG_PUBTYPES_DUPLICATE,0,
  368|  79.2k|        FALSE,err);
  369|       |    /* DWARF5 */
  370|  79.2k|    SET_UP_SECTION(dbg,scn_name,".debug_loclists",
  ------------------
  |  |  243|  79.2k|    {                                           \
  |  |  244|  79.2k|    int lerr = 0;                               \
  |  |  245|  79.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.2k|        (mname),  /* actual section name */     \
  |  |  247|  79.2k|        (mtarg),    /* std section name */      \
  |  |  248|  79.2k|        /* scn_number from macro use context */ \
  |  |  249|  79.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.2k|        (minfo),                                \
  |  |  251|  79.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 8, False: 79.2k]
  |  |  ------------------
  |  |  253|      8|        return lerr;                            \
  |  |  254|      8|    }    /* else fall through. */               \
  |  |  255|  79.2k|    }
  ------------------
  371|  79.2k|        group_number,
  372|  79.2k|        &dbg->de_debug_loclists,
  373|  79.2k|        /*13*/ DW_DLE_DEBUG_LOClISTS_DUPLICATE,0,
  374|  79.2k|        FALSE,err);
  375|       |    /* DWARF5 */
  376|  79.2k|    SET_UP_SECTION(dbg,scn_name,".debug_loclists.dwo",
  ------------------
  |  |  243|  79.2k|    {                                           \
  |  |  244|  79.2k|    int lerr = 0;                               \
  |  |  245|  79.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.2k|        (mname),  /* actual section name */     \
  |  |  247|  79.2k|        (mtarg),    /* std section name */      \
  |  |  248|  79.2k|        /* scn_number from macro use context */ \
  |  |  249|  79.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.2k|        (minfo),                                \
  |  |  251|  79.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 12, False: 79.2k]
  |  |  ------------------
  |  |  253|     12|        return lerr;                            \
  |  |  254|     12|    }    /* else fall through. */               \
  |  |  255|  79.2k|    }
  ------------------
  377|  79.2k|        DW_GROUPNUMBER_DWO,
  378|  79.2k|        &dbg->de_debug_loclists,
  379|  79.2k|        /*13*/ DW_DLE_DEBUG_LOClISTS_DUPLICATE,0,
  380|  79.2k|        FALSE,err);
  381|       |    /* DWARF5 */
  382|  79.2k|    SET_UP_SECTION(dbg,scn_name,".debug_rnglists",
  ------------------
  |  |  243|  79.2k|    {                                           \
  |  |  244|  79.2k|    int lerr = 0;                               \
  |  |  245|  79.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.2k|        (mname),  /* actual section name */     \
  |  |  247|  79.2k|        (mtarg),    /* std section name */      \
  |  |  248|  79.2k|        /* scn_number from macro use context */ \
  |  |  249|  79.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.2k|        (minfo),                                \
  |  |  251|  79.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 11, False: 79.2k]
  |  |  ------------------
  |  |  253|     11|        return lerr;                            \
  |  |  254|     11|    }    /* else fall through. */               \
  |  |  255|  79.2k|    }
  ------------------
  383|  79.2k|        group_number,
  384|  79.2k|        &dbg->de_debug_rnglists,
  385|  79.2k|        /*13*/ DW_DLE_DEBUG_RNGLISTS_DUPLICATE,0,
  386|  79.2k|        FALSE,err);
  387|       |    /* DWARF5 */
  388|  79.2k|    SET_UP_SECTION(dbg,scn_name,".debug_rnglists.dwo",
  ------------------
  |  |  243|  79.2k|    {                                           \
  |  |  244|  79.2k|    int lerr = 0;                               \
  |  |  245|  79.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.2k|        (mname),  /* actual section name */     \
  |  |  247|  79.2k|        (mtarg),    /* std section name */      \
  |  |  248|  79.2k|        /* scn_number from macro use context */ \
  |  |  249|  79.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.2k|        (minfo),                                \
  |  |  251|  79.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 7, False: 79.2k]
  |  |  ------------------
  |  |  253|      7|        return lerr;                            \
  |  |  254|      7|    }    /* else fall through. */               \
  |  |  255|  79.2k|    }
  ------------------
  389|  79.2k|        DW_GROUPNUMBER_DWO,
  390|  79.2k|        &dbg->de_debug_rnglists,
  391|  79.2k|        /*13*/ DW_DLE_DEBUG_RNGLISTS_DUPLICATE,0,
  392|  79.2k|        FALSE,err);
  393|       |    /* DWARF5 */
  394|  79.2k|    SET_UP_SECTION(dbg,scn_name,".debug_str_offsets",
  ------------------
  |  |  243|  79.2k|    {                                           \
  |  |  244|  79.2k|    int lerr = 0;                               \
  |  |  245|  79.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.2k|        (mname),  /* actual section name */     \
  |  |  247|  79.2k|        (mtarg),    /* std section name */      \
  |  |  248|  79.2k|        /* scn_number from macro use context */ \
  |  |  249|  79.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.2k|        (minfo),                                \
  |  |  251|  79.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 16, False: 79.1k]
  |  |  ------------------
  |  |  253|     16|        return lerr;                            \
  |  |  254|     16|    }    /* else fall through. */               \
  |  |  255|  79.2k|    }
  ------------------
  395|  79.2k|        group_number,
  396|  79.2k|        &dbg->de_debug_str_offsets,
  397|  79.2k|        DW_DLE_DEBUG_STR_OFFSETS_DUPLICATE,0,
  398|  79.2k|        FALSE,err);
  399|       |    /* DWARF5 */
  400|  79.1k|    SET_UP_SECTION(dbg,scn_name,".debug_str_offsets.dwo",
  ------------------
  |  |  243|  79.1k|    {                                           \
  |  |  244|  79.1k|    int lerr = 0;                               \
  |  |  245|  79.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.1k|        (mname),  /* actual section name */     \
  |  |  247|  79.1k|        (mtarg),    /* std section name */      \
  |  |  248|  79.1k|        /* scn_number from macro use context */ \
  |  |  249|  79.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.1k|        (minfo),                                \
  |  |  251|  79.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 4, False: 79.1k]
  |  |  ------------------
  |  |  253|      4|        return lerr;                            \
  |  |  254|      4|    }    /* else fall through. */               \
  |  |  255|  79.1k|    }
  ------------------
  401|  79.1k|        DW_GROUPNUMBER_DWO,
  402|  79.1k|        &dbg->de_debug_str_offsets,
  403|  79.1k|        DW_DLE_DEBUG_STR_OFFSETS_DUPLICATE,0,
  404|  79.1k|        FALSE,err);
  405|       |
  406|       |    /* SGI IRIX-only. */
  407|  79.1k|    SET_UP_SECTION(dbg,scn_name,".debug_funcnames",
  ------------------
  |  |  243|  79.1k|    {                                           \
  |  |  244|  79.1k|    int lerr = 0;                               \
  |  |  245|  79.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.1k|        (mname),  /* actual section name */     \
  |  |  247|  79.1k|        (mtarg),    /* std section name */      \
  |  |  248|  79.1k|        /* scn_number from macro use context */ \
  |  |  249|  79.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.1k|        (minfo),                                \
  |  |  251|  79.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 5, False: 79.1k]
  |  |  ------------------
  |  |  253|      5|        return lerr;                            \
  |  |  254|      5|    }    /* else fall through. */               \
  |  |  255|  79.1k|    }
  ------------------
  408|  79.1k|        group_number,
  409|  79.1k|        &dbg->de_debug_funcnames,
  410|  79.1k|        /*11*/ DW_DLE_DEBUG_FUNCNAMES_DUPLICATE,0,
  411|  79.1k|        FALSE,err);
  412|       |    /*  SGI IRIX-only, created years before DWARF3. Content
  413|       |        essentially identical to .debug_pubtypes.  */
  414|  79.1k|    SET_UP_SECTION(dbg,scn_name,".debug_typenames",
  ------------------
  |  |  243|  79.1k|    {                                           \
  |  |  244|  79.1k|    int lerr = 0;                               \
  |  |  245|  79.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.1k|        (mname),  /* actual section name */     \
  |  |  247|  79.1k|        (mtarg),    /* std section name */      \
  |  |  248|  79.1k|        /* scn_number from macro use context */ \
  |  |  249|  79.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.1k|        (minfo),                                \
  |  |  251|  79.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 7, False: 79.1k]
  |  |  ------------------
  |  |  253|      7|        return lerr;                            \
  |  |  254|      7|    }    /* else fall through. */               \
  |  |  255|  79.1k|    }
  ------------------
  415|  79.1k|        group_number,
  416|  79.1k|        &dbg->de_debug_typenames,
  417|  79.1k|        /*12*/ DW_DLE_DEBUG_TYPENAMES_DUPLICATE,0,
  418|  79.1k|        FALSE,err);
  419|       |    /* SGI IRIX-only.  */
  420|  79.1k|    SET_UP_SECTION(dbg,scn_name,".debug_varnames",
  ------------------
  |  |  243|  79.1k|    {                                           \
  |  |  244|  79.1k|    int lerr = 0;                               \
  |  |  245|  79.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.1k|        (mname),  /* actual section name */     \
  |  |  247|  79.1k|        (mtarg),    /* std section name */      \
  |  |  248|  79.1k|        /* scn_number from macro use context */ \
  |  |  249|  79.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.1k|        (minfo),                                \
  |  |  251|  79.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 4, False: 79.1k]
  |  |  ------------------
  |  |  253|      4|        return lerr;                            \
  |  |  254|      4|    }    /* else fall through. */               \
  |  |  255|  79.1k|    }
  ------------------
  421|  79.1k|        group_number,
  422|  79.1k|        &dbg->de_debug_varnames,
  423|  79.1k|        DW_DLE_DEBUG_VARNAMES_DUPLICATE,0,
  424|  79.1k|        FALSE,err);
  425|       |    /* SGI IRIX-only. */
  426|  79.1k|    SET_UP_SECTION(dbg,scn_name,".debug_weaknames",
  ------------------
  |  |  243|  79.1k|    {                                           \
  |  |  244|  79.1k|    int lerr = 0;                               \
  |  |  245|  79.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.1k|        (mname),  /* actual section name */     \
  |  |  247|  79.1k|        (mtarg),    /* std section name */      \
  |  |  248|  79.1k|        /* scn_number from macro use context */ \
  |  |  249|  79.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.1k|        (minfo),                                \
  |  |  251|  79.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 4, False: 79.1k]
  |  |  ------------------
  |  |  253|      4|        return lerr;                            \
  |  |  254|      4|    }    /* else fall through. */               \
  |  |  255|  79.1k|    }
  ------------------
  427|  79.1k|        group_number,
  428|  79.1k|        &dbg->de_debug_weaknames,
  429|  79.1k|        DW_DLE_DEBUG_WEAKNAMES_DUPLICATE,0,
  430|  79.1k|        FALSE,err);
  431|       |
  432|  79.1k|    SET_UP_SECTION(dbg,scn_name,".debug_macinfo",
  ------------------
  |  |  243|  79.1k|    {                                           \
  |  |  244|  79.1k|    int lerr = 0;                               \
  |  |  245|  79.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.1k|        (mname),  /* actual section name */     \
  |  |  247|  79.1k|        (mtarg),    /* std section name */      \
  |  |  248|  79.1k|        /* scn_number from macro use context */ \
  |  |  249|  79.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.1k|        (minfo),                                \
  |  |  251|  79.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 19, False: 79.1k]
  |  |  ------------------
  |  |  253|     19|        return lerr;                            \
  |  |  254|     19|    }    /* else fall through. */               \
  |  |  255|  79.1k|    }
  ------------------
  433|  79.1k|        group_number,
  434|  79.1k|        &dbg->de_debug_macinfo,
  435|  79.1k|        DW_DLE_DEBUG_MACINFO_DUPLICATE,0,
  436|  79.1k|        TRUE,err);
  437|       |    /*  ".debug_macinfo.dwo" is not allowed.  */
  438|       |
  439|       |    /* DWARF5 */
  440|  79.1k|    SET_UP_SECTION(dbg,scn_name,".debug_macro",
  ------------------
  |  |  243|  79.1k|    {                                           \
  |  |  244|  79.1k|    int lerr = 0;                               \
  |  |  245|  79.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.1k|        (mname),  /* actual section name */     \
  |  |  247|  79.1k|        (mtarg),    /* std section name */      \
  |  |  248|  79.1k|        /* scn_number from macro use context */ \
  |  |  249|  79.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.1k|        (minfo),                                \
  |  |  251|  79.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 11, False: 79.1k]
  |  |  ------------------
  |  |  253|     11|        return lerr;                            \
  |  |  254|     11|    }    /* else fall through. */               \
  |  |  255|  79.1k|    }
  ------------------
  441|  79.1k|        group_number,
  442|  79.1k|        &dbg->de_debug_macro,
  443|  79.1k|        DW_DLE_DEBUG_MACRO_DUPLICATE,0,
  444|  79.1k|        TRUE,err);
  445|       |    /* DWARF5 */
  446|  79.1k|    SET_UP_SECTION(dbg,scn_name,".debug_macro.dwo",
  ------------------
  |  |  243|  79.1k|    {                                           \
  |  |  244|  79.1k|    int lerr = 0;                               \
  |  |  245|  79.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.1k|        (mname),  /* actual section name */     \
  |  |  247|  79.1k|        (mtarg),    /* std section name */      \
  |  |  248|  79.1k|        /* scn_number from macro use context */ \
  |  |  249|  79.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.1k|        (minfo),                                \
  |  |  251|  79.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 13, False: 79.1k]
  |  |  ------------------
  |  |  253|     13|        return lerr;                            \
  |  |  254|     13|    }    /* else fall through. */               \
  |  |  255|  79.1k|    }
  ------------------
  447|  79.1k|        DW_GROUPNUMBER_DWO,
  448|  79.1k|        &dbg->de_debug_macro,
  449|  79.1k|        DW_DLE_DEBUG_MACRO_DUPLICATE,0,
  450|  79.1k|        TRUE,err);
  451|  79.1k|    SET_UP_SECTION(dbg,scn_name,".debug_ranges",
  ------------------
  |  |  243|  79.1k|    {                                           \
  |  |  244|  79.1k|    int lerr = 0;                               \
  |  |  245|  79.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.1k|        (mname),  /* actual section name */     \
  |  |  247|  79.1k|        (mtarg),    /* std section name */      \
  |  |  248|  79.1k|        /* scn_number from macro use context */ \
  |  |  249|  79.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.1k|        (minfo),                                \
  |  |  251|  79.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 9, False: 79.1k]
  |  |  ------------------
  |  |  253|      9|        return lerr;                            \
  |  |  254|      9|    }    /* else fall through. */               \
  |  |  255|  79.1k|    }
  ------------------
  452|  79.1k|        group_number,
  453|  79.1k|        &dbg->de_debug_ranges,
  454|  79.1k|        DW_DLE_DEBUG_RANGES_DUPLICATE,0,
  455|  79.1k|        TRUE,err);
  456|       |    /*  No .debug_ranges.dwo allowed. */
  457|       |
  458|       |    /* New DWARF5 */
  459|  79.1k|    SET_UP_SECTION(dbg,scn_name,".debug_sup",
  ------------------
  |  |  243|  79.1k|    {                                           \
  |  |  244|  79.1k|    int lerr = 0;                               \
  |  |  245|  79.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  79.1k|        (mname),  /* actual section name */     \
  |  |  247|  79.1k|        (mtarg),    /* std section name */      \
  |  |  248|  79.1k|        /* scn_number from macro use context */ \
  |  |  249|  79.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  79.1k|        (minfo),                                \
  |  |  251|  79.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  79.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  79.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 502, False: 78.6k]
  |  |  ------------------
  |  |  253|    502|        return lerr;                            \
  |  |  254|    502|    }    /* else fall through. */               \
  |  |  255|  79.1k|    }
  ------------------
  460|  79.1k|        group_number,
  461|  79.1k|        &dbg->de_debug_sup,
  462|  79.1k|        DW_DLE_DEBUG_SUP_DUPLICATE,0,
  463|  79.1k|        TRUE,err);
  464|       |    /* No .debug_sup.dwo allowed. */
  465|       |
  466|       |    /*  .symtab and .strtab have to be in any group.  */
  467|  78.6k|    SET_UP_SECTION(dbg,scn_name,".symtab",
  ------------------
  |  |  243|  78.6k|    {                                           \
  |  |  244|  78.6k|    int lerr = 0;                               \
  |  |  245|  78.6k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  78.6k|        (mname),  /* actual section name */     \
  |  |  247|  78.6k|        (mtarg),    /* std section name */      \
  |  |  248|  78.6k|        /* scn_number from macro use context */ \
  |  |  249|  78.6k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  78.6k|        (minfo),                                \
  |  |  251|  78.6k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  78.6k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  78.6k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 68, False: 78.5k]
  |  |  ------------------
  |  |  253|     68|        return lerr;                            \
  |  |  254|     68|    }    /* else fall through. */               \
  |  |  255|  78.6k|    }
  ------------------
  468|  78.6k|        group_number,
  469|  78.6k|        &dbg->de_elf_symtab,
  470|  78.6k|        DW_DLE_DEBUG_SYMTAB_ERR,0,
  471|  78.6k|        FALSE,err);
  472|  78.5k|    SET_UP_SECTION(dbg,scn_name,".strtab",
  ------------------
  |  |  243|  78.5k|    {                                           \
  |  |  244|  78.5k|    int lerr = 0;                               \
  |  |  245|  78.5k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  78.5k|        (mname),  /* actual section name */     \
  |  |  247|  78.5k|        (mtarg),    /* std section name */      \
  |  |  248|  78.5k|        /* scn_number from macro use context */ \
  |  |  249|  78.5k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  78.5k|        (minfo),                                \
  |  |  251|  78.5k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  78.5k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  78.5k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 105, False: 78.4k]
  |  |  ------------------
  |  |  253|    105|        return lerr;                            \
  |  |  254|    105|    }    /* else fall through. */               \
  |  |  255|  78.5k|    }
  ------------------
  473|  78.5k|        group_number,
  474|  78.5k|        &dbg->de_elf_strtab,
  475|  78.5k|        DW_DLE_DEBUG_STRTAB_ERR,0,
  476|  78.5k|        FALSE,err);
  477|       |
  478|       |    /* New DWARF5 */
  479|  78.4k|    SET_UP_SECTION(dbg,scn_name,".debug_addr",
  ------------------
  |  |  243|  78.4k|    {                                           \
  |  |  244|  78.4k|    int lerr = 0;                               \
  |  |  245|  78.4k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  78.4k|        (mname),  /* actual section name */     \
  |  |  247|  78.4k|        (mtarg),    /* std section name */      \
  |  |  248|  78.4k|        /* scn_number from macro use context */ \
  |  |  249|  78.4k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  78.4k|        (minfo),                                \
  |  |  251|  78.4k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  78.4k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  78.4k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 11, False: 78.4k]
  |  |  ------------------
  |  |  253|     11|        return lerr;                            \
  |  |  254|     11|    }    /* else fall through. */               \
  |  |  255|  78.4k|    }
  ------------------
  480|  78.4k|        group_number,
  481|  78.4k|        &dbg->de_debug_addr,
  482|  78.4k|        DW_DLE_DEBUG_ADDR_DUPLICATE,0,
  483|  78.4k|        TRUE,err);
  484|       |    /*  No .debug_addr.dwo allowed.  */
  485|       |
  486|       |    /* gdb added this. */
  487|  78.4k|    SET_UP_SECTION(dbg,scn_name,".gdb_index",
  ------------------
  |  |  243|  78.4k|    {                                           \
  |  |  244|  78.4k|    int lerr = 0;                               \
  |  |  245|  78.4k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  78.4k|        (mname),  /* actual section name */     \
  |  |  247|  78.4k|        (mtarg),    /* std section name */      \
  |  |  248|  78.4k|        /* scn_number from macro use context */ \
  |  |  249|  78.4k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  78.4k|        (minfo),                                \
  |  |  251|  78.4k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  78.4k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  78.4k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 20, False: 78.4k]
  |  |  ------------------
  |  |  253|     20|        return lerr;                            \
  |  |  254|     20|    }    /* else fall through. */               \
  |  |  255|  78.4k|    }
  ------------------
  488|  78.4k|        group_number,
  489|  78.4k|        &dbg->de_debug_gdbindex,
  490|  78.4k|        DW_DLE_DUPLICATE_GDB_INDEX,0,
  491|  78.4k|        FALSE,err);
  492|       |
  493|       |    /* New DWARF5 */
  494|  78.4k|    SET_UP_SECTION(dbg,scn_name,".debug_names",
  ------------------
  |  |  243|  78.4k|    {                                           \
  |  |  244|  78.4k|    int lerr = 0;                               \
  |  |  245|  78.4k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  78.4k|        (mname),  /* actual section name */     \
  |  |  247|  78.4k|        (mtarg),    /* std section name */      \
  |  |  248|  78.4k|        /* scn_number from macro use context */ \
  |  |  249|  78.4k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  78.4k|        (minfo),                                \
  |  |  251|  78.4k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  78.4k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  78.4k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 13, False: 78.4k]
  |  |  ------------------
  |  |  253|     13|        return lerr;                            \
  |  |  254|     13|    }    /* else fall through. */               \
  |  |  255|  78.4k|    }
  ------------------
  495|  78.4k|        group_number,
  496|  78.4k|        &dbg->de_debug_names,
  497|  78.4k|        /*13*/ DW_DLE_DEBUG_NAMES_DUPLICATE,0,
  498|  78.4k|        FALSE,err);
  499|       |    /* No .debug_names.dwo allowed. */
  500|       |
  501|       |    /* gdb added this in DW4. It is in standard DWARF5  */
  502|  78.4k|    SET_UP_SECTION(dbg,scn_name,".debug_cu_index",
  ------------------
  |  |  243|  78.4k|    {                                           \
  |  |  244|  78.4k|    int lerr = 0;                               \
  |  |  245|  78.4k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  78.4k|        (mname),  /* actual section name */     \
  |  |  247|  78.4k|        (mtarg),    /* std section name */      \
  |  |  248|  78.4k|        /* scn_number from macro use context */ \
  |  |  249|  78.4k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  78.4k|        (minfo),                                \
  |  |  251|  78.4k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  78.4k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  78.4k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 382, False: 78.0k]
  |  |  ------------------
  |  |  253|    382|        return lerr;                            \
  |  |  254|    382|    }    /* else fall through. */               \
  |  |  255|  78.4k|    }
  ------------------
  503|  78.4k|        DW_GROUPNUMBER_DWO,
  504|  78.4k|        &dbg->de_debug_cu_index,
  505|  78.4k|        DW_DLE_DUPLICATE_CU_INDEX,0,
  506|  78.4k|        FALSE,err);
  507|       |    /* gdb added this in DW4. It is in standard DWARF5 */
  508|  78.0k|    SET_UP_SECTION(dbg,scn_name,".debug_tu_index",
  ------------------
  |  |  243|  78.0k|    {                                           \
  |  |  244|  78.0k|    int lerr = 0;                               \
  |  |  245|  78.0k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  78.0k|        (mname),  /* actual section name */     \
  |  |  247|  78.0k|        (mtarg),    /* std section name */      \
  |  |  248|  78.0k|        /* scn_number from macro use context */ \
  |  |  249|  78.0k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  78.0k|        (minfo),                                \
  |  |  251|  78.0k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  78.0k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  78.0k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 188, False: 77.8k]
  |  |  ------------------
  |  |  253|    188|        return lerr;                            \
  |  |  254|    188|    }    /* else fall through. */               \
  |  |  255|  78.0k|    }
  ------------------
  509|  78.0k|        DW_GROUPNUMBER_DWO,
  510|  78.0k|        &dbg->de_debug_tu_index,
  511|  78.0k|        DW_DLE_DUPLICATE_TU_INDEX,0,
  512|  78.0k|        FALSE,err);
  513|       |
  514|       |    /*  GNU added this. It is not part of DWARF, but we will
  515|       |        consider it is so that debuglink can work.
  516|       |        Force have_dwarf TRUE github issue 297 */
  517|  77.8k|    SET_UP_SECTION(dbg,scn_name,".gnu_debuglink",
  ------------------
  |  |  243|  77.8k|    {                                           \
  |  |  244|  77.8k|    int lerr = 0;                               \
  |  |  245|  77.8k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  77.8k|        (mname),  /* actual section name */     \
  |  |  247|  77.8k|        (mtarg),    /* std section name */      \
  |  |  248|  77.8k|        /* scn_number from macro use context */ \
  |  |  249|  77.8k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  77.8k|        (minfo),                                \
  |  |  251|  77.8k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  77.8k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  77.8k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 345, False: 77.4k]
  |  |  ------------------
  |  |  253|    345|        return lerr;                            \
  |  |  254|    345|    }    /* else fall through. */               \
  |  |  255|  77.8k|    }
  ------------------
  518|  77.8k|        DW_GROUPNUMBER_DWO,
  519|  77.8k|        &dbg->de_gnu_debuglink,
  520|  77.8k|        DW_DLE_DUPLICATE_GNU_DEBUGLINK,0,
  521|  77.8k|        TRUE,err);
  522|       |
  523|       |    /*  GNU added this. It is not part of DWARF, but we will
  524|       |        consider it is so that debuglink can work,
  525|       |        Force have_dwarf TRUE github issue 297 */
  526|  77.4k|    SET_UP_SECTION(dbg,scn_name,".note.gnu.build-id",
  ------------------
  |  |  243|  77.4k|    {                                           \
  |  |  244|  77.4k|    int lerr = 0;                               \
  |  |  245|  77.4k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  77.4k|        (mname),  /* actual section name */     \
  |  |  247|  77.4k|        (mtarg),    /* std section name */      \
  |  |  248|  77.4k|        /* scn_number from macro use context */ \
  |  |  249|  77.4k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  77.4k|        (minfo),                                \
  |  |  251|  77.4k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  77.4k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  77.4k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 550, False: 76.9k]
  |  |  ------------------
  |  |  253|    550|        return lerr;                            \
  |  |  254|    550|    }    /* else fall through. */               \
  |  |  255|  77.4k|    }
  ------------------
  527|  77.4k|        DW_GROUPNUMBER_DWO,
  528|  77.4k|        &dbg->de_note_gnu_buildid,
  529|  77.4k|        DW_DLE_DUPLICATE_NOTE_GNU_BUILD_ID,0,
  530|  77.4k|        TRUE,err);
  531|       |
  532|       |    /* GNU added this. It is not part of DWARF */
  533|  76.9k|    SET_UP_SECTION(dbg,scn_name,".debug_gnu_pubtypes.dwo",
  ------------------
  |  |  243|  76.9k|    {                                           \
  |  |  244|  76.9k|    int lerr = 0;                               \
  |  |  245|  76.9k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  76.9k|        (mname),  /* actual section name */     \
  |  |  247|  76.9k|        (mtarg),    /* std section name */      \
  |  |  248|  76.9k|        /* scn_number from macro use context */ \
  |  |  249|  76.9k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  76.9k|        (minfo),                                \
  |  |  251|  76.9k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  76.9k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  76.9k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 6, False: 76.9k]
  |  |  ------------------
  |  |  253|      6|        return lerr;                            \
  |  |  254|      6|    }    /* else fall through. */               \
  |  |  255|  76.9k|    }
  ------------------
  534|  76.9k|        DW_GROUPNUMBER_DWO,
  535|  76.9k|        &dbg->de_debug_gnu_pubtypes,
  536|  76.9k|        DW_DLE_DUPLICATE_GNU_DEBUG_PUBTYPES,0,
  537|  76.9k|        FALSE,err);
  538|  76.9k|    SET_UP_SECTION(dbg,scn_name,".debug_gnu_pubtypes",
  ------------------
  |  |  243|  76.9k|    {                                           \
  |  |  244|  76.9k|    int lerr = 0;                               \
  |  |  245|  76.9k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  76.9k|        (mname),  /* actual section name */     \
  |  |  247|  76.9k|        (mtarg),    /* std section name */      \
  |  |  248|  76.9k|        /* scn_number from macro use context */ \
  |  |  249|  76.9k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  76.9k|        (minfo),                                \
  |  |  251|  76.9k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  76.9k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  76.9k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 12, False: 76.9k]
  |  |  ------------------
  |  |  253|     12|        return lerr;                            \
  |  |  254|     12|    }    /* else fall through. */               \
  |  |  255|  76.9k|    }
  ------------------
  539|  76.9k|        group_number,
  540|  76.9k|        &dbg->de_debug_gnu_pubtypes,
  541|  76.9k|        DW_DLE_DUPLICATE_GNU_DEBUG_PUBTYPES,0,
  542|  76.9k|        FALSE,err);
  543|  76.9k|    SET_UP_SECTION(dbg,scn_name,".debug_gnu_pubnames.dwo",
  ------------------
  |  |  243|  76.9k|    {                                           \
  |  |  244|  76.9k|    int lerr = 0;                               \
  |  |  245|  76.9k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  76.9k|        (mname),  /* actual section name */     \
  |  |  247|  76.9k|        (mtarg),    /* std section name */      \
  |  |  248|  76.9k|        /* scn_number from macro use context */ \
  |  |  249|  76.9k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  76.9k|        (minfo),                                \
  |  |  251|  76.9k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  76.9k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  76.9k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 8, False: 76.9k]
  |  |  ------------------
  |  |  253|      8|        return lerr;                            \
  |  |  254|      8|    }    /* else fall through. */               \
  |  |  255|  76.9k|    }
  ------------------
  544|  76.9k|        DW_GROUPNUMBER_DWO,
  545|  76.9k|        &dbg->de_debug_gnu_pubnames,
  546|  76.9k|        DW_DLE_DUPLICATE_GNU_DEBUG_PUBNAMES,0,
  547|  76.9k|        FALSE,err);
  548|  76.9k|    SET_UP_SECTION(dbg,scn_name,".debug_gnu_pubnames",
  ------------------
  |  |  243|  76.9k|    {                                           \
  |  |  244|  76.9k|    int lerr = 0;                               \
  |  |  245|  76.9k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  76.9k|        (mname),  /* actual section name */     \
  |  |  247|  76.9k|        (mtarg),    /* std section name */      \
  |  |  248|  76.9k|        /* scn_number from macro use context */ \
  |  |  249|  76.9k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  76.9k|        (minfo),                                \
  |  |  251|  76.9k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  76.9k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  76.9k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 15, False: 76.8k]
  |  |  ------------------
  |  |  253|     15|        return lerr;                            \
  |  |  254|     15|    }    /* else fall through. */               \
  |  |  255|  76.9k|    }
  ------------------
  549|  76.9k|        group_number,
  550|  76.9k|        &dbg->de_debug_gnu_pubnames,
  551|  76.9k|        DW_DLE_DUPLICATE_GNU_DEBUG_PUBNAMES,0,
  552|  76.9k|        FALSE,err);
  553|  76.8k|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|  76.8k|#define DW_DLV_NO_ENTRY -1
  ------------------
  554|  76.9k|}
dwarf_setup_sections.c:set_up_section:
  158|  3.63M|{
  159|       |    /*  Here accommodate the .debug or .zdebug version, (and of
  160|       |        course non- .debug too, but those never zlib) .
  161|       |        SECNAMEMAX should be a little bigger than any section
  162|       |        name we care about as possibly compressed, which
  163|       |        is to say bigger than any standard section name. */
  164|  3.63M|#define SECNAMEMAX 30
  165|  3.63M|    size_t secnamelen = strlen(secname);
  166|       |    /* static const char *dprefix = ".debug_"; */
  167|  3.63M|#define DPREFIXLEN 7
  168|  3.63M|    static const char *zprefix = ".zdebug_";
  169|  3.63M|#define ZPREFIXLEN 8
  170|  3.63M|    int havezdebug = FALSE;
  ------------------
  |  |   36|  3.63M|#define FALSE 0
  ------------------
  171|  3.63M|    int namesmatch = FALSE;
  ------------------
  |  |   36|  3.63M|#define FALSE 0
  ------------------
  172|  3.63M|    const char *postzprefix = 0;
  173|       |
  174|       |    /*  For example, if the secname is .zdebug_info
  175|       |        we update the finaltargname to .debug_info
  176|       |        to match with the particular (known, predefined)
  177|       |        object section name.
  178|       |        We add one character, so check
  179|       |        to see if it will, in the end, fit.
  180|       |        See the SET_UP_SECTION macro.  */
  181|       |
  182|  3.63M|    if (secnamelen >= SECNAMEMAX) {
  ------------------
  |  |  164|  3.63M|#define SECNAMEMAX 30
  ------------------
  |  Branch (182:9): [True: 26.3k, False: 3.60M]
  ------------------
  183|       |        /*  This is not the target section.
  184|       |            our caller will keep looking. */
  185|  26.3k|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|  26.3k|#define DW_DLV_NO_ENTRY -1
  ------------------
  186|  26.3k|    }
  187|  3.60M|    havezdebug = !strncmp(secname,zprefix,ZPREFIXLEN);
  ------------------
  |  |  169|  3.60M|#define ZPREFIXLEN 8
  ------------------
  188|  3.60M|    if (havezdebug) {
  ------------------
  |  Branch (188:9): [True: 1.95M, False: 1.65M]
  ------------------
  189|  1.95M|        postzprefix = secname+ZPREFIXLEN;
  ------------------
  |  |  169|  1.95M|#define ZPREFIXLEN 8
  ------------------
  190|  1.95M|    }
  191|       |    /*  With Alpine gcc
  192|       |        12.2.1_git20220924-r4) 12.2.1 20220924
  193|       |        and some other gcc versions when compiling
  194|       |        with -Werror and -fsanitize:
  195|       |        we get
  196|       |        error: 'strcmp' reading 1 or more bytes
  197|       |        from a region of size 0 [-Werror=stringop-overread]
  198|       |        So we add -Wnostringop-overread to the build as the error is
  199|       |        a false positive. We had to drop stringop-overread
  200|       |        references in compiler options, such turned off
  201|       |        valuable warnings. Oct 2024
  202|       |        refined the test to notice empty string */
  203|  3.60M|    if (both_strings_nonempty(postzprefix,targname,DPREFIXLEN) &&
  ------------------
  |  |  167|  3.60M|#define DPREFIXLEN 7
  ------------------
  |  Branch (203:9): [True: 1.86M, False: 1.74M]
  ------------------
  204|  1.86M|        !strcmp(postzprefix,targname+DPREFIXLEN)) {
  ------------------
  |  |  167|  1.86M|#define DPREFIXLEN 7
  ------------------
  |  Branch (204:9): [True: 137, False: 1.86M]
  ------------------
  205|       |            /*  zprefix version matches the object section
  206|       |                name so the section is compressed and is
  207|       |                the section this targname applies to. */
  208|    137|        namesmatch = TRUE;
  ------------------
  |  |   33|    137|#define TRUE 1
  ------------------
  209|  3.60M|    } else if (!strcmp(secname,targname)) {
  ------------------
  |  Branch (209:16): [True: 2.65k, False: 3.60M]
  ------------------
  210|  2.65k|        namesmatch = TRUE;
  ------------------
  |  |   33|  2.65k|#define TRUE 1
  ------------------
  211|  3.60M|    } else { /*  Fall to next statement */ }
  212|  3.60M|#undef ZPREFIXLEN
  213|  3.60M|#undef DPREFIXLEN
  214|  3.60M|#undef SECNAMEMAX
  215|  3.60M|    if (!namesmatch) {
  ------------------
  |  Branch (215:9): [True: 3.60M, False: 2.79k]
  ------------------
  216|       |        /*  This is not the target section.
  217|       |            our caller will keep looking. */
  218|  3.60M|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|  3.60M|#define DW_DLV_NO_ENTRY -1
  ------------------
  219|  3.60M|    }
  220|       |
  221|       |    /* SETUP_SECTION. See also BUILDING_SECTIONS, BUILDING_MAP  */
  222|  2.79k|    {
  223|       |        /*  The section name is a match with targname, or
  224|       |            the .zdebug version of targname. */
  225|  2.79k|        int sectionerr = 0;
  226|       |
  227|  2.79k|        sectionerr = add_debug_section_info(dbg,secname,
  228|  2.79k|            sec_standard_name,
  229|  2.79k|            obj_sec_num,
  230|  2.79k|            secdata,
  231|  2.79k|            groupnum_of_sec,
  232|  2.79k|            duperr,emptyerr, have_dwarf,
  233|  2.79k|            havezdebug,err);
  234|  2.79k|        if (sectionerr != DW_DLV_OK) {
  ------------------
  |  |  122|  2.79k|#define DW_DLV_OK        0
  ------------------
  |  Branch (234:13): [True: 45, False: 2.75k]
  ------------------
  235|       |            /* *err is set already */
  236|     45|            return sectionerr;
  237|     45|        }
  238|  2.79k|    }
  239|  2.75k|    return DW_DLV_OK;
  ------------------
  |  |  122|  2.75k|#define DW_DLV_OK        0
  ------------------
  240|  2.79k|}
dwarf_setup_sections.c:both_strings_nonempty:
  127|  3.60M|{
  128|  3.60M|    const char *s3 = 0;
  129|  3.60M|    if (!s1 || !s2) {
  ------------------
  |  Branch (129:9): [True: 1.65M, False: 1.95M]
  |  Branch (129:16): [True: 0, False: 1.95M]
  ------------------
  130|  1.65M|        return FALSE;
  ------------------
  |  |   36|  1.65M|#define FALSE 0
  ------------------
  131|  1.65M|    }
  132|  1.95M|    s3 = s2 + offset;
  133|  1.95M|    if (!s1[0] || !s3[0]) {
  ------------------
  |  Branch (133:9): [True: 9.15k, False: 1.94M]
  |  Branch (133:19): [True: 84.5k, False: 1.86M]
  ------------------
  134|  93.7k|        return FALSE;
  ------------------
  |  |   36|  93.7k|#define FALSE 0
  ------------------
  135|  93.7k|    }
  136|  1.86M|    return TRUE;
  ------------------
  |  |   33|  1.86M|#define TRUE 1
  ------------------
  137|  1.95M|}
dwarf_setup_sections.c:add_debug_section_info:
   77|  2.79k|{
   78|  2.79k|    unsigned total_entries = dbg->de_debug_sections_total_entries;
   79|  2.79k|    if (secdata->dss_is_in_use) {
  ------------------
  |  Branch (79:9): [True: 45, False: 2.75k]
  ------------------
   80|     45|        *err = duperr;
   81|     45|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     45|#define DW_DLV_ERROR     1
  ------------------
   82|     45|    }
   83|  2.75k|    if (total_entries < DWARF_MAX_DEBUG_SECTIONS) {
  ------------------
  |  |  592|  2.75k|#define DWARF_MAX_DEBUG_SECTIONS 50
  ------------------
  |  Branch (83:9): [True: 2.75k, False: 0]
  ------------------
   84|  2.75k|        struct Dwarf_dbg_sect_s *debug_section =
   85|  2.75k|            &dbg->de_debug_sections[total_entries];
   86|  2.75k|        secdata->dss_is_in_use = TRUE;
  ------------------
  |  |   33|  2.75k|#define TRUE 1
  ------------------
   87|  2.75k|        debug_section->ds_name = name;
   88|  2.75k|        debug_section->ds_number = obj_sec_num;
   89|  2.75k|        debug_section->ds_secdata = secdata;
   90|  2.75k|        debug_section->ds_groupnumber =  groupnum;
   91|  2.75k|        secdata->dss_name = name; /* Actual name from object file. */
   92|  2.75k|        secdata->dss_standard_name = standard_section_name;
   93|  2.75k|        secdata->dss_number = obj_sec_num;
   94|  2.75k|        secdata->dss_zdebug_requires_decompress =
   95|  2.75k|            (Dwarf_Small)havezdebug;
   96|  2.75k|        secdata->dss_computed_mmap_offset = 0;
   97|  2.75k|        secdata->dss_computed_mmap_len = 0;
   98|  2.75k|        secdata->dss_mmap_realarea = 0;
   99|  2.75k|        secdata->dss_was_alloc = FALSE;
  ------------------
  |  |   36|  2.75k|#define FALSE 0
  ------------------
  100|       |        /*  Just gets current global pref */
  101|  2.75k|#ifndef TESTING
  102|  2.75k|        secdata->dss_load_preference = dwarf_set_load_preference(0);
  103|  2.75k|#endif /* TESTING*/
  104|       |        /* We don't yet know about SHF_COMPRESSED */
  105|  2.75k|        debug_section->ds_duperr = duperr;
  106|  2.75k|        debug_section->ds_emptyerr = emptyerr;
  107|  2.75k|        debug_section->ds_have_dwarf = have_dwarf;
  108|  2.75k|        debug_section->ds_have_zdebug = havezdebug;
  109|  2.75k|        ++dbg->de_debug_sections_total_entries;
  110|  2.75k|        return DW_DLV_OK;
  ------------------
  |  |  122|  2.75k|#define DW_DLV_OK        0
  ------------------
  111|  2.75k|    }
  112|       |    /*  This represents a bug in libdwarf.
  113|       |        Mis-setup-DWARF_MAX_DEBUG_SECTIONS.
  114|       |        Or possibly a use of section groups that is
  115|       |        not supported.  */
  116|      0|    *err = DW_DLE_TOO_MANY_DEBUG;
  ------------------
  |  | 1290|      0|#define DW_DLE_TOO_MANY_DEBUG                  245
  ------------------
  117|      0|    return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  118|  2.75k|}

dwarfstring_constructor:
   65|  4.40k|{
   66|  4.40k|    g->s_data = "";
   67|  4.40k|    g->s_size = 0;
   68|  4.40k|    g->s_avail = 0;
   69|  4.40k|    g->s_malloc = FALSE;
  ------------------
  |  |   36|  4.40k|#define FALSE 0
  ------------------
   70|  4.40k|    return TRUE;
  ------------------
  |  |   33|  4.40k|#define TRUE 1
  ------------------
   71|  4.40k|}
dwarfstring_reset:
  120|    594|{
  121|    594|    if (!g->s_size) {
  ------------------
  |  Branch (121:9): [True: 310, False: 284]
  ------------------
  122|       |        /* In initial condition, nothing to do. */
  123|    310|        return TRUE;
  ------------------
  |  |   33|    310|#define TRUE 1
  ------------------
  124|    310|    }
  125|    284|    g->s_avail   = g->s_size;
  126|    284|    g->s_data[0] = 0;
  127|    284|    return TRUE;
  ------------------
  |  |   33|    284|#define TRUE 1
  ------------------
  128|    594|}
dwarfstring_destructor:
  163|  1.83k|{
  164|  1.83k|    if (g->s_malloc) {
  ------------------
  |  Branch (164:9): [True: 1.18k, False: 650]
  ------------------
  165|  1.18k|        free(g->s_data);
  166|  1.18k|        g->s_data   = 0;
  167|  1.18k|        g->s_malloc = 0;
  168|  1.18k|    }
  169|       |    /*  The constructor sets all the fields, most to zero.
  170|       |        s_data is set to point to static string ""
  171|       |        s_malloc set to FALSE. */
  172|  1.83k|    dwarfstring_constructor(g);
  173|  1.83k|}
dwarfstring_append_length:
  182|   151k|{
  183|       |    /*  lastpos is the length of characters
  184|       |        without the null-terminator  we call it strlen */
  185|   151k|    size_t lastpos = g->s_size - g->s_avail;
  186|   151k|    int r          = 0;
  187|       |
  188|   151k|    if (!str  || slen ==0) {
  ------------------
  |  Branch (188:9): [True: 0, False: 151k]
  |  Branch (188:18): [True: 51.4k, False: 99.5k]
  ------------------
  189|  51.4k|        return TRUE;
  ------------------
  |  |   33|  51.4k|#define TRUE 1
  ------------------
  190|  51.4k|    }
  191|  99.5k|    if (slen >= g->s_avail) {
  ------------------
  |  Branch (191:9): [True: 35.3k, False: 64.2k]
  ------------------
  192|  35.3k|        size_t newlen = 0;
  193|       |
  194|  35.3k|        newlen = g->s_size + slen+2;
  195|  35.3k|        r = dwarfstring_add_to(g,newlen);
  196|  35.3k|        if (!r) {
  ------------------
  |  Branch (196:13): [True: 0, False: 35.3k]
  ------------------
  197|       |            /* Unable to resize, dare not do anything. */
  198|      0|            return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  199|      0|        }
  200|  35.3k|    }
  201|  99.5k|    memcpy(g->s_data + lastpos,str,slen);
  202|  99.5k|    g->s_avail -= slen;
  203|       |    /*  Adding string terminating null byte.
  204|       |        Space is guaranteed available to do this.*/
  205|  99.5k|    g->s_data[g->s_size - g->s_avail] = 0;
  206|  99.5k|    return TRUE;
  ------------------
  |  |   33|  99.5k|#define TRUE 1
  ------------------
  207|  99.5k|}
dwarfstring_append:
  211|  2.72k|{
  212|  2.72k|    size_t dlenszt = 0;
  213|       |
  214|  2.72k|    if (!str) {
  ------------------
  |  Branch (214:9): [True: 0, False: 2.72k]
  ------------------
  215|      0|        return TRUE;
  ------------------
  |  |   33|      0|#define TRUE 1
  ------------------
  216|      0|    }
  217|  2.72k|    dlenszt = strlen(str);
  218|  2.72k|    return dwarfstring_append_length(g,str,dlenszt);
  219|  2.72k|}
dwarfstring_string:
  223|  3.33k|{
  224|  3.33k|    return g->s_data;
  225|  3.33k|}
dwarfstring_strlen:
  229|  1.53k|{
  230|  1.53k|    return g->s_size - g->s_avail;
  231|  1.53k|}
dwarfstring_append_printf_s:
  276|    106|{
  277|    106|    size_t stringlenszt = 0;
  278|    106|    size_t next = 0;
  279|    106|    long val = 0;
  280|    106|    char *endptr = 0;
  281|    106|    const char *numptr = 0;
  282|       |    /* was %[-]fixedlen.  Zero means no len provided. */
  283|    106|    size_t fixedlen = 0;
  284|       |    /* was %-, nonzero means left-justify */
  285|    106|    long leftjustify = 0;
  286|    106|    size_t prefixlen = 0;
  287|    106|    int res = 0;
  288|       |
  289|    106|    if (!s) {
  ------------------
  |  Branch (289:9): [True: 0, False: 106]
  ------------------
  290|      0|        DWSERR("<DWARFSTRINGERR: null string pointer to "
  ------------------
  |  |   57|      0|#define DWSERR(m) dwarfstring_append_length(data,(m),sizeof(m)-1)
  ------------------
  291|      0|            "dwarfstring_append_printf_s>");
  292|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  293|      0|    }
  294|    106|    stringlenszt = strlen(s);
  295|    106|    if (!format) {
  ------------------
  |  Branch (295:9): [True: 0, False: 106]
  ------------------
  296|      0|        DWSERR("<DWARFSTRINGERR: null format pointer to "
  ------------------
  |  |   57|      0|#define DWSERR(m) dwarfstring_append_length(data,(m),sizeof(m)-1)
  ------------------
  297|      0|            "dwarfstring_append_printf_s>");
  298|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  299|      0|    }
  300|  4.79k|    while (format[next] && format[next] != '%') {
  ------------------
  |  Branch (300:12): [True: 4.79k, False: 0]
  |  Branch (300:28): [True: 4.68k, False: 106]
  ------------------
  301|  4.68k|        ++next;
  302|  4.68k|        ++prefixlen;
  303|  4.68k|    }
  304|    106|    if (prefixlen) {
  ------------------
  |  Branch (304:9): [True: 106, False: 0]
  ------------------
  305|    106|        dwarfstring_append_length(data,format,prefixlen);
  306|       |        /*  Fall through whether return value TRUE or FALSE */
  307|    106|    }
  308|    106|    if (format[next] != '%') {
  ------------------
  |  Branch (308:9): [True: 0, False: 106]
  ------------------
  309|       |        /*   No % operator found, we are done */
  310|      0|        DWSERR("<DWARFSTRINGERR: no percent passed to "
  ------------------
  |  |   57|      0|#define DWSERR(m) dwarfstring_append_length(data,(m),sizeof(m)-1)
  ------------------
  311|      0|            "dwarfstring_append_printf_s>");
  312|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  313|      0|    }
  314|    106|    next++;
  315|    106|    if (!format[next]) {
  ------------------
  |  Branch (315:9): [True: 0, False: 106]
  ------------------
  316|      0|        DWSERR("<DWARFSTRINGERR: empty percent  to "
  ------------------
  |  |   57|      0|#define DWSERR(m) dwarfstring_append_length(data,(m),sizeof(m)-1)
  ------------------
  317|      0|            "dwarfstring_append_printf_s>");
  318|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  319|      0|    }
  320|    106|    if (format[next] == ' ') {
  ------------------
  |  Branch (320:9): [True: 0, False: 106]
  ------------------
  321|      0|        DWSERR("<DWARFSTRINGERR: empty percent  to "
  ------------------
  |  |   57|      0|#define DWSERR(m) dwarfstring_append_length(data,(m),sizeof(m)-1)
  ------------------
  322|      0|            "dwarfstring_append_printf_s>");
  323|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  324|      0|    }
  325|       |
  326|    106|    if (format[next] == '-') {
  ------------------
  |  Branch (326:9): [True: 0, False: 106]
  ------------------
  327|      0|        leftjustify++;
  328|      0|        next++;
  329|      0|    }
  330|    106|    numptr = format+next;
  331|    106|    val = strtol(numptr,&endptr,10);
  332|    106|    if ( endptr != numptr) {
  ------------------
  |  Branch (332:10): [True: 0, False: 106]
  ------------------
  333|      0|        fixedlen = val;
  334|      0|    }
  335|    106|    next = (endptr - format);
  336|    106|    if (format[next] != 's') {
  ------------------
  |  Branch (336:9): [True: 0, False: 106]
  ------------------
  337|      0|        DWSERR("<DWARFSTRINGERR: no percent-s to "
  ------------------
  |  |   57|      0|#define DWSERR(m) dwarfstring_append_length(data,(m),sizeof(m)-1)
  ------------------
  338|      0|            "dwarfstring_append_printf_s>");
  339|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  340|      0|    }
  341|    106|    next++;
  342|       |
  343|    106|    if (fixedlen && (stringlenszt >= fixedlen)) {
  ------------------
  |  Branch (343:9): [True: 0, False: 106]
  |  Branch (343:21): [True: 0, False: 0]
  ------------------
  344|       |        /*  Ignore  leftjustify (if any) and the stringlenszt
  345|       |            as the actual string overrides those. */
  346|      0|        leftjustify = 0;
  347|      0|    }
  348|    106|    if (leftjustify) {
  ------------------
  |  Branch (348:9): [True: 0, False: 106]
  ------------------
  349|       |
  350|      0|        dwarfstring_append_length(data,s,stringlenszt);
  351|       |        /*  Ignore return value */
  352|      0|        if (fixedlen) {
  ------------------
  |  Branch (352:13): [True: 0, False: 0]
  ------------------
  353|      0|            size_t trailingspaces = fixedlen - stringlenszt;
  354|       |
  355|      0|            _dwarfstring_append_spaces(data,trailingspaces);
  356|      0|        }
  357|    106|    } else {
  358|    106|        if (fixedlen && fixedlen < stringlenszt) {
  ------------------
  |  Branch (358:13): [True: 0, False: 106]
  |  Branch (358:25): [True: 0, False: 0]
  ------------------
  359|       |            /*  This lets us have fixedlen < stringlenszt by
  360|       |                taking all the chars from s*/
  361|      0|            dwarfstring_append_length(data,s,stringlenszt);
  362|       |            /*  Ignore return value, just keep going */
  363|    106|        } else {
  364|    106|            if (fixedlen) {
  ------------------
  |  Branch (364:17): [True: 0, False: 106]
  ------------------
  365|      0|                size_t leadingspaces = fixedlen - stringlenszt;
  366|      0|                size_t k = 0;
  367|       |
  368|      0|                for ( ; k < leadingspaces; ++k) {
  ------------------
  |  Branch (368:25): [True: 0, False: 0]
  ------------------
  369|      0|                    dwarfstring_append_length(data," ",1);
  370|      0|                }
  371|      0|            }
  372|    106|            res = dwarfstring_append_length(data,s,stringlenszt);
  373|    106|            if (res == FALSE) {
  ------------------
  |  |   36|    106|#define FALSE 0
  ------------------
  |  Branch (373:17): [True: 0, False: 106]
  ------------------
  374|      0|                return res;
  375|      0|            }
  376|    106|        }
  377|    106|    }
  378|    106|    if (!format[next]) {
  ------------------
  |  Branch (378:9): [True: 0, False: 106]
  ------------------
  379|      0|        return TRUE;
  ------------------
  |  |   33|      0|#define TRUE 1
  ------------------
  380|      0|    }
  381|    106|    {
  382|    106|        char * startpt = format+next;
  383|    106|        size_t suffixlen = strlen(startpt);
  384|       |
  385|    106|        res = dwarfstring_append_length(data,startpt,suffixlen);
  386|    106|    }
  387|    106|    return res;
  388|    106|}
dwarfstring_append_printf_u:
  690|  51.1k|{
  691|       |
  692|  51.1k|    size_t next = 0;
  693|  51.1k|    long val = 0;
  694|  51.1k|    char *endptr = 0;
  695|  51.1k|    const char *numptr = 0;
  696|  51.1k|    size_t fixedlen = 0;
  697|  51.1k|    int leadingzero = 0;
  698|  51.1k|    int lcount = 0;
  699|  51.1k|    int ucount = 0;
  700|  51.1k|    int dcount = 0;
  701|  51.1k|    int xcount = 0;
  702|  51.1k|    int Xcount = 0;
  703|  51.1k|    char *ctable = 0;
  704|  51.1k|    size_t divisor = 0;
  705|  51.1k|    size_t prefixlen = 0;
  706|       |
  707|  51.1k|    if (!format) {
  ------------------
  |  Branch (707:9): [True: 0, False: 51.1k]
  ------------------
  708|      0|        DWSERR("<DWARFSTRINGERR: null format pointer to "
  ------------------
  |  |   57|      0|#define DWSERR(m) dwarfstring_append_length(data,(m),sizeof(m)-1)
  ------------------
  709|      0|            "dwarfstring_append_printf_u>");
  710|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  711|      0|    }
  712|  62.2k|    while (format[next] && format[next] != '%') {
  ------------------
  |  Branch (712:12): [True: 62.2k, False: 0]
  |  Branch (712:28): [True: 11.1k, False: 51.1k]
  ------------------
  713|  11.1k|        ++next;
  714|  11.1k|        ++prefixlen;
  715|  11.1k|    }
  716|  51.1k|    dwarfstring_append_length(data,format,prefixlen);
  717|  51.1k|    if (format[next] != '%') {
  ------------------
  |  Branch (717:9): [True: 0, False: 51.1k]
  ------------------
  718|       |        /*   No % operator found, we are done */
  719|      0|        DWSERR("<DWARFSTRINGERR: no percent passed to "
  ------------------
  |  |   57|      0|#define DWSERR(m) dwarfstring_append_length(data,(m),sizeof(m)-1)
  ------------------
  720|      0|            "dwarfstring_append_printf_u>");
  721|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  722|      0|    }
  723|  51.1k|    next++;
  724|  51.1k|    if (!format[next]) {
  ------------------
  |  Branch (724:9): [True: 0, False: 51.1k]
  ------------------
  725|      0|        DWSERR("<DWARFSTRINGERR: empty percent  to "
  ------------------
  |  |   57|      0|#define DWSERR(m) dwarfstring_append_length(data,(m),sizeof(m)-1)
  ------------------
  726|      0|            "dwarfstring_append_printf_u>");
  727|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  728|      0|    }
  729|  51.1k|    if (format[next] == ' ') {
  ------------------
  |  Branch (729:9): [True: 0, False: 51.1k]
  ------------------
  730|      0|        DWSERR("<DWARFSTRINGERR: empty percent  to "
  ------------------
  |  |   57|      0|#define DWSERR(m) dwarfstring_append_length(data,(m),sizeof(m)-1)
  ------------------
  731|      0|            "dwarfstring_append_printf_u>");
  732|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  733|      0|    }
  734|  51.1k|    if (format[next] == '-') {
  ------------------
  |  Branch (734:9): [True: 0, False: 51.1k]
  ------------------
  735|      0|        DWSERR("<DWARFSTRINGERR: format - passed to "
  ------------------
  |  |   57|      0|#define DWSERR(m) dwarfstring_append_length(data,(m),sizeof(m)-1)
  ------------------
  736|      0|            "dwarfstring_append_printf_u "
  737|      0|            "cannot be handled>");
  738|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  739|      0|    }
  740|  51.1k|    if (format[next] == '0') {
  ------------------
  |  Branch (740:9): [True: 50.7k, False: 309]
  ------------------
  741|  50.7k|        leadingzero = 1;
  742|  50.7k|        next++;
  743|  50.7k|    }
  744|  51.1k|    numptr = format+next;
  745|  51.1k|    val = strtol(numptr,&endptr,10);
  746|  51.1k|    if ( endptr != numptr) {
  ------------------
  |  Branch (746:10): [True: 50.7k, False: 309]
  ------------------
  747|  50.7k|        fixedlen = val;
  748|  50.7k|    }
  749|  51.1k|    next = (endptr - format);
  750|       |    /*  Following is lx lu or u or llx llu , we take
  751|       |        all this to mean 64 bits, */
  752|       |#ifdef _WIN32
  753|       |    if (format[next] == 'I') {
  754|       |        /*lcount++;*/
  755|       |        next++;
  756|       |    }
  757|       |    if (format[next] == '6') {
  758|       |        /*lcount++;*/
  759|       |        next++;
  760|       |    }
  761|       |    if (format[next] == '4') {
  762|       |        /*lcount++;*/
  763|       |        next++;
  764|       |    }
  765|       |#endif /* _WIN32 */
  766|  51.1k|    if (format[next] == 'l') {
  ------------------
  |  Branch (766:9): [True: 50, False: 51.0k]
  ------------------
  767|     50|        lcount++;
  768|     50|        next++;
  769|     50|    }
  770|  51.1k|    if (format[next] == 'l') {
  ------------------
  |  Branch (770:9): [True: 0, False: 51.1k]
  ------------------
  771|      0|        lcount++;
  772|      0|        next++;
  773|      0|    }
  774|  51.1k|    if (format[next] == 'l') {
  ------------------
  |  Branch (774:9): [True: 0, False: 51.1k]
  ------------------
  775|      0|        lcount++;
  776|      0|        next++;
  777|      0|    }
  778|  51.1k|    if (format[next] == 'u') {
  ------------------
  |  Branch (778:9): [True: 259, False: 50.8k]
  ------------------
  779|    259|        ucount++;
  780|    259|        next++;
  781|    259|    }
  782|  51.1k|    if (format[next] == 'd') {
  ------------------
  |  Branch (782:9): [True: 0, False: 51.1k]
  ------------------
  783|      0|        dcount++;
  784|      0|        next++;
  785|      0|    }
  786|  51.1k|    if (format[next] == 'x') {
  ------------------
  |  Branch (786:9): [True: 50.8k, False: 259]
  ------------------
  787|  50.8k|        xcount++;
  788|  50.8k|        next++;
  789|  50.8k|    }
  790|  51.1k|    if (format[next] == 'X') {
  ------------------
  |  Branch (790:9): [True: 0, False: 51.1k]
  ------------------
  791|      0|        Xcount++;
  792|      0|        next++;
  793|      0|    }
  794|  51.1k|    if (format[next] == 's') {
  ------------------
  |  Branch (794:9): [True: 0, False: 51.1k]
  ------------------
  795|      0|        DWSERR("<DWARFSTRINGERR: format percent-s passed to "
  ------------------
  |  |   57|      0|#define DWSERR(m) dwarfstring_append_length(data,(m),sizeof(m)-1)
  ------------------
  796|      0|            "dwarfstring_append_printf_u "
  797|      0|            "cannot be handled>");
  798|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  799|      0|    }
  800|  51.1k|    if ( (Xcount +xcount+dcount+ucount) > 1) {
  ------------------
  |  Branch (800:10): [True: 0, False: 51.1k]
  ------------------
  801|      0|        DWSERR("<DWARFSTRINGERR: format  percent -x X d u repeats to "
  ------------------
  |  |   57|      0|#define DWSERR(m) dwarfstring_append_length(data,(m),sizeof(m)-1)
  ------------------
  802|      0|            "dwarfstring_append_printf_u "
  803|      0|            "cannot be handled>");
  804|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  805|      0|    }
  806|  51.1k|    if ( (Xcount +xcount+dcount+ucount) == 0) {
  ------------------
  |  Branch (806:10): [True: 0, False: 51.1k]
  ------------------
  807|      0|        DWSERR("<DWARFSTRINGERR: format percent x X d u missing to "
  ------------------
  |  |   57|      0|#define DWSERR(m) dwarfstring_append_length(data,(m),sizeof(m)-1)
  ------------------
  808|      0|            "dwarfstring_append_printf_u "
  809|      0|            "cannot be handled>");
  810|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  811|      0|    }
  812|  51.1k|    if (lcount > 2) {
  ------------------
  |  Branch (812:9): [True: 0, False: 51.1k]
  ------------------
  813|      0|        DWSERR("<DWARFSTRINGERR: format percent lll to "
  ------------------
  |  |   57|      0|#define DWSERR(m) dwarfstring_append_length(data,(m),sizeof(m)-1)
  ------------------
  814|      0|            "dwarfstring_append_printf_u "
  815|      0|            "cannot be handled>");
  816|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  817|      0|    }
  818|  51.1k|    if (dcount > 0) {
  ------------------
  |  Branch (818:9): [True: 0, False: 51.1k]
  ------------------
  819|      0|        DWSERR("<DWARFSTRINGERR: format  percent-d to "
  ------------------
  |  |   57|      0|#define DWSERR(m) dwarfstring_append_length(data,(m),sizeof(m)-1)
  ------------------
  820|      0|            "dwarfstring_append_printf_u "
  821|      0|            "cannot be handled>");
  822|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  823|      0|    }
  824|  51.1k|    if (ucount) {
  ------------------
  |  Branch (824:9): [True: 259, False: 50.8k]
  ------------------
  825|    259|        divisor = 10;
  826|    259|        ctable = dtable;
  827|  50.8k|    } else {
  828|  50.8k|        divisor = 16;
  829|  50.8k|        if (xcount) {
  ------------------
  |  Branch (829:13): [True: 50.8k, False: 0]
  ------------------
  830|  50.8k|            ctable = xtable;
  831|  50.8k|        } else {
  832|      0|            ctable = Xtable;
  833|      0|        }
  834|  50.8k|    }
  835|  51.1k|    {
  836|  51.1k|        char digbuf[36];
  837|  51.1k|        char *digptr = 0;
  838|  51.1k|        unsigned digcharlen = 0;
  839|  51.1k|        dwarfstring_u remaining = v;
  840|       |
  841|  51.1k|        if (divisor == 16) {
  ------------------
  |  Branch (841:13): [True: 50.8k, False: 259]
  ------------------
  842|  50.8k|            digptr = digbuf+sizeof(digbuf) -1;
  843|  56.2k|            for ( ;; ) {
  844|  56.2k|                dwarfstring_u dig;
  845|  56.2k|                dig = remaining & 0xf;
  846|  56.2k|                remaining = remaining >> 4;
  847|  56.2k|                *digptr = ctable[dig];
  848|  56.2k|                ++digcharlen;
  849|  56.2k|                if (!remaining) {
  ------------------
  |  Branch (849:21): [True: 50.8k, False: 5.44k]
  ------------------
  850|  50.8k|                    break;
  851|  50.8k|                }
  852|  5.44k|                --digptr;
  853|  5.44k|            }
  854|  50.8k|        } else {
  855|    259|            digptr = digbuf+sizeof(digbuf) -1;
  856|    259|            *digptr = 0;
  857|    259|            --digptr;
  858|  1.49k|            for ( ;; ) {
  859|  1.49k|                dwarfstring_u dig;
  860|  1.49k|                dig = remaining % divisor;
  861|  1.49k|                remaining /= divisor;
  862|  1.49k|                *digptr = ctable[dig];
  863|  1.49k|                ++digcharlen;
  864|  1.49k|                if (!remaining) {
  ------------------
  |  Branch (864:21): [True: 259, False: 1.23k]
  ------------------
  865|    259|                    break;
  866|    259|                }
  867|  1.23k|                --digptr;
  868|  1.23k|            }
  869|    259|        }
  870|  51.1k|        if (fixedlen <= digcharlen) {
  ------------------
  |  Branch (870:13): [True: 5.64k, False: 45.4k]
  ------------------
  871|  5.64k|            dwarfstring_append_length(data,digptr,digcharlen);
  872|  45.4k|        } else {
  873|  45.4k|            if (!leadingzero) {
  ------------------
  |  Branch (873:17): [True: 0, False: 45.4k]
  ------------------
  874|      0|                size_t justcount = fixedlen - digcharlen;
  875|      0|                _dwarfstring_append_spaces(data,justcount);
  876|      0|                dwarfstring_append_length(data,digptr,digcharlen);
  877|  45.4k|            } else {
  878|  45.4k|                size_t prefixcount = fixedlen - digcharlen;
  879|  45.4k|                _dwarfstring_append_zeros(data,prefixcount);
  880|  45.4k|                dwarfstring_append_length(data,digptr,digcharlen);
  881|  45.4k|            }
  882|  45.4k|        }
  883|  51.1k|    }
  884|  51.1k|    if (format[next]) {
  ------------------
  |  Branch (884:9): [True: 309, False: 50.7k]
  ------------------
  885|    309|        size_t trailinglen = strlen(format+next);
  886|    309|        dwarfstring_append_length(data,format+next,trailinglen);
  887|    309|    }
  888|  51.1k|    return FALSE;
  ------------------
  |  |   36|  51.1k|#define FALSE 0
  ------------------
  889|  51.1k|}
dwarf_string.c:dwarfstring_add_to:
   78|  35.3k|{
   79|  35.3k|    char *b          = 0;
   80|       |    /*  s_size - s_avail is the string without counting
   81|       |        the null following the string. So, is  strlen()  */
   82|  35.3k|    size_t lastpos   = g->s_size - g->s_avail;
   83|  35.3k|    size_t malloclen = newlen+1;
   84|       |
   85|       |    /*  ASSERT: newlen as well as malloclen  are
   86|       |        greater than g->s_size at both call points */
   87|  35.3k|    if (malloclen < minimumnewlen) {
  ------------------
  |  Branch (87:9): [True: 1.08k, False: 34.2k]
  ------------------
   88|  1.08k|        malloclen = minimumnewlen;
   89|  1.08k|    }
   90|       |    /*  Not zeroing the new buffer block. */
   91|  35.3k|    b = malloc(malloclen);
   92|  35.3k|    if (!b) {
  ------------------
  |  Branch (92:9): [True: 0, False: 35.3k]
  ------------------
   93|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
   94|      0|    }
   95|  35.3k|    if (lastpos > 0) {
  ------------------
  |  Branch (95:9): [True: 34.0k, False: 1.31k]
  ------------------
   96|       |        /* Copying the non-null bytes in s_data. */
   97|  34.0k|        memcpy(b,g->s_data,lastpos);
   98|  34.0k|    }
   99|  35.3k|    if (g->s_malloc) {
  ------------------
  |  Branch (99:9): [True: 34.1k, False: 1.18k]
  ------------------
  100|  34.1k|        free(g->s_data);
  101|  34.1k|        g->s_data = 0;
  102|  34.1k|    }
  103|  35.3k|    g->s_data = b;
  104|       |    /*  s_data[lastpos] is one past the end of anything
  105|       |        counted as string
  106|       |        in s_data at the point of call, and is guaranteed
  107|       |        to be safe as we increased the size of s_data, we did not
  108|       |        shrink.  And, too, we add 1 to newlen, always,
  109|       |        so space for a terminating null byte is guaranteed
  110|       |        available. */
  111|  35.3k|    g->s_data[lastpos] = 0;
  112|  35.3k|    g->s_size = newlen;
  113|  35.3k|    g->s_avail = newlen - lastpos;
  114|  35.3k|    g->s_malloc = TRUE;
  ------------------
  |  |   33|  35.3k|#define TRUE 1
  ------------------
  115|  35.3k|    return TRUE;
  ------------------
  |  |   33|  35.3k|#define TRUE 1
  ------------------
  116|  35.3k|}
dwarf_string.c:_dwarfstring_append_zeros:
  255|  45.4k|{
  256|  45.4k|    int res = 0;
  257|  45.4k|    static char zeros[] = {
  258|  45.4k|        "0000000000000000000000000000000000000000"};
  259|  45.4k|    size_t charct = sizeof(zeros)-1;
  260|       |
  261|  45.4k|    while (l > charct) {
  ------------------
  |  Branch (261:12): [True: 0, False: 45.4k]
  ------------------
  262|      0|        res = dwarfstring_append_length(data,zeros,charct);
  263|      0|        l -= charct;
  264|      0|        if (res != TRUE) {
  ------------------
  |  |   33|      0|#define TRUE 1
  ------------------
  |  Branch (264:13): [True: 0, False: 0]
  ------------------
  265|      0|            return res;
  266|      0|        }
  267|      0|    }
  268|       |    /* ASSERT: l > 0 */
  269|  45.4k|    dwarfstring_append_length(data,zeros,l);
  270|  45.4k|    return res;
  271|  45.4k|}

_dwarf_initialize_search_hash:
  183|  5.55k|{
  184|  5.55k|    unsigned long prime_to_use = primes[0];
  185|  5.55k|    unsigned entry_index = 0;
  186|  5.55k|    unsigned k = 0;
  187|  5.55k|    struct hs_base *base = 0;
  188|       |
  189|  5.55k|    base = *(struct hs_base **)treeptr;
  190|  5.55k|    if (base) {
  ------------------
  |  Branch (190:9): [True: 0, False: 5.55k]
  ------------------
  191|       |        /* initialized already. */
  192|      0|        return base ;
  193|      0|    }
  194|  5.55k|    base = calloc(1, sizeof(struct hs_base));
  195|  5.55k|    if (!base) {
  ------------------
  |  Branch (195:9): [True: 0, False: 5.55k]
  ------------------
  196|       |        /* Out of memory. */
  197|      0|        return NULL ;
  198|      0|    }
  199|  5.55k|    prime_to_use = primes[0];
  200|  6.38k|    while(size_estimate && (size_estimate > prime_to_use)) {
  ------------------
  |  Branch (200:11): [True: 6.35k, False: 38]
  |  Branch (200:28): [True: 831, False: 5.52k]
  ------------------
  201|    831|        k = k +1;
  202|    831|        prime_to_use = primes[k];
  203|    831|        if (prime_to_use == 0) {
  ------------------
  |  Branch (203:13): [True: 0, False: 831]
  ------------------
  204|       |            /* Oops. Too large. */
  205|      0|            free(base);
  206|      0|            return NULL;
  207|      0|        }
  208|    831|        entry_index = k;
  209|    831|    }
  210|       |#ifdef TESTINGHASHTAB
  211|       |    printf("debugging: initial alloc size estimate %lu\n",
  212|       |        size_estimate);
  213|       |    printf("debugging: initial alloc prime to use %lu\n",
  214|       |    prime_to_use);
  215|       |#endif
  216|  5.55k|    base->tablesize_ = prime_to_use;
  217|  5.55k|    base->allowed_fill_ = calculate_allowed_fill(allowed_fill_percent,
  218|  5.55k|        prime_to_use);
  219|  5.55k|    if (base->allowed_fill_< (base->tablesize_/2)) {
  ------------------
  |  Branch (219:9): [True: 0, False: 5.55k]
  ------------------
  220|      0|        free(base);
  221|       |        /* Oops. We are in trouble. Coding mistake here.  */
  222|      0|        return NULL;
  223|      0|    }
  224|  5.55k|    base->record_count_ = 0;
  225|  5.55k|    base->tablesize_entry_index_ = entry_index;
  226|       |    /*  hashtab_ is an array of hs_entry,
  227|       |        indexes 0 through tablesize_ -1. */
  228|  5.55k|    base->hashfunc_ = hashfunc;
  229|  5.55k|    base->hashtab_ = calloc(base->tablesize_,
  230|  5.55k|        sizeof(struct ts_entry));
  231|  5.55k|    if (!base->hashtab_) {
  ------------------
  |  Branch (231:9): [True: 0, False: 5.55k]
  ------------------
  232|      0|        free(base);
  233|      0|        return NULL;
  234|      0|    }
  235|  5.55k|    *treeptr = base;
  236|  5.55k|    return base;
  237|  5.55k|}
_dwarf_tsearch:
  520|  98.9k|{
  521|  98.9k|    struct hs_base **rootp = (struct hs_base **)headin;
  522|  98.9k|    struct hs_base *head = *rootp;
  523|  98.9k|    struct ts_entry *r = 0;
  524|  98.9k|    int inserted = 0;
  525|       |    /* nullme won't be set. */
  526|  98.9k|    struct ts_entry *nullme = 0;
  527|       |
  528|  98.9k|    if (!head) {
  ------------------
  |  Branch (528:9): [True: 0, False: 98.9k]
  ------------------
  529|       |        /* something is wrong here, not initialized. */
  530|      0|        return NULL;
  531|      0|    }
  532|  98.9k|    r = _tsearch_inner(key,head,compar,want_insert,&inserted,&nullme);
  533|  98.9k|    if (!r) {
  ------------------
  |  Branch (533:9): [True: 0, False: 98.9k]
  ------------------
  534|      0|        return NULL;
  535|      0|    }
  536|  98.9k|    return (void *)&(r->keyptr);
  537|  98.9k|}
_dwarf_tfind:
  543|   301k|{
  544|       |    /*  Nothing will change, but we discard const
  545|       |        so we can use tsearch_inner(). */
  546|   301k|    struct hs_base **proot = (struct hs_base **)rootp;
  547|   301k|    struct hs_base *head = *proot;
  548|   301k|    struct ts_entry *r = 0;
  549|       |    /* inserted flag won't be set. */
  550|   301k|    int inserted = 0;
  551|       |    /* nullme won't be set. */
  552|   301k|    struct ts_entry * nullme = 0;
  553|       |    /* Get to actual tree. */
  554|       |
  555|   301k|    if (!head) {
  ------------------
  |  Branch (555:9): [True: 0, False: 301k]
  ------------------
  556|      0|        return NULL;
  557|      0|    }
  558|       |
  559|   301k|    r = _tsearch_inner(key,head,compar,only_find,&inserted,&nullme);
  560|   301k|    if (!r) {
  ------------------
  |  Branch (560:9): [True: 213k, False: 88.4k]
  ------------------
  561|   213k|        return NULL;
  562|   213k|    }
  563|  88.4k|    return (void *)(&(r->keyptr));
  564|   301k|}
_dwarf_tdelete:
  572|     60|{
  573|     60|    struct hs_base **proot = (struct hs_base **)rootp;
  574|     60|    struct hs_base *head = *proot;
  575|     60|    struct ts_entry *found = 0;
  576|       |    /* inserted flag won't be set. */
  577|     60|    int inserted = 0;
  578|     60|    struct ts_entry * parentp = 0;
  579|       |
  580|     60|    if (!head) {
  ------------------
  |  Branch (580:9): [True: 0, False: 60]
  ------------------
  581|      0|        return NULL;
  582|      0|    }
  583|       |
  584|     60|    found = _tsearch_inner(key,head,compar,want_delete,&inserted,
  585|     60|        &parentp);
  586|     60|    if (found) {
  ------------------
  |  Branch (586:9): [True: 60, False: 0]
  ------------------
  587|     60|        if (parentp) {
  ------------------
  |  Branch (587:13): [True: 0, False: 60]
  ------------------
  588|       |            /* Delete a chain entry. */
  589|      0|            head->record_count_--;
  590|      0|            parentp->next = found->next;
  591|       |            /*  We free our storage. It would be up
  592|       |                to caller to do a tfind to find
  593|       |                a record and delete content if necessary. */
  594|      0|            free(found);
  595|      0|            return (void *)&(parentp->keyptr);
  596|      0|        }
  597|       |        /* So found is the head of a chain. */
  598|     60|        if (found->next) {
  ------------------
  |  Branch (598:13): [True: 0, False: 60]
  ------------------
  599|       |            /*  Delete a chain entry, pull up to hash tab, freeing
  600|       |                up the chain entry. */
  601|      0|            struct ts_entry *pullup = found->next;
  602|      0|            *found = *pullup;
  603|      0|            free(pullup);
  604|      0|            head->record_count_--;
  605|      0|            return (void *)&(found->keyptr);
  606|     60|        } else {
  607|       |            /*  Delete a main hash table entry.
  608|       |                Problem: what the heck to return as a keyptr pointer?
  609|       |                Well, we return NULL. As in the standard
  610|       |                tsearch, returning NULL does not mean
  611|       |                failure! Here it just means 'empty chain somewhere'.
  612|       |            */
  613|     60|            head->record_count_--;
  614|     60|            found->next = 0;
  615|     60|            found->keyptr = 0;
  616|     60|            found->entryused = 0;
  617|     60|            return NULL;
  618|     60|        }
  619|     60|    }
  620|      0|    return NULL;
  621|     60|}
_dwarf_twalk:
  648|    253|{
  649|    253|    const struct hs_base *head = (const struct hs_base *)rootp;
  650|    253|    struct ts_entry *root = 0;
  651|    253|    if (!head) {
  ------------------
  |  Branch (651:9): [True: 35, False: 218]
  ------------------
  652|     35|        return;
  653|     35|    }
  654|    218|    root = head->hashtab_;
  655|       |    /* Get to actual tree. */
  656|    218|    _dwarf_twalk_inner(head,root,action);
  657|    218|}
_dwarf_tdestroy:
  702|  6.75k|{
  703|  6.75k|    struct hs_base *head = (struct hs_base *)rootp;
  704|  6.75k|    struct ts_entry *root = 0;
  705|  6.75k|    if (!head) {
  ------------------
  |  Branch (705:9): [True: 1.19k, False: 5.55k]
  ------------------
  706|  1.19k|        return;
  707|  1.19k|    }
  708|  5.55k|    root = head->hashtab_;
  709|  5.55k|    _dwarf_tdestroy_inner(head,free_node);
  710|  5.55k|    free(root);
  711|  5.55k|    free(head);
  712|  5.55k|}
dwarf_tsearchhash.c:calculate_allowed_fill:
  159|  5.57k|{
  160|  5.57k|    unsigned long v = 0;
  161|  5.57k|    if (ct < 100000) {
  ------------------
  |  Branch (161:9): [True: 5.57k, False: 0]
  ------------------
  162|  5.57k|        unsigned long v2 = (ct *fill_percent)/100;
  163|  5.57k|        return v2;
  164|  5.57k|    }
  165|      0|    v = (ct /100)*fill_percent;
  166|      0|    return v;
  167|  5.57k|}
dwarf_tsearchhash.c:_tsearch_inner:
  447|   471k|{
  448|   471k|    struct ts_entry *s =0;
  449|   471k|    struct ts_entry *c =0;
  450|   471k|    struct ts_entry *q =0;
  451|   471k|    int kc = 0;
  452|   471k|    DW_TSHASHTYPE keyhash =  0;
  ------------------
  |  |   54|   471k|#define DW_TSHASHTYPE uintptr_t
  ------------------
  453|   471k|    DW_TSHASHTYPE hindx = 0;
  ------------------
  |  |   54|   471k|#define DW_TSHASHTYPE uintptr_t
  ------------------
  454|   471k|    struct ts_entry *chain_parent = 0;
  455|       |
  456|   471k|    if (! head->hashfunc_) {
  ------------------
  |  Branch (456:9): [True: 0, False: 471k]
  ------------------
  457|       |        /* Not fully initialized. */
  458|      0|        return NULL;
  459|      0|    }
  460|   471k|    keyhash =  head->hashfunc_(key);
  461|   471k|    if (intent == want_insert) {
  ------------------
  |  Branch (461:9): [True: 170k, False: 301k]
  ------------------
  462|   170k|        if (head->record_count_ > head->allowed_fill_) {
  ------------------
  |  Branch (462:13): [True: 12, False: 170k]
  ------------------
  463|     12|            resize_table(head,compar);
  464|     12|        }
  465|   170k|    }
  466|   471k|    hindx = keyhash%head->tablesize_;
  467|   471k|    s = &head->hashtab_[hindx];
  468|   471k|    if (!s->entryused) {
  ------------------
  |  Branch (468:9): [True: 383k, False: 88.4k]
  ------------------
  469|       |        /* Not found. */
  470|   383k|        if (intent != want_insert) {
  ------------------
  |  Branch (470:13): [True: 213k, False: 170k]
  ------------------
  471|   213k|            return NULL;
  472|   213k|        }
  473|       |        /*  Insert in the base hash table in an
  474|       |            empty slot. */
  475|   170k|        *inserted = 1;
  476|   170k|        head->record_count_++;
  477|   170k|        s->keyptr = (const void *)key;
  478|   170k|        s->entryused = 1;
  479|   170k|        s->next = 0;
  480|   170k|        return s;
  481|   383k|    }
  482|  88.4k|    kc = compar(key,s->keyptr);
  483|  88.4k|    if (kc == 0 ) {
  ------------------
  |  Branch (483:9): [True: 88.4k, False: 0]
  ------------------
  484|       |        /* found! */
  485|  88.4k|        if (intent == want_delete) {
  ------------------
  |  Branch (485:13): [True: 60, False: 88.4k]
  ------------------
  486|     60|            *owner_ptr = 0;
  487|     60|        }
  488|  88.4k|        return (void *)&(s->keyptr);
  489|  88.4k|    }
  490|      0|    chain_parent = s;
  491|      0|    for (c = s->next; c; c = c->next)  {
  ------------------
  |  Branch (491:23): [True: 0, False: 0]
  ------------------
  492|      0|        kc = compar(key,c->keyptr);
  493|      0|        if (kc == 0 ) {
  ------------------
  |  Branch (493:13): [True: 0, False: 0]
  ------------------
  494|       |            /* found! */
  495|      0|            if (intent == want_delete) {
  ------------------
  |  Branch (495:17): [True: 0, False: 0]
  ------------------
  496|      0|                *owner_ptr = chain_parent;
  497|      0|            }
  498|      0|            return (void *)&(c->keyptr);
  499|      0|        }
  500|      0|        chain_parent = c;
  501|      0|    }
  502|      0|    if (intent != want_insert) {
  ------------------
  |  Branch (502:9): [True: 0, False: 0]
  ------------------
  503|      0|        return NULL;
  504|      0|    }
  505|       |    /* Insert following head record of the chain. */
  506|      0|    q = allocate_ts_entry(key);
  507|      0|    if (!q) {
  ------------------
  |  Branch (507:9): [True: 0, False: 0]
  ------------------
  508|      0|        return q;
  509|      0|    }
  510|      0|    q->next = s->next;
  511|      0|    s->next = q;
  512|      0|    head->record_count_++;
  513|      0|    *inserted = 1;
  514|      0|    return q;
  515|      0|}
dwarf_tsearchhash.c:resize_table:
  350|     12|{
  351|     12|    struct hs_base newhead;
  352|     12|    unsigned new_entry_index = 0;
  353|     12|    unsigned long prime_to_use = 0;
  354|       |
  355|       |    /* Copy the values we have. */
  356|     12|    newhead = *head;
  357|       |    /* But drop the hashtab_ from new. calloc below. */
  358|     12|    newhead.hashtab_ = 0;
  359|     12|    newhead.record_count_ = 0;
  360|     12|    new_entry_index = head->tablesize_entry_index_ +1;
  361|     12|    prime_to_use = primes[new_entry_index];
  362|     12|    if (!prime_to_use) {
  ------------------
  |  Branch (362:9): [True: 0, False: 12]
  ------------------
  363|       |        /*  Oops, too large. Leave table size as is, though
  364|       |            it will get slow as it overfills. */
  365|      0|        return;
  366|      0|    }
  367|     12|    newhead.tablesize_ = prime_to_use;
  368|     12|    newhead.allowed_fill_ = calculate_allowed_fill(
  369|     12|        allowed_fill_percent, prime_to_use);
  370|     12|    if (newhead.allowed_fill_< (newhead.tablesize_/2)) {
  ------------------
  |  Branch (370:9): [True: 0, False: 12]
  ------------------
  371|       |        /* Oops. We are in trouble.  */
  372|      0|        return;
  373|      0|    }
  374|     12|    newhead.tablesize_entry_index_ = new_entry_index;
  375|     12|    newhead.hashtab_ = calloc(newhead.tablesize_,
  376|     12|        sizeof(struct ts_entry));
  377|     12|    if (!newhead.hashtab_) {
  ------------------
  |  Branch (377:9): [True: 0, False: 12]
  ------------------
  378|       |        /*  Oops, too large. Leave table size as is, though
  379|       |            things will get slow as it overfills. */
  380|      0|        free(newhead.hashtab_);
  381|      0|        return;
  382|      0|    }
  383|     12|    {
  384|       |        /*  Insert all the records from the old table into
  385|       |            the new table. */
  386|     12|        int fillnewfail = 0;
  387|     12|        unsigned long ix = 0;
  388|     12|        unsigned long tsize = head->tablesize_;
  389|     12|        struct ts_entry *p = &head->hashtab_[0];
  390|       |#ifdef TESTINGHASHTAB
  391|       |        printf("debugging: Resize %lu to %lu\n",tsize,prime_to_use);
  392|       |#endif
  393|  79.1k|        for ( ; ix < tsize; ix++,p++) {
  ------------------
  |  Branch (393:17): [True: 79.1k, False: 12]
  ------------------
  394|  79.1k|            int inserted = 0;
  395|  79.1k|            struct ts_entry*n = 0;
  396|  79.1k|            if (fillnewfail) {
  ------------------
  |  Branch (396:17): [True: 0, False: 79.1k]
  ------------------
  397|      0|                break;
  398|      0|            }
  399|  79.1k|            if (p->keyptr) {
  ------------------
  |  Branch (399:17): [True: 71.2k, False: 7.91k]
  ------------------
  400|  71.2k|                _tsearch_inner(p->keyptr,
  401|  71.2k|                    &newhead,compar,
  402|  71.2k|                    want_insert,
  403|  71.2k|                    &inserted,
  404|  71.2k|                    0);
  405|  71.2k|                if (!inserted) {
  ------------------
  |  Branch (405:21): [True: 0, False: 71.2k]
  ------------------
  406|      0|                    fillnewfail = 1;
  407|      0|                    break;
  408|      0|                }
  409|  71.2k|            }
  410|  79.1k|            for (n = p->next; n ; n = n->next) {
  ------------------
  |  Branch (410:31): [True: 0, False: 79.1k]
  ------------------
  411|      0|                inserted = 0;
  412|      0|                _tsearch_inner(n->keyptr,
  413|      0|                    &newhead,compar,
  414|      0|                    want_insert,
  415|      0|                    &inserted,
  416|      0|                    0);
  417|      0|                if (!inserted) {
  ------------------
  |  Branch (417:21): [True: 0, False: 0]
  ------------------
  418|      0|                    fillnewfail = 1;
  419|      0|                    break;
  420|      0|                }
  421|      0|            }
  422|  79.1k|        }
  423|     12|        if (fillnewfail) {
  ------------------
  |  Branch (423:13): [True: 0, False: 12]
  ------------------
  424|      0|            free(newhead.hashtab_);
  425|      0|            return;
  426|      0|        }
  427|     12|    }
  428|       |    /* Now get rid of the chain entries of the old table. */
  429|     12|    _dwarf_tdestroy_inner(head,0);
  430|       |    /* Now get rid of the old table itself. */
  431|     12|    free(head->hashtab_);
  432|     12|    head->hashtab_ = 0;
  433|     12|    *head = newhead;
  434|     12|    return;
  435|     12|}
dwarf_tsearchhash.c:_dwarf_twalk_inner:
  629|    218|{
  630|    218|    unsigned long ix = 0;
  631|    218|    int depth = 0;
  632|    218|    unsigned long tsize = h->tablesize_;
  633|   118k|    for ( ; ix < tsize; ix++,p++) {
  ------------------
  |  Branch (633:13): [True: 118k, False: 218]
  ------------------
  634|   118k|        struct ts_entry*n = 0;
  635|   118k|        if (p->keyptr) {
  ------------------
  |  Branch (635:13): [True: 301, False: 118k]
  ------------------
  636|    301|            action((void *)(&(p->keyptr)),dwarf_leaf,depth);
  637|    301|        }
  638|   118k|        for (n = p->next; n ; n = n->next) {
  ------------------
  |  Branch (638:27): [True: 0, False: 118k]
  ------------------
  639|      0|            action((void *)(&(n->keyptr)),dwarf_leaf,depth);
  640|      0|        }
  641|   118k|    }
  642|    218|}
dwarf_tsearchhash.c:_dwarf_tdestroy_inner:
  662|  5.57k|{
  663|  5.57k|    unsigned long ix = 0;
  664|  5.57k|    unsigned long tsize = h->tablesize_;
  665|  5.57k|    struct ts_entry *p = &h->hashtab_[0];
  666|       |#ifdef TESTINGHASHTAB
  667|       |    printf("debugging: destroyhashtable blocks      %lu\n",tsize);
  668|       |    printf("debugging: destroyhashtable recordcount %lu\n",
  669|       |        h->record_count_);
  670|       |#endif
  671|  6.41M|    for ( ; ix < tsize; ix++,p++) {
  ------------------
  |  Branch (671:13): [True: 6.40M, False: 5.57k]
  ------------------
  672|  6.40M|        struct ts_entry*n = 0;
  673|  6.40M|        struct ts_entry*prev = 0;
  674|  6.40M|        if (p->keyptr && p->entryused) {
  ------------------
  |  Branch (674:13): [True: 170k, False: 6.23M]
  |  Branch (674:26): [True: 170k, False: 0]
  ------------------
  675|   170k|            if (free_node) {
  ------------------
  |  Branch (675:17): [True: 98.9k, False: 71.2k]
  ------------------
  676|  98.9k|                free_node((void *)(p->keyptr));
  677|  98.9k|            }
  678|   170k|            --h->record_count_;
  679|   170k|        }
  680|       |        /* Now walk and free up the chain entries. */
  681|  6.40M|        for (n = p->next; n ; ) {
  ------------------
  |  Branch (681:27): [True: 0, False: 6.40M]
  ------------------
  682|      0|            if (free_node) {
  ------------------
  |  Branch (682:17): [True: 0, False: 0]
  ------------------
  683|      0|                free_node((void *)(n->keyptr));
  684|      0|            }
  685|      0|            --h->record_count_;
  686|      0|            prev = n;
  687|      0|            n = n->next;
  688|      0|            free(prev);
  689|      0|        }
  690|  6.40M|    }
  691|  5.57k|}

_dwarf_check_string_valid:
 1145|    199|{
 1146|    199|    Dwarf_Small *start = areaptr;
 1147|    199|    Dwarf_Small *p = strptr;
 1148|    199|    Dwarf_Small *end = areaendptr;
 1149|       |
 1150|    199|    if (p < start) {
  ------------------
  |  Branch (1150:9): [True: 0, False: 199]
  ------------------
 1151|      0|        _dwarf_error(dbg,error,suggested_error);
 1152|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1153|      0|    }
 1154|    199|    if (p >= end) {
  ------------------
  |  Branch (1154:9): [True: 0, False: 199]
  ------------------
 1155|      0|        _dwarf_error(dbg,error,suggested_error);
 1156|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1157|      0|    }
 1158|    199|    if (dbg->de_assume_string_in_bounds) {
  ------------------
  |  Branch (1158:9): [True: 0, False: 199]
  ------------------
 1159|       |        /* This NOT the default. But folks can choose
 1160|       |            to live dangerously and just assume strings ok. */
 1161|      0|        return DW_DLV_OK;
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
 1162|      0|    }
 1163|  91.6k|    while (p < end) {
  ------------------
  |  Branch (1163:12): [True: 91.6k, False: 6]
  ------------------
 1164|  91.6k|        if (*p == 0) {
  ------------------
  |  Branch (1164:13): [True: 193, False: 91.4k]
  ------------------
 1165|    193|            return DW_DLV_OK;
  ------------------
  |  |  122|    193|#define DW_DLV_OK        0
  ------------------
 1166|    193|        }
 1167|  91.4k|        ++p;
 1168|  91.4k|    }
 1169|      6|    _dwarf_error(dbg,error,DW_DLE_STRING_NOT_TERMINATED);
  ------------------
  |  | 1349|      6|#define DW_DLE_STRING_NOT_TERMINATED           303
  ------------------
 1170|      6|    return DW_DLV_ERROR;
  ------------------
  |  |  123|      6|#define DW_DLV_ERROR     1
  ------------------
 1171|    199|}

dwarf_get_xu_index_header:
  183|    559|{
  184|    559|    Dwarf_Xu_Index_Header indexptr = 0;
  185|    559|    int res = DW_DLV_ERROR;
  ------------------
  |  |  123|    559|#define DW_DLV_ERROR     1
  ------------------
  186|    559|    struct Dwarf_Section_s *sect = 0;
  187|    559|    Dwarf_Unsigned local_version = 0;
  188|    559|    Dwarf_Unsigned num_secs  = 0;
  189|    559|    Dwarf_Unsigned num_CUs  = 0;
  190|    559|    Dwarf_Unsigned num_slots  = 0;
  191|    559|    Dwarf_Small   *data = 0;
  192|    559|    Dwarf_Unsigned tables_end_offset = 0;
  193|    559|    Dwarf_Unsigned hash_tab_offset = 0;
  194|    559|    Dwarf_Unsigned indexes_tab_offset = 0;
  195|    559|    Dwarf_Unsigned section_offsets_tab_offset = 0;
  196|    559|    Dwarf_Unsigned section_offsets_headerline_offset = 0;
  197|    559|    Dwarf_Unsigned section_sizes_tab_offset = 0;
  198|    559|    unsigned datalen32 = SIZEOFT32;
  ------------------
  |  |   41|    559|#define SIZEOFT32 4
  ------------------
  199|    559|    Dwarf_Small *section_end = 0;
  200|       |
  201|    559|    CHECK_DBG(dbg,error,"dwarf_get_xu_index_header()");
  ------------------
  |  |  190|    559|    do {                                                      \
  |  |  191|    559|        if (!(cd_dbg) || (cd_dbg)->de_magic != DBG_IS_VALID) {    \
  |  |  ------------------
  |  |  |  |  596|    559|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |  |  Branch (191:13): [True: 0, False: 559]
  |  |  |  Branch (191:26): [True: 0, False: 559]
  |  |  ------------------
  |  |  192|      0|            _dwarf_error_string(NULL, (cd_er), DW_DLE_DBG_NULL, \
  |  |  ------------------
  |  |  |  | 1126|      0|#define DW_DLE_DBG_NULL                         81
  |  |  ------------------
  |  |  193|      0|                "DW_DLE_DBG_NULL: "                           \
  |  |  194|      0|                "dbg argument to " cd_funcname                \
  |  |  195|      0|                "either null or it contains"                  \
  |  |  196|      0|                "a stale Dwarf_Debug pointer");               \
  |  |  197|      0|            return DW_DLV_ERROR;                              \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  198|      0|        }                                                     \
  |  |  199|    559|    } while (0)
  |  |  ------------------
  |  |  |  Branch (199:14): [Folded, False: 559]
  |  |  ------------------
  ------------------
  202|    559|    if (!section_type || !xuptr) {
  ------------------
  |  Branch (202:9): [True: 0, False: 559]
  |  Branch (202:26): [True: 0, False: 559]
  ------------------
  203|      0|        _dwarf_error_string(0,error,DW_DLE_XU_TYPE_ARG_ERROR,
  ------------------
  |  | 1313|      0|#define DW_DLE_XU_TYPE_ARG_ERROR               268
  ------------------
  204|      0|            "DW_DLE_XU_TYPE_ARG_ERROR: section type or header "
  205|      0|            "return pointer is not valid");
  206|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  207|      0|    }
  208|       |
  209|    559|    if (!strcmp(section_type,"cu") ) {
  ------------------
  |  Branch (209:9): [True: 380, False: 179]
  ------------------
  210|    380|        sect = &dbg->de_debug_cu_index;
  211|    380|    } else if (!strcmp(section_type,"tu") ) {
  ------------------
  |  Branch (211:16): [True: 179, False: 0]
  ------------------
  212|    179|        sect = &dbg->de_debug_tu_index;
  213|    179|    } else {
  214|      0|        _dwarf_error_string(dbg, error, DW_DLE_XU_TYPE_ARG_ERROR,
  ------------------
  |  | 1313|      0|#define DW_DLE_XU_TYPE_ARG_ERROR               268
  ------------------
  215|      0|            "DW_DLE_XU_TYPE_ARG_ERROR, Passed in section type "
  216|      0|            "is neither \"tu\" nor \"cu\"");
  217|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  218|      0|    }
  219|    559|    if (!sect->dss_size) {
  ------------------
  |  Branch (219:9): [True: 0, False: 559]
  ------------------
  220|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
  221|      0|    }
  222|    559|    if (!sect->dss_data) {
  ------------------
  |  Branch (222:9): [True: 559, False: 0]
  ------------------
  223|    559|        res = _dwarf_load_section(dbg, sect,error);
  224|    559|        if (res != DW_DLV_OK) {
  ------------------
  |  |  122|    559|#define DW_DLV_OK        0
  ------------------
  |  Branch (224:13): [True: 274, False: 285]
  ------------------
  225|    274|            return res;
  226|    274|        }
  227|    559|    }
  228|       |
  229|    285|    data = sect->dss_data;
  230|    285|    section_end = data + sect->dss_size;
  231|       |
  232|    285|    if (sect->dss_size < (4*datalen32) ) {
  ------------------
  |  Branch (232:9): [True: 2, False: 283]
  ------------------
  233|      2|        dwarfstring m;
  234|       |
  235|      2|        dwarfstring_constructor(&m);
  236|      2|        dwarfstring_append_printf_s(&m,
  237|      2|            "DW_DLE_ERRONEOUS_XU_INDEX_SECTION: "
  238|      2|            "The size of the %s ",
  239|      2|            (char *)section_type);
  240|      2|        dwarfstring_append_printf_u(&m,
  241|      2|            "is just %u bytes, much to small to be "
  242|      2|            " a correct section",
  243|      2|            sect->dss_size);
  244|      2|        _dwarf_error_string(dbg, error,
  245|      2|            DW_DLE_ERRONEOUS_XU_INDEX_SECTION,
  ------------------
  |  | 1391|      2|#define DW_DLE_ERRONEOUS_XU_INDEX_SECTION      345
  ------------------
  246|      2|            dwarfstring_string(&m));
  247|      2|        dwarfstring_destructor(&m);
  248|      2|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      2|#define DW_DLV_ERROR     1
  ------------------
  249|      2|    }
  250|    283|    READ_UNALIGNED_CK(dbg,local_version, Dwarf_Unsigned,
  ------------------
  |  |  245|    283|    do  {                                        \
  |  |  246|    283|        desttype _ltmp = 0;                      \
  |  |  247|    283|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|    283|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 283]
  |  |  ------------------
  |  |  249|      0|            _dwarf_error_string((dbg), (error),  \
  |  |  250|      0|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      0|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  251|      0|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  252|      0|                "Read starts past the end of section");\
  |  |  253|      0|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  254|      0|        }                                        \
  |  |  255|    283|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 0, False: 283]
  |  |  ------------------
  |  |  256|      0|            _dwarf_error_string((dbg), (error),  \
  |  |  257|      0|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      0|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  258|      0|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  259|      0|                "Read would end past the end of section");\
  |  |  260|      0|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  261|      0|        }                                        \
  |  |  262|    283|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|    283|            (source), (unsigned long)(length)) ; \
  |  |  264|    283|        (dest) = _ltmp;                          \
  |  |  265|    283|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 283]
  |  |  ------------------
  ------------------
  251|    283|        data,datalen32,
  252|    283|        error,section_end);
  253|    283|    data += datalen32;
  254|    283|    if (local_version < DW_CU_VERSION2 ||
  ------------------
  |  |   53|    566|#define DW_CU_VERSION2 2
  ------------------
  |  Branch (254:9): [True: 3, False: 280]
  ------------------
  255|    280|        local_version > DW_CU_VERSION5) {
  ------------------
  |  |   56|    280|#define DW_CU_VERSION5 5
  ------------------
  |  Branch (255:9): [True: 43, False: 237]
  ------------------
  256|       |        /*  A GNU extension allowed debug_fission to
  257|       |            apply to DWARF4, and even down to...DWARF2! */
  258|     46|        dwarfstring m;
  259|       |
  260|     46|        dwarfstring_constructor(&m);
  261|       |
  262|     46|        dwarfstring_append_printf_u(&m,"DW_DLE_XU_NAME_COL_ERROR: "
  263|     46|            "The CU/TU Index Section version is %u ",local_version);
  264|     46|        _dwarf_error_string(dbg,error,DW_DLE_XU_NAME_COL_ERROR,
  ------------------
  |  | 1315|     46|#define DW_DLE_XU_NAME_COL_ERROR               270
  ------------------
  265|     46|            dwarfstring_string(&m));
  266|     46|        dwarfstring_destructor(&m);
  267|     46|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     46|#define DW_DLV_ERROR     1
  ------------------
  268|     46|    }
  269|       |
  270|       |    /* reading N, section_count */
  271|    237|    READ_UNALIGNED_CK(dbg,num_secs, Dwarf_Unsigned,
  ------------------
  |  |  245|    237|    do  {                                        \
  |  |  246|    237|        desttype _ltmp = 0;                      \
  |  |  247|    237|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|    237|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 237]
  |  |  ------------------
  |  |  249|      0|            _dwarf_error_string((dbg), (error),  \
  |  |  250|      0|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      0|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  251|      0|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  252|      0|                "Read starts past the end of section");\
  |  |  253|      0|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  254|      0|        }                                        \
  |  |  255|    237|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 0, False: 237]
  |  |  ------------------
  |  |  256|      0|            _dwarf_error_string((dbg), (error),  \
  |  |  257|      0|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      0|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  258|      0|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  259|      0|                "Read would end past the end of section");\
  |  |  260|      0|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  261|      0|        }                                        \
  |  |  262|    237|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|    237|            (source), (unsigned long)(length)) ; \
  |  |  264|    237|        (dest) = _ltmp;                          \
  |  |  265|    237|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 237]
  |  |  ------------------
  ------------------
  272|    237|        data,datalen32,
  273|    237|        error,section_end);
  274|    237|    if (num_secs > DW_SECT_RNGLISTS) {
  ------------------
  |  | 1103|    237|#define DW_SECT_RNGLISTS    8  /* .debug_rnglists.dwo    DWARF5 */
  ------------------
  |  Branch (274:9): [True: 30, False: 207]
  ------------------
  275|     30|        dwarfstring m;
  276|       |
  277|     30|        dwarfstring_constructor(&m);
  278|     30|        dwarfstring_append_printf_s(&m,
  279|     30|            "DW_DLE_XU_NAME_COL_ERROR: "
  280|     30|            " %s index section header ",
  281|     30|            (char *)section_type);
  282|     30|        dwarfstring_append_printf_u(&m,
  283|     30|            "shows N, the sections count, "
  284|     30|            "as %u but only values "
  285|     30|            " 1 through 8 (DW_SECT_RNGLISTS) are valid.",
  286|     30|            num_secs);
  287|     30|        _dwarf_error_string(dbg,error,DW_DLE_XU_NAME_COL_ERROR,
  ------------------
  |  | 1315|     30|#define DW_DLE_XU_NAME_COL_ERROR               270
  ------------------
  288|     30|            dwarfstring_string(&m));
  289|     30|        dwarfstring_destructor(&m);
  290|     30|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     30|#define DW_DLV_ERROR     1
  ------------------
  291|     30|    }
  292|    207|    data += datalen32;
  293|       |    /*  Reading U, unit_count, compilation-units or type-units
  294|       |        depending on cu or tu */
  295|    207|    READ_UNALIGNED_CK(dbg,num_CUs, Dwarf_Unsigned,
  ------------------
  |  |  245|    207|    do  {                                        \
  |  |  246|    207|        desttype _ltmp = 0;                      \
  |  |  247|    207|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|    207|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 207]
  |  |  ------------------
  |  |  249|      0|            _dwarf_error_string((dbg), (error),  \
  |  |  250|      0|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      0|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  251|      0|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  252|      0|                "Read starts past the end of section");\
  |  |  253|      0|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  254|      0|        }                                        \
  |  |  255|    207|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 0, False: 207]
  |  |  ------------------
  |  |  256|      0|            _dwarf_error_string((dbg), (error),  \
  |  |  257|      0|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      0|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  258|      0|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  259|      0|                "Read would end past the end of section");\
  |  |  260|      0|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  261|      0|        }                                        \
  |  |  262|    207|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|    207|            (source), (unsigned long)(length)) ; \
  |  |  264|    207|        (dest) = _ltmp;                          \
  |  |  265|    207|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 207]
  |  |  ------------------
  ------------------
  296|    207|        data,datalen32,
  297|    207|        error,section_end);
  298|    207|    data += datalen32;
  299|    207|    if (num_CUs >= sect->dss_size ||
  ------------------
  |  Branch (299:9): [True: 48, False: 159]
  ------------------
  300|    159|        (num_CUs/datalen32) >= sect->dss_size) {
  ------------------
  |  Branch (300:9): [True: 0, False: 159]
  ------------------
  301|     48|        _dwarf_error_string(dbg,error,DW_DLE_XU_NAME_COL_ERROR,
  ------------------
  |  | 1315|     48|#define DW_DLE_XU_NAME_COL_ERROR               270
  ------------------
  302|     48|            "dbg,error,DW_DLE_XU_NAME_COL_ERROR: "
  303|     48|            "The CU/TU Index Section header unit count "
  304|     48|            "is too large to be real. Corrupt DWARF\n");
  305|     48|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     48|#define DW_DLV_ERROR     1
  ------------------
  306|     48|    }
  307|       |    /* reading S, slot_count, slots in the hash table */
  308|    159|    READ_UNALIGNED_CK(dbg,num_slots, Dwarf_Unsigned,
  ------------------
  |  |  245|    159|    do  {                                        \
  |  |  246|    159|        desttype _ltmp = 0;                      \
  |  |  247|    159|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|    159|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 159]
  |  |  ------------------
  |  |  249|      0|            _dwarf_error_string((dbg), (error),  \
  |  |  250|      0|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      0|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  251|      0|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  252|      0|                "Read starts past the end of section");\
  |  |  253|      0|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  254|      0|        }                                        \
  |  |  255|    159|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 0, False: 159]
  |  |  ------------------
  |  |  256|      0|            _dwarf_error_string((dbg), (error),  \
  |  |  257|      0|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      0|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  258|      0|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  259|      0|                "Read would end past the end of section");\
  |  |  260|      0|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  261|      0|        }                                        \
  |  |  262|    159|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|    159|            (source), (unsigned long)(length)) ; \
  |  |  264|    159|        (dest) = _ltmp;                          \
  |  |  265|    159|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 159]
  |  |  ------------------
  ------------------
  309|    159|        data,datalen32,
  310|    159|        error,section_end);
  311|    159|    hash_tab_offset = datalen32*4;
  312|    159|    indexes_tab_offset = hash_tab_offset +
  313|    159|        (num_slots * HASHSIGNATURELEN);
  ------------------
  |  |   88|    159|#define  HASHSIGNATURELEN 8
  ------------------
  314|       |    /*  Look for corrupt section data. */
  315|    159|    if (num_slots > sect->dss_size) {
  ------------------
  |  Branch (315:9): [True: 47, False: 112]
  ------------------
  316|     47|        dwarfstring m;
  317|       |
  318|     47|        dwarfstring_constructor(&m);
  319|     47|        dwarfstring_append_printf_s(&m,
  320|     47|            "DW_DLE_ERRONEOUS_XU_INDEX_SECTION: "
  321|     47|            "The size of the %s ",(char *)section_type);
  322|     47|        dwarfstring_append_printf_u(&m,
  323|     47|            " is just %u bytes,",sect->dss_size);
  324|     47|        dwarfstring_append_printf_u(&m,
  325|     47|            "while the number of slots (S) is %u. "
  326|     47|            "which is clearly wrong",num_slots );
  327|     47|        _dwarf_error_string(dbg, error,
  328|     47|            DW_DLE_ERRONEOUS_XU_INDEX_SECTION,
  ------------------
  |  | 1391|     47|#define DW_DLE_ERRONEOUS_XU_INDEX_SECTION      345
  ------------------
  329|     47|            dwarfstring_string(&m));
  330|     47|        dwarfstring_destructor(&m);
  331|     47|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     47|#define DW_DLV_ERROR     1
  ------------------
  332|     47|    }
  333|    112|    if ( (4*num_slots) > sect->dss_size) {
  ------------------
  |  Branch (333:10): [True: 22, False: 90]
  ------------------
  334|     22|        dwarfstring m;
  335|       |
  336|     22|        dwarfstring_constructor(&m);
  337|     22|        dwarfstring_append_printf_s(&m,
  338|     22|            "DW_DLE_ERRONEOUS_XU_INDEX_SECTION: "
  339|     22|            "The size of the %s ",(char *)section_type);
  340|     22|        dwarfstring_append_printf_u(&m,
  341|     22|            " is just %u bytes,",sect->dss_size);
  342|     22|        dwarfstring_append_printf_u(&m,
  343|     22|            "while the number of slots bytes (S) is at least %u. "
  344|     22|            "which is clearly wrong",num_slots*4);
  345|     22|        _dwarf_error_string(dbg, error,
  346|     22|            DW_DLE_ERRONEOUS_XU_INDEX_SECTION,
  ------------------
  |  | 1391|     22|#define DW_DLE_ERRONEOUS_XU_INDEX_SECTION      345
  ------------------
  347|     22|            dwarfstring_string(&m));
  348|     22|        dwarfstring_destructor(&m);
  349|     22|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     22|#define DW_DLV_ERROR     1
  ------------------
  350|     22|    }
  351|       |
  352|       |    /*  This offset is to  1 row of N columns, each 32bit. */
  353|     90|    section_offsets_headerline_offset = indexes_tab_offset +
  354|     90|        (num_slots *datalen32);
  355|       |    /*  Now we can make the real table part index normally.
  356|       |        This offset is to  U row of N columns, each 32bit. */
  357|     90|    section_offsets_tab_offset = section_offsets_headerline_offset
  358|     90|        + (num_secs*datalen32);
  359|     90|    if ( num_secs > sect->dss_size) {
  ------------------
  |  Branch (359:10): [True: 0, False: 90]
  ------------------
  360|      0|        dwarfstring m;
  361|       |
  362|      0|        dwarfstring_constructor(&m);
  363|      0|        dwarfstring_append_printf_s(&m,
  364|      0|            "DW_DLE_ERRONEOUS_XU_INDEX_SECTION: "
  365|      0|            "The size of the %s ",(char *)section_type);
  366|      0|        dwarfstring_append_printf_u(&m,
  367|      0|            " is just %u bytes,",sect->dss_size);
  368|      0|        dwarfstring_append_printf_u(&m,
  369|      0|            "while the number of sections/columns (S) is %u. "
  370|      0|            "which is clearly wrong",num_secs );
  371|      0|        _dwarf_error_string(dbg, error,
  372|      0|            DW_DLE_ERRONEOUS_XU_INDEX_SECTION,
  ------------------
  |  | 1391|      0|#define DW_DLE_ERRONEOUS_XU_INDEX_SECTION      345
  ------------------
  373|      0|            dwarfstring_string(&m));
  374|      0|        dwarfstring_destructor(&m);
  375|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  376|      0|    }
  377|     90|    if ( (datalen32*num_secs) > sect->dss_size) {
  ------------------
  |  Branch (377:10): [True: 5, False: 85]
  ------------------
  378|      5|        dwarfstring m;
  379|       |
  380|      5|        dwarfstring_constructor(&m);
  381|      5|        dwarfstring_append_printf_s(&m,
  382|      5|            "DW_DLE_ERRONEOUS_XU_INDEX_SECTION: "
  383|      5|            "The size of the %s ",(char *)section_type);
  384|      5|        dwarfstring_append_printf_u(&m,
  385|      5|            " is just %u bytes,",sect->dss_size);
  386|      5|        dwarfstring_append_printf_u(&m,
  387|      5|            "while the number of sections/columns bytes (S)"
  388|      5|            " is at least %u. "
  389|      5|            "which is clearly wrong",num_secs*4);
  390|      5|        _dwarf_error_string(dbg, error,
  391|      5|            DW_DLE_ERRONEOUS_XU_INDEX_SECTION,
  ------------------
  |  | 1391|      5|#define DW_DLE_ERRONEOUS_XU_INDEX_SECTION      345
  ------------------
  392|      5|            dwarfstring_string(&m));
  393|      5|        dwarfstring_destructor(&m);
  394|      5|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      5|#define DW_DLV_ERROR     1
  ------------------
  395|      5|    }
  396|     85|    section_sizes_tab_offset = section_offsets_tab_offset +
  397|     85|        (num_CUs *num_secs* datalen32) ;
  398|     85|    tables_end_offset = section_sizes_tab_offset +
  399|     85|        (num_CUs * num_secs * datalen32);
  400|     85|    if ( tables_end_offset > sect->dss_size) {
  ------------------
  |  Branch (400:10): [True: 25, False: 60]
  ------------------
  401|       |        /* Something is badly wrong here. */
  402|     25|        dwarfstring m;
  403|       |
  404|     25|        dwarfstring_constructor(&m);
  405|     25|        dwarfstring_append_printf_u(&m,"ERROR: "
  406|     25|            "DW_DLE_ERRONEOUS_XU_INDEX_SECTION as the end offset "
  407|     25|            "0x%lx is greater than ",tables_end_offset);
  408|     25|        dwarfstring_append_printf_u(&m,"the section size "
  409|     25|            "0x%lx.",sect->dss_size);
  410|     25|        _dwarf_error_string(dbg, error,
  411|     25|            DW_DLE_ERRONEOUS_XU_INDEX_SECTION,
  ------------------
  |  | 1391|     25|#define DW_DLE_ERRONEOUS_XU_INDEX_SECTION      345
  ------------------
  412|     25|            dwarfstring_string(&m));
  413|     25|        dwarfstring_destructor(&m);
  414|     25|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     25|#define DW_DLV_ERROR     1
  ------------------
  415|     25|    }
  416|     60|    indexptr = (Dwarf_Xu_Index_Header)
  417|     60|        _dwarf_get_alloc(dbg,DW_DLA_XU_INDEX,1);
  ------------------
  |  | 1018|     60|#define DW_DLA_XU_INDEX        0x38  /* Dwarf_Xu_Index_Header */
  ------------------
  418|     60|    if (indexptr == NULL) {
  ------------------
  |  Branch (418:9): [True: 0, False: 60]
  ------------------
  419|      0|        _dwarf_error(dbg, error, DW_DLE_ALLOC_FAIL);
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  420|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  421|      0|    }
  422|       |    /*  Only "cu" or "tu" allowed, that is checked above.
  423|       |        But for safety we just copy the allowed bytes*/
  424|     60|    indexptr->gx_type[0] = section_type[0];
  425|     60|    indexptr->gx_type[1] = section_type[1];
  426|     60|    indexptr->gx_type[2] = 0;
  427|     60|    indexptr->gx_dbg = dbg;
  428|     60|    indexptr->gx_section_length = sect->dss_size;
  429|     60|    indexptr->gx_section_data   = sect->dss_data;
  430|     60|    indexptr->gx_section_name   = sect->dss_name;
  431|     60|    indexptr->gx_version        = local_version;
  432|     60|    indexptr->gx_column_count_sections = num_secs;
  433|     60|    indexptr->gx_units_in_index = num_CUs;
  434|     60|    indexptr->gx_slots_in_hash  = num_slots;
  435|     60|    indexptr->gx_hash_table_offset  =  hash_tab_offset;
  436|     60|    indexptr->gx_index_table_offset = indexes_tab_offset;
  437|     60|    indexptr->gx_section_offsets_headerline_offset=
  438|     60|        section_offsets_headerline_offset;
  439|     60|    indexptr->gx_section_offsets_offset= section_offsets_tab_offset;
  440|     60|    indexptr->gx_section_sizes_offset  = section_sizes_tab_offset;
  441|     60|    res = fill_in_offsets_headerline(dbg,indexptr,
  442|     60|        section_offsets_headerline_offset,
  443|     60|        num_secs,error);
  444|     60|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     60|#define DW_DLV_OK        0
  ------------------
  |  Branch (444:9): [True: 33, False: 27]
  ------------------
  445|     33|        dwarf_dealloc(dbg,indexptr,DW_DLA_XU_INDEX);
  ------------------
  |  | 1018|     33|#define DW_DLA_XU_INDEX        0x38  /* Dwarf_Xu_Index_Header */
  ------------------
  446|     33|        return res;
  447|     33|    }
  448|     27|    *xuptr             =     indexptr;
  449|     27|    *version           = indexptr->gx_version;
  450|     27|    *number_of_columns = indexptr->gx_column_count_sections;
  451|     27|    *number_of_CUs     = indexptr->gx_units_in_index;
  452|     27|    *number_of_slots   = indexptr->gx_slots_in_hash;
  453|     27|    *section_name      = indexptr->gx_section_name;
  454|     27|    return DW_DLV_OK;
  ------------------
  |  |  122|     27|#define DW_DLV_OK        0
  ------------------
  455|     60|}
dwarf_dealloc_xu_header:
 1243|     27|{
 1244|     27|    if (indexptr) {
  ------------------
  |  Branch (1244:9): [True: 27, False: 0]
  ------------------
 1245|     27|        Dwarf_Debug dbg = indexptr->gx_dbg;
 1246|     27|        dwarf_dealloc(dbg,indexptr,DW_DLA_XU_INDEX);
  ------------------
  |  | 1018|     27|#define DW_DLA_XU_INDEX        0x38  /* Dwarf_Xu_Index_Header */
  ------------------
 1247|     27|    }
 1248|     27|}
dwarf_xu_index.c:fill_in_offsets_headerline:
  116|     60|{
  117|     60|    Dwarf_Small *section_start = xuhdr->gx_section_data;
  118|     60|    Dwarf_Small *section_end = xuhdr->gx_section_data+
  119|     60|        xuhdr->gx_section_length;
  120|     60|    Dwarf_Small *data = 0;
  121|     60|    unsigned i = 0;
  122|       |
  123|     60|    data = section_start +headerline_offset;
  124|     96|    for ( ; i < num_sects ; ++i) {
  ------------------
  |  Branch (124:13): [True: 69, False: 27]
  ------------------
  125|     69|        Dwarf_Unsigned v = 0;
  126|       |
  127|     69|        READ_UNALIGNED_CK(dbg,v, Dwarf_Unsigned,
  ------------------
  |  |  245|     69|    do  {                                        \
  |  |  246|     69|        desttype _ltmp = 0;                      \
  |  |  247|     69|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|     69|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 69]
  |  |  ------------------
  |  |  249|      0|            _dwarf_error_string((dbg), (error),  \
  |  |  250|      0|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      0|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  251|      0|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  252|      0|                "Read starts past the end of section");\
  |  |  253|      0|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  254|      0|        }                                        \
  |  |  255|     69|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 0, False: 69]
  |  |  ------------------
  |  |  256|      0|            _dwarf_error_string((dbg), (error),  \
  |  |  257|      0|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      0|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  258|      0|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  259|      0|                "Read would end past the end of section");\
  |  |  260|      0|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  261|      0|        }                                        \
  |  |  262|     69|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|     69|            (source), (unsigned long)(length)) ; \
  |  |  264|     69|        (dest) = _ltmp;                          \
  |  |  265|     69|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 69]
  |  |  ------------------
  ------------------
  128|     69|            data,SIZEOFT32,
  129|     69|            error,section_end);
  130|     69|        data += SIZEOFT32;
  ------------------
  |  |   41|     69|#define SIZEOFT32 4
  ------------------
  131|     69|        if (v > DW_SECT_RNGLISTS) {
  ------------------
  |  | 1103|     69|#define DW_SECT_RNGLISTS    8  /* .debug_rnglists.dwo    DWARF5 */
  ------------------
  |  Branch (131:13): [True: 33, False: 36]
  ------------------
  132|     33|            dwarfstring s;
  133|       |
  134|     33|            dwarfstring_constructor(&s);
  135|     33|            dwarfstring_append_printf_u(&s,
  136|     33|                "ERROR: DW_DLE_XU_NAME_COL_ERROR  The "
  137|     33|                "section number of %u ",v);
  138|     33|            dwarfstring_append(&s," is too high. "
  139|     33|                "Sections 1-8 are listed in "
  140|     33|                "DWARF5 Table 7.1.");
  141|     33|            _dwarf_error_string(dbg, error, DW_DLE_XU_NAME_COL_ERROR,
  ------------------
  |  | 1315|     33|#define DW_DLE_XU_NAME_COL_ERROR               270
  ------------------
  142|     33|                dwarfstring_string(&s));
  143|     33|            dwarfstring_destructor(&s);
  144|     33|            return DW_DLV_ERROR;
  ------------------
  |  |  123|     33|#define DW_DLV_ERROR     1
  ------------------
  145|     33|        }
  146|     36|        xuhdr->gx_section_id[i] = (unsigned long)v;
  147|     36|    }
  148|     27|    return DW_DLV_OK;
  ------------------
  |  |  122|     27|#define DW_DLV_OK        0
  ------------------
  149|     60|}

