LLVMFuzzerTestOneInput:
   33|  8.41k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   34|  8.41k|  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.41k|  sprintf(filename, "/tmp/libfuzzer.%d", getpid());
   40|  8.41k|#endif
   41|  8.41k|  FILE *fp = fopen(filename, "wb");
   42|  8.41k|  if (!fp) {
  ------------------
  |  Branch (42:7): [True: 0, False: 8.41k]
  ------------------
   43|      0|    printf("FAIL libfuzzer cannot open temp as writeable %s\n",
   44|      0|        filename);
   45|      0|    return 0;
   46|      0|  }
   47|       |
   48|  8.41k|  fwrite(data, size, 1, fp);
   49|  8.41k|  fclose(fp);
   50|       |
   51|  8.41k|  int fuzz_fd = 0;
   52|  8.41k|  Dwarf_Ptr errarg = 0;
   53|  8.41k|  Dwarf_Handler errhand = 0;
   54|  8.41k|  Dwarf_Error *errp = NULL;
   55|  8.41k|  Dwarf_Debug dbg = 0;
   56|       |
   57|  8.41k|  fuzz_fd = open(filename, O_RDONLY |O_BINARY);
  ------------------
  |  |   27|  8.41k|#define O_BINARY 0
  ------------------
   58|  8.41k|  if (fuzz_fd != -1) {
  ------------------
  |  Branch (58:7): [True: 8.41k, False: 0]
  ------------------
   59|  8.41k|    dwarf_init_b(fuzz_fd, DW_GROUPNUMBER_ANY, errhand, errarg, &dbg, errp);
  ------------------
  |  |  126|  8.41k|#define DW_GROUPNUMBER_ANY  0
  ------------------
   60|       |
   61|  8.41k|    int res = 0;
   62|  8.41k|    char *debuglink_path = 0;
   63|  8.41k|    unsigned char *crc = 0;
   64|  8.41k|    char *debuglink_fullpath = 0;
   65|  8.41k|    unsigned debuglink_fullpath_strlen = 0;
   66|  8.41k|    unsigned buildid_type = 0;
   67|  8.41k|    char *buildidowner_name = 0;
   68|  8.41k|    unsigned char *buildid_itself = 0;
   69|  8.41k|    unsigned buildid_length = 0;
   70|  8.41k|    char **paths = 0;
   71|  8.41k|    unsigned paths_count = 0;
   72|  8.41k|    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.41k|    res =
   79|  8.41k|        dwarf_add_debuglink_global_path(dbg, "/usr/include/c++/9/debug", errp);
   80|  8.41k|    res = dwarf_gnu_debuglink(dbg, &debuglink_path, &crc, &debuglink_fullpath,
   81|  8.41k|                              &debuglink_fullpath_strlen, &buildid_type,
   82|  8.41k|                              &buildidowner_name, &buildid_itself,
   83|  8.41k|                              &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.41k|    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.41k|    free(debuglink_fullpath);
   96|       |
   97|  8.41k|    dwarf_finish(dbg);
   98|  8.41k|    close(fuzz_fd);
   99|  8.41k|  }
  100|       |
  101|  8.41k|  unlink(filename);
  102|  8.41k|  return 0;
  103|  8.41k|}

_dwarf_load_macho_header64:
   63|    897|{
   64|    897|    struct mach_header_64 mh64;
   65|    897|    int res = 0;
   66|    897|    Dwarf_Unsigned inner = mfp->mo_inner_offset;
   67|       |
   68|    897|    if (sizeof(mh64) > mfp->mo_filesize) {
  ------------------
  |  Branch (68:9): [True: 23, False: 874]
  ------------------
   69|     23|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     23|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
   70|     23|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     23|#define DW_DLV_ERROR      1
  ------------------
   71|     23|    }
   72|    874|    res = RRMOA(mfp->mo_fd, &mh64, inner, sizeof(mh64),
  ------------------
  |  |   65|    874|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    874|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
   73|    874|        (inner+mfp->mo_filesize), errcode);
   74|    874|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    874|#define DW_DLV_OK         0
  ------------------
  |  Branch (74:9): [True: 0, False: 874]
  ------------------
   75|      0|        return res;
   76|      0|    }
   77|       |    /* Do not adjust endianness of magic, leave as-is. */
   78|    874|    ASNAR(memcpy,mfp->mo_header.magic,mh64.magic);
  ------------------
  |  |   53|    874|    do {                                        \
  |  |   54|    874|        (t) = 0;                                \
  |  |   55|    874|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    874|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 874]
  |  |  ------------------
  ------------------
   79|    874|    ASNAR(mfp->mo_copy_word,mfp->mo_header.cputype,mh64.cputype);
  ------------------
  |  |   53|    874|    do {                                        \
  |  |   54|    874|        (t) = 0;                                \
  |  |   55|    874|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    874|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 874]
  |  |  ------------------
  ------------------
   80|    874|    ASNAR(mfp->mo_copy_word,mfp->mo_header.cpusubtype,
  ------------------
  |  |   53|    874|    do {                                        \
  |  |   54|    874|        (t) = 0;                                \
  |  |   55|    874|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    874|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 874]
  |  |  ------------------
  ------------------
   81|    874|        mh64.cpusubtype);
   82|    874|    ASNAR(mfp->mo_copy_word,mfp->mo_header.filetype,mh64.filetype);
  ------------------
  |  |   53|    874|    do {                                        \
  |  |   54|    874|        (t) = 0;                                \
  |  |   55|    874|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    874|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 874]
  |  |  ------------------
  ------------------
   83|    874|    ASNAR(mfp->mo_copy_word,mfp->mo_header.ncmds,mh64.ncmds);
  ------------------
  |  |   53|    874|    do {                                        \
  |  |   54|    874|        (t) = 0;                                \
  |  |   55|    874|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    874|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 874]
  |  |  ------------------
  ------------------
   84|    874|    ASNAR(mfp->mo_copy_word,mfp->mo_header.sizeofcmds,
  ------------------
  |  |   53|    874|    do {                                        \
  |  |   54|    874|        (t) = 0;                                \
  |  |   55|    874|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    874|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 874]
  |  |  ------------------
  ------------------
   85|    874|        mh64.sizeofcmds);
   86|    874|    ASNAR(mfp->mo_copy_word,mfp->mo_header.flags,mh64.flags);
  ------------------
  |  |   53|    874|    do {                                        \
  |  |   54|    874|        (t) = 0;                                \
  |  |   55|    874|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    874|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 874]
  |  |  ------------------
  ------------------
   87|    874|    ASNAR(mfp->mo_copy_word,mfp->mo_header.reserved,mh64.reserved);
  ------------------
  |  |   53|    874|    do {                                        \
  |  |   54|    874|        (t) = 0;                                \
  |  |   55|    874|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    874|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 874]
  |  |  ------------------
  ------------------
   88|    874|    mfp->mo_command_count = (unsigned int)mfp->mo_header.ncmds;
   89|    874|    if (mfp->mo_header.sizeofcmds >= MAX_COMMANDS_SIZE ||
  ------------------
  |  |   42|  1.74k|#define MAX_COMMANDS_SIZE  30000
  ------------------
  |  Branch (89:9): [True: 22, False: 852]
  ------------------
   90|    852|        mfp->mo_header.sizeofcmds >= mfp->mo_filesize ) {
  ------------------
  |  Branch (90:9): [True: 33, False: 819]
  ------------------
   91|     55|        *errcode = DW_DLE_MACHO_CORRUPT_HEADER;
  ------------------
  |  | 1532|     55|#define DW_DLE_MACHO_CORRUPT_HEADER            486
  ------------------
   92|     55|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     55|#define DW_DLV_ERROR      1
  ------------------
   93|     55|    }
   94|    819|    mfp->mo_machine = mfp->mo_header.cputype;
   95|    819|    mfp->mo_flags = mfp->mo_header.flags;
   96|    819|    mfp->mo_command_start_offset = sizeof(mh64);
   97|    819|    return DW_DLV_OK;
  ------------------
  |  |   59|    819|#define DW_DLV_OK         0
  ------------------
   98|    874|}
_dwarf_load_segment_command_content64:
  106|   271k|{
  107|   271k|    struct segment_command_64 sc;
  108|   271k|    int res = 0;
  109|   271k|    Dwarf_Unsigned filesize = mfp->mo_filesize;
  110|   271k|    Dwarf_Unsigned segoffset = mmp->offset_this_command;
  111|   271k|    Dwarf_Unsigned afterseghdr = segoffset + sizeof(sc);
  112|   271k|    Dwarf_Unsigned inner = mfp->mo_inner_offset;
  113|       |
  114|   271k|    if (segoffset > filesize ||
  ------------------
  |  Branch (114:9): [True: 0, False: 271k]
  ------------------
  115|   271k|        mmp->cmdsize > filesize ||
  ------------------
  |  Branch (115:9): [True: 0, False: 271k]
  ------------------
  116|   271k|        (mmp->cmdsize + segoffset) > filesize ) {
  ------------------
  |  Branch (116:9): [True: 0, False: 271k]
  ------------------
  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|   271k|    res = RRMOA(mfp->mo_fd,&sc,inner+segoffset,
  ------------------
  |  |   65|   271k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|   271k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  121|   271k|        sizeof(sc), inner+filesize, errcode);
  122|   271k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|   271k|#define DW_DLV_OK         0
  ------------------
  |  Branch (122:9): [True: 30, False: 271k]
  ------------------
  123|     30|        return res;
  124|     30|    }
  125|   271k|    ASNAR(mfp->mo_copy_word,msp->cmd,sc.cmd);
  ------------------
  |  |   53|   271k|    do {                                        \
  |  |   54|   271k|        (t) = 0;                                \
  |  |   55|   271k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   271k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 271k]
  |  |  ------------------
  ------------------
  126|   271k|    ASNAR(mfp->mo_copy_word,msp->cmdsize,sc.cmdsize);
  ------------------
  |  |   53|   271k|    do {                                        \
  |  |   54|   271k|        (t) = 0;                                \
  |  |   55|   271k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   271k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 271k]
  |  |  ------------------
  ------------------
  127|   271k|    _dwarf_safe_strcpy(msp->segname,sizeof(msp->segname),
  128|   271k|        sc.segname,sizeof(sc.segname));
  129|   271k|    ASNAR(mfp->mo_copy_word,msp->vmaddr,sc.vmaddr);
  ------------------
  |  |   53|   271k|    do {                                        \
  |  |   54|   271k|        (t) = 0;                                \
  |  |   55|   271k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   271k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 271k]
  |  |  ------------------
  ------------------
  130|   271k|    ASNAR(mfp->mo_copy_word,msp->vmsize,sc.vmsize);
  ------------------
  |  |   53|   271k|    do {                                        \
  |  |   54|   271k|        (t) = 0;                                \
  |  |   55|   271k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   271k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 271k]
  |  |  ------------------
  ------------------
  131|   271k|    ASNAR(mfp->mo_copy_word,msp->fileoff,sc.fileoff);
  ------------------
  |  |   53|   271k|    do {                                        \
  |  |   54|   271k|        (t) = 0;                                \
  |  |   55|   271k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   271k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 271k]
  |  |  ------------------
  ------------------
  132|   271k|    ASNAR(mfp->mo_copy_word,msp->filesize,sc.filesize);
  ------------------
  |  |   53|   271k|    do {                                        \
  |  |   54|   271k|        (t) = 0;                                \
  |  |   55|   271k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   271k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 271k]
  |  |  ------------------
  ------------------
  133|   271k|    if (msp->fileoff > filesize ||
  ------------------
  |  Branch (133:9): [True: 101, False: 271k]
  ------------------
  134|   271k|        msp->filesize > filesize) {
  ------------------
  |  Branch (134:9): [True: 86, False: 271k]
  ------------------
  135|       |        /* corrupt */
  136|    187|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|    187|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  137|    187|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    187|#define DW_DLV_ERROR      1
  ------------------
  138|    187|    }
  139|   271k|    if ((msp->fileoff+msp->filesize ) > filesize) {
  ------------------
  |  Branch (139:9): [True: 24, False: 271k]
  ------------------
  140|       |        /* corrupt */
  141|     24|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|     24|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  142|     24|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     24|#define DW_DLV_ERROR      1
  ------------------
  143|     24|    }
  144|   271k|    ASNAR(mfp->mo_copy_word,msp->maxprot,sc.maxprot);
  ------------------
  |  |   53|   271k|    do {                                        \
  |  |   54|   271k|        (t) = 0;                                \
  |  |   55|   271k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   271k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 271k]
  |  |  ------------------
  ------------------
  145|   271k|    ASNAR(mfp->mo_copy_word,msp->initprot,sc.initprot);
  ------------------
  |  |   53|   271k|    do {                                        \
  |  |   54|   271k|        (t) = 0;                                \
  |  |   55|   271k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   271k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 271k]
  |  |  ------------------
  ------------------
  146|   271k|    ASNAR(mfp->mo_copy_word,msp->nsects,sc.nsects);
  ------------------
  |  |   53|   271k|    do {                                        \
  |  |   54|   271k|        (t) = 0;                                \
  |  |   55|   271k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   271k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 271k]
  |  |  ------------------
  ------------------
  147|   271k|    if (msp->nsects >= mfp->mo_filesize) {
  ------------------
  |  Branch (147:9): [True: 50, False: 270k]
  ------------------
  148|     50|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|     50|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  149|     50|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     50|#define DW_DLV_ERROR      1
  ------------------
  150|     50|    }
  151|   270k|    ASNAR(mfp->mo_copy_word,msp->flags,sc.flags);
  ------------------
  |  |   53|   270k|    do {                                        \
  |  |   54|   270k|        (t) = 0;                                \
  |  |   55|   270k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   270k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 270k]
  |  |  ------------------
  ------------------
  152|   270k|    msp->macho_command_index = mmpindex;
  153|   270k|    msp->sectionsoffset = afterseghdr;
  154|   270k|    return DW_DLV_OK;
  ------------------
  |  |   59|   270k|#define DW_DLV_OK         0
  ------------------
  155|   271k|}
_dwarf_macho_load_dwarf_section_details64:
  163|  46.0k|{
  164|  46.0k|    int            res = 0;
  165|  46.0k|    Dwarf_Unsigned seci = 0;
  166|  46.0k|    Dwarf_Unsigned seccount = segp->nsects;
  167|  46.0k|    Dwarf_Unsigned secalloc = seccount+1;
  168|       |
  169|       |    /* offset of sections being added */
  170|  46.0k|    Dwarf_Unsigned curoff = segp->sectionsoffset;
  171|  46.0k|    Dwarf_Unsigned shdrlen = sizeof(struct section_64);
  172|  46.0k|    Dwarf_Unsigned newcount = 0;
  173|  46.0k|    struct generic_macho_section *secs = 0;
  174|       |
  175|  46.0k|    if (mfp->mo_dwarf_sections) {
  ------------------
  |  Branch (175:9): [True: 45.3k, False: 696]
  ------------------
  176|  45.3k|        Dwarf_Unsigned secssizetot = 0;
  177|  45.3k|        struct generic_macho_section * originalsections =
  178|  45.3k|            mfp->mo_dwarf_sections;
  179|       |
  180|  45.3k|        if (!seccount) {
  ------------------
  |  Branch (180:13): [True: 27.2k, False: 18.1k]
  ------------------
  181|       |            /* No sections. Odd. Unexpected. */
  182|  27.2k|            return DW_DLV_OK;
  ------------------
  |  |   59|  27.2k|#define DW_DLV_OK         0
  ------------------
  183|  27.2k|        }
  184|  18.1k|        newcount = mfp->mo_dwarf_sectioncount + seccount;
  185|  18.1k|        res = _dwarf_uint64_mult(newcount,
  186|  18.1k|            sizeof(struct generic_macho_section),
  187|  18.1k|            &secssizetot);
  188|  18.1k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  18.1k|#define DW_DLV_OK         0
  ------------------
  |  Branch (188:13): [True: 0, False: 18.1k]
  ------------------
  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|  18.1k|        if (secssizetot > mfp->mo_filesize ) {
  ------------------
  |  Branch (193:13): [True: 98, False: 18.0k]
  ------------------
  194|       |
  195|       |            /*  Really supposed to refer to size on disk, this
  196|       |                is therefore approximate test. */
  197|     98|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|     98|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  198|     98|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     98|#define DW_DLV_ERROR      1
  ------------------
  199|     98|        }
  200|  18.0k|        secs = (struct generic_macho_section *)calloc(
  201|  18.0k|            1,secssizetot);
  202|  18.0k|        if (!secs) {
  ------------------
  |  Branch (202:13): [True: 0, False: 18.0k]
  ------------------
  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|  18.0k|        memcpy(secs,mfp->mo_dwarf_sections,
  207|  18.0k|            mfp->mo_dwarf_sectioncount*
  208|  18.0k|            sizeof(struct generic_macho_section));
  209|  18.0k|        mfp->mo_dwarf_sections = secs;
  210|  18.0k|        seci =  mfp->mo_dwarf_sectioncount ;
  211|  18.0k|        mfp->mo_dwarf_sectioncount = newcount;
  212|  18.0k|        free(originalsections);
  213|  18.0k|        secs += seci;
  214|  18.0k|        secs->offset_of_sec_rec = curoff;
  215|  18.0k|        secalloc = newcount;
  216|  18.0k|    } else {
  217|    696|        Dwarf_Unsigned secssizetot = 0;
  218|       |
  219|    696|        newcount = secalloc;
  220|    696|        res = _dwarf_uint64_mult(newcount,
  221|    696|            sizeof(struct generic_macho_section),
  222|    696|            &secssizetot);
  223|    696|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    696|#define DW_DLV_OK         0
  ------------------
  |  Branch (223:13): [True: 0, False: 696]
  ------------------
  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|    696|        if (secssizetot > mfp->mo_filesize ) {
  ------------------
  |  Branch (228:13): [True: 79, False: 617]
  ------------------
  229|       |            /*  Really supposed to refer to size on disk, this
  230|       |                is therefore approximate test. */
  231|     79|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|     79|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  232|     79|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     79|#define DW_DLV_ERROR      1
  ------------------
  233|     79|        }
  234|    617|        secs = (struct generic_macho_section *)calloc(
  235|    617|            1,secssizetot);
  236|    617|        if (!secs) {
  ------------------
  |  Branch (236:13): [True: 0, False: 617]
  ------------------
  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|    617|        mfp->mo_dwarf_sections = secs;
  241|    617|        mfp->mo_dwarf_sectioncount = secalloc;
  242|    617|        secs->offset_of_sec_rec = curoff;
  243|       |        /*  Leave 0 section all zeros except our offset,
  244|       |            elf-like in a sense */
  245|    617|        secs->dwarfsectname = "";
  246|    617|        seci = 1;
  247|    617|        ++secs;
  248|    617|    }
  249|  50.5k|    for (; seci < secalloc; ++seci,++secs,curoff += shdrlen ) {
  ------------------
  |  Branch (249:12): [True: 31.9k, False: 18.5k]
  ------------------
  250|  31.9k|        struct section_64 mosec;
  251|  31.9k|        Dwarf_Unsigned endoffset = 0;
  252|  31.9k|        Dwarf_Unsigned inner = mfp->mo_inner_offset;
  253|  31.9k|        Dwarf_Unsigned offplussize = 0;
  254|  31.9k|        Dwarf_Unsigned innercur = 0;
  255|       |
  256|  31.9k|        endoffset = curoff + sizeof(mosec);
  257|  31.9k|        if (curoff >=  mfp->mo_filesize ||
  ------------------
  |  Branch (257:13): [True: 1, False: 31.9k]
  ------------------
  258|  31.9k|            endoffset > mfp->mo_filesize) {
  ------------------
  |  Branch (258:13): [True: 2, False: 31.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|  31.9k|        innercur = inner+curoff;
  263|  31.9k|        if (innercur < inner || innercur <curoff) {
  ------------------
  |  Branch (263:13): [True: 0, False: 31.9k]
  |  Branch (263:33): [True: 0, False: 31.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|  31.9k|        offplussize = inner+mfp->mo_filesize;
  269|  31.9k|        if (offplussize < inner || offplussize <mfp->mo_filesize) {
  ------------------
  |  Branch (269:13): [True: 0, False: 31.9k]
  |  Branch (269:36): [True: 0, False: 31.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|  31.9k|        res = RRMOA(mfp->mo_fd, &mosec,
  ------------------
  |  |   65|  31.9k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  31.9k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  274|  31.9k|            innercur, sizeof(mosec),
  275|  31.9k|            offplussize, errcode);
  276|  31.9k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  31.9k|#define DW_DLV_OK         0
  ------------------
  |  Branch (276:13): [True: 0, False: 31.9k]
  ------------------
  277|      0|            return res;
  278|      0|        }
  279|  31.9k|        _dwarf_safe_strcpy(secs->sectname,
  280|  31.9k|            sizeof(secs->sectname),
  281|  31.9k|            mosec.sectname,sizeof(mosec.sectname));
  282|  31.9k|        if (_dwarf_not_ascii(secs->sectname) ) {
  ------------------
  |  Branch (282:13): [True: 21, False: 31.9k]
  ------------------
  283|     21|            *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|     21|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  284|     21|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     21|#define DW_DLV_ERROR      1
  ------------------
  285|     21|        }
  286|  31.9k|        _dwarf_safe_strcpy(secs->segname,
  287|  31.9k|            sizeof(secs->segname),
  288|  31.9k|            mosec.segname,sizeof(mosec.segname));
  289|  31.9k|        ASNAR(mfp->mo_copy_word,secs->addr,mosec.addr);
  ------------------
  |  |   53|  31.9k|    do {                                        \
  |  |   54|  31.9k|        (t) = 0;                                \
  |  |   55|  31.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  31.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 31.9k]
  |  |  ------------------
  ------------------
  290|  31.9k|        ASNAR(mfp->mo_copy_word,secs->size,mosec.size);
  ------------------
  |  |   53|  31.9k|    do {                                        \
  |  |   54|  31.9k|        (t) = 0;                                \
  |  |   55|  31.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  31.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 31.9k]
  |  |  ------------------
  ------------------
  291|  31.9k|        ASNAR(mfp->mo_copy_word,secs->offset,mosec.offset);
  ------------------
  |  |   53|  31.9k|    do {                                        \
  |  |   54|  31.9k|        (t) = 0;                                \
  |  |   55|  31.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  31.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 31.9k]
  |  |  ------------------
  ------------------
  292|  31.9k|        ASNAR(mfp->mo_copy_word,secs->align,mosec.align);
  ------------------
  |  |   53|  31.9k|    do {                                        \
  |  |   54|  31.9k|        (t) = 0;                                \
  |  |   55|  31.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  31.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 31.9k]
  |  |  ------------------
  ------------------
  293|  31.9k|        ASNAR(mfp->mo_copy_word,secs->reloff,mosec.reloff);
  ------------------
  |  |   53|  31.9k|    do {                                        \
  |  |   54|  31.9k|        (t) = 0;                                \
  |  |   55|  31.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  31.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 31.9k]
  |  |  ------------------
  ------------------
  294|  31.9k|        ASNAR(mfp->mo_copy_word,secs->nreloc,mosec.nreloc);
  ------------------
  |  |   53|  31.9k|    do {                                        \
  |  |   54|  31.9k|        (t) = 0;                                \
  |  |   55|  31.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  31.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 31.9k]
  |  |  ------------------
  ------------------
  295|  31.9k|        ASNAR(mfp->mo_copy_word,secs->flags,mosec.flags);
  ------------------
  |  |   53|  31.9k|    do {                                        \
  |  |   54|  31.9k|        (t) = 0;                                \
  |  |   55|  31.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  31.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 31.9k]
  |  |  ------------------
  ------------------
  296|       |        /*offplussize = secs->offset+secs->size; */
  297|  31.9k|        res = _dwarf_uint64_add(secs->offset,secs->size,
  298|  31.9k|            &offplussize);
  299|  31.9k|        if (res == DW_DLV_ERROR){
  ------------------
  |  |   60|  31.9k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (299:13): [True: 9, False: 31.9k]
  ------------------
  300|       |            /* overflow in add */
  301|      9|            *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      9|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  302|      9|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      9|#define DW_DLV_ERROR      1
  ------------------
  303|      9|        }
  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|  31.9k|        if (0 == strcmp(secs->segname,"__DWARF")) {
  ------------------
  |  Branch (308:13): [True: 15.1k, False: 16.8k]
  ------------------
  309|  15.1k|            if (secs->offset > mfp->mo_filesize ||
  ------------------
  |  Branch (309:17): [True: 48, False: 15.0k]
  ------------------
  310|  15.0k|                secs->size > mfp->mo_filesize ||
  ------------------
  |  Branch (310:17): [True: 58, False: 15.0k]
  ------------------
  311|  15.0k|                offplussize > mfp->mo_filesize) {
  ------------------
  |  Branch (311:17): [True: 23, False: 14.9k]
  ------------------
  312|    129|                *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|    129|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  313|    129|                return DW_DLV_ERROR;
  ------------------
  |  |   60|    129|#define DW_DLV_ERROR      1
  ------------------
  314|    129|            }
  315|  15.1k|        }
  316|  31.7k|        secs->reserved1 = 0;
  317|  31.7k|        secs->reserved2 = 0;
  318|  31.7k|        secs->reserved3 = 0;
  319|  31.7k|        secs->offset_of_sec_rec = curoff;
  320|  31.7k|        secs->generic_segment_num  = segi;
  321|  31.7k|    }
  322|  18.5k|    return DW_DLV_OK;
  ------------------
  |  |   59|  18.5k|#define DW_DLV_OK         0
  ------------------
  323|  18.7k|}
_dwarf_fill_in_uni_arch_64:
  331|    266|{
  332|    266|    Dwarf_Unsigned i = 0;
  333|    266|    struct Dwarf_Universal_Arch_s * dua = 0;
  334|       |
  335|    266|    dua = duhd->au_arches;
  336|    593|    for ( ; i < duhd->au_count; ++i,++fa,++dua) {
  ------------------
  |  Branch (336:13): [True: 548, False: 45]
  ------------------
  337|    548|        ASNAR(word_swap,dua->au_cputype,fa->cputype);
  ------------------
  |  |   53|    548|    do {                                        \
  |  |   54|    548|        (t) = 0;                                \
  |  |   55|    548|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    548|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 548]
  |  |  ------------------
  ------------------
  338|    548|        ASNAR(word_swap,dua->au_cpusubtype,fa->cpusubtype);
  ------------------
  |  |   53|    548|    do {                                        \
  |  |   54|    548|        (t) = 0;                                \
  |  |   55|    548|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    548|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 548]
  |  |  ------------------
  ------------------
  339|    548|        ASNAR(word_swap,dua->au_offset,fa->offset);
  ------------------
  |  |   53|    548|    do {                                        \
  |  |   54|    548|        (t) = 0;                                \
  |  |   55|    548|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    548|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 548]
  |  |  ------------------
  ------------------
  340|    548|        if (dua->au_offset >= duhd->au_filesize) {
  ------------------
  |  Branch (340:13): [True: 88, False: 460]
  ------------------
  341|     88|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|     88|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
  342|     88|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     88|#define DW_DLV_ERROR      1
  ------------------
  343|     88|        }
  344|    460|        ASNAR(word_swap,dua->au_size,fa->size);
  ------------------
  |  |   53|    460|    do {                                        \
  |  |   54|    460|        (t) = 0;                                \
  |  |   55|    460|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    460|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 460]
  |  |  ------------------
  ------------------
  345|    460|        if (dua->au_size >= duhd->au_filesize) {
  ------------------
  |  Branch (345:13): [True: 83, False: 377]
  ------------------
  346|     83|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|     83|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
  347|     83|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     83|#define DW_DLV_ERROR      1
  ------------------
  348|     83|        }
  349|    377|        if ((dua->au_size+dua->au_offset) > duhd->au_filesize) {
  ------------------
  |  Branch (349:13): [True: 22, False: 355]
  ------------------
  350|     22|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|     22|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
  351|     22|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     22|#define DW_DLV_ERROR      1
  ------------------
  352|     22|        }
  353|    355|        ASNAR(word_swap,dua->au_align,fa->align);
  ------------------
  |  |   53|    355|    do {                                        \
  |  |   54|    355|        (t) = 0;                                \
  |  |   55|    355|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    355|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 355]
  |  |  ------------------
  ------------------
  354|    355|        if (dua->au_align >= 32) {
  ------------------
  |  Branch (354:13): [True: 28, False: 327]
  ------------------
  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|    327|        ASNAR(word_swap,dua->au_reserved,fa->reserved);
  ------------------
  |  |   53|    327|    do {                                        \
  |  |   54|    327|        (t) = 0;                                \
  |  |   55|    327|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    327|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 327]
  |  |  ------------------
  ------------------
  359|    327|    }
  360|     45|    return DW_DLV_OK;
  ------------------
  |  |   59|     45|#define DW_DLV_OK         0
  ------------------
  361|    266|}

_dwarf_free_static_errlist:
  296|  10.7k|{
  297|  10.7k|    unsigned i = 0;
  298|       |
  299|  10.7k|    for ( ; i <static_used; ++i) {
  ------------------
  |  Branch (299:13): [True: 0, False: 10.7k]
  ------------------
  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.7k|}
_dwarf_get_alloc:
  630|     62|{
  631|     62|    char * alloc_mem = 0;
  632|     62|    Dwarf_Unsigned basesize = 0;
  633|     62|    Dwarf_Unsigned size = 0;
  634|     62|    unsigned int type = alloc_type;
  635|     62|    short action = 0;
  636|       |
  637|     62|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|     62|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|     62|#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|     62|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 0, False: 62]
  |  |  |  Branch (159:7): [True: 0, False: 62]
  |  |  |  Branch (159:15): [True: 0, False: 62]
  |  |  ------------------
  ------------------
  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|     62|    if (type >= ALLOC_AREA_INDEX_TABLE_MAX) {
  ------------------
  |  |   48|     62|#define ALLOC_AREA_INDEX_TABLE_MAX 66
  ------------------
  |  Branch (647:9): [True: 0, False: 62]
  ------------------
  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|     62|    basesize = alloc_instance_basics[alloc_type].ia_struct_size;
  659|     62|    action = alloc_instance_basics[alloc_type].ia_multiply_count;
  660|     62|    if (action == MULTIPLY_NO) {
  ------------------
  |  |   91|     62|#define MULTIPLY_NO 0
  ------------------
  |  Branch (660:9): [True: 62, False: 0]
  ------------------
  661|       |        /* Usually count is 1, but do not assume it. */
  662|     62|        size = basesize;
  663|     62|    } 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|     62|    size += DW_RESERVE;
  ------------------
  |  |  176|     62|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
  673|     62|    alloc_mem = malloc(size);
  674|     62|    if (!alloc_mem) {
  ------------------
  |  Branch (674:9): [True: 0, False: 62]
  ------------------
  675|      0|        return NULL;
  676|      0|    }
  677|     62|    {
  678|     62|        char * ret_mem = alloc_mem + DW_RESERVE;
  ------------------
  |  |  176|     62|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
  679|     62|        void *key = ret_mem;
  680|     62|        struct reserve_data_s *r = (struct reserve_data_s*)alloc_mem;
  681|     62|        void *result = 0;
  682|       |
  683|     62|        memset(alloc_mem, 0, size);
  684|       |        /* We are not actually using rd_dbg, we are using rd_type. */
  685|     62|        r->rd_dbg = dbg;
  686|     62|        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|     62|        r->rd_length = (unsigned short)size;
  690|     62|        if (alloc_instance_basics[type].specialconstructor) {
  ------------------
  |  Branch (690:13): [True: 0, False: 62]
  ------------------
  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|     62|        if (global_de_alloc_tree_on) {
  ------------------
  |  Branch (715:13): [True: 62, False: 0]
  ------------------
  716|     62|            result = dwarf_tsearch((void *)key,
  ------------------
  |  |   76|     62|#define dwarf_tsearch  _dwarf_tsearch
  ------------------
  717|     62|                &dbg->de_alloc_tree,simple_compare_function);
  718|     62|            if (!result) {
  ------------------
  |  Branch (718:17): [True: 0, False: 62]
  ------------------
  719|       |                /*  Something badly wrong. Out of memory.
  720|       |                    pretend all is well. */
  721|      0|            }
  722|     62|        }
  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|     62|        return (ret_mem);
  731|     62|    }
  732|     62|}
dwarf_set_load_preference:
  780|  2.68k|{
  781|  2.68k|    enum Dwarf_Sec_Alloc_Pref prev_load_pref =
  782|  2.68k|        _dwarf_global_load_preference;
  783|  2.68k|#ifdef HAVE_FULL_MMAP
  784|       |    /*  Only set the preference if MMAP is available. */
  785|  2.68k|    switch(dw_load_preference) {
  786|      0|    case  Dwarf_Alloc_Malloc:
  ------------------
  |  Branch (786:5): [True: 0, False: 2.68k]
  ------------------
  787|      0|    case  Dwarf_Alloc_Mmap:
  ------------------
  |  Branch (787:5): [True: 0, False: 2.68k]
  ------------------
  788|      0|        _dwarf_global_load_preference = dw_load_preference;
  789|      0|        break;
  790|  2.68k|    case  Dwarf_Alloc_None:
  ------------------
  |  Branch (790:5): [True: 2.68k, False: 0]
  ------------------
  791|  2.68k|        break; /* ignore */
  792|      0|    default: break;
  ------------------
  |  Branch (792:5): [True: 0, False: 2.68k]
  ------------------
  793|  2.68k|    }
  794|       |#else
  795|       |    (void)dw_load_preference;
  796|       |#endif
  797|  2.68k|    return prev_load_pref;
  798|  2.68k|}
_dwarf_determine_section_allocation_type:
  852|  2.43k|{
  853|       |#ifndef HAVE_FULL_MMAP
  854|       |    return _dwarf_global_load_preference;
  855|       |#else
  856|  2.43k|    char *whichalloc = getenv("DWARF_WHICH_ALLOC");
  857|       |
  858|  2.43k|    if (whichalloc) {
  ------------------
  |  Branch (858:9): [True: 0, False: 2.43k]
  ------------------
  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.43k|    return _dwarf_global_load_preference;
  869|  2.43k|#endif /* HAVE_FULL_MMAP */
  870|  2.43k|}
dwarf_dealloc:
  955|     62|{
  956|     62|    unsigned int type = 0;
  957|     62|    char * malloc_addr = 0;
  958|     62|    struct reserve_data_s * r = 0;
  959|       |
  960|     62|    if (!space) {
  ------------------
  |  Branch (960:9): [True: 0, False: 62]
  ------------------
  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|     62|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|     62|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|     62|#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|     62|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 0, False: 62]
  |  |  |  Branch (159:7): [True: 0, False: 62]
  |  |  |  Branch (159:15): [True: 0, False: 62]
  |  |  ------------------
  ------------------
  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|     62|    if (space == (Dwarf_Ptr)&_dwarf_failsafe_error) {
  ------------------
  |  Branch (981:9): [True: 0, False: 62]
  ------------------
  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|     62|    if (dbg && alloc_type == DW_DLA_ERROR) {
  ------------------
  |  |  995|     62|#define DW_DLA_ERROR           0x0e  /* Dwarf_Error */
  ------------------
  |  Branch (991:9): [True: 62, False: 0]
  |  Branch (991:16): [True: 0, False: 62]
  ------------------
  992|      0|        dbg = dbg->de_errors_dbg;
  993|      0|    }
  994|     62|    if (dbg && dbg->de_alloc_tree) {
  ------------------
  |  Branch (994:9): [True: 62, False: 0]
  |  Branch (994:16): [True: 62, False: 0]
  ------------------
  995|       |        /*  If it's a string in debug_info etc doing
  996|       |            (char *)space - DW_RESERVE is totally bogus. */
  997|     62|        if (alloc_type == DW_DLA_STRING &&
  ------------------
  |  |  982|    124|#define DW_DLA_STRING          0x01  /* char* */
  ------------------
  |  Branch (997:13): [True: 0, False: 62]
  ------------------
  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|     62|    }
 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|     62|    if ((uintptr_t)space > DW_RESERVE) {
  ------------------
  |  |  176|     62|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
  |  Branch (1023:9): [True: 62, False: 0]
  ------------------
 1024|     62|        malloc_addr = (char *)space - DW_RESERVE;
  ------------------
  |  |  176|     62|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
 1025|     62|    } else {
 1026|       |        /* Impossible */
 1027|      0|        return;
 1028|      0|    }
 1029|     62|    r =(struct reserve_data_s *)malloc_addr;
 1030|     62|    if (dbg && dbg != r->rd_dbg) {
  ------------------
  |  Branch (1030:9): [True: 62, False: 0]
  |  Branch (1030:16): [True: 0, False: 62]
  ------------------
 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|     62|    if (dbg && alloc_type != r->rd_type) {
  ------------------
  |  Branch (1042:9): [True: 62, False: 0]
  |  Branch (1042:16): [True: 0, False: 62]
  ------------------
 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|     62|    if (alloc_type == DW_DLA_ERROR) {
  ------------------
  |  |  995|     62|#define DW_DLA_ERROR           0x0e  /* Dwarf_Error */
  ------------------
  |  Branch (1055:9): [True: 0, False: 62]
  ------------------
 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|     62|    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|     62|    if (type >= ALLOC_AREA_INDEX_TABLE_MAX) {
  ------------------
  |  |   48|     62|#define ALLOC_AREA_INDEX_TABLE_MAX 66
  ------------------
  |  Branch (1104:9): [True: 0, False: 62]
  ------------------
 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|     62|    if (alloc_instance_basics[type].specialdestructor) {
  ------------------
  |  Branch (1114:9): [True: 0, False: 62]
  ------------------
 1115|      0|        alloc_instance_basics[type].specialdestructor(space);
 1116|      0|    }
 1117|     62|    if (dbg && dbg->de_alloc_tree) {
  ------------------
  |  Branch (1117:9): [True: 62, False: 0]
  |  Branch (1117:16): [True: 62, 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|     62|        void *key = space;
 1123|       |
 1124|     62|        dwarf_tdelete(key,&dbg->de_alloc_tree,
  ------------------
  |  |   78|     62|#define dwarf_tdelete  _dwarf_tdelete
  ------------------
 1125|     62|            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|     62|    }
 1136|     62|    r->rd_dbg  = (void *)(uintptr_t)0xfeadbeef;
 1137|     62|    r->rd_length = 0;
 1138|     62|    r->rd_type = 0;
 1139|     62|    free(malloc_addr);
 1140|     62|    return;
 1141|     62|}
_dwarf_get_debug:
 1149|  3.38k|{
 1150|  3.38k|    Dwarf_Debug dbg;
 1151|       |
 1152|  3.38k|    dbg = (Dwarf_Debug) malloc(sizeof(struct Dwarf_Debug_s));
 1153|  3.38k|    if (!dbg) {
  ------------------
  |  Branch (1153:9): [True: 0, False: 3.38k]
  ------------------
 1154|      0|        return NULL;
 1155|      0|    }
 1156|  3.38k|    memset(dbg, 0, sizeof(struct Dwarf_Debug_s));
 1157|       |    /* Set up for a dwarf_tsearch hash table */
 1158|  3.38k|    dbg->de_magic = DBG_IS_VALID;
  ------------------
  |  |  596|  3.38k|#define DBG_IS_VALID 0xebfdebfd
  ------------------
 1159|       |
 1160|       |    /*  See also dwarf_tsearchhash.c the prime number
 1161|       |        table 'primes[]'. */
 1162|  3.38k|#define INIT_HASH_INIT_LIMIT 2000000
 1163|  3.38k|    if (global_de_alloc_tree_on) {
  ------------------
  |  Branch (1163:9): [True: 3.38k, False: 0]
  ------------------
 1164|       |        /*  The type of the dwarf_initialize_search_hash
 1165|       |            initial-size argument */
 1166|  3.38k|        unsigned long size_est = (unsigned long)(filesize/30);
 1167|       |
 1168|  3.38k|        if (size_est > INIT_HASH_INIT_LIMIT) {
  ------------------
  |  | 1162|  3.38k|#define INIT_HASH_INIT_LIMIT 2000000
  ------------------
  |  Branch (1168:13): [True: 0, False: 3.38k]
  ------------------
 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.38k|        dwarf_initialize_search_hash(&dbg->de_alloc_tree,
  ------------------
  |  |   82|  3.38k|#define dwarf_initialize_search_hash _dwarf_initialize_search_hash
  ------------------
 1176|  3.38k|            simple_value_hashfunc,size_est);
 1177|  3.38k|    }
 1178|  3.38k|    return dbg;
 1179|  3.38k|}
_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.72k|    case Dwarf_Alloc_Malloc:
  ------------------
  |  Branch (1193:5): [True: 1.72k, False: 100k]
  ------------------
 1194|  1.72k|        if (sec->dss_was_alloc) {
  ------------------
  |  Branch (1194:13): [True: 0, False: 1.72k]
  ------------------
 1195|      0|            free(sec->dss_data);
 1196|      0|        }
 1197|  1.72k|        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.72k]
  ------------------
 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.38k|{
 1262|  3.38k|    unsigned g = 0;
 1263|       |
 1264|  3.38k|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|  3.38k|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|  3.38k|#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.38k|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 0, False: 3.38k]
  |  |  |  Branch (159:7): [True: 0, False: 3.38k]
  |  |  |  Branch (159:15): [True: 0, False: 3.38k]
  |  |  ------------------
  ------------------
 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.38k|    if (dbg->de_cu_hashindex_data) {
  ------------------
  |  Branch (1273:9): [True: 11, False: 3.37k]
  ------------------
 1274|     11|        dwarf_dealloc_xu_header(dbg->de_cu_hashindex_data);
 1275|     11|        dbg->de_cu_hashindex_data = 0;
 1276|     11|    }
 1277|  3.38k|    if (dbg->de_tu_hashindex_data) {
  ------------------
  |  Branch (1277:9): [True: 13, False: 3.37k]
  ------------------
 1278|     13|        dwarf_dealloc_xu_header(dbg->de_tu_hashindex_data);
 1279|     13|        dbg->de_tu_hashindex_data = 0;
 1280|     13|    }
 1281|  3.38k|    if (dbg->de_printf_callback_null_device_handle) {
  ------------------
  |  Branch (1281:9): [True: 0, False: 3.38k]
  ------------------
 1282|      0|        fclose(dbg->de_printf_callback_null_device_handle);
 1283|      0|        dbg->de_printf_callback_null_device_handle = 0;
 1284|      0|    }
 1285|  3.38k|    freecontextlist(dbg,&dbg->de_info_reading);
 1286|  3.38k|    freecontextlist(dbg,&dbg->de_types_reading);
 1287|       |    /* Housecleaning done. Now really free all the space. */
 1288|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_info);
 1289|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_types);
 1290|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_abbrev);
 1291|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_line);
 1292|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_line_str);
 1293|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_loc);
 1294|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_aranges);
 1295|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_macinfo);
 1296|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_macro);
 1297|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_names);
 1298|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_pubnames);
 1299|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_str);
 1300|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_sup);
 1301|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_frame);
 1302|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_frame_eh_gnu);
 1303|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_pubtypes);
 1304|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_funcnames);
 1305|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_typenames);
 1306|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_varnames);
 1307|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_weaknames);
 1308|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_ranges);
 1309|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_str_offsets);
 1310|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_addr);
 1311|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_gdbindex);
 1312|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_cu_index);
 1313|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_tu_index);
 1314|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_loclists);
 1315|  3.38k|    _dwarf_malloc_section_free(&dbg->de_debug_rnglists);
 1316|  3.38k|    _dwarf_malloc_section_free(&dbg->de_gnu_debuglink);
 1317|  3.38k|    _dwarf_malloc_section_free(&dbg->de_note_gnu_buildid);
 1318|  3.38k|    _dwarf_harmless_cleanout(&dbg->de_harmless_errors);
 1319|       |
 1320|  3.38k|    _dwarf_dealloc_rnglists_context(dbg);
 1321|  3.38k|    _dwarf_dealloc_loclists_context(dbg);
 1322|  3.38k|    if (dbg->de_printf_callback.dp_buffer &&
  ------------------
  |  Branch (1322:9): [True: 0, False: 3.38k]
  ------------------
 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.38k|    _dwarf_destroy_group_map(dbg);
 1327|       |    /*  de_alloc_tree might be NULL if
 1328|       |        global_de_alloc_tree_on is zero. */
 1329|  3.38k|    if (dbg->de_alloc_tree) {
  ------------------
  |  Branch (1329:9): [True: 3.38k, False: 0]
  ------------------
 1330|  3.38k|        dbg->de_in_tdestroy = TRUE;
  ------------------
  |  |   33|  3.38k|#define TRUE 1
  ------------------
 1331|  3.38k|        dwarf_tdestroy(dbg->de_alloc_tree,tdestroy_free_node);
  ------------------
  |  |   80|  3.38k|#define dwarf_tdestroy _dwarf_tdestroy
  ------------------
 1332|  3.38k|        dbg->de_in_tdestroy = FALSE;
  ------------------
  |  |   36|  3.38k|#define FALSE 0
  ------------------
 1333|  3.38k|        dbg->de_alloc_tree = 0;
 1334|  3.38k|    }
 1335|  3.38k|    _dwarf_free_static_errlist();
 1336|       |    /*  first, walk the search and free()
 1337|       |        contents. */
 1338|       |    /*  Now  do the search tree itself */
 1339|  3.38k|    if (dbg->de_tied_data.td_tied_search) {
  ------------------
  |  Branch (1339:9): [True: 0, False: 3.38k]
  ------------------
 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.38k|    free((void *)dbg->de_path);
 1345|  3.38k|    dbg->de_path = 0;
 1346|  5.51k|    for (g = 0; g < dbg->de_gnu_global_path_count; ++g) {
  ------------------
  |  Branch (1346:17): [True: 2.13k, False: 3.38k]
  ------------------
 1347|  2.13k|        free((char *)dbg->de_gnu_global_paths[g]);
 1348|  2.13k|        dbg->de_gnu_global_paths[g] = 0;
 1349|  2.13k|    }
 1350|  3.38k|    free((void*)dbg->de_gnu_global_paths);
 1351|  3.38k|    dbg->de_gnu_global_paths = 0;
 1352|  3.38k|    dbg->de_gnu_global_path_count = 0;
 1353|  3.38k|    memset(dbg, 0, sizeof(*dbg)); /* Prevent accidental use later. */
 1354|  3.38k|    free(dbg);
 1355|  3.38k|    return DW_DLV_OK;
  ------------------
  |  |  122|  3.38k|#define DW_DLV_OK        0
  ------------------
 1356|  3.38k|}
dwarf_alloc.c:simple_compare_function:
  599|     62|{
  600|     62|    DW_TSHASHTYPE lp = (DW_TSHASHTYPE)(uintptr_t)l;
  ------------------
  |  |   54|     62|#define DW_TSHASHTYPE uintptr_t
  ------------------
  601|     62|    DW_TSHASHTYPE rp = (DW_TSHASHTYPE)(uintptr_t)r;
  ------------------
  |  |   54|     62|#define DW_TSHASHTYPE uintptr_t
  ------------------
  602|     62|    if (lp < rp) {
  ------------------
  |  Branch (602:9): [True: 0, False: 62]
  ------------------
  603|      0|        return -1;
  604|      0|    }
  605|     62|    if (lp > rp) {
  ------------------
  |  Branch (605:9): [True: 0, False: 62]
  ------------------
  606|      0|        return 1;
  607|      0|    }
  608|     62|    return 0;
  609|     62|}
dwarf_alloc.c:simple_value_hashfunc:
  549|    124|{
  550|    124|    DW_TSHASHTYPE up = (DW_TSHASHTYPE)(uintptr_t)keyp;
  ------------------
  |  |   54|    124|#define DW_TSHASHTYPE uintptr_t
  ------------------
  551|    124|    return up;
  552|    124|}
dwarf_alloc.c:freecontextlist:
 1227|  6.77k|{
 1228|  6.77k|    Dwarf_CU_Context context = 0;
 1229|  6.77k|    Dwarf_CU_Context nextcontext = 0;
 1230|  6.77k|    for (context = dis->de_cu_context_list;
 1231|  6.77k|        context; context = nextcontext) {
  ------------------
  |  Branch (1231:9): [True: 0, False: 6.77k]
  ------------------
 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.77k|    dis->de_cu_context_list = 0;
 1248|  6.77k|}

_dwarf_pathjoinl:
  236|    666|{
  237|    666|    char *inputs = dwarfstring_string(input);
  238|    666|    char *targ = dwarfstring_string(target);
  239|    666|    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|    666|    targlenszt = dwarfstring_strlen(target);
  257|    666|#endif /* _WIN32 */
  258|       |
  259|    666|    if (!targlenszt) {
  ------------------
  |  Branch (259:9): [True: 310, False: 356]
  ------------------
  260|    310|        dwarfstring_append(target,inputs);
  261|    310|        return DW_DLV_OK;
  ------------------
  |  |  122|    310|#define DW_DLV_OK        0
  ------------------
  262|    310|    }
  263|    356|    targ = dwarfstring_string(target);
  264|    356|    if (!is_full_path(targ+targlenszt-1)) {
  ------------------
  |  Branch (264:9): [True: 260, False: 96]
  ------------------
  265|    260|        if (!is_full_path(inputs)) {
  ------------------
  |  Branch (265:13): [True: 256, False: 4]
  ------------------
  266|    256|            dwarfstring_append(target,joinstr);
  267|    256|            dwarfstring_append(target,inputs);
  268|    256|        } else {
  269|      4|            dwarfstring_append(target,inputs);
  270|      4|        }
  271|    260|    } else {
  272|     96|        if (!is_full_path(inputs)) {
  ------------------
  |  Branch (272:13): [True: 88, False: 8]
  ------------------
  273|     88|            dwarfstring_append(target,inputs);
  274|     88|        } else {
  275|      8|            dwarfstring_append(target,inputs+1);
  276|      8|        }
  277|     96|    }
  278|       |#if defined (_WIN32)
  279|       |    dwarfstring_destructor(&winput);
  280|       |#endif /* _WIN32 */
  281|    356|    return DW_DLV_OK;
  ------------------
  |  |  122|    356|#define DW_DLV_OK        0
  ------------------
  282|    666|}
_dwarf_construct_linkedto_path:
  618|    107|{
  619|    107|    char * pathname = pathname_in;
  620|    107|    int               res = 0;
  621|    107|    struct joins_s    joind;
  622|    107|    size_t            dirnamelen = 0;
  623|    107|    struct dwarfstring_list_s  base_dwlist;
  624|    107|    struct dwarfstring_list_s *last_entry = 0;
  625|       |
  626|    107|    dwarfstring_list_constructor(&base_dwlist);
  627|    107|    construct_js(&joind);
  628|    107|    dirnamelen = mydirlen(pathname);
  629|    107|    if (dirnamelen) {
  ------------------
  |  Branch (629:9): [True: 0, False: 107]
  ------------------
  630|       |        /*  Original dirname, before cwd (if needed) */
  631|      0|        dwarfstring_append_length(&joind.js_tmp2,
  632|      0|            pathname,dirnamelen);
  633|      0|    }
  634|    107|    if (!is_full_path(pathname)) {
  ------------------
  |  Branch (634:9): [True: 107, False: 0]
  ------------------
  635|       |        /*  Meaning a/b or b, not /a/b or /b ,
  636|       |            so we apply cwd */
  637|    107|        char  buffer[2000];
  638|    107|        unsigned buflen= sizeof(buffer);
  639|    107|        char *wdret = 0;
  640|       |
  641|    107|        buffer[0] = 0;
  642|    107|        wdret = getcwd(buffer,buflen);
  643|    107|        if (!wdret) {
  ------------------
  |  Branch (643:13): [True: 0, False: 107]
  ------------------
  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|    107|        dwarfstring_append(&joind.js_cwd,buffer);
  652|    107|    }
  653|       |    /* Applies to the leading chars in the named file */
  654|    107|    if (dwarfstring_strlen(&joind.js_tmp2) > 0) {
  ------------------
  |  Branch (654:9): [True: 0, False: 107]
  ------------------
  655|      0|        transform_leading_windowsletter(&joind.js_dirname,
  656|      0|            dwarfstring_string(&joind.js_tmp2));
  657|      0|    }
  658|    107|    dwarfstring_reset(&joind.js_tmp2);
  659|       |
  660|       |    /* Creating a real basename. No slashes. */
  661|    107|    dwarfstring_append(&joind.js_basenamesimple,
  662|    107|        pathname+dirnamelen);
  663|    107|    dwarfstring_append(&joind.js_basesimpledebug,
  664|    107|        dwarfstring_string(&joind.js_basenamesimple));
  665|    107|    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|    107|    dwarfstring_append(&joind.js_originalfullpath,
  673|    107|        dwarfstring_string(&joind.js_dirname));
  674|    107|    _dwarf_pathjoinl(&joind.js_originalfullpath,
  675|    107|        &joind.js_basenamesimple);
  676|       |
  677|    107|    build_buildid_filename(&joind.js_buildid_filename,
  678|    107|        buildid_length, buildid);
  679|       |    /*  The GNU buildid method of finding debug files.
  680|       |        No crc calculation required ever. */
  681|    107|    res = _dwarf_do_buildid_setup(buildid_length,
  682|    107|        global_prefixes_in,
  683|    107|        length_global_prefixes_in,
  684|    107|        &last_entry,
  685|    107|        &joind,
  686|    107|        &base_dwlist,errcode);
  687|    107|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|    107|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (687:9): [True: 0, False: 107]
  ------------------
  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|    107|    res = _dwarf_do_debuglink_setup(link_string_in,
  697|    107|        link_string_fullpath_out,
  698|    107|        global_prefixes_in,
  699|    107|        length_global_prefixes_in,
  700|    107|        &last_entry,
  701|    107|        &joind,&base_dwlist,errcode);
  702|    107|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|    107|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (702:9): [True: 0, False: 107]
  ------------------
  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|    107|    {
  714|    107|        struct dwarfstring_list_s *cur = 0;
  715|    107|        char        **resultfullstring = 0;
  716|    107|        unsigned long count = 0;
  717|    107|        size_t        pointerarraysize = 0;
  718|    107|        size_t        sumstringlengths = 0;
  719|    107|        size_t        totalareasize = 0;
  720|    107|        size_t        setptrindex = 0;
  721|    107|        size_t        setstrindex = 0;
  722|       |
  723|    107|        cur = &base_dwlist;
  724|    416|        for ( ; cur ; cur = cur->dl_next) {
  ------------------
  |  Branch (724:17): [True: 309, False: 107]
  ------------------
  725|    309|            ++count;
  726|    309|            pointerarraysize += sizeof(void *);
  727|    309|            sumstringlengths +=
  728|    309|                dwarfstring_strlen(&cur->dl_string) +1;
  729|    309|        }
  730|       |        /*  Make a final null pointer in the pointer array. */
  731|    107|        pointerarraysize += sizeof(void *);
  732|    107|        totalareasize = pointerarraysize + sumstringlengths +8;
  733|    107|        resultfullstring = (char **)malloc(totalareasize);
  734|    107|        setstrindex = pointerarraysize;
  735|    107|        if (!resultfullstring) {
  ------------------
  |  Branch (735:13): [True: 0, False: 107]
  ------------------
  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|    107|        memset(resultfullstring,0,totalareasize);
  742|    107|        cur = &base_dwlist;
  743|       |
  744|    416|        for ( ; cur ; cur = cur->dl_next,++setptrindex) {
  ------------------
  |  Branch (744:17): [True: 309, False: 107]
  ------------------
  745|    309|            char **iptr = (char **)((char *)resultfullstring +
  746|    309|                setptrindex*sizeof(void *));
  747|    309|            char *sptr = (char*)resultfullstring + setstrindex;
  748|    309|            char *msg = dwarfstring_string(&cur->dl_string);
  749|    309|            size_t slen = dwarfstring_strlen(&cur->dl_string);
  750|       |
  751|    309|            _dwarf_safe_strcpy(sptr,totalareasize - setstrindex,
  752|    309|                msg,slen);
  753|    309|            setstrindex += slen +1;
  754|    309|            *iptr = sptr;
  755|    309|        }
  756|    107|        *paths_out = resultfullstring;
  757|    107|        *paths_out_length = count;
  758|    107|    }
  759|      0|    dwarfstring_list_destructor(&base_dwlist);
  760|    107|    destruct_js(&joind);
  761|    107|    return DW_DLV_OK;
  ------------------
  |  |  122|    107|#define DW_DLV_OK        0
  ------------------
  762|    107|}
dwarf_gnu_debuglink:
  964|  8.41k|{
  965|  8.41k|    dwarfstring debuglink_fullpath;
  966|  8.41k|    int res = DW_DLV_ERROR;
  ------------------
  |  |  123|  8.41k|#define DW_DLV_ERROR     1
  ------------------
  967|  8.41k|    char * pathname = 0;
  968|  8.41k|    int errcode = 0;
  969|  8.41k|    struct Dwarf_Section_s * pdebuglink = 0;
  970|  8.41k|    struct Dwarf_Section_s * pbuildid = 0;
  971|       |
  972|  8.41k|    CHECK_DBG(dbg,error,"dwarf_gnu_debuglink()");
  ------------------
  |  |  190|  8.41k|    do {                                                      \
  |  |  191|  8.41k|        if (!(cd_dbg) || (cd_dbg)->de_magic != DBG_IS_VALID) {    \
  |  |  ------------------
  |  |  |  |  596|  1.06k|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |  |  Branch (191:13): [True: 7.34k, False: 1.06k]
  |  |  |  Branch (191:26): [True: 0, False: 1.06k]
  |  |  ------------------
  |  |  192|  7.34k|            _dwarf_error_string(NULL, (cd_er), DW_DLE_DBG_NULL, \
  |  |  ------------------
  |  |  |  | 1126|  7.34k|#define DW_DLE_DBG_NULL                         81
  |  |  ------------------
  |  |  193|  7.34k|                "DW_DLE_DBG_NULL: "                           \
  |  |  194|  7.34k|                "dbg argument to " cd_funcname                \
  |  |  195|  7.34k|                "either null or it contains"                  \
  |  |  196|  7.34k|                "a stale Dwarf_Debug pointer");               \
  |  |  197|  7.34k|            return DW_DLV_ERROR;                              \
  |  |  ------------------
  |  |  |  |  123|  7.34k|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  198|  7.34k|        }                                                     \
  |  |  199|  8.41k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (199:14): [Folded, False: 1.06k]
  |  |  ------------------
  ------------------
  973|  1.06k|    if (dbg->de_gnu_debuglink.dss_size) {
  ------------------
  |  Branch (973:9): [True: 318, False: 747]
  ------------------
  974|    318|        pdebuglink = &dbg->de_gnu_debuglink;
  975|    318|        res = _dwarf_load_section(dbg, pdebuglink,error);
  976|    318|        if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|    318|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (976:13): [True: 246, False: 72]
  ------------------
  977|    246|            return res;
  978|    246|        }
  979|    318|    }
  980|    819|    if (dbg->de_note_gnu_buildid.dss_size) {
  ------------------
  |  Branch (980:9): [True: 540, False: 279]
  ------------------
  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: 308, False: 232]
  ------------------
  984|    308|            return res;
  985|    308|        }
  986|    540|    }
  987|    511|    if (!pdebuglink && !pbuildid) {
  ------------------
  |  Branch (987:9): [True: 440, False: 71]
  |  Branch (987:24): [True: 215, False: 225]
  ------------------
  988|    215|        if (dbg->de_path) {
  ------------------
  |  Branch (988:13): [True: 0, False: 215]
  ------------------
  989|      0|            *debuglink_fullpath_returned = strdup(dbg->de_path);
  990|      0|            *debuglink_fullpath_length_returned =
  991|      0|            (unsigned)strlen(dbg->de_path);
  992|    215|        } else {
  993|    215|            *debuglink_fullpath_returned = 0;
  994|    215|            *debuglink_fullpath_length_returned = 0;
  995|    215|        }
  996|    215|        return DW_DLV_OK;
  ------------------
  |  |  122|    215|#define DW_DLV_OK        0
  ------------------
  997|    215|    }
  998|       |
  999|    296|    if (pbuildid) {
  ------------------
  |  Branch (999:9): [True: 232, False: 64]
  ------------------
 1000|       |        /* buildid does not involve calculating a crc at any point */
 1001|    232|        int buildidres = 0;
 1002|    232|        buildidres = _dwarf_extract_buildid(dbg,
 1003|    232|            pbuildid,
 1004|    232|            buildid_type_returned,
 1005|    232|            buildid_owner_name_returned,
 1006|    232|            buildid_returned,
 1007|    232|            buildid_length_returned,
 1008|    232|            error);
 1009|    232|        if (buildidres == DW_DLV_ERROR) {
  ------------------
  |  |  123|    232|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (1009:13): [True: 169, False: 63]
  ------------------
 1010|    169|            return buildidres;
 1011|    169|        }
 1012|    232|    }
 1013|    127|    if (pdebuglink) {
  ------------------
  |  Branch (1013:9): [True: 69, False: 58]
  ------------------
 1014|     69|        int linkres = 0;
 1015|       |
 1016|     69|        linkres = _dwarf_extract_debuglink(dbg,
 1017|     69|            pdebuglink,
 1018|     69|            debuglink_path_returned,
 1019|     69|            crc_returned,
 1020|     69|            error);
 1021|     69|        if (linkres == DW_DLV_ERROR) {
  ------------------
  |  |  123|     69|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (1021:13): [True: 20, False: 49]
  ------------------
 1022|     20|            return linkres;
 1023|     20|        }
 1024|     69|    }
 1025|    107|    dwarfstring_constructor(&debuglink_fullpath);
 1026|    107|    pathname = dbg->de_path?(char *)dbg->de_path:
  ------------------
  |  Branch (1026:16): [True: 0, False: 107]
  ------------------
 1027|    107|        "";
 1028|    107|    if (pathname && paths_returned) {
  ------------------
  |  Branch (1028:9): [True: 107, False: 0]
  |  Branch (1028:21): [True: 107, False: 0]
  ------------------
 1029|       |        /*  Caller wants paths created and returned. */
 1030|    107|        res =  _dwarf_construct_linkedto_path(
 1031|    107|            (char **)dbg->de_gnu_global_paths,
 1032|    107|            dbg->de_gnu_global_path_count,
 1033|    107|            pathname,
 1034|    107|            *debuglink_path_returned,
 1035|    107|            &debuglink_fullpath,
 1036|    107|            *buildid_returned,
 1037|    107|            *buildid_length_returned,
 1038|    107|            paths_returned,
 1039|    107|            paths_count_returned,
 1040|    107|            &errcode);
 1041|    107|        if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|    107|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (1041:13): [True: 0, False: 107]
  ------------------
 1042|      0|            dwarfstring_destructor(&debuglink_fullpath);
 1043|      0|            return res;
 1044|      0|        }
 1045|    107|        if (dwarfstring_strlen(&debuglink_fullpath)) {
  ------------------
  |  Branch (1045:13): [True: 45, False: 62]
  ------------------
 1046|     45|            *debuglink_fullpath_returned =
 1047|     45|                strdup(dwarfstring_string(&debuglink_fullpath));
 1048|     45|            *debuglink_fullpath_length_returned =
 1049|     45|                (unsigned)dwarfstring_strlen(&debuglink_fullpath);
 1050|     45|        }
 1051|    107|    } 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|    107|    dwarfstring_destructor(&debuglink_fullpath);
 1057|    107|    return DW_DLV_OK;
  ------------------
  |  |  122|    107|#define DW_DLV_OK        0
  ------------------
 1058|    107|}
dwarf_add_debuglink_global_path:
 1069|  9.47k|{
 1070|  9.47k|    unsigned    glpath_count_in = 0;
 1071|  9.47k|    unsigned    glpath_count_out = 0;
 1072|  9.47k|    char      **glpaths = 0;
 1073|  9.47k|    char       *path1 = 0;
 1074|       |
 1075|  9.47k|    CHECK_DBG(dbg,error,"dwarf_add_debuglink_global_path()");
  ------------------
  |  |  190|  9.47k|    do {                                                      \
  |  |  191|  9.47k|        if (!(cd_dbg) || (cd_dbg)->de_magic != DBG_IS_VALID) {    \
  |  |  ------------------
  |  |  |  |  596|  2.13k|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |  |  Branch (191:13): [True: 7.34k, False: 2.13k]
  |  |  |  Branch (191:26): [True: 0, False: 2.13k]
  |  |  ------------------
  |  |  192|  7.34k|            _dwarf_error_string(NULL, (cd_er), DW_DLE_DBG_NULL, \
  |  |  ------------------
  |  |  |  | 1126|  7.34k|#define DW_DLE_DBG_NULL                         81
  |  |  ------------------
  |  |  193|  7.34k|                "DW_DLE_DBG_NULL: "                           \
  |  |  194|  7.34k|                "dbg argument to " cd_funcname                \
  |  |  195|  7.34k|                "either null or it contains"                  \
  |  |  196|  7.34k|                "a stale Dwarf_Debug pointer");               \
  |  |  197|  7.34k|            return DW_DLV_ERROR;                              \
  |  |  ------------------
  |  |  |  |  123|  7.34k|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  198|  7.34k|        }                                                     \
  |  |  199|  9.47k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (199:14): [Folded, False: 2.13k]
  |  |  ------------------
  ------------------
 1076|  2.13k|    glpath_count_in = dbg->de_gnu_global_path_count;
 1077|  2.13k|    glpath_count_out = glpath_count_in+1;
 1078|  2.13k|    glpaths = (char **)malloc(sizeof(char *)*
 1079|  2.13k|        glpath_count_out);
 1080|  2.13k|    if (!glpaths) {
  ------------------
  |  Branch (1080:9): [True: 0, False: 2.13k]
  ------------------
 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.13k|    if (glpath_count_in) {
  ------------------
  |  Branch (1084:9): [True: 1.06k, False: 1.06k]
  ------------------
 1085|  1.06k|        memcpy(glpaths, dbg->de_gnu_global_paths,
 1086|  1.06k|            sizeof(char *)*glpath_count_in);
 1087|  1.06k|    }
 1088|  2.13k|    path1 = strdup(pathname);
 1089|  2.13k|    if (!path1) {
  ------------------
  |  Branch (1089:9): [True: 0, False: 2.13k]
  ------------------
 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.13k|    free(dbg->de_gnu_global_paths);
 1095|  2.13k|    glpaths[glpath_count_in] = path1;
 1096|  2.13k|    dbg->de_gnu_global_paths = (const char **)glpaths;
 1097|  2.13k|    dbg->de_gnu_global_path_count = glpath_count_out;
 1098|  2.13k|    return DW_DLV_OK;
  ------------------
  |  |  122|  2.13k|#define DW_DLV_OK        0
  ------------------
 1099|  2.13k|}
dwarf_debuglink.c:is_full_path:
   78|    819|{
   79|    819|    unsigned char c = path[0];
   80|    819|    unsigned char c1 = 0;
   81|    819|    int okdriveletter = FALSE;
  ------------------
  |  |   36|    819|#define FALSE 0
  ------------------
   82|       |
   83|    819|    if (!c) {
  ------------------
  |  Branch (83:9): [True: 212, False: 607]
  ------------------
   84|       |        /* empty string. */
   85|    212|        return FALSE;
  ------------------
  |  |   36|    212|#define FALSE 0
  ------------------
   86|    212|    }
   87|    607|    if (c == joinchar) {
  ------------------
  |  Branch (87:9): [True: 102, False: 505]
  ------------------
   88|    102|        return TRUE;
  ------------------
  |  |   33|    102|#define TRUE 1
  ------------------
   89|    102|    }
   90|    505|    if (c >= 'c' && c <= 'z') {
  ------------------
  |  Branch (90:9): [True: 320, False: 185]
  |  Branch (90:21): [True: 275, False: 45]
  ------------------
   91|    275|        okdriveletter = TRUE;
  ------------------
  |  |   33|    275|#define TRUE 1
  ------------------
   92|    275|    } else  if (c >= 'C' && c <= 'Z') {
  ------------------
  |  Branch (92:17): [True: 84, False: 146]
  |  Branch (92:29): [True: 30, False: 54]
  ------------------
   93|     30|        okdriveletter = TRUE;
  ------------------
  |  |   33|     30|#define TRUE 1
  ------------------
   94|     30|    }
   95|    505|    if (!okdriveletter) {
  ------------------
  |  Branch (95:9): [True: 200, False: 305]
  ------------------
   96|    200|        return FALSE;
  ------------------
  |  |   36|    200|#define FALSE 0
  ------------------
   97|    200|    }
   98|       |
   99|    305|    c1 = path[1];
  100|    305|    if (!c1) {
  ------------------
  |  Branch (100:9): [True: 263, False: 42]
  ------------------
  101|       |        /* No second character */
  102|    263|        return FALSE;
  ------------------
  |  |   36|    263|#define FALSE 0
  ------------------
  103|    263|    }
  104|     42|    if (c1 == ':') {
  ------------------
  |  Branch (104:9): [True: 6, False: 36]
  ------------------
  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|      6|        return TRUE;
  ------------------
  |  |   33|      6|#define TRUE 1
  ------------------
  109|      6|    }
  110|       |    /*  No kind of full path name */
  111|     36|    return FALSE;
  ------------------
  |  |   36|     36|#define FALSE 0
  ------------------
  112|     42|}
dwarf_debuglink.c:dwarfstring_list_constructor:
  321|    309|{
  322|    309|    dwarfstring_constructor(&l->dl_string);
  323|    309|    l->dl_next = 0;
  324|    309|}
dwarf_debuglink.c:construct_js:
  139|    107|{
  140|    107|    memset(js,0,sizeof(struct joins_s));
  141|    107|    dwarfstring_constructor(&js->js_dirname);
  142|    107|    dwarfstring_constructor(&js->js_basenamesimple);
  143|    107|    dwarfstring_constructor(&js->js_basesimpledebug);
  144|    107|    dwarfstring_constructor(&js->js_cwd);
  145|    107|    dwarfstring_constructor(&js->js_originalfullpath);
  146|    107|    dwarfstring_constructor(&js->js_linkstring);
  147|    107|    dwarfstring_constructor(&js->js_tmp2);
  148|    107|    dwarfstring_constructor(&js->js_tmp3);
  149|    107|    dwarfstring_constructor(&js->js_buildid);
  150|    107|    dwarfstring_constructor(&js->js_buildid_filename);
  151|    107|}
dwarf_debuglink.c:mydirlen:
  287|    107|{
  288|    107|    char *cp = 0;
  289|    107|    char *lastjoinchar = 0;
  290|    107|    size_t count =0;
  291|       |
  292|    107|    for (cp = s ; *cp ; ++cp,++count)  {
  ------------------
  |  Branch (292:19): [True: 0, False: 107]
  ------------------
  293|      0|        if (*cp == joinchar) {
  ------------------
  |  Branch (293:13): [True: 0, False: 0]
  ------------------
  294|      0|            lastjoinchar = cp;
  295|      0|        }
  296|      0|    }
  297|    107|    if (lastjoinchar) {
  ------------------
  |  Branch (297:9): [True: 0, False: 107]
  ------------------
  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|    107|    return 0;
  312|    107|}
dwarf_debuglink.c:dwarfstring_list_destructor:
  359|    107|{
  360|    107|    struct dwarfstring_list_s *curl = l;
  361|    107|    struct dwarfstring_list_s *nextl = l;
  362|       |
  363|    107|    nextl = curl->dl_next;
  364|    107|    dwarfstring_destructor(&curl->dl_string);
  365|    107|    curl->dl_next = 0;
  366|    107|    curl = nextl;
  367|    309|    for ( ; curl ; curl = nextl) {
  ------------------
  |  Branch (367:13): [True: 202, False: 107]
  ------------------
  368|    202|        nextl = curl->dl_next;
  369|    202|        dwarfstring_destructor(&curl->dl_string);
  370|    202|        curl->dl_next = 0;
  371|    202|        free(curl);
  372|    202|    }
  373|    107|}
dwarf_debuglink.c:destruct_js:
  154|    107|{
  155|    107|    dwarfstring_destructor(&js->js_dirname);
  156|    107|    dwarfstring_destructor(&js->js_basenamesimple);
  157|    107|    dwarfstring_destructor(&js->js_basesimpledebug);
  158|    107|    dwarfstring_destructor(&js->js_cwd);
  159|    107|    dwarfstring_destructor(&js->js_originalfullpath);
  160|    107|    dwarfstring_destructor(&js->js_linkstring);
  161|    107|    dwarfstring_destructor(&js->js_tmp2);
  162|    107|    dwarfstring_destructor(&js->js_tmp3);
  163|    107|    dwarfstring_destructor(&js->js_buildid);
  164|    107|    dwarfstring_destructor(&js->js_buildid_filename);
  165|    107|}
dwarf_debuglink.c:build_buildid_filename:
  392|    107|{
  393|    107|    dwarfstring tmp;
  394|    107|    unsigned bu = 0;
  395|    107|    unsigned char *cp  = 0;
  396|       |
  397|    107|    dwarfstring_constructor(&tmp);
  398|    107|    dwarfstring_append(&tmp,".build-id");
  399|    107|    dwarfstring_append(&tmp,joinstr);
  400|    107|    cp = buildid;
  401|  47.7k|    for (bu = 0; bu < buildid_length; ++bu ,++cp) {
  ------------------
  |  Branch (401:18): [True: 47.6k, False: 107]
  ------------------
  402|  47.6k|        dwarfstring_append_printf_u(&tmp, "%02x",*cp);
  403|  47.6k|        if (bu == 0) {
  ------------------
  |  Branch (403:13): [True: 58, False: 47.5k]
  ------------------
  404|     58|            dwarfstring_append(&tmp,"/");
  405|     58|        }
  406|  47.6k|    }
  407|    107|    _dwarf_pathjoinl(target,&tmp);
  408|    107|    dwarfstring_append(target,".debug");
  409|    107|    dwarfstring_destructor(&tmp);
  410|    107|    return;
  411|    107|}
dwarf_debuglink.c:_dwarf_do_buildid_setup:
  542|    107|{
  543|    107|    unsigned                   global_prefix_number = 0;
  544|    107|    int res = 0;
  545|       |
  546|    107|    if (!buildid_length) {
  ------------------
  |  Branch (546:9): [True: 49, False: 58]
  ------------------
  547|     49|        return DW_DLV_OK;
  ------------------
  |  |  122|     49|#define DW_DLV_OK        0
  ------------------
  548|     49|    }
  549|     58|    for (global_prefix_number = 0;
  550|    174|        buildid_length &&
  ------------------
  |  Branch (550:9): [True: 174, False: 0]
  ------------------
  551|    174|        (global_prefix_number < length_global_prefixes_in);
  ------------------
  |  Branch (551:9): [True: 116, False: 58]
  ------------------
  552|    116|        ++global_prefix_number) {
  553|    116|        char * prefix = 0;
  554|    116|        struct dwarfstring_list_s *now_last = 0;
  555|       |
  556|    116|        prefix = global_prefixes_in[global_prefix_number];
  557|    116|        dwarfstring_reset(&joind->js_buildid);
  558|    116|        dwarfstring_append(&joind->js_buildid,prefix);
  559|    116|        _dwarf_pathjoinl(&joind->js_buildid,
  560|    116|            &joind->js_buildid_filename);
  561|    116|        res = dwarfstring_list_add_new(
  562|    116|            base_dwlist,
  563|    116|            *last_entry,&joind->js_buildid,
  564|    116|            &now_last,errcode);
  565|    116|        if (res != DW_DLV_OK) {
  ------------------
  |  |  122|    116|#define DW_DLV_OK        0
  ------------------
  |  Branch (565:13): [True: 0, False: 116]
  ------------------
  566|      0|            return res;
  567|      0|        }
  568|    116|        *last_entry = now_last;
  569|    116|    }
  570|     58|    return DW_DLV_OK;
  ------------------
  |  |  122|     58|#define DW_DLV_OK        0
  ------------------
  571|     58|}
dwarf_debuglink.c:dwarfstring_list_add_new:
  332|    305|{
  333|    305|    struct dwarfstring_list_s *next = 0;
  334|       |
  335|    305|    if (prev) {
  ------------------
  |  Branch (335:9): [True: 202, False: 103]
  ------------------
  336|    202|        next = ( struct dwarfstring_list_s *)
  337|    202|        malloc(sizeof(struct dwarfstring_list_s));
  338|    202|        if (!next) {
  ------------------
  |  Branch (338:13): [True: 0, False: 202]
  ------------------
  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|    202|        dwarfstring_list_constructor(next);
  343|    202|    } else {
  344|    103|        next = base_entry;
  345|    103|    }
  346|    305|    dwarfstring_append(&next->dl_string,
  347|    305|        dwarfstring_string(input));
  348|    305|    if (prev) {
  ------------------
  |  Branch (348:9): [True: 202, False: 103]
  ------------------
  349|    202|        prev->dl_next = next;
  350|    202|    }
  351|    305|    *new_out = next;
  352|    305|    return DW_DLV_OK;
  ------------------
  |  |  122|    305|#define DW_DLV_OK        0
  ------------------
  353|    305|}
dwarf_debuglink.c:_dwarf_do_debuglink_setup:
  453|    107|{
  454|    107|    int res = 0;
  455|       |
  456|    107|    if (!link_string_in) {
  ------------------
  |  Branch (456:9): [True: 59, False: 48]
  ------------------
  457|     59|        return DW_DLV_OK;
  ------------------
  |  |  122|     59|#define DW_DLV_OK        0
  ------------------
  458|     59|    }
  459|     48|    {
  460|       |        /* First try dir of executable */
  461|     48|        struct dwarfstring_list_s *now_last = 0;
  462|     48|        unsigned  global_prefix_number = 0;
  463|       |
  464|     48|        dwarfstring_append(&joind->js_linkstring,
  465|     48|            link_string_in);
  466|     48|        dwarfstring_reset(&joind->js_tmp3);
  467|     48|        dwarfstring_reset(&joind->js_tmp2);
  468|     48|        prepare_linked_name(&joind->js_tmp3,
  469|     48|            &joind->js_dirname,
  470|     48|            0,&joind->js_linkstring);
  471|     48|        dwarfstring_append(
  472|     48|            link_string_fullpath_out,
  473|     48|            dwarfstring_string(&joind->js_tmp3));
  474|     48|        if (!duplicatedpath(&joind->js_originalfullpath,
  ------------------
  |  Branch (474:13): [True: 45, False: 3]
  ------------------
  475|     48|            &joind->js_tmp3)) {
  476|     45|            res = dwarfstring_list_add_new(
  477|     45|                base_dwlist,
  478|     45|                *last_entry,&joind->js_tmp3,
  479|     45|                &now_last,errcode);
  480|     45|            if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     45|#define DW_DLV_OK        0
  ------------------
  |  Branch (480:17): [True: 0, False: 45]
  ------------------
  481|      0|                return res;
  482|      0|            }
  483|     45|            *last_entry = now_last;
  484|     45|        }
  485|     48|        dwarfstring_reset(&joind->js_tmp2);
  486|     48|        dwarfstring_reset(&joind->js_tmp3);
  487|     48|        dwarfstring_append(&joind->js_tmp3,".debug");
  488|     48|        prepare_linked_name(&joind->js_tmp2,
  489|     48|            &joind->js_dirname,
  490|     48|            &joind->js_tmp3,&joind->js_linkstring);
  491|     48|        if (! duplicatedpath(&joind->js_originalfullpath,
  ------------------
  |  Branch (491:13): [True: 48, False: 0]
  ------------------
  492|     48|            &joind->js_tmp2)) {
  493|     48|            res = dwarfstring_list_add_new(
  494|     48|                base_dwlist,
  495|     48|                *last_entry,&joind->js_tmp2,
  496|     48|                &now_last,errcode);
  497|     48|            if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     48|#define DW_DLV_OK        0
  ------------------
  |  Branch (497:17): [True: 0, False: 48]
  ------------------
  498|      0|                return res;
  499|      0|            }
  500|     48|            *last_entry = now_last;
  501|     48|        } else {
  502|      0|        }
  503|       |        /*  Now look in the global locations. */
  504|     48|        for (global_prefix_number = 0;
  505|    144|            global_prefix_number < length_global_prefixes_in;
  ------------------
  |  Branch (505:13): [True: 96, False: 48]
  ------------------
  506|     96|            ++global_prefix_number) {
  507|     96|            char * prefix =
  508|     96|                global_prefixes_in[global_prefix_number];
  509|       |
  510|     96|            dwarfstring_reset(&joind->js_tmp2);
  511|     96|            dwarfstring_reset(&joind->js_tmp3);
  512|     96|            dwarfstring_append(&joind->js_tmp2, prefix);
  513|     96|            prepare_linked_name(&joind->js_tmp3,
  514|     96|                &joind->js_tmp2,
  515|     96|                &joind->js_dirname,
  516|     96|                &joind->js_linkstring);
  517|     96|            if (!duplicatedpath(&joind->js_originalfullpath,
  ------------------
  |  Branch (517:17): [True: 96, False: 0]
  ------------------
  518|     96|                &joind->js_tmp3)) {
  519|     96|                res = dwarfstring_list_add_new(
  520|     96|                    base_dwlist,
  521|     96|                    *last_entry,&joind->js_tmp3,
  522|     96|                    &now_last,errcode);
  523|     96|                if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     96|#define DW_DLV_OK        0
  ------------------
  |  Branch (523:21): [True: 0, False: 96]
  ------------------
  524|      0|                    return res;
  525|      0|                }
  526|     96|                *last_entry = now_last;
  527|     96|            } else {
  528|      0|            }
  529|     96|        }
  530|     48|    }
  531|     48|    return DW_DLV_OK;
  ------------------
  |  |  122|     48|#define DW_DLV_OK        0
  ------------------
  532|     48|}
dwarf_debuglink.c:prepare_linked_name:
  380|    192|{
  381|    192|    dwarfstring_append(out, dwarfstring_string(dirname));
  382|    192|    if (extradir) {
  ------------------
  |  Branch (382:9): [True: 144, False: 48]
  ------------------
  383|    144|        _dwarf_pathjoinl(out,extradir);
  384|    144|    }
  385|    192|    _dwarf_pathjoinl(out,linkname);
  386|    192|}
dwarf_debuglink.c:duplicatedpath:
  435|    192|{
  436|    192|    if (strcmp(dwarfstring_string(l),
  ------------------
  |  Branch (436:9): [True: 189, False: 3]
  ------------------
  437|    192|        dwarfstring_string(r))) {
  438|    189|        return FALSE;
  ------------------
  |  |   36|    189|#define FALSE 0
  ------------------
  439|    189|    }
  440|       |    /*  Oops. somebody made a mistake */
  441|      3|    return TRUE;
  ------------------
  |  |   33|      3|#define TRUE 1
  ------------------
  442|    192|}
dwarf_debuglink.c:_dwarf_extract_buildid:
  825|    232|{
  826|    232|    Dwarf_Small * ptr = 0;
  827|    232|    Dwarf_Small * endptr = 0;
  828|    232|    int res = DW_DLV_ERROR;
  ------------------
  |  |  123|    232|#define DW_DLV_ERROR     1
  ------------------
  829|    232|    struct buildid_s *bu = 0;
  830|    232|    Dwarf_Unsigned namesize = 0;
  831|    232|    Dwarf_Unsigned descrsize = 0;
  832|    232|    Dwarf_Unsigned type = 0;
  833|    232|    Dwarf_Unsigned finalsize;
  834|    232|    Dwarf_Unsigned secsize = 0;
  835|       |
  836|    232|    if (!pbuildid->dss_data) {
  ------------------
  |  Branch (836:9): [True: 1, False: 231]
  ------------------
  837|      1|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      1|#define DW_DLV_NO_ENTRY -1
  ------------------
  838|      1|    }
  839|    231|    secsize = pbuildid->dss_size;
  840|    231|    ptr = pbuildid->dss_data;
  841|    231|    if (secsize < sizeof(struct buildid_s)) {
  ------------------
  |  Branch (841:9): [True: 4, False: 227]
  ------------------
  842|      4|        _dwarf_error(dbg,error,DW_DLE_CORRUPT_NOTE_GNU_DEBUGID);
  ------------------
  |  | 1503|      4|#define DW_DLE_CORRUPT_NOTE_GNU_DEBUGID        457
  ------------------
  843|      4|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      4|#define DW_DLV_ERROR     1
  ------------------
  844|      4|    }
  845|    227|    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|    227|    bu = (struct buildid_s *)ptr;
  850|    227|    ASNAR(dbg->de_copy_word,namesize, bu->bu_ownernamesize);
  ------------------
  |  |   53|    227|    do {                                        \
  |  |   54|    227|        (t) = 0;                                \
  |  |   55|    227|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    227|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 227]
  |  |  ------------------
  ------------------
  851|    227|    ASNAR(dbg->de_copy_word,descrsize,bu->bu_buildidsize);
  ------------------
  |  |   53|    227|    do {                                        \
  |  |   54|    227|        (t) = 0;                                \
  |  |   55|    227|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    227|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 227]
  |  |  ------------------
  ------------------
  852|    227|    if (descrsize >= secsize) {
  ------------------
  |  Branch (852:9): [True: 77, False: 150]
  ------------------
  853|     77|        _dwarf_error_string(dbg,error,
  854|     77|            DW_DLE_BUILD_ID_DESCRIPTION_SIZE,
  ------------------
  |  | 1541|     77|#define DW_DLE_BUILD_ID_DESCRIPTION_SIZE       495
  ------------------
  855|     77|            "DW_DLE_BUILD_ID_DESCRIPTION_SIZE Size is much too "
  856|     77|            "large to be correct. Corrupt Dwarf");
  857|     77|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     77|#define DW_DLV_ERROR     1
  ------------------
  858|     77|    }
  859|    150|    if ((descrsize+8) >= secsize) {
  ------------------
  |  Branch (859:9): [True: 4, False: 146]
  ------------------
  860|      4|        _dwarf_error_string(dbg,error,
  861|      4|            DW_DLE_BUILD_ID_DESCRIPTION_SIZE,
  ------------------
  |  | 1541|      4|#define DW_DLE_BUILD_ID_DESCRIPTION_SIZE       495
  ------------------
  862|      4|            "DW_DLE_BUILD_ID_DESCRIPTION_SIZE Size is too "
  863|      4|            "large to be correct. Corrupt Dwarf");
  864|      4|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      4|#define DW_DLV_ERROR     1
  ------------------
  865|      4|    }
  866|    146|    if (descrsize >= DW_BUILDID_SANE_SIZE) {
  ------------------
  |  |   38|    146|#define  DW_BUILDID_SANE_SIZE (8*1024)
  ------------------
  |  Branch (866:9): [True: 11, False: 135]
  ------------------
  867|     11|        _dwarf_error_string(dbg,error,
  868|     11|            DW_DLE_BUILD_ID_DESCRIPTION_SIZE,
  ------------------
  |  | 1541|     11|#define DW_DLE_BUILD_ID_DESCRIPTION_SIZE       495
  ------------------
  869|     11|            "DW_DLE_BUILD_ID_DESCRIPTION_SIZE Size is too "
  870|     11|            "large to be sane. Corrupt Dwarf");
  871|     11|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     11|#define DW_DLV_ERROR     1
  ------------------
  872|     11|    }
  873|       |
  874|    135|    ASNAR(dbg->de_copy_word,type,     bu->bu_type);
  ------------------
  |  |   53|    135|    do {                                        \
  |  |   54|    135|        (t) = 0;                                \
  |  |   55|    135|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    135|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 135]
  |  |  ------------------
  ------------------
  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|    135|    res = _dwarf_check_string_valid(dbg,
  880|    135|        (Dwarf_Small *)&bu->bu_owner[0],
  881|    135|        (Dwarf_Small *)&bu->bu_owner[0],
  882|    135|        endptr,
  883|    135|        DW_DLE_CORRUPT_GNU_DEBUGID_STRING,
  ------------------
  |  | 1505|    135|#define DW_DLE_CORRUPT_GNU_DEBUGID_STRING      459
  ------------------
  884|    135|        error);
  885|    135|    if ( res != DW_DLV_OK) {
  ------------------
  |  |  122|    135|#define DW_DLV_OK        0
  ------------------
  |  Branch (885:10): [True: 1, False: 134]
  ------------------
  886|      1|        return res;
  887|      1|    }
  888|    134|    if ((strlen(bu->bu_owner) +1) != namesize) {
  ------------------
  |  Branch (888:9): [True: 66, False: 68]
  ------------------
  889|     66|        _dwarf_error(dbg,error, DW_DLE_CORRUPT_GNU_DEBUGID_STRING);
  ------------------
  |  | 1505|     66|#define DW_DLE_CORRUPT_GNU_DEBUGID_STRING      459
  ------------------
  890|     66|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     66|#define DW_DLV_ERROR     1
  ------------------
  891|     66|    }
  892|       |
  893|     68|    finalsize = sizeof(struct buildid_s)-1 + namesize + descrsize;
  894|     68|    if (finalsize > secsize) {
  ------------------
  |  Branch (894:9): [True: 6, False: 62]
  ------------------
  895|      6|        _dwarf_error(dbg,error, DW_DLE_CORRUPT_GNU_DEBUGID_SIZE);
  ------------------
  |  | 1504|      6|#define DW_DLE_CORRUPT_GNU_DEBUGID_SIZE        458
  ------------------
  896|      6|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      6|#define DW_DLV_ERROR     1
  ------------------
  897|      6|    }
  898|     62|    *type_returned = (unsigned)type;
  899|     62|    *owner_name_returned = &bu->bu_owner[0];
  900|     62|    if (descrsize >= secsize) { /* In case value insanely large */
  ------------------
  |  Branch (900:9): [True: 0, False: 62]
  ------------------
  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|     62|    if ((descrsize+8) >= secsize) { /* In case a bit too large */
  ------------------
  |  Branch (914:9): [True: 0, False: 62]
  ------------------
  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|     62|    *build_id_length_returned = (unsigned)descrsize;
  929|     62|    *build_id_returned = (unsigned char *)ptr +
  930|     62|        sizeof(struct buildid_s)-1 + namesize;
  931|     62|    return DW_DLV_OK;
  ------------------
  |  |  122|     62|#define DW_DLV_OK        0
  ------------------
  932|     62|}
dwarf_debuglink.c:_dwarf_extract_debuglink:
  770|     69|{
  771|     69|    Dwarf_Small *ptr = 0;
  772|     69|    Dwarf_Small *endptr = 0;
  773|     69|    size_t   namelenszt = 0;
  774|     69|    unsigned m = 0;
  775|     69|    unsigned incr = 0;
  776|     69|    Dwarf_Small *crcptr = 0;
  777|     69|    int res = DW_DLV_ERROR;
  ------------------
  |  |  123|     69|#define DW_DLV_ERROR     1
  ------------------
  778|     69|    Dwarf_Unsigned secsize = 0;
  779|       |
  780|     69|    if (!pdebuglink->dss_data) {
  ------------------
  |  Branch (780:9): [True: 1, False: 68]
  ------------------
  781|      1|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      1|#define DW_DLV_NO_ENTRY -1
  ------------------
  782|      1|    }
  783|     68|    secsize = pdebuglink->dss_size;
  784|     68|    ptr = pdebuglink->dss_data;
  785|     68|    endptr = ptr + secsize;
  786|       |
  787|     68|    res = _dwarf_check_string_valid(dbg,ptr,
  788|     68|        ptr, endptr,  DW_DLE_FORM_STRING_BAD_STRING,
  ------------------
  |  | 1407|     68|#define DW_DLE_FORM_STRING_BAD_STRING          361
  ------------------
  789|     68|        error);
  790|     68|    if ( res != DW_DLV_OK) {
  ------------------
  |  |  122|     68|#define DW_DLV_OK        0
  ------------------
  |  Branch (790:10): [True: 5, False: 63]
  ------------------
  791|      5|        return res;
  792|      5|    }
  793|     63|    namelenszt = strlen((const char*)ptr);
  794|     63|    m = (namelenszt+1) %4;
  795|     63|    if (m) {
  ------------------
  |  Branch (795:9): [True: 34, False: 29]
  ------------------
  796|     34|        incr = 4 - m;
  797|     34|    }
  798|     63|    crcptr = (unsigned char *)ptr +namelenszt +1 +incr;
  799|     63|    if ((crcptr +4) != (unsigned char*)endptr) {
  ------------------
  |  Branch (799:9): [True: 15, False: 48]
  ------------------
  800|     15|        _dwarf_error(dbg,error,DW_DLE_CORRUPT_GNU_DEBUGLINK);
  ------------------
  |  | 1502|     15|#define DW_DLE_CORRUPT_GNU_DEBUGLINK           456
  ------------------
  801|     15|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     15|#define DW_DLV_ERROR     1
  ------------------
  802|     15|    }
  803|     48|    *name_returned = (char *)ptr;
  804|     48|    *crc_returned = crcptr;
  805|     48|    return DW_DLV_OK;
  ------------------
  |  |  122|     48|#define DW_DLV_OK        0
  ------------------
  806|     63|}

_dwarf_load_elf_symtab_symbols:
 1008|  2.79k|{
 1009|  2.79k|    int res = 0;
 1010|  2.79k|    struct generic_symentry *gsym = 0;
 1011|  2.79k|    Dwarf_Unsigned count = 0;
 1012|  2.79k|    Dwarf_Unsigned secnum = ep->f_symtab_sect_index;
 1013|  2.79k|    struct generic_shdr * psh = 0;
 1014|       |
 1015|  2.79k|    if (!secnum) {
  ------------------
  |  Branch (1015:9): [True: 2.72k, False: 67]
  ------------------
 1016|  2.72k|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|  2.72k|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1017|  2.72k|    }
 1018|     67|    psh = ep->f_shdr + secnum;
 1019|     67|    if (psh->gh_size > ep->f_filesize) {
  ------------------
  |  Branch (1019:9): [True: 0, False: 67]
  ------------------
 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|     67|    res = _dwarf_generic_elf_load_symbols(ep,
 1024|     67|        secnum,
 1025|     67|        psh,
 1026|     67|        &gsym,
 1027|     67|        &count,errcode);
 1028|     67|    if (res == DW_DLV_OK) {
  ------------------
  |  |   59|     67|#define DW_DLV_OK         0
  ------------------
  |  Branch (1028:9): [True: 50, False: 17]
  ------------------
 1029|     50|        ep->f_symtab = gsym;
 1030|     50|        ep->f_loc_symtab.g_count = count;
 1031|     50|    }
 1032|     67|    return res;
 1033|     67|}
_dwarf_load_elf_symstr:
 1214|  2.91k|{
 1215|  2.91k|    struct generic_shdr *strpsh = 0;
 1216|  2.91k|    int res = 0;
 1217|  2.91k|    Dwarf_Unsigned strsectindex  =0;
 1218|  2.91k|    Dwarf_Unsigned strsectlength = 0;
 1219|  2.91k|    Dwarf_Unsigned flags = 0;
 1220|       |
 1221|  2.91k|    if (!ep->f_symtab_sect_strings_sect_index) {
  ------------------
  |  Branch (1221:9): [True: 2.67k, False: 247]
  ------------------
 1222|  2.67k|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|  2.67k|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1223|  2.67k|    }
 1224|    247|    strsectindex = ep->f_symtab_sect_strings_sect_index;
 1225|    247|    strsectlength = ep->f_symtab_sect_strings_max;
 1226|    247|    strpsh = ep->f_shdr + strsectindex;
 1227|    247|    if (strsectindex == ep->f_elf_shstrings_index) {
  ------------------
  |  Branch (1227:9): [True: 64, False: 183]
  ------------------
 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|    183|    if (strpsh->gh_sht_group_array ||
  ------------------
  |  Branch (1240:9): [True: 1, False: 182]
  ------------------
 1241|    182|        strpsh->gh_sht_group_array_count ||
  ------------------
  |  Branch (1241:9): [True: 0, False: 182]
  ------------------
 1242|    182|        strpsh->gh_content) {
  ------------------
  |  Branch (1242:9): [True: 0, False: 182]
  ------------------
 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|    182|    if (strsectlength > ep->f_filesize ||
  ------------------
  |  Branch (1249:9): [True: 0, False: 182]
  ------------------
 1250|    182|        strpsh->gh_offset >ep->f_filesize ||
  ------------------
  |  Branch (1250:9): [True: 95, False: 87]
  ------------------
 1251|     87|        (strsectlength + strpsh->gh_offset) >
  ------------------
  |  Branch (1251:9): [True: 26, False: 61]
  ------------------
 1252|    121|            ep->f_filesize) {
 1253|    121|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|    121|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1254|    121|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    121|#define DW_DLV_ERROR      1
  ------------------
 1255|    121|    }
 1256|     61|    if (ep->f_symtab_sect_strings_sect_index ==
  ------------------
  |  Branch (1256:9): [True: 0, False: 61]
  ------------------
 1257|     61|        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|     61|    ep->f_symtab_sect_strings = calloc(1,strsectlength+1);
 1263|     61|    flags = strpsh->gh_flags;
 1264|     61|    if (!ep->f_symtab_sect_strings) {
  ------------------
  |  Branch (1264:9): [True: 0, False: 61]
  ------------------
 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|     61|    strpsh->gh_load_type = Dwarf_Alloc_Malloc;
 1272|     61|    res = RRMOA(ep->f_fd,ep->f_symtab_sect_strings,
  ------------------
  |  |   65|     61|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     61|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1273|     61|        strpsh->gh_offset,
 1274|     61|        strsectlength,
 1275|     61|        ep->f_filesize,errcode);
 1276|     61|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     61|#define DW_DLV_OK         0
  ------------------
  |  Branch (1276:9): [True: 1, False: 60]
  ------------------
 1277|      1|        free(ep->f_symtab_sect_strings);
 1278|      1|        ep->f_symtab_sect_strings = 0;
 1279|      1|        return res;
 1280|      1|    }
 1281|     60|    strpsh->gh_content = ep->f_symtab_sect_strings;
 1282|     60|    strpsh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|     60|#define TRUE 1
  ------------------
 1283|     60|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|     60|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (1283:9): [True: 2, False: 58]
  ------------------
 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|      2|        ep->f_symtab_sect_strings = 0;
 1297|      2|        *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      2|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
 1298|      2|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
 1299|      2|#endif /* COMPRESSED TEST */
 1300|      2|    }
 1301|     58|    return DW_DLV_OK;
  ------------------
  |  |   59|     58|#define DW_DLV_OK         0
  ------------------
 1302|     60|}
_dwarf_load_elf_relx:
 1796|  39.9k|{
 1797|  39.9k|    struct generic_shdr *gshdr = 0;
 1798|  39.9k|    Dwarf_Unsigned seccount = 0;
 1799|  39.9k|    unsigned offsetsize = 0;
 1800|  39.9k|    struct generic_rela *grp = 0;
 1801|  39.9k|    Dwarf_Unsigned count_read = 0;
 1802|  39.9k|    int res = 0;
 1803|  39.9k|    unsigned oksec = 0;
 1804|  39.9k|    enum RelocOffsetSize localoffsize = RelocOffset32;
 1805|       |
 1806|       |    /*  ASSERT: Caller guarantees localr is
 1807|       |        a valid RelocRela  */
 1808|  39.9k|    if (!ep) {
  ------------------
  |  Branch (1808:9): [True: 0, False: 39.9k]
  ------------------
 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|  39.9k|    offsetsize = ep->f_offsetsize;
 1813|  39.9k|    seccount = ep->f_loc_shdr.g_count;
 1814|  39.9k|    if (secnum >= seccount) {
  ------------------
  |  Branch (1814:9): [True: 0, False: 39.9k]
  ------------------
 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|  39.9k|    gshdr = ep->f_shdr +secnum;
 1819|  39.9k|    if (is_empty_section(gshdr->gh_type)) {
  ------------------
  |  Branch (1819:9): [True: 34.5k, False: 5.40k]
  ------------------
 1820|       |
 1821|  34.5k|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|  34.5k|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1822|  34.5k|    }
 1823|       |
 1824|  5.40k|    res = this_rel_is_a_section_dwarf_related(ep,gshdr,
 1825|  5.40k|        &oksec,errcode);
 1826|  5.40k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  5.40k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1826:9): [True: 63, False: 5.34k]
  ------------------
 1827|     63|        return res;
 1828|     63|    }
 1829|  5.34k|    if (!oksec) {
  ------------------
  |  Branch (1829:9): [True: 3.28k, False: 2.05k]
  ------------------
 1830|  3.28k|        return DW_DLV_OK;
  ------------------
  |  |   59|  3.28k|#define DW_DLV_OK         0
  ------------------
 1831|  3.28k|    }
 1832|       |    /*  We will actually read these relocations. */
 1833|  2.05k|    if (offsetsize == 64) {
  ------------------
  |  Branch (1833:9): [True: 746, False: 1.30k]
  ------------------
 1834|    746|        localoffsize = RelocOffset64;
 1835|  1.30k|    } else if (offsetsize == 32) {
  ------------------
  |  Branch (1835:16): [True: 1.30k, False: 0]
  ------------------
 1836|  1.30k|        localoffsize = RelocOffset32;
 1837|  1.30k|    } 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|  2.05k|    res = _dwarf_elf_load_a_relx_batch(ep,
 1844|  2.05k|        gshdr,&grp,&count_read,localr,localoffsize,errcode);
 1845|  2.05k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  2.05k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1845:9): [True: 190, False: 1.86k]
  ------------------
 1846|    190|        return res;
 1847|    190|    }
 1848|  1.86k|    if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |   58|  1.86k|#define DW_DLV_NO_ENTRY  -1
  ------------------
  |  Branch (1848:9): [True: 421, False: 1.44k]
  ------------------
 1849|    421|        return res;
 1850|    421|    }
 1851|  1.44k|    gshdr->gh_rels = grp;
 1852|  1.44k|    gshdr->gh_relcount = count_read;
 1853|  1.44k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.44k|#define DW_DLV_OK         0
  ------------------
 1854|  1.86k|}
_dwarf_load_elf_header:
 1993|  4.58k|{
 1994|  4.58k|    unsigned offsetsize = ep->f_offsetsize;
 1995|  4.58k|    int res = 0;
 1996|       |
 1997|  4.58k|    if (offsetsize == 32) {
  ------------------
  |  Branch (1997:9): [True: 3.05k, False: 1.52k]
  ------------------
 1998|  3.05k|        res = elf_load_elf_header32(ep,errcode);
 1999|  3.05k|    } 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.58k|    return res;
 2010|  4.58k|}
_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.02k, False: 1.48k]
  ------------------
 2388|  3.02k|        res  = elf_load_sectheaders32(ep,ep->f_ehdr->ge_shoff,
 2389|  3.02k|            ep->f_ehdr->ge_shentsize,
 2390|  3.02k|            ep->f_ehdr->ge_shnum,errcode);
 2391|  3.02k|    } else  if (ep->f_offsetsize == 64) {
  ------------------
  |  Branch (2391:17): [True: 1.48k, False: 0]
  ------------------
 2392|  1.48k|        res  = elf_load_sectheaders64(ep,ep->f_ehdr->ge_shoff,
 2393|  1.48k|            ep->f_ehdr->ge_shentsize,
 2394|  1.48k|            ep->f_ehdr->ge_shnum,errcode);
 2395|  1.48k|    } 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.05k, False: 3.45k]
  ------------------
 2400|  1.05k|        return res;
 2401|  1.05k|    }
 2402|  3.45k|    res  = _dwarf_elf_load_sectstrings(ep,
 2403|  3.45k|        ep->f_ehdr->ge_shstrndx,errcode);
 2404|  3.45k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  3.45k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2404:9): [True: 163, False: 3.28k]
  ------------------
 2405|    163|        return res;
 2406|    163|    }
 2407|  3.28k|    res  = _dwarf_elf_load_sect_namestrings(ep,errcode);
 2408|  3.28k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  3.28k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2408:9): [True: 53, False: 3.23k]
  ------------------
 2409|     53|        return res;
 2410|     53|    }
 2411|  3.23k|    res  = _dwarf_elf_find_sym_sections(ep,errcode);
 2412|  3.23k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  3.23k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2412:9): [True: 39, False: 3.19k]
  ------------------
 2413|     39|        return res;
 2414|     39|    }
 2415|  3.19k|    res = _dwarf_elf_setup_all_section_groups(ep,errcode);
 2416|  3.19k|    return res;
 2417|  3.23k|}
dwarf_elf_load_headers.c:_dwarf_generic_elf_load_symbols:
  970|     67|{
  971|     67|    int res = 0;
  972|     67|    struct generic_symentry *gsym = 0;
  973|     67|    Dwarf_Unsigned count = 0;
  974|       |
  975|     67|    if (!secnum) {
  ------------------
  |  Branch (975:9): [True: 0, False: 67]
  ------------------
  976|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  977|      0|    }
  978|     67|    if (psh->gh_size > ep->f_filesize) {
  ------------------
  |  Branch (978:9): [True: 0, False: 67]
  ------------------
  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|     67|    if (ep->f_offsetsize == 32) {
  ------------------
  |  Branch (982:9): [True: 45, False: 22]
  ------------------
  983|     45|        res = _dwarf_generic_elf_load_symbols32(ep,
  984|     45|            &gsym,psh,
  985|     45|            &count,errcode);
  986|     45|    } else if (ep->f_offsetsize == 64) {
  ------------------
  |  Branch (986:16): [True: 22, False: 0]
  ------------------
  987|     22|        res = _dwarf_generic_elf_load_symbols64(ep,
  988|     22|            &gsym,psh,
  989|     22|            &count,errcode);
  990|     22|    } 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|     67|    if (res == DW_DLV_OK) {
  ------------------
  |  |   59|     67|#define DW_DLV_OK         0
  ------------------
  |  Branch (994:9): [True: 50, False: 17]
  ------------------
  995|     50|        *gsym_out = gsym;
  996|     50|        *count_out = count;
  997|     50|    } else {
  998|     17|        free(psh->gh_content);
  999|     17|        psh->gh_content = 0;
 1000|     17|        psh->gh_was_alloc = FALSE;
  ------------------
  |  |   36|     17|#define FALSE 0
  ------------------
 1001|     17|    }
 1002|     67|    return res;
 1003|     67|}
dwarf_elf_load_headers.c:_dwarf_generic_elf_load_symbols32:
  748|     45|{
  749|     45|    Dwarf_Unsigned  ecount = 0;
  750|     45|    Dwarf_Unsigned  size2 = 0;
  751|     45|    Dwarf_Unsigned  offset =0;
  752|     45|    Dwarf_Unsigned  size =0;
  753|     45|    Dwarf_Unsigned  i = 0;
  754|     45|    dw_elf32_sym   *psym = 0;
  755|     45|    struct generic_symentry * gsym = 0;
  756|     45|    struct generic_symentry * orig_gsym = 0;
  757|     45|    Dwarf_Unsigned flags = 0;
  758|     45|    Dwarf_Small   *content = 0;
  759|     45|    int            res = 0;
  760|       |
  761|     45|    flags = psh->gh_flags;
  762|     45|    size = psh->gh_size;
  763|     45|    offset = psh->gh_offset;
  764|     45|    if (psh->gh_content) {
  ------------------
  |  Branch (764:9): [True: 3, False: 42]
  ------------------
  765|      3|        *errcode = DW_DLE_ELF_SECTION_ERROR;
  ------------------
  |  | 1492|      3|#define DW_DLE_ELF_SECTION_ERROR               446
  ------------------
  766|      3|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
  767|      3|    }
  768|     42|    if (psh->gh_sht_group_array ||
  ------------------
  |  Branch (768:9): [True: 0, False: 42]
  ------------------
  769|     42|        psh->gh_sht_group_array_count ||
  ------------------
  |  Branch (769:9): [True: 0, False: 42]
  ------------------
  770|     42|        psh->gh_content) {
  ------------------
  |  Branch (770:9): [True: 0, False: 42]
  ------------------
  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|     42|    content = calloc(1,size);
  775|     42|    if (!content) {
  ------------------
  |  Branch (775:9): [True: 0, False: 42]
  ------------------
  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|     42|    res = RRMOA(ep->f_fd,content,offset,size,
  ------------------
  |  |   65|     42|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     42|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  780|     42|        ep->f_filesize,errcode);
  781|     42|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     42|#define DW_DLV_OK         0
  ------------------
  |  Branch (781:9): [True: 2, False: 40]
  ------------------
  782|      2|        free(content);
  783|      2|        return res;
  784|      2|    }
  785|     40|    psh->gh_content = (char *)content;
  786|     40|    psh->gh_load_type = Dwarf_Alloc_Malloc;
  787|     40|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|     40|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (787:9): [True: 1, False: 39]
  ------------------
  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|     39|    size = psh->gh_size;
  805|     39|    ecount = (long)(size/sizeof(dw_elf32_sym));
  806|     39|    size2 = ecount * sizeof(dw_elf32_sym);
  807|     39|    if (size != size2) {
  ------------------
  |  Branch (807:9): [True: 4, False: 35]
  ------------------
  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|     35|    if (size >= ep->f_filesize ) {
  ------------------
  |  Branch (813:9): [True: 0, False: 35]
  ------------------
  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|     35|    psym = (dw_elf32_sym *)psh->gh_content;
  820|     35|    gsym = calloc(ecount,sizeof(struct generic_symentry));
  821|     35|    if (!gsym) {
  ------------------
  |  Branch (821:9): [True: 0, False: 35]
  ------------------
  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|     35|    orig_gsym = gsym;
  828|  49.0k|    for ( i = 0; i < ecount; ++i,++psym,++gsym) {
  ------------------
  |  Branch (828:18): [True: 49.0k, False: 35]
  ------------------
  829|  49.0k|        Dwarf_Unsigned bind = 0;
  830|  49.0k|        Dwarf_Unsigned type = 0;
  831|       |
  832|  49.0k|        ASNAR(ep->f_copy_word,gsym->gs_name,psym->st_name);
  ------------------
  |  |   53|  49.0k|    do {                                        \
  |  |   54|  49.0k|        (t) = 0;                                \
  |  |   55|  49.0k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  49.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 49.0k]
  |  |  ------------------
  ------------------
  833|  49.0k|        ASNAR(ep->f_copy_word,gsym->gs_value,psym->st_value);
  ------------------
  |  |   53|  49.0k|    do {                                        \
  |  |   54|  49.0k|        (t) = 0;                                \
  |  |   55|  49.0k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  49.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 49.0k]
  |  |  ------------------
  ------------------
  834|  49.0k|        ASNAR(ep->f_copy_word,gsym->gs_size,psym->st_size);
  ------------------
  |  |   53|  49.0k|    do {                                        \
  |  |   54|  49.0k|        (t) = 0;                                \
  |  |   55|  49.0k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  49.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 49.0k]
  |  |  ------------------
  ------------------
  835|  49.0k|        ASNAR(ep->f_copy_word,gsym->gs_info,psym->st_info);
  ------------------
  |  |   53|  49.0k|    do {                                        \
  |  |   54|  49.0k|        (t) = 0;                                \
  |  |   55|  49.0k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  49.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 49.0k]
  |  |  ------------------
  ------------------
  836|  49.0k|        ASNAR(ep->f_copy_word,gsym->gs_other,psym->st_other);
  ------------------
  |  |   53|  49.0k|    do {                                        \
  |  |   54|  49.0k|        (t) = 0;                                \
  |  |   55|  49.0k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  49.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 49.0k]
  |  |  ------------------
  ------------------
  837|  49.0k|        ASNAR(ep->f_copy_word,gsym->gs_shndx,psym->st_shndx);
  ------------------
  |  |   53|  49.0k|    do {                                        \
  |  |   54|  49.0k|        (t) = 0;                                \
  |  |   55|  49.0k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  49.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 49.0k]
  |  |  ------------------
  ------------------
  838|  49.0k|        bind = gsym->gs_info >> 4;
  839|  49.0k|        type = gsym->gs_info & 0xf;
  840|  49.0k|        gsym->gs_bind = bind;
  841|  49.0k|        gsym->gs_type = type;
  842|  49.0k|    }
  843|     35|    psh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|     35|#define TRUE 1
  ------------------
  844|     35|    psh->gh_load_type = Dwarf_Alloc_Malloc;
  845|     35|    *count_out = ecount;
  846|     35|    *gsym_out = orig_gsym;
  847|     35|    return DW_DLV_OK;
  ------------------
  |  |   59|     35|#define DW_DLV_OK         0
  ------------------
  848|     35|}
dwarf_elf_load_headers.c:_dwarf_generic_elf_load_symbols64:
  856|     22|{
  857|     22|    Dwarf_Unsigned ecount = 0;
  858|     22|    Dwarf_Unsigned size = 0;
  859|     22|    Dwarf_Unsigned offset = 0;
  860|     22|    Dwarf_Unsigned size2 = 0;
  861|     22|    Dwarf_Unsigned i = 0;
  862|     22|    dw_elf64_sym  *psym = 0;
  863|     22|    struct generic_symentry * gsym = 0;
  864|     22|    struct generic_symentry * orig_gsym = 0;
  865|     22|    int            res = 0;
  866|     22|    Dwarf_Unsigned flags = 0;
  867|     22|    char *         content = 0;
  868|       |
  869|     22|    flags = psh->gh_flags;
  870|     22|    size = psh->gh_size;
  871|     22|    offset = psh->gh_offset;
  872|     22|    if (psh->gh_sht_group_array ||
  ------------------
  |  Branch (872:9): [True: 0, False: 22]
  ------------------
  873|     22|        psh->gh_sht_group_array_count ||
  ------------------
  |  Branch (873:9): [True: 0, False: 22]
  ------------------
  874|     22|        psh->gh_content) {
  ------------------
  |  Branch (874:9): [True: 0, False: 22]
  ------------------
  875|      0|        *errcode = DW_DLE_ELF_GRPSTRING_SECTION_ERROR;
  ------------------
  |  | 1563|      0|#define DW_DLE_ELF_GRPSTRING_SECTION_ERROR     517
  ------------------
  876|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  877|      0|    }
  878|     22|    content = calloc(1,size);
  879|     22|    if (!content) {
  ------------------
  |  Branch (879:9): [True: 0, False: 22]
  ------------------
  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|     22|    res = RRMOA(ep->f_fd,content,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));
  ------------------
  884|     22|        ep->f_filesize,errcode);
  885|     22|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     22|#define DW_DLV_OK         0
  ------------------
  |  Branch (885:9): [True: 1, False: 21]
  ------------------
  886|      1|        free(content);
  887|      1|        return res;
  888|      1|    }
  889|     21|    psh->gh_content = content;
  890|     21|    psh->gh_load_type = Dwarf_Alloc_Malloc;
  891|     21|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|     21|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (891:9): [True: 1, False: 20]
  ------------------
  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|     20|    size = psh->gh_size;
  910|     20|    ecount = (long)(size/sizeof(dw_elf64_sym));
  911|     20|    size2 = ecount * sizeof(dw_elf64_sym);
  912|     20|    if (size != size2) {
  ------------------
  |  Branch (912:9): [True: 5, False: 15]
  ------------------
  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|     15|    if (size >= ep->f_filesize ) {
  ------------------
  |  Branch (918:9): [True: 0, False: 15]
  ------------------
  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|     15|    psym = (dw_elf64_sym *)psh->gh_content;
  925|     15|    gsym = calloc(ecount,sizeof(struct generic_symentry));
  926|     15|    if (!gsym) {
  ------------------
  |  Branch (926:9): [True: 0, False: 15]
  ------------------
  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|     15|    res = RRMOA(ep->f_fd,psym,offset,size,
  ------------------
  |  |   65|     15|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     15|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  933|     15|        ep->f_filesize,errcode);
  934|     15|    if (res!= DW_DLV_OK) {
  ------------------
  |  |   59|     15|#define DW_DLV_OK         0
  ------------------
  |  Branch (934:9): [True: 0, False: 15]
  ------------------
  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|     15|    orig_gsym = gsym;
  942|    520|    for ( i = 0; i < ecount; ++i,++psym,++gsym) {
  ------------------
  |  Branch (942:18): [True: 505, False: 15]
  ------------------
  943|    505|        Dwarf_Unsigned bind = 0;
  944|    505|        Dwarf_Unsigned type = 0;
  945|       |
  946|    505|        ASNAR(ep->f_copy_word,gsym->gs_name,psym->st_name);
  ------------------
  |  |   53|    505|    do {                                        \
  |  |   54|    505|        (t) = 0;                                \
  |  |   55|    505|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    505|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 505]
  |  |  ------------------
  ------------------
  947|    505|        ASNAR(ep->f_copy_word,gsym->gs_value,psym->st_value);
  ------------------
  |  |   53|    505|    do {                                        \
  |  |   54|    505|        (t) = 0;                                \
  |  |   55|    505|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    505|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 505]
  |  |  ------------------
  ------------------
  948|    505|        ASNAR(ep->f_copy_word,gsym->gs_size,psym->st_size);
  ------------------
  |  |   53|    505|    do {                                        \
  |  |   54|    505|        (t) = 0;                                \
  |  |   55|    505|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    505|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 505]
  |  |  ------------------
  ------------------
  949|    505|        ASNAR(ep->f_copy_word,gsym->gs_info,psym->st_info);
  ------------------
  |  |   53|    505|    do {                                        \
  |  |   54|    505|        (t) = 0;                                \
  |  |   55|    505|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    505|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 505]
  |  |  ------------------
  ------------------
  950|    505|        ASNAR(ep->f_copy_word,gsym->gs_other,psym->st_other);
  ------------------
  |  |   53|    505|    do {                                        \
  |  |   54|    505|        (t) = 0;                                \
  |  |   55|    505|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    505|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 505]
  |  |  ------------------
  ------------------
  951|    505|        ASNAR(ep->f_copy_word,gsym->gs_shndx,psym->st_shndx);
  ------------------
  |  |   53|    505|    do {                                        \
  |  |   54|    505|        (t) = 0;                                \
  |  |   55|    505|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    505|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 505]
  |  |  ------------------
  ------------------
  952|    505|        bind = gsym->gs_info >> 4;
  953|    505|        type = gsym->gs_info & 0xf;
  954|    505|        gsym->gs_bind = bind;
  955|    505|        gsym->gs_type = type;
  956|    505|    }
  957|     15|    psh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|     15|#define TRUE 1
  ------------------
  958|     15|    *count_out = ecount;
  959|     15|    *gsym_out = orig_gsym;
  960|     15|    return DW_DLV_OK;
  ------------------
  |  |   59|     15|#define DW_DLV_OK         0
  ------------------
  961|     15|}
dwarf_elf_load_headers.c:is_empty_section:
  352|   866k|{
  353|   866k|    if (type == SHT_NOBITS) {
  ------------------
  |  |   87|   866k|#define SHT_NOBITS 8
  ------------------
  |  Branch (353:9): [True: 6.93k, False: 859k]
  ------------------
  354|  6.93k|        return TRUE;
  ------------------
  |  |   33|  6.93k|#define TRUE 1
  ------------------
  355|  6.93k|    }
  356|   859k|    if (type == SHT_NULL) {
  ------------------
  |  |   44|   859k|#define SHT_NULL 0
  ------------------
  |  Branch (356:9): [True: 780k, False: 78.6k]
  ------------------
  357|   780k|        return TRUE;
  ------------------
  |  |   33|   780k|#define TRUE 1
  ------------------
  358|   780k|    }
  359|  78.6k|    return FALSE;
  ------------------
  |  |   36|  78.6k|#define FALSE 0
  ------------------
  360|   859k|}
dwarf_elf_load_headers.c:this_rel_is_a_section_dwarf_related:
 1764|  5.40k|{
 1765|  5.40k|    Dwarf_Unsigned oksecnum = 0;
 1766|  5.40k|    struct generic_shdr *gstarg = 0;
 1767|       |
 1768|  5.40k|    if (gshdr->gh_type != SHT_RELA &&
  ------------------
  |  |   56|  10.8k|#define SHT_RELA 4
  ------------------
  |  Branch (1768:9): [True: 3.06k, False: 2.34k]
  ------------------
 1769|  3.06k|        gshdr->gh_type != SHT_REL)  {
  ------------------
  |  |   59|  3.06k|#define SHT_REL 9
  ------------------
  |  Branch (1769:9): [True: 1.36k, False: 1.70k]
  ------------------
 1770|  1.36k|        *oksecnum_out = 0;
 1771|  1.36k|        return DW_DLV_OK;
  ------------------
  |  |   59|  1.36k|#define DW_DLV_OK         0
  ------------------
 1772|  1.36k|    }
 1773|  4.04k|    oksecnum = gshdr->gh_reloc_target_secnum;
 1774|  4.04k|    if (oksecnum >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (1774:9): [True: 63, False: 3.98k]
  ------------------
 1775|     63|        *oksecnum_out = 0;
 1776|     63|        *errcode = DW_DLE_ELF_SECTION_ERROR;
  ------------------
  |  | 1492|     63|#define DW_DLE_ELF_SECTION_ERROR               446
  ------------------
 1777|     63|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     63|#define DW_DLV_ERROR      1
  ------------------
 1778|     63|    }
 1779|  3.98k|    gstarg = ep->f_shdr+oksecnum;
 1780|  3.98k|    if (!gstarg->gh_is_dwarf) {
  ------------------
  |  Branch (1780:9): [True: 1.92k, False: 2.05k]
  ------------------
 1781|  1.92k|        *oksecnum_out = 0; /* no reloc needed. */
 1782|  1.92k|        return DW_DLV_OK;
  ------------------
  |  |   59|  1.92k|#define DW_DLV_OK         0
  ------------------
 1783|  1.92k|    }
 1784|  2.05k|    *oksecnum_out = (unsigned)oksecnum;
 1785|  2.05k|    return DW_DLV_OK;
  ------------------
  |  |   59|  2.05k|#define DW_DLV_OK         0
  ------------------
 1786|  3.98k|}
dwarf_elf_load_headers.c:_dwarf_elf_load_a_relx_batch:
 1613|  2.05k|{
 1614|  2.05k|    Dwarf_Unsigned count = 0;
 1615|  2.05k|    Dwarf_Unsigned size = 0;
 1616|  2.05k|    Dwarf_Unsigned flags = 0;
 1617|  2.05k|    Dwarf_Unsigned size2 = 0;
 1618|  2.05k|    Dwarf_Unsigned sizeg = 0;
 1619|  2.05k|    Dwarf_Unsigned offset = 0;
 1620|  2.05k|    int            res = 0;
 1621|  2.05k|    Dwarf_Unsigned object_reclen = 0;
 1622|  2.05k|    struct generic_rela *grel = 0;
 1623|  2.05k|    char *         relp = 0;
 1624|  2.05k|    int            local_alloc = FALSE;
  ------------------
  |  |   36|  2.05k|#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|  2.05k|    flags = gsh->gh_flags;
 1632|  2.05k|    offset = gsh->gh_offset;
 1633|  2.05k|    size = gsh->gh_size;
 1634|  2.05k|    if (size == 0) {
  ------------------
  |  Branch (1634:9): [True: 421, False: 1.63k]
  ------------------
 1635|    421|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|    421|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1636|    421|    }
 1637|  1.63k|    relp = (char *)gsh->gh_content;
 1638|  1.63k|    if (!relp) {
  ------------------
  |  Branch (1638:9): [True: 1.34k, False: 284]
  ------------------
 1639|  1.34k|        relp = (char *)malloc(size);
 1640|  1.34k|        local_alloc = TRUE;
  ------------------
  |  |   33|  1.34k|#define TRUE 1
  ------------------
 1641|  1.34k|    }
 1642|  1.63k|    if (!relp) {
  ------------------
  |  Branch (1642:9): [True: 0, False: 1.63k]
  ------------------
 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.63k|    if ((offset > ep->f_filesize)||
  ------------------
  |  Branch (1646:9): [True: 120, False: 1.51k]
  ------------------
 1647|  1.51k|        (size > ep->f_filesize) ||
  ------------------
  |  Branch (1647:9): [True: 0, False: 1.51k]
  ------------------
 1648|  1.51k|        ((size +offset) > ep->f_filesize)) {
  ------------------
  |  Branch (1648:9): [True: 23, False: 1.48k]
  ------------------
 1649|    143|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|    143|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1650|    143|        if (local_alloc) {
  ------------------
  |  Branch (1650:13): [True: 143, False: 0]
  ------------------
 1651|    143|            free(relp);
 1652|    143|        }
 1653|    143|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    143|#define DW_DLV_ERROR      1
  ------------------
 1654|    143|    }
 1655|  1.48k|    res = RRMOA(ep->f_fd,relp,offset,size,
  ------------------
  |  |   65|  1.48k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  1.48k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1656|  1.48k|        ep->f_filesize,errcode);
 1657|  1.48k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.48k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1657:9): [True: 0, False: 1.48k]
  ------------------
 1658|      0|        free(relp);
 1659|      0|        free(grel);
 1660|      0|        return res;
 1661|      0|    }
 1662|  1.48k|    if (local_alloc) {
  ------------------
  |  Branch (1662:9): [True: 1.20k, False: 284]
  ------------------
 1663|  1.20k|        gsh->gh_content = relp;
 1664|  1.20k|        gsh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|  1.20k|#define TRUE 1
  ------------------
 1665|  1.20k|        gsh->gh_load_type = Dwarf_Alloc_Malloc;
 1666|  1.20k|    }
 1667|  1.48k|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|  1.48k|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (1667:9): [True: 4, False: 1.48k]
  ------------------
 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|      4|        *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      4|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
 1677|      4|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
 1678|      4|#endif /* COMPRESSED TEST */
 1679|      4|    }
 1680|  1.48k|    size = gsh->gh_size;
 1681|  1.48k|    if (localoffsize == RelocOffset32) {
  ------------------
  |  Branch (1681:9): [True: 929, False: 555]
  ------------------
 1682|    929|        if (localrela ==  RelocIsRela) {
  ------------------
  |  Branch (1682:13): [True: 332, False: 597]
  ------------------
 1683|    332|            object_reclen = sizeof(dw_elf32_rela);
 1684|    332|            count = (long)(size/object_reclen);
 1685|    332|            size2 = count * object_reclen;
 1686|    332|            if (size != size2) {
  ------------------
  |  Branch (1686:17): [True: 19, False: 313]
  ------------------
 1687|     19|                *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|     19|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1688|     19|                return DW_DLV_ERROR;
  ------------------
  |  |   60|     19|#define DW_DLV_ERROR      1
  ------------------
 1689|     19|            }
 1690|    597|        } else {
 1691|    597|            object_reclen = sizeof(dw_elf32_rel);
 1692|    597|            count = (long)(size/object_reclen);
 1693|    597|            size2 = count * object_reclen;
 1694|    597|            if (size != size2) {
  ------------------
  |  Branch (1694:17): [True: 6, False: 591]
  ------------------
 1695|      6|                *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      6|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1696|      6|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      6|#define DW_DLV_ERROR      1
  ------------------
 1697|      6|            }
 1698|    597|        }
 1699|    929|    } else {
 1700|    555|        if (localrela ==  RelocIsRela) {
  ------------------
  |  Branch (1700:13): [True: 290, False: 265]
  ------------------
 1701|    290|            object_reclen = sizeof(dw_elf64_rela);
 1702|    290|            count = (long)(size/object_reclen);
 1703|    290|            size2 = count * object_reclen;
 1704|    290|            if (size != size2) {
  ------------------
  |  Branch (1704:17): [True: 16, False: 274]
  ------------------
 1705|     16|                *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|     16|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1706|     16|                return DW_DLV_ERROR;
  ------------------
  |  |   60|     16|#define DW_DLV_ERROR      1
  ------------------
 1707|     16|            }
 1708|    290|        } else {
 1709|    265|            object_reclen = sizeof(dw_elf64_rel);
 1710|    265|            count = (long)(size/object_reclen);
 1711|    265|            size2 = count * object_reclen;
 1712|    265|            if (size != size2) {
  ------------------
  |  Branch (1712:17): [True: 2, False: 263]
  ------------------
 1713|      2|                *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      2|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1714|      2|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
 1715|      2|            }
 1716|    265|        }
 1717|    555|    }
 1718|       |
 1719|  1.44k|    sizeg = count*sizeof(struct generic_rela);
 1720|  1.44k|    grel = (struct generic_rela *)malloc(sizeg);
 1721|  1.44k|    if (!grel) {
  ------------------
  |  Branch (1721:9): [True: 0, False: 1.44k]
  ------------------
 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.44k|    if (localoffsize == RelocOffset32) {
  ------------------
  |  Branch (1725:9): [True: 904, False: 537]
  ------------------
 1726|    904|        if (localrela ==  RelocIsRela) {
  ------------------
  |  Branch (1726:13): [True: 313, False: 591]
  ------------------
 1727|    313|            res = generic_rel_from_rela32(ep,gsh,
 1728|    313|                (dw_elf32_rela *)gsh->gh_content,grel,errcode);
 1729|    591|        } else {
 1730|    591|            res = generic_rel_from_rel32(ep,gsh,
 1731|    591|                (dw_elf32_rel *)gsh->gh_content,grel,errcode);
 1732|    591|        }
 1733|    904|    } else {
 1734|    537|        if (localrela ==  RelocIsRela) {
  ------------------
  |  Branch (1734:13): [True: 274, False: 263]
  ------------------
 1735|    274|            res = generic_rel_from_rela64(ep,gsh,
 1736|    274|                (dw_elf64_rela *)gsh->gh_content,grel,errcode);
 1737|    274|        } else {
 1738|    263|            res = generic_rel_from_rel64(ep,gsh,
 1739|    263|                (dw_elf64_rel *)gsh->gh_content,grel,errcode);
 1740|    263|        }
 1741|    537|    }
 1742|  1.44k|    if (res == DW_DLV_OK) {
  ------------------
  |  |   59|  1.44k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1742:9): [True: 1.44k, False: 0]
  ------------------
 1743|  1.44k|        gsh->gh_relcount = count;
 1744|  1.44k|        gsh->gh_rels = grel;
 1745|  1.44k|        *count_out = count;
 1746|  1.44k|        *grel_out = grel;
 1747|  1.44k|        return res;
 1748|  1.44k|    }
 1749|       |    /* Some sort of issue */
 1750|      0|    count_out = 0;
 1751|      0|    free(grel);
 1752|      0|    return res;
 1753|  1.44k|}
dwarf_elf_load_headers.c:generic_rel_from_rela32:
 1042|    313|{
 1043|    313|    Dwarf_Unsigned ecount = 0;
 1044|    313|    Dwarf_Unsigned size = gsh->gh_size;
 1045|    313|    Dwarf_Unsigned size2 = 0;
 1046|    313|    Dwarf_Unsigned i = 0;
 1047|       |
 1048|    313|    ecount = size/sizeof(dw_elf32_rela);
 1049|    313|    size2 = ecount * sizeof(dw_elf32_rela);
 1050|    313|    if (size >= ep->f_filesize) {
  ------------------
  |  Branch (1050:9): [True: 0, False: 313]
  ------------------
 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|    313|    if (size != size2) {
  ------------------
  |  Branch (1054:9): [True: 0, False: 313]
  ------------------
 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|  30.6k|    for ( i = 0; i < ecount; ++i,++relp,++grel) {
  ------------------
  |  Branch (1058:18): [True: 30.3k, False: 313]
  ------------------
 1059|  30.3k|        ASNAR(ep->f_copy_word,grel->gr_offset,relp->r_offset);
  ------------------
  |  |   53|  30.3k|    do {                                        \
  |  |   54|  30.3k|        (t) = 0;                                \
  |  |   55|  30.3k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  30.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 30.3k]
  |  |  ------------------
  ------------------
 1060|  30.3k|        ASNAR(ep->f_copy_word,grel->gr_info,relp->r_info);
  ------------------
  |  |   53|  30.3k|    do {                                        \
  |  |   54|  30.3k|        (t) = 0;                                \
  |  |   55|  30.3k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  30.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 30.3k]
  |  |  ------------------
  ------------------
 1061|       |        /* addend signed */
 1062|  30.3k|        ASNAR(ep->f_copy_word,grel->gr_addend,relp->r_addend);
  ------------------
  |  |   53|  30.3k|    do {                                        \
  |  |   54|  30.3k|        (t) = 0;                                \
  |  |   55|  30.3k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  30.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 30.3k]
  |  |  ------------------
  ------------------
 1063|  30.3k|        SIGN_EXTEND(grel->gr_addend,sizeof(relp->r_addend));
  ------------------
  |  |  102|  30.3k|    do {                                                          \
  |  |  103|  30.3k|        if (*(Dwarf_Sbyte *)((char *)&(dest)+ ((length)-1)) < 0) { \
  |  |  ------------------
  |  |  |  Branch (103:13): [True: 6.82k, False: 23.5k]
  |  |  ------------------
  |  |  104|  6.82k|            memcpy((char *)&(dest)+(length),                      \
  |  |  105|  6.82k|                "\xff\xff\xff\xff\xff\xff\xff\xff",               \
  |  |  106|  6.82k|                sizeof(dest) - (length));                         \
  |  |  107|  6.82k|        }                                                         \
  |  |  108|  30.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (108:14): [Folded, False: 30.3k]
  |  |  ------------------
  ------------------
 1064|  30.3k|        grel->gr_sym  = grel->gr_info>>8; /* ELF32_R_SYM */
 1065|  30.3k|        grel->gr_type = grel->gr_info & 0xff;
 1066|  30.3k|        grel->gr_is_rela = TRUE;
  ------------------
  |  |   33|  30.3k|#define TRUE 1
  ------------------
 1067|  30.3k|    }
 1068|    313|    return DW_DLV_OK;
  ------------------
  |  |   59|    313|#define DW_DLV_OK         0
  ------------------
 1069|    313|}
dwarf_elf_load_headers.c:generic_rel_from_rel32:
 1131|    591|{
 1132|    591|    Dwarf_Unsigned ecount = 0;
 1133|    591|    Dwarf_Unsigned size = gsh->gh_size;
 1134|    591|    Dwarf_Unsigned size2 = 0;
 1135|    591|    Dwarf_Unsigned i = 0;
 1136|       |
 1137|    591|    ecount = size/sizeof(dw_elf32_rel);
 1138|    591|    size2 = ecount * sizeof(dw_elf32_rel);
 1139|    591|    if (size >= ep->f_filesize) {
  ------------------
  |  Branch (1139:9): [True: 0, False: 591]
  ------------------
 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|    591|    if (size != size2) {
  ------------------
  |  Branch (1143:9): [True: 0, False: 591]
  ------------------
 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|   135k|    for ( i = 0; i < ecount; ++i,++relp,++grel) {
  ------------------
  |  Branch (1147:18): [True: 134k, False: 591]
  ------------------
 1148|   134k|        ASNAR(ep->f_copy_word,grel->gr_offset,relp->r_offset);
  ------------------
  |  |   53|   134k|    do {                                        \
  |  |   54|   134k|        (t) = 0;                                \
  |  |   55|   134k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   134k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 134k]
  |  |  ------------------
  ------------------
 1149|   134k|        ASNAR(ep->f_copy_word,grel->gr_info,relp->r_info);
  ------------------
  |  |   53|   134k|    do {                                        \
  |  |   54|   134k|        (t) = 0;                                \
  |  |   55|   134k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   134k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 134k]
  |  |  ------------------
  ------------------
 1150|   134k|        grel->gr_addend  = 0; /* Unused for plain .rel */
 1151|   134k|        grel->gr_sym  = grel->gr_info >>8; /* ELF32_R_SYM */
 1152|   134k|        grel->gr_is_rela = FALSE;
  ------------------
  |  |   36|   134k|#define FALSE 0
  ------------------
 1153|   134k|        grel->gr_type = grel->gr_info & 0xff;
 1154|   134k|    }
 1155|    591|    return DW_DLV_OK;
  ------------------
  |  |   59|    591|#define DW_DLV_OK         0
  ------------------
 1156|    591|}
dwarf_elf_load_headers.c:generic_rel_from_rela64:
 1077|    274|{
 1078|    274|    Dwarf_Unsigned ecount = 0;
 1079|    274|    Dwarf_Unsigned size = gsh->gh_size;
 1080|    274|    Dwarf_Unsigned size2 = 0;
 1081|    274|    Dwarf_Unsigned i = 0;
 1082|    274|    int objlittleendian = (ep->f_endian == DW_END_little);
  ------------------
  |  | 1115|    274|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1083|    274|    int ismips64 = (ep->f_machine == EM_MIPS);
  ------------------
  |  |  209|    274|#define EM_MIPS          8
  ------------------
 1084|    274|    int issparcv9 = (ep->f_machine == EM_SPARCV9);
  ------------------
  |  |  263|    274|#define EM_SPARCV9       43
  ------------------
 1085|       |
 1086|    274|    ecount = size/sizeof(dw_elf64_rela);
 1087|    274|    size2 = ecount * sizeof(dw_elf64_rela);
 1088|    274|    if (size >= ep->f_filesize) {
  ------------------
  |  Branch (1088:9): [True: 0, False: 274]
  ------------------
 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|    274|    if (size != size2) {
  ------------------
  |  Branch (1092:9): [True: 0, False: 274]
  ------------------
 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|  14.2k|    for ( i = 0; i < ecount; ++i,++relp,++grel) {
  ------------------
  |  Branch (1096:18): [True: 14.0k, False: 274]
  ------------------
 1097|  14.0k|        ASNAR(ep->f_copy_word,grel->gr_offset,relp->r_offset);
  ------------------
  |  |   53|  14.0k|    do {                                        \
  |  |   54|  14.0k|        (t) = 0;                                \
  |  |   55|  14.0k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  14.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 14.0k]
  |  |  ------------------
  ------------------
 1098|  14.0k|        ASNAR(ep->f_copy_word,grel->gr_info,relp->r_info);
  ------------------
  |  |   53|  14.0k|    do {                                        \
  |  |   54|  14.0k|        (t) = 0;                                \
  |  |   55|  14.0k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  14.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 14.0k]
  |  |  ------------------
  ------------------
 1099|  14.0k|        ASNAR(ep->f_copy_word,grel->gr_addend,relp->r_addend);
  ------------------
  |  |   53|  14.0k|    do {                                        \
  |  |   54|  14.0k|        (t) = 0;                                \
  |  |   55|  14.0k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  14.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 14.0k]
  |  |  ------------------
  ------------------
 1100|  14.0k|        SIGN_EXTEND(grel->gr_addend,sizeof(relp->r_addend));
  ------------------
  |  |  102|  14.0k|    do {                                                          \
  |  |  103|  14.0k|        if (*(Dwarf_Sbyte *)((char *)&(dest)+ ((length)-1)) < 0) { \
  |  |  ------------------
  |  |  |  Branch (103:13): [True: 574, False: 13.4k]
  |  |  ------------------
  |  |  104|    574|            memcpy((char *)&(dest)+(length),                      \
  |  |  105|    574|                "\xff\xff\xff\xff\xff\xff\xff\xff",               \
  |  |  106|    574|                sizeof(dest) - (length));                         \
  |  |  107|    574|        }                                                         \
  |  |  108|  14.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (108:14): [Folded, False: 14.0k]
  |  |  ------------------
  ------------------
 1101|  14.0k|        if (ismips64 && objlittleendian ) {
  ------------------
  |  Branch (1101:13): [True: 1.71k, False: 12.3k]
  |  Branch (1101:25): [True: 1.45k, False: 264]
  ------------------
 1102|  1.45k|            char realsym[4];
 1103|       |
 1104|  1.45k|            memcpy(realsym,&relp->r_info,sizeof(realsym));
 1105|  1.45k|            ASNAR(ep->f_copy_word,grel->gr_sym,realsym);
  ------------------
  |  |   53|  1.45k|    do {                                        \
  |  |   54|  1.45k|        (t) = 0;                                \
  |  |   55|  1.45k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.45k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.45k]
  |  |  ------------------
  ------------------
 1106|  1.45k|            grel->gr_type  = relp->r_info[7];
 1107|  1.45k|            grel->gr_type2 = relp->r_info[6];
 1108|  1.45k|            grel->gr_type3 = relp->r_info[5];
 1109|  12.5k|        } else if (issparcv9) {
  ------------------
  |  Branch (1109:20): [True: 606, False: 11.9k]
  ------------------
 1110|       |            /*  Always Big Endian?  */
 1111|    606|            char realsym[4];
 1112|       |
 1113|    606|            memcpy(realsym,&relp->r_info,sizeof(realsym));
 1114|    606|            ASNAR(ep->f_copy_word,grel->gr_sym,realsym);
  ------------------
  |  |   53|    606|    do {                                        \
  |  |   54|    606|        (t) = 0;                                \
  |  |   55|    606|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    606|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 606]
  |  |  ------------------
  ------------------
 1115|    606|            grel->gr_type  = relp->r_info[7];
 1116|  11.9k|        } else {
 1117|  11.9k|            grel->gr_sym  = grel->gr_info >> 32;
 1118|  11.9k|            grel->gr_type = grel->gr_info & 0xffffffff;
 1119|  11.9k|        }
 1120|  14.0k|        grel->gr_is_rela = TRUE;
  ------------------
  |  |   33|  14.0k|#define TRUE 1
  ------------------
 1121|  14.0k|    }
 1122|    274|    return DW_DLV_OK;
  ------------------
  |  |   59|    274|#define DW_DLV_OK         0
  ------------------
 1123|    274|}
dwarf_elf_load_headers.c:generic_rel_from_rel64:
 1164|    263|{
 1165|    263|    Dwarf_Unsigned ecount = 0;
 1166|    263|    Dwarf_Unsigned size = gsh->gh_size;
 1167|    263|    Dwarf_Unsigned size2 = 0;
 1168|    263|    Dwarf_Unsigned i = 0;
 1169|    263|    int objlittleendian = (ep->f_endian == DW_END_little);
  ------------------
  |  | 1115|    263|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1170|    263|    int ismips64 = (ep->f_machine == EM_MIPS);
  ------------------
  |  |  209|    263|#define EM_MIPS          8
  ------------------
 1171|    263|    int issparcv9 = (ep->f_machine == EM_SPARCV9);
  ------------------
  |  |  263|    263|#define EM_SPARCV9       43
  ------------------
 1172|       |
 1173|    263|    ecount = size/sizeof(dw_elf64_rel);
 1174|    263|    size2 = ecount * sizeof(dw_elf64_rel);
 1175|    263|    if (size >= ep->f_filesize) {
  ------------------
  |  Branch (1175:9): [True: 0, False: 263]
  ------------------
 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|    263|    if (size != size2) {
  ------------------
  |  Branch (1179:9): [True: 0, False: 263]
  ------------------
 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|  9.50k|    for ( i = 0; i < ecount; ++i,++relp,++grel) {
  ------------------
  |  Branch (1183:18): [True: 9.24k, False: 263]
  ------------------
 1184|  9.24k|        ASNAR(ep->f_copy_word,grel->gr_offset,relp->r_offset);
  ------------------
  |  |   53|  9.24k|    do {                                        \
  |  |   54|  9.24k|        (t) = 0;                                \
  |  |   55|  9.24k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  9.24k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 9.24k]
  |  |  ------------------
  ------------------
 1185|  9.24k|        ASNAR(ep->f_copy_word,grel->gr_info,relp->r_info);
  ------------------
  |  |   53|  9.24k|    do {                                        \
  |  |   54|  9.24k|        (t) = 0;                                \
  |  |   55|  9.24k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  9.24k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 9.24k]
  |  |  ------------------
  ------------------
 1186|  9.24k|        grel->gr_addend  = 0; /* Unused for plain .rel */
 1187|  9.24k|        if (ismips64 && objlittleendian ) {
  ------------------
  |  Branch (1187:13): [True: 3.58k, False: 5.65k]
  |  Branch (1187:25): [True: 3.37k, False: 211]
  ------------------
 1188|  3.37k|            char realsym[4];
 1189|       |
 1190|  3.37k|            memcpy(realsym,&relp->r_info,sizeof(realsym));
 1191|  3.37k|            ASNAR(ep->f_copy_word,grel->gr_sym,realsym);
  ------------------
  |  |   53|  3.37k|    do {                                        \
  |  |   54|  3.37k|        (t) = 0;                                \
  |  |   55|  3.37k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.37k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.37k]
  |  |  ------------------
  ------------------
 1192|  3.37k|            grel->gr_type  = relp->r_info[7];
 1193|  3.37k|            grel->gr_type2 = relp->r_info[6];
 1194|  3.37k|            grel->gr_type3 = relp->r_info[5];
 1195|  5.86k|        } else if (issparcv9) {
  ------------------
  |  Branch (1195:20): [True: 567, False: 5.29k]
  ------------------
 1196|       |            /*  Always Big Endian?  */
 1197|    567|            char realsym[4];
 1198|       |
 1199|    567|            memcpy(realsym,&relp->r_info,sizeof(realsym));
 1200|    567|            ASNAR(ep->f_copy_word,grel->gr_sym,realsym);
  ------------------
  |  |   53|    567|    do {                                        \
  |  |   54|    567|        (t) = 0;                                \
  |  |   55|    567|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    567|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 567]
  |  |  ------------------
  ------------------
 1201|    567|            grel->gr_type  = relp->r_info[7];
 1202|  5.29k|        } else {
 1203|  5.29k|            grel->gr_sym  = grel->gr_info >>32;
 1204|  5.29k|            grel->gr_type = grel->gr_info & 0xffffffff;
 1205|  5.29k|        }
 1206|  9.24k|        grel->gr_is_rela = FALSE;
  ------------------
  |  |   36|  9.24k|#define FALSE 0
  ------------------
 1207|  9.24k|    }
 1208|    263|    return DW_DLV_OK;
  ------------------
  |  |   59|    263|#define DW_DLV_OK         0
  ------------------
 1209|    263|}
dwarf_elf_load_headers.c:elf_load_elf_header32:
 1934|  3.05k|{
 1935|  3.05k|    int res = 0;
 1936|  3.05k|    dw_elf32_ehdr ehdr32;
 1937|  3.05k|    struct generic_ehdr *ehdr = 0;
 1938|       |
 1939|  3.05k|    ehdr32 = eh32_zero;
 1940|  3.05k|    res = RRMOA(ep->f_fd,&ehdr32,0,sizeof(ehdr32),
  ------------------
  |  |   65|  3.05k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  3.05k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1941|  3.05k|        ep->f_filesize,errcode);
 1942|  3.05k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  3.05k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1942:9): [True: 5, False: 3.05k]
  ------------------
 1943|      5|        return res;
 1944|      5|    }
 1945|  3.05k|    ehdr = (struct generic_ehdr *)calloc(1,
 1946|  3.05k|        sizeof(struct generic_ehdr));
 1947|  3.05k|    if (!ehdr) {
  ------------------
  |  Branch (1947:9): [True: 0, False: 3.05k]
  ------------------
 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.05k|    res  = generic_ehdr_from_32(ep,ehdr,&ehdr32,errcode);
 1952|  3.05k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  3.05k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1952:9): [True: 28, False: 3.02k]
  ------------------
 1953|     28|        free(ehdr);
 1954|     28|        return res;
 1955|     28|    }
 1956|  3.02k|    ep->f_machine = (unsigned)ehdr->ge_machine;
 1957|  3.02k|    ep->f_flags = ehdr->ge_flags;
 1958|  3.02k|    return res;
 1959|  3.05k|}
dwarf_elf_load_headers.c:generic_ehdr_from_32:
  366|  3.05k|{
  367|  3.05k|    int i = 0;
  368|       |
  369|  51.9k|    for (i = 0; i < EI_NIDENT; ++i) {
  ------------------
  |  |  926|  51.9k|#define EI_NIDENT 16
  ------------------
  |  Branch (369:17): [True: 48.8k, False: 3.05k]
  ------------------
  370|  48.8k|        ehdr->ge_ident[i] = e->e_ident[i];
  371|  48.8k|    }
  372|  3.05k|    ASNAR(ep->f_copy_word,ehdr->ge_type,e->e_type);
  ------------------
  |  |   53|  3.05k|    do {                                        \
  |  |   54|  3.05k|        (t) = 0;                                \
  |  |   55|  3.05k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.05k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.05k]
  |  |  ------------------
  ------------------
  373|  3.05k|    ASNAR(ep->f_copy_word,ehdr->ge_machine,e->e_machine);
  ------------------
  |  |   53|  3.05k|    do {                                        \
  |  |   54|  3.05k|        (t) = 0;                                \
  |  |   55|  3.05k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.05k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.05k]
  |  |  ------------------
  ------------------
  374|  3.05k|    ASNAR(ep->f_copy_word,ehdr->ge_version,e->e_version);
  ------------------
  |  |   53|  3.05k|    do {                                        \
  |  |   54|  3.05k|        (t) = 0;                                \
  |  |   55|  3.05k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.05k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.05k]
  |  |  ------------------
  ------------------
  375|  3.05k|    ASNAR(ep->f_copy_word,ehdr->ge_entry,e->e_entry);
  ------------------
  |  |   53|  3.05k|    do {                                        \
  |  |   54|  3.05k|        (t) = 0;                                \
  |  |   55|  3.05k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.05k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.05k]
  |  |  ------------------
  ------------------
  376|  3.05k|    ASNAR(ep->f_copy_word,ehdr->ge_phoff,e->e_phoff);
  ------------------
  |  |   53|  3.05k|    do {                                        \
  |  |   54|  3.05k|        (t) = 0;                                \
  |  |   55|  3.05k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.05k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.05k]
  |  |  ------------------
  ------------------
  377|  3.05k|    ASNAR(ep->f_copy_word,ehdr->ge_shoff,e->e_shoff);
  ------------------
  |  |   53|  3.05k|    do {                                        \
  |  |   54|  3.05k|        (t) = 0;                                \
  |  |   55|  3.05k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.05k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.05k]
  |  |  ------------------
  ------------------
  378|  3.05k|    ASNAR(ep->f_copy_word,ehdr->ge_flags,e->e_flags);
  ------------------
  |  |   53|  3.05k|    do {                                        \
  |  |   54|  3.05k|        (t) = 0;                                \
  |  |   55|  3.05k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.05k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.05k]
  |  |  ------------------
  ------------------
  379|  3.05k|    ASNAR(ep->f_copy_word,ehdr->ge_ehsize,e->e_ehsize);
  ------------------
  |  |   53|  3.05k|    do {                                        \
  |  |   54|  3.05k|        (t) = 0;                                \
  |  |   55|  3.05k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.05k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.05k]
  |  |  ------------------
  ------------------
  380|  3.05k|    ASNAR(ep->f_copy_word,ehdr->ge_phentsize,e->e_phentsize);
  ------------------
  |  |   53|  3.05k|    do {                                        \
  |  |   54|  3.05k|        (t) = 0;                                \
  |  |   55|  3.05k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.05k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.05k]
  |  |  ------------------
  ------------------
  381|  3.05k|    ASNAR(ep->f_copy_word,ehdr->ge_phnum,e->e_phnum);
  ------------------
  |  |   53|  3.05k|    do {                                        \
  |  |   54|  3.05k|        (t) = 0;                                \
  |  |   55|  3.05k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.05k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.05k]
  |  |  ------------------
  ------------------
  382|  3.05k|    ASNAR(ep->f_copy_word,ehdr->ge_shentsize,e->e_shentsize);
  ------------------
  |  |   53|  3.05k|    do {                                        \
  |  |   54|  3.05k|        (t) = 0;                                \
  |  |   55|  3.05k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.05k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.05k]
  |  |  ------------------
  ------------------
  383|  3.05k|    ASNAR(ep->f_copy_word,ehdr->ge_shnum,e->e_shnum);
  ------------------
  |  |   53|  3.05k|    do {                                        \
  |  |   54|  3.05k|        (t) = 0;                                \
  |  |   55|  3.05k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.05k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.05k]
  |  |  ------------------
  ------------------
  384|  3.05k|    ASNAR(ep->f_copy_word,ehdr->ge_shstrndx,e->e_shstrndx);
  ------------------
  |  |   53|  3.05k|    do {                                        \
  |  |   54|  3.05k|        (t) = 0;                                \
  |  |   55|  3.05k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.05k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.05k]
  |  |  ------------------
  ------------------
  385|  3.05k|    if (!ehdr->ge_shoff) {
  ------------------
  |  Branch (385:9): [True: 1, False: 3.05k]
  ------------------
  386|      1|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      1|#define DW_DLV_NO_ENTRY  -1
  ------------------
  387|      1|    }
  388|  3.05k|    if (ehdr->ge_shoff < sizeof(dw_elf32_ehdr)) {
  ------------------
  |  Branch (388:9): [True: 6, False: 3.04k]
  ------------------
  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.04k|    if (ehdr->ge_shstrndx == SHN_XINDEX) {
  ------------------
  |  |  302|  3.04k|#define SHN_XINDEX 0xffff
  ------------------
  |  Branch (393:9): [True: 41, False: 3.00k]
  ------------------
  394|     41|        ehdr->ge_strndx_extended = TRUE;
  ------------------
  |  |   33|     41|#define TRUE 1
  ------------------
  395|  3.00k|    } else {
  396|  3.00k|        ehdr->ge_strndx_in_strndx = TRUE;
  ------------------
  |  |   33|  3.00k|#define TRUE 1
  ------------------
  397|  3.00k|        if (ehdr->ge_shstrndx < 1) {
  ------------------
  |  Branch (397:13): [True: 2, False: 3.00k]
  ------------------
  398|      2|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|      2|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
  399|      2|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
  400|      2|        }
  401|  3.00k|    }
  402|       |    /*  If !ge_strndx_extended && !ehdr->ge_shnum
  403|       |        this is a very unusual case.  */
  404|  3.04k|    if (!ehdr->ge_shnum) {
  ------------------
  |  Branch (404:9): [True: 95, False: 2.94k]
  ------------------
  405|     95|        ehdr->ge_shnum_extended = TRUE;
  ------------------
  |  |   33|     95|#define TRUE 1
  ------------------
  406|  2.94k|    } else {
  407|  2.94k|        ehdr->ge_shnum_in_shnum = TRUE;
  ------------------
  |  |   33|  2.94k|#define TRUE 1
  ------------------
  408|  2.94k|        if (!ehdr->ge_shnum) {
  ------------------
  |  Branch (408:13): [True: 0, False: 2.94k]
  ------------------
  409|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  410|      0|        }
  411|  2.94k|        if (ehdr->ge_shnum < 3) {
  ------------------
  |  Branch (411:13): [True: 2, False: 2.94k]
  ------------------
  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.94k|    }
  416|  3.04k|    if (ehdr->ge_shnum_in_shnum &&
  ------------------
  |  Branch (416:9): [True: 2.94k, False: 95]
  ------------------
  417|  2.94k|        ehdr->ge_strndx_in_strndx &&
  ------------------
  |  Branch (417:9): [True: 2.90k, False: 38]
  ------------------
  418|  2.90k|        (ehdr->ge_shstrndx >= ehdr->ge_shnum)) {
  ------------------
  |  Branch (418:9): [True: 17, False: 2.89k]
  ------------------
  419|     17|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|     17|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
  420|     17|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     17|#define DW_DLV_ERROR      1
  ------------------
  421|     17|    }
  422|       |
  423|  3.02k|    ep->f_machine = (unsigned int)ehdr->ge_machine;
  424|  3.02k|    ep->f_ftype = (unsigned int)ehdr->ge_type;
  425|  3.02k|    ep->f_ehdr = ehdr;
  426|  3.02k|    ep->f_loc_ehdr.g_name = "Elf File Header";
  427|  3.02k|    ep->f_loc_ehdr.g_offset = 0;
  428|  3.02k|    ep->f_loc_ehdr.g_count = 1;
  429|  3.02k|    ep->f_loc_ehdr.g_entrysize = sizeof(dw_elf32_ehdr);
  430|  3.02k|    ep->f_loc_ehdr.g_totalsize = sizeof(dw_elf32_ehdr);
  431|  3.02k|    return DW_DLV_OK;
  ------------------
  |  |   59|  3.02k|#define DW_DLV_OK         0
  ------------------
  432|  3.04k|}
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: 4, False: 1.51k]
  ------------------
 1972|      4|        return res;
 1973|      4|    }
 1974|  1.51k|    ehdr = (struct generic_ehdr *)calloc(1,
 1975|  1.51k|        sizeof(struct generic_ehdr));
 1976|  1.51k|    if (!ehdr) {
  ------------------
  |  Branch (1976:9): [True: 0, False: 1.51k]
  ------------------
 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.51k|    res  = generic_ehdr_from_64(ep,ehdr,&ehdr64,errcode);
 1981|  1.51k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.51k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1981:9): [True: 36, False: 1.48k]
  ------------------
 1982|     36|        free(ehdr);
 1983|     36|        return res;
 1984|     36|    }
 1985|  1.48k|    ep->f_machine = (unsigned)ehdr->ge_machine;
 1986|  1.48k|    ep->f_flags = ehdr->ge_flags;
 1987|  1.48k|    return res;
 1988|  1.51k|}
dwarf_elf_load_headers.c:generic_ehdr_from_64:
  438|  1.51k|{
  439|  1.51k|    int i = 0;
  440|       |
  441|  25.8k|    for (i = 0; i < EI_NIDENT; ++i) {
  ------------------
  |  |  926|  25.8k|#define EI_NIDENT 16
  ------------------
  |  Branch (441:17): [True: 24.3k, False: 1.51k]
  ------------------
  442|  24.3k|        ehdr->ge_ident[i] = e->e_ident[i];
  443|  24.3k|    }
  444|  1.51k|    ASNAR(ep->f_copy_word,ehdr->ge_type,e->e_type);
  ------------------
  |  |   53|  1.51k|    do {                                        \
  |  |   54|  1.51k|        (t) = 0;                                \
  |  |   55|  1.51k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.51k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.51k]
  |  |  ------------------
  ------------------
  445|  1.51k|    ASNAR(ep->f_copy_word,ehdr->ge_machine,e->e_machine);
  ------------------
  |  |   53|  1.51k|    do {                                        \
  |  |   54|  1.51k|        (t) = 0;                                \
  |  |   55|  1.51k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.51k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.51k]
  |  |  ------------------
  ------------------
  446|  1.51k|    ASNAR(ep->f_copy_word,ehdr->ge_version,e->e_version);
  ------------------
  |  |   53|  1.51k|    do {                                        \
  |  |   54|  1.51k|        (t) = 0;                                \
  |  |   55|  1.51k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.51k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.51k]
  |  |  ------------------
  ------------------
  447|  1.51k|    ASNAR(ep->f_copy_word,ehdr->ge_entry,e->e_entry);
  ------------------
  |  |   53|  1.51k|    do {                                        \
  |  |   54|  1.51k|        (t) = 0;                                \
  |  |   55|  1.51k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.51k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.51k]
  |  |  ------------------
  ------------------
  448|  1.51k|    ASNAR(ep->f_copy_word,ehdr->ge_phoff,e->e_phoff);
  ------------------
  |  |   53|  1.51k|    do {                                        \
  |  |   54|  1.51k|        (t) = 0;                                \
  |  |   55|  1.51k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.51k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.51k]
  |  |  ------------------
  ------------------
  449|  1.51k|    ASNAR(ep->f_copy_word,ehdr->ge_shoff,e->e_shoff);
  ------------------
  |  |   53|  1.51k|    do {                                        \
  |  |   54|  1.51k|        (t) = 0;                                \
  |  |   55|  1.51k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.51k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.51k]
  |  |  ------------------
  ------------------
  450|  1.51k|    ASNAR(ep->f_copy_word,ehdr->ge_flags,e->e_flags);
  ------------------
  |  |   53|  1.51k|    do {                                        \
  |  |   54|  1.51k|        (t) = 0;                                \
  |  |   55|  1.51k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.51k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.51k]
  |  |  ------------------
  ------------------
  451|  1.51k|    ASNAR(ep->f_copy_word,ehdr->ge_ehsize,e->e_ehsize);
  ------------------
  |  |   53|  1.51k|    do {                                        \
  |  |   54|  1.51k|        (t) = 0;                                \
  |  |   55|  1.51k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.51k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.51k]
  |  |  ------------------
  ------------------
  452|  1.51k|    ASNAR(ep->f_copy_word,ehdr->ge_phentsize,e->e_phentsize);
  ------------------
  |  |   53|  1.51k|    do {                                        \
  |  |   54|  1.51k|        (t) = 0;                                \
  |  |   55|  1.51k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.51k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.51k]
  |  |  ------------------
  ------------------
  453|  1.51k|    ASNAR(ep->f_copy_word,ehdr->ge_phnum,e->e_phnum);
  ------------------
  |  |   53|  1.51k|    do {                                        \
  |  |   54|  1.51k|        (t) = 0;                                \
  |  |   55|  1.51k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.51k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.51k]
  |  |  ------------------
  ------------------
  454|  1.51k|    ASNAR(ep->f_copy_word,ehdr->ge_shentsize,e->e_shentsize);
  ------------------
  |  |   53|  1.51k|    do {                                        \
  |  |   54|  1.51k|        (t) = 0;                                \
  |  |   55|  1.51k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.51k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.51k]
  |  |  ------------------
  ------------------
  455|  1.51k|    ASNAR(ep->f_copy_word,ehdr->ge_shnum,e->e_shnum);
  ------------------
  |  |   53|  1.51k|    do {                                        \
  |  |   54|  1.51k|        (t) = 0;                                \
  |  |   55|  1.51k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.51k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.51k]
  |  |  ------------------
  ------------------
  456|  1.51k|    ASNAR(ep->f_copy_word,ehdr->ge_shstrndx,e->e_shstrndx);
  ------------------
  |  |   53|  1.51k|    do {                                        \
  |  |   54|  1.51k|        (t) = 0;                                \
  |  |   55|  1.51k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.51k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.51k]
  |  |  ------------------
  ------------------
  457|  1.51k|    if (!ehdr->ge_shoff) {
  ------------------
  |  Branch (457:9): [True: 1, False: 1.51k]
  ------------------
  458|      1|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      1|#define DW_DLV_NO_ENTRY  -1
  ------------------
  459|      1|    }
  460|  1.51k|    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: 402, False: 1.11k]
  ------------------
  466|    402|        ehdr->ge_strndx_extended = TRUE;
  ------------------
  |  |   33|    402|#define TRUE 1
  ------------------
  467|  1.11k|    } else {
  468|  1.11k|        ehdr->ge_strndx_in_strndx = TRUE;
  ------------------
  |  |   33|  1.11k|#define TRUE 1
  ------------------
  469|  1.11k|        if (ehdr->ge_shstrndx < 1) {
  ------------------
  |  Branch (469:13): [True: 7, False: 1.10k]
  ------------------
  470|      7|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|      7|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
  471|      7|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      7|#define DW_DLV_ERROR      1
  ------------------
  472|      7|        }
  473|  1.11k|    }
  474|  1.50k|    if (!ehdr->ge_shnum) {
  ------------------
  |  Branch (474:9): [True: 157, False: 1.34k]
  ------------------
  475|    157|        ehdr->ge_shnum_extended = TRUE;
  ------------------
  |  |   33|    157|#define TRUE 1
  ------------------
  476|  1.34k|    } else {
  477|  1.34k|        ehdr->ge_shnum_in_shnum = TRUE;
  ------------------
  |  |   33|  1.34k|#define TRUE 1
  ------------------
  478|  1.34k|        if (!ehdr->ge_shnum) {
  ------------------
  |  Branch (478:13): [True: 0, False: 1.34k]
  ------------------
  479|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  480|      0|        }
  481|  1.34k|        if (ehdr->ge_shnum < 3) {
  ------------------
  |  Branch (481:13): [True: 2, False: 1.34k]
  ------------------
  482|      2|            *errcode = DW_DLE_TOO_FEW_SECTIONS;
  ------------------
  |  | 1540|      2|#define DW_DLE_TOO_FEW_SECTIONS                494
  ------------------
  483|      2|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
  484|      2|        }
  485|  1.34k|    }
  486|  1.50k|    if (ehdr->ge_shnum_in_shnum &&
  ------------------
  |  Branch (486:9): [True: 1.34k, False: 157]
  ------------------
  487|  1.34k|        ehdr->ge_strndx_in_strndx &&
  ------------------
  |  Branch (487:9): [True: 953, False: 393]
  ------------------
  488|    953|        (ehdr->ge_shstrndx >= ehdr->ge_shnum)) {
  ------------------
  |  Branch (488:9): [True: 20, False: 933]
  ------------------
  489|     20|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|     20|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
  490|     20|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     20|#define DW_DLV_ERROR      1
  ------------------
  491|     20|    }
  492|  1.48k|    ep->f_machine = (unsigned int)ehdr->ge_machine;
  493|  1.48k|    ep->f_ftype = (unsigned int)ehdr->ge_type;
  494|  1.48k|    ep->f_ehdr = ehdr;
  495|  1.48k|    ep->f_loc_ehdr.g_name = "Elf File Header";
  496|  1.48k|    ep->f_loc_ehdr.g_offset = 0;
  497|  1.48k|    ep->f_loc_ehdr.g_count = 1;
  498|  1.48k|    ep->f_loc_ehdr.g_entrysize = sizeof(dw_elf64_ehdr);
  499|  1.48k|    ep->f_loc_ehdr.g_totalsize = sizeof(dw_elf64_ehdr);
  500|  1.48k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.48k|#define DW_DLV_OK         0
  ------------------
  501|  1.50k|}
dwarf_elf_load_headers.c:elf_load_sectheaders32:
 1450|  3.02k|{
 1451|  3.02k|    Dwarf_Unsigned generic_count = 0;
 1452|  3.02k|    Dwarf_Unsigned shdr_count = 0;
 1453|  3.02k|    Dwarf_Bool have_shdr_count = FALSE;
  ------------------
  |  |   36|  3.02k|#define FALSE 0
  ------------------
 1454|  3.02k|    Dwarf_Unsigned shstrndx_number = 0;
 1455|  3.02k|    Dwarf_Bool have_shstrndx_number = FALSE;
  ------------------
  |  |   36|  3.02k|#define FALSE 0
  ------------------
 1456|  3.02k|    struct generic_ehdr *ehp = 0;
 1457|  3.02k|    int res = 0;
 1458|       |
 1459|  3.02k|    if (entsize < sizeof(dw_elf32_shdr)) {
  ------------------
  |  Branch (1459:9): [True: 5, False: 3.02k]
  ------------------
 1460|      5|        *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      5|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1461|      5|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      5|#define DW_DLV_ERROR      1
  ------------------
 1462|      5|    }
 1463|  3.02k|    ehp = ep->f_ehdr;
 1464|  3.02k|    if (!ehp->ge_shnum_in_shnum || !ehp->ge_strndx_in_strndx) {
  ------------------
  |  Branch (1464:9): [True: 93, False: 2.92k]
  |  Branch (1464:36): [True: 38, False: 2.88k]
  ------------------
 1465|    131|        res = get_counts_from_sec32_zero(ep,offset,
 1466|    131|            &have_shdr_count,&shdr_count,
 1467|    131|            &have_shstrndx_number,&shstrndx_number,
 1468|    131|            errcode);
 1469|    131|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    131|#define DW_DLV_OK         0
  ------------------
  |  Branch (1469:13): [True: 83, False: 48]
  ------------------
 1470|     83|            return res;
 1471|     83|        }
 1472|     48|        if (have_shdr_count) {
  ------------------
  |  Branch (1472:13): [True: 48, False: 0]
  ------------------
 1473|     48|            count = shdr_count;
 1474|     48|        }
 1475|     48|    }
 1476|  2.93k|    if (count == 0) {
  ------------------
  |  Branch (1476:9): [True: 0, False: 2.93k]
  ------------------
 1477|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1478|      0|    }
 1479|  2.93k|    if ((offset > ep->f_filesize)||
  ------------------
  |  Branch (1479:9): [True: 50, False: 2.88k]
  ------------------
 1480|  2.88k|        (entsize > 200)||
  ------------------
  |  Branch (1480:9): [True: 18, False: 2.86k]
  ------------------
 1481|  2.86k|        (count > ep->f_filesize) ||
  ------------------
  |  Branch (1481:9): [True: 55, False: 2.81k]
  ------------------
 1482|  2.81k|        ((count *entsize +offset) > ep->f_filesize)) {
  ------------------
  |  Branch (1482:9): [True: 25, False: 2.78k]
  ------------------
 1483|    148|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|    148|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1484|    148|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    148|#define DW_DLV_ERROR      1
  ------------------
 1485|    148|    }
 1486|  2.78k|    res = generic_shdr_from_shdr32(ep,&generic_count,
 1487|  2.78k|        offset,entsize,count,errcode);
 1488|  2.78k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.78k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1488:9): [True: 154, False: 2.63k]
  ------------------
 1489|    154|        return res;
 1490|    154|    }
 1491|  2.63k|    if (generic_count != count) {
  ------------------
  |  Branch (1491:9): [True: 0, False: 2.63k]
  ------------------
 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.63k|    return DW_DLV_OK;
  ------------------
  |  |   59|  2.63k|#define DW_DLV_OK         0
  ------------------
 1496|  2.63k|}
dwarf_elf_load_headers.c:get_counts_from_sec32_zero:
 1403|    131|{
 1404|    131|    dw_elf32_shdr       shd32;
 1405|    131|    struct generic_shdr shdg;
 1406|    131|    int res = 0;
 1407|    131|    Dwarf_Unsigned size = sizeof(shd32);
 1408|    131|    struct generic_ehdr * geh  = ep->f_ehdr;
 1409|       |
 1410|    131|    shd32 =  shd32zero;
 1411|    131|    shdg  = shdgzero;
 1412|    131|    res = RRMOA(ep->f_fd,&shd32,offset,size,
  ------------------
  |  |   65|    131|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    131|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1413|    131|        ep->f_filesize,errcode);
 1414|    131|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    131|#define DW_DLV_OK         0
  ------------------
  |  Branch (1414:9): [True: 46, False: 85]
  ------------------
 1415|     46|        return res;
 1416|     46|    }
 1417|     85|    copysection32(ep,&shdg,&shd32);
 1418|     85|    if (geh->ge_shnum_extended) {
  ------------------
  |  Branch (1418:9): [True: 57, False: 28]
  ------------------
 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: 2, False: 55]
  ------------------
 1422|      2|            *errcode = DW_DLE_TOO_FEW_SECTIONS;
  ------------------
  |  | 1540|      2|#define DW_DLE_TOO_FEW_SECTIONS                494
  ------------------
 1423|      2|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
 1424|      2|        }
 1425|     57|    }
 1426|     83|    *have_shdr_count = TRUE;
  ------------------
  |  |   33|     83|#define TRUE 1
  ------------------
 1427|     83|    *shdr_count = geh->ge_shnum;
 1428|     83|    if (geh->ge_strndx_extended) {
  ------------------
  |  Branch (1428:9): [True: 29, False: 54]
  ------------------
 1429|     29|        geh->ge_shstrndx = shdg.gh_link;
 1430|     29|        geh->ge_strndx_in_strndx = TRUE;
  ------------------
  |  |   33|     29|#define TRUE 1
  ------------------
 1431|     29|    }
 1432|     83|    if (geh->ge_shnum_in_shnum &&
  ------------------
  |  Branch (1432:9): [True: 83, False: 0]
  ------------------
 1433|     83|        geh->ge_strndx_in_strndx&&
  ------------------
  |  Branch (1433:9): [True: 83, False: 0]
  ------------------
 1434|     83|        (geh->ge_shstrndx >= geh->ge_shnum)) {
  ------------------
  |  Branch (1434:9): [True: 35, False: 48]
  ------------------
 1435|     35|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|     35|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
 1436|     35|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     35|#define DW_DLV_ERROR      1
  ------------------
 1437|     35|    }
 1438|     48|    *have_shstrndx_number = TRUE;
  ------------------
  |  |   33|     48|#define TRUE 1
  ------------------
 1439|     48|    *shstrndx_number = geh->ge_shstrndx;
 1440|     48|    return DW_DLV_OK;
  ------------------
  |  |   59|     48|#define DW_DLV_OK         0
  ------------------
 1441|     83|}
dwarf_elf_load_headers.c:copysection32:
  508|   208k|{
  509|   208k|    ASNAR(ep->f_copy_word,gshdr->gh_name,psh->sh_name);
  ------------------
  |  |   53|   208k|    do {                                        \
  |  |   54|   208k|        (t) = 0;                                \
  |  |   55|   208k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   208k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 208k]
  |  |  ------------------
  ------------------
  510|   208k|    ASNAR(ep->f_copy_word,gshdr->gh_type,psh->sh_type);
  ------------------
  |  |   53|   208k|    do {                                        \
  |  |   54|   208k|        (t) = 0;                                \
  |  |   55|   208k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   208k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 208k]
  |  |  ------------------
  ------------------
  511|   208k|    ASNAR(ep->f_copy_word,gshdr->gh_flags,psh->sh_flags);
  ------------------
  |  |   53|   208k|    do {                                        \
  |  |   54|   208k|        (t) = 0;                                \
  |  |   55|   208k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   208k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 208k]
  |  |  ------------------
  ------------------
  512|   208k|    ASNAR(ep->f_copy_word,gshdr->gh_addr,psh->sh_addr);
  ------------------
  |  |   53|   208k|    do {                                        \
  |  |   54|   208k|        (t) = 0;                                \
  |  |   55|   208k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   208k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 208k]
  |  |  ------------------
  ------------------
  513|   208k|    ASNAR(ep->f_copy_word,gshdr->gh_offset,psh->sh_offset);
  ------------------
  |  |   53|   208k|    do {                                        \
  |  |   54|   208k|        (t) = 0;                                \
  |  |   55|   208k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   208k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 208k]
  |  |  ------------------
  ------------------
  514|   208k|    ASNAR(ep->f_copy_word,gshdr->gh_size,psh->sh_size);
  ------------------
  |  |   53|   208k|    do {                                        \
  |  |   54|   208k|        (t) = 0;                                \
  |  |   55|   208k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   208k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 208k]
  |  |  ------------------
  ------------------
  515|   208k|    ASNAR(ep->f_copy_word,gshdr->gh_link,psh->sh_link);
  ------------------
  |  |   53|   208k|    do {                                        \
  |  |   54|   208k|        (t) = 0;                                \
  |  |   55|   208k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   208k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 208k]
  |  |  ------------------
  ------------------
  516|   208k|    ASNAR(ep->f_copy_word,gshdr->gh_info,psh->sh_info);
  ------------------
  |  |   53|   208k|    do {                                        \
  |  |   54|   208k|        (t) = 0;                                \
  |  |   55|   208k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   208k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 208k]
  |  |  ------------------
  ------------------
  517|   208k|    ASNAR(ep->f_copy_word,gshdr->gh_addralign,psh->sh_addralign);
  ------------------
  |  |   53|   208k|    do {                                        \
  |  |   54|   208k|        (t) = 0;                                \
  |  |   55|   208k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   208k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 208k]
  |  |  ------------------
  ------------------
  518|   208k|    ASNAR(ep->f_copy_word,gshdr->gh_entsize,psh->sh_entsize);
  ------------------
  |  |   53|   208k|    do {                                        \
  |  |   54|   208k|        (t) = 0;                                \
  |  |   55|   208k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   208k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 208k]
  |  |  ------------------
  ------------------
  519|   208k|}
dwarf_elf_load_headers.c:generic_shdr_from_shdr32:
  528|  2.78k|{
  529|  2.78k|    dw_elf32_shdr          *psh =0;
  530|  2.78k|    dw_elf32_shdr          *orig_psh =0;
  531|  2.78k|    struct generic_ehdr *ehdr = ep->f_ehdr;
  532|  2.78k|    struct generic_shdr *gshdr =0;
  533|  2.78k|    struct generic_shdr *orig_gshdr =0;
  534|  2.78k|    Dwarf_Unsigned i = 0;
  535|  2.78k|    int res = 0;
  536|       |
  537|  2.78k|    *count_out = 0;
  538|  2.78k|    psh = (dw_elf32_shdr *)calloc(count , entsize);
  539|  2.78k|    if (!psh) {
  ------------------
  |  Branch (539:9): [True: 0, False: 2.78k]
  ------------------
  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.78k|    gshdr = (struct generic_shdr *)calloc(count,sizeof(*gshdr));
  544|  2.78k|    if (!gshdr) {
  ------------------
  |  Branch (544:9): [True: 0, False: 2.78k]
  ------------------
  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.78k|    orig_psh = psh;
  551|  2.78k|    orig_gshdr = gshdr;
  552|  2.78k|    res = RRMOA(ep->f_fd,psh,offset,count*entsize,
  ------------------
  |  |   65|  2.78k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  2.78k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  553|  2.78k|        ep->f_filesize,errcode);
  554|  2.78k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.78k|#define DW_DLV_OK         0
  ------------------
  |  Branch (554:9): [True: 0, False: 2.78k]
  ------------------
  555|      0|        free(orig_psh);
  556|      0|        free(orig_gshdr);
  557|      0|        return res;
  558|      0|    }
  559|   211k|    for (i = 0; i < count;
  ------------------
  |  Branch (559:17): [True: 208k, False: 2.63k]
  ------------------
  560|   208k|        ++i,  psh++,gshdr++) {
  561|   208k|        int isempty     = FALSE;
  ------------------
  |  |   36|   208k|#define FALSE 0
  ------------------
  562|   208k|        int bitsoncount = 0;
  563|       |
  564|   208k|        gshdr->gh_secnum = i;
  565|   208k|        copysection32(ep,gshdr,psh);
  566|   208k|        if (gshdr->gh_size >= ep->f_filesize &&
  ------------------
  |  Branch (566:13): [True: 570, False: 207k]
  ------------------
  567|    570|            gshdr->gh_type != SHT_NOBITS) {
  ------------------
  |  |   87|    570|#define SHT_NOBITS 8
  ------------------
  |  Branch (567:13): [True: 9, False: 561]
  ------------------
  568|      9|            free(orig_psh);
  569|      9|            free(orig_gshdr);
  570|      9|            *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      9|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
  571|      9|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      9|#define DW_DLV_ERROR      1
  ------------------
  572|      9|        }
  573|   208k|        isempty = is_empty_section(gshdr->gh_type);
  574|   208k|        if (i == 0) {
  ------------------
  |  Branch (574:13): [True: 2.78k, False: 205k]
  ------------------
  575|  2.78k|            Dwarf_Unsigned shnum = 0;
  576|  2.78k|            Dwarf_Unsigned shstrx = 0;
  577|       |
  578|       |            /*  Catch errors asap */
  579|  2.78k|            if (!ehdr->ge_shnum_extended) {
  ------------------
  |  Branch (579:17): [True: 2.78k, False: 3]
  ------------------
  580|  2.78k|                shnum = gshdr->gh_size;
  581|  2.78k|            }
  582|  2.78k|            if (!ehdr->ge_strndx_extended) {
  ------------------
  |  Branch (582:17): [True: 2.78k, False: 7]
  ------------------
  583|  2.78k|                shstrx = gshdr->gh_link;
  584|  2.78k|            }
  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.78k|            if (!isempty || gshdr->gh_name || gshdr->gh_flags ||
  ------------------
  |  Branch (590:17): [True: 1, False: 2.78k]
  |  Branch (590:29): [True: 32, False: 2.75k]
  |  Branch (590:47): [True: 32, False: 2.72k]
  ------------------
  591|  2.72k|                shnum || shstrx ||
  ------------------
  |  Branch (591:17): [True: 4, False: 2.71k]
  |  Branch (591:26): [True: 1, False: 2.71k]
  ------------------
  592|  2.71k|                gshdr->gh_addr ||
  ------------------
  |  Branch (592:17): [True: 29, False: 2.68k]
  ------------------
  593|  2.68k|                gshdr->gh_info) {
  ------------------
  |  Branch (593:17): [True: 31, False: 2.65k]
  ------------------
  594|    130|                free(orig_psh);
  595|    130|                free(orig_gshdr);
  596|    130|                *errcode = DW_DLE_IMPROPER_SECTION_ZERO;
  ------------------
  |  | 1543|    130|#define DW_DLE_IMPROPER_SECTION_ZERO           497
  ------------------
  597|    130|                return DW_DLV_ERROR;
  ------------------
  |  |   60|    130|#define DW_DLV_ERROR      1
  ------------------
  598|    130|            }
  599|  2.78k|        }
  600|   208k|        bitsoncount = getbitsoncount(gshdr->gh_flags);
  601|   208k|        if (bitsoncount > 8) {
  ------------------
  |  Branch (601:13): [True: 15, False: 208k]
  ------------------
  602|     15|            free(orig_psh);
  603|     15|            free(orig_gshdr);
  604|     15|            *errcode = DW_DLE_BAD_SECTION_FLAGS;
  ------------------
  |  | 1542|     15|#define DW_DLE_BAD_SECTION_FLAGS               496
  ------------------
  605|     15|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     15|#define DW_DLV_ERROR      1
  ------------------
  606|     15|        }
  607|       |
  608|   208k|        if (gshdr->gh_type == SHT_REL || gshdr->gh_type == SHT_RELA){
  ------------------
  |  |   59|   416k|#define SHT_REL 9
  ------------------
                      if (gshdr->gh_type == SHT_REL || gshdr->gh_type == SHT_RELA){
  ------------------
  |  |   56|   206k|#define SHT_RELA 4
  ------------------
  |  Branch (608:13): [True: 1.65k, False: 206k]
  |  Branch (608:42): [True: 2.82k, False: 203k]
  ------------------
  609|  4.47k|            gshdr->gh_reloc_target_secnum = gshdr->gh_info;
  610|  4.47k|        }
  611|   208k|    }
  612|  2.63k|    free(orig_psh);
  613|  2.63k|    *count_out = count;
  614|  2.63k|    ep->f_shdr = orig_gshdr;
  615|  2.63k|    ep->f_loc_shdr.g_name = "Section Header";
  616|  2.63k|    ep->f_loc_shdr.g_count = count;
  617|  2.63k|    ep->f_loc_shdr.g_offset = offset;
  618|  2.63k|    ep->f_loc_shdr.g_entrysize = sizeof(dw_elf32_shdr);
  619|  2.63k|    ep->f_loc_shdr.g_totalsize = sizeof(dw_elf32_shdr)*count;
  620|  2.63k|    return DW_DLV_OK;
  ------------------
  |  |   59|  2.63k|#define DW_DLV_OK         0
  ------------------
  621|  2.78k|}
dwarf_elf_load_headers.c:getbitsoncount:
  152|   216k|{
  153|   216k|    int           bitscount = 0;
  154|   216k|    Dwarf_Unsigned v = v_in;
  155|       |
  156|   320k|    while (v) {
  ------------------
  |  Branch (156:12): [True: 103k, False: 216k]
  ------------------
  157|   103k|        unsigned int nibble = v & 0xf;
  158|   103k|        bitscount += nibblecounts[nibble];
  159|   103k|        v >>= 4;
  160|   103k|    }
  161|   216k|    return bitscount;
  162|   216k|}
dwarf_elf_load_headers.c:elf_load_sectheaders64:
 1555|  1.48k|{
 1556|  1.48k|    Dwarf_Unsigned generic_count = 0;
 1557|  1.48k|    Dwarf_Unsigned shdr_count = 0;
 1558|  1.48k|    Dwarf_Bool have_shdr_count = FALSE;
  ------------------
  |  |   36|  1.48k|#define FALSE 0
  ------------------
 1559|  1.48k|    Dwarf_Unsigned shstrndx_number = 0;
 1560|  1.48k|    Dwarf_Bool have_shstrndx_number = FALSE;
  ------------------
  |  |   36|  1.48k|#define FALSE 0
  ------------------
 1561|  1.48k|    struct generic_ehdr *ehp = 0;
 1562|  1.48k|    int res = 0;
 1563|       |
 1564|  1.48k|    ehp = ep->f_ehdr;
 1565|  1.48k|    if (!ehp->ge_shnum_in_shnum || !ehp->ge_strndx_in_strndx ) {
  ------------------
  |  Branch (1565:9): [True: 157, False: 1.32k]
  |  Branch (1565:36): [True: 393, False: 933]
  ------------------
 1566|    550|        res = get_counts_from_sec64_zero(ep,offset,
 1567|    550|            &have_shdr_count,&shdr_count,
 1568|    550|            &have_shstrndx_number,&shstrndx_number,
 1569|    550|            errcode);
 1570|    550|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    550|#define DW_DLV_OK         0
  ------------------
  |  Branch (1570:13): [True: 61, False: 489]
  ------------------
 1571|     61|            return res;
 1572|     61|        }
 1573|    489|        if (have_shdr_count) {
  ------------------
  |  Branch (1573:13): [True: 489, False: 0]
  ------------------
 1574|    489|            count = shdr_count;
 1575|    489|        }
 1576|    489|    }
 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: 30, False: 1.39k]
  ------------------
 1581|     30|        *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|     30|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1582|     30|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     30|#define DW_DLV_ERROR      1
  ------------------
 1583|     30|    }
 1584|  1.39k|    if ((offset > ep->f_filesize)||
  ------------------
  |  Branch (1584:9): [True: 98, False: 1.29k]
  ------------------
 1585|  1.29k|        (entsize > 200)||
  ------------------
  |  Branch (1585:9): [True: 18, False: 1.27k]
  ------------------
 1586|  1.27k|        (count > ep->f_filesize) ||
  ------------------
  |  Branch (1586:9): [True: 86, False: 1.19k]
  ------------------
 1587|  1.19k|        ((count *entsize +offset) > ep->f_filesize)) {
  ------------------
  |  Branch (1587:9): [True: 47, False: 1.14k]
  ------------------
 1588|    249|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|    249|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1589|    249|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    249|#define DW_DLV_ERROR      1
  ------------------
 1590|    249|    }
 1591|       |
 1592|  1.14k|    res = generic_shdr_from_shdr64(ep,&generic_count,
 1593|  1.14k|        offset,entsize,count,errcode);
 1594|  1.14k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.14k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1594:9): [True: 328, False: 815]
  ------------------
 1595|    328|        return res;
 1596|    328|    }
 1597|    815|    if (generic_count != count) {
  ------------------
  |  Branch (1597:9): [True: 0, False: 815]
  ------------------
 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|    815|    return DW_DLV_OK;
  ------------------
  |  |   59|    815|#define DW_DLV_OK         0
  ------------------
 1602|    815|}
dwarf_elf_load_headers.c:get_counts_from_sec64_zero:
 1509|    550|{
 1510|    550|    dw_elf64_shdr       shd64;
 1511|    550|    struct generic_shdr shdg;
 1512|    550|    int res = 0;
 1513|    550|    Dwarf_Unsigned size = sizeof(shd64);
 1514|    550|    struct generic_ehdr * geh  = ep->f_ehdr;
 1515|       |
 1516|    550|    shd64 =  shd64zero;
 1517|    550|    shdg  = shdgzero;
 1518|    550|    res = RRMOA(ep->f_fd,&shd64,offset,size,
  ------------------
  |  |   65|    550|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    550|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1519|    550|        ep->f_filesize,errcode);
 1520|    550|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    550|#define DW_DLV_OK         0
  ------------------
  |  Branch (1520:9): [True: 56, False: 494]
  ------------------
 1521|     56|        return res;
 1522|     56|    }
 1523|    494|    copysection64(ep,&shdg,&shd64);
 1524|    494|    if (geh->ge_shnum_extended) {
  ------------------
  |  Branch (1524:9): [True: 125, False: 369]
  ------------------
 1525|    125|        geh->ge_shnum = shdg.gh_size;
 1526|    125|        geh->ge_shnum_in_shnum = TRUE;
  ------------------
  |  |   33|    125|#define TRUE 1
  ------------------
 1527|    125|        if (geh->ge_shnum  < 3) {
  ------------------
  |  Branch (1527:13): [True: 2, False: 123]
  ------------------
 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|    125|    }
 1532|    492|    *have_shdr_count = TRUE;
  ------------------
  |  |   33|    492|#define TRUE 1
  ------------------
 1533|    492|    *shdr_count = geh->ge_shnum;
 1534|    492|    if (geh->ge_strndx_extended) {
  ------------------
  |  Branch (1534:9): [True: 378, False: 114]
  ------------------
 1535|    378|        geh->ge_shstrndx = shdg.gh_link;
 1536|    378|        geh->ge_strndx_in_strndx = TRUE;
  ------------------
  |  |   33|    378|#define TRUE 1
  ------------------
 1537|    378|    }
 1538|    492|    if (geh->ge_shnum_in_shnum    &&
  ------------------
  |  Branch (1538:9): [True: 492, False: 0]
  ------------------
 1539|    492|        geh->ge_strndx_in_strndx &&
  ------------------
  |  Branch (1539:9): [True: 492, False: 0]
  ------------------
 1540|    492|        (geh->ge_shstrndx >= geh->ge_shnum)) {
  ------------------
  |  Branch (1540:9): [True: 3, False: 489]
  ------------------
 1541|      3|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|      3|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
 1542|      3|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
 1543|      3|    }
 1544|       |
 1545|    489|    *have_shstrndx_number = TRUE;
  ------------------
  |  |   33|    489|#define TRUE 1
  ------------------
 1546|    489|    *shstrndx_number = geh->ge_shstrndx;
 1547|    489|    return DW_DLV_OK;
  ------------------
  |  |   59|    489|#define DW_DLV_OK         0
  ------------------
 1548|    492|}
dwarf_elf_load_headers.c:copysection64:
  628|  8.98k|{
  629|  8.98k|    ASNAR(ep->f_copy_word,gshdr->gh_name,psh->sh_name);
  ------------------
  |  |   53|  8.98k|    do {                                        \
  |  |   54|  8.98k|        (t) = 0;                                \
  |  |   55|  8.98k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  8.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 8.98k]
  |  |  ------------------
  ------------------
  630|  8.98k|    ASNAR(ep->f_copy_word,gshdr->gh_type,psh->sh_type);
  ------------------
  |  |   53|  8.98k|    do {                                        \
  |  |   54|  8.98k|        (t) = 0;                                \
  |  |   55|  8.98k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  8.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 8.98k]
  |  |  ------------------
  ------------------
  631|  8.98k|    ASNAR(ep->f_copy_word,gshdr->gh_flags,psh->sh_flags);
  ------------------
  |  |   53|  8.98k|    do {                                        \
  |  |   54|  8.98k|        (t) = 0;                                \
  |  |   55|  8.98k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  8.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 8.98k]
  |  |  ------------------
  ------------------
  632|  8.98k|    ASNAR(ep->f_copy_word,gshdr->gh_addr,psh->sh_addr);
  ------------------
  |  |   53|  8.98k|    do {                                        \
  |  |   54|  8.98k|        (t) = 0;                                \
  |  |   55|  8.98k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  8.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 8.98k]
  |  |  ------------------
  ------------------
  633|  8.98k|    ASNAR(ep->f_copy_word,gshdr->gh_offset,psh->sh_offset);
  ------------------
  |  |   53|  8.98k|    do {                                        \
  |  |   54|  8.98k|        (t) = 0;                                \
  |  |   55|  8.98k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  8.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 8.98k]
  |  |  ------------------
  ------------------
  634|  8.98k|    ASNAR(ep->f_copy_word,gshdr->gh_size,psh->sh_size);
  ------------------
  |  |   53|  8.98k|    do {                                        \
  |  |   54|  8.98k|        (t) = 0;                                \
  |  |   55|  8.98k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  8.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 8.98k]
  |  |  ------------------
  ------------------
  635|  8.98k|    ASNAR(ep->f_copy_word,gshdr->gh_link,psh->sh_link);
  ------------------
  |  |   53|  8.98k|    do {                                        \
  |  |   54|  8.98k|        (t) = 0;                                \
  |  |   55|  8.98k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  8.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 8.98k]
  |  |  ------------------
  ------------------
  636|  8.98k|    ASNAR(ep->f_copy_word,gshdr->gh_info,psh->sh_info);
  ------------------
  |  |   53|  8.98k|    do {                                        \
  |  |   54|  8.98k|        (t) = 0;                                \
  |  |   55|  8.98k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  8.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 8.98k]
  |  |  ------------------
  ------------------
  637|  8.98k|    ASNAR(ep->f_copy_word,gshdr->gh_addralign,psh->sh_addralign);
  ------------------
  |  |   53|  8.98k|    do {                                        \
  |  |   54|  8.98k|        (t) = 0;                                \
  |  |   55|  8.98k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  8.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 8.98k]
  |  |  ------------------
  ------------------
  638|  8.98k|    ASNAR(ep->f_copy_word,gshdr->gh_entsize,psh->sh_entsize);
  ------------------
  |  |   53|  8.98k|    do {                                        \
  |  |   54|  8.98k|        (t) = 0;                                \
  |  |   55|  8.98k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  8.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 8.98k]
  |  |  ------------------
  ------------------
  639|  8.98k|}
dwarf_elf_load_headers.c:generic_shdr_from_shdr64:
  648|  1.14k|{
  649|  1.14k|    dw_elf64_shdr          *psh =0;
  650|  1.14k|    dw_elf64_shdr          *orig_psh =0;
  651|  1.14k|    struct generic_shdr *gshdr =0;
  652|  1.14k|    struct generic_shdr *orig_gshdr =0;
  653|  1.14k|    struct generic_ehdr *ehdr = ep->f_ehdr;
  654|  1.14k|    Dwarf_Unsigned i = 0;
  655|  1.14k|    int res = 0;
  656|       |
  657|  1.14k|    *count_out = 0;
  658|  1.14k|    psh = (dw_elf64_shdr *)calloc(count , entsize);
  659|  1.14k|    if (!psh) {
  ------------------
  |  Branch (659:9): [True: 0, False: 1.14k]
  ------------------
  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.14k|    gshdr = (struct generic_shdr *)calloc(count,sizeof(*gshdr));
  664|  1.14k|    if (gshdr == 0) {
  ------------------
  |  Branch (664:9): [True: 0, False: 1.14k]
  ------------------
  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.14k|    orig_psh = psh;
  670|  1.14k|    orig_gshdr = gshdr;
  671|  1.14k|    res = RRMOA(ep->f_fd,psh,offset,count*entsize,
  ------------------
  |  |   65|  1.14k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  1.14k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  672|  1.14k|        ep->f_filesize,errcode);
  673|  1.14k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.14k|#define DW_DLV_OK         0
  ------------------
  |  Branch (673:9): [True: 0, False: 1.14k]
  ------------------
  674|      0|        free(orig_psh);
  675|      0|        free(orig_gshdr);
  676|      0|        return res;
  677|      0|    }
  678|  9.30k|    for ( i = 0; i < count;
  ------------------
  |  Branch (678:18): [True: 8.48k, False: 815]
  ------------------
  679|  8.48k|        ++i,  psh++,gshdr++) {
  680|  8.48k|        int bitsoncount = 0;
  681|  8.48k|        int isempty = FALSE;
  ------------------
  |  |   36|  8.48k|#define FALSE 0
  ------------------
  682|       |
  683|  8.48k|        gshdr->gh_secnum = i;
  684|  8.48k|        copysection64(ep,gshdr,psh);
  685|  8.48k|        if (gshdr->gh_size >= ep->f_filesize &&
  ------------------
  |  Branch (685:13): [True: 641, False: 7.84k]
  ------------------
  686|    641|            gshdr->gh_type != SHT_NOBITS) {
  ------------------
  |  |   87|    641|#define SHT_NOBITS 8
  ------------------
  |  Branch (686:13): [True: 33, False: 608]
  ------------------
  687|     33|            free(orig_psh);
  688|     33|            free(orig_gshdr);
  689|     33|            *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|     33|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
  690|     33|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     33|#define DW_DLV_ERROR      1
  ------------------
  691|     33|        }
  692|  8.45k|        isempty = is_empty_section(gshdr->gh_type);
  693|  8.45k|        if (i == 0) {
  ------------------
  |  Branch (693:13): [True: 1.13k, False: 7.32k]
  ------------------
  694|  1.13k|            Dwarf_Unsigned shnum = 0;
  695|  1.13k|            Dwarf_Unsigned shstrx = 0;
  696|       |
  697|       |            /*  Catch errors asap */
  698|  1.13k|            if (!ehdr->ge_shnum_extended) {
  ------------------
  |  Branch (698:17): [True: 1.13k, False: 2]
  ------------------
  699|  1.13k|                shnum = gshdr->gh_size;
  700|  1.13k|            }
  701|  1.13k|            if (!ehdr->ge_strndx_extended) {
  ------------------
  |  Branch (701:17): [True: 774, False: 359]
  ------------------
  702|    774|                shstrx = gshdr->gh_link;
  703|    774|            }
  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.13k|            if (!isempty || gshdr->gh_name || gshdr->gh_flags ||
  ------------------
  |  Branch (708:17): [True: 2, False: 1.13k]
  |  Branch (708:29): [True: 18, False: 1.11k]
  |  Branch (708:47): [True: 112, False: 1.00k]
  ------------------
  709|  1.00k|                shnum || shstrx ||
  ------------------
  |  Branch (709:17): [True: 1, False: 1.00k]
  |  Branch (709:26): [True: 1, False: 999]
  ------------------
  710|    999|                gshdr->gh_addr ||
  ------------------
  |  Branch (710:17): [True: 67, False: 932]
  ------------------
  711|    932|                gshdr->gh_info) {
  ------------------
  |  Branch (711:17): [True: 19, False: 913]
  ------------------
  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.13k|        }
  718|  8.23k|        bitsoncount = getbitsoncount(gshdr->gh_flags);
  719|  8.23k|        if (bitsoncount > 8) {
  ------------------
  |  Branch (719:13): [True: 75, False: 8.15k]
  ------------------
  720|     75|            free(orig_psh);
  721|     75|            free(orig_gshdr);
  722|     75|            *errcode = DW_DLE_BAD_SECTION_FLAGS;
  ------------------
  |  | 1542|     75|#define DW_DLE_BAD_SECTION_FLAGS               496
  ------------------
  723|     75|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     75|#define DW_DLV_ERROR      1
  ------------------
  724|     75|        }
  725|       |
  726|  8.15k|        if (gshdr->gh_type == SHT_REL ||
  ------------------
  |  |   59|  16.3k|#define SHT_REL 9
  ------------------
  |  Branch (726:13): [True: 589, False: 7.56k]
  ------------------
  727|  7.56k|            gshdr->gh_type == SHT_RELA){
  ------------------
  |  |   56|  7.56k|#define SHT_RELA 4
  ------------------
  |  Branch (727:13): [True: 1.19k, False: 6.37k]
  ------------------
  728|  1.77k|            gshdr->gh_reloc_target_secnum = gshdr->gh_info;
  729|  1.77k|        }
  730|  8.15k|    }
  731|    815|    free(orig_psh);
  732|    815|    *count_out = count;
  733|    815|    ep->f_shdr = orig_gshdr;
  734|    815|    ep->f_loc_shdr.g_name = "Section Header";
  735|    815|    ep->f_loc_shdr.g_count = count;
  736|    815|    ep->f_loc_shdr.g_offset = offset;
  737|    815|    ep->f_loc_shdr.g_entrysize = sizeof(dw_elf64_shdr);
  738|    815|    ep->f_loc_shdr.g_totalsize = sizeof(dw_elf64_shdr)*count;
  739|    815|    return DW_DLV_OK;
  ------------------
  |  |   59|    815|#define DW_DLV_OK         0
  ------------------
  740|  1.14k|}
dwarf_elf_load_headers.c:_dwarf_elf_load_sectstrings:
 1313|  3.45k|{
 1314|  3.45k|    int res = 0;
 1315|  3.45k|    struct generic_shdr *psh = 0;
 1316|  3.45k|    Dwarf_Unsigned secoffset = 0;
 1317|  3.45k|    Dwarf_Unsigned flags =  0;
 1318|       |
 1319|  3.45k|    if (stringsection >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (1319:9): [True: 0, False: 3.45k]
  ------------------
 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.45k|    psh = ep->f_shdr+stringsection;
 1324|  3.45k|    flags = psh->gh_flags;
 1325|       |
 1326|  3.45k|    secoffset = psh->gh_offset;
 1327|  3.45k|    if (is_empty_section(psh->gh_type)) {
  ------------------
  |  Branch (1327:9): [True: 27, False: 3.42k]
  ------------------
 1328|     27|        *errcode = DW_DLE_ELF_STRING_SECTION_MISSING;
  ------------------
  |  | 1489|     27|#define DW_DLE_ELF_STRING_SECTION_MISSING      443
  ------------------
 1329|     27|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     27|#define DW_DLV_ERROR      1
  ------------------
 1330|     27|    }
 1331|  3.42k|    if (secoffset >= ep->f_filesize ||
  ------------------
  |  Branch (1331:9): [True: 107, False: 3.31k]
  ------------------
 1332|  3.31k|        psh->gh_size > ep->f_filesize ||
  ------------------
  |  Branch (1332:9): [True: 0, False: 3.31k]
  ------------------
 1333|  3.31k|        (secoffset + psh->gh_size) > ep->f_filesize) {
  ------------------
  |  Branch (1333:9): [True: 26, False: 3.29k]
  ------------------
 1334|    133|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|    133|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1335|    133|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    133|#define DW_DLV_ERROR      1
  ------------------
 1336|    133|    }
 1337|  3.29k|    if (psh->gh_content) {
  ------------------
  |  Branch (1337:9): [True: 0, False: 3.29k]
  ------------------
 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.29k|    psh->gh_content = (char *)calloc(1,psh->gh_size+1);
 1343|  3.29k|    if (!psh->gh_content) {
  ------------------
  |  Branch (1343:9): [True: 0, False: 3.29k]
  ------------------
 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.29k|    res = RRMOA(ep->f_fd,psh->gh_content,secoffset,
  ------------------
  |  |   65|  3.29k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  3.29k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1348|  3.29k|        psh->gh_size,
 1349|  3.29k|        ep->f_filesize,errcode);
 1350|  3.29k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  3.29k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1350:9): [True: 0, False: 3.29k]
  ------------------
 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.29k|    psh->gh_load_type = Dwarf_Alloc_Malloc;
 1358|  3.29k|    psh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|  3.29k|#define TRUE 1
  ------------------
 1359|  3.29k|    ep->f_elf_shstrings_index = stringsection;
 1360|  3.29k|    ep->f_elf_shstrings_max = psh->gh_size;
 1361|  3.29k|    ep->f_elf_shstrings_length = psh->gh_size;
 1362|  3.29k|    ep->f_elf_shstrings_data = psh->gh_content;
 1363|  3.29k|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|  3.29k|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (1363:9): [True: 3, False: 3.28k]
  ------------------
 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|      3|        free(psh->gh_content);
 1377|      3|        psh->gh_content = 0;
 1378|      3|        ep->f_elf_shstrings_max = 0;
 1379|      3|        ep->f_elf_shstrings_length = 0;
 1380|      3|        ep->f_elf_shstrings_data = 0;
 1381|      3|        psh->gh_was_alloc = FALSE;
  ------------------
  |  |   36|      3|#define FALSE 0
  ------------------
 1382|      3|        *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      3|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
 1383|      3|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
 1384|      3|#endif /* COMPRESSED TEST */
 1385|      3|    }
 1386|  3.28k|    return DW_DLV_OK;
  ------------------
  |  |   59|  3.28k|#define DW_DLV_OK         0
  ------------------
 1387|  3.29k|}
dwarf_elf_load_headers.c:_dwarf_elf_load_sect_namestrings:
 1887|  3.28k|{
 1888|  3.28k|    struct generic_shdr *gshdr = 0;
 1889|  3.28k|    Dwarf_Unsigned generic_count = 0;
 1890|  3.28k|    Dwarf_Unsigned i = 1;
 1891|  3.28k|    const char *stringsecbase = 0;
 1892|       |
 1893|  3.28k|    stringsecbase = ep->f_elf_shstrings_data;
 1894|  3.28k|    gshdr = ep->f_shdr;
 1895|  3.28k|    generic_count = ep->f_loc_shdr.g_count;
 1896|       |    /*  Here we ensure gh_namestring set to something with
 1897|       |        null termination */
 1898|   210k|    for (i = 0; i < generic_count; i++, ++gshdr) {
  ------------------
  |  Branch (1898:17): [True: 206k, False: 3.23k]
  ------------------
 1899|   206k|        const char *namestr =
 1900|   206k|            "<No valid Elf section strings exist>";
 1901|   206k|        int res = 0;
 1902|       |
 1903|   206k|        if (!ep->f_ehdr->ge_shstrndx || !stringsecbase) {
  ------------------
  |  Branch (1903:13): [True: 0, False: 206k]
  |  Branch (1903:41): [True: 0, False: 206k]
  ------------------
 1904|      0|            gshdr->gh_namestring = namestr;
 1905|      0|            continue;
 1906|      0|        }
 1907|   206k|        namestr = "<Invalid sh_name value. Corrupt Elf.>";
 1908|   206k|        res = validate_section_name_string(ep->f_elf_shstrings_length,
 1909|   206k|            gshdr->gh_name, stringsecbase,
 1910|   206k|            errcode);
 1911|   206k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|   206k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1911:13): [True: 53, False: 206k]
  ------------------
 1912|     53|            gshdr->gh_namestring = namestr;
 1913|     53|            if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|     53|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1913:17): [True: 53, False: 0]
  ------------------
 1914|     53|                return res;
 1915|     53|            }
 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|   206k|        } else {
 1920|   206k|            gshdr->gh_namestring = stringsecbase + gshdr->gh_name;
 1921|   206k|        }
 1922|   206k|    }
 1923|  3.23k|    return DW_DLV_OK;
  ------------------
  |  |   59|  3.23k|#define DW_DLV_OK         0
  ------------------
 1924|  3.28k|}
dwarf_elf_load_headers.c:validate_section_name_string:
 1861|   206k|{
 1862|   206k|    const char *endpoint = strings_start + section_length;
 1863|   206k|    const char *cur = 0;
 1864|       |
 1865|   206k|    if (section_length <= string_loc_index) {
  ------------------
  |  Branch (1865:9): [True: 51, False: 206k]
  ------------------
 1866|     51|        *errcode = DW_DLE_SECTION_STRING_OFFSET_BAD;
  ------------------
  |  | 1483|     51|#define DW_DLE_SECTION_STRING_OFFSET_BAD       437
  ------------------
 1867|     51|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     51|#define DW_DLV_ERROR      1
  ------------------
 1868|     51|    }
 1869|   206k|    cur = string_loc_index+strings_start;
 1870|  14.5M|    for ( ; cur < endpoint;++cur) {
  ------------------
  |  Branch (1870:13): [True: 14.5M, False: 2]
  ------------------
 1871|  14.5M|        if (!*cur) {
  ------------------
  |  Branch (1871:13): [True: 206k, False: 14.3M]
  ------------------
 1872|   206k|            return DW_DLV_OK;
  ------------------
  |  |   59|   206k|#define DW_DLV_OK         0
  ------------------
 1873|   206k|        }
 1874|  14.5M|    }
 1875|      2|    *errcode = DW_DLE_SECTION_STRING_OFFSET_BAD;
  ------------------
  |  | 1483|      2|#define DW_DLE_SECTION_STRING_OFFSET_BAD       437
  ------------------
 1876|      2|    return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
 1877|   206k|}
dwarf_elf_load_headers.c:_dwarf_elf_find_sym_sections:
 2342|  3.23k|{
 2343|  3.23k|    struct generic_shdr* psh = 0;
 2344|  3.23k|    Dwarf_Unsigned i = 0;
 2345|  3.23k|    Dwarf_Unsigned count = 0;
 2346|  3.23k|    int res = 0;
 2347|       |
 2348|  3.23k|    count = ep->f_loc_shdr.g_count;
 2349|  3.23k|    psh = ep->f_shdr;
 2350|   210k|    for (i = 0; i < count; ++psh,++i) {
  ------------------
  |  Branch (2350:17): [True: 206k, False: 3.23k]
  ------------------
 2351|   206k|        const char *name = psh->gh_namestring;
 2352|   206k|        if (is_empty_section(psh->gh_type)) {
  ------------------
  |  Branch (2352:13): [True: 189k, False: 17.5k]
  ------------------
 2353|       |            /*  No data here. */
 2354|   189k|            continue;
 2355|   189k|        }
 2356|  17.5k|        if (!strcmp(name,".dynsym")) {
  ------------------
  |  Branch (2356:13): [True: 207, False: 17.3k]
  ------------------
 2357|    207|            ep->f_dynsym_sect_index = i;
 2358|    207|            ep->f_loc_dynsym.g_offset = psh->gh_offset;
 2359|  17.3k|        } else if (!strcmp(name,".dynstr")) {
  ------------------
  |  Branch (2359:20): [True: 210, False: 17.1k]
  ------------------
 2360|    210|            ep->f_dynsym_sect_strings_sect_index = i;
 2361|    210|            ep->f_dynsym_sect_strings_max = psh->gh_size;
 2362|  17.1k|        } else if (!strcmp(name,".symtab")) {
  ------------------
  |  Branch (2362:20): [True: 314, False: 16.8k]
  ------------------
 2363|    314|            ep->f_symtab_sect_index = i;
 2364|    314|            ep->f_loc_symtab.g_offset = psh->gh_offset;
 2365|  16.8k|        } else if (!strcmp(name,".strtab")) {
  ------------------
  |  Branch (2365:20): [True: 762, False: 16.0k]
  ------------------
 2366|    762|            ep->f_symtab_sect_strings_sect_index = i;
 2367|    762|            ep->f_symtab_sect_strings_max = psh->gh_size;
 2368|  16.0k|        } else if (!strcmp(name,".dynamic")) {
  ------------------
  |  Branch (2368:20): [True: 214, False: 15.8k]
  ------------------
 2369|    214|            ep->f_dynamic_sect_index = i;
 2370|    214|            ep->f_loc_dynamic.g_offset = psh->gh_offset;
 2371|    214|        }
 2372|  17.5k|    }
 2373|  3.23k|    res = validate_links(ep,ep->f_symtab_sect_index,
 2374|  3.23k|        ep->f_symtab_sect_strings_sect_index,errcode);
 2375|  3.23k|    if (res!= DW_DLV_OK) {
  ------------------
  |  |   59|  3.23k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2375:9): [True: 39, False: 3.19k]
  ------------------
 2376|     39|        return res;
 2377|     39|    }
 2378|  3.19k|    return DW_DLV_OK;
  ------------------
  |  |   59|  3.19k|#define DW_DLV_OK         0
  ------------------
 2379|  3.23k|}
dwarf_elf_load_headers.c:validate_links:
 2018|  3.23k|{
 2019|  3.23k|    struct generic_shdr* pshk = 0;
 2020|       |
 2021|  3.23k|    if (!knownsect) {
  ------------------
  |  Branch (2021:9): [True: 3.12k, False: 109]
  ------------------
 2022|  3.12k|        return DW_DLV_OK;
  ------------------
  |  |   59|  3.12k|#define DW_DLV_OK         0
  ------------------
 2023|  3.12k|    }
 2024|    109|    if (!string_sect) {
  ------------------
  |  Branch (2024:9): [True: 7, False: 102]
  ------------------
 2025|      7|        *errcode = DW_DLE_ELF_STRING_SECTION_ERROR;
  ------------------
  |  | 1493|      7|#define DW_DLE_ELF_STRING_SECTION_ERROR        447
  ------------------
 2026|      7|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      7|#define DW_DLV_ERROR      1
  ------------------
 2027|      7|    }
 2028|    102|    pshk = ep->f_shdr + knownsect;
 2029|    102|    if (string_sect != pshk->gh_link) {
  ------------------
  |  Branch (2029:9): [True: 32, False: 70]
  ------------------
 2030|     32|        *errcode = DW_DLE_ELF_SECTION_LINK_ERROR;
  ------------------
  |  | 1486|     32|#define DW_DLE_ELF_SECTION_LINK_ERROR          440
  ------------------
 2031|     32|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     32|#define DW_DLV_ERROR      1
  ------------------
 2032|     32|    }
 2033|     70|    return DW_DLV_OK;
  ------------------
  |  |   59|     70|#define DW_DLV_OK         0
  ------------------
 2034|    102|}
dwarf_elf_load_headers.c:_dwarf_elf_setup_all_section_groups:
 2263|  3.19k|{
 2264|  3.19k|    struct generic_shdr* psh = 0;
 2265|  3.19k|    Dwarf_Unsigned i = 0;
 2266|  3.19k|    Dwarf_Unsigned count = 0;
 2267|  3.19k|    int res = 0;
 2268|       |
 2269|  3.19k|    count = ep->f_loc_shdr.g_count;
 2270|  3.19k|    psh = ep->f_shdr;
 2271|       |
 2272|       |    /* Does step A and step B */
 2273|   203k|    for (i = 0; i < count; ++psh,++i) {
  ------------------
  |  Branch (2273:17): [True: 200k, False: 2.92k]
  ------------------
 2274|   200k|        const char *name = psh->gh_namestring;
 2275|       |
 2276|   200k|        if (is_empty_section(psh->gh_type)) {
  ------------------
  |  Branch (2276:13): [True: 183k, False: 16.3k]
  ------------------
 2277|       |            /*  No data here. */
 2278|   183k|            continue;
 2279|   183k|        }
 2280|  16.3k|        if (elf_sht_groupsec(psh->gh_type,name)) {
  ------------------
  |  Branch (2280:13): [True: 1.40k, False: 14.9k]
  ------------------
 2281|  1.40k|            ep->f_shf_group_flag_section_count++;
 2282|  14.9k|        } else {
 2283|  14.9k|            continue;
 2284|  14.9k|        }
 2285|       |        /* Looks like a section group. Do Step A. */
 2286|  1.40k|        res  =read_gs_section_group(ep,psh,errcode);
 2287|  1.40k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.40k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2287:13): [True: 275, False: 1.13k]
  ------------------
 2288|    275|            return res;
 2289|    275|        }
 2290|  1.40k|    }
 2291|       |    /*  Any sections not marked above or here are in
 2292|       |        grep DW_GROUPNUMBER_BASE (1).
 2293|       |        Section C. */
 2294|  2.92k|    psh = ep->f_shdr;
 2295|   201k|    for (i = 0; i < count; ++psh,++i) {
  ------------------
  |  Branch (2295:17): [True: 198k, False: 2.91k]
  ------------------
 2296|   198k|        const char *name = psh->gh_namestring;
 2297|   198k|        int is_rel = FALSE;
  ------------------
  |  |   36|   198k|#define FALSE 0
  ------------------
 2298|   198k|        int is_rela = FALSE;
  ------------------
  |  |   36|   198k|#define FALSE 0
  ------------------
 2299|       |
 2300|   198k|        if (is_empty_section(psh->gh_type)) {
  ------------------
  |  Branch (2300:13): [True: 183k, False: 15.6k]
  ------------------
 2301|       |            /*  No data here. */
 2302|   183k|            continue;
 2303|   183k|        }
 2304|  15.6k|        if (elf_sht_groupsec(psh->gh_type,name)) {
  ------------------
  |  Branch (2304:13): [True: 1.05k, False: 14.6k]
  ------------------
 2305|  1.05k|            continue;
 2306|  1.05k|        }
 2307|       |        /* Not a section group */
 2308|  14.6k|        if (string_endswith(name,".dwo")) {
  ------------------
  |  Branch (2308:13): [True: 1.32k, False: 13.3k]
  ------------------
 2309|  1.32k|            if (psh->gh_section_group_number) {
  ------------------
  |  Branch (2309:17): [True: 1, False: 1.32k]
  ------------------
 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.32k|            psh->gh_is_dwarf = TRUE;
  ------------------
  |  |   33|  1.32k|#define TRUE 1
  ------------------
 2315|  1.32k|            psh->gh_section_group_number = DW_GROUPNUMBER_DWO;
  ------------------
  |  |  128|  1.32k|#define DW_GROUPNUMBER_DWO  2
  ------------------
 2316|  1.32k|            ep->f_dwo_group_section_count++;
 2317|  13.3k|        } else if (_dwarf_load_elf_section_is_dwarf(name,
  ------------------
  |  Branch (2317:20): [True: 6.95k, False: 6.35k]
  ------------------
 2318|  13.3k|            psh->gh_type,
 2319|  13.3k|            &is_rela,&is_rel)) {
 2320|  6.95k|            if (!psh->gh_section_group_number) {
  ------------------
  |  Branch (2320:17): [True: 6.89k, False: 53]
  ------------------
 2321|  6.89k|                psh->gh_section_group_number = DW_GROUPNUMBER_BASE;
  ------------------
  |  |  127|  6.89k|#define DW_GROUPNUMBER_BASE 1
  ------------------
 2322|  6.89k|            }
 2323|  6.95k|            psh->gh_is_dwarf = TRUE;
  ------------------
  |  |   33|  6.95k|#define TRUE 1
  ------------------
 2324|  6.95k|        } else {
 2325|       |            /* Do nothing. */
 2326|  6.35k|        }
 2327|  14.6k|    }
 2328|  2.91k|    if (ep->f_sht_group_type_section_count) {
  ------------------
  |  Branch (2328:9): [True: 249, False: 2.67k]
  ------------------
 2329|       |        /*  Not ARM. Done. */
 2330|    249|    }
 2331|  2.91k|    if (!ep->f_shf_group_flag_section_count) {
  ------------------
  |  Branch (2331:9): [True: 2.62k, False: 294]
  ------------------
 2332|       |        /*  Nothing more to do. */
 2333|  2.62k|        return DW_DLV_OK;
  ------------------
  |  |   59|  2.62k|#define DW_DLV_OK         0
  ------------------
 2334|  2.62k|    }
 2335|    294|    return DW_DLV_OK;
  ------------------
  |  |   59|    294|#define DW_DLV_OK         0
  ------------------
 2336|  2.91k|}
dwarf_elf_load_headers.c:elf_sht_groupsec:
 2058|  32.0k|{
 2059|       |    /*  ARM compilers name SHT group "__ARM_grp<long name here>"
 2060|       |        not .group */
 2061|  32.0k|    if ((type == SHT_GROUP) || (!strcmp(sname,".group"))){
  ------------------
  |  |   99|  32.0k|#define SHT_GROUP  17
  ------------------
  |  Branch (2061:9): [True: 2.36k, False: 29.7k]
  |  Branch (2061:32): [True: 106, False: 29.6k]
  ------------------
 2062|  2.46k|        return TRUE;
  ------------------
  |  |   33|  2.46k|#define TRUE 1
  ------------------
 2063|  2.46k|    }
 2064|  29.6k|    return FALSE;
  ------------------
  |  |   36|  29.6k|#define FALSE 0
  ------------------
 2065|  32.0k|}
dwarf_elf_load_headers.c:read_gs_section_group:
 2077|  1.40k|{
 2078|  1.40k|    Dwarf_Unsigned i = 0;
 2079|  1.40k|    int res = 0;
 2080|       |
 2081|  1.40k|    if (!psh->gh_sht_group_array) {
  ------------------
  |  Branch (2081:9): [True: 1.40k, False: 0]
  ------------------
 2082|  1.40k|        Dwarf_Unsigned seclen = psh->gh_size;
 2083|  1.40k|        char *data = 0;
 2084|  1.40k|        char *dp = 0;
 2085|  1.40k|        Dwarf_Unsigned flags = psh->gh_flags;
 2086|  1.40k|        Dwarf_Unsigned* grouparray = 0;
 2087|  1.40k|        char dblock[4];
 2088|  1.40k|        Dwarf_Unsigned va = 0;
 2089|  1.40k|        Dwarf_Unsigned count = 0;
 2090|  1.40k|        Dwarf_Unsigned groupmallocsize = 0;
 2091|  1.40k|        int foundone = 0;
 2092|       |
 2093|  1.40k|        if (seclen >= ep->f_filesize) {
  ------------------
  |  Branch (2093:13): [True: 0, False: 1.40k]
  ------------------
 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.40k|        if (seclen < DWARF_32BIT_SIZE) {
  ------------------
  |  |  133|  1.40k|#define DWARF_32BIT_SIZE 4
  ------------------
  |  Branch (2097:13): [True: 4, False: 1.40k]
  ------------------
 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.40k|        if (psh->gh_content) {
  ------------------
  |  Branch (2101:13): [True: 5, False: 1.39k]
  ------------------
 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.39k|        data = malloc(seclen);
 2107|  1.39k|        if (!data) {
  ------------------
  |  Branch (2107:13): [True: 0, False: 1.39k]
  ------------------
 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.39k|        if (psh->gh_entsize != DWARF_32BIT_SIZE) {
  ------------------
  |  |  133|  1.39k|#define DWARF_32BIT_SIZE 4
  ------------------
  |  Branch (2111:13): [True: 111, False: 1.28k]
  ------------------
 2112|    111|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|    111|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2113|    111|            free(data);
 2114|    111|            return DW_DLV_ERROR;
  ------------------
  |  |   60|    111|#define DW_DLV_ERROR      1
  ------------------
 2115|    111|        }
 2116|  1.28k|        if (!psh->gh_entsize) {
  ------------------
  |  Branch (2116:13): [True: 0, False: 1.28k]
  ------------------
 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.28k|        count = seclen/psh->gh_entsize;
 2122|  1.28k|        if (count >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (2122:13): [True: 11, False: 1.27k]
  ------------------
 2123|       |            /* Impossible */
 2124|     11|            free(data);
 2125|     11|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|     11|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2126|     11|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     11|#define DW_DLV_ERROR      1
  ------------------
 2127|     11|        }
 2128|  1.27k|        res = RRMOA(ep->f_fd,data,psh->gh_offset,seclen,
  ------------------
  |  |   65|  1.27k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  1.27k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 2129|  1.27k|            ep->f_filesize,errcode);
 2130|  1.27k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.27k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2130:13): [True: 1, False: 1.27k]
  ------------------
 2131|      1|            free(data);
 2132|      1|            return res;
 2133|      1|        }
 2134|  1.27k|        psh->gh_content = data;
 2135|  1.27k|        data = 0;
 2136|  1.27k|        psh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|  1.27k|#define TRUE 1
  ------------------
 2137|  1.27k|        psh->gh_load_type = Dwarf_Alloc_Malloc;
 2138|  1.27k|        if (flags & SHF_COMPRESSED) {
  ------------------
  |  |  288|  1.27k|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (2138:13): [True: 2, False: 1.27k]
  ------------------
 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.27k|        groupmallocsize =  (1+count) * sizeof(Dwarf_Unsigned);
 2156|  1.27k|        if (groupmallocsize >= ep->f_filesize) {
  ------------------
  |  Branch (2156:13): [True: 0, False: 1.27k]
  ------------------
 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.27k|        grouparray = malloc(groupmallocsize);
 2161|  1.27k|        if (!grouparray) {
  ------------------
  |  Branch (2161:13): [True: 0, False: 1.27k]
  ------------------
 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.27k|        memcpy(dblock,psh->gh_content,DWARF_32BIT_SIZE);
  ------------------
  |  |  133|  1.27k|#define DWARF_32BIT_SIZE 4
  ------------------
 2166|  1.27k|        ASNAR(memcpy,va,dblock);
  ------------------
  |  |   53|  1.27k|    do {                                        \
  |  |   54|  1.27k|        (t) = 0;                                \
  |  |   55|  1.27k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.27k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.27k]
  |  |  ------------------
  ------------------
 2167|       |        /* There is ambiguity on the endianness of this stuff. */
 2168|  1.27k|        if (va != 1 && va != 0x1000000) {
  ------------------
  |  Branch (2168:13): [True: 675, False: 599]
  |  Branch (2168:24): [True: 62, False: 613]
  ------------------
 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.21k|        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.21k|        dp = psh->gh_content;
 2179|       |        /* Skip the initial group version */
 2180|  1.21k|        dp = dp + DWARF_32BIT_SIZE;
  ------------------
  |  |  133|  1.21k|#define DWARF_32BIT_SIZE 4
  ------------------
 2181|       |        /* Remember all the group members */
 2182|  5.63k|        for ( i = 1; i < count; ++i,dp += DWARF_32BIT_SIZE) {
  ------------------
  |  |  133|  4.42k|#define DWARF_32BIT_SIZE 4
  ------------------
  |  Branch (2182:22): [True: 4.50k, False: 1.13k]
  ------------------
 2183|  4.50k|            Dwarf_Unsigned gseca = 0;
 2184|  4.50k|            Dwarf_Unsigned gsecb = 0;
 2185|  4.50k|            struct generic_shdr* targpsh = 0;
 2186|       |
 2187|  4.50k|            memcpy(dblock,dp,DWARF_32BIT_SIZE);
  ------------------
  |  |  133|  4.50k|#define DWARF_32BIT_SIZE 4
  ------------------
 2188|  4.50k|            ASNAR(memcpy,gseca,dblock);
  ------------------
  |  |   53|  4.50k|    do {                                        \
  |  |   54|  4.50k|        (t) = 0;                                \
  |  |   55|  4.50k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.50k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.50k]
  |  |  ------------------
  ------------------
 2189|       |            /*  Loading gseca and gsecb with different endianness.
 2190|       |                Only one of them can be of any use. */
 2191|  4.50k|            ASNAR(_dwarf_memcpy_swap_bytes,gsecb,dblock);
  ------------------
  |  |   53|  4.50k|    do {                                        \
  |  |   54|  4.50k|        (t) = 0;                                \
  |  |   55|  4.50k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.50k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.50k]
  |  |  ------------------
  ------------------
 2192|  4.50k|            if (!gseca) {
  ------------------
  |  Branch (2192:17): [True: 3, False: 4.50k]
  ------------------
 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.50k|            if (gseca >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (2198:17): [True: 2.81k, False: 1.68k]
  ------------------
 2199|       |                /*  Might be confused endianness by
 2200|       |                    the compiler generating the SHT_GROUP.
 2201|       |                    This is pretty horrible. */
 2202|  2.81k|                if (gsecb >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (2202:21): [True: 74, False: 2.74k]
  ------------------
 2203|     74|                    *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|     74|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2204|     74|                    free(grouparray);
 2205|     74|                    return DW_DLV_ERROR;
  ------------------
  |  |   60|     74|#define DW_DLV_ERROR      1
  ------------------
 2206|     74|                }
 2207|       |                /*  Looks as though gsecb is the correct
 2208|       |                    interpretation.  Yes, ugly. */
 2209|  2.74k|                gseca = gsecb;
 2210|  2.74k|            }
 2211|  4.42k|            grouparray[i] = gseca;
 2212|  4.42k|            targpsh = ep->f_shdr + gseca;
 2213|  4.42k|            if (_dwarf_ignorethissection(targpsh->gh_namestring)){
  ------------------
  |  Branch (2213:17): [True: 3.50k, False: 922]
  ------------------
 2214|       |                /* dp ok as is. Iterate again. */
 2215|  3.50k|                continue;
 2216|  3.50k|            }
 2217|    922|            if (targpsh->gh_section_group_number) {
  ------------------
  |  Branch (2217:17): [True: 2, False: 920]
  ------------------
 2218|       |                /* multi-assignment to groups. Oops. */
 2219|      2|                free(grouparray);
 2220|      2|                *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      2|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2221|      2|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
 2222|      2|            }
 2223|    920|            targpsh->gh_section_group_number =
 2224|    920|                ep->f_sg_next_group_number;
 2225|    920|            foundone = 1;
 2226|    920|        }
 2227|  1.13k|        dp = 0;
 2228|  1.13k|        if (foundone) {
  ------------------
  |  Branch (2228:13): [True: 353, False: 780]
  ------------------
 2229|    353|            ++ep->f_sg_next_group_number;
 2230|    353|            ++ep->f_sht_group_type_section_count;
 2231|    353|        }
 2232|  1.13k|        psh->gh_sht_group_array = grouparray;
 2233|  1.13k|        psh->gh_sht_group_array_count = count;
 2234|  1.13k|    }
 2235|  1.13k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.13k|#define DW_DLV_OK         0
  ------------------
 2236|  1.40k|}
dwarf_elf_load_headers.c:string_endswith:
 2038|  14.6k|{
 2039|  14.6k|    size_t len = strlen(n);
 2040|  14.6k|    size_t qlen = strlen(q);
 2041|  14.6k|    const char *startpt = 0;
 2042|       |
 2043|  14.6k|    if ( len < qlen) {
  ------------------
  |  Branch (2043:10): [True: 1.50k, False: 13.1k]
  ------------------
 2044|  1.50k|        return FALSE;
  ------------------
  |  |   36|  1.50k|#define FALSE 0
  ------------------
 2045|  1.50k|    }
 2046|  13.1k|    startpt = n + (len-qlen);
 2047|  13.1k|    if (strcmp(startpt,q)) {
  ------------------
  |  Branch (2047:9): [True: 11.8k, False: 1.32k]
  ------------------
 2048|  11.8k|        return FALSE;
  ------------------
  |  |   36|  11.8k|#define FALSE 0
  ------------------
 2049|  11.8k|    }
 2050|  1.32k|    return TRUE;
  ------------------
  |  |   33|  1.32k|#define TRUE 1
  ------------------
 2051|  13.1k|}
dwarf_elf_load_headers.c:_dwarf_load_elf_section_is_dwarf:
  310|  13.3k|{
  311|  13.3k|    *is_rel = FALSE;
  ------------------
  |  |   36|  13.3k|#define FALSE 0
  ------------------
  312|  13.3k|    *is_rela = FALSE;
  ------------------
  |  |   36|  13.3k|#define FALSE 0
  ------------------
  313|  13.3k|    if (_dwarf_ignorethissection(sname)) {
  ------------------
  |  Branch (313:9): [True: 1.17k, False: 12.1k]
  ------------------
  314|  1.17k|        return FALSE;
  ------------------
  |  |   36|  1.17k|#define FALSE 0
  ------------------
  315|  1.17k|    }
  316|  12.1k|    if (sectype == SHT_REL) {
  ------------------
  |  |   59|  12.1k|#define SHT_REL 9
  ------------------
  |  Branch (316:9): [True: 1.28k, False: 10.8k]
  ------------------
  317|  1.28k|        return TRUE;
  ------------------
  |  |   33|  1.28k|#define TRUE 1
  ------------------
  318|  1.28k|    }
  319|  10.8k|    if (sectype == SHT_RELA) {
  ------------------
  |  |   56|  10.8k|#define SHT_RELA 4
  ------------------
  |  Branch (319:9): [True: 2.08k, False: 8.76k]
  ------------------
  320|  2.08k|        *is_rela = TRUE;
  ------------------
  |  |   33|  2.08k|#define TRUE 1
  ------------------
  321|  2.08k|        return TRUE;
  ------------------
  |  |   33|  2.08k|#define TRUE 1
  ------------------
  322|  2.08k|    }
  323|  8.76k|    if (!strncmp(sname,".rel",4)) {
  ------------------
  |  Branch (323:9): [True: 1.52k, False: 7.24k]
  ------------------
  324|  1.52k|        if (!strncmp(sname,".rela.",6)) {
  ------------------
  |  Branch (324:13): [True: 538, False: 985]
  ------------------
  325|    538|            *is_rela = TRUE;
  ------------------
  |  |   33|    538|#define TRUE 1
  ------------------
  326|    538|            return TRUE;
  ------------------
  |  |   33|    538|#define TRUE 1
  ------------------
  327|    538|        }
  328|    985|        if (!strncmp(sname,".rel.",5)) {
  ------------------
  |  Branch (328:13): [True: 668, False: 317]
  ------------------
  329|    668|            *is_rela = TRUE;
  ------------------
  |  |   33|    668|#define TRUE 1
  ------------------
  330|    668|            return TRUE;
  ------------------
  |  |   33|    668|#define TRUE 1
  ------------------
  331|    668|        }
  332|       |        /*  Else something is goofy/Impossible */
  333|    317|        return FALSE;
  ------------------
  |  |   36|    317|#define FALSE 0
  ------------------
  334|    985|    }
  335|  7.24k|    if (!strncmp(sname,".debug_",7)) {
  ------------------
  |  Branch (335:9): [True: 1.31k, False: 5.93k]
  ------------------
  336|  1.31k|        return TRUE;
  ------------------
  |  |   33|  1.31k|#define TRUE 1
  ------------------
  337|  1.31k|    }
  338|  5.93k|    if (!strncmp(sname,".zdebug_",8)) {
  ------------------
  |  Branch (338:9): [True: 455, False: 5.47k]
  ------------------
  339|    455|        return TRUE;
  ------------------
  |  |   33|    455|#define TRUE 1
  ------------------
  340|    455|    }
  341|  5.47k|    if (!strcmp(sname,".eh_frame")) {
  ------------------
  |  Branch (341:9): [True: 334, False: 5.14k]
  ------------------
  342|    334|        return TRUE;
  ------------------
  |  |   33|    334|#define TRUE 1
  ------------------
  343|    334|    }
  344|  5.14k|    if (!strncmp(sname,".gdb_index",10)) {
  ------------------
  |  Branch (344:9): [True: 271, False: 4.87k]
  ------------------
  345|    271|        return TRUE;
  ------------------
  |  |   33|    271|#define TRUE 1
  ------------------
  346|    271|    }
  347|  4.87k|    return FALSE;
  ------------------
  |  |   36|  4.87k|#define FALSE 0
  ------------------
  348|  5.14k|}

_dwarf_elf_nlsetup:
  917|  4.58k|{
  918|  4.58k|    Dwarf_Obj_Access_Interface_a *binary_interface = 0;
  919|  4.58k|    dwarf_elf_object_access_internals_t *intfc = 0;
  920|  4.58k|    int res = DW_DLV_OK;
  ------------------
  |  |   59|  4.58k|#define DW_DLV_OK         0
  ------------------
  921|  4.58k|    int localerrnum = 0;
  922|       |
  923|  4.58k|    res = _dwarf_elf_object_access_init(
  924|  4.58k|        fd,
  925|  4.58k|        ftype,endian,offsetsize,filesize,
  926|  4.58k|        &binary_interface,
  927|  4.58k|        &localerrnum);
  928|  4.58k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  4.58k|#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.05k]
  ------------------
  930|      2|            return res;
  931|      2|        }
  932|  2.05k|        _dwarf_error(NULL, error, localerrnum);
  933|  2.05k|        return DW_DLV_ERROR;
  ------------------
  |  |   60|  2.05k|#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.85k, False: 667]
  ------------------
  940|  1.85k|        _dwarf_destruct_elf_nlaccess(binary_interface);
  941|  1.85k|        return res;
  942|  1.85k|    }
  943|    667|    intfc = binary_interface->ai_object;
  944|    667|    intfc->f_path = strdup(true_path);
  945|    667|    (*dbg)->de_obj_machine = intfc->f_machine;
  946|    667|    (*dbg)->de_obj_type = intfc->f_ftype; /* ET_REL etc */
  947|    667|    (*dbg)->de_obj_flags = intfc->f_flags;
  948|    667|    return res;
  949|  2.52k|}
dwarf_elfread.c:_dwarf_destruct_elf_nlaccess:
  821|  4.58k|{
  822|  4.58k|    struct Dwarf_Obj_Access_Interface_a_s *aip =
  823|  4.58k|        (struct Dwarf_Obj_Access_Interface_a_s *)obj;
  824|  4.58k|    dwarf_elf_object_access_internals_t *ep = 0;
  825|  4.58k|    struct generic_shdr *shp = 0;
  826|  4.58k|    Dwarf_Unsigned shcount = 0;
  827|  4.58k|    Dwarf_Unsigned i = 0;
  828|       |
  829|  4.58k|    ep = (dwarf_elf_object_access_internals_t *)aip->ai_object;
  830|  4.58k|    shp = ep->f_shdr;
  831|  4.58k|    shcount = ep->f_loc_shdr.g_count;
  832|   218k|    for (i = 0; i < shcount; ++i,++shp) {
  ------------------
  |  Branch (832:17): [True: 214k, False: 4.58k]
  ------------------
  833|   214k|        enum Dwarf_Sec_Alloc_Pref alloc = shp->gh_load_type;
  834|   214k|        free(shp->gh_rels);
  835|   214k|        shp->gh_rels = 0;
  836|   214k|        switch(alloc) {
  837|  6.29k|        case Dwarf_Alloc_Malloc:
  ------------------
  |  Branch (837:9): [True: 6.29k, False: 207k]
  ------------------
  838|  6.29k|            if (shp->gh_was_alloc) {
  ------------------
  |  Branch (838:17): [True: 6.27k, False: 18]
  ------------------
  839|  6.27k|                free(shp->gh_content);
  840|  6.27k|                shp->gh_content = 0;
  841|  6.27k|            }
  842|  6.29k|            break;
  843|      0|#ifdef HAVE_FULL_MMAP
  844|      0|        case Dwarf_Alloc_Mmap: {
  ------------------
  |  Branch (844:9): [True: 0, False: 214k]
  ------------------
  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|   207k|        default: break;
  ------------------
  |  Branch (855:9): [True: 207k, False: 6.29k]
  ------------------
  856|       |            /*  something disastrously wrong. No free/mmap */
  857|   214k|        } /* end switch on alloc */
  858|   214k|        shp->gh_content = 0;
  859|   214k|        shp->gh_mmap_realarea = (char *)-1;
  860|   214k|        shp->gh_computed_mmaplen = 0;
  861|   214k|        free(shp->gh_sht_group_array);
  862|   214k|        shp->gh_sht_group_array = 0;
  863|   214k|        shp->gh_sht_group_array_count = 0;
  864|   214k|    }
  865|  4.58k|    free(ep->f_ehdr);
  866|  4.58k|    ep->f_ehdr = 0;
  867|  4.58k|    ep->f_loc_shdr.g_count = 0;
  868|  4.58k|    free(ep->f_phdr);
  869|  4.58k|    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.58k|    ep->f_elf_shstrings_data = 0;
  876|  4.58k|    ep->f_elf_shstrings_length = 0;
  877|  4.58k|    ep->f_elf_shstrings_max = 0;
  878|  4.58k|    ep->f_elf_shstrings_index = 0;
  879|  4.58k|    ep->f_symtab_sect_strings = 0;
  880|  4.58k|    ep->f_symtab_sect_strings_max = 0;
  881|  4.58k|    ep->f_symtab_sect_strings_sect_index = 0;
  882|       |
  883|  4.58k|    free(ep->f_dynsym_sect_strings);
  884|  4.58k|    ep->f_dynsym_sect_strings = 0;
  885|  4.58k|    free(ep->f_dynamic);
  886|  4.58k|    ep->f_dynamic = 0;
  887|  4.58k|    free(ep->f_symtab);
  888|  4.58k|    ep->f_symtab = 0;
  889|  4.58k|    free(ep->f_dynsym);
  890|  4.58k|    ep->f_dynsym = 0;
  891|  4.58k|    free(ep->f_shdr);
  892|  4.58k|    ep->f_shdr = 0;
  893|       |    /* if TRUE close f_fd on destruct.*/
  894|  4.58k|    if (ep->f_destruct_close_fd) {
  ------------------
  |  Branch (894:9): [True: 0, False: 4.58k]
  ------------------
  895|      0|        _dwarf_closer(ep->f_fd);
  896|      0|    }
  897|  4.58k|    ep->f_ident[0] = 'X';
  898|  4.58k|    free(ep->f_path);
  899|  4.58k|    ep->f_path = 0;
  900|  4.58k|    free(ep);
  901|  4.58k|    ep = 0;
  902|  4.58k|    free(aip);
  903|  4.58k|    aip = 0;
  904|  4.58k|}
dwarf_elfread.c:_dwarf_elf_object_access_init:
 1115|  4.58k|{
 1116|       |
 1117|  4.58k|    int res = 0;
 1118|  4.58k|    dwarf_elf_object_access_internals_t *internals = 0;
 1119|  4.58k|    Dwarf_Obj_Access_Interface_a *intfc = 0;
 1120|       |
 1121|  4.58k|    internals = malloc(sizeof(dwarf_elf_object_access_internals_t));
 1122|  4.58k|    if (!internals) {
  ------------------
  |  Branch (1122:9): [True: 0, False: 4.58k]
  ------------------
 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.58k|    memset(internals,0,sizeof(*internals));
 1128|  4.58k|    res = _dwarf_elf_object_access_internals_init(internals,
 1129|  4.58k|        fd,
 1130|  4.58k|        ftype, endian, offsetsize, filesize,
 1131|  4.58k|        localerrnum);
 1132|  4.58k|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|  4.58k|#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.58k|{
  982|  4.58k|    dwarf_elf_object_access_internals_t * intfc = internals;
  983|  4.58k|    Dwarf_Unsigned i  = 0;
  984|  4.58k|    struct Dwarf_Obj_Access_Interface_a_s *localdoas;
  985|  4.58k|    int res = 0;
  986|       |
  987|       |    /*  Must malloc as _dwarf_destruct_elf_access()
  988|       |        forces that due to other uses. */
  989|  4.58k|    localdoas = (struct Dwarf_Obj_Access_Interface_a_s *)
  990|  4.58k|        malloc(sizeof(struct Dwarf_Obj_Access_Interface_a_s));
  991|  4.58k|    if (!localdoas) {
  ------------------
  |  Branch (991:9): [True: 0, False: 4.58k]
  ------------------
  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.58k|    memset(localdoas,0,sizeof(struct Dwarf_Obj_Access_Interface_a_s));
  997|       |    /*  E is used with libelf. F with this elf reader. */
  998|  4.58k|    intfc->f_ident[0]    = 'F';
  999|  4.58k|    intfc->f_ident[1]    = '1';
 1000|  4.58k|    intfc->f_fd          = fd;
 1001|  4.58k|    intfc->f_is_64bit    = ((offsetsize==64)?TRUE:FALSE);
  ------------------
  |  |   33|  1.52k|#define TRUE 1
  ------------------
                  intfc->f_is_64bit    = ((offsetsize==64)?TRUE:FALSE);
  ------------------
  |  |   36|  3.05k|#define FALSE 0
  ------------------
  |  Branch (1001:29): [True: 1.52k, False: 3.05k]
  ------------------
 1002|  4.58k|    intfc->f_offsetsize  = (Dwarf_Small)offsetsize;
 1003|  4.58k|    intfc->f_pointersize = (Dwarf_Small)offsetsize;
 1004|  4.58k|    intfc->f_filesize    = filesize;
 1005|  4.58k|    intfc->f_ftype       = ftype;
 1006|  4.58k|    intfc->f_destruct_close_fd = FALSE;
  ------------------
  |  |   36|  4.58k|#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.58k|    if (endian == DW_END_little ) {
  ------------------
  |  | 1115|  4.58k|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  |  Branch (1017:9): [True: 1.38k, False: 3.20k]
  ------------------
 1018|  1.38k|        intfc->f_copy_word = _dwarf_memcpy_noswap_bytes;
 1019|  1.38k|        intfc->f_endian = DW_END_little;
  ------------------
  |  | 1115|  1.38k|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1020|  3.20k|    } else {
 1021|  3.20k|        intfc->f_copy_word = _dwarf_memcpy_swap_bytes;
 1022|  3.20k|        intfc->f_endian = DW_END_big;
  ------------------
  |  | 1114|  3.20k|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
 1023|  3.20k|    }
 1024|  4.58k|#endif /* LITTLE- BIG-ENDIAN */
 1025|       |    /*  The following sets f_machine. */
 1026|  4.58k|    res = _dwarf_load_elf_header(intfc,errcode);
 1027|  4.58k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  4.58k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1027:9): [True: 73, False: 4.50k]
  ------------------
 1028|     73|        localdoas->ai_object = intfc;
 1029|     73|        localdoas->ai_methods = 0;
 1030|     73|        _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1031|     73|        localdoas = 0;
 1032|     73|        return res;
 1033|     73|    }
 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.58k, False: 2.91k]
  ------------------
 1037|  1.58k|        localdoas->ai_object = intfc;
 1038|  1.58k|        localdoas->ai_methods = 0;
 1039|  1.58k|        _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1040|  1.58k|        localdoas = 0;
 1041|  1.58k|        return res;
 1042|       |
 1043|  1.58k|    }
 1044|       |    /* We are not looking at symbol strings for now. */
 1045|  2.91k|    res = _dwarf_load_elf_symstr(intfc,errcode);
 1046|  2.91k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  2.91k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1046:9): [True: 125, False: 2.79k]
  ------------------
 1047|    125|        localdoas->ai_object = intfc;
 1048|    125|        localdoas->ai_methods = 0;
 1049|    125|        _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1050|    125|        localdoas = 0;
 1051|    125|        return res;
 1052|    125|    }
 1053|  2.79k|    res  = _dwarf_load_elf_symtab_symbols(intfc,errcode);
 1054|  2.79k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  2.79k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1054:9): [True: 17, False: 2.77k]
  ------------------
 1055|     17|        localdoas->ai_object = intfc;
 1056|     17|        localdoas->ai_methods = 0;
 1057|     17|        _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1058|     17|        localdoas = 0;
 1059|     17|        return res;
 1060|     17|    }
 1061|   196k|    for ( i = 1; i < intfc->f_loc_shdr.g_count; ++i) {
  ------------------
  |  Branch (1061:18): [True: 193k, False: 2.52k]
  ------------------
 1062|   193k|        struct generic_shdr *shp = 0;
 1063|   193k|        Dwarf_Unsigned section_type = 0;
 1064|   193k|        enum RelocRela localrel = RelocIsRela;
 1065|       |
 1066|   193k|        shp = intfc->f_shdr +i;
 1067|   193k|        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|   193k|        if (!shp->gh_namestring || !shp->gh_namestring[0]) {
  ------------------
  |  Branch (1071:13): [True: 0, False: 193k]
  |  Branch (1071:36): [True: 1.57k, False: 192k]
  ------------------
 1072|       |            /*  A serious error which we ignore here
 1073|       |                as it will be caught elsewhere
 1074|       |                if necessary. */
 1075|  1.57k|            continue;
 1076|   192k|        } else if (section_type == SHT_REL) {
  ------------------
  |  |   59|   192k|#define SHT_REL 9
  ------------------
  |  Branch (1076:20): [True: 1.70k, False: 190k]
  ------------------
 1077|  1.70k|            localrel = RelocIsRel;
 1078|   190k|        } else if (section_type == SHT_RELA) {
  ------------------
  |  |   56|   190k|#define SHT_RELA 4
  ------------------
  |  Branch (1078:20): [True: 2.34k, False: 188k]
  ------------------
 1079|  2.34k|            localrel = RelocIsRela;
 1080|   188k|        } else if (!strncmp(".rel.",shp->gh_namestring,5)) {
  ------------------
  |  Branch (1080:20): [True: 6.51k, False: 181k]
  ------------------
 1081|  6.51k|            localrel = RelocIsRel;
 1082|   181k|        } else if (!strncmp(".rela.",shp->gh_namestring,6)) {
  ------------------
  |  Branch (1082:20): [True: 29.4k, False: 152k]
  ------------------
 1083|  29.4k|            localrel = RelocIsRela;
 1084|   152k|        } else {
 1085|   152k|            continue;
 1086|   152k|        }
 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|  39.9k|        res = _dwarf_load_elf_relx(intfc,i,localrel,errcode);
 1093|  39.9k|        if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  39.9k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1093:13): [True: 253, False: 39.7k]
  ------------------
 1094|    253|            localdoas->ai_object = intfc;
 1095|    253|            localdoas->ai_methods = 0;
 1096|    253|            _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1097|    253|            localdoas = 0;
 1098|    253|            return res;
 1099|    253|        }
 1100|  39.9k|    }
 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.77k|}
dwarf_elfread.c:elf_get_nolibelf_section_info:
  185|   353k|{
  186|   353k|    dwarf_elf_object_access_internals_t *elf =
  187|   353k|        (dwarf_elf_object_access_internals_t*)(obj);
  188|       |
  189|   353k|    (void)error;
  190|   353k|    if (section_index < elf->f_loc_shdr.g_count) {
  ------------------
  |  Branch (190:9): [True: 353k, False: 0]
  ------------------
  191|   353k|        struct generic_shdr *sp = 0;
  192|       |
  193|   353k|        sp = elf->f_shdr + section_index;
  194|   353k|        return_section->as_addr      = sp->gh_addr;
  195|   353k|        return_section->as_type      = sp->gh_type;
  196|   353k|        return_section->as_size      = sp->gh_size;
  197|   353k|        return_section->as_name      = sp->gh_namestring;
  198|   353k|        return_section->as_link      = sp->gh_link;
  199|   353k|        return_section->as_info      = sp->gh_info;
  200|   353k|        return_section->as_flags     = sp->gh_flags;
  201|   353k|        return_section->as_entrysize = sp->gh_entsize;
  202|   353k|        return_section->as_offset    = sp->gh_offset;
  203|   353k|        return DW_DLV_OK;
  ------------------
  |  |   59|   353k|#define DW_DLV_OK         0
  ------------------
  204|   353k|    }
  205|      0|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  206|   353k|}
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.03k|{
  251|       |    /*  Linux kernel read size limit 0x7ffff000,
  252|       |        Without any good reason, limit our reads
  253|       |        to a bit less. */
  254|  2.03k|    const Dwarf_Unsigned read_size_limit = 0x7ff00000;
  255|  2.03k|    Dwarf_Unsigned read_offset = 0;
  256|  2.03k|    Dwarf_Unsigned read_size = 0;
  257|  2.03k|    Dwarf_Unsigned remaining_bytes = 0;
  258|  2.03k|    Dwarf_Small *  read_target = 0;
  259|  2.03k|    dwarf_elf_object_access_internals_t *elf =
  260|  2.03k|        (dwarf_elf_object_access_internals_t*)(obj);
  261|  2.03k|    struct generic_shdr *sp = 0;
  262|  2.03k|    int decompressme = FALSE;
  ------------------
  |  |   36|  2.03k|#define FALSE 0
  ------------------
  263|  2.03k|    int res = 0;
  264|       |
  265|  2.03k|    res = elf_load_find_sec_ptr(obj,section_index,&sp,
  266|  2.03k|        &decompressme,errorc);
  267|  2.03k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.03k|#define DW_DLV_OK         0
  ------------------
  |  Branch (267:9): [True: 0, False: 2.03k]
  ------------------
  268|      0|        return res;
  269|      0|    }
  270|  2.03k|    if (sp->gh_content) {
  ------------------
  |  Branch (270:9): [True: 1.20k, False: 832]
  ------------------
  271|  1.20k|        *return_data = (Dwarf_Small *)sp->gh_content;
  272|  1.20k|        return DW_DLV_OK;
  ------------------
  |  |   59|  1.20k|#define DW_DLV_OK         0
  ------------------
  273|  1.20k|    }
  274|       |    /*  Guarding against bad values and
  275|       |        against overflow */
  276|    832|    if (sp->gh_size > elf->f_filesize ||
  ------------------
  |  Branch (276:9): [True: 309, False: 523]
  ------------------
  277|    523|        sp->gh_offset > elf->f_filesize ||
  ------------------
  |  Branch (277:9): [True: 101, False: 422]
  ------------------
  278|    422|        (sp->gh_size + sp->gh_offset) >
  ------------------
  |  Branch (278:9): [True: 22, False: 400]
  ------------------
  279|    432|            elf->f_filesize) {
  280|    432|        *errorc = DW_DLE_ELF_SECTION_ERROR;
  ------------------
  |  | 1492|    432|#define DW_DLE_ELF_SECTION_ERROR               446
  ------------------
  281|    432|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    432|#define DW_DLV_ERROR      1
  ------------------
  282|    432|    }
  283|       |
  284|    400|    sp->gh_load_type = Dwarf_Alloc_Malloc;
  285|    400|    sp->gh_content = malloc((size_t)sp->gh_size);
  286|    400|    if (!sp->gh_content) {
  ------------------
  |  Branch (286:9): [True: 0, False: 400]
  ------------------
  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|    400|    remaining_bytes = sp->gh_size;
  293|    400|    read_size = remaining_bytes;
  294|    400|    read_offset = sp->gh_offset;
  295|    400|    read_target = (Dwarf_Small*)sp->gh_content;
  296|    800|    for ( ; remaining_bytes > 0; read_size = remaining_bytes ) {
  ------------------
  |  Branch (296:13): [True: 400, False: 400]
  ------------------
  297|    400|        if (read_size > read_size_limit) {
  ------------------
  |  Branch (297:13): [True: 0, False: 400]
  ------------------
  298|      0|            read_size = read_size_limit;
  299|      0|        }
  300|    400|        res = RRMOA(elf->f_fd,
  ------------------
  |  |   65|    400|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    400|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  301|    400|            (void *)read_target, read_offset,
  302|    400|            read_size,
  303|    400|            elf->f_filesize, errorc);
  304|    400|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    400|#define DW_DLV_OK         0
  ------------------
  |  Branch (304:13): [True: 0, False: 400]
  ------------------
  305|      0|            free(sp->gh_content);
  306|      0|            sp->gh_content = 0;
  307|      0|            return res;
  308|      0|        }
  309|    400|        remaining_bytes -= read_size;
  310|    400|        read_offset += read_size;
  311|    400|        read_target += read_size;
  312|    400|    }
  313|    400|    sp->gh_was_alloc = TRUE;
  ------------------
  |  |   33|    400|#define TRUE 1
  ------------------
  314|    400|    sp->gh_load_type = Dwarf_Alloc_Malloc;
  315|       |
  316|    400|    if (decompressme) {
  ------------------
  |  Branch (316:9): [True: 4, False: 396]
  ------------------
  317|      4|        Dwarf_Unsigned flags = sp->gh_flags;
  318|      4|        if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|      4|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (318:13): [True: 4, 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|      4|            *errorc = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      4|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
  330|      4|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
  331|      4|#endif /* COMPRESSED TEST */
  332|      4|        }
  333|      4|    }
  334|    396|    *return_data = (Dwarf_Small *)sp->gh_content;
  335|    396|    return DW_DLV_OK;
  ------------------
  |  |   59|    396|#define DW_DLV_OK         0
  ------------------
  336|    400|}
dwarf_elfread.c:elf_load_find_sec_ptr:
  212|  4.07k|{
  213|  4.07k|    dwarf_elf_object_access_internals_t *elf =
  214|  4.07k|        (dwarf_elf_object_access_internals_t*)(obj);
  215|       |
  216|  4.07k|    (void)errorc;
  217|  4.07k|    if (0 < section_index &&
  ------------------
  |  Branch (217:9): [True: 4.07k, False: 3]
  ------------------
  218|  4.07k|        section_index < elf->f_loc_shdr.g_count) {
  ------------------
  |  Branch (218:9): [True: 4.07k, False: 0]
  ------------------
  219|  4.07k|        struct generic_shdr *sp =
  220|  4.07k|            elf->f_shdr + section_index;
  221|       |
  222|  4.07k|        if (!sp->gh_size) {
  ------------------
  |  Branch (222:13): [True: 0, False: 4.07k]
  ------------------
  223|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  224|      0|        }
  225|  4.07k|        *sp_inout = sp;
  226|  4.07k|        if (sp->gh_flags & SHF_COMPRESSED) {
  ------------------
  |  |  288|  4.07k|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (226:13): [True: 62, False: 4.01k]
  ------------------
  227|     62|            switch(sp->gh_type) {
  228|      4|            case SHT_STRTAB:
  ------------------
  |  |   53|      4|#define SHT_STRTAB 3
  ------------------
  |  Branch (228:13): [True: 4, False: 58]
  ------------------
  229|      8|            case SHT_SYMTAB:
  ------------------
  |  |   50|      8|#define SHT_SYMTAB 2
  ------------------
  |  Branch (229:13): [True: 4, False: 58]
  ------------------
  230|     20|            case SHT_REL:
  ------------------
  |  |   59|     20|#define SHT_REL 9
  ------------------
  |  Branch (230:13): [True: 12, False: 50]
  ------------------
  231|     28|            case SHT_RELA:
  ------------------
  |  |   56|     28|#define SHT_RELA 4
  ------------------
  |  Branch (231:13): [True: 8, False: 54]
  ------------------
  232|     28|                *decompressme = TRUE;
  ------------------
  |  |   33|     28|#define TRUE 1
  ------------------
  233|     28|                break;
  234|     18|            case SHT_NOBITS:
  ------------------
  |  |   87|     18|#define SHT_NOBITS 8
  ------------------
  |  Branch (234:13): [True: 18, False: 44]
  ------------------
  235|     34|            default:
  ------------------
  |  Branch (235:13): [True: 16, False: 46]
  ------------------
  236|     34|                break;
  237|     62|            }
  238|     62|        }
  239|  4.07k|        return DW_DLV_OK;
  ------------------
  |  |   59|  4.07k|#define DW_DLV_OK         0
  ------------------
  240|  4.07k|    }
  241|      3|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      3|#define DW_DLV_NO_ENTRY  -1
  ------------------
  242|  4.07k|}
dwarf_elfread.c:elf_relocations_nolibelf:
  762|    124|{
  763|    124|    int res = DW_DLV_ERROR;
  ------------------
  |  |   60|    124|#define DW_DLV_ERROR      1
  ------------------
  764|    124|    dwarf_elf_object_access_internals_t*obj = 0;
  765|    124|    struct Dwarf_Section_s * relocatablesec = 0;
  766|    124|    Dwarf_Unsigned section_with_reloc_records = 0;
  767|       |
  768|    124|    if (section_index == 0) {
  ------------------
  |  Branch (768:9): [True: 0, False: 124]
  ------------------
  769|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  770|      0|    }
  771|    124|    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|    124|    res = find_section_to_relocate(dbg, section_index,
  778|    124|        &relocatablesec, errorc);
  779|    124|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    124|#define DW_DLV_OK         0
  ------------------
  |  Branch (779:9): [True: 124, False: 0]
  ------------------
  780|    124|        return res;
  781|    124|    }
  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|    124|{
  561|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_info,relocatablesec);
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  562|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_abbrev,relocatablesec);
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  563|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_line,relocatablesec);
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  564|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_loc,relocatablesec);
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  565|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_aranges,relocatablesec);
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  566|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_macinfo,relocatablesec);
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  567|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_pubnames,
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  568|    124|        relocatablesec);
  569|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_names,
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  570|    124|        relocatablesec);
  571|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_ranges,relocatablesec);
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  572|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_frame,
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  573|    124|        relocatablesec);
  574|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_frame_eh_gnu,
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  575|    124|        relocatablesec);
  576|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_pubtypes,
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  577|    124|        relocatablesec);
  578|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_funcnames,
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  579|    124|        relocatablesec);
  580|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_typenames,
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  581|    124|        relocatablesec);
  582|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_varnames,
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  583|    124|        relocatablesec);
  584|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_weaknames,
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  585|    124|        relocatablesec);
  586|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_types,relocatablesec);
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  587|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_macro,relocatablesec);
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  588|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_rnglists,
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  589|    124|        relocatablesec);
  590|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_loclists,
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  591|    124|        relocatablesec);
  592|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_aranges,
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  593|    124|        relocatablesec);
  594|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_sup,
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  595|    124|        relocatablesec);
  596|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_str_offsets,
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  597|    124|        relocatablesec);
  598|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_addr,relocatablesec);
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  599|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_gnu_pubnames,
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  600|    124|        relocatablesec);
  601|    124|    MATCH_REL_SEC(section_index,dbg->de_debug_gnu_pubtypes,
  ------------------
  |  |  551|    124|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    124|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 124]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  602|    124|        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|    124|    *errorc = DW_DLE_RELOC_SECTION_MISMATCH;
  ------------------
  |  | 1259|    124|#define DW_DLE_RELOC_SECTION_MISMATCH          214
  ------------------
  610|    124|    return DW_DLV_ERROR;
  ------------------
  |  |   60|    124|#define DW_DLV_ERROR      1
  ------------------
  611|    124|}
dwarf_elfread.c:elf_load_nolibelf_section_a:
  453|  2.04k|{
  454|  2.04k|    int res  = 0;
  455|  2.04k|    enum Dwarf_Sec_Alloc_Pref alloc_type_in = *dw_alloc_type;
  456|  2.04k|    struct generic_shdr *sp = 0;
  457|  2.04k|    int decompressme = FALSE;
  ------------------
  |  |   36|  2.04k|#define FALSE 0
  ------------------
  458|       |
  459|  2.04k|    res = elf_load_find_sec_ptr(obj,dw_section_index,&sp,
  460|  2.04k|        &decompressme,errc);
  461|  2.04k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.04k|#define DW_DLV_OK         0
  ------------------
  |  Branch (461:9): [True: 3, False: 2.03k]
  ------------------
  462|      3|        return res;
  463|      3|    }
  464|  2.03k|    if (alloc_type_in == Dwarf_Alloc_Malloc ||
  ------------------
  |  Branch (464:9): [True: 2.03k, False: 0]
  ------------------
  465|  2.03k|        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.03k|        res = elf_load_nolibelf_section(obj,dw_section_index,
  469|  2.03k|            return_data_ptr,errc);
  470|  2.03k|        *return_mmap_base_ptr = 0;
  471|  2.03k|        *return_mmap_offset = 0;
  472|  2.03k|        *return_mmap_len = 0;
  473|  2.03k|        *dw_alloc_type = Dwarf_Alloc_Malloc;
  474|       |        /* *return_data_len =  not set */
  475|  2.03k|        return res;
  476|  2.03k|    }
  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.71k|{
  112|  5.71k|    _dwarf_error_string(dbg,error,errval,0);
  113|  5.71k|}
_dwarf_error_string:
  120|  20.7k|{
  121|  20.7k|    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.7k|    if (error) {
  ------------------
  |  Branch (126:9): [True: 0, False: 20.7k]
  ------------------
  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.7k|    if (dbg  && dbg->de_errhand != NULL) {
  ------------------
  |  Branch (193:9): [True: 1.47k, False: 19.2k]
  |  Branch (193:17): [True: 0, False: 1.47k]
  ------------------
  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.7k|    fflush(stderr);
  205|  20.7k|    fprintf(stderr,
  206|  20.7k|        "\nlibdwarf is unable to record error %s "
  207|  20.7k|        "No error argument or handler available\n",
  208|  20.7k|        dwarf_errmsg_by_number(errval));
  209|       |    fflush(stderr);
  210|  20.7k|    return;
  211|  20.7k|}
dwarf_errmsg_by_number:
  224|  20.7k|{
  225|  20.7k|    if (errornum > DW_DLE_LAST) {
  ------------------
  |  | 1566|  20.7k|#define DW_DLE_LAST        517
  ------------------
  |  Branch (225:9): [True: 0, False: 20.7k]
  ------------------
  226|      0|        return "Dwarf_Error value out of range";
  227|      0|    }
  228|  20.7k|    return ((char *) &_dwarf_errmsgs[errornum][0]);
  229|  20.7k|}

dwarf_init_b:
  453|  8.41k|{
  454|  8.41k|    unsigned ftype = 0;
  455|  8.41k|    unsigned endian = 0;
  456|  8.41k|    unsigned offsetsize = 0;
  457|  8.41k|    unsigned universalnumber = 0;
  458|  8.41k|    Dwarf_Unsigned   filesize = 0;
  459|  8.41k|    int res = 0;
  460|  8.41k|    int errcode = 0;
  461|       |
  462|  8.41k|    if (!ret_dbg) {
  ------------------
  |  Branch (462:9): [True: 0, False: 8.41k]
  ------------------
  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.41k|    *ret_dbg = 0;
  468|       |
  469|  8.41k|    res = _dwarf_object_detector_fd_a(fd,
  470|  8.41k|        &ftype,
  471|  8.41k|        &endian,&offsetsize,0,
  472|  8.41k|        &filesize,&errcode);
  473|  8.41k|    if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|  8.41k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (473:9): [True: 428, False: 7.98k]
  ------------------
  474|    428|        return res;
  475|    428|    }
  476|  7.98k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|  7.98k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (476:9): [True: 21, False: 7.96k]
  ------------------
  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.96k|    switch(ftype) {
  481|  4.58k|    case DW_FTYPE_ELF: {
  ------------------
  |  |  114|  4.58k|#define DW_FTYPE_ELF        1  /* Unix/Linux/etc */
  ------------------
  |  Branch (481:5): [True: 4.58k, False: 3.38k]
  ------------------
  482|  4.58k|        int res2 = 0;
  483|       |
  484|  4.58k|        res2 = _dwarf_elf_nlsetup(fd,"",
  485|  4.58k|            ftype,endian,offsetsize,filesize,
  486|  4.58k|            group_number,errhand,errarg,ret_dbg,error);
  487|  4.58k|        if (res2 != DW_DLV_OK) {
  ------------------
  |  |  122|  4.58k|#define DW_DLV_OK        0
  ------------------
  |  Branch (487:13): [True: 3.91k, False: 667]
  ------------------
  488|  3.91k|            return res2;
  489|  3.91k|        }
  490|    667|        set_global_paths_init(*ret_dbg,error);
  491|    667|        return res2;
  492|  4.58k|        }
  493|    530|    case DW_FTYPE_APPLEUNIVERSAL:
  ------------------
  |  |  118|    530|#define DW_FTYPE_APPLEUNIVERSAL    5
  ------------------
  |  Branch (493:5): [True: 530, False: 7.43k]
  ------------------
  494|  2.64k|    case DW_FTYPE_MACH_O: {
  ------------------
  |  |  115|  2.64k|#define DW_FTYPE_MACH_O     2  /* Macos. */
  ------------------
  |  Branch (494:5): [True: 2.11k, False: 5.85k]
  ------------------
  495|  2.64k|        int resm = 0;
  496|       |
  497|  2.64k|        resm = _dwarf_macho_setup(fd,"",
  498|  2.64k|            universalnumber,
  499|  2.64k|            ftype,endian,offsetsize,filesize,
  500|  2.64k|            group_number,errhand,errarg,ret_dbg,error);
  501|  2.64k|        if (resm != DW_DLV_OK) {
  ------------------
  |  |  122|  2.64k|#define DW_DLV_OK        0
  ------------------
  |  Branch (501:13): [True: 2.44k, False: 201]
  ------------------
  502|  2.44k|            return resm;
  503|  2.44k|        }
  504|    201|        set_global_paths_init(*ret_dbg,error);
  505|    201|        return resm;
  506|  2.64k|        }
  507|       |
  508|    738|    case DW_FTYPE_PE: {
  ------------------
  |  |  116|    738|#define DW_FTYPE_PE         3  /* Windows */
  ------------------
  |  Branch (508:5): [True: 738, False: 7.22k]
  ------------------
  509|    738|        int resp = 0;
  510|       |
  511|    738|        resp = _dwarf_pe_setup(fd,
  512|    738|            "",
  513|    738|            ftype,endian,offsetsize,filesize,
  514|    738|            group_number,errhand,errarg,ret_dbg,error);
  515|    738|        if (resp != DW_DLV_OK) {
  ------------------
  |  |  122|    738|#define DW_DLV_OK        0
  ------------------
  |  Branch (515:13): [True: 541, False: 197]
  ------------------
  516|    541|            return resp;
  517|    541|        }
  518|    197|        set_global_paths_init(*ret_dbg,error);
  519|    197|        return resp;
  520|    738|        }
  521|      1|    default: break;
  ------------------
  |  Branch (521:5): [True: 1, False: 7.96k]
  ------------------
  522|  7.96k|    }
  523|  7.96k|    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.41k|{
  538|       |#ifdef LIBDWARF_MALLOC
  539|       |    _libdwarf_finish();
  540|       |#endif
  541|  8.41k|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|  8.41k|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|  1.06k|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   33|  7.34k|#define TRUE 1
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   36|  1.06k|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 7.34k, False: 1.06k]
  |  |  |  Branch (159:7): [True: 7.34k, False: 1.06k]
  |  |  |  Branch (159:15): [True: 0, False: 1.06k]
  |  |  ------------------
  ------------------
  542|  7.34k|        _dwarf_free_static_errlist();
  543|  7.34k|        return DW_DLV_OK;
  ------------------
  |  |  122|  7.34k|#define DW_DLV_OK        0
  ------------------
  544|  7.34k|    }
  545|  1.06k|    if (dbg->de_obj_file) {
  ------------------
  |  Branch (545:9): [True: 1.06k, 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.06k|        char otype  = *(char *)(dbg->de_obj_file->ai_object);
  550|       |
  551|  1.06k|        switch(otype) {
  552|      0|        case 'E': /* libelf. Impossible for years now. */
  ------------------
  |  Branch (552:9): [True: 0, False: 1.06k]
  ------------------
  553|      0|            break;
  554|    667|        case 'F':
  ------------------
  |  Branch (554:9): [True: 667, False: 398]
  ------------------
  555|       |            /* Non-libelf elf access */
  556|    868|        case 'M':
  ------------------
  |  Branch (556:9): [True: 201, False: 864]
  ------------------
  557|  1.06k|        case 'P':
  ------------------
  |  Branch (557:9): [True: 197, False: 868]
  ------------------
  558|       |            /* These take care of data alloc/mmap
  559|       |                by object type. */
  560|  1.06k|            dbg->de_obj_file->ai_methods->om_finish(dbg->de_obj_file);
  561|  1.06k|        default:
  ------------------
  |  Branch (561:9): [True: 0, False: 1.06k]
  ------------------
  562|       |            /*  Do nothing. A serious internal error */
  563|  1.06k|            break;
  564|  1.06k|        }
  565|  1.06k|    }
  566|  1.06k|    if (dbg->de_owns_fd) {
  ------------------
  |  Branch (566:9): [True: 0, False: 1.06k]
  ------------------
  567|      0|        _dwarf_closer(dbg->de_fd);
  568|      0|        dbg->de_owns_fd = FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  569|      0|    }
  570|  1.06k|    free((void *)dbg->de_path);
  571|  1.06k|    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.06k|    return dwarf_object_finish(dbg);
  582|  1.06k|}
dwarf_generic_init.c:set_global_paths_init:
  132|  1.06k|{
  133|  1.06k|    int res = 0;
  134|       |
  135|  1.06k|    res = dwarf_add_debuglink_global_path(dbg,
  136|  1.06k|        "/usr/lib/debug",error);
  137|  1.06k|    return res;
  138|  1.06k|}

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

_dwarf_harmless_init:
  226|  1.06k|{
  227|  1.06k|    unsigned i = 0;
  228|  1.06k|    memset(dhp,0,sizeof(*dhp));
  229|  1.06k|    dhp->dh_maxcount = size +1;
  230|  1.06k|    dhp->dh_errors = (char **)calloc(dhp->dh_maxcount,
  231|  1.06k|        sizeof(char *));
  232|  1.06k|    if (!dhp->dh_errors) {
  ------------------
  |  Branch (232:9): [True: 0, False: 1.06k]
  ------------------
  233|      0|        dhp->dh_maxcount = 0;
  234|      0|        return;
  235|      0|    }
  236|  6.39k|    for (i = 0; i < dhp->dh_maxcount; ++i) {
  ------------------
  |  Branch (236:17): [True: 5.32k, False: 1.06k]
  ------------------
  237|  5.32k|        char *newstr =
  238|  5.32k|            (char *)calloc(1, DW_HARMLESS_ERROR_MSG_STRING_SIZE);
  ------------------
  |  |   76|  5.32k|#define DW_HARMLESS_ERROR_MSG_STRING_SIZE 300
  ------------------
  239|  5.32k|        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.32k|        dhp->dh_errors[i] = newstr;
  253|  5.32k|    }
  254|  1.06k|}
_dwarf_harmless_cleanout:
  258|  4.45k|{
  259|  4.45k|    unsigned i = 0;
  260|  4.45k|    if (!dhp->dh_errors) {
  ------------------
  |  Branch (260:9): [True: 3.38k, False: 1.06k]
  ------------------
  261|  3.38k|        return;
  262|  3.38k|    }
  263|  6.39k|    for (i = 0; i < dhp->dh_maxcount; ++i) {
  ------------------
  |  Branch (263:17): [True: 5.32k, False: 1.06k]
  ------------------
  264|  5.32k|        free(dhp->dh_errors[i]);
  265|  5.32k|        dhp->dh_errors[i] = 0;
  266|  5.32k|    }
  267|  1.06k|    free(dhp->dh_errors);
  268|  1.06k|    dhp->dh_errors = 0;
  269|  1.06k|    dhp->dh_maxcount = 0;
  270|  1.06k|}

dwarf_object_init_b:
 1064|  3.38k|{
 1065|  3.38k|    Dwarf_Debug dbg = 0;
 1066|  3.38k|    int setup_result = DW_DLV_OK;
  ------------------
  |  |  122|  3.38k|#define DW_DLV_OK        0
  ------------------
 1067|  3.38k|    Dwarf_Unsigned filesize = 0;
 1068|       |
 1069|  3.38k|    if (!ret_dbg) {
  ------------------
  |  Branch (1069:9): [True: 0, False: 3.38k]
  ------------------
 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.38k|    *ret_dbg = 0;
 1076|  3.38k|    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.38k|    dbg = _dwarf_get_debug(filesize);
 1082|  3.38k|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|  3.38k|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|  3.38k|#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.38k|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 0, False: 3.38k]
  |  |  |  Branch (159:7): [True: 0, False: 3.38k]
  |  |  |  Branch (159:15): [True: 0, False: 3.38k]
  |  |  ------------------
  ------------------
 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.38k|    dbg->de_errhand = errhand;
 1088|  3.38k|    dbg->de_errarg = errarg;
 1089|  3.38k|    dbg->de_frame_rule_initial_value = DW_FRAME_REG_INITIAL_VALUE;
  ------------------
  |  |  961|  3.38k|#define DW_FRAME_REG_INITIAL_VALUE DW_FRAME_SAME_VAL
  |  |  ------------------
  |  |  |  |  142|  3.38k|#define DW_FRAME_SAME_VAL               12289
  |  |  ------------------
  ------------------
 1090|  3.38k|    dbg->de_frame_reg_rules_entry_count = DW_FRAME_LAST_REG_NUM;
  ------------------
  |  | 1681|  3.38k|#define DW_FRAME_LAST_REG_NUM   (DW_FRAME_HIGHEST_NORMAL_REGISTER + 1)
  |  |  ------------------
  |  |  |  | 1676|  3.38k|#define DW_FRAME_HIGHEST_NORMAL_REGISTER 188
  |  |  ------------------
  ------------------
 1091|  3.38k|    dbg->de_frame_cfa_col_number = DW_FRAME_CFA_COL3;
  ------------------
  |  |  149|  3.38k|#define DW_FRAME_CFA_COL3 DW_FRAME_CFA_COL /*compatibility name*/
  |  |  ------------------
  |  |  |  |  147|  3.38k|#define DW_FRAME_CFA_COL                12290
  |  |  ------------------
  ------------------
 1092|  3.38k|    dbg->de_frame_same_value_number = DW_FRAME_SAME_VAL;
  ------------------
  |  |  142|  3.38k|#define DW_FRAME_SAME_VAL               12289
  ------------------
 1093|  3.38k|    dbg->de_frame_undefined_value_number  = DW_FRAME_UNDEFINED_VAL;
  ------------------
  |  |  137|  3.38k|#define DW_FRAME_UNDEFINED_VAL          12288
  ------------------
 1094|  3.38k|    dbg->de_dbg = dbg;
 1095|       |    /*  See  dwarf_set_tied_dbg()  dwarf_get_tied_dbg()
 1096|       |        and comments in dwarf_opaque.h*/
 1097|  3.38k|    dbg->de_primary_dbg = dbg;
 1098|  3.38k|    dbg->de_secondary_dbg = 0;
 1099|  3.38k|    dbg->de_errors_dbg = dbg;
 1100|       |
 1101|  3.38k|    dbg->de_obj_file = obj;
 1102|  3.38k|    dbg->de_filesize = filesize;
 1103|  3.38k|    dbg->de_groupnumber = groupnumber;
 1104|  3.38k|    setup_result = _dwarf_setup(dbg, error);
 1105|  3.38k|    if (setup_result == DW_DLV_OK) {
  ------------------
  |  |  122|  3.38k|#define DW_DLV_OK        0
  ------------------
  |  Branch (1105:9): [True: 1.59k, False: 1.79k]
  ------------------
 1106|  1.59k|        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.59k|        if (fission_result == DW_DLV_ERROR) {
  ------------------
  |  |  123|  1.59k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (1111:13): [True: 525, False: 1.06k]
  ------------------
 1112|       |            /*  Something is very wrong. */
 1113|    525|            setup_result = fission_result;
 1114|    525|        }
 1115|  1.59k|        if (setup_result == DW_DLV_OK) {
  ------------------
  |  |  122|  1.59k|#define DW_DLV_OK        0
  ------------------
  |  Branch (1115:13): [True: 1.06k, False: 525]
  ------------------
 1116|       |            /*  Defaults OFF as of 25 Nov 2025. V2.2.1 */
 1117|  1.06k|            dbg->de_harmless_errors_on = 0;
 1118|  1.06k|            _dwarf_harmless_init(&dbg->de_harmless_errors,
 1119|  1.06k|                DW_HARMLESS_ERROR_CIRCULAR_LIST_DEFAULT_SIZE);
  ------------------
  |  | 8985|  1.06k|#define DW_HARMLESS_ERROR_CIRCULAR_LIST_DEFAULT_SIZE 4
  ------------------
 1120|  1.06k|            *ret_dbg = dbg;
 1121|       |            /*  This is the normal return. */
 1122|  1.06k|            return setup_result;
 1123|  1.06k|        }
 1124|  1.59k|    }
 1125|  2.32k|    if (setup_result == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|  2.32k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (1125:9): [True: 1.58k, False: 733]
  ------------------
 1126|  1.58k|        _dwarf_free_all_of_one_debug(dbg);
 1127|  1.58k|        dbg = 0;
 1128|       |        /*  ASSERT: _dwarf_free_all_of_one_debug() never returns
 1129|       |            DW_DLV_ERROR */
 1130|  1.58k|        return setup_result;
 1131|  1.58k|    }
 1132|       |    /*  An error of some sort. Report it as well as
 1133|       |        possible.
 1134|       |        ASSERT: setup_result == DW_DLV_ERROR
 1135|       |        here  */
 1136|    733|    {
 1137|    733|        Dwarf_Unsigned myerr = 0;
 1138|    733|        dwarfstring msg;
 1139|       |
 1140|    733|        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|    733|        if (error && *error) {
  ------------------
  |  Branch (1149:13): [True: 0, False: 733]
  |  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|    733|        _dwarf_free_all_of_one_debug(dbg);
 1165|    733|        dbg = 0;
 1166|    733|        if (myerr) {
  ------------------
  |  Branch (1166:13): [True: 0, False: 733]
  ------------------
 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|    733|    }
 1178|    733|    return setup_result;
 1179|  2.32k|}
dwarf_object_finish:
 1190|  1.06k|{
 1191|  1.06k|    int res = 0;
 1192|       |    /* do not use CHECK_DBG */
 1193|  1.06k|    _dwarf_harmless_cleanout(&dbg->de_harmless_errors);
 1194|  1.06k|    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.06k|    return res;
 1199|  1.06k|}
_dwarf_load_section:
 1472|  2.43k|{
 1473|  2.43k|    int res  = DW_DLV_ERROR;
  ------------------
  |  |  123|  2.43k|#define DW_DLV_ERROR     1
  ------------------
 1474|  2.43k|    struct Dwarf_Obj_Access_Interface_a_s *o = 0;
 1475|  2.43k|    int            errc = 0;
 1476|  2.43k|    Dwarf_Unsigned data_len = 0;
 1477|  2.43k|    Dwarf_Small   *mmap_real_area = 0;
 1478|  2.43k|    Dwarf_Unsigned mmap_offset = 0;
 1479|  2.43k|    Dwarf_Unsigned mmap_len = 0;
 1480|  2.43k|    Dwarf_Small   *data_ptr = 0;
 1481|  2.43k|    enum Dwarf_Sec_Alloc_Pref pref =
 1482|  2.43k|        _dwarf_determine_section_allocation_type();
 1483|  2.43k|    enum Dwarf_Sec_Alloc_Pref finaltype = pref;
 1484|       |
 1485|       |    /* check to see if the section is already loaded */
 1486|  2.43k|    if (section->dss_data !=  NULL) {
  ------------------
  |  Branch (1486:9): [True: 0, False: 2.43k]
  ------------------
 1487|      0|        return DW_DLV_OK;
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
 1488|      0|    }
 1489|  2.43k|    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.43k|    data_len = section->dss_size;
 1503|  2.43k|#ifdef HAVE_FULL_MMAP
 1504|  2.43k|    if (o->ai_methods->om_load_section_a) {
  ------------------
  |  Branch (1504:9): [True: 2.04k, False: 395]
  ------------------
 1505|  2.04k|        res = o->ai_methods->om_load_section_a(o->ai_object,
 1506|  2.04k|            section->dss_index,
 1507|  2.04k|            &finaltype,
 1508|  2.04k|            &data_ptr, &data_len,
 1509|  2.04k|            &mmap_real_area,&mmap_offset,&mmap_len,
 1510|  2.04k|            &errc);
 1511|  2.04k|    } else
 1512|    395|#endif /* HAVE_FULL_MMAP */
 1513|    395|    {
 1514|    395|        if (o->ai_methods->om_load_section) {
  ------------------
  |  Branch (1514:13): [True: 395, False: 0]
  ------------------
 1515|    395|            res = o->ai_methods->om_load_section(o->ai_object,
 1516|    395|                section->dss_index,
 1517|    395|                &data_ptr,
 1518|    395|                &errc);
 1519|    395|            finaltype = Dwarf_Alloc_Malloc;
 1520|    395|        } 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|    395|    }
 1530|  2.43k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|  2.43k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (1530:9): [True: 706, False: 1.73k]
  ------------------
 1531|    706|        DWARF_DBG_ERROR(dbg, errc, DW_DLV_ERROR);
  ------------------
  |  |   43|    706|    _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.73k|    if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|  1.73k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (1542:9): [True: 3, False: 1.72k]
  ------------------
 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.72k|    section->dss_was_alloc = FALSE;
  ------------------
  |  |   36|  1.72k|#define FALSE 0
  ------------------
 1555|  1.72k|    section->dss_computed_mmap_offset = mmap_offset;
 1556|  1.72k|    section->dss_computed_mmap_len = mmap_len;
 1557|  1.72k|    section->dss_mmap_realarea = mmap_real_area;
 1558|  1.72k|    section->dss_size = data_len;
 1559|  1.72k|    section->dss_data = data_ptr;
 1560|  1.72k|    section->dss_load_preference = pref;
 1561|  1.72k|    section->dss_actual_load_type = finaltype;
 1562|       |
 1563|  1.72k|    if (section->dss_ignore_reloc_group_sec) {
  ------------------
  |  Branch (1563:9): [True: 1.02k, False: 699]
  ------------------
 1564|       |        /* Neither zdebug nor reloc apply to .group sections. */
 1565|  1.02k|        return res;
 1566|  1.02k|    }
 1567|       |    /*  We delay decompress of dwarfdump-important sections
 1568|       |        to here, not decompress in elf-specific reader. */
 1569|    699|    if ((section->dss_zdebug_requires_decompress ||
  ------------------
  |  Branch (1569:10): [True: 4, False: 695]
  ------------------
 1570|    695|        section->dss_shf_compressed ||
  ------------------
  |  Branch (1570:9): [True: 11, False: 684]
  ------------------
 1571|    684|        section->dss_ZLIB_compressed) &&
  ------------------
  |  Branch (1571:9): [True: 0, False: 684]
  ------------------
 1572|     15|        !section->dss_did_decompress) {
  ------------------
  |  Branch (1572:9): [True: 15, False: 0]
  ------------------
 1573|     15|        if (!section->dss_data) {
  ------------------
  |  Branch (1573:13): [True: 0, False: 15]
  ------------------
 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|     15|        _dwarf_error_string(dbg, error,
 1590|     15|            DW_DLE_ZDEBUG_REQUIRES_ZLIB,
  ------------------
  |  | 1360|     15|#define DW_DLE_ZDEBUG_REQUIRES_ZLIB            314
  ------------------
 1591|     15|            "DW_DLE_ZDEBUG_REQUIRES_ZLIB: "
 1592|     15|            " zlib and zstd are missing, cannot"
 1593|     15|            " decompress section.");
 1594|     15|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     15|#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|    684|    if (_dwarf_apply_relocs == 0) {
  ------------------
  |  Branch (1600:9): [True: 0, False: 684]
  ------------------
 1601|      0|        return res;
 1602|      0|    }
 1603|    684|    if (section->dss_reloc_size == 0) {
  ------------------
  |  Branch (1603:9): [True: 560, False: 124]
  ------------------
 1604|    560|        return res;
 1605|    560|    }
 1606|    124|    if (!o->ai_methods->om_relocate_a_section) {
  ------------------
  |  Branch (1606:9): [True: 0, False: 124]
  ------------------
 1607|      0|        return res;
 1608|      0|    }
 1609|       |    /*apply relocations */
 1610|    124|    res = o->ai_methods->om_relocate_a_section(o->ai_object,
 1611|    124|        section->dss_index, dbg, &errc);
 1612|    124|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|    124|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (1612:9): [True: 124, False: 0]
  ------------------
 1613|    124|        DWARF_DBG_ERROR(dbg, errc, DW_DLV_ERROR);
  ------------------
  |  |   43|    124|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
 1614|      0|    }
 1615|      0|    return res;
 1616|    124|}
dwarf_init_finish.c:_dwarf_setup:
  750|  3.38k|{
  751|  3.38k|    const char    *scn_name = 0;
  752|  3.38k|    struct Dwarf_Obj_Access_Interface_a_s * obj = 0;
  753|  3.38k|    int            resn = 0;
  754|  3.38k|    struct Dwarf_Section_s **sections = 0;
  755|  3.38k|    Dwarf_Small    endianness = 0;
  756|  3.38k|    Dwarf_Unsigned section_count = 0;
  757|  3.38k|    unsigned       default_group_number = 0;
  758|  3.38k|    unsigned       foundDwarf = FALSE;
  ------------------
  |  |   36|  3.38k|#define FALSE 0
  ------------------
  759|  3.38k|    Dwarf_Unsigned obj_section_index = 0;
  760|       |
  761|  3.38k|    dbg->de_assume_string_in_bounds =
  762|  3.38k|        _dwarf_assume_string_in_bounds;
  763|       |    /* First make an arbitrary assumption. */
  764|  3.38k|    dbg->de_copy_word = _dwarf_memcpy_noswap_bytes;
  765|  3.38k|    obj = dbg->de_obj_file;
  766|  3.38k|    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.38k|    dbg->de_big_endian_object = 0;
  776|  3.38k|    if (endianness == DW_END_big ) {
  ------------------
  |  | 1114|  3.38k|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  |  Branch (776:9): [True: 2.26k, False: 1.11k]
  ------------------
  777|  2.26k|        dbg->de_big_endian_object = 1;
  778|  2.26k|        dbg->de_copy_word = _dwarf_memcpy_swap_bytes;
  779|  2.26k|    }
  780|  3.38k|#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.38k|    dbg->de_length_size = obj->ai_methods->
  786|  3.38k|        om_get_length_size(obj->ai_object);
  787|  3.38k|    dbg->de_pointer_size =
  788|  3.38k|        obj->ai_methods->om_get_pointer_size(obj->ai_object);
  789|  3.38k|    section_count = obj->ai_methods->
  790|  3.38k|        om_get_section_count(obj->ai_object);
  791|  3.38k|    resn = determine_target_group(section_count,obj,
  792|  3.38k|        &default_group_number,dbg,error);
  793|  3.38k|    if (resn == DW_DLV_ERROR) {
  ------------------
  |  |  123|  3.38k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (793:9): [True: 10, False: 3.37k]
  ------------------
  794|     10|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     10|#define DW_DLV_ERROR     1
  ------------------
  795|     10|    }
  796|  3.37k|    if (dbg->de_groupnumber == DW_GROUPNUMBER_ANY) {
  ------------------
  |  |  126|  3.37k|#define DW_GROUPNUMBER_ANY  0
  ------------------
  |  Branch (796:9): [True: 3.37k, False: 0]
  ------------------
  797|  3.37k|        dbg->de_groupnumber = default_group_number;
  798|  3.37k|    }
  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.37k|    sections = (struct Dwarf_Section_s **)calloc(section_count + 1,
  803|  3.37k|        sizeof(struct Dwarf_Section_s *));
  804|  3.37k|    if (!sections) {
  ------------------
  |  Branch (804:9): [True: 0, False: 3.37k]
  ------------------
  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|   198k|    for (obj_section_index = 0; obj_section_index < section_count;
  ------------------
  |  Branch (826:33): [True: 195k, False: 3.17k]
  ------------------
  827|   195k|        ++obj_section_index) {
  828|       |
  829|   195k|        struct Dwarf_Obj_Access_Section_a_s doas;
  830|   195k|        int res = DW_DLV_ERROR;
  ------------------
  |  |  123|   195k|#define DW_DLV_ERROR     1
  ------------------
  831|   195k|        int err = 0;
  832|   195k|        unsigned groupnumber = 0;
  833|   195k|        unsigned mapgroupnumber = 0;
  834|   195k|        int is_rela = FALSE;
  ------------------
  |  |   36|   195k|#define FALSE 0
  ------------------
  835|       |
  836|   195k|        res = _dwarf_section_get_target_group_from_map(dbg,
  837|   195k|            (unsigned int)obj_section_index, &groupnumber,error);
  838|   195k|        if (res == DW_DLV_OK ) {
  ------------------
  |  |  122|   195k|#define DW_DLV_OK        0
  ------------------
  |  Branch (838:13): [True: 107k, False: 87.9k]
  ------------------
  839|       |            /* groupnumber is set. Fall through */
  840|   107k|            mapgroupnumber = groupnumber;
  841|   107k|        } else if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|  87.9k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (841:20): [True: 0, False: 87.9k]
  ------------------
  842|      0|            free(sections);
  843|      0|            return res;
  844|  87.9k|        } else { /* DW_DLV_NO_ENTRY */
  845|       |            /* fall through, a BASE or DWO group, possibly */
  846|  87.9k|        }
  847|   195k|        memset(&doas,0,sizeof(doas));
  848|       |
  849|   195k|        res = obj->ai_methods->om_get_section_info(obj->ai_object,
  850|   195k|            obj_section_index,
  851|   195k|            &doas, &err);
  852|   195k|        if (res == DW_DLV_NO_ENTRY){
  ------------------
  |  |  121|   195k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (852:13): [True: 0, False: 195k]
  ------------------
  853|      0|            free(sections);
  854|      0|            return res;
  855|      0|        }
  856|   195k|        if (res == DW_DLV_ERROR){
  ------------------
  |  |  123|   195k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (856:13): [True: 0, False: 195k]
  ------------------
  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|   195k|        scn_name = doas.as_name;
  861|   195k|        if (!groupnumber) {
  ------------------
  |  Branch (861:13): [True: 87.9k, False: 107k]
  ------------------
  862|       |            /* This finds dwo sections, group 2 */
  863|  87.9k|            res = _dwarf_dwo_groupnumber_given_name(scn_name,
  864|  87.9k|                &groupnumber);
  865|  87.9k|            if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|  87.9k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (865:17): [True: 87.3k, False: 651]
  ------------------
  866|       |                /* No, must be group 1 */
  867|  87.3k|                groupnumber = DW_GROUPNUMBER_BASE;
  ------------------
  |  |  127|  87.3k|#define DW_GROUPNUMBER_BASE 1
  ------------------
  868|  87.3k|            }
  869|  87.9k|        }
  870|   195k|        if (!this_section_dwarf_relevant(scn_name,
  ------------------
  |  Branch (870:13): [True: 48.5k, False: 146k]
  ------------------
  871|   195k|            (int)doas.as_type,
  872|   195k|            &is_rela) ) {
  873|  48.5k|            continue;
  874|  48.5k|        }
  875|   146k|        if (!is_a_relx_section(scn_name,(int)doas.as_type,
  ------------------
  |  Branch (875:13): [True: 139k, False: 7.57k]
  ------------------
  876|   146k|            &is_rela)
  877|   139k|            && !is_a_special_section_semi_dwarf(scn_name)) {
  ------------------
  |  Branch (877:16): [True: 107k, False: 31.7k]
  ------------------
  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|   107k|            if (mapgroupnumber == dbg->de_groupnumber) {
  ------------------
  |  Branch (883:17): [True: 101k, False: 6.31k]
  ------------------
  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|   101k|            } else {
  889|       |                /* This section not mapped into this group. */
  890|  6.31k|                if (groupnumber == 1 && dbg->de_groupnumber > 2 &&
  ------------------
  |  Branch (890:21): [True: 298, False: 6.01k]
  |  Branch (890:41): [True: 241, False: 57]
  ------------------
  891|    241|                    !_dwarf_section_in_group_by_name(dbg,scn_name,
  ------------------
  |  Branch (891:21): [True: 194, False: 47]
  ------------------
  892|    241|                        dbg->de_groupnumber)) {
  893|       |                    /* Load the section (but as group 1) */
  894|  6.11k|                } else {
  895|  6.11k|                    continue;
  896|  6.11k|                }
  897|  6.31k|            }
  898|   107k|        }
  899|       |        /* BUILDING_SECTIONS.  See also BUILDING_MAP, SETUP_SECTION */
  900|   140k|        {
  901|       |            /*  Build up the sections table and the
  902|       |                de_debug* etc pointers in Dwarf_Debug. */
  903|   140k|            struct Dwarf_dbg_sect_s *section = 0;
  904|   140k|            int found_match = FALSE;
  ------------------
  |  |   36|   140k|#define FALSE 0
  ------------------
  905|       |
  906|   140k|            res = is_section_name_known_already(dbg,scn_name);
  907|   140k|            if (res == DW_DLV_OK) {
  ------------------
  |  |  122|   140k|#define DW_DLV_OK        0
  ------------------
  |  Branch (907:17): [True: 41.0k, False: 99.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|  41.0k|                continue;
  915|  41.0k|            }
  916|  99.6k|            if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|  99.6k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (916:17): [True: 0, False: 99.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|  99.6k|            res = _dwarf_enter_section_in_de_debug_sections_array(dbg,
  922|  99.6k|                scn_name, obj_section_index, groupnumber,&err);
  923|  99.6k|            if (res == DW_DLV_OK) {
  ------------------
  |  |  122|  99.6k|#define DW_DLV_OK        0
  ------------------
  |  Branch (923:17): [True: 2.68k, False: 96.9k]
  ------------------
  924|  2.68k|                section = &dbg->de_debug_sections[
  925|  2.68k|                    dbg->de_debug_sections_total_entries-1];
  926|  2.68k|                res = get_basic_section_data(dbg,
  927|  2.68k|                    section->ds_secdata, &doas,
  928|  2.68k|                    obj_section_index,
  929|  2.68k|                    groupnumber,
  930|  2.68k|                    error,
  931|  2.68k|                    section->ds_duperr,
  932|  2.68k|                    section->ds_emptyerr);
  933|  2.68k|                if (res != DW_DLV_OK) {
  ------------------
  |  |  122|  2.68k|#define DW_DLV_OK        0
  ------------------
  |  Branch (933:21): [True: 22, False: 2.65k]
  ------------------
  934|     22|                    free(sections);
  935|     22|                    return res;
  936|     22|                }
  937|  2.65k|                sections[obj_section_index] = section->ds_secdata;
  938|  2.65k|                foundDwarf += section->ds_have_dwarf;
  939|  2.65k|                found_match = TRUE;
  ------------------
  |  |   33|  2.65k|#define TRUE 1
  ------------------
  940|       |                /*  Normal section set up.
  941|       |                    Fall through. */
  942|  96.9k|            } else if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|  96.9k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (942:24): [True: 96.9k, False: 43]
  ------------------
  943|       |                /*  We get here for relocation sections.
  944|       |                    Fall through. */
  945|  96.9k|            } else {
  946|     43|                free(sections);
  947|     43|                DWARF_DBG_ERROR(dbg, err, DW_DLV_ERROR);
  ------------------
  |  |   43|     43|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
  948|      0|            }
  949|       |
  950|  99.5k|            if (!found_match) {
  ------------------
  |  Branch (950:17): [True: 96.9k, False: 2.65k]
  ------------------
  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|  96.9k|                if (is_a_relx_section(scn_name,
  ------------------
  |  Branch (959:21): [True: 6.73k, False: 90.1k]
  ------------------
  960|  96.9k|                    (int)doas.as_type, &is_rela)) {
  961|  6.73k|                    if ( doas.as_info < section_count) {
  ------------------
  |  Branch (961:26): [True: 6.60k, False: 133]
  ------------------
  962|  6.60k|                        if (sections[doas.as_info]) {
  ------------------
  |  Branch (962:29): [True: 531, False: 6.07k]
  ------------------
  963|    531|                            add_relx_data_to_secdata(
  964|    531|                                sections[doas.as_info],
  965|    531|                                &doas,
  966|    531|                                obj_section_index,is_rela);
  967|    531|                        }
  968|  6.60k|                    } else {
  969|       |                        /* Something is wrong with the object file. */
  970|    133|                        free(sections);
  971|    133|                        DWARF_DBG_ERROR(dbg, DW_DLE_ELF_SECT_ERR,
  ------------------
  |  |   43|    133|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
  972|    133|                            DW_DLV_ERROR);
  973|      0|                    }
  974|  6.73k|                }
  975|  96.9k|            }
  976|       |            /* Fetch next section */
  977|  99.5k|        }
  978|  99.5k|    }
  979|       |
  980|       |    /* Free table with section information. */
  981|  3.17k|    free(sections);
  982|  3.17k|    if (foundDwarf) {
  ------------------
  |  Branch (982:9): [True: 1.59k, False: 1.58k]
  ------------------
  983|  1.59k|        return DW_DLV_OK;
  ------------------
  |  |  122|  1.59k|#define DW_DLV_OK        0
  ------------------
  984|  1.59k|    }
  985|  1.58k|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|  1.58k|#define DW_DLV_NO_ENTRY -1
  ------------------
  986|  3.17k|}
dwarf_init_finish.c:determine_target_group:
  603|  3.38k|{
  604|  3.38k|    unsigned obj_section_index = 0;
  605|  3.38k|    int found_group_one = 0;
  606|  3.38k|    int found_group_two = 0;
  607|  3.38k|    struct Dwarf_Group_Data_s *grp = 0;
  608|  3.38k|    unsigned comdat_group_next = 3;
  609|  3.38k|    unsigned lowest_comdat_groupnum = 0;
  610|       |
  611|  3.38k|    grp = &dbg->de_groupnumbers;
  612|  3.38k|    grp->gd_number_of_groups = 0;
  613|  3.38k|    grp->gd_number_of_sections = (unsigned int)section_count;
  614|  3.38k|    if (grp->gd_map) {
  ------------------
  |  Branch (614:9): [True: 0, False: 3.38k]
  ------------------
  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|   240k|    for (obj_section_index = 0; obj_section_index < section_count;
  ------------------
  |  Branch (618:33): [True: 236k, False: 3.37k]
  ------------------
  619|   236k|        ++obj_section_index) {
  620|       |
  621|   236k|        struct Dwarf_Obj_Access_Section_a_s doas;
  622|   236k|        int res = DW_DLV_ERROR;
  ------------------
  |  |  123|   236k|#define DW_DLV_ERROR     1
  ------------------
  623|   236k|        int err = 0;
  624|   236k|        const char *scn_name = 0;
  625|   236k|        unsigned groupnumber = 0;
  626|   236k|        unsigned mapgroupnumber = 0;
  627|   236k|        int is_rela = FALSE;
  ------------------
  |  |   36|   236k|#define FALSE 0
  ------------------
  628|       |
  629|   236k|        memset(&doas,0,sizeof(doas));
  630|   236k|        res = obj->ai_methods->om_get_section_info(obj->ai_object,
  631|   236k|            obj_section_index,
  632|   236k|            &doas, &err);
  633|   236k|        if (res == DW_DLV_NO_ENTRY){
  ------------------
  |  |  121|   236k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (633:13): [True: 0, False: 236k]
  ------------------
  634|      0|            return res;
  635|      0|        }
  636|   236k|        if (res == DW_DLV_ERROR){
  ------------------
  |  |  123|   236k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (636:13): [True: 0, False: 236k]
  ------------------
  637|      0|            _dwarf_error(dbg, error,err);
  638|      0|            return res;
  639|      0|        }
  640|       |
  641|   236k|        if (doas.as_type == SHT_GROUP) {
  ------------------
  |  |   86|   236k|#define SHT_GROUP 17
  ------------------
  |  Branch (641:13): [True: 1.02k, False: 235k]
  ------------------
  642|       |            /*  See assumptions in function comment above. */
  643|  1.02k|            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.02k|            res = insert_sht_list_in_group_map(dbg,&doas,
  648|  1.02k|                comdat_group_next,
  649|  1.02k|                obj_section_index,
  650|  1.02k|                section_count,
  651|  1.02k|                obj,
  652|  1.02k|                &did_add_map,error);
  653|  1.02k|            if (res != DW_DLV_OK) {
  ------------------
  |  |  122|  1.02k|#define DW_DLV_OK        0
  ------------------
  |  Branch (653:17): [True: 10, False: 1.01k]
  ------------------
  654|     10|                return res;
  655|     10|            }
  656|  1.01k|            if (!lowest_comdat_groupnum) {
  ------------------
  |  Branch (656:17): [True: 283, False: 735]
  ------------------
  657|    283|                lowest_comdat_groupnum = comdat_group_next;
  658|    283|            }
  659|  1.01k|            if (did_add_map) {
  ------------------
  |  Branch (659:17): [True: 227, False: 791]
  ------------------
  660|    227|                ++grp->gd_number_of_groups;
  661|    227|                ++comdat_group_next;
  662|    227|            }
  663|  1.01k|            continue;
  664|  1.02k|        }
  665|   235k|        scn_name = doas.as_name;
  666|   235k|        if (!this_section_dwarf_relevant(scn_name,
  ------------------
  |  Branch (666:13): [True: 48.1k, False: 187k]
  ------------------
  667|   235k|            (int)doas.as_type,
  668|   235k|            &is_rela) ) {
  669|  48.1k|            continue;
  670|  48.1k|        }
  671|       |
  672|       |        /*  Now at a 'normal' section, though we do not
  673|       |            quite know what group it is. */
  674|       |
  675|   187k|        res = _dwarf_section_get_target_group_from_map(dbg,
  676|   187k|            obj_section_index,&groupnumber,error);
  677|   187k|        if (res == DW_DLV_OK ) {
  ------------------
  |  |  122|   187k|#define DW_DLV_OK        0
  ------------------
  |  Branch (677:13): [True: 210, False: 187k]
  ------------------
  678|       |            /*  groupnumber is set. Fall through.
  679|       |                All COMDAT group should get here. */
  680|    210|            mapgroupnumber = groupnumber;
  681|   187k|        } else if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|   187k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (681:20): [True: 0, False: 187k]
  ------------------
  682|      0|            return res;
  683|   187k|        } else { /* DW_DLV_NO_ENTRY */
  684|       |            /* Normal non-COMDAT. groupnumber is zero.  */
  685|   187k|        }
  686|       |
  687|       |        /* BUILDING_MAP.  See also BUILDING_SECTIONS, SETUP_SECTION */
  688|   187k|        if (!groupnumber) {
  ------------------
  |  Branch (688:13): [True: 187k, False: 210]
  ------------------
  689|   187k|            res =_dwarf_dwo_groupnumber_given_name(scn_name,
  690|   187k|                &groupnumber);
  691|       |            /* DW_DLV_ERROR impossible here. */
  692|   187k|            if (res == DW_DLV_OK) {
  ------------------
  |  |  122|   187k|#define DW_DLV_OK        0
  ------------------
  |  Branch (692:17): [True: 18.8k, False: 168k]
  ------------------
  693|       |                /* groupnumber set 2 */
  694|   168k|            } else {
  695|       |                /*  This is what it has to be.
  696|       |                    .rela in here too.  */
  697|   168k|                groupnumber = DW_GROUPNUMBER_BASE;
  ------------------
  |  |  127|   168k|#define DW_GROUPNUMBER_BASE 1
  ------------------
  698|   168k|            }
  699|   187k|        }
  700|   187k|        if (is_a_relx_section(scn_name,(int)doas.as_type,
  ------------------
  |  Branch (700:13): [True: 38.1k, False: 149k]
  ------------------
  701|   187k|            &is_rela)) {
  702|  38.1k|            continue;
  703|  38.1k|        }
  704|       |
  705|       |        /*  ASSERT: groupnumber non-zero now */
  706|   149k|        if (!is_a_special_section_semi_dwarf(scn_name)) {
  ------------------
  |  Branch (706:13): [True: 117k, False: 31.7k]
  ------------------
  707|   117k|            if (mapgroupnumber) {
  ------------------
  |  Branch (707:17): [True: 115, False: 117k]
  ------------------
  708|       |                /* Already in group map */
  709|    115|                continue;
  710|    115|            }
  711|       |            /* !mapgroupnumber */
  712|   117k|            res = _dwarf_insert_in_group_map(dbg,
  713|   117k|                (unsigned)groupnumber,
  714|   117k|                (unsigned)obj_section_index,
  715|   117k|                scn_name,
  716|   117k|                error);
  717|   117k|            if (res != DW_DLV_OK) {
  ------------------
  |  |  122|   117k|#define DW_DLV_OK        0
  ------------------
  |  Branch (717:17): [True: 0, False: 117k]
  ------------------
  718|      0|                return res;
  719|      0|            }
  720|   117k|            if (groupnumber == 1) {
  ------------------
  |  Branch (720:17): [True: 99.5k, False: 18.2k]
  ------------------
  721|  99.5k|                found_group_one++;
  722|  99.5k|            } else if (groupnumber == 2) {
  ------------------
  |  Branch (722:24): [True: 18.2k, False: 0]
  ------------------
  723|  18.2k|                found_group_two++;
  724|  18.2k|            } else { /* fall through to continue */ }
  725|   117k|            continue;
  726|   117k|        }
  727|   149k|    }
  728|  3.37k|    if (found_group_two) {
  ------------------
  |  Branch (728:9): [True: 470, False: 2.90k]
  ------------------
  729|    470|        ++grp->gd_number_of_groups;
  730|    470|    }
  731|  3.37k|    if (found_group_one) {
  ------------------
  |  Branch (731:9): [True: 1.76k, False: 1.60k]
  ------------------
  732|  1.76k|        *group_number_out = DW_GROUPNUMBER_BASE;
  ------------------
  |  |  127|  1.76k|#define DW_GROUPNUMBER_BASE 1
  ------------------
  733|  1.76k|        ++grp->gd_number_of_groups;
  734|  1.76k|    } else {
  735|  1.60k|        if (found_group_two) {
  ------------------
  |  Branch (735:13): [True: 186, False: 1.42k]
  ------------------
  736|    186|            *group_number_out = DW_GROUPNUMBER_DWO;
  ------------------
  |  |  128|    186|#define DW_GROUPNUMBER_DWO  2
  ------------------
  737|  1.42k|        } else {
  738|  1.42k|            if (lowest_comdat_groupnum) {
  ------------------
  |  Branch (738:17): [True: 238, False: 1.18k]
  ------------------
  739|    238|                *group_number_out = lowest_comdat_groupnum;
  740|  1.18k|            } else {
  741|  1.18k|                *group_number_out = DW_GROUPNUMBER_BASE;
  ------------------
  |  |  127|  1.18k|#define DW_GROUPNUMBER_BASE 1
  ------------------
  742|  1.18k|            }
  743|  1.42k|        }
  744|  1.60k|    }
  745|  3.37k|    return DW_DLV_OK;
  ------------------
  |  |  122|  3.37k|#define DW_DLV_OK        0
  ------------------
  746|  3.38k|}
dwarf_init_finish.c:insert_sht_list_in_group_map:
  430|  1.02k|{
  431|  1.02k|    struct Dwarf_Section_s secdata;
  432|  1.02k|    Dwarf_Small * data = 0;
  433|  1.02k|    int           res = 0;
  434|  1.02k|    Dwarf_Small*  secend = 0;
  435|       |
  436|  1.02k|    memset(&secdata,0,sizeof(secdata));
  437|  1.02k|    secdata.dss_size =      doas->as_size;
  438|  1.02k|    secdata.dss_entrysize = doas->as_entrysize;
  439|  1.02k|    secdata.dss_group_number = 1; /* arbitrary. */
  440|  1.02k|    secdata.dss_index     = section_number;
  441|  1.02k|    secdata.dss_name      = ".group";
  442|  1.02k|    secdata.dss_standard_name = ".group";
  443|  1.02k|    secdata.dss_number = section_number;
  444|  1.02k|    secdata.dss_ignore_reloc_group_sec = TRUE;
  ------------------
  |  |   33|  1.02k|#define TRUE 1
  ------------------
  445|  1.02k|    res = _dwarf_load_section(dbg,&secdata,error);
  446|  1.02k|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|  1.02k|#define DW_DLV_OK        0
  ------------------
  |  Branch (446:9): [True: 0, False: 1.02k]
  ------------------
  447|      0|        _dwarf_malloc_section_free(&secdata);
  448|      0|        return res;
  449|      0|    }
  450|  1.02k|    if (!secdata.dss_data) {
  ------------------
  |  Branch (450:9): [True: 0, False: 1.02k]
  ------------------
  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.02k|    if (doas->as_entrysize != 4) {
  ------------------
  |  Branch (454:9): [True: 0, False: 1.02k]
  ------------------
  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.02k|    data = secdata.dss_data;
  464|  1.02k|    secend = data + secdata.dss_size;
  465|  1.02k|    {
  466|  1.02k|        Dwarf_Unsigned i = 1;
  467|  1.02k|        Dwarf_Unsigned count = doas->as_size/doas->as_entrysize;
  468|  1.02k|        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.02k|        if ((data+DWARF_32BIT_SIZE) > secend) {
  ------------------
  |  |  133|  1.02k|#define DWARF_32BIT_SIZE 4
  ------------------
  |  Branch (479:13): [True: 0, False: 1.02k]
  ------------------
  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.02k|        READ_UNALIGNED_CK(dbg,fval,Dwarf_Unsigned,
  ------------------
  |  |  245|  1.02k|    do  {                                        \
  |  |  246|  1.02k|        desttype _ltmp = 0;                      \
  |  |  247|  1.02k|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|  1.02k|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 1.02k]
  |  |  ------------------
  |  |  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.02k|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 0, False: 1.02k]
  |  |  ------------------
  |  |  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.02k|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|  1.02k|            (source), (unsigned long)(length)) ; \
  |  |  264|  1.02k|        (dest) = _ltmp;                          \
  |  |  265|  1.02k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 1.02k]
  |  |  ------------------
  ------------------
  487|  1.02k|            data,
  488|  1.02k|            DWARF_32BIT_SIZE,
  489|  1.02k|            error,
  490|  1.02k|            secend);
  491|  1.02k|        if (fval != 1 && fval != 0x1000000) {
  ------------------
  |  Branch (491:13): [True: 657, False: 371]
  |  Branch (491:26): [True: 0, False: 657]
  ------------------
  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.02k|        data = data + doas->as_entrysize;
  499|  4.87k|        for (i = 1 ; i < count ; ++i) {
  ------------------
  |  Branch (499:22): [True: 3.85k, False: 1.01k]
  ------------------
  500|  3.85k|            Dwarf_Unsigned  val = 0;
  501|       |
  502|  3.85k|            if ((data+DWARF_32BIT_SIZE) > secend) {
  ------------------
  |  |  133|  3.85k|#define DWARF_32BIT_SIZE 4
  ------------------
  |  Branch (502:17): [True: 0, False: 3.85k]
  ------------------
  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.85k|            READ_UNALIGNED_CK(dbg,val,Dwarf_Unsigned,
  ------------------
  |  |  245|  3.85k|    do  {                                        \
  |  |  246|  3.85k|        desttype _ltmp = 0;                      \
  |  |  247|  3.85k|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|  3.85k|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 3.85k]
  |  |  ------------------
  |  |  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.85k|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 0, False: 3.85k]
  |  |  ------------------
  |  |  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.85k|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|  3.85k|            (source), (unsigned long)(length)) ; \
  |  |  264|  3.85k|        (dest) = _ltmp;                          \
  |  |  265|  3.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 3.85k]
  |  |  ------------------
  ------------------
  510|  3.85k|                data,
  511|  3.85k|                DWARF_32BIT_SIZE,
  512|  3.85k|                error,
  513|  3.85k|                secend);
  514|  3.85k|            if (val > section_count) {
  ------------------
  |  Branch (514:17): [True: 3.14k, False: 716]
  ------------------
  515|       |                /*  Might be confused endianness by
  516|       |                    the compiler generating the SHT_GROUP.
  517|       |                    This is pretty horrible. */
  518|  3.14k|                Dwarf_Unsigned valr = 0;
  519|  3.14k|                _dwarf_memcpy_swap_bytes(&valr,&val,
  520|  3.14k|                    DWARF_32BIT_SIZE);
  ------------------
  |  |  133|  3.14k|#define DWARF_32BIT_SIZE 4
  ------------------
  521|  3.14k|                if (valr > section_count) {
  ------------------
  |  Branch (521:21): [True: 0, False: 3.14k]
  ------------------
  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|  3.14k|                val = valr;
  529|  3.14k|            }
  530|  3.85k|            {
  531|       |                /*  Ensure this group entry DWARF relevant before
  532|       |                    adding to group map */
  533|  3.85k|                struct Dwarf_Obj_Access_Section_a_s doasx;
  534|  3.85k|                int resx = DW_DLV_ERROR;
  ------------------
  |  |  123|  3.85k|#define DW_DLV_ERROR     1
  ------------------
  535|  3.85k|                int err = 0;
  536|  3.85k|                int is_rela = FALSE;
  ------------------
  |  |   36|  3.85k|#define FALSE 0
  ------------------
  537|       |
  538|  3.85k|                memset(&doasx,0,sizeof(doasx));
  539|  3.85k|                resx = obj->ai_methods->
  540|  3.85k|                    om_get_section_info(obj->ai_object,
  541|  3.85k|                    val,
  542|  3.85k|                    &doasx, &err);
  543|  3.85k|                if (resx == DW_DLV_NO_ENTRY){
  ------------------
  |  |  121|  3.85k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (543:21): [True: 0, False: 3.85k]
  ------------------
  544|       |                    /*  Should we really ignore this? */
  545|      0|                    continue;
  546|      0|                }
  547|  3.85k|                if (resx == DW_DLV_ERROR){
  ------------------
  |  |  123|  3.85k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (547:21): [True: 0, False: 3.85k]
  ------------------
  548|      0|                    _dwarf_malloc_section_free(&secdata);
  549|      0|                    _dwarf_error(dbg,error,err);
  550|      0|                    return resx;
  551|      0|                }
  552|  3.85k|                if (!this_section_dwarf_relevant(doasx.as_name,
  ------------------
  |  Branch (552:21): [True: 3.49k, False: 357]
  ------------------
  553|  3.85k|                    (int)doasx.as_type,&is_rela) ) {
  554|  3.49k|                    continue;
  555|  3.49k|                }
  556|    357|                data += DWARF_32BIT_SIZE;
  ------------------
  |  |  133|    357|#define DWARF_32BIT_SIZE 4
  ------------------
  557|    357|                *did_add_map = TRUE;
  ------------------
  |  |   33|    357|#define TRUE 1
  ------------------
  558|    357|                res = _dwarf_insert_in_group_map(dbg,
  559|    357|                    (unsigned)comdat_group_number,
  560|    357|                    (unsigned)val,
  561|    357|                    doasx.as_name,
  562|    357|                    error);
  563|    357|                if (res != DW_DLV_OK) {
  ------------------
  |  |  122|    357|#define DW_DLV_OK        0
  ------------------
  |  Branch (563:21): [True: 10, False: 347]
  ------------------
  564|     10|                    _dwarf_malloc_section_free(&secdata);
  565|     10|                    return res;
  566|     10|                }
  567|    357|            }
  568|    357|        }
  569|  1.02k|    }
  570|  1.01k|    _dwarf_malloc_section_free(&secdata);
  571|  1.01k|    return DW_DLV_OK;
  ------------------
  |  |  122|  1.01k|#define DW_DLV_OK        0
  ------------------
  572|  1.02k|}
dwarf_init_finish.c:this_section_dwarf_relevant:
  376|   435k|{
  377|       |    /* A small helper function for _dwarf_setup(). */
  378|   435k|    if (_dwarf_startswith(scn_name, ".zdebug_") ||
  ------------------
  |  Branch (378:9): [True: 125k, False: 309k]
  ------------------
  379|   309k|        _dwarf_startswith(scn_name, ".debug_")) {
  ------------------
  |  Branch (379:9): [True: 87.3k, False: 222k]
  ------------------
  380|       |        /* standard debug */
  381|   212k|        return TRUE;
  ------------------
  |  |   33|   212k|#define TRUE 1
  ------------------
  382|   212k|    }
  383|   222k|    if (_dwarf_ignorethissection(scn_name)) {
  ------------------
  |  Branch (383:9): [True: 9.43k, False: 212k]
  ------------------
  384|  9.43k|        return FALSE;
  ------------------
  |  |   36|  9.43k|#define FALSE 0
  ------------------
  385|  9.43k|    }
  386|       |    /* Now check if a special section could be
  387|       |        in a section_group, but though seems unlikely. */
  388|   212k|    if (!strcmp(scn_name, ".eh_frame")) {
  ------------------
  |  Branch (388:9): [True: 1.99k, False: 210k]
  ------------------
  389|       |        /*  This is not really a group related file, but
  390|       |            it is harmless to consider it such. */
  391|  1.99k|        return TRUE;
  ------------------
  |  |   33|  1.99k|#define TRUE 1
  ------------------
  392|  1.99k|    }
  393|   210k|    if (!strcmp(scn_name, ".gnu_debuglink")) {
  ------------------
  |  Branch (393:9): [True: 901, False: 210k]
  ------------------
  394|       |        /*  This is not a group or DWARF related file, but
  395|       |            it is useful for split dwarf. */
  396|    901|        return TRUE;
  ------------------
  |  |   33|    901|#define TRUE 1
  ------------------
  397|    901|    }
  398|   210k|    if (!strcmp(scn_name, ".note.gnu.build-id")) {
  ------------------
  |  Branch (398:9): [True: 11.5k, False: 198k]
  ------------------
  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|   198k|    if (!strcmp(scn_name, ".gdb_index")) {
  ------------------
  |  Branch (403:9): [True: 538, False: 197k]
  ------------------
  404|    538|        return TRUE;
  ------------------
  |  |   33|    538|#define TRUE 1
  ------------------
  405|    538|    }
  406|   197k|    if (is_a_special_section_semi_dwarf(scn_name)) {
  ------------------
  |  Branch (406:9): [True: 63.5k, False: 134k]
  ------------------
  407|  63.5k|        return TRUE;
  ------------------
  |  |   33|  63.5k|#define TRUE 1
  ------------------
  408|  63.5k|    }
  409|   134k|    if (is_a_relx_section(scn_name,type,is_rela)) {
  ------------------
  |  Branch (409:9): [True: 43.6k, False: 90.7k]
  ------------------
  410|  43.6k|        return TRUE;
  ------------------
  |  |   33|  43.6k|#define TRUE 1
  ------------------
  411|  43.6k|    }
  412|       |    /*  All sorts of sections are of no interest: .text
  413|       |        .rel. and many others. */
  414|  90.7k|    return FALSE;
  ------------------
  |  |   36|  90.7k|#define FALSE 0
  ------------------
  415|   134k|}
dwarf_init_finish.c:is_a_relx_section:
  338|   565k|{
  339|   565k|    if (type == SHT_RELA) {
  ------------------
  |  |   79|   565k|#define SHT_RELA 4
  ------------------
  |  Branch (339:9): [True: 7.15k, False: 558k]
  ------------------
  340|  7.15k|        *is_rela = TRUE;
  ------------------
  |  |   33|  7.15k|#define TRUE 1
  ------------------
  341|  7.15k|        return TRUE;
  ------------------
  |  |   33|  7.15k|#define TRUE 1
  ------------------
  342|  7.15k|    }
  343|   558k|    if (_dwarf_startswith(scn_name,".rela.")) {
  ------------------
  |  Branch (343:9): [True: 62.6k, False: 496k]
  ------------------
  344|  62.6k|        *is_rela = TRUE;
  ------------------
  |  |   33|  62.6k|#define TRUE 1
  ------------------
  345|  62.6k|        return TRUE;
  ------------------
  |  |   33|  62.6k|#define TRUE 1
  ------------------
  346|  62.6k|    }
  347|   496k|    if (_dwarf_startswith(scn_name,".rel.")) {
  ------------------
  |  Branch (347:9): [True: 21.2k, False: 474k]
  ------------------
  348|  21.2k|        *is_rela = FALSE;
  ------------------
  |  |   36|  21.2k|#define FALSE 0
  ------------------
  349|  21.2k|        return TRUE;
  ------------------
  |  |   33|  21.2k|#define TRUE 1
  ------------------
  350|  21.2k|    }
  351|   474k|    if (type == SHT_REL) {
  ------------------
  |  |   82|   474k|#define SHT_REL 9
  ------------------
  |  Branch (351:9): [True: 5.03k, False: 469k]
  ------------------
  352|  5.03k|        *is_rela = FALSE;
  ------------------
  |  |   36|  5.03k|#define FALSE 0
  ------------------
  353|  5.03k|        return TRUE;
  ------------------
  |  |   33|  5.03k|#define TRUE 1
  ------------------
  354|  5.03k|    }
  355|   469k|    *is_rela = FALSE;
  ------------------
  |  |   36|   469k|#define FALSE 0
  ------------------
  356|   469k|    return FALSE;
  ------------------
  |  |   36|   469k|#define FALSE 0
  ------------------
  357|   474k|}
dwarf_init_finish.c:is_a_special_section_semi_dwarf:
  362|   486k|{
  363|   486k|    if (!strcmp(scn_name,".strtab") ||
  ------------------
  |  Branch (363:9): [True: 125k, False: 361k]
  ------------------
  364|   361k|        !strcmp(scn_name,".symtab")) {
  ------------------
  |  Branch (364:9): [True: 1.47k, False: 359k]
  ------------------
  365|   127k|        return TRUE;
  ------------------
  |  |   33|   127k|#define TRUE 1
  ------------------
  366|   127k|    }
  367|       |    /*  It's not one of these special sections referenced in
  368|       |        the test. */
  369|   359k|    return FALSE;
  ------------------
  |  |   36|   359k|#define FALSE 0
  ------------------
  370|   486k|}
dwarf_init_finish.c:is_section_name_known_already:
  285|   140k|{
  286|   140k|    unsigned i = 0;
  287|   168k|    for ( ; i < dbg->de_debug_sections_total_entries; ++i) {
  ------------------
  |  Branch (287:13): [True: 68.9k, False: 99.6k]
  ------------------
  288|  68.9k|        struct Dwarf_dbg_sect_s *section = &dbg->de_debug_sections[i];
  289|  68.9k|        if (!strcmp(scn_name, section->ds_name)) {
  ------------------
  |  Branch (289:13): [True: 41.0k, False: 27.9k]
  ------------------
  290|       |            /*  The caller will declare this a duplicate, an error. */
  291|  41.0k|            return DW_DLV_OK;
  ------------------
  |  |  122|  41.0k|#define DW_DLV_OK        0
  ------------------
  292|  41.0k|        }
  293|  68.9k|    }
  294|       |    /*  This is normal, we expect we've not accepted
  295|       |        scn_name already. */
  296|  99.6k|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|  99.6k|#define DW_DLV_NO_ENTRY -1
  ------------------
  297|   140k|}
dwarf_init_finish.c:get_basic_section_data:
  205|  2.68k|{
  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.68k|    if (secdata->dss_index != 0) {
  ------------------
  |  Branch (213:9): [True: 0, False: 2.68k]
  ------------------
  214|      0|        DWARF_DBG_ERROR(dbg, duperr, DW_DLV_ERROR);
  ------------------
  |  |   43|      0|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
  215|      0|    }
  216|  2.68k|    if (doas->as_size == 0) {
  ------------------
  |  Branch (216:9): [True: 321, False: 2.36k]
  ------------------
  217|       |        /*  As of 2018 it seems impossible to detect
  218|       |            (via dwarfdump) whether emptyerr has any
  219|       |            practical effect, whether TRUE or FALSE.  */
  220|    321|        if (emptyerr == 0 ) {
  ------------------
  |  Branch (220:13): [True: 299, False: 22]
  ------------------
  221|       |            /*  Allow empty section. */
  222|    299|            return DW_DLV_OK;
  ------------------
  |  |  122|    299|#define DW_DLV_OK        0
  ------------------
  223|    299|        }
  224|       |        /* Know no reason to allow section */
  225|    321|        DWARF_DBG_ERROR(dbg, emptyerr, DW_DLV_ERROR);
  ------------------
  |  |   43|     22|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
  226|      0|    }
  227|  2.36k|    secdata->dss_index = section_index;
  228|  2.36k|    secdata->dss_size  = doas->as_size;
  229|  2.36k|    secdata->dss_group_number = group_number;
  230|  2.36k|    secdata->dss_addr  = doas->as_addr;
  231|  2.36k|    secdata->dss_link  = doas->as_link;
  232|  2.36k|    secdata->dss_flags = doas->as_flags;
  233|  2.36k|    if (secdata->dss_flags & SHF_COMPRESSED) {
  ------------------
  |  |   92|  2.36k|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (233:9): [True: 139, False: 2.22k]
  ------------------
  234|    139|        secdata->dss_shf_compressed = TRUE;
  ------------------
  |  |   33|    139|#define TRUE 1
  ------------------
  235|    139|    }
  236|  2.36k|    secdata->dss_entrysize = doas->as_entrysize;
  237|  2.36k|    secdata->dss_addralign = doas->as_addralign;
  238|  2.36k|    return DW_DLV_OK;
  ------------------
  |  |  122|  2.36k|#define DW_DLV_OK        0
  ------------------
  239|  2.68k|}
dwarf_init_finish.c:add_relx_data_to_secdata:
  246|    531|{
  247|    531|    secdata->dss_reloc_index = section_index;
  248|    531|    secdata->dss_reloc_size = doas->as_size;
  249|    531|    secdata->dss_reloc_entrysize = doas->as_entrysize;
  250|    531|    secdata->dss_reloc_addr = doas->as_addr;
  251|    531|    secdata->dss_reloc_symtab = doas->as_link;
  252|    531|    secdata->dss_reloc_link = doas->as_link;
  253|    531|    secdata->dss_is_rela = (char)is_rela;
  254|    531|}
dwarf_init_finish.c:load_debugfission_tables:
  999|  1.59k|{
 1000|  1.59k|    int i = 0;
 1001|  1.59k|    if (dbg->de_debug_cu_index.dss_size ==0 &&
  ------------------
  |  Branch (1001:9): [True: 1.19k, False: 396]
  ------------------
 1002|  1.19k|        dbg->de_debug_tu_index.dss_size ==0) {
  ------------------
  |  Branch (1002:9): [True: 1.04k, False: 152]
  ------------------
 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|    734|    for (i = 0; i < 2; ++i) {
  ------------------
  |  Branch (1008:17): [True: 711, False: 23]
  ------------------
 1009|    711|        Dwarf_Xu_Index_Header xuptr = 0;
 1010|    711|        struct Dwarf_Section_s* dwsect = 0;
 1011|    711|        Dwarf_Unsigned version = 0;
 1012|    711|        Dwarf_Unsigned number_of_cols /* L */ = 0;
 1013|    711|        Dwarf_Unsigned number_of_CUs /* N */ = 0;
 1014|    711|        Dwarf_Unsigned number_of_slots /* M */ = 0;
 1015|    711|        const char *secname = 0;
 1016|    711|        int res = 0;
 1017|    711|        const char *type = 0;
 1018|       |
 1019|    711|        if (i == 0) {
  ------------------
  |  Branch (1019:13): [True: 548, False: 163]
  ------------------
 1020|    548|            dwsect = &dbg->de_debug_cu_index;
 1021|    548|            type = "cu";
 1022|    548|        } else {
 1023|    163|            dwsect = &dbg->de_debug_tu_index;
 1024|    163|            type = "tu";
 1025|    163|        }
 1026|    711|        if ( !dwsect->dss_size ) {
  ------------------
  |  Branch (1026:14): [True: 161, False: 550]
  ------------------
 1027|    161|            continue;
 1028|    161|        }
 1029|    550|        res = dwarf_get_xu_index_header(dbg,type,
 1030|    550|            &xuptr,&version,&number_of_cols,
 1031|    550|            &number_of_CUs,&number_of_slots,
 1032|    550|            &secname,error);
 1033|    550|        if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|    550|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (1033:13): [True: 1, False: 549]
  ------------------
 1034|      1|            continue;
 1035|      1|        }
 1036|    549|        if (res != DW_DLV_OK) {
  ------------------
  |  |  122|    549|#define DW_DLV_OK        0
  ------------------
  |  Branch (1036:13): [True: 525, False: 24]
  ------------------
 1037|    525|            return res;
 1038|    525|        }
 1039|     24|        if (i == 0) {
  ------------------
  |  Branch (1039:13): [True: 11, False: 13]
  ------------------
 1040|     11|            dbg->de_cu_hashindex_data = xuptr;
 1041|     13|        } else {
 1042|     13|            dbg->de_tu_hashindex_data = xuptr;
 1043|     13|        }
 1044|     24|    }
 1045|     23|    return DW_DLV_OK;
  ------------------
  |  |  122|     23|#define DW_DLV_OK        0
  ------------------
 1046|    548|}

_dwarf_dealloc_loclists_context:
  674|  3.38k|{
  675|  3.38k|    Dwarf_Unsigned i = 0;
  676|  3.38k|    Dwarf_Loclists_Context * loccon = 0;
  677|       |
  678|  3.38k|    if (!dbg->de_loclists_context) {
  ------------------
  |  Branch (678:9): [True: 3.38k, False: 0]
  ------------------
  679|  3.38k|        return;
  680|  3.38k|    }
  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|  61.5k|{
  132|  61.5k|    unsigned char *cp = (unsigned char *)s;
  133|   335k|    for (  ; *cp ; ++cp) {
  ------------------
  |  Branch (133:14): [True: 274k, False: 61.4k]
  ------------------
  134|   274k|        if (*cp < 0x20 || *cp > 0x7e) {
  ------------------
  |  Branch (134:13): [True: 15, False: 274k]
  |  Branch (134:27): [True: 32, False: 274k]
  ------------------
  135|     47|            return TRUE;
  ------------------
  |  |   33|     47|#define TRUE 1
  ------------------
  136|     47|        }
  137|   274k|    }
  138|  61.4k|    return FALSE;
  ------------------
  |  |   36|  61.4k|#define FALSE 0
  ------------------
  139|  61.5k|}
_dwarf_load_macho_header:
  407|  2.16k|{
  408|  2.16k|    int res = 0;
  409|       |
  410|  2.16k|    if (mfp->mo_offsetsize == 32) {
  ------------------
  |  Branch (410:9): [True: 1.26k, False: 897]
  ------------------
  411|  1.26k|        res = load_macho_header32(mfp,errcode);
  412|  1.26k|    } else if (mfp->mo_offsetsize == 64) {
  ------------------
  |  Branch (412:16): [True: 897, False: 0]
  ------------------
  413|    897|        res = _dwarf_load_macho_header64(mfp,errcode);
  414|    897|    } 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.16k|    return res;
  419|  2.16k|}
_dwarf_load_macho_commands:
  785|  2.00k|{
  786|  2.00k|    Dwarf_Unsigned cmdi = 0;
  787|  2.00k|    Dwarf_Unsigned curoff = mfp->mo_command_start_offset;
  788|  2.00k|    struct load_command mc;
  789|  2.00k|    struct generic_macho_command *mcp = 0;
  790|  2.00k|    unsigned segment_command_count = 0;
  791|  2.00k|    int res = 0;
  792|  2.00k|    Dwarf_Unsigned inner = mfp->mo_inner_offset;
  793|  2.00k|    Dwarf_Unsigned commandsizetotal = 0;
  794|       |
  795|  2.00k|    if (mfp->mo_command_count >= mfp->mo_filesize) {
  ------------------
  |  Branch (795:9): [True: 39, False: 1.97k]
  ------------------
  796|       |        /* corrupt object. */
  797|     39|        *errcode = DW_DLE_MACH_O_SEGOFFSET_BAD;
  ------------------
  |  | 1462|     39|#define DW_DLE_MACH_O_SEGOFFSET_BAD            416
  ------------------
  798|     39|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     39|#define DW_DLV_ERROR      1
  ------------------
  799|     39|    }
  800|  1.97k|    if ((curoff + mfp->mo_command_count * sizeof(mc)) >=
  ------------------
  |  Branch (800:9): [True: 38, False: 1.93k]
  ------------------
  801|  1.97k|        mfp->mo_filesize) {
  802|       |        /* corrupt object. */
  803|     38|        *errcode = DW_DLE_MACH_O_SEGOFFSET_BAD;
  ------------------
  |  | 1462|     38|#define DW_DLE_MACH_O_SEGOFFSET_BAD            416
  ------------------
  804|     38|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     38|#define DW_DLV_ERROR      1
  ------------------
  805|     38|    }
  806|       |
  807|  1.93k|    mfp->mo_commands = (struct generic_macho_command *) calloc(
  808|  1.93k|        mfp->mo_command_count,sizeof(struct generic_macho_command));
  809|  1.93k|    if (!mfp->mo_commands) {
  ------------------
  |  Branch (809:9): [True: 0, False: 1.93k]
  ------------------
  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.93k|    mcp = mfp->mo_commands;
  815|   813k|    for ( ; cmdi < mfp->mo_header.ncmds; ++cmdi,++mcp ) {
  ------------------
  |  Branch (815:13): [True: 811k, False: 1.85k]
  ------------------
  816|   811k|        res = RRMOA(mfp->mo_fd, &mc,
  ------------------
  |  |   65|   811k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|   811k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  817|   811k|            inner+curoff, sizeof(mc),
  818|   811k|            inner+mfp->mo_filesize, errcode);
  819|   811k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|   811k|#define DW_DLV_OK         0
  ------------------
  |  Branch (819:13): [True: 3, False: 811k]
  ------------------
  820|      3|            free(mfp->mo_commands);
  821|      3|            mfp->mo_commands = 0;
  822|      3|            return res;
  823|      3|        }
  824|   811k|        ASNAR(mfp->mo_copy_word,mcp->cmd,mc.cmd);
  ------------------
  |  |   53|   811k|    do {                                        \
  |  |   54|   811k|        (t) = 0;                                \
  |  |   55|   811k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   811k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 811k]
  |  |  ------------------
  ------------------
  825|   811k|        ASNAR(mfp->mo_copy_word,mcp->cmdsize,mc.cmdsize);
  ------------------
  |  |   53|   811k|    do {                                        \
  |  |   54|   811k|        (t) = 0;                                \
  |  |   55|   811k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   811k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 811k]
  |  |  ------------------
  ------------------
  826|   811k|        commandsizetotal += mcp->cmdsize;
  827|   811k|        mcp->offset_this_command = curoff;
  828|   811k|        curoff += mcp->cmdsize;
  829|   811k|        if (mcp->cmdsize > mfp->mo_filesize ||
  ------------------
  |  Branch (829:13): [True: 52, False: 811k]
  ------------------
  830|   811k|            curoff > mfp->mo_filesize) {
  ------------------
  |  Branch (830:13): [True: 24, False: 811k]
  ------------------
  831|       |            /* corrupt object */
  832|     76|            free(mfp->mo_commands);
  833|     76|            mfp->mo_commands = 0;
  834|     76|            *errcode = DW_DLE_FILE_OFFSET_BAD;
  ------------------
  |  | 1463|     76|#define DW_DLE_FILE_OFFSET_BAD                 417
  ------------------
  835|     76|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     76|#define DW_DLV_ERROR      1
  ------------------
  836|     76|        }
  837|   811k|        if (mcp->cmd == LC_SEGMENT || mcp->cmd == LC_SEGMENT_64) {
  ------------------
  |  |  360|  1.62M|#define LC_SEGMENT    0x1    /* segment of this file to be mapped */
  ------------------
                      if (mcp->cmd == LC_SEGMENT || mcp->cmd == LC_SEGMENT_64) {
  ------------------
  |  |  407|   424k|#define    LC_SEGMENT_64    0x19
  ------------------
  |  Branch (837:13): [True: 387k, False: 424k]
  |  Branch (837:39): [True: 272k, False: 151k]
  ------------------
  838|   659k|            segment_command_count++;
  839|   659k|        }
  840|   811k|    }
  841|  1.85k|    mfp->mo_segment_count = segment_command_count;
  842|  1.85k|    mfp->mo_segment_size_total = commandsizetotal;
  843|  1.85k|    res = _dwarf_macho_load_segment_commands(mfp,errcode);
  844|  1.85k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.85k|#define DW_DLV_OK         0
  ------------------
  |  Branch (844:9): [True: 487, False: 1.36k]
  ------------------
  845|    487|        free(mfp->mo_commands);
  846|    487|        mfp->mo_commands = 0;
  847|    487|        return res;
  848|    487|    }
  849|  1.36k|    res = _dwarf_macho_load_dwarf_sections(mfp,errcode);
  850|  1.36k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.36k|#define DW_DLV_OK         0
  ------------------
  |  Branch (850:9): [True: 771, False: 595]
  ------------------
  851|    771|        free(mfp->mo_commands);
  852|    771|        mfp->mo_commands = 0;
  853|    771|    }
  854|  1.36k|    return res;
  855|  1.85k|}
_dwarf_macho_setup:
  868|  2.64k|{
  869|  2.64k|    Dwarf_Obj_Access_Interface_a *binary_interface = 0;
  870|  2.64k|    dwarf_macho_object_access_internals_t *intfc = 0;
  871|  2.64k|    int res = DW_DLV_OK;
  ------------------
  |  |   59|  2.64k|#define DW_DLV_OK         0
  ------------------
  872|  2.64k|    int localerrnum = 0;
  873|  2.64k|    unsigned universalbinary_count = 0;
  874|       |
  875|  2.64k|    res = _dwarf_macho_object_access_init(
  876|  2.64k|        fd,
  877|  2.64k|        universalnumber,
  878|  2.64k|        ftype,endian,offsetsize,
  879|  2.64k|        &universalbinary_count,
  880|  2.64k|        filesize,
  881|  2.64k|        &binary_interface,
  882|  2.64k|        &localerrnum);
  883|  2.64k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.64k|#define DW_DLV_OK         0
  ------------------
  |  Branch (883:9): [True: 2.04k, False: 595]
  ------------------
  884|  2.04k|        if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |   58|  2.04k|#define DW_DLV_NO_ENTRY  -1
  ------------------
  |  Branch (884:13): [True: 20, False: 2.02k]
  ------------------
  885|     20|            return res;
  886|     20|        }
  887|  2.02k|        _dwarf_error(NULL, error, localerrnum);
  888|  2.02k|        return DW_DLV_ERROR;
  ------------------
  |  |   60|  2.02k|#define DW_DLV_ERROR      1
  ------------------
  889|  2.04k|    }
  890|       |    /*  allocates and initializes Dwarf_Debug,
  891|       |        generic code */
  892|    595|    res = dwarf_object_init_b(binary_interface, errhand, errarg,
  893|    595|        groupnumber, dbg, error);
  894|    595|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|    595|#define DW_DLV_OK         0
  ------------------
  |  Branch (894:9): [True: 394, False: 201]
  ------------------
  895|    394|        _dwarf_destruct_macho_access(binary_interface);
  896|    394|        return res;
  897|    394|    }
  898|    201|    intfc = binary_interface->ai_object;
  899|    201|    intfc->mo_path = strdup(true_path);
  900|    201|    (*dbg)->de_obj_flags = intfc->mo_flags;
  901|    201|    (*dbg)->de_obj_machine = intfc->mo_machine;
  902|    201|    (*dbg)->de_universalbinary_index = universalnumber;
  903|    201|    (*dbg)->de_universalbinary_count = universalbinary_count;
  904|    201|    return res;
  905|    595|}
_dwarf_dealloc_universal_head:
 1372|     86|{
 1373|     86|    if (!dw_head) {
  ------------------
  |  Branch (1373:9): [True: 0, False: 86]
  ------------------
 1374|      0|        return;
 1375|      0|    }
 1376|     86|    free(dw_head->au_arches);
 1377|     86|    dw_head->au_arches = 0;
 1378|     86|    free(dw_head);
 1379|     86|}
dwarf_machoread.c:load_macho_header32:
  367|  1.26k|{
  368|  1.26k|    struct mach_header mh32;
  369|  1.26k|    int res = 0;
  370|  1.26k|    Dwarf_Unsigned inner = mfp->mo_inner_offset;
  371|       |
  372|  1.26k|    if (sizeof(mh32) > mfp->mo_filesize) {
  ------------------
  |  Branch (372:9): [True: 15, False: 1.25k]
  ------------------
  373|     15|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     15|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  374|     15|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     15|#define DW_DLV_ERROR      1
  ------------------
  375|     15|    }
  376|  1.25k|    res = RRMOA(mfp->mo_fd, &mh32, inner, sizeof(mh32),
  ------------------
  |  |   65|  1.25k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  1.25k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  377|  1.25k|        (inner+mfp->mo_filesize), errcode);
  378|  1.25k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.25k|#define DW_DLV_OK         0
  ------------------
  |  Branch (378:9): [True: 0, False: 1.25k]
  ------------------
  379|      0|        return res;
  380|      0|    }
  381|       |    /* Do not adjust endianness of magic, leave as-is. */
  382|  1.25k|    ASNAR(memcpy,mfp->mo_header.magic,mh32.magic);
  ------------------
  |  |   53|  1.25k|    do {                                        \
  |  |   54|  1.25k|        (t) = 0;                                \
  |  |   55|  1.25k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.25k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.25k]
  |  |  ------------------
  ------------------
  383|  1.25k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.cputype,mh32.cputype);
  ------------------
  |  |   53|  1.25k|    do {                                        \
  |  |   54|  1.25k|        (t) = 0;                                \
  |  |   55|  1.25k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.25k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.25k]
  |  |  ------------------
  ------------------
  384|  1.25k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.cpusubtype,
  ------------------
  |  |   53|  1.25k|    do {                                        \
  |  |   54|  1.25k|        (t) = 0;                                \
  |  |   55|  1.25k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.25k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.25k]
  |  |  ------------------
  ------------------
  385|  1.25k|        mh32.cpusubtype);
  386|  1.25k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.filetype,mh32.filetype);
  ------------------
  |  |   53|  1.25k|    do {                                        \
  |  |   54|  1.25k|        (t) = 0;                                \
  |  |   55|  1.25k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.25k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.25k]
  |  |  ------------------
  ------------------
  387|  1.25k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.ncmds,mh32.ncmds);
  ------------------
  |  |   53|  1.25k|    do {                                        \
  |  |   54|  1.25k|        (t) = 0;                                \
  |  |   55|  1.25k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.25k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.25k]
  |  |  ------------------
  ------------------
  388|  1.25k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.sizeofcmds,
  ------------------
  |  |   53|  1.25k|    do {                                        \
  |  |   54|  1.25k|        (t) = 0;                                \
  |  |   55|  1.25k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.25k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.25k]
  |  |  ------------------
  ------------------
  389|  1.25k|        mh32.sizeofcmds);
  390|  1.25k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.flags,mh32.flags);
  ------------------
  |  |   53|  1.25k|    do {                                        \
  |  |   54|  1.25k|        (t) = 0;                                \
  |  |   55|  1.25k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.25k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.25k]
  |  |  ------------------
  ------------------
  391|  1.25k|    mfp->mo_header.reserved = 0;
  392|  1.25k|    mfp->mo_command_count = (unsigned int)mfp->mo_header.ncmds;
  393|  1.25k|    if (mfp->mo_header.sizeofcmds >= mfp->mo_filesize ||
  ------------------
  |  Branch (393:9): [True: 59, False: 1.19k]
  ------------------
  394|  1.19k|        mfp->mo_header.sizeofcmds >= MAX_COMMANDS_SIZE ) {
  ------------------
  |  |   42|  1.19k|#define MAX_COMMANDS_SIZE  30000
  ------------------
  |  Branch (394:9): [True: 1, False: 1.19k]
  ------------------
  395|     60|        *errcode = DW_DLE_MACHO_CORRUPT_HEADER;
  ------------------
  |  | 1532|     60|#define DW_DLE_MACHO_CORRUPT_HEADER            486
  ------------------
  396|     60|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     60|#define DW_DLV_ERROR      1
  ------------------
  397|     60|    }
  398|  1.19k|    mfp->mo_machine = mfp->mo_header.cputype;
  399|  1.19k|    mfp->mo_flags = mfp->mo_header.flags;
  400|  1.19k|    mfp->mo_command_start_offset = sizeof(mh32);
  401|  1.19k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.19k|#define DW_DLV_OK         0
  ------------------
  402|  1.25k|}
dwarf_machoread.c:_dwarf_macho_load_segment_commands:
  493|  1.85k|{
  494|  1.85k|    Dwarf_Unsigned i = 0;
  495|  1.85k|    Dwarf_Unsigned segtotsize = 0;
  496|  1.85k|    int            res = 0;
  497|  1.85k|    struct generic_macho_command *mmp = 0;
  498|  1.85k|    struct generic_macho_segment_command *msp = 0;
  499|       |
  500|  1.85k|    if (mfp->mo_segment_count < 1) {
  ------------------
  |  Branch (500:9): [True: 123, False: 1.73k]
  ------------------
  501|    123|        return DW_DLV_OK;
  ------------------
  |  |   59|    123|#define DW_DLV_OK         0
  ------------------
  502|    123|    }
  503|  1.73k|    res = _dwarf_uint64_mult(mfp->mo_segment_count,
  504|  1.73k|        sizeof(struct generic_macho_segment_command),
  505|  1.73k|        &segtotsize);
  506|  1.73k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  1.73k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (506:9): [True: 0, False: 1.73k]
  ------------------
  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.73k|    mfp->mo_segment_commands =
  512|  1.73k|        (struct generic_macho_segment_command *)
  513|  1.73k|        calloc(1, segtotsize);
  514|  1.73k|    if (!mfp->mo_segment_commands) {
  ------------------
  |  Branch (514:9): [True: 0, False: 1.73k]
  ------------------
  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.73k|    mmp = mfp->mo_commands;
  520|  1.73k|    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.73k|    if ( mfp->mo_header.sizeofcmds > MAX_COMMANDS_SIZE) {
  ------------------
  |  |   42|  1.73k|#define MAX_COMMANDS_SIZE  30000
  ------------------
  |  Branch (525:10): [True: 0, False: 1.73k]
  ------------------
  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|   732k|    for (i = 0 ; i < mfp->mo_command_count; ++i,++mmp) {
  ------------------
  |  Branch (529:18): [True: 731k, False: 1.24k]
  ------------------
  530|   731k|        unsigned cmd = (unsigned)mmp->cmd;
  531|       |
  532|   731k|        if (cmd == LC_SEGMENT) {
  ------------------
  |  |  360|   731k|#define LC_SEGMENT    0x1    /* segment of this file to be mapped */
  ------------------
  |  Branch (532:13): [True: 386k, False: 344k]
  ------------------
  533|   386k|            res = load_segment_command_content32(mfp,mmp,msp,
  534|   386k|                i,errcode);
  535|   386k|            ++msp;
  536|   386k|        } else if (cmd == LC_SEGMENT_64) {
  ------------------
  |  |  407|   344k|#define    LC_SEGMENT_64    0x19
  ------------------
  |  Branch (536:20): [True: 271k, False: 73.4k]
  ------------------
  537|   271k|            res = _dwarf_load_segment_command_content64(mfp,mmp,msp,
  538|   271k|                i,errcode);
  539|   271k|            ++msp;
  540|   271k|        } else { /* fall through, not a command of interest */ }
  541|   731k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|   731k|#define DW_DLV_OK         0
  ------------------
  |  Branch (541:13): [True: 487, False: 731k]
  ------------------
  542|    487|            free(mfp->mo_segment_commands);
  543|    487|            mfp->mo_segment_commands = 0;
  544|    487|            return res;
  545|    487|        }
  546|   731k|    }
  547|  1.24k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.24k|#define DW_DLV_OK         0
  ------------------
  548|  1.73k|}
dwarf_machoread.c:load_segment_command_content32:
  428|   386k|{
  429|   386k|    struct segment_command sc;
  430|   386k|    int res = 0;
  431|   386k|    Dwarf_Unsigned filesize = mfp->mo_filesize;
  432|   386k|    Dwarf_Unsigned segoffset = mmp->offset_this_command;
  433|   386k|    Dwarf_Unsigned afterseghdr = segoffset + sizeof(sc);
  434|   386k|    Dwarf_Unsigned inner = mfp->mo_inner_offset;
  435|   386k|    Dwarf_Unsigned fulloffset = mfp->mo_inner_offset;
  436|       |
  437|   386k|    if (segoffset > filesize ||
  ------------------
  |  Branch (437:9): [True: 0, False: 386k]
  ------------------
  438|   386k|        mmp->cmdsize > filesize ||
  ------------------
  |  Branch (438:9): [True: 0, False: 386k]
  ------------------
  439|   386k|        (mmp->cmdsize + segoffset) > filesize ) {
  ------------------
  |  Branch (439:9): [True: 0, False: 386k]
  ------------------
  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|   386k|    fulloffset = segoffset+inner;
  444|   386k|    if (fulloffset <segoffset || fulloffset < inner) { 
  ------------------
  |  Branch (444:9): [True: 0, False: 386k]
  |  Branch (444:34): [True: 0, False: 386k]
  ------------------
  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|   386k|    if (afterseghdr > filesize ) {
  ------------------
  |  Branch (449:9): [True: 56, False: 386k]
  ------------------
  450|     56|        *errcode = DW_DLE_MACH_O_SEGOFFSET_BAD;
  ------------------
  |  | 1462|     56|#define DW_DLE_MACH_O_SEGOFFSET_BAD            416
  ------------------
  451|     56|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     56|#define DW_DLV_ERROR      1
  ------------------
  452|     56|    }
  453|   386k|    res = RRMOA(mfp->mo_fd, &sc, (inner+segoffset),
  ------------------
  |  |   65|   386k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|   386k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  454|   386k|        sizeof(sc), (inner+filesize), errcode);
  455|   386k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|   386k|#define DW_DLV_OK         0
  ------------------
  |  Branch (455:9): [True: 0, False: 386k]
  ------------------
  456|      0|        return res;
  457|      0|    }
  458|   386k|    ASNAR(mfp->mo_copy_word,msp->cmd,sc.cmd);
  ------------------
  |  |   53|   386k|    do {                                        \
  |  |   54|   386k|        (t) = 0;                                \
  |  |   55|   386k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   386k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 386k]
  |  |  ------------------
  ------------------
  459|   386k|    ASNAR(mfp->mo_copy_word,msp->cmdsize,sc.cmdsize);
  ------------------
  |  |   53|   386k|    do {                                        \
  |  |   54|   386k|        (t) = 0;                                \
  |  |   55|   386k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   386k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 386k]
  |  |  ------------------
  ------------------
  460|   386k|    _dwarf_safe_strcpy(msp->segname,sizeof(msp->segname),
  461|   386k|        sc.segname,sizeof(sc.segname));
  462|   386k|    ASNAR(mfp->mo_copy_word,msp->vmaddr,sc.vmaddr);
  ------------------
  |  |   53|   386k|    do {                                        \
  |  |   54|   386k|        (t) = 0;                                \
  |  |   55|   386k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   386k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 386k]
  |  |  ------------------
  ------------------
  463|   386k|    ASNAR(mfp->mo_copy_word,msp->vmsize,sc.vmsize);
  ------------------
  |  |   53|   386k|    do {                                        \
  |  |   54|   386k|        (t) = 0;                                \
  |  |   55|   386k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   386k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 386k]
  |  |  ------------------
  ------------------
  464|   386k|    ASNAR(mfp->mo_copy_word,msp->fileoff,sc.fileoff);
  ------------------
  |  |   53|   386k|    do {                                        \
  |  |   54|   386k|        (t) = 0;                                \
  |  |   55|   386k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   386k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 386k]
  |  |  ------------------
  ------------------
  465|   386k|    ASNAR(mfp->mo_copy_word,msp->filesize,sc.filesize);
  ------------------
  |  |   53|   386k|    do {                                        \
  |  |   54|   386k|        (t) = 0;                                \
  |  |   55|   386k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   386k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 386k]
  |  |  ------------------
  ------------------
  466|   386k|    if (msp->fileoff > mfp->mo_filesize ||
  ------------------
  |  Branch (466:9): [True: 49, False: 386k]
  ------------------
  467|   386k|        msp->filesize > mfp->mo_filesize) {
  ------------------
  |  Branch (467:9): [True: 7, False: 386k]
  ------------------
  468|       |        /* corrupt */
  469|     56|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|     56|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  470|     56|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     56|#define DW_DLV_ERROR      1
  ------------------
  471|     56|    }
  472|   386k|    if ((msp->fileoff+msp->filesize ) > filesize) {
  ------------------
  |  Branch (472:9): [True: 28, False: 386k]
  ------------------
  473|       |        /* corrupt */
  474|     28|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|     28|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  475|     28|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     28|#define DW_DLV_ERROR      1
  ------------------
  476|     28|    }
  477|   386k|    ASNAR(mfp->mo_copy_word,msp->maxprot,sc.maxprot);
  ------------------
  |  |   53|   386k|    do {                                        \
  |  |   54|   386k|        (t) = 0;                                \
  |  |   55|   386k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   386k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 386k]
  |  |  ------------------
  ------------------
  478|   386k|    ASNAR(mfp->mo_copy_word,msp->initprot,sc.initprot);
  ------------------
  |  |   53|   386k|    do {                                        \
  |  |   54|   386k|        (t) = 0;                                \
  |  |   55|   386k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   386k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 386k]
  |  |  ------------------
  ------------------
  479|   386k|    ASNAR(mfp->mo_copy_word,msp->nsects,sc.nsects);
  ------------------
  |  |   53|   386k|    do {                                        \
  |  |   54|   386k|        (t) = 0;                                \
  |  |   55|   386k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   386k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 386k]
  |  |  ------------------
  ------------------
  480|   386k|    if (msp->nsects >= mfp->mo_filesize) {
  ------------------
  |  Branch (480:9): [True: 56, False: 386k]
  ------------------
  481|     56|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|     56|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  482|     56|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     56|#define DW_DLV_ERROR      1
  ------------------
  483|     56|    }
  484|   386k|    ASNAR(mfp->mo_copy_word,msp->flags,sc.flags);
  ------------------
  |  |   53|   386k|    do {                                        \
  |  |   54|   386k|        (t) = 0;                                \
  |  |   55|   386k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   386k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 386k]
  |  |  ------------------
  ------------------
  485|   386k|    msp->macho_command_index = mmpindex;
  486|   386k|    msp->sectionsoffset = afterseghdr;
  487|   386k|    return DW_DLV_OK;
  ------------------
  |  |   59|   386k|#define DW_DLV_OK         0
  ------------------
  488|   386k|}
dwarf_machoread.c:_dwarf_macho_load_dwarf_sections:
  743|  1.36k|{
  744|  1.36k|    Dwarf_Unsigned segi = 0;
  745|  1.36k|    Dwarf_Unsigned ftype = mfp->mo_header.filetype;
  746|       |
  747|  1.36k|    struct generic_macho_segment_command *segp =
  748|  1.36k|        mfp->mo_segment_commands;
  749|  1.36k|    if (ftype != MH_DSYM &&
  ------------------
  |  |  198|  2.73k|#define    MH_DSYM        0xa /* companion file with only debug */
  ------------------
  |  Branch (749:9): [True: 1.13k, False: 227]
  ------------------
  750|  1.13k|        ftype != MH_EXECUTE &&
  ------------------
  |  |  189|  2.50k|#define    MH_EXECUTE    0x2        /* demand paged executable file */
  ------------------
  |  Branch (750:9): [True: 1.11k, False: 24]
  ------------------
  751|  1.11k|        ftype != MH_OBJECT) {
  ------------------
  |  |  188|  1.11k|#define    MH_OBJECT    0x1        /* relocatable object file */
  ------------------
  |  Branch (751:9): [True: 108, False: 1.00k]
  ------------------
  752|       |        /* We do not think it can have DWARF */
  753|    108|        return DW_DLV_OK;
  ------------------
  |  |   59|    108|#define DW_DLV_OK         0
  ------------------
  754|    108|    }
  755|  1.25k|    if (mfp->mo_segment_count > MAX_COMMANDS_SIZE) {
  ------------------
  |  |   42|  1.25k|#define MAX_COMMANDS_SIZE  30000
  ------------------
  |  Branch (755:9): [True: 4, False: 1.25k]
  ------------------
  756|       |        /*  It's really bad, the size is supposed to be size on disk,
  757|       |            so this is a likely silly check. */
  758|      4|        *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      4|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  759|      4|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
  760|      4|    }
  761|  69.3k|    for ( ; segi < mfp->mo_segment_count; ++segi,++segp) {
  ------------------
  |  Branch (761:13): [True: 68.8k, False: 487]
  ------------------
  762|  68.8k|        int res = 0;
  763|  68.8k|        if (0 == strcmp(segp->segname,"__PAGEZERO")) {
  ------------------
  |  Branch (763:13): [True: 450, False: 68.4k]
  ------------------
  764|    450|            continue;
  765|    450|        }
  766|  68.4k|        if (0 ==strcmp(segp->segname,"__LINKEDIT")) {
  ------------------
  |  Branch (766:13): [True: 4.30k, False: 64.1k]
  ------------------
  767|  4.30k|            continue;
  768|  4.30k|        }
  769|  64.1k|        if (0 ==strcmp(segp->segname,"__DATA")) {
  ------------------
  |  Branch (769:13): [True: 215, False: 63.9k]
  ------------------
  770|    215|            continue;
  771|    215|        }
  772|  63.9k|        res = _dwarf_macho_load_dwarf_section_details(mfp,
  773|  63.9k|            segp,segi,errcode);
  774|  63.9k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  63.9k|#define DW_DLV_OK         0
  ------------------
  |  Branch (774:13): [True: 767, False: 63.1k]
  ------------------
  775|    767|            return res;
  776|    767|        }
  777|  63.9k|    }
  778|    487|    return DW_DLV_OK;
  ------------------
  |  |   59|    487|#define DW_DLV_OK         0
  ------------------
  779|  1.25k|}
dwarf_machoread.c:_dwarf_macho_load_dwarf_section_details:
  724|  63.9k|{
  725|  63.9k|    int res = 0;
  726|       |
  727|  63.9k|    if (mfp->mo_offsetsize == 32) {
  ------------------
  |  Branch (727:9): [True: 17.8k, False: 46.0k]
  ------------------
  728|  17.8k|        res = _dwarf_macho_load_dwarf_section_details32(mfp,
  729|  17.8k|            segp,segi,errcode);
  730|  46.0k|    } else if (mfp->mo_offsetsize == 64) {
  ------------------
  |  Branch (730:16): [True: 46.0k, False: 0]
  ------------------
  731|  46.0k|        res = _dwarf_macho_load_dwarf_section_details64(mfp,
  732|  46.0k|            segp,segi,errcode);
  733|  46.0k|    } 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|  63.9k|    return res;
  738|  63.9k|}
dwarf_machoread.c:_dwarf_macho_load_dwarf_section_details32:
  555|  17.8k|{
  556|  17.8k|    int res = 0;
  557|  17.8k|    Dwarf_Unsigned seci = 0;
  558|  17.8k|    Dwarf_Unsigned seccount = segp->nsects;
  559|  17.8k|    Dwarf_Unsigned secalloc = seccount+1;
  560|       |
  561|       |    /* offset of sections being added */
  562|  17.8k|    Dwarf_Unsigned curoff = segp->sectionsoffset;
  563|  17.8k|    Dwarf_Unsigned shdrlen = sizeof(struct section);
  564|  17.8k|    Dwarf_Unsigned newcount = 0;
  565|  17.8k|    struct generic_macho_section *secs = 0;
  566|       |
  567|  17.8k|    if (mfp->mo_dwarf_sections) {
  ------------------
  |  Branch (567:9): [True: 17.3k, False: 507]
  ------------------
  568|  17.3k|        Dwarf_Unsigned secssizetot = 0;
  569|  17.3k|        struct generic_macho_section * originalsections =
  570|  17.3k|            mfp->mo_dwarf_sections;
  571|       |
  572|  17.3k|        if (!seccount) {
  ------------------
  |  Branch (572:13): [True: 625, False: 16.7k]
  ------------------
  573|       |            /* No sections. Odd. Unexpected. */
  574|    625|            return DW_DLV_OK;
  ------------------
  |  |   59|    625|#define DW_DLV_OK         0
  ------------------
  575|    625|        }
  576|  16.7k|        newcount = mfp->mo_dwarf_sectioncount + seccount;
  577|  16.7k|        res = _dwarf_uint64_mult(newcount,
  578|  16.7k|            sizeof(struct generic_macho_section),
  579|  16.7k|            &secssizetot);
  580|  16.7k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  16.7k|#define DW_DLV_OK         0
  ------------------
  |  Branch (580:13): [True: 0, False: 16.7k]
  ------------------
  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|  16.7k|        if (secssizetot > mfp->mo_filesize ) {
  ------------------
  |  Branch (585:13): [True: 70, False: 16.6k]
  ------------------
  586|       |
  587|       |            /*  Really supposed to refer to size on disk, this
  588|       |                is therefore approximate test. */
  589|     70|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|     70|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  590|     70|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     70|#define DW_DLV_ERROR      1
  ------------------
  591|     70|        }
  592|       |
  593|  16.6k|        secs = (struct generic_macho_section *)calloc(
  594|  16.6k|            1,secssizetot);
  595|  16.6k|        if (!secs) {
  ------------------
  |  Branch (595:13): [True: 0, False: 16.6k]
  ------------------
  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|  16.6k|        memcpy(secs,mfp->mo_dwarf_sections,
  600|  16.6k|            mfp->mo_dwarf_sectioncount*
  601|  16.6k|            sizeof(struct generic_macho_section));
  602|  16.6k|        mfp->mo_dwarf_sections = secs;
  603|  16.6k|        seci =  mfp->mo_dwarf_sectioncount ;
  604|  16.6k|        mfp->mo_dwarf_sectioncount = newcount;
  605|  16.6k|        free(originalsections);
  606|  16.6k|        secs += seci;
  607|  16.6k|        secs->offset_of_sec_rec = curoff;
  608|  16.6k|        secalloc = newcount;
  609|  16.6k|    } else {
  610|    507|        Dwarf_Unsigned secssizetot = 0;
  611|       |
  612|    507|        newcount = secalloc;
  613|    507|        res = _dwarf_uint64_mult(newcount,
  614|    507|            sizeof(struct generic_macho_section),
  615|    507|            &secssizetot);
  616|    507|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    507|#define DW_DLV_OK         0
  ------------------
  |  Branch (616:13): [True: 0, False: 507]
  ------------------
  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|    507|        if (secssizetot > mfp->mo_filesize ) {
  ------------------
  |  Branch (621:13): [True: 199, False: 308]
  ------------------
  622|       |            /*  Really supposed to refer to size on disk, this
  623|       |                is therefore approximate sanity test. */
  624|    199|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|    199|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  625|    199|            return DW_DLV_ERROR;
  ------------------
  |  |   60|    199|#define DW_DLV_ERROR      1
  ------------------
  626|    199|        }
  627|    308|        secs = (struct generic_macho_section *)calloc(
  628|    308|            1,secssizetot);
  629|    308|        if (!secs) {
  ------------------
  |  Branch (629:13): [True: 0, False: 308]
  ------------------
  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|    308|        mfp->mo_dwarf_sections = secs;
  634|    308|        mfp->mo_dwarf_sectioncount = secalloc;
  635|    308|        secs->offset_of_sec_rec = curoff;
  636|       |        /*  Leave 0 section all zeros except our offset,
  637|       |            elf-like in a sense */
  638|    308|        secs->dwarfsectname = "";
  639|    308|        seci = 1;
  640|    308|        ++secs;
  641|    308|    }
  642|       |
  643|  46.3k|    for (; seci < secalloc; ++seci,++secs,curoff += shdrlen ) {
  ------------------
  |  Branch (643:12): [True: 29.5k, False: 16.7k]
  ------------------
  644|  29.5k|        struct section mosec;
  645|  29.5k|        Dwarf_Unsigned endoffset = 0;
  646|  29.5k|        Dwarf_Unsigned inner = mfp->mo_inner_offset;
  647|  29.5k|        Dwarf_Unsigned offplussize = 0;
  648|  29.5k|        Dwarf_Unsigned innercur = 0;
  649|       |
  650|  29.5k|        endoffset = curoff + sizeof(mosec);
  651|  29.5k|        if (curoff >=  mfp->mo_filesize ||
  ------------------
  |  Branch (651:13): [True: 2, False: 29.5k]
  ------------------
  652|  29.5k|            endoffset > mfp->mo_filesize) {
  ------------------
  |  Branch (652:13): [True: 10, False: 29.5k]
  ------------------
  653|     12|            *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|     12|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  654|     12|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     12|#define DW_DLV_ERROR      1
  ------------------
  655|     12|        }
  656|  29.5k|        innercur = inner+curoff;
  657|  29.5k|        if (innercur < inner || innercur <curoff) {
  ------------------
  |  Branch (657:13): [True: 0, False: 29.5k]
  |  Branch (657:33): [True: 0, False: 29.5k]
  ------------------
  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|  29.5k|        offplussize = inner+mfp->mo_filesize;
  663|  29.5k|        if (offplussize < inner || offplussize <mfp->mo_filesize) {
  ------------------
  |  Branch (663:13): [True: 0, False: 29.5k]
  |  Branch (663:36): [True: 0, False: 29.5k]
  ------------------
  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|  29.5k|        res = RRMOA(mfp->mo_fd, &mosec,
  ------------------
  |  |   65|  29.5k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  29.5k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  669|  29.5k|            innercur, sizeof(mosec),
  670|  29.5k|            offplussize, errcode);
  671|  29.5k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  29.5k|#define DW_DLV_OK         0
  ------------------
  |  Branch (671:13): [True: 0, False: 29.5k]
  ------------------
  672|      0|            return res;
  673|      0|        }
  674|  29.5k|        _dwarf_safe_strcpy(secs->sectname,
  675|  29.5k|            sizeof(secs->sectname),
  676|  29.5k|            mosec.sectname,sizeof(mosec.sectname));
  677|  29.5k|        if (_dwarf_not_ascii(secs->sectname) ) {
  ------------------
  |  Branch (677:13): [True: 26, False: 29.5k]
  ------------------
  678|     26|            *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|     26|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  679|     26|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     26|#define DW_DLV_ERROR      1
  ------------------
  680|     26|        }
  681|  29.5k|        _dwarf_safe_strcpy(secs->segname, sizeof(secs->segname),
  682|  29.5k|            mosec.segname,sizeof(mosec.segname));
  683|  29.5k|        ASNAR(mfp->mo_copy_word,secs->addr,mosec.addr);
  ------------------
  |  |   53|  29.5k|    do {                                        \
  |  |   54|  29.5k|        (t) = 0;                                \
  |  |   55|  29.5k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  29.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 29.5k]
  |  |  ------------------
  ------------------
  684|  29.5k|        ASNAR(mfp->mo_copy_word,secs->size,mosec.size);
  ------------------
  |  |   53|  29.5k|    do {                                        \
  |  |   54|  29.5k|        (t) = 0;                                \
  |  |   55|  29.5k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  29.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 29.5k]
  |  |  ------------------
  ------------------
  685|  29.5k|        ASNAR(mfp->mo_copy_word,secs->offset,mosec.offset);
  ------------------
  |  |   53|  29.5k|    do {                                        \
  |  |   54|  29.5k|        (t) = 0;                                \
  |  |   55|  29.5k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  29.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 29.5k]
  |  |  ------------------
  ------------------
  686|  29.5k|        ASNAR(mfp->mo_copy_word,secs->align,mosec.align);
  ------------------
  |  |   53|  29.5k|    do {                                        \
  |  |   54|  29.5k|        (t) = 0;                                \
  |  |   55|  29.5k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  29.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 29.5k]
  |  |  ------------------
  ------------------
  687|  29.5k|        ASNAR(mfp->mo_copy_word,secs->reloff,mosec.reloff);
  ------------------
  |  |   53|  29.5k|    do {                                        \
  |  |   54|  29.5k|        (t) = 0;                                \
  |  |   55|  29.5k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  29.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 29.5k]
  |  |  ------------------
  ------------------
  688|  29.5k|        ASNAR(mfp->mo_copy_word,secs->nreloc,mosec.nreloc);
  ------------------
  |  |   53|  29.5k|    do {                                        \
  |  |   54|  29.5k|        (t) = 0;                                \
  |  |   55|  29.5k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  29.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 29.5k]
  |  |  ------------------
  ------------------
  689|  29.5k|        ASNAR(mfp->mo_copy_word,secs->flags,mosec.flags);
  ------------------
  |  |   53|  29.5k|    do {                                        \
  |  |   54|  29.5k|        (t) = 0;                                \
  |  |   55|  29.5k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  29.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 29.5k]
  |  |  ------------------
  ------------------
  690|       |        /*offplussize = secs->offset+secs->size; */
  691|  29.5k|        res = _dwarf_uint64_add(secs->offset,secs->size,
  692|  29.5k|            &offplussize);
  693|  29.5k|        if (res == DW_DLV_ERROR){
  ------------------
  |  |   60|  29.5k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (693:13): [True: 0, False: 29.5k]
  ------------------
  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|  29.5k|        if (0 == strcmp(secs->segname,"__DWARF")) {
  ------------------
  |  Branch (702:13): [True: 7.14k, False: 22.3k]
  ------------------
  703|  7.14k|            if (secs->offset > mfp->mo_filesize ||
  ------------------
  |  Branch (703:17): [True: 47, False: 7.10k]
  ------------------
  704|  7.10k|                secs->size > mfp->mo_filesize ||
  ------------------
  |  Branch (704:17): [True: 47, False: 7.05k]
  ------------------
  705|  7.05k|                offplussize > mfp->mo_filesize) {
  ------------------
  |  Branch (705:17): [True: 27, False: 7.02k]
  ------------------
  706|    121|                *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|    121|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  707|    121|                return DW_DLV_ERROR;
  ------------------
  |  |   60|    121|#define DW_DLV_ERROR      1
  ------------------
  708|    121|            }
  709|  7.14k|        }
  710|  29.4k|        secs->reserved1 = 0;
  711|  29.4k|        secs->reserved2 = 0;
  712|  29.4k|        secs->reserved3 = 0;
  713|  29.4k|        secs->generic_segment_num  = segi;
  714|  29.4k|        secs->offset_of_sec_rec = curoff;
  715|  29.4k|    }
  716|  16.7k|    return DW_DLV_OK;
  ------------------
  |  |   59|  16.7k|#define DW_DLV_OK         0
  ------------------
  717|  16.9k|}
dwarf_machoread.c:_dwarf_destruct_macho_access:
  347|    595|{
  348|    595|    struct Dwarf_Obj_Access_Interface_a_s * aip =
  349|    595|        (struct Dwarf_Obj_Access_Interface_a_s *)obj;
  350|       |
  351|    595|    dwarf_macho_object_access_internals_t *mp = 0;
  352|       |
  353|    595|    if (!aip) {
  ------------------
  |  Branch (353:9): [True: 0, False: 595]
  ------------------
  354|      0|        return;
  355|      0|    }
  356|    595|    mp = (dwarf_macho_object_access_internals_t *)aip->ai_object;
  357|    595|    _dwarf_destruct_macho_internals(mp);
  358|    595|    aip->ai_object = 0;
  359|    595|    free(aip);
  360|    595|    return;
  361|    595|}
dwarf_machoread.c:_dwarf_destruct_macho_internals:
  312|  2.64k|{
  313|  2.64k|    Dwarf_Unsigned i = 0;
  314|       |
  315|  2.64k|    if (mp->mo_destruct_close_fd) {
  ------------------
  |  Branch (315:9): [True: 0, False: 2.64k]
  ------------------
  316|      0|        _dwarf_closer(mp->mo_fd);
  317|      0|        mp->mo_fd = -1;
  318|      0|    }
  319|  2.64k|    if (mp->mo_commands){
  ------------------
  |  Branch (319:9): [True: 595, False: 2.04k]
  ------------------
  320|    595|        free(mp->mo_commands);
  321|    595|        mp->mo_commands = 0;
  322|    595|    }
  323|  2.64k|    if (mp->mo_segment_commands){
  ------------------
  |  Branch (323:9): [True: 1.24k, False: 1.39k]
  ------------------
  324|  1.24k|        free(mp->mo_segment_commands);
  325|  1.24k|        mp->mo_segment_commands = 0;
  326|  1.24k|    }
  327|  2.64k|    free((char *)mp->mo_path);
  328|  2.64k|    if (mp->mo_dwarf_sections) {
  ------------------
  |  Branch (328:9): [True: 925, False: 1.71k]
  ------------------
  329|    925|        struct generic_macho_section *sp = 0;
  330|       |
  331|    925|        sp = mp->mo_dwarf_sections;
  332|  66.2k|        for ( i=0; i < mp->mo_dwarf_sectioncount; ++i,++sp) {
  ------------------
  |  Branch (332:20): [True: 65.3k, False: 925]
  ------------------
  333|  65.3k|            if (sp->loaded_data) {
  ------------------
  |  Branch (333:17): [True: 18, False: 65.3k]
  ------------------
  334|     18|                free(sp->loaded_data);
  335|     18|                sp->loaded_data = 0;
  336|     18|            }
  337|  65.3k|        }
  338|    925|        free(mp->mo_dwarf_sections);
  339|    925|        mp->mo_dwarf_sections = 0;
  340|    925|    }
  341|  2.64k|    free(mp);
  342|  2.64k|    return;
  343|  2.64k|}
dwarf_machoread.c:_dwarf_macho_object_access_init:
 1114|  2.64k|{
 1115|  2.64k|    int res = 0;
 1116|  2.64k|    dwarf_macho_object_access_internals_t *internals = 0;
 1117|  2.64k|    Dwarf_Obj_Access_Interface_a *intfc = 0;
 1118|       |
 1119|  2.64k|    internals = malloc(
 1120|  2.64k|        sizeof(dwarf_macho_object_access_internals_t));
 1121|  2.64k|    if (!internals) {
  ------------------
  |  Branch (1121:9): [True: 0, False: 2.64k]
  ------------------
 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.64k|    memset(internals,0,sizeof(*internals));
 1127|  2.64k|    res = _dwarf_macho_object_access_internals_init(internals,
 1128|  2.64k|        fd,
 1129|  2.64k|        uninumber,
 1130|  2.64k|        ftype, endian, offsetsize,
 1131|  2.64k|        universalbinary_count,
 1132|  2.64k|        filesize,
 1133|  2.64k|        localerrnum);
 1134|  2.64k|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|  2.64k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1134:9): [True: 2.04k, False: 595]
  ------------------
 1135|  2.04k|        _dwarf_destruct_macho_internals(internals);
 1136|  2.04k|        return res;
 1137|  2.04k|    }
 1138|    595|    intfc = malloc(sizeof(Dwarf_Obj_Access_Interface_a));
 1139|    595|    if (!intfc) {
  ------------------
  |  Branch (1139:9): [True: 0, False: 595]
  ------------------
 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|    595|    intfc->ai_object = internals;
 1147|    595|    intfc->ai_methods = &macho_methods;
 1148|    595|    *binary_interface = intfc;
 1149|    595|    return DW_DLV_OK;
  ------------------
  |  |   59|    595|#define DW_DLV_OK         0
  ------------------
 1150|    595|}
dwarf_machoread.c:_dwarf_macho_object_access_internals_init:
 1006|  2.64k|{
 1007|  2.64k|    Dwarf_Unsigned i  = 0;
 1008|  2.64k|    struct generic_macho_section *sp = 0;
 1009|  2.64k|    int res = 0;
 1010|  2.64k|    unsigned int   ftypei = ftype;
 1011|  2.64k|    unsigned int   endiani = endian;
 1012|  2.64k|    unsigned int   offsetsizei = offsetsize;
 1013|  2.64k|    Dwarf_Unsigned filesizei = filesize;
 1014|  2.64k|    Dwarf_Unsigned fileoffseti = 0;
 1015|  2.64k|    unsigned int unibinarycounti = 0;
 1016|       |
 1017|  2.64k|    if (ftype == DW_FTYPE_APPLEUNIVERSAL) {
  ------------------
  |  |  118|  2.64k|#define DW_FTYPE_APPLEUNIVERSAL    5
  ------------------
  |  Branch (1017:9): [True: 530, False: 2.11k]
  ------------------
 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: 480, False: 50]
  ------------------
 1025|    480|            return res;
 1026|    480|        }
 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|     50|        endoffset = fileoffseti+filesizei;
 1033|     50|        if (endoffset < fileoffseti ||
  ------------------
  |  Branch (1033:13): [True: 0, False: 50]
  ------------------
 1034|     50|            endoffset < filesizei) {
  ------------------
  |  Branch (1034:13): [True: 0, False: 50]
  ------------------
 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|     50|        *unibinarycount = unibinarycounti;
 1040|     50|        endian = endiani;
 1041|     50|    }
 1042|       |
 1043|  2.16k|    internals->mo_ident[0]    = 'M';
 1044|  2.16k|    internals->mo_ident[1]    = '1';
 1045|  2.16k|    internals->mo_fd          = fd;
 1046|  2.16k|    internals->mo_offsetsize  = offsetsizei;
 1047|  2.16k|    internals->mo_pointersize = offsetsizei;
 1048|  2.16k|    internals->mo_inner_offset  = fileoffseti;
 1049|  2.16k|    internals->mo_filesize    = filesizei;
 1050|  2.16k|    internals->mo_ftype       = ftypei;
 1051|  2.16k|    internals->mo_uninumber   = uninumber;
 1052|  2.16k|    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.16k|    if (endian == DW_END_little ) {
  ------------------
  |  | 1115|  2.16k|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  |  Branch (1063:9): [True: 537, False: 1.62k]
  ------------------
 1064|    537|        internals->mo_copy_word = _dwarf_memcpy_noswap_bytes;
 1065|    537|        internals->mo_endian = DW_END_little;
  ------------------
  |  | 1115|    537|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1066|  1.62k|    } else {
 1067|  1.62k|        internals->mo_copy_word = _dwarf_memcpy_swap_bytes;
 1068|  1.62k|        internals->mo_endian = DW_END_big;
  ------------------
  |  | 1114|  1.62k|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
 1069|  1.62k|    }
 1070|  2.16k|#endif /* LITTLE- BIG-ENDIAN */
 1071|  2.16k|    res = _dwarf_load_macho_header(internals,errcode);
 1072|  2.16k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.16k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1072:9): [True: 153, False: 2.00k]
  ------------------
 1073|    153|        return res;
 1074|    153|    }
 1075|       |    /* Load sections */
 1076|  2.00k|    res = _dwarf_load_macho_commands(internals,errcode);
 1077|  2.00k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.00k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1077:9): [True: 1.41k, False: 595]
  ------------------
 1078|  1.41k|        return res;
 1079|  1.41k|    }
 1080|    595|    if (internals->mo_dwarf_sections) {
  ------------------
  |  Branch (1080:9): [True: 436, False: 159]
  ------------------
 1081|    436|        sp = internals->mo_dwarf_sections+1;
 1082|    436|    } else {
 1083|       |        /*  There are no dwarf sections, but could be .text */
 1084|    159|    }
 1085|  20.4k|    for (i = 1; i < internals->mo_dwarf_sectioncount ; ++i,++sp) {
  ------------------
  |  Branch (1085:17): [True: 19.8k, False: 595]
  ------------------
 1086|  19.8k|        int j = 1;
 1087|  19.8k|        int lim = sizeof(SectionNames)/sizeof(SectionNames[0]);
 1088|  19.8k|        sp->dwarfsectname = "";
 1089|   425k|        for ( ; j < lim; ++j) {
  ------------------
  |  Branch (1089:17): [True: 406k, False: 18.9k]
  ------------------
 1090|   406k|            if (!strcmp(sp->sectname,SectionNames[j].ms_moname)) {
  ------------------
  |  Branch (1090:17): [True: 966, False: 405k]
  ------------------
 1091|    966|                sp->dwarfsectname = SectionNames[j].ms_dwname;
 1092|    966|                break;
 1093|    966|            }
 1094|   406k|        }
 1095|  19.8k|        if (sp->dwarfsectname[0] == 0) {
  ------------------
  |  Branch (1095:13): [True: 18.9k, False: 966]
  ------------------
 1096|       |            /* if not matched, keep the apple section name */
 1097|  18.9k|            sp->dwarfsectname = sp->sectname;
 1098|  18.9k|        }
 1099|  19.8k|    }
 1100|    595|    return DW_DLV_OK;
  ------------------
  |  |   59|    595|#define DW_DLV_OK         0
  ------------------
 1101|  2.00k|}
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: 444, False: 86]
  ------------------
  954|    444|        return res;
  955|    444|    }
  956|     86|    if (uninumber >= *unibinarycount) {
  ------------------
  |  Branch (956:9): [True: 3, False: 83]
  ------------------
  957|      3|        *errcode = DW_DLE_UNIVERSAL_BINARY_ERROR;
  ------------------
  |  | 1548|      3|#define DW_DLE_UNIVERSAL_BINARY_ERROR          502
  ------------------
  958|      3|        _dwarf_dealloc_universal_head(head);
  959|      3|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
  960|      3|    }
  961|       |    /*  Now find the precise details of uninumber
  962|       |        instance we want */
  963|       |
  964|     83|    innerbase = head->au_arches[uninumber].au_offset;
  965|     83|    innersize = head->au_arches[uninumber].au_size;
  966|     83|    if (innersize >= outer_filesize ||
  ------------------
  |  Branch (966:9): [True: 0, False: 83]
  ------------------
  967|     83|        innerbase >= outer_filesize) {
  ------------------
  |  Branch (967:9): [True: 0, False: 83]
  ------------------
  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|     83|    {
  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|     83|        Dwarf_Unsigned fake_size = 0;
  979|       |
  980|     83|        res = _dwarf_object_detector_fd_a(fd,
  981|     83|            ftype,endian,offsetsize,innerbase,&fake_size,
  982|     83|            errcode);
  983|     83|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     83|#define DW_DLV_OK         0
  ------------------
  |  Branch (983:13): [True: 33, False: 50]
  ------------------
  984|     33|            _dwarf_dealloc_universal_head(head);
  985|     33|            return res;
  986|     33|        }
  987|     83|    }
  988|     50|    *fileoffset = innerbase;
  989|     50|    *filesize = innersize;
  990|     50|    _dwarf_dealloc_universal_head(head);
  991|     50|    return DW_DLV_OK;
  ------------------
  |  |   59|     50|#define DW_DLV_OK         0
  ------------------
  992|     83|}
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: 71, False: 459]
  ------------------
 1241|     71|        locendian = DW_END_big;
  ------------------
  |  | 1114|     71|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
 1242|     71|        locoffsetsize = 32;
 1243|    459|    } else if (duhd.au_magic == FAT_CIGAM) {
  ------------------
  |  |   85|    459|#define FAT_CIGAM   0xbebafeca
  ------------------
  |  Branch (1243:16): [True: 123, False: 336]
  ------------------
 1244|    123|        locendian = DW_END_little;
  ------------------
  |  | 1115|    123|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1245|    123|        locoffsetsize = 32;
 1246|    336|    }else if (duhd.au_magic == FAT_MAGIC_64) {
  ------------------
  |  |   86|    336|#define FAT_MAGIC_64    0xcafebabf
  ------------------
  |  Branch (1246:15): [True: 116, False: 220]
  ------------------
 1247|    116|        locendian = DW_END_big;
  ------------------
  |  | 1114|    116|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
 1248|    116|        locoffsetsize = 64;
 1249|    220|    } else if (duhd.au_magic == FAT_CIGAM_64) {
  ------------------
  |  |   87|    220|#define FAT_CIGAM_64    0xbfbafeca
  ------------------
  |  Branch (1249:16): [True: 220, False: 0]
  ------------------
 1250|    220|        locendian = DW_END_little;
  ------------------
  |  | 1115|    220|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1251|    220|        locoffsetsize = 64;
 1252|    220|    } 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: 343, False: 187]
  ------------------
 1264|    343|        word_swap = _dwarf_memcpy_noswap_bytes;
 1265|    343|    } else {
 1266|    187|        word_swap = _dwarf_memcpy_swap_bytes;
 1267|    187|    }
 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: 47, False: 483]
  ------------------
 1272|     47|        *errcode = DW_DLE_UNIVERSAL_BINARY_ERROR ;
  ------------------
  |  | 1548|     47|#define DW_DLE_UNIVERSAL_BINARY_ERROR          502
  ------------------
 1273|     47|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     47|#define DW_DLV_ERROR      1
  ------------------
 1274|     47|    }
 1275|    483|    duhd.au_arches = (struct  Dwarf_Universal_Arch_s*)
 1276|    483|        calloc(duhd.au_count, sizeof(struct Dwarf_Universal_Arch_s));
 1277|    483|    if (!duhd.au_arches) {
  ------------------
  |  Branch (1277:9): [True: 0, False: 483]
  ------------------
 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|    483|    if (locoffsetsize == 32) {
  ------------------
  |  Branch (1281:9): [True: 175, False: 308]
  ------------------
 1282|    175|        struct fat_arch * fa = 0;
 1283|       |
 1284|    175|        fa = (struct fat_arch *)calloc(duhd.au_count,
 1285|    175|            sizeof(struct fat_arch));
 1286|    175|        if (!fa) {
  ------------------
  |  Branch (1286:13): [True: 0, False: 175]
  ------------------
 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|    175|        if (sizeof(fh)+duhd.au_count*sizeof(*fa) >= dw_filesize) {
  ------------------
  |  Branch (1293:13): [True: 30, False: 145]
  ------------------
 1294|     30|            free(duhd.au_arches);
 1295|     30|            duhd.au_arches = 0;
 1296|     30|            free(fa);
 1297|     30|            *errcode = DW_DLE_FILE_OFFSET_BAD;
  ------------------
  |  | 1463|     30|#define DW_DLE_FILE_OFFSET_BAD                 417
  ------------------
 1298|     30|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     30|#define DW_DLV_ERROR      1
  ------------------
 1299|     30|        }
 1300|    145|        res = RRMOA(fd,fa,/*offset=*/sizeof(fh),
  ------------------
  |  |   65|    145|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    145|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1301|    145|            duhd.au_count*sizeof(*fa),
 1302|    145|            dw_filesize,errcode);
 1303|    145|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    145|#define DW_DLV_OK         0
  ------------------
  |  Branch (1303:13): [True: 0, False: 145]
  ------------------
 1304|      0|            free(duhd.au_arches);
 1305|      0|            duhd.au_arches = 0;
 1306|      0|            free(fa);
 1307|      0|            return res;
 1308|      0|        }
 1309|    145|        res = fill_in_uni_arch_32(fa,&duhd,word_swap,
 1310|    145|            errcode);
 1311|    145|        free(fa);
 1312|    145|        fa = 0;
 1313|    145|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    145|#define DW_DLV_OK         0
  ------------------
  |  Branch (1313:13): [True: 104, False: 41]
  ------------------
 1314|    104|            free(duhd.au_arches);
 1315|    104|            duhd.au_arches = 0;
 1316|    104|            return res;
 1317|    104|        }
 1318|    308|    } else { /* 64 */
 1319|    308|        struct fat_arch_64 * fa = 0;
 1320|    308|        fa = (struct fat_arch_64 *)calloc(duhd.au_count,
 1321|    308|            sizeof(struct fat_arch_64));
 1322|    308|        if (!fa) {
  ------------------
  |  Branch (1322:13): [True: 0, False: 308]
  ------------------
 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|    308|        if (sizeof(fh)+duhd.au_count*sizeof(*fa) >= dw_filesize) {
  ------------------
  |  Branch (1328:13): [True: 42, False: 266]
  ------------------
 1329|     42|            free(duhd.au_arches);
 1330|     42|            duhd.au_arches = 0;
 1331|     42|            free(fa);
 1332|     42|            *errcode = DW_DLE_FILE_OFFSET_BAD ;
  ------------------
  |  | 1463|     42|#define DW_DLE_FILE_OFFSET_BAD                 417
  ------------------
 1333|     42|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     42|#define DW_DLV_ERROR      1
  ------------------
 1334|     42|        }
 1335|    266|        res = RRMOA(fd,fa,/*offset*/sizeof(fh),
  ------------------
  |  |   65|    266|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    266|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1336|    266|            duhd.au_count*sizeof(fa),
 1337|    266|            dw_filesize,errcode);
 1338|    266|        if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|    266|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1338:13): [True: 0, False: 266]
  ------------------
 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|    266|        res = _dwarf_fill_in_uni_arch_64(fa,&duhd,word_swap,
 1346|    266|            errcode);
 1347|    266|        free(fa);
 1348|    266|        fa = 0;
 1349|    266|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    266|#define DW_DLV_OK         0
  ------------------
  |  Branch (1349:13): [True: 221, False: 45]
  ------------------
 1350|    221|            free(duhd.au_arches);
 1351|    221|            duhd.au_arches = 0;
 1352|    221|            return res;
 1353|    221|        }
 1354|    266|    }
 1355|       |
 1356|     86|    duhdp = malloc(sizeof(*duhdp));
 1357|     86|    if (!duhdp) {
  ------------------
  |  Branch (1357:9): [True: 0, False: 86]
  ------------------
 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|     86|    memcpy(duhdp,&duhd,sizeof(duhd));
 1364|     86|    *dw_contentcount = (unsigned int)duhd.au_count;
 1365|     86|    duhdp->au_arches = duhd.au_arches;
 1366|     86|    *dw_head = duhdp;
 1367|     86|    return DW_DLV_OK;
  ------------------
  |  |   59|     86|#define DW_DLV_OK         0
  ------------------
 1368|     86|}
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|    145|{
 1176|    145|    Dwarf_Unsigned i = 0;
 1177|    145|    struct Dwarf_Universal_Arch_s * dua = 0;
 1178|       |
 1179|    145|    dua = duhd->au_arches;
 1180|    476|    for ( ; i < duhd->au_count; ++i,++fa,++dua) {
  ------------------
  |  Branch (1180:13): [True: 435, False: 41]
  ------------------
 1181|    435|        ASNAR(word_swap,dua->au_cputype,fa->cputype);
  ------------------
  |  |   53|    435|    do {                                        \
  |  |   54|    435|        (t) = 0;                                \
  |  |   55|    435|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    435|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 435]
  |  |  ------------------
  ------------------
 1182|    435|        ASNAR(word_swap,dua->au_cpusubtype,fa->cpusubtype);
  ------------------
  |  |   53|    435|    do {                                        \
  |  |   54|    435|        (t) = 0;                                \
  |  |   55|    435|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    435|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 435]
  |  |  ------------------
  ------------------
 1183|    435|        ASNAR(word_swap,dua->au_offset,fa->offset);
  ------------------
  |  |   53|    435|    do {                                        \
  |  |   54|    435|        (t) = 0;                                \
  |  |   55|    435|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    435|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 435]
  |  |  ------------------
  ------------------
 1184|    435|        if (dua->au_offset >= duhd->au_filesize) {
  ------------------
  |  Branch (1184:13): [True: 48, False: 387]
  ------------------
 1185|     48|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|     48|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
 1186|     48|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     48|#define DW_DLV_ERROR      1
  ------------------
 1187|     48|        }
 1188|    387|        ASNAR(word_swap,dua->au_size,fa->size);
  ------------------
  |  |   53|    387|    do {                                        \
  |  |   54|    387|        (t) = 0;                                \
  |  |   55|    387|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    387|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 387]
  |  |  ------------------
  ------------------
 1189|    387|        if (dua->au_size >= duhd->au_filesize) {
  ------------------
  |  Branch (1189:13): [True: 7, False: 380]
  ------------------
 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|    380|        if ((dua->au_size+dua->au_offset) > duhd->au_filesize) {
  ------------------
  |  Branch (1193:13): [True: 16, False: 364]
  ------------------
 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|    364|        ASNAR(word_swap,dua->au_align,fa->align);
  ------------------
  |  |   53|    364|    do {                                        \
  |  |   54|    364|        (t) = 0;                                \
  |  |   55|    364|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    364|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 364]
  |  |  ------------------
  ------------------
 1199|    364|        if (dua->au_align >= 32) {
  ------------------
  |  Branch (1199:13): [True: 33, False: 331]
  ------------------
 1200|     33|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|     33|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
 1201|     33|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     33|#define DW_DLV_ERROR      1
  ------------------
 1202|     33|        }
 1203|    331|        dua->au_reserved = 0;
 1204|    331|    }
 1205|     41|    return DW_DLV_OK;
  ------------------
  |  |   59|     41|#define DW_DLV_OK         0
  ------------------
 1206|    145|}
dwarf_machoread.c:macho_get_section_info:
  227|  40.0k|{
  228|  40.0k|    dwarf_macho_object_access_internals_t *macho =
  229|  40.0k|        (dwarf_macho_object_access_internals_t*)(obj);
  230|       |
  231|  40.0k|    (void)error;
  232|  40.0k|    if (section_index < macho->mo_dwarf_sectioncount) {
  ------------------
  |  Branch (232:9): [True: 40.0k, False: 0]
  ------------------
  233|  40.0k|        struct generic_macho_section *sp = 0;
  234|       |
  235|  40.0k|        sp = macho->mo_dwarf_sections + section_index;
  236|  40.0k|        return_section->as_name   = sp->dwarfsectname;
  237|  40.0k|        return_section->as_type   = 0;
  238|  40.0k|        return_section->as_flags  = sp->flags;
  239|  40.0k|        return_section->as_addr   = sp->addr;
  240|  40.0k|        return_section->as_offset = sp->offset;
  241|  40.0k|        return_section->as_size   = sp->size;
  242|  40.0k|        return_section->as_link   = 0;
  243|  40.0k|        return_section->as_info   = 0;
  244|  40.0k|        return_section->as_addralign = 0;
  245|  40.0k|        return_section->as_entrysize = 0;
  246|  40.0k|        return DW_DLV_OK;
  ------------------
  |  |   59|  40.0k|#define DW_DLV_OK         0
  ------------------
  247|  40.0k|    }
  248|      0|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  249|  40.0k|}
dwarf_machoread.c:macho_get_byte_order:
  190|    595|{
  191|    595|    dwarf_macho_object_access_internals_t *macho =
  192|    595|        (dwarf_macho_object_access_internals_t*)(obj);
  193|    595|    return macho->mo_endian;
  194|    595|}
dwarf_machoread.c:macho_get_length_size:
  197|    595|{
  198|    595|    dwarf_macho_object_access_internals_t *macho =
  199|    595|        (dwarf_macho_object_access_internals_t*)(obj);
  200|    595|    return macho->mo_offsetsize/8;
  201|    595|}
dwarf_machoread.c:macho_get_pointer_size:
  204|    595|{
  205|    595|    dwarf_macho_object_access_internals_t *macho =
  206|    595|        (dwarf_macho_object_access_internals_t*)(obj);
  207|    595|    return macho->mo_pointersize/8;
  208|    595|}
dwarf_machoread.c:macho_get_file_size:
  210|    595|{
  211|    595|    dwarf_macho_object_access_internals_t *macho =
  212|    595|        (dwarf_macho_object_access_internals_t*)(obj);
  213|    595|    return macho->mo_filesize;
  214|    595|}
dwarf_machoread.c:macho_get_section_count:
  217|    595|{
  218|    595|    dwarf_macho_object_access_internals_t *macho =
  219|    595|        (dwarf_macho_object_access_internals_t*)(obj);
  220|    595|    return macho->mo_dwarf_sectioncount;
  221|    595|}
dwarf_machoread.c:macho_load_section:
  254|    187|{
  255|    187|    dwarf_macho_object_access_internals_t *macho =
  256|    187|        (dwarf_macho_object_access_internals_t*)(obj);
  257|       |
  258|    187|    if (0 < section_index &&
  ------------------
  |  Branch (258:9): [True: 187, False: 0]
  ------------------
  259|    187|        section_index < macho->mo_dwarf_sectioncount) {
  ------------------
  |  Branch (259:9): [True: 187, False: 0]
  ------------------
  260|    187|        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|    187|        Dwarf_Unsigned inner = macho->mo_inner_offset;
  267|    187|        Dwarf_Unsigned full_offset = 0;
  268|       |
  269|    187|        struct generic_macho_section *sp =
  270|    187|            macho->mo_dwarf_sections + section_index;
  271|    187|        if (sp->loaded_data) {
  ------------------
  |  Branch (271:13): [True: 0, False: 187]
  ------------------
  272|      0|            *return_data = sp->loaded_data;
  273|      0|            return DW_DLV_OK;
  ------------------
  |  |   59|      0|#define DW_DLV_OK         0
  ------------------
  274|      0|        }
  275|    187|        if (!sp->size) {
  ------------------
  |  Branch (275:13): [True: 0, False: 187]
  ------------------
  276|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  277|      0|        }
  278|    187|        full_offset = sp->size + sp->offset + inner;
  279|    187|        if (full_offset < sp->size ||
  ------------------
  |  Branch (279:13): [True: 4, False: 183]
  ------------------
  280|    183|            full_offset < sp->offset ||
  ------------------
  |  Branch (280:13): [True: 0, False: 183]
  ------------------
  281|    183|            full_offset < inner) {
  ------------------
  |  Branch (281:13): [True: 0, False: 183]
  ------------------
  282|      4|            *error = DW_DLE_ARITHMETIC_OVERFLOW;
  ------------------
  |  | 1547|      4|#define DW_DLE_ARITHMETIC_OVERFLOW             501
  ------------------
  283|      4|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
  284|      4|        }
  285|    183|        if ((sp->size + sp->offset) > macho->mo_filesize) {
  ------------------
  |  Branch (285:13): [True: 165, False: 18]
  ------------------
  286|    165|            *error = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|    165|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  287|    165|            return DW_DLV_ERROR;
  ------------------
  |  |   60|    165|#define DW_DLV_ERROR      1
  ------------------
  288|    165|        }
  289|     18|        sp->loaded_data = malloc((size_t)sp->size);
  290|     18|        if (!sp->loaded_data) {
  ------------------
  |  Branch (290:13): [True: 0, False: 18]
  ------------------
  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|     18|        res = RRMOA(macho->mo_fd,
  ------------------
  |  |   65|     18|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     18|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  295|     18|            sp->loaded_data, (inner+sp->offset),
  296|     18|            sp->size,
  297|     18|            (inner+macho->mo_filesize), error);
  298|     18|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     18|#define DW_DLV_OK         0
  ------------------
  |  Branch (298:13): [True: 0, False: 18]
  ------------------
  299|      0|            free(sp->loaded_data);
  300|      0|            sp->loaded_data = 0;
  301|      0|            return res;
  302|      0|        }
  303|     18|        *return_data = sp->loaded_data;
  304|     18|        return DW_DLV_OK;
  ------------------
  |  |   59|     18|#define DW_DLV_OK         0
  ------------------
  305|     18|    }
  306|      0|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  307|    187|}

_dwarf_memcpy_noswap_bytes:
   48|  3.02M|{
   49|  3.02M|    memcpy(s1,s2,(size_t)len);
   50|  3.02M|    return;
   51|  3.02M|}
_dwarf_memcpy_swap_bytes:
   57|  8.72M|{
   58|  8.72M|    unsigned char       *targ = (unsigned char *) s1;
   59|  8.72M|    const unsigned char *src = (const unsigned char *) s2;
   60|  8.72M|    unsigned long        i = 0;
   61|  8.72M|    unsigned long        n = (long)(len-1);
   62|       |
   63|  8.72M|    if (len > 8) {
  ------------------
  |  Branch (63:9): [True: 0, False: 8.72M]
  ------------------
   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|  47.8M|    for ( ; i < len; ++i,--n) {
  ------------------
  |  Branch (70:13): [True: 39.1M, False: 8.72M]
  ------------------
   71|  39.1M|        targ[n]  = src[i];
   72|  39.1M|    }
   73|  8.72M|    return;
   74|  8.72M|}

_dwarf_object_detector_fd_a:
  526|  8.49k|{
  527|  8.49k|    struct elf_header h;
  528|  8.49k|    Dwarf_Unsigned readlen = sizeof(h);
  529|  8.49k|    Dwarf_Unsigned filesize = 0;
  530|  8.49k|    Dwarf_Unsigned remaininglen  = 0;
  531|  8.49k|    int            res = 0;
  532|       |
  533|  8.49k|    h = h_zero;
  534|  8.49k|    {
  535|  8.49k|        res = _dwarf_seekr(fd,0,SEEK_END,&filesize);
  536|  8.49k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   64|  8.49k|#define DW_DLV_OK        0
  ------------------
  |  Branch (536:13): [True: 0, False: 8.49k]
  ------------------
  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.49k|    }
  541|  8.49k|    if (filesize <= readlen) {
  ------------------
  |  Branch (541:9): [True: 11, False: 8.48k]
  ------------------
  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.48k|    if (filesize <= fileoffsetbase) {
  ------------------
  |  Branch (546:9): [True: 0, False: 8.48k]
  ------------------
  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.48k|    remaininglen = filesize - fileoffsetbase;
  551|  8.48k|    if (remaininglen <= readlen) {
  ------------------
  |  Branch (551:9): [True: 13, False: 8.47k]
  ------------------
  552|       |        /* Not a real object file */
  553|     13|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     13|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  554|     13|        return DW_DLV_ERROR;
  ------------------
  |  |   65|     13|#define DW_DLV_ERROR     1
  ------------------
  555|     13|    }
  556|       |    /*  fileoffsetbase is non zero iff we have
  557|       |        an Apple Universal Binary. */
  558|  8.47k|    if (readlen > remaininglen) {
  ------------------
  |  Branch (558:9): [True: 0, False: 8.47k]
  ------------------
  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.47k|    res = _dwarf_object_read_random(fd, (char *)&h,
  564|  8.47k|        fileoffsetbase,
  565|  8.47k|        readlen, filesize,errcode);
  566|  8.47k|    if (h.e_ident[0] == 0x7f &&
  ------------------
  |  Branch (566:9): [True: 4.62k, False: 3.84k]
  ------------------
  567|  4.62k|        h.e_ident[1] == 'E' &&
  ------------------
  |  Branch (567:9): [True: 4.61k, False: 11]
  ------------------
  568|  4.61k|        h.e_ident[2] == 'L' &&
  ------------------
  |  Branch (568:9): [True: 4.60k, False: 12]
  ------------------
  569|  4.60k|        h.e_ident[3] == 'F') {
  ------------------
  |  Branch (569:9): [True: 4.59k, False: 9]
  ------------------
  570|       |        /* is ELF */
  571|       |
  572|  4.59k|        res = fill_in_elf_fields(&h,endian,offsetsize,errcode);
  573|  4.59k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   64|  4.59k|#define DW_DLV_OK        0
  ------------------
  |  Branch (573:13): [True: 10, False: 4.58k]
  ------------------
  574|     10|            return res;
  575|     10|        }
  576|  4.58k|        *ftype = DW_FTYPE_ELF;
  ------------------
  |  |  114|  4.58k|#define DW_FTYPE_ELF        1  /* Unix/Linux/etc */
  ------------------
  577|  4.58k|        *filesize_out = (Dwarf_Unsigned)filesize;
  578|  4.58k|        return DW_DLV_OK;
  ------------------
  |  |   64|  4.58k|#define DW_DLV_OK        0
  ------------------
  579|  4.59k|    }
  580|  3.87k|    if (is_mach_o_universal(&h,endian,offsetsize)) {
  ------------------
  |  Branch (580:9): [True: 575, False: 3.30k]
  ------------------
  581|    575|        *ftype = DW_FTYPE_APPLEUNIVERSAL;
  ------------------
  |  |  118|    575|#define DW_FTYPE_APPLEUNIVERSAL    5
  ------------------
  582|    575|        *filesize_out = (Dwarf_Unsigned)filesize;
  583|    575|        return DW_DLV_OK;
  ------------------
  |  |   64|    575|#define DW_DLV_OK        0
  ------------------
  584|    575|    }
  585|  3.30k|    if (is_mach_o_magic(&h,endian,offsetsize)) {
  ------------------
  |  Branch (585:9): [True: 2.11k, False: 1.18k]
  ------------------
  586|  2.11k|        *ftype = DW_FTYPE_MACH_O;
  ------------------
  |  |  115|  2.11k|#define DW_FTYPE_MACH_O     2  /* Macos. */
  ------------------
  587|  2.11k|        *filesize_out = (Dwarf_Unsigned)filesize;
  588|  2.11k|        return DW_DLV_OK;
  ------------------
  |  |   64|  2.11k|#define DW_DLV_OK        0
  ------------------
  589|  2.11k|    }
  590|  1.18k|    if (is_archive_magic(&h)) {
  ------------------
  |  Branch (590:9): [True: 1, False: 1.18k]
  ------------------
  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.18k|    res = is_pe_object(fd,filesize,endian,offsetsize,errcode);
  596|  1.18k|    if (res == DW_DLV_OK ) {
  ------------------
  |  |   64|  1.18k|#define DW_DLV_OK        0
  ------------------
  |  Branch (596:9): [True: 738, False: 448]
  ------------------
  597|    738|        *ftype = DW_FTYPE_PE;
  ------------------
  |  |  116|    738|#define DW_FTYPE_PE         3  /* Windows */
  ------------------
  598|    738|        *filesize_out = (Dwarf_Unsigned)filesize;
  599|    738|        return DW_DLV_OK;
  ------------------
  |  |   64|    738|#define DW_DLV_OK        0
  ------------------
  600|    738|    }
  601|       |    /* Unknown object format. */
  602|    448|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   63|    448|#define DW_DLV_NO_ENTRY -1
  ------------------
  603|  1.18k|}
dwarf_object_detector.c:fill_in_elf_fields:
  266|  4.59k|{
  267|  4.59k|    unsigned locendian = 0;
  268|  4.59k|    unsigned locoffsetsize = 0;
  269|       |
  270|  4.59k|    switch(h->e_ident[EI_CLASS]) {
  ------------------
  |  |   69|  4.59k|#define EI_CLASS  4
  ------------------
  271|  3.06k|    case ELFCLASS32:
  ------------------
  |  |   72|  3.06k|#define ELFCLASS32 1
  ------------------
  |  Branch (271:5): [True: 3.06k, False: 1.53k]
  ------------------
  272|  3.06k|        locoffsetsize = 32;
  273|  3.06k|        break;
  274|  1.52k|    case ELFCLASS64:
  ------------------
  |  |   73|  1.52k|#define ELFCLASS64 2
  ------------------
  |  Branch (274:5): [True: 1.52k, False: 3.06k]
  ------------------
  275|  1.52k|        locoffsetsize = 64;
  276|  1.52k|        break;
  277|      1|    default:
  ------------------
  |  Branch (277:5): [True: 1, False: 4.59k]
  ------------------
  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.59k|    }
  281|  4.59k|    switch(h->e_ident[EI_DATA]) {
  ------------------
  |  |   70|  4.59k|#define EI_DATA   5
  ------------------
  282|  1.38k|    case ELFDATA2LSB:
  ------------------
  |  |   74|  1.38k|#define ELFDATA2LSB 1
  ------------------
  |  Branch (282:5): [True: 1.38k, False: 3.20k]
  ------------------
  283|  1.38k|        locendian = DW_END_little;
  ------------------
  |  | 1115|  1.38k|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  284|  1.38k|        break;
  285|  3.20k|    case ELFDATA2MSB:
  ------------------
  |  |   75|  3.20k|#define ELFDATA2MSB 2
  ------------------
  |  Branch (285:5): [True: 3.20k, False: 1.38k]
  ------------------
  286|  3.20k|        locendian = DW_END_big;
  ------------------
  |  | 1114|  3.20k|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  287|  3.20k|        break;
  288|      1|    default:
  ------------------
  |  Branch (288:5): [True: 1, False: 4.59k]
  ------------------
  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.59k|    }
  292|  4.59k|    if (h->e_ident[EI_VERSION] != 1 /* EV_CURRENT */) {
  ------------------
  |  |   71|  4.59k|#define EI_VERSION 6
  ------------------
  |  Branch (292:9): [True: 8, False: 4.58k]
  ------------------
  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.58k|    *endian = locendian;
  297|  4.58k|    *objoffsetsize = locoffsetsize;
  298|  4.58k|    return DW_DLV_OK;
  ------------------
  |  |   64|  4.58k|#define DW_DLV_OK        0
  ------------------
  299|  4.59k|}
dwarf_object_detector.c:is_mach_o_universal:
  432|  3.87k|{
  433|  3.87k|    unsigned long magicval = 0;
  434|  3.87k|    unsigned locendian = 0;
  435|  3.87k|    unsigned locoffsetsize = 0;
  436|       |
  437|       |    /*  No swapping here. Need to match size of
  438|       |        the universal-object  magic field. */
  439|  3.87k|    magicval = magic_copy(h->e_ident,4);
  440|  3.87k|    if (magicval == FAT_MAGIC) {
  ------------------
  |  |   84|  3.87k|#define FAT_MAGIC   0xcafebabe
  ------------------
  |  Branch (440:9): [True: 75, False: 3.80k]
  ------------------
  441|     75|        locendian = DW_END_big;
  ------------------
  |  | 1114|     75|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  442|     75|        locoffsetsize = 32;
  443|  3.80k|    } else if (magicval == FAT_CIGAM) {
  ------------------
  |  |   85|  3.80k|#define FAT_CIGAM   0xbebafeca
  ------------------
  |  Branch (443:16): [True: 140, False: 3.66k]
  ------------------
  444|    140|        locendian = DW_END_little;
  ------------------
  |  | 1115|    140|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  445|    140|        locoffsetsize = 32;
  446|  3.66k|    }else if (magicval == FAT_MAGIC_64) {
  ------------------
  |  |   86|  3.66k|#define FAT_MAGIC_64    0xcafebabf
  ------------------
  |  Branch (446:15): [True: 125, False: 3.53k]
  ------------------
  447|    125|        locendian = DW_END_big;
  ------------------
  |  | 1114|    125|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  448|    125|        locoffsetsize = 64;
  449|  3.53k|    } else if (magicval == FAT_CIGAM_64) {
  ------------------
  |  |   87|  3.53k|#define FAT_CIGAM_64    0xbfbafeca
  ------------------
  |  Branch (449:16): [True: 235, False: 3.30k]
  ------------------
  450|    235|        locendian = DW_END_little;
  ------------------
  |  | 1115|    235|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  451|    235|        locoffsetsize = 64;
  452|  3.30k|    } else {
  453|  3.30k|        return FALSE;
  ------------------
  |  |   36|  3.30k|#define FALSE 0
  ------------------
  454|  3.30k|    }
  455|    575|    *endian = locendian;
  456|    575|    *offsetsize = locoffsetsize;
  457|    575|    return TRUE;
  ------------------
  |  |   33|    575|#define TRUE 1
  ------------------
  458|  3.87k|}
dwarf_object_detector.c:magic_copy:
  126|  8.11k|{
  127|  8.11k|    unsigned i = 0;
  128|  8.11k|    unsigned long v = 0;
  129|       |
  130|  8.11k|    v = d[0];
  131|  30.5k|    for (i = 1 ; i < len; ++i) {
  ------------------
  |  Branch (131:18): [True: 22.4k, False: 8.11k]
  ------------------
  132|  22.4k|        v <<= 8;
  133|  22.4k|        v |=  d[i];
  134|  22.4k|    }
  135|  8.11k|    return v;
  136|  8.11k|}
dwarf_object_detector.c:is_mach_o_magic:
  464|  3.30k|{
  465|  3.30k|    unsigned long magicval = 0;
  466|  3.30k|    unsigned locendian = 0;
  467|  3.30k|    unsigned locoffsetsize = 0;
  468|       |
  469|       |    /*  No swapping here. Need to match size of
  470|       |        Mach-o magic field. */
  471|  3.30k|    magicval = magic_copy(h->e_ident,4);
  472|  3.30k|    if (magicval == MH_MAGIC) {
  ------------------
  |  |  130|  3.30k|#define    MH_MAGIC    0xfeedface    /* the mach magic number */
  ------------------
  |  Branch (472:9): [True: 820, False: 2.48k]
  ------------------
  473|    820|        locendian = DW_END_big;
  ------------------
  |  | 1114|    820|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  474|    820|        locoffsetsize = 32;
  475|  2.48k|    } else if (magicval == MH_CIGAM) {
  ------------------
  |  |  131|  2.48k|#define MH_CIGAM    0xcefaedfe    /* NXSwapInt(MH_MAGIC) */
  ------------------
  |  Branch (475:16): [True: 423, False: 2.05k]
  ------------------
  476|    423|        locendian = DW_END_little;
  ------------------
  |  | 1115|    423|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  477|    423|        locoffsetsize = 32;
  478|  2.05k|    }else if (magicval == MH_MAGIC_64) {
  ------------------
  |  |  151|  2.05k|#define MH_MAGIC_64 0xfeedfacf /* the 64-bit mach magic number */
  ------------------
  |  Branch (478:15): [True: 791, False: 1.26k]
  ------------------
  479|    791|        locendian = DW_END_big;
  ------------------
  |  | 1114|    791|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  480|    791|        locoffsetsize = 64;
  481|  1.26k|    } else if (magicval == MH_CIGAM_64) {
  ------------------
  |  |  152|  1.26k|#define MH_CIGAM_64 0xcffaedfe /* NXSwapInt(MH_MAGIC_64) */
  ------------------
  |  Branch (481:16): [True: 80, False: 1.18k]
  ------------------
  482|     80|        locendian = DW_END_little;
  ------------------
  |  | 1115|     80|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  483|     80|        locoffsetsize = 64;
  484|  1.18k|    } else {
  485|  1.18k|        return FALSE;
  ------------------
  |  |   36|  1.18k|#define FALSE 0
  ------------------
  486|  1.18k|    }
  487|  2.11k|    *endian = locendian;
  488|  2.11k|    *offsetsize = locoffsetsize;
  489|  2.11k|    return TRUE;
  ------------------
  |  |   33|  2.11k|#define TRUE 1
  ------------------
  490|  3.30k|}
dwarf_object_detector.c:is_archive_magic:
  304|  1.18k|is_archive_magic(struct elf_header *h) {
  305|  1.18k|    int i = 0;
  306|  1.18k|    int len = sizeof(archive_magic);
  307|  1.18k|    const char *cp = (const char *)h;
  308|  1.21k|    for ( ; i < len; ++i) {
  ------------------
  |  Branch (308:13): [True: 1.21k, False: 1]
  ------------------
  309|  1.21k|        if (cp[i] != archive_magic[i]) {
  ------------------
  |  Branch (309:13): [True: 1.18k, False: 24]
  ------------------
  310|  1.18k|            return FALSE;
  ------------------
  |  |   36|  1.18k|#define FALSE 0
  ------------------
  311|  1.18k|        }
  312|  1.21k|    }
  313|      1|    return TRUE;
  ------------------
  |  |   33|      1|#define TRUE 1
  ------------------
  314|  1.18k|}
dwarf_object_detector.c:is_pe_object:
  324|  1.18k|{
  325|  1.18k|    unsigned dos_sig = 0;
  326|  1.18k|    unsigned locendian = 0;
  327|  1.18k|    void (*word_swap) (void *, const void *, unsigned long);
  328|  1.18k|    unsigned long nt_address = 0;
  329|  1.18k|    struct dos_header dhinmem;
  330|  1.18k|    char nt_sig_array[4];
  331|  1.18k|    unsigned long nt_sig = 0;
  332|  1.18k|    struct pe_image_file_header ifh;
  333|  1.18k|    int res = 0;
  334|       |
  335|  1.18k|    if (filesize < (sizeof (struct dos_header) +
  ------------------
  |  Branch (335:9): [True: 245, False: 941]
  ------------------
  336|  1.18k|        SIZEOFT32 + sizeof(struct pe_image_file_header))) {
  ------------------
  |  |   61|  1.18k|#define SIZEOFT32 4
  ------------------
  337|    245|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|    245|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  338|    245|        return DW_DLV_ERROR;
  ------------------
  |  |   65|    245|#define DW_DLV_ERROR     1
  ------------------
  339|    245|    }
  340|    941|    res = _dwarf_object_read_random(fd,(char *)&dhinmem,
  341|    941|        0,sizeof(dhinmem),filesize,errcode);
  342|    941|    if (res != DW_DLV_OK) {
  ------------------
  |  |   64|    941|#define DW_DLV_OK        0
  ------------------
  |  Branch (342:9): [True: 0, False: 941]
  ------------------
  343|      0|        return res;
  344|      0|    }
  345|       |    /* No swap here, want it as in the file */
  346|    941|    dos_sig = magic_copy((unsigned char *)dhinmem.dh_mz,
  347|    941|        sizeof(dhinmem.dh_mz));
  348|    941|    if (dos_sig == IMAGE_DOS_SIGNATURE_dw) {
  ------------------
  |  |  191|    941|#define IMAGE_DOS_SIGNATURE_dw      0x5A4D
  ------------------
  |  Branch (348:9): [True: 602, False: 339]
  ------------------
  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|    602|        word_swap =  _dwarf_memcpy_swap_bytes;
  357|    602|#endif /* LITTLE- BIG-ENDIAN */
  358|    602|        locendian = DW_END_big;
  ------------------
  |  | 1114|    602|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  359|    602|    } else if (dos_sig == IMAGE_DOS_REVSIGNATURE_dw) {
  ------------------
  |  |  192|    339|#define IMAGE_DOS_REVSIGNATURE_dw   0x4D5A
  ------------------
  |  Branch (359:16): [True: 287, False: 52]
  ------------------
  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|    287|        word_swap = _dwarf_memcpy_noswap_bytes;
  366|    287|#endif /* LITTLE- BIG-ENDIAN */
  367|    287|        locendian = DW_END_little;
  ------------------
  |  | 1115|    287|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  368|    287|    } else {
  369|       |        /* Not dos header not a PE file we recognize */
  370|     52|        *errcode = DW_DLE_FILE_WRONG_TYPE;
  ------------------
  |  | 1458|     52|#define DW_DLE_FILE_WRONG_TYPE                 412
  ------------------
  371|     52|        return DW_DLV_ERROR;
  ------------------
  |  |   65|     52|#define DW_DLV_ERROR     1
  ------------------
  372|     52|    }
  373|    889|    ASNAR(word_swap,nt_address, dhinmem.dh_image_offset);
  ------------------
  |  |   53|    889|    do {                                        \
  |  |   54|    889|        (t) = 0;                                \
  |  |   55|    889|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    889|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 889]
  |  |  ------------------
  ------------------
  374|    889|    if (filesize < nt_address) {
  ------------------
  |  Branch (374:9): [True: 27, False: 862]
  ------------------
  375|       |        /* Not dos header not a PE file we recognize */
  376|     27|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     27|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  377|     27|        return DW_DLV_ERROR;
  ------------------
  |  |   65|     27|#define DW_DLV_ERROR     1
  ------------------
  378|     27|    }
  379|    862|    if (filesize < (nt_address + SIZEOFT32 +
  ------------------
  |  |   61|    862|#define SIZEOFT32 4
  ------------------
  |  Branch (379:9): [True: 4, False: 858]
  ------------------
  380|    862|        sizeof(struct pe_image_file_header))) {
  381|      4|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|      4|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  382|       |        /* Not dos header not a PE file we recognize */
  383|      4|        return DW_DLV_ERROR;
  ------------------
  |  |   65|      4|#define DW_DLV_ERROR     1
  ------------------
  384|      4|    }
  385|    858|    res =  _dwarf_object_read_random(fd,(char *)&nt_sig_array[0],
  386|    858|        nt_address, sizeof(nt_sig_array),filesize,errcode);
  387|    858|    if (res != DW_DLV_OK) {
  ------------------
  |  |   64|    858|#define DW_DLV_OK        0
  ------------------
  |  Branch (387:9): [True: 0, False: 858]
  ------------------
  388|      0|        return res;
  389|      0|    }
  390|    858|    {   unsigned long lsig = 0;
  391|       |
  392|    858|        ASNAR(word_swap,lsig,nt_sig_array);
  ------------------
  |  |   53|    858|    do {                                        \
  |  |   54|    858|        (t) = 0;                                \
  |  |   55|    858|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    858|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 858]
  |  |  ------------------
  ------------------
  393|    858|        nt_sig = lsig;
  394|    858|    }
  395|    858|    if (nt_sig != IMAGE_NT_SIGNATURE_dw) {
  ------------------
  |  |  193|    858|#define IMAGE_NT_SIGNATURE_dw       0x00004550
  ------------------
  |  Branch (395:9): [True: 55, False: 803]
  ------------------
  396|     55|        *errcode = DW_DLE_FILE_WRONG_TYPE;
  ------------------
  |  | 1458|     55|#define DW_DLE_FILE_WRONG_TYPE                 412
  ------------------
  397|     55|        return DW_DLV_ERROR;
  ------------------
  |  |   65|     55|#define DW_DLV_ERROR     1
  ------------------
  398|     55|    }
  399|    803|    res = _dwarf_object_read_random(fd,(char *)&ifh,
  400|    803|        nt_address + SIZEOFT32,
  ------------------
  |  |   61|    803|#define SIZEOFT32 4
  ------------------
  401|    803|        sizeof(struct pe_image_file_header),
  402|    803|        filesize,
  403|    803|        errcode);
  404|    803|    if (res != DW_DLV_OK) {
  ------------------
  |  |   64|    803|#define DW_DLV_OK        0
  ------------------
  |  Branch (404:9): [True: 0, False: 803]
  ------------------
  405|      0|        return res;
  406|      0|    }
  407|    803|    {
  408|    803|        unsigned long machine = 0;
  409|       |
  410|    803|        ASNAR(word_swap,machine,ifh.im_machine);
  ------------------
  |  |   53|    803|    do {                                        \
  |  |   54|    803|        (t) = 0;                                \
  |  |   55|    803|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    803|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 803]
  |  |  ------------------
  ------------------
  411|    803|        switch(machine) {
  412|    592|        case IMAGE_FILE_MACHINE_I386_dw:
  ------------------
  |  |  194|    592|#define IMAGE_FILE_MACHINE_I386_dw  0x14c
  ------------------
  |  Branch (412:9): [True: 592, False: 211]
  ------------------
  413|    592|            *offsetsize = 32;
  414|    592|            *endian = locendian;
  415|    592|            return DW_DLV_OK;
  ------------------
  |  |   64|    592|#define DW_DLV_OK        0
  ------------------
  416|     25|        case IMAGE_FILE_MACHINE_IA64_dw:
  ------------------
  |  |  195|     25|#define IMAGE_FILE_MACHINE_IA64_dw  0x200
  ------------------
  |  Branch (416:9): [True: 25, False: 778]
  ------------------
  417|    146|        case IMAGE_FILE_MACHINE_AMD64_dw:
  ------------------
  |  |  196|    146|#define IMAGE_FILE_MACHINE_AMD64_dw 0x8664
  ------------------
  |  Branch (417:9): [True: 121, False: 682]
  ------------------
  418|    146|            *offsetsize = 64;
  419|    146|            *endian = locendian;
  420|    146|            return DW_DLV_OK;
  ------------------
  |  |   64|    146|#define DW_DLV_OK        0
  ------------------
  421|     65|        default: break;
  ------------------
  |  Branch (421:9): [True: 65, False: 738]
  ------------------
  422|    803|        }
  423|    803|    }
  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|    803|}

_dwarf_object_read_random:
   56|  1.59M|{
   57|  1.59M|    Dwarf_Unsigned endpoint = 0;
   58|  1.59M|    int res = 0;
   59|       |
   60|  1.59M|    if (loc >= filesize) {
  ------------------
  |  Branch (60:9): [True: 107, False: 1.59M]
  ------------------
   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.59M|    endpoint = loc+size;
   67|  1.59M|    if (endpoint < loc) {
  ------------------
  |  Branch (67:9): [True: 0, False: 1.59M]
  ------------------
   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.59M|    if (endpoint > filesize) {
  ------------------
  |  Branch (72:9): [True: 43, False: 1.59M]
  ------------------
   73|       |        /*  Let us -not- try to read past end of object.
   74|       |            The object is corrupt. */
   75|     43|        *errc = DW_DLE_READ_OFF_END;
  ------------------
  |  | 1491|     43|#define DW_DLE_READ_OFF_END                    445
  ------------------
   76|     43|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     43|#define DW_DLV_ERROR     1
  ------------------
   77|     43|    }
   78|  1.59M|    res = _dwarf_seekr(fd,loc,SEEK_SET,0);
   79|  1.59M|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|  1.59M|#define DW_DLV_OK        0
  ------------------
  |  Branch (79:9): [True: 0, False: 1.59M]
  ------------------
   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.59M|    res = _dwarf_readr(fd,out_buf,size,0);
   84|  1.59M|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|  1.59M|#define DW_DLV_OK        0
  ------------------
  |  Branch (84:9): [True: 0, False: 1.59M]
  ------------------
   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.59M|    return DW_DLV_OK;
  ------------------
  |  |  122|  1.59M|#define DW_DLV_OK        0
  ------------------
   89|  1.59M|}

_dwarf_pe_setup:
  838|    738|{
  839|    738|    Dwarf_Obj_Access_Interface_a *binary_interface = 0;
  840|    738|    dwarf_pe_object_access_internals_t *pep = 0;
  841|    738|    int res = DW_DLV_OK;
  ------------------
  |  |   59|    738|#define DW_DLV_OK         0
  ------------------
  842|    738|    int localerrnum = 0;
  843|       |
  844|    738|    res = _dwarf_pe_object_access_init(
  845|    738|        fd,
  846|    738|        ftype,endian,offsetsize,filesize,
  847|    738|        &binary_interface,
  848|    738|        &localerrnum);
  849|    738|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    738|#define DW_DLV_OK         0
  ------------------
  |  Branch (849:9): [True: 472, False: 266]
  ------------------
  850|    472|        if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |   58|    472|#define DW_DLV_NO_ENTRY  -1
  ------------------
  |  Branch (850:13): [True: 0, False: 472]
  ------------------
  851|      0|            return res;
  852|      0|        }
  853|    472|        _dwarf_error(NULL, error, localerrnum);
  854|    472|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    472|#define DW_DLV_ERROR      1
  ------------------
  855|    472|    }
  856|       |    /*  allocates and initializes Dwarf_Debug,
  857|       |        generic code */
  858|    266|    res = dwarf_object_init_b(binary_interface, errhand, errarg,
  859|    266|        groupnumber, dbg, error);
  860|    266|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|    266|#define DW_DLV_OK         0
  ------------------
  |  Branch (860:9): [True: 69, False: 197]
  ------------------
  861|     69|        _dwarf_destruct_pe_access(binary_interface);
  862|     69|        return res;
  863|     69|    }
  864|    197|    pep = binary_interface->ai_object;
  865|    197|    (*dbg)->de_obj_flags = pep->pe_flags;
  866|    197|    (*dbg)->de_obj_machine = pep->pe_machine;
  867|    197|    pep->pe_path = strdup(true_path);
  868|    197|    return res;
  869|    266|}
dwarf_peread.c:_dwarf_destruct_pe_access:
  431|    738|{
  432|    738|    struct Dwarf_Obj_Access_Interface_a_s * aip =
  433|    738|        (struct Dwarf_Obj_Access_Interface_a_s * )obj;
  434|    738|    dwarf_pe_object_access_internals_t *pep = 0;
  435|    738|    Dwarf_Unsigned i = 0;
  436|       |
  437|    738|    if (!aip) {
  ------------------
  |  Branch (437:9): [True: 0, False: 738]
  ------------------
  438|      0|        return;
  439|      0|    }
  440|    738|    pep = (dwarf_pe_object_access_internals_t*)(aip->ai_object);
  441|    738|    if (pep->pe_destruct_close_fd && pep->pe_fd !=-1) {
  ------------------
  |  Branch (441:9): [True: 0, False: 738]
  |  Branch (441:38): [True: 0, False: 0]
  ------------------
  442|      0|        _dwarf_closer(pep->pe_fd);
  443|      0|        pep->pe_fd = -1;
  444|      0|    }
  445|    738|    free((char *)pep->pe_path);
  446|    738|    pep->pe_path = 0;
  447|    738|    if (pep->pe_sectionptr) {
  ------------------
  |  Branch (447:9): [True: 494, False: 244]
  ------------------
  448|    494|        struct dwarf_pe_generic_image_section_header  *sp = 0;
  449|       |
  450|    494|        sp = pep->pe_sectionptr;
  451|   103k|        for (i=0; i < pep->pe_section_count; ++i,++sp) {
  ------------------
  |  Branch (451:19): [True: 103k, False: 494]
  ------------------
  452|   103k|            if (sp->loaded_data) {
  ------------------
  |  Branch (452:17): [True: 107, False: 103k]
  ------------------
  453|    107|                free(sp->loaded_data);
  454|    107|                sp->loaded_data = 0;
  455|    107|            }
  456|   103k|            free(sp->name);
  457|   103k|            sp->name = 0;
  458|   103k|            free(sp->dwarfsectname);
  459|   103k|            sp->dwarfsectname = 0;
  460|   103k|        }
  461|    494|        free(pep->pe_sectionptr);
  462|    494|        pep->pe_section_count = 0;
  463|    494|    }
  464|    738|    free(pep->pe_string_table);
  465|    738|    pep->pe_string_table = 0;
  466|    738|    free(pep);
  467|    738|    free(aip);
  468|    738|    return;
  469|    738|}
dwarf_peread.c:_dwarf_pe_object_access_init:
  958|    738|{
  959|       |
  960|    738|    int res = 0;
  961|    738|    dwarf_pe_object_access_internals_t *internals = 0;
  962|    738|    Dwarf_Obj_Access_Interface_a *intfc = 0;
  963|       |
  964|    738|    internals = malloc(sizeof(dwarf_pe_object_access_internals_t));
  965|    738|    if (!internals) {
  ------------------
  |  Branch (965:9): [True: 0, False: 738]
  ------------------
  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|    738|    memset(internals,0,sizeof(*internals));
  971|    738|    res = _dwarf_pe_object_access_internals_init(internals,
  972|    738|        fd,
  973|    738|        ftype, endian, offsetsize, filesize,
  974|    738|        localerrnum);
  975|    738|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|    738|#define DW_DLV_OK         0
  ------------------
  |  Branch (975:9): [True: 472, False: 266]
  ------------------
  976|       |        /* *err is already set. and the call freed internals */
  977|    472|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    472|#define DW_DLV_ERROR      1
  ------------------
  978|    472|    }
  979|       |
  980|    266|    intfc = malloc(sizeof(Dwarf_Obj_Access_Interface_a));
  981|    266|    if (!intfc) {
  ------------------
  |  Branch (981:9): [True: 0, False: 266]
  ------------------
  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|    266|    intfc->ai_object = internals;
  989|    266|    intfc->ai_methods = &pe_methods;
  990|    266|    *binary_interface = intfc;
  991|    266|    return DW_DLV_OK;
  ------------------
  |  |   59|    266|#define DW_DLV_OK         0
  ------------------
  992|    266|}
dwarf_peread.c:_dwarf_pe_object_access_internals_init:
  894|    738|{
  895|    738|    dwarf_pe_object_access_internals_t * intfc = internals;
  896|    738|    struct Dwarf_Obj_Access_Interface_a_s *localdoas = 0;
  897|    738|    int res = 0;
  898|       |
  899|       |    /*  Must malloc as _dwarf_destruct_pe_access()
  900|       |        forces that due to other uses. */
  901|    738|    localdoas = (struct Dwarf_Obj_Access_Interface_a_s *)
  902|    738|        malloc(sizeof(struct Dwarf_Obj_Access_Interface_a_s));
  903|    738|    if (!localdoas) {
  ------------------
  |  Branch (903:9): [True: 0, False: 738]
  ------------------
  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|    738|    memset(localdoas,0,sizeof(struct Dwarf_Obj_Access_Interface_a_s));
  909|    738|    intfc->pe_ident[0]    = 'P';
  910|    738|    intfc->pe_ident[1]    = '1';
  911|    738|    intfc->pe_fd          = fd;
  912|    738|    intfc->pe_is_64bit    = ((offsetsize==64)?TRUE:FALSE);
  ------------------
  |  |   33|    146|#define TRUE 1
  ------------------
                  intfc->pe_is_64bit    = ((offsetsize==64)?TRUE:FALSE);
  ------------------
  |  |   36|    592|#define FALSE 0
  ------------------
  |  Branch (912:30): [True: 146, False: 592]
  ------------------
  913|    738|    intfc->pe_offsetsize  = offsetsize;
  914|    738|    intfc->pe_pointersize = offsetsize;
  915|    738|    intfc->pe_filesize    = filesize;
  916|    738|    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|    738|    if (endian == DW_END_little) {
  ------------------
  |  | 1115|    738|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  |  Branch (928:9): [True: 219, False: 519]
  ------------------
  929|    219|        intfc->pe_copy_word = _dwarf_memcpy_noswap_bytes;
  930|    219|        intfc->pe_endian = DW_END_little;
  ------------------
  |  | 1115|    219|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  931|    519|    } else {
  932|    519|        intfc->pe_copy_word = _dwarf_memcpy_swap_bytes;
  933|    519|        intfc->pe_endian = DW_END_big;
  ------------------
  |  | 1114|    519|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  934|    519|    }
  935|    738|#endif /* LITTLE- BIG-ENDIAN */
  936|    738|    res = _dwarf_load_pe_sections(intfc,errcode);
  937|    738|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    738|#define DW_DLV_OK         0
  ------------------
  |  Branch (937:9): [True: 472, False: 266]
  ------------------
  938|    472|        localdoas->ai_object = intfc;
  939|    472|        localdoas->ai_methods = 0;
  940|    472|        _dwarf_destruct_pe_access(localdoas);
  941|    472|        localdoas = 0;
  942|    472|        return res;
  943|    472|    }
  944|    266|    free(localdoas);
  945|    266|    localdoas = 0;
  946|    266|    return DW_DLV_OK;
  ------------------
  |  |   59|    266|#define DW_DLV_OK         0
  ------------------
  947|    738|}
dwarf_peread.c:_dwarf_load_pe_sections:
  619|    738|{
  620|    738|    struct dos_header_dw dhinmem;
  621|    738|    IMAGE_FILE_HEADER_dw ifh;
  622|    738|    void (*word_swap) (void *, const void *, unsigned long);
  623|    738|    unsigned locendian = 0;
  624|    738|    int res = 0;
  625|    738|    Dwarf_Unsigned dos_sig = 0;
  626|    738|    Dwarf_Unsigned nt_address = 0;
  627|    738|    char nt_sig_array[4];
  628|    738|    unsigned long nt_signature = 0;
  629|       |
  630|    738|    if ( (sizeof(ifh) + sizeof(dhinmem))  >= pep->pe_filesize) {
  ------------------
  |  Branch (630:10): [True: 0, False: 738]
  ------------------
  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|    738|    res = _dwarf_object_read_random(pep->pe_fd,(char *)&dhinmem,
  636|    738|        0, sizeof(dhinmem),pep->pe_filesize, errcode);
  637|    738|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    738|#define DW_DLV_OK         0
  ------------------
  |  Branch (637:9): [True: 0, False: 738]
  ------------------
  638|      0|        return res;
  639|      0|    }
  640|    738|    dos_sig = magic_copy((char *)dhinmem.dh_mz,
  641|    738|        sizeof(dhinmem.dh_mz));
  642|    738|    if (dos_sig == IMAGE_DOS_SIGNATURE_dw) {
  ------------------
  |  |   38|    738|#define IMAGE_DOS_SIGNATURE_dw    0x5a4d /* le on disk 'M' 'Z' */
  ------------------
  |  Branch (642:9): [True: 519, False: 219]
  ------------------
  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|    519|        word_swap = _dwarf_memcpy_swap_bytes;
  651|    519|#endif /* LITTLE- BIG-ENDIAN */
  652|    519|        locendian = DW_END_big;
  ------------------
  |  | 1114|    519|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
  653|    519|    } else if (dos_sig == IMAGE_DOS_REVSIGNATURE_dw) {
  ------------------
  |  |   39|    219|#define IMAGE_DOS_REVSIGNATURE_dw 0x4d5a /* be on disk */
  ------------------
  |  Branch (653:16): [True: 219, 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|    219|        word_swap = _dwarf_memcpy_noswap_bytes;
  660|    219|#endif /* LITTLE- BIG-ENDIAN */
  661|    219|        locendian = DW_END_little;
  ------------------
  |  | 1115|    219|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  662|    219|    } 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|    738|    if (locendian != pep->pe_endian) {
  ------------------
  |  Branch (667:9): [True: 0, False: 738]
  ------------------
  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|    738|    pep->pe_copy_word = word_swap;
  674|    738|    ASNAR(word_swap,nt_address,dhinmem.dh_image_offset);
  ------------------
  |  |   53|    738|    do {                                        \
  |  |   54|    738|        (t) = 0;                                \
  |  |   55|    738|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    738|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 738]
  |  |  ------------------
  ------------------
  675|    738|    if (pep->pe_filesize < (nt_address + sizeof(nt_sig_array))) {
  ------------------
  |  Branch (675:9): [True: 0, False: 738]
  ------------------
  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|    738|    res =  _dwarf_object_read_random(pep->pe_fd,
  683|    738|        (char *)&nt_sig_array[0],
  684|    738|        nt_address, sizeof(nt_sig_array),
  685|    738|        pep->pe_filesize,errcode);
  686|    738|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    738|#define DW_DLV_OK         0
  ------------------
  |  Branch (686:9): [True: 0, False: 738]
  ------------------
  687|      0|        return res;
  688|      0|    }
  689|    738|    {   unsigned long lsig = 0;
  690|       |
  691|    738|        ASNAR(word_swap,lsig,nt_sig_array);
  ------------------
  |  |   53|    738|    do {                                        \
  |  |   54|    738|        (t) = 0;                                \
  |  |   55|    738|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    738|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 738]
  |  |  ------------------
  ------------------
  692|    738|        nt_signature = lsig;
  693|    738|    }
  694|    738|    if (nt_signature != IMAGE_NT_SIGNATURE_dw) {
  ------------------
  |  |   40|    738|#define IMAGE_NT_SIGNATURE_dw     0x00004550
  ------------------
  |  Branch (694:9): [True: 0, False: 738]
  ------------------
  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|    738|    pep->pe_nt_header_offset = nt_address  + SIZEOFT32;
  ------------------
  |  |   41|    738|#define SIZEOFT32 4
  ------------------
  700|    738|    if (pep->pe_filesize < (pep->pe_nt_header_offset +
  ------------------
  |  Branch (700:9): [True: 0, False: 738]
  ------------------
  701|    738|        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|    738|    res = _dwarf_object_read_random(pep->pe_fd,(char *)&ifh,
  707|    738|        pep->pe_nt_header_offset, sizeof(ifh),
  708|    738|        pep->pe_filesize,errcode);
  709|    738|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    738|#define DW_DLV_OK         0
  ------------------
  |  Branch (709:9): [True: 0, False: 738]
  ------------------
  710|      0|        return res;
  711|      0|    }
  712|    738|    ASNAR(word_swap,pep->pe_FileHeader.Machine,ifh.Machine);
  ------------------
  |  |   53|    738|    do {                                        \
  |  |   54|    738|        (t) = 0;                                \
  |  |   55|    738|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    738|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 738]
  |  |  ------------------
  ------------------
  713|    738|    ASNAR(word_swap,pep->pe_FileHeader.NumberOfSections,
  ------------------
  |  |   53|    738|    do {                                        \
  |  |   54|    738|        (t) = 0;                                \
  |  |   55|    738|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    738|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 738]
  |  |  ------------------
  ------------------
  714|    738|        ifh.NumberOfSections);
  715|    738|    ASNAR(word_swap,pep->pe_FileHeader.TimeDateStamp,
  ------------------
  |  |   53|    738|    do {                                        \
  |  |   54|    738|        (t) = 0;                                \
  |  |   55|    738|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    738|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 738]
  |  |  ------------------
  ------------------
  716|    738|        ifh.TimeDateStamp);
  717|    738|    ASNAR(word_swap,pep->pe_FileHeader.PointerToSymbolTable,
  ------------------
  |  |   53|    738|    do {                                        \
  |  |   54|    738|        (t) = 0;                                \
  |  |   55|    738|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    738|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 738]
  |  |  ------------------
  ------------------
  718|    738|        ifh.PointerToSymbolTable);
  719|    738|    ASNAR(word_swap,pep->pe_FileHeader.NumberOfSymbols,
  ------------------
  |  |   53|    738|    do {                                        \
  |  |   54|    738|        (t) = 0;                                \
  |  |   55|    738|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    738|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 738]
  |  |  ------------------
  ------------------
  720|    738|        ifh.NumberOfSymbols);
  721|    738|    ASNAR(word_swap,pep->pe_FileHeader.SizeOfOptionalHeader,
  ------------------
  |  |   53|    738|    do {                                        \
  |  |   54|    738|        (t) = 0;                                \
  |  |   55|    738|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    738|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 738]
  |  |  ------------------
  ------------------
  722|    738|        ifh.SizeOfOptionalHeader);
  723|    738|    ASNAR(word_swap,pep->pe_FileHeader.Characteristics,
  ------------------
  |  |   53|    738|    do {                                        \
  |  |   54|    738|        (t) = 0;                                \
  |  |   55|    738|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    738|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 738]
  |  |  ------------------
  ------------------
  724|    738|        ifh.Characteristics);
  725|    738|    pep->pe_machine = pep->pe_FileHeader.Machine;
  726|    738|    pep->pe_flags = pep->pe_FileHeader.Characteristics;
  727|    738|    pep->pe_optional_header_offset = pep->pe_nt_header_offset+
  728|    738|        sizeof(ifh);
  729|    738|    if (pep->pe_offsetsize == 32) {
  ------------------
  |  Branch (729:9): [True: 592, False: 146]
  ------------------
  730|    592|        res = load_optional_header32(pep,
  731|    592|            pep->pe_optional_header_offset,errcode);
  732|    592|        pep->pe_optional_header_size =
  733|    592|            sizeof(IMAGE_OPTIONAL_HEADER32_dw);
  734|    592|    } else if (pep->pe_offsetsize == 64) {
  ------------------
  |  Branch (734:16): [True: 146, False: 0]
  ------------------
  735|    146|        res = load_optional_header64(pep,
  736|    146|            pep->pe_optional_header_offset,errcode);
  737|    146|        pep->pe_optional_header_size =
  738|    146|            sizeof(IMAGE_OPTIONAL_HEADER64_dw);
  739|    146|    } 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|    738|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    738|#define DW_DLV_OK         0
  ------------------
  |  Branch (743:9): [True: 33, False: 705]
  ------------------
  744|     33|        return res;
  745|     33|    }
  746|       |
  747|    705|    pep->pe_section_table_offset = pep->pe_optional_header_offset
  748|    705|        + pep->pe_optional_header_size;
  749|    705|    pep->pe_symbol_table_offset =
  750|    705|        pep->pe_FileHeader.PointerToSymbolTable;
  751|    705|    if (pep->pe_symbol_table_offset >= pep->pe_filesize) {
  ------------------
  |  Branch (751:9): [True: 51, False: 654]
  ------------------
  752|     51|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|     51|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
  753|     51|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     51|#define DW_DLV_ERROR      1
  ------------------
  754|     51|    }
  755|    654|    if (pep->pe_symbol_table_offset) {
  ------------------
  |  Branch (755:9): [True: 578, False: 76]
  ------------------
  756|    578|        pep->pe_string_table_offset  =
  757|    578|            pep->pe_symbol_table_offset +
  758|    578|            (pep->pe_FileHeader.NumberOfSymbols *
  759|    578|            IMAGE_SIZEOF_SYMBOL);
  ------------------
  |  |   53|    578|#define IMAGE_SIZEOF_SYMBOL 18
  ------------------
  760|    578|    }
  761|       |
  762|    654|    if (pep->pe_string_table_offset >= pep->pe_filesize) {
  ------------------
  |  Branch (762:9): [True: 57, False: 597]
  ------------------
  763|     57|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|     57|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
  764|     57|        pep->pe_string_table_size = 0;
  765|     57|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     57|#define DW_DLV_ERROR      1
  ------------------
  766|     57|    }
  767|    597|    if (pep->pe_string_table_offset) {
  ------------------
  |  Branch (767:9): [True: 521, False: 76]
  ------------------
  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|    521|        char size_field[4];
  773|       |
  774|    521|        if ((pep->pe_string_table_offset+sizeof(size_field)) >
  ------------------
  |  Branch (774:13): [True: 9, False: 512]
  ------------------
  775|    521|            pep->pe_filesize) {
  776|      9|            *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|      9|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  777|      9|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      9|#define DW_DLV_ERROR      1
  ------------------
  778|      9|        }
  779|    512|        memset(size_field,0,sizeof(size_field));
  780|    512|        res =  _dwarf_object_read_random(pep->pe_fd,
  781|    512|            (char *)size_field, pep->pe_string_table_offset,
  782|    512|            sizeof(size_field),
  783|    512|            pep->pe_filesize,errcode);
  784|    512|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    512|#define DW_DLV_OK         0
  ------------------
  |  Branch (784:13): [True: 0, False: 512]
  ------------------
  785|      0|            return res;
  786|      0|        }
  787|    512|        ASNAR(pep->pe_copy_word,pep->pe_string_table_size,
  ------------------
  |  |   53|    512|    do {                                        \
  |  |   54|    512|        (t) = 0;                                \
  |  |   55|    512|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    512|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 512]
  |  |  ------------------
  ------------------
  788|    512|            size_field);
  789|    512|        if (pep->pe_string_table_size >= pep->pe_filesize ) {
  ------------------
  |  Branch (789:13): [True: 65, False: 447]
  ------------------
  790|     65|            *errcode = DW_DLE_PE_OFFSET_BAD;
  ------------------
  |  | 1473|     65|#define DW_DLE_PE_OFFSET_BAD                   427
  ------------------
  791|     65|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     65|#define DW_DLV_ERROR      1
  ------------------
  792|     65|        }
  793|    447|        if ((pep->pe_string_table_offset+pep->pe_string_table_size) >
  ------------------
  |  Branch (793:13): [True: 6, False: 441]
  ------------------
  794|    447|            pep->pe_filesize) {
  795|      6|            *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|      6|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  796|      6|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      6|#define DW_DLV_ERROR      1
  ------------------
  797|      6|        }
  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|    441|        pep->pe_string_table =
  805|    441|            (char *)calloc(1,(size_t)pep->pe_string_table_size+1);
  806|    441|        if (!pep->pe_string_table) {
  ------------------
  |  Branch (806:13): [True: 0, False: 441]
  ------------------
  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|    441|        res = _dwarf_object_read_random(pep->pe_fd,
  811|    441|            (char *)pep->pe_string_table,
  812|    441|            pep->pe_string_table_offset,
  813|    441|            (size_t)pep->pe_string_table_size,
  814|    441|            pep->pe_filesize,errcode);
  815|    441|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    441|#define DW_DLV_OK         0
  ------------------
  |  Branch (815:13): [True: 0, False: 441]
  ------------------
  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|    441|        pep->pe_string_table[pep->pe_string_table_size] = 0;
  822|    441|    }
  823|    517|    res = _dwarf_pe_load_dwarf_section_headers(pep,errcode);
  824|    517|    return res;
  825|    597|}
dwarf_peread.c:magic_copy:
   84|    738|{
   85|    738|    unsigned i = 0;
   86|    738|    unsigned long v = 0;
   87|       |
   88|    738|    v = d[0];
   89|  1.47k|    for (i = 1 ; i < len; ++i) {
  ------------------
  |  Branch (89:18): [True: 738, False: 738]
  ------------------
   90|    738|        v <<= 8;
   91|    738|        v |=  0xff&d[i];
   92|    738|    }
   93|    738|    return v;
   94|    738|}
dwarf_peread.c:load_optional_header32:
  234|    592|{
  235|    592|    int res = 0;
  236|    592|    IMAGE_OPTIONAL_HEADER32_dw hdr;
  237|       |
  238|    592|    pep->pe_optional_header_size = sizeof(IMAGE_OPTIONAL_HEADER32_dw);
  239|       |
  240|    592|    if ((pep->pe_optional_header_size + offset) >
  ------------------
  |  Branch (240:9): [True: 20, False: 572]
  ------------------
  241|    592|        pep->pe_filesize) {
  242|     20|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     20|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  243|     20|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     20|#define DW_DLV_ERROR      1
  ------------------
  244|     20|    }
  245|       |
  246|    572|    res =  _dwarf_object_read_random(pep->pe_fd,
  247|    572|        (char *)&hdr,
  248|    572|        offset, sizeof(IMAGE_OPTIONAL_HEADER32_dw),
  249|    572|        pep->pe_filesize,
  250|    572|        errcode);
  251|    572|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    572|#define DW_DLV_OK         0
  ------------------
  |  Branch (251:9): [True: 0, False: 572]
  ------------------
  252|      0|        return res;
  253|      0|    }
  254|       |
  255|       |    /* This is a subset of fields. */
  256|    572|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.Magic,
  ------------------
  |  |   53|    572|    do {                                        \
  |  |   54|    572|        (t) = 0;                                \
  |  |   55|    572|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    572|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 572]
  |  |  ------------------
  ------------------
  257|    572|        hdr.Magic);
  258|    572|    pep->pe_OptionalHeader.MajorLinkerVersion= hdr.MajorLinkerVersion;
  259|    572|    pep->pe_OptionalHeader.MinorLinkerVersion= hdr.MinorLinkerVersion;
  260|    572|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.ImageBase,
  ------------------
  |  |   53|    572|    do {                                        \
  |  |   54|    572|        (t) = 0;                                \
  |  |   55|    572|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    572|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 572]
  |  |  ------------------
  ------------------
  261|    572|        hdr.ImageBase);
  262|    572|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.SizeOfCode,
  ------------------
  |  |   53|    572|    do {                                        \
  |  |   54|    572|        (t) = 0;                                \
  |  |   55|    572|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    572|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 572]
  |  |  ------------------
  ------------------
  263|    572|        hdr.SizeOfCode);
  264|    572|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.SizeOfImage,
  ------------------
  |  |   53|    572|    do {                                        \
  |  |   54|    572|        (t) = 0;                                \
  |  |   55|    572|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    572|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 572]
  |  |  ------------------
  ------------------
  265|    572|        hdr.SizeOfImage);
  266|    572|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.SizeOfHeaders,
  ------------------
  |  |   53|    572|    do {                                        \
  |  |   54|    572|        (t) = 0;                                \
  |  |   55|    572|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    572|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 572]
  |  |  ------------------
  ------------------
  267|    572|        hdr.SizeOfHeaders);
  268|    572|    pep->pe_OptionalHeader.SizeOfDataDirEntry =
  269|    572|        sizeof(IMAGE_DATA_DIRECTORY_dw);
  270|    572|    return DW_DLV_OK;
  ------------------
  |  |   59|    572|#define DW_DLV_OK         0
  ------------------
  271|    572|}
dwarf_peread.c:load_optional_header64:
  275|    146|{
  276|    146|    IMAGE_OPTIONAL_HEADER64_dw hdr;
  277|    146|    int res = 0;
  278|       |
  279|    146|    pep->pe_optional_header_size = sizeof(IMAGE_OPTIONAL_HEADER64_dw);
  280|    146|    if ((pep->pe_optional_header_size + offset) >
  ------------------
  |  Branch (280:9): [True: 13, False: 133]
  ------------------
  281|    146|        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|    133|    res =  _dwarf_object_read_random(pep->pe_fd,
  286|    133|        (char *)&hdr,
  287|    133|        offset, sizeof(IMAGE_OPTIONAL_HEADER64_dw),
  288|    133|        pep->pe_filesize,
  289|    133|        errcode);
  290|    133|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    133|#define DW_DLV_OK         0
  ------------------
  |  Branch (290:9): [True: 0, False: 133]
  ------------------
  291|      0|        return res;
  292|      0|    }
  293|       |
  294|       |    /* This is a subset of fields. */
  295|    133|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.Magic,
  ------------------
  |  |   53|    133|    do {                                        \
  |  |   54|    133|        (t) = 0;                                \
  |  |   55|    133|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    133|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 133]
  |  |  ------------------
  ------------------
  296|    133|        hdr.Magic);
  297|    133|    pep->pe_OptionalHeader.MajorLinkerVersion= hdr.MajorLinkerVersion;
  298|    133|    pep->pe_OptionalHeader.MinorLinkerVersion= hdr.MinorLinkerVersion;
  299|    133|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.ImageBase,
  ------------------
  |  |   53|    133|    do {                                        \
  |  |   54|    133|        (t) = 0;                                \
  |  |   55|    133|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    133|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 133]
  |  |  ------------------
  ------------------
  300|    133|        hdr.ImageBase);
  301|    133|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.SizeOfCode,
  ------------------
  |  |   53|    133|    do {                                        \
  |  |   54|    133|        (t) = 0;                                \
  |  |   55|    133|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    133|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 133]
  |  |  ------------------
  ------------------
  302|    133|        hdr.SizeOfCode);
  303|    133|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.SizeOfImage,
  ------------------
  |  |   53|    133|    do {                                        \
  |  |   54|    133|        (t) = 0;                                \
  |  |   55|    133|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    133|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 133]
  |  |  ------------------
  ------------------
  304|    133|        hdr.SizeOfImage);
  305|    133|    ASNAR(pep->pe_copy_word,pep->pe_OptionalHeader.SizeOfHeaders,
  ------------------
  |  |   53|    133|    do {                                        \
  |  |   54|    133|        (t) = 0;                                \
  |  |   55|    133|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    133|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 133]
  |  |  ------------------
  ------------------
  306|    133|        hdr.SizeOfHeaders);
  307|    133|    pep->pe_OptionalHeader.SizeOfDataDirEntry =
  308|    133|        sizeof(IMAGE_DATA_DIRECTORY_dw);
  309|    133|    return DW_DLV_OK;
  ------------------
  |  |   59|    133|#define DW_DLV_OK         0
  ------------------
  310|    133|}
dwarf_peread.c:_dwarf_pe_load_dwarf_section_headers:
  474|    517|{
  475|    517|    Dwarf_Unsigned i = 0;
  476|    517|    Dwarf_Unsigned input_count =
  477|    517|        pep->pe_FileHeader.NumberOfSections;
  478|    517|    Dwarf_Unsigned offset_in_input = pep->pe_section_table_offset;
  479|    517|    Dwarf_Unsigned section_hdr_size = sizeof(IMAGE_SECTION_HEADER_dw);
  480|    517|    struct dwarf_pe_generic_image_section_header *sec_outp = 0;
  481|    517|    Dwarf_Unsigned cur_offset = offset_in_input;
  482|    517|    Dwarf_Unsigned past_end_hdrs = offset_in_input +
  483|    517|        section_hdr_size*input_count;
  484|       |
  485|       |    /* internal sections include null initial section */
  486|    517|    pep->pe_section_count = input_count+1;
  487|       |
  488|    517|    if (past_end_hdrs > pep->pe_filesize) {
  ------------------
  |  Branch (488:9): [True: 23, False: 494]
  ------------------
  489|     23|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     23|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  490|     23|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     23|#define DW_DLV_ERROR      1
  ------------------
  491|     23|    }
  492|       |
  493|    494|    if (!offset_in_input) {
  ------------------
  |  Branch (493:9): [True: 0, False: 494]
  ------------------
  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|    494|    pep->pe_sectionptr =
  498|    494|        (struct dwarf_pe_generic_image_section_header * )
  499|    494|        calloc((size_t)pep->pe_section_count,
  500|    494|        sizeof(struct dwarf_pe_generic_image_section_header));
  501|    494|    if (!pep->pe_sectionptr) {
  ------------------
  |  Branch (501:9): [True: 0, False: 494]
  ------------------
  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|    494|    sec_outp = pep->pe_sectionptr;
  506|    494|    sec_outp->name = strdup("");
  507|    494|    sec_outp->dwarfsectname = strdup("");
  508|    494|    sec_outp++;
  509|  26.1k|    for ( ;  i < input_count;
  ------------------
  |  Branch (509:14): [True: 25.8k, False: 266]
  ------------------
  510|  25.8k|        ++i, cur_offset += section_hdr_size, sec_outp++) {
  511|       |
  512|  25.8k|        int res = 0;
  513|  25.8k|        IMAGE_SECTION_HEADER_dw filesect;
  514|  25.8k|        char        safe_name[IMAGE_SIZEOF_SHORT_NAME +1];
  515|  25.8k|        const char *expname = 0;
  516|  25.8k|        int irrelevant = 0;
  517|       |
  518|  25.8k|        res =  _dwarf_object_read_random(pep->pe_fd,
  519|  25.8k|            (char *)&filesect,cur_offset,
  520|  25.8k|            sizeof(filesect),
  521|  25.8k|            pep->pe_filesize,
  522|  25.8k|            errcode);
  523|  25.8k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  25.8k|#define DW_DLV_OK         0
  ------------------
  |  Branch (523:13): [True: 0, False: 25.8k]
  ------------------
  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|  25.8k|        _dwarf_safe_strcpy(safe_name,
  530|  25.8k|            sizeof(safe_name),
  531|  25.8k|            filesect.Name,
  532|  25.8k|            IMAGE_SIZEOF_SHORT_NAME);
  ------------------
  |  |  193|  25.8k|#define IMAGE_SIZEOF_SHORT_NAME 8
  ------------------
  533|       |        /* Have NUL terminator now. */
  534|  25.8k|        sec_outp->name = strdup(safe_name);
  535|  25.8k|        res = pe_section_name_get(pep,
  536|  25.8k|            safe_name,(unsigned int)strlen(safe_name),
  537|  25.8k|            &expname,errcode);
  538|  25.8k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  25.8k|#define DW_DLV_OK         0
  ------------------
  |  Branch (538:13): [True: 13, False: 25.8k]
  ------------------
  539|     13|            return res;
  540|     13|        }
  541|  25.8k|        if (expname) {
  ------------------
  |  Branch (541:13): [True: 25.8k, False: 0]
  ------------------
  542|  25.8k|            sec_outp->dwarfsectname = strdup(expname);
  543|  25.8k|        } else {
  544|      0|            sec_outp->dwarfsectname = strdup("<sec name missing>");
  545|      0|        }
  546|  25.8k|        if ( !sec_outp->name || !sec_outp->dwarfsectname) {
  ------------------
  |  Branch (546:14): [True: 0, False: 25.8k]
  |  Branch (546:33): [True: 0, False: 25.8k]
  ------------------
  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|  25.8k|        sec_outp->SecHeaderOffset = cur_offset;
  551|  25.8k|        ASNAR(pep->pe_copy_word,sec_outp->VirtualSize,
  ------------------
  |  |   53|  25.8k|    do {                                        \
  |  |   54|  25.8k|        (t) = 0;                                \
  |  |   55|  25.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  25.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 25.8k]
  |  |  ------------------
  ------------------
  552|  25.8k|            filesect.Misc.VirtualSize);
  553|  25.8k|        ASNAR(pep->pe_copy_word,sec_outp->VirtualAddress,
  ------------------
  |  |   53|  25.8k|    do {                                        \
  |  |   54|  25.8k|        (t) = 0;                                \
  |  |   55|  25.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  25.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 25.8k]
  |  |  ------------------
  ------------------
  554|  25.8k|            filesect.VirtualAddress);
  555|  25.8k|        ASNAR(pep->pe_copy_word,sec_outp->SizeOfRawData,
  ------------------
  |  |   53|  25.8k|    do {                                        \
  |  |   54|  25.8k|        (t) = 0;                                \
  |  |   55|  25.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  25.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 25.8k]
  |  |  ------------------
  ------------------
  556|  25.8k|            filesect.SizeOfRawData);
  557|  25.8k|        irrelevant = is_irrelevant_section(sec_outp->dwarfsectname,
  558|  25.8k|            sec_outp->VirtualSize);
  559|  25.8k|        sec_outp->section_irrelevant_to_dwarf = irrelevant;
  560|  25.8k|        if (irrelevant) {
  ------------------
  |  Branch (560:13): [True: 20.9k, False: 4.89k]
  ------------------
  561|  20.9k|            continue;
  562|  20.9k|        }
  563|  4.89k|        {
  564|       |            /*  A Heuristic, allowing large virtual size
  565|       |                but not unlimited as we will malloc it
  566|       |                later, as Virtualsize. */
  567|  4.89k|            Dwarf_Unsigned limit = 100*pep->pe_filesize;
  568|  4.89k|            if (limit < pep->pe_filesize) {
  ------------------
  |  Branch (568:17): [True: 0, False: 4.89k]
  ------------------
  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.89k|            if (sec_outp->VirtualSize >
  ------------------
  |  Branch (573:17): [True: 35, False: 4.85k]
  ------------------
  574|  4.89k|                ((Dwarf_Unsigned)2000*
  575|  4.89k|                (Dwarf_Unsigned)1000*
  576|  4.89k|                (Dwarf_Unsigned)1000) &&
  577|     35|                (sec_outp->VirtualSize > pep->pe_filesize)) {
  ------------------
  |  Branch (577:17): [True: 35, 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|     35|                *errcode = DW_DLE_PE_SECTION_SIZE_HEURISTIC_FAIL;
  ------------------
  |  | 1550|     35|#define DW_DLE_PE_SECTION_SIZE_HEURISTIC_FAIL  504
  ------------------
  583|     35|                return DW_DLV_ERROR;
  ------------------
  |  |   60|     35|#define DW_DLV_ERROR      1
  ------------------
  584|     35|            }
  585|  4.85k|            if (sec_outp->VirtualSize > limit &&
  ------------------
  |  Branch (585:17): [True: 513, False: 4.34k]
  ------------------
  586|    513|                0 == pep->pe_is_64bit ) {
  ------------------
  |  Branch (586:17): [True: 59, False: 454]
  ------------------
  587|       |                /* Likely totally unreasonable. Bad. */
  588|     59|                *errcode = DW_DLE_PE_SECTION_SIZE_HEURISTIC_FAIL;
  ------------------
  |  | 1550|     59|#define DW_DLE_PE_SECTION_SIZE_HEURISTIC_FAIL  504
  ------------------
  589|     59|                return DW_DLV_ERROR;
  ------------------
  |  |   60|     59|#define DW_DLV_ERROR      1
  ------------------
  590|     59|            }
  591|  4.85k|        }
  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: 52, False: 4.74k]
  ------------------
  595|  4.74k|            sec_outp->PointerToRawData > pep->pe_filesize ||
  ------------------
  |  Branch (595:13): [True: 61, False: 4.68k]
  ------------------
  596|  4.68k|            (sec_outp->SizeOfRawData+
  ------------------
  |  Branch (596:13): [True: 8, False: 4.67k]
  ------------------
  597|  4.68k|                sec_outp->PointerToRawData > pep->pe_filesize)) {
  598|    121|            *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|    121|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  599|    121|            return DW_DLV_ERROR;
  ------------------
  |  |   60|    121|#define DW_DLV_ERROR      1
  ------------------
  600|    121|        }
  601|  4.67k|        ASNAR(pep->pe_copy_word,sec_outp->PointerToRelocations,
  ------------------
  |  |   53|  4.67k|    do {                                        \
  |  |   54|  4.67k|        (t) = 0;                                \
  |  |   55|  4.67k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.67k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.67k]
  |  |  ------------------
  ------------------
  602|  4.67k|            filesect.PointerToRelocations);
  603|  4.67k|        ASNAR(pep->pe_copy_word,sec_outp->PointerToLinenumbers,
  ------------------
  |  |   53|  4.67k|    do {                                        \
  |  |   54|  4.67k|        (t) = 0;                                \
  |  |   55|  4.67k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.67k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.67k]
  |  |  ------------------
  ------------------
  604|  4.67k|            filesect.PointerToLinenumbers);
  605|  4.67k|        ASNAR(pep->pe_copy_word,sec_outp->NumberOfRelocations,
  ------------------
  |  |   53|  4.67k|    do {                                        \
  |  |   54|  4.67k|        (t) = 0;                                \
  |  |   55|  4.67k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.67k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.67k]
  |  |  ------------------
  ------------------
  606|  4.67k|            filesect.NumberOfRelocations);
  607|  4.67k|        ASNAR(pep->pe_copy_word,sec_outp->NumberOfLinenumbers,
  ------------------
  |  |   53|  4.67k|    do {                                        \
  |  |   54|  4.67k|        (t) = 0;                                \
  |  |   55|  4.67k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.67k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.67k]
  |  |  ------------------
  ------------------
  608|  4.67k|            filesect.NumberOfLinenumbers);
  609|  4.67k|        ASNAR(pep->pe_copy_word,sec_outp->Characteristics,
  ------------------
  |  |   53|  4.67k|    do {                                        \
  |  |   54|  4.67k|        (t) = 0;                                \
  |  |   55|  4.67k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.67k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.67k]
  |  |  ------------------
  ------------------
  610|  4.67k|            filesect.Characteristics);
  611|       |        /* sec_outp->loaded data set when we load a section */
  612|  4.67k|    }
  613|    266|    return DW_DLV_OK;
  ------------------
  |  |   59|    266|#define DW_DLV_OK         0
  ------------------
  614|    494|}
dwarf_peread.c:pe_section_name_get:
  119|  25.8k|{
  120|  25.8k|    if (name_array[0] == '/') {
  ------------------
  |  Branch (120:9): [True: 1.54k, False: 24.3k]
  ------------------
  121|  1.54k|        long v = 0;
  122|  1.54k|        unsigned long u = 0;
  123|  1.54k|        const char *s = 0;
  124|  1.54k|        char temp_array[9];
  125|  1.54k|        int res = 0;
  126|       |
  127|       |        /*  The value is an integer after the /,
  128|       |            and we want the value */
  129|  1.54k|        _dwarf_safe_strcpy(temp_array,sizeof(temp_array),
  130|  1.54k|            name_array+1,size_name-1);
  131|  1.54k|        v = atoi(temp_array);
  132|  1.54k|        if (v < 0) {
  ------------------
  |  Branch (132:13): [True: 1, False: 1.54k]
  ------------------
  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.54k|        u = v;
  137|  1.54k|        if (!pep->pe_string_table) {
  ------------------
  |  Branch (137:13): [True: 1, False: 1.54k]
  ------------------
  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.54k|        if (u >= pep->pe_string_table_size) {
  ------------------
  |  Branch (141:13): [True: 7, False: 1.53k]
  ------------------
  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.53k|        res = check_valid_string(pep->pe_string_table,
  146|  1.53k|            pep->pe_string_table_size,u);
  147|  1.53k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.53k|#define DW_DLV_OK         0
  ------------------
  |  Branch (147:13): [True: 4, False: 1.53k]
  ------------------
  148|      4|            *errcode = DW_DLE_STRING_OFFSET_BAD;
  ------------------
  |  | 1098|      4|#define DW_DLE_STRING_OFFSET_BAD                53
  ------------------
  149|      4|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
  150|      4|        }
  151|  1.53k|        s = pep->pe_string_table +u;
  152|  1.53k|        *name_out = s;
  153|  1.53k|        return DW_DLV_OK;
  ------------------
  |  |   59|  1.53k|#define DW_DLV_OK         0
  ------------------
  154|  1.53k|    }
  155|  24.3k|    *name_out = name_array;
  156|  24.3k|    return DW_DLV_OK;
  ------------------
  |  |   59|  24.3k|#define DW_DLV_OK         0
  ------------------
  157|  25.8k|}
dwarf_peread.c:check_valid_string:
   99|  1.53k|{
  100|  1.53k|    Dwarf_Unsigned i = startindex;
  101|  18.0k|    for ( ; i < size; ++i) {
  ------------------
  |  Branch (101:13): [True: 18.0k, False: 4]
  ------------------
  102|  18.0k|        if (!tab[i]) {
  ------------------
  |  Branch (102:13): [True: 1.53k, False: 16.5k]
  ------------------
  103|  1.53k|            return DW_DLV_OK;
  ------------------
  |  |   59|  1.53k|#define DW_DLV_OK         0
  ------------------
  104|  1.53k|        }
  105|  18.0k|    }
  106|      4|    return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
  107|  1.53k|}
dwarf_peread.c:is_irrelevant_section:
  342|  25.8k|{
  343|  25.8k|    int res = FALSE;
  ------------------
  |  |   36|  25.8k|#define FALSE 0
  ------------------
  344|       |
  345|  25.8k|    res = in_name_list(name);
  346|  25.8k|    if (res) {
  ------------------
  |  Branch (346:9): [True: 522, False: 25.3k]
  ------------------
  347|    522|        return TRUE;
  ------------------
  |  |   33|    522|#define TRUE 1
  ------------------
  348|    522|    }
  349|  25.3k|    if (!virtsz) {
  ------------------
  |  Branch (349:9): [True: 20.4k, False: 4.89k]
  ------------------
  350|  20.4k|        return TRUE;
  ------------------
  |  |   33|  20.4k|#define TRUE 1
  ------------------
  351|  20.4k|    }
  352|  4.89k|    return FALSE;
  ------------------
  |  |   36|  4.89k|#define FALSE 0
  ------------------
  353|  25.3k|}
dwarf_peread.c:in_name_list:
  322|  25.8k|{
  323|  25.8k|    int i = 0;
  324|       |
  325|  25.8k|    if (!name) {
  ------------------
  |  Branch (325:9): [True: 0, False: 25.8k]
  ------------------
  326|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  327|      0|    }
  328|   128k|    for ( ; ; ++i) {
  329|   128k|        if (!boringname[i]) {
  ------------------
  |  Branch (329:13): [True: 25.3k, False: 102k]
  ------------------
  330|  25.3k|            break;
  331|  25.3k|        }
  332|   102k|        if (!strcmp(name,boringname[i])) {
  ------------------
  |  Branch (332:13): [True: 522, False: 102k]
  ------------------
  333|    522|            return TRUE;
  ------------------
  |  |   33|    522|#define TRUE 1
  ------------------
  334|    522|        }
  335|   102k|    }
  336|  25.3k|    return FALSE;
  ------------------
  |  |   36|  25.3k|#define FALSE 0
  ------------------
  337|  25.8k|}
dwarf_peread.c:pe_get_section_info:
  204|  42.8k|{
  205|  42.8k|    dwarf_pe_object_access_internals_t *pep =
  206|  42.8k|        (dwarf_pe_object_access_internals_t*)(obj);
  207|       |
  208|  42.8k|    (void)error;
  209|  42.8k|    if (section_index < pep->pe_section_count) {
  ------------------
  |  Branch (209:9): [True: 42.8k, False: 0]
  ------------------
  210|  42.8k|        struct dwarf_pe_generic_image_section_header *sp = 0;
  211|  42.8k|        sp = pep->pe_sectionptr + section_index;
  212|  42.8k|        return_section->as_name = sp->dwarfsectname;
  213|  42.8k|        return_section->as_type = 0;
  214|  42.8k|        return_section->as_flags = sp->Characteristics;
  215|  42.8k|        return_section->as_addr = pep->pe_OptionalHeader.ImageBase +
  216|  42.8k|            sp->VirtualAddress;
  217|  42.8k|        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|  42.8k|        return_section->as_size = sp->VirtualSize;
  222|  42.8k|        return_section->as_link = 0;
  223|  42.8k|        return_section->as_info = 0;
  224|  42.8k|        return_section->as_addralign = 0;
  225|  42.8k|        return_section->as_entrysize = 0;
  226|  42.8k|        return DW_DLV_OK;
  ------------------
  |  |   59|  42.8k|#define DW_DLV_OK         0
  ------------------
  227|  42.8k|    }
  228|      0|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  229|  42.8k|}
dwarf_peread.c:pe_get_byte_order:
  161|    266|{
  162|    266|    dwarf_pe_object_access_internals_t *pep =
  163|    266|        (dwarf_pe_object_access_internals_t*)(obj);
  164|    266|    return pep->pe_endian;
  165|    266|}
dwarf_peread.c:pe_get_length_size:
  169|    266|{
  170|    266|    dwarf_pe_object_access_internals_t *pep =
  171|    266|        (dwarf_pe_object_access_internals_t*)(obj);
  172|    266|    return pep->pe_offsetsize/8;
  173|    266|}
dwarf_peread.c:pe_get_pointer_size:
  185|    266|{
  186|    266|    dwarf_pe_object_access_internals_t *pep =
  187|    266|        (dwarf_pe_object_access_internals_t*)(obj);
  188|    266|    return pep->pe_pointersize/8;
  189|    266|}
dwarf_peread.c:pe_get_file_size:
  177|    266|{
  178|    266|    dwarf_pe_object_access_internals_t *pep =
  179|    266|        (dwarf_pe_object_access_internals_t*)(obj);
  180|    266|    return pep->pe_filesize;
  181|    266|}
dwarf_peread.c:pe_get_section_count:
  193|    266|{
  194|    266|    dwarf_pe_object_access_internals_t *pep =
  195|    266|        (dwarf_pe_object_access_internals_t*)(obj);
  196|    266|    return pep->pe_section_count;
  197|    266|}
dwarf_peread.c:pe_load_section:
  358|    208|{
  359|    208|    dwarf_pe_object_access_internals_t *pep =
  360|    208|        (dwarf_pe_object_access_internals_t*)(obj);
  361|       |
  362|    208|    if (0 < section_index &&
  ------------------
  |  Branch (362:9): [True: 208, False: 0]
  ------------------
  363|    208|        section_index < pep->pe_section_count) {
  ------------------
  |  Branch (363:9): [True: 208, False: 0]
  ------------------
  364|    208|        int res = 0;
  365|    208|        struct dwarf_pe_generic_image_section_header *sp =
  366|    208|            pep->pe_sectionptr + section_index;
  367|    208|        Dwarf_Unsigned read_length = 0;
  368|       |
  369|    208|        if (sp->loaded_data) {
  ------------------
  |  Branch (369:13): [True: 0, False: 208]
  ------------------
  370|      0|            *return_data = sp->loaded_data;
  371|      0|            return DW_DLV_OK;
  ------------------
  |  |   59|      0|#define DW_DLV_OK         0
  ------------------
  372|      0|        }
  373|    208|        if (sp->section_irrelevant_to_dwarf) {
  ------------------
  |  Branch (373:13): [True: 0, False: 208]
  ------------------
  374|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  375|      0|        }
  376|    208|        if (!sp->VirtualSize) {
  ------------------
  |  Branch (376:13): [True: 0, False: 208]
  ------------------
  377|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  378|      0|        }
  379|    208|        if (sp->SizeOfRawData >= pep->pe_filesize) {
  ------------------
  |  Branch (379:13): [True: 2, False: 206]
  ------------------
  380|      2|            *error = DW_DLE_PE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1537|      2|#define DW_DLE_PE_SECTION_SIZE_ERROR           491
  ------------------
  381|      2|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
  382|      2|        }
  383|    206|        read_length = sp->SizeOfRawData;
  384|    206|        if (sp->VirtualSize < read_length) {
  ------------------
  |  Branch (384:13): [True: 9, False: 197]
  ------------------
  385|       |            /* Don't read padding that wasn't allocated in memory */
  386|      9|            read_length = sp->VirtualSize;
  387|      9|        }
  388|    206|        if ((read_length + sp->PointerToRawData) >
  ------------------
  |  Branch (388:13): [True: 0, False: 206]
  ------------------
  389|    206|            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|    206|        if (sp->VirtualSize >= 2*pep->pe_filesize) {
  ------------------
  |  Branch (398:13): [True: 98, False: 108]
  ------------------
  399|     98|            *error = DW_DLE_PE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1537|     98|#define DW_DLE_PE_SECTION_SIZE_ERROR           491
  ------------------
  400|     98|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     98|#define DW_DLV_ERROR      1
  ------------------
  401|     98|        }
  402|    108|        sp->loaded_data = malloc((size_t)sp->VirtualSize);
  403|    108|        if (!sp->loaded_data) {
  ------------------
  |  Branch (403:13): [True: 0, False: 108]
  ------------------
  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|    108|        res = _dwarf_object_read_random(pep->pe_fd,
  408|    108|            (char *)sp->loaded_data,
  409|    108|            sp->PointerToRawData, (size_t)read_length,
  410|    108|            pep->pe_filesize,
  411|    108|            error);
  412|    108|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    108|#define DW_DLV_OK         0
  ------------------
  |  Branch (412:13): [True: 1, False: 107]
  ------------------
  413|      1|            free(sp->loaded_data);
  414|      1|            sp->loaded_data = 0;
  415|      1|            return res;
  416|      1|        }
  417|    107|        if (sp->VirtualSize > read_length) {
  ------------------
  |  Branch (417:13): [True: 98, False: 9]
  ------------------
  418|       |            /*  Zero space that was allocated but
  419|       |                truncated from the file */
  420|     98|            memset(sp->loaded_data + read_length, 0,
  421|     98|                (size_t)(sp->VirtualSize - read_length));
  422|     98|        }
  423|    107|        *return_data = sp->loaded_data;
  424|    107|        return DW_DLV_OK;
  ------------------
  |  |   59|    107|#define DW_DLV_OK         0
  ------------------
  425|    108|    }
  426|      0|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  427|    208|}

_dwarf_dealloc_rnglists_context:
  720|  3.38k|{
  721|  3.38k|    Dwarf_Unsigned i = 0;
  722|  3.38k|    Dwarf_Rnglists_Context * rngcon = 0;
  723|       |
  724|  3.38k|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|  3.38k|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|  3.38k|#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.38k|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 0, False: 3.38k]
  |  |  |  Branch (159:7): [True: 0, False: 3.38k]
  |  |  |  Branch (159:15): [True: 0, False: 3.38k]
  |  |  ------------------
  ------------------
  725|      0|        return;
  726|      0|    }
  727|  3.38k|    if (!dbg->de_rnglists_context) {
  ------------------
  |  Branch (727:9): [True: 3.38k, False: 0]
  ------------------
  728|  3.38k|        return;
  729|  3.38k|    }
  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|  37.8k|{
  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|  37.8k|    Dwarf_Unsigned computed = x * y;
  138|  37.8k|    Dwarf_Unsigned bigger = 0;
  139|       |
  140|  37.8k|    *result = computed;
  141|  37.8k|    if (!x || !y) {
  ------------------
  |  Branch (141:9): [True: 0, False: 37.8k]
  |  Branch (141:15): [True: 0, False: 37.8k]
  ------------------
  142|      0|        return DW_DLV_OK;
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
  143|      0|    }
  144|  37.8k|    bigger = (x > y)?x:y;
  ------------------
  |  Branch (144:14): [True: 27.0k, False: 10.8k]
  ------------------
  145|  37.8k|    if (computed < bigger)  {
  ------------------
  |  Branch (145:9): [True: 0, False: 37.8k]
  ------------------
  146|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  147|      0|    }
  148|  37.8k|    return DW_DLV_OK;
  ------------------
  |  |  122|  37.8k|#define DW_DLV_OK        0
  ------------------
  149|  37.8k|}
_dwarf_uint64_add:
  158|  61.4k|{
  159|  61.4k|    Dwarf_Unsigned computed = dw_lhs + dw_rhs;
  160|  61.4k|    Dwarf_Unsigned bigger = 0;
  161|       |
  162|  61.4k|    if (!dw_lhs || !dw_rhs) {
  ------------------
  |  Branch (162:9): [True: 35.7k, False: 25.7k]
  |  Branch (162:20): [True: 7.13k, False: 18.5k]
  ------------------
  163|  42.8k|        *result = computed;
  164|  42.8k|        return DW_DLV_OK;
  ------------------
  |  |  122|  42.8k|#define DW_DLV_OK        0
  ------------------
  165|  42.8k|    }
  166|  18.5k|    bigger = (dw_lhs > dw_rhs)?dw_lhs:dw_rhs;
  ------------------
  |  Branch (166:14): [True: 6.53k, False: 12.0k]
  ------------------
  167|  18.5k|    if (computed && computed < bigger)  {
  ------------------
  |  Branch (167:9): [True: 18.3k, False: 198]
  |  Branch (167:21): [True: 9, False: 18.3k]
  ------------------
  168|      9|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      9|#define DW_DLV_ERROR     1
  ------------------
  169|      9|    }
  170|  18.5k|    *result = computed;
  171|  18.5k|    return DW_DLV_OK;
  ------------------
  |  |  122|  18.5k|#define DW_DLV_OK        0
  ------------------
  172|  18.5k|}

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

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

_dwarf_readr:
  107|  1.59M|{
  108|       |
  109|  1.59M|    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.59M|    Dwarf_Unsigned max_single_read = 0x1ffff000;
  116|  1.59M|#endif
  117|  1.59M|    Dwarf_Unsigned remaining_bytes = 0;
  118|  1.59M|    Dwarf_Unsigned totalsize = size;
  119|       |
  120|  1.59M|    remaining_bytes = size;
  121|  3.18M|    while(remaining_bytes > 0) {
  ------------------
  |  Branch (121:11): [True: 1.59M, False: 1.59M]
  ------------------
  122|  1.59M|        if (remaining_bytes > max_single_read) {
  ------------------
  |  Branch (122:13): [True: 0, False: 1.59M]
  ------------------
  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.59M|        rcode = (Dwarf_Signed)read(fd,buf,(size_t)size);
  131|  1.59M|#endif
  132|  1.59M|        if (rcode < 0 || rcode != (Dwarf_Signed)size) {
  ------------------
  |  Branch (132:13): [True: 0, False: 1.59M]
  |  Branch (132:26): [True: 0, False: 1.59M]
  ------------------
  133|      0|            return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  134|      0|        }
  135|  1.59M|        remaining_bytes -= size;
  136|  1.59M|        buf += size;
  137|  1.59M|        size = remaining_bytes;
  138|  1.59M|    }
  139|  1.59M|    if (sizeread_out) {
  ------------------
  |  Branch (139:9): [True: 0, False: 1.59M]
  ------------------
  140|      0|        *sizeread_out = totalsize;
  141|      0|    }
  142|  1.59M|    return DW_DLV_OK;
  ------------------
  |  |  122|  1.59M|#define DW_DLV_OK        0
  ------------------
  143|  1.59M|}
_dwarf_seekr:
  150|  1.59M|{
  151|  1.59M|    Dwarf_Signed fsize = 0;
  152|  1.59M|    Dwarf_Signed sloc = 0;
  153|       |
  154|  1.59M|    sloc = (Dwarf_Signed)loc;
  155|  1.59M|    if (sloc < 0) {
  ------------------
  |  Branch (155:9): [True: 0, False: 1.59M]
  ------------------
  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.59M|    fsize = (Dwarf_Signed)lseek(fd,(off_t)loc,seektype);
  164|  1.59M|#endif
  165|  1.59M|    if (fsize < 0) {
  ------------------
  |  Branch (165:9): [True: 0, False: 1.59M]
  ------------------
  166|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  167|      0|    }
  168|  1.59M|    if (out_loc) {
  ------------------
  |  Branch (168:9): [True: 8.49k, False: 1.59M]
  ------------------
  169|  8.49k|        *out_loc = (Dwarf_Unsigned)fsize;
  170|  8.49k|    }
  171|  1.59M|    return DW_DLV_OK;
  ------------------
  |  |  122|  1.59M|#define DW_DLV_OK        0
  ------------------
  172|  1.59M|}

_dwarf_enter_section_in_de_debug_sections_array:
  270|  99.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|  99.6k|    SET_UP_SECTION(dbg,scn_name,".debug_info",
  ------------------
  |  |  243|  99.6k|    {                                           \
  |  |  244|  99.6k|    int lerr = 0;                               \
  |  |  245|  99.6k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.6k|        (mname),  /* actual section name */     \
  |  |  247|  99.6k|        (mtarg),    /* std section name */      \
  |  |  248|  99.6k|        /* scn_number from macro use context */ \
  |  |  249|  99.6k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.6k|        (minfo),                                \
  |  |  251|  99.6k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.6k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.6k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 15, False: 99.6k]
  |  |  ------------------
  |  |  253|     15|        return lerr;                            \
  |  |  254|     15|    }    /* else fall through. */               \
  |  |  255|  99.6k|    }
  ------------------
  275|  99.6k|        group_number,
  276|  99.6k|        &dbg->de_debug_info,
  277|  99.6k|        DW_DLE_DEBUG_INFO_DUPLICATE,DW_DLE_DEBUG_INFO_NULL,
  278|  99.6k|        TRUE,err);
  279|  99.6k|    SET_UP_SECTION(dbg,scn_name,".debug_info.dwo",
  ------------------
  |  |  243|  99.6k|    {                                           \
  |  |  244|  99.6k|    int lerr = 0;                               \
  |  |  245|  99.6k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.6k|        (mname),  /* actual section name */     \
  |  |  247|  99.6k|        (mtarg),    /* std section name */      \
  |  |  248|  99.6k|        /* scn_number from macro use context */ \
  |  |  249|  99.6k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.6k|        (minfo),                                \
  |  |  251|  99.6k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.6k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.6k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 7, False: 99.6k]
  |  |  ------------------
  |  |  253|      7|        return lerr;                            \
  |  |  254|      7|    }    /* else fall through. */               \
  |  |  255|  99.6k|    }
  ------------------
  280|  99.6k|        DW_GROUPNUMBER_DWO,
  281|  99.6k|        &dbg->de_debug_info,
  282|  99.6k|        DW_DLE_DEBUG_INFO_DUPLICATE,DW_DLE_DEBUG_INFO_NULL,
  283|  99.6k|        TRUE,err);
  284|  99.6k|    SET_UP_SECTION(dbg,scn_name,".debug_types",
  ------------------
  |  |  243|  99.6k|    {                                           \
  |  |  244|  99.6k|    int lerr = 0;                               \
  |  |  245|  99.6k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.6k|        (mname),  /* actual section name */     \
  |  |  247|  99.6k|        (mtarg),    /* std section name */      \
  |  |  248|  99.6k|        /* scn_number from macro use context */ \
  |  |  249|  99.6k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.6k|        (minfo),                                \
  |  |  251|  99.6k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.6k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.6k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 7, False: 99.6k]
  |  |  ------------------
  |  |  253|      7|        return lerr;                            \
  |  |  254|      7|    }    /* else fall through. */               \
  |  |  255|  99.6k|    }
  ------------------
  285|  99.6k|        group_number,
  286|  99.6k|        &dbg->de_debug_types,
  287|  99.6k|        DW_DLE_DEBUG_TYPES_DUPLICATE,DW_DLE_DEBUG_TYPES_NULL,
  288|  99.6k|        TRUE,err);
  289|       |    /* types.dwo  is non-standard. DWARF4 GNU maybe. */
  290|  99.6k|    SET_UP_SECTION(dbg,scn_name,".debug_types.dwo",
  ------------------
  |  |  243|  99.6k|    {                                           \
  |  |  244|  99.6k|    int lerr = 0;                               \
  |  |  245|  99.6k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.6k|        (mname),  /* actual section name */     \
  |  |  247|  99.6k|        (mtarg),    /* std section name */      \
  |  |  248|  99.6k|        /* scn_number from macro use context */ \
  |  |  249|  99.6k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.6k|        (minfo),                                \
  |  |  251|  99.6k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.6k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.6k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 15, False: 99.6k]
  |  |  ------------------
  |  |  253|     15|        return lerr;                            \
  |  |  254|     15|    }    /* else fall through. */               \
  |  |  255|  99.6k|    }
  ------------------
  291|  99.6k|        DW_GROUPNUMBER_DWO,
  292|  99.6k|        &dbg->de_debug_types,
  293|  99.6k|        DW_DLE_DEBUG_TYPES_DUPLICATE,DW_DLE_DEBUG_TYPES_NULL,
  294|  99.6k|        TRUE,err);
  295|  99.6k|    SET_UP_SECTION(dbg,scn_name,".debug_abbrev",
  ------------------
  |  |  243|  99.6k|    {                                           \
  |  |  244|  99.6k|    int lerr = 0;                               \
  |  |  245|  99.6k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.6k|        (mname),  /* actual section name */     \
  |  |  247|  99.6k|        (mtarg),    /* std section name */      \
  |  |  248|  99.6k|        /* scn_number from macro use context */ \
  |  |  249|  99.6k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.6k|        (minfo),                                \
  |  |  251|  99.6k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.6k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.6k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 10, False: 99.5k]
  |  |  ------------------
  |  |  253|     10|        return lerr;                            \
  |  |  254|     10|    }    /* else fall through. */               \
  |  |  255|  99.6k|    }
  ------------------
  296|  99.6k|        group_number,
  297|  99.6k|        &dbg->de_debug_abbrev, /*03*/
  298|  99.6k|        DW_DLE_DEBUG_ABBREV_DUPLICATE,DW_DLE_DEBUG_ABBREV_NULL,
  299|  99.6k|        TRUE,err);
  300|  99.5k|    SET_UP_SECTION(dbg,scn_name,".debug_abbrev.dwo",
  ------------------
  |  |  243|  99.5k|    {                                           \
  |  |  244|  99.5k|    int lerr = 0;                               \
  |  |  245|  99.5k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.5k|        (mname),  /* actual section name */     \
  |  |  247|  99.5k|        (mtarg),    /* std section name */      \
  |  |  248|  99.5k|        /* scn_number from macro use context */ \
  |  |  249|  99.5k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.5k|        (minfo),                                \
  |  |  251|  99.5k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.5k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.5k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 7, False: 99.5k]
  |  |  ------------------
  |  |  253|      7|        return lerr;                            \
  |  |  254|      7|    }    /* else fall through. */               \
  |  |  255|  99.5k|    }
  ------------------
  301|  99.5k|        DW_GROUPNUMBER_DWO,
  302|  99.5k|        &dbg->de_debug_abbrev, /*03*/
  303|  99.5k|        DW_DLE_DEBUG_ABBREV_DUPLICATE,DW_DLE_DEBUG_ABBREV_NULL,
  304|  99.5k|        TRUE,err);
  305|  99.5k|    SET_UP_SECTION(dbg,scn_name,".debug_aranges",
  ------------------
  |  |  243|  99.5k|    {                                           \
  |  |  244|  99.5k|    int lerr = 0;                               \
  |  |  245|  99.5k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.5k|        (mname),  /* actual section name */     \
  |  |  247|  99.5k|        (mtarg),    /* std section name */      \
  |  |  248|  99.5k|        /* scn_number from macro use context */ \
  |  |  249|  99.5k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.5k|        (minfo),                                \
  |  |  251|  99.5k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.5k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.5k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 14, False: 99.5k]
  |  |  ------------------
  |  |  253|     14|        return lerr;                            \
  |  |  254|     14|    }    /* else fall through. */               \
  |  |  255|  99.5k|    }
  ------------------
  306|  99.5k|        group_number,
  307|  99.5k|        &dbg->de_debug_aranges,
  308|  99.5k|        DW_DLE_DEBUG_ARANGES_DUPLICATE,0,
  309|  99.5k|        FALSE,err);
  310|  99.5k|    SET_UP_SECTION(dbg,scn_name,".debug_line",
  ------------------
  |  |  243|  99.5k|    {                                           \
  |  |  244|  99.5k|    int lerr = 0;                               \
  |  |  245|  99.5k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.5k|        (mname),  /* actual section name */     \
  |  |  247|  99.5k|        (mtarg),    /* std section name */      \
  |  |  248|  99.5k|        /* scn_number from macro use context */ \
  |  |  249|  99.5k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.5k|        (minfo),                                \
  |  |  251|  99.5k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.5k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.5k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 15, False: 99.5k]
  |  |  ------------------
  |  |  253|     15|        return lerr;                            \
  |  |  254|     15|    }    /* else fall through. */               \
  |  |  255|  99.5k|    }
  ------------------
  311|  99.5k|        group_number,
  312|  99.5k|        &dbg->de_debug_line,
  313|  99.5k|        DW_DLE_DEBUG_LINE_DUPLICATE,0,
  314|  99.5k|        TRUE,err);
  315|       |    /* DWARF5 */
  316|  99.5k|    SET_UP_SECTION(dbg,scn_name,".debug_line_str",
  ------------------
  |  |  243|  99.5k|    {                                           \
  |  |  244|  99.5k|    int lerr = 0;                               \
  |  |  245|  99.5k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.5k|        (mname),  /* actual section name */     \
  |  |  247|  99.5k|        (mtarg),    /* std section name */      \
  |  |  248|  99.5k|        /* scn_number from macro use context */ \
  |  |  249|  99.5k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.5k|        (minfo),                                \
  |  |  251|  99.5k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.5k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.5k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 14, False: 99.5k]
  |  |  ------------------
  |  |  253|     14|        return lerr;                            \
  |  |  254|     14|    }    /* else fall through. */               \
  |  |  255|  99.5k|    }
  ------------------
  317|  99.5k|        group_number,
  318|  99.5k|        &dbg->de_debug_line_str,
  319|  99.5k|        DW_DLE_DEBUG_LINE_DUPLICATE,0,
  320|  99.5k|        FALSE,err);
  321|  99.5k|    SET_UP_SECTION(dbg,scn_name,".debug_line.dwo",
  ------------------
  |  |  243|  99.5k|    {                                           \
  |  |  244|  99.5k|    int lerr = 0;                               \
  |  |  245|  99.5k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.5k|        (mname),  /* actual section name */     \
  |  |  247|  99.5k|        (mtarg),    /* std section name */      \
  |  |  248|  99.5k|        /* scn_number from macro use context */ \
  |  |  249|  99.5k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.5k|        (minfo),                                \
  |  |  251|  99.5k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.5k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.5k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 18, False: 99.5k]
  |  |  ------------------
  |  |  253|     18|        return lerr;                            \
  |  |  254|     18|    }    /* else fall through. */               \
  |  |  255|  99.5k|    }
  ------------------
  322|  99.5k|        DW_GROUPNUMBER_DWO,
  323|  99.5k|        &dbg->de_debug_line,
  324|  99.5k|        DW_DLE_DEBUG_LINE_DUPLICATE,0,
  325|  99.5k|        TRUE,err);
  326|  99.5k|    SET_UP_SECTION(dbg,scn_name,".debug_frame",
  ------------------
  |  |  243|  99.5k|    {                                           \
  |  |  244|  99.5k|    int lerr = 0;                               \
  |  |  245|  99.5k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.5k|        (mname),  /* actual section name */     \
  |  |  247|  99.5k|        (mtarg),    /* std section name */      \
  |  |  248|  99.5k|        /* scn_number from macro use context */ \
  |  |  249|  99.5k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.5k|        (minfo),                                \
  |  |  251|  99.5k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.5k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.5k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 11, False: 99.5k]
  |  |  ------------------
  |  |  253|     11|        return lerr;                            \
  |  |  254|     11|    }    /* else fall through. */               \
  |  |  255|  99.5k|    }
  ------------------
  327|  99.5k|        group_number,
  328|  99.5k|        &dbg->de_debug_frame,
  329|  99.5k|        DW_DLE_DEBUG_FRAME_DUPLICATE,0,
  330|  99.5k|        TRUE,err);
  331|       |    /* gnu egcs-1.1.2 data */
  332|  99.5k|    SET_UP_SECTION(dbg,scn_name,".eh_frame",
  ------------------
  |  |  243|  99.5k|    {                                           \
  |  |  244|  99.5k|    int lerr = 0;                               \
  |  |  245|  99.5k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.5k|        (mname),  /* actual section name */     \
  |  |  247|  99.5k|        (mtarg),    /* std section name */      \
  |  |  248|  99.5k|        /* scn_number from macro use context */ \
  |  |  249|  99.5k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.5k|        (minfo),                                \
  |  |  251|  99.5k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.5k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.5k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 236, False: 99.2k]
  |  |  ------------------
  |  |  253|    236|        return lerr;                            \
  |  |  254|    236|    }    /* else fall through. */               \
  |  |  255|  99.5k|    }
  ------------------
  333|  99.5k|        group_number,
  334|  99.5k|        &dbg->de_debug_frame_eh_gnu,
  335|  99.5k|        DW_DLE_DEBUG_FRAME_DUPLICATE,0,
  336|  99.5k|        TRUE,err);
  337|  99.2k|    SET_UP_SECTION(dbg,scn_name,".debug_loc",
  ------------------
  |  |  243|  99.2k|    {                                           \
  |  |  244|  99.2k|    int lerr = 0;                               \
  |  |  245|  99.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.2k|        (mname),  /* actual section name */     \
  |  |  247|  99.2k|        (mtarg),    /* std section name */      \
  |  |  248|  99.2k|        /* scn_number from macro use context */ \
  |  |  249|  99.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.2k|        (minfo),                                \
  |  |  251|  99.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 13, False: 99.2k]
  |  |  ------------------
  |  |  253|     13|        return lerr;                            \
  |  |  254|     13|    }    /* else fall through. */               \
  |  |  255|  99.2k|    }
  ------------------
  338|  99.2k|        group_number,
  339|  99.2k|        &dbg->de_debug_loc,
  340|  99.2k|        DW_DLE_DEBUG_LOC_DUPLICATE,0,
  341|  99.2k|        FALSE,err);
  342|       |    /*  .debug_loc.dwo would be non-standard. */
  343|  99.2k|    SET_UP_SECTION(dbg,scn_name,".debug_loc.dwo",
  ------------------
  |  |  243|  99.2k|    {                                           \
  |  |  244|  99.2k|    int lerr = 0;                               \
  |  |  245|  99.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.2k|        (mname),  /* actual section name */     \
  |  |  247|  99.2k|        (mtarg),    /* std section name */      \
  |  |  248|  99.2k|        /* scn_number from macro use context */ \
  |  |  249|  99.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.2k|        (minfo),                                \
  |  |  251|  99.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 4, False: 99.2k]
  |  |  ------------------
  |  |  253|      4|        return lerr;                            \
  |  |  254|      4|    }    /* else fall through. */               \
  |  |  255|  99.2k|    }
  ------------------
  344|  99.2k|        DW_GROUPNUMBER_DWO,
  345|  99.2k|        &dbg->de_debug_loc,
  346|  99.2k|        DW_DLE_DEBUG_LOC_DUPLICATE,0,
  347|  99.2k|        FALSE,err);
  348|  99.2k|    SET_UP_SECTION(dbg,scn_name,".debug_pubnames",
  ------------------
  |  |  243|  99.2k|    {                                           \
  |  |  244|  99.2k|    int lerr = 0;                               \
  |  |  245|  99.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.2k|        (mname),  /* actual section name */     \
  |  |  247|  99.2k|        (mtarg),    /* std section name */      \
  |  |  248|  99.2k|        /* scn_number from macro use context */ \
  |  |  249|  99.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.2k|        (minfo),                                \
  |  |  251|  99.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 8, False: 99.2k]
  |  |  ------------------
  |  |  253|      8|        return lerr;                            \
  |  |  254|      8|    }    /* else fall through. */               \
  |  |  255|  99.2k|    }
  ------------------
  349|  99.2k|        group_number,
  350|  99.2k|        &dbg->de_debug_pubnames,
  351|  99.2k|        DW_DLE_DEBUG_PUBNAMES_DUPLICATE,0,
  352|  99.2k|        FALSE,err);
  353|  99.2k|    SET_UP_SECTION(dbg,scn_name,".debug_str",
  ------------------
  |  |  243|  99.2k|    {                                           \
  |  |  244|  99.2k|    int lerr = 0;                               \
  |  |  245|  99.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.2k|        (mname),  /* actual section name */     \
  |  |  247|  99.2k|        (mtarg),    /* std section name */      \
  |  |  248|  99.2k|        /* scn_number from macro use context */ \
  |  |  249|  99.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.2k|        (minfo),                                \
  |  |  251|  99.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 23, False: 99.2k]
  |  |  ------------------
  |  |  253|     23|        return lerr;                            \
  |  |  254|     23|    }    /* else fall through. */               \
  |  |  255|  99.2k|    }
  ------------------
  354|  99.2k|        group_number,
  355|  99.2k|        &dbg->de_debug_str,
  356|  99.2k|        DW_DLE_DEBUG_STR_DUPLICATE,0,
  357|  99.2k|        FALSE,err);
  358|  99.2k|    SET_UP_SECTION(dbg,scn_name,".debug_str.dwo",
  ------------------
  |  |  243|  99.2k|    {                                           \
  |  |  244|  99.2k|    int lerr = 0;                               \
  |  |  245|  99.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.2k|        (mname),  /* actual section name */     \
  |  |  247|  99.2k|        (mtarg),    /* std section name */      \
  |  |  248|  99.2k|        /* scn_number from macro use context */ \
  |  |  249|  99.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.2k|        (minfo),                                \
  |  |  251|  99.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 7, False: 99.2k]
  |  |  ------------------
  |  |  253|      7|        return lerr;                            \
  |  |  254|      7|    }    /* else fall through. */               \
  |  |  255|  99.2k|    }
  ------------------
  359|  99.2k|        DW_GROUPNUMBER_DWO,
  360|  99.2k|        &dbg->de_debug_str,
  361|  99.2k|        DW_DLE_DEBUG_STR_DUPLICATE,0,
  362|  99.2k|        FALSE,err);
  363|       |    /* Section new in DWARF3.  */
  364|  99.2k|    SET_UP_SECTION(dbg,scn_name,".debug_pubtypes",
  ------------------
  |  |  243|  99.2k|    {                                           \
  |  |  244|  99.2k|    int lerr = 0;                               \
  |  |  245|  99.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.2k|        (mname),  /* actual section name */     \
  |  |  247|  99.2k|        (mtarg),    /* std section name */      \
  |  |  248|  99.2k|        /* scn_number from macro use context */ \
  |  |  249|  99.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.2k|        (minfo),                                \
  |  |  251|  99.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 5, False: 99.2k]
  |  |  ------------------
  |  |  253|      5|        return lerr;                            \
  |  |  254|      5|    }    /* else fall through. */               \
  |  |  255|  99.2k|    }
  ------------------
  365|  99.2k|        group_number,
  366|  99.2k|        &dbg->de_debug_pubtypes,
  367|  99.2k|        /*13*/ DW_DLE_DEBUG_PUBTYPES_DUPLICATE,0,
  368|  99.2k|        FALSE,err);
  369|       |    /* DWARF5 */
  370|  99.2k|    SET_UP_SECTION(dbg,scn_name,".debug_loclists",
  ------------------
  |  |  243|  99.2k|    {                                           \
  |  |  244|  99.2k|    int lerr = 0;                               \
  |  |  245|  99.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.2k|        (mname),  /* actual section name */     \
  |  |  247|  99.2k|        (mtarg),    /* std section name */      \
  |  |  248|  99.2k|        /* scn_number from macro use context */ \
  |  |  249|  99.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.2k|        (minfo),                                \
  |  |  251|  99.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 8, False: 99.2k]
  |  |  ------------------
  |  |  253|      8|        return lerr;                            \
  |  |  254|      8|    }    /* else fall through. */               \
  |  |  255|  99.2k|    }
  ------------------
  371|  99.2k|        group_number,
  372|  99.2k|        &dbg->de_debug_loclists,
  373|  99.2k|        /*13*/ DW_DLE_DEBUG_LOClISTS_DUPLICATE,0,
  374|  99.2k|        FALSE,err);
  375|       |    /* DWARF5 */
  376|  99.2k|    SET_UP_SECTION(dbg,scn_name,".debug_loclists.dwo",
  ------------------
  |  |  243|  99.2k|    {                                           \
  |  |  244|  99.2k|    int lerr = 0;                               \
  |  |  245|  99.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.2k|        (mname),  /* actual section name */     \
  |  |  247|  99.2k|        (mtarg),    /* std section name */      \
  |  |  248|  99.2k|        /* scn_number from macro use context */ \
  |  |  249|  99.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.2k|        (minfo),                                \
  |  |  251|  99.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 9, False: 99.2k]
  |  |  ------------------
  |  |  253|      9|        return lerr;                            \
  |  |  254|      9|    }    /* else fall through. */               \
  |  |  255|  99.2k|    }
  ------------------
  377|  99.2k|        DW_GROUPNUMBER_DWO,
  378|  99.2k|        &dbg->de_debug_loclists,
  379|  99.2k|        /*13*/ DW_DLE_DEBUG_LOClISTS_DUPLICATE,0,
  380|  99.2k|        FALSE,err);
  381|       |    /* DWARF5 */
  382|  99.2k|    SET_UP_SECTION(dbg,scn_name,".debug_rnglists",
  ------------------
  |  |  243|  99.2k|    {                                           \
  |  |  244|  99.2k|    int lerr = 0;                               \
  |  |  245|  99.2k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.2k|        (mname),  /* actual section name */     \
  |  |  247|  99.2k|        (mtarg),    /* std section name */      \
  |  |  248|  99.2k|        /* scn_number from macro use context */ \
  |  |  249|  99.2k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.2k|        (minfo),                                \
  |  |  251|  99.2k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.2k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.2k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 11, False: 99.1k]
  |  |  ------------------
  |  |  253|     11|        return lerr;                            \
  |  |  254|     11|    }    /* else fall through. */               \
  |  |  255|  99.2k|    }
  ------------------
  383|  99.2k|        group_number,
  384|  99.2k|        &dbg->de_debug_rnglists,
  385|  99.2k|        /*13*/ DW_DLE_DEBUG_RNGLISTS_DUPLICATE,0,
  386|  99.2k|        FALSE,err);
  387|       |    /* DWARF5 */
  388|  99.1k|    SET_UP_SECTION(dbg,scn_name,".debug_rnglists.dwo",
  ------------------
  |  |  243|  99.1k|    {                                           \
  |  |  244|  99.1k|    int lerr = 0;                               \
  |  |  245|  99.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.1k|        (mname),  /* actual section name */     \
  |  |  247|  99.1k|        (mtarg),    /* std section name */      \
  |  |  248|  99.1k|        /* scn_number from macro use context */ \
  |  |  249|  99.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.1k|        (minfo),                                \
  |  |  251|  99.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 7, False: 99.1k]
  |  |  ------------------
  |  |  253|      7|        return lerr;                            \
  |  |  254|      7|    }    /* else fall through. */               \
  |  |  255|  99.1k|    }
  ------------------
  389|  99.1k|        DW_GROUPNUMBER_DWO,
  390|  99.1k|        &dbg->de_debug_rnglists,
  391|  99.1k|        /*13*/ DW_DLE_DEBUG_RNGLISTS_DUPLICATE,0,
  392|  99.1k|        FALSE,err);
  393|       |    /* DWARF5 */
  394|  99.1k|    SET_UP_SECTION(dbg,scn_name,".debug_str_offsets",
  ------------------
  |  |  243|  99.1k|    {                                           \
  |  |  244|  99.1k|    int lerr = 0;                               \
  |  |  245|  99.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.1k|        (mname),  /* actual section name */     \
  |  |  247|  99.1k|        (mtarg),    /* std section name */      \
  |  |  248|  99.1k|        /* scn_number from macro use context */ \
  |  |  249|  99.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.1k|        (minfo),                                \
  |  |  251|  99.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 15, False: 99.1k]
  |  |  ------------------
  |  |  253|     15|        return lerr;                            \
  |  |  254|     15|    }    /* else fall through. */               \
  |  |  255|  99.1k|    }
  ------------------
  395|  99.1k|        group_number,
  396|  99.1k|        &dbg->de_debug_str_offsets,
  397|  99.1k|        DW_DLE_DEBUG_STR_OFFSETS_DUPLICATE,0,
  398|  99.1k|        FALSE,err);
  399|       |    /* DWARF5 */
  400|  99.1k|    SET_UP_SECTION(dbg,scn_name,".debug_str_offsets.dwo",
  ------------------
  |  |  243|  99.1k|    {                                           \
  |  |  244|  99.1k|    int lerr = 0;                               \
  |  |  245|  99.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.1k|        (mname),  /* actual section name */     \
  |  |  247|  99.1k|        (mtarg),    /* std section name */      \
  |  |  248|  99.1k|        /* scn_number from macro use context */ \
  |  |  249|  99.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.1k|        (minfo),                                \
  |  |  251|  99.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 4, False: 99.1k]
  |  |  ------------------
  |  |  253|      4|        return lerr;                            \
  |  |  254|      4|    }    /* else fall through. */               \
  |  |  255|  99.1k|    }
  ------------------
  401|  99.1k|        DW_GROUPNUMBER_DWO,
  402|  99.1k|        &dbg->de_debug_str_offsets,
  403|  99.1k|        DW_DLE_DEBUG_STR_OFFSETS_DUPLICATE,0,
  404|  99.1k|        FALSE,err);
  405|       |
  406|       |    /* SGI IRIX-only. */
  407|  99.1k|    SET_UP_SECTION(dbg,scn_name,".debug_funcnames",
  ------------------
  |  |  243|  99.1k|    {                                           \
  |  |  244|  99.1k|    int lerr = 0;                               \
  |  |  245|  99.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.1k|        (mname),  /* actual section name */     \
  |  |  247|  99.1k|        (mtarg),    /* std section name */      \
  |  |  248|  99.1k|        /* scn_number from macro use context */ \
  |  |  249|  99.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.1k|        (minfo),                                \
  |  |  251|  99.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 5, False: 99.1k]
  |  |  ------------------
  |  |  253|      5|        return lerr;                            \
  |  |  254|      5|    }    /* else fall through. */               \
  |  |  255|  99.1k|    }
  ------------------
  408|  99.1k|        group_number,
  409|  99.1k|        &dbg->de_debug_funcnames,
  410|  99.1k|        /*11*/ DW_DLE_DEBUG_FUNCNAMES_DUPLICATE,0,
  411|  99.1k|        FALSE,err);
  412|       |    /*  SGI IRIX-only, created years before DWARF3. Content
  413|       |        essentially identical to .debug_pubtypes.  */
  414|  99.1k|    SET_UP_SECTION(dbg,scn_name,".debug_typenames",
  ------------------
  |  |  243|  99.1k|    {                                           \
  |  |  244|  99.1k|    int lerr = 0;                               \
  |  |  245|  99.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.1k|        (mname),  /* actual section name */     \
  |  |  247|  99.1k|        (mtarg),    /* std section name */      \
  |  |  248|  99.1k|        /* scn_number from macro use context */ \
  |  |  249|  99.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.1k|        (minfo),                                \
  |  |  251|  99.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 8, False: 99.1k]
  |  |  ------------------
  |  |  253|      8|        return lerr;                            \
  |  |  254|      8|    }    /* else fall through. */               \
  |  |  255|  99.1k|    }
  ------------------
  415|  99.1k|        group_number,
  416|  99.1k|        &dbg->de_debug_typenames,
  417|  99.1k|        /*12*/ DW_DLE_DEBUG_TYPENAMES_DUPLICATE,0,
  418|  99.1k|        FALSE,err);
  419|       |    /* SGI IRIX-only.  */
  420|  99.1k|    SET_UP_SECTION(dbg,scn_name,".debug_varnames",
  ------------------
  |  |  243|  99.1k|    {                                           \
  |  |  244|  99.1k|    int lerr = 0;                               \
  |  |  245|  99.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.1k|        (mname),  /* actual section name */     \
  |  |  247|  99.1k|        (mtarg),    /* std section name */      \
  |  |  248|  99.1k|        /* scn_number from macro use context */ \
  |  |  249|  99.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.1k|        (minfo),                                \
  |  |  251|  99.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 2, False: 99.1k]
  |  |  ------------------
  |  |  253|      2|        return lerr;                            \
  |  |  254|      2|    }    /* else fall through. */               \
  |  |  255|  99.1k|    }
  ------------------
  421|  99.1k|        group_number,
  422|  99.1k|        &dbg->de_debug_varnames,
  423|  99.1k|        DW_DLE_DEBUG_VARNAMES_DUPLICATE,0,
  424|  99.1k|        FALSE,err);
  425|       |    /* SGI IRIX-only. */
  426|  99.1k|    SET_UP_SECTION(dbg,scn_name,".debug_weaknames",
  ------------------
  |  |  243|  99.1k|    {                                           \
  |  |  244|  99.1k|    int lerr = 0;                               \
  |  |  245|  99.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.1k|        (mname),  /* actual section name */     \
  |  |  247|  99.1k|        (mtarg),    /* std section name */      \
  |  |  248|  99.1k|        /* scn_number from macro use context */ \
  |  |  249|  99.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.1k|        (minfo),                                \
  |  |  251|  99.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 4, False: 99.1k]
  |  |  ------------------
  |  |  253|      4|        return lerr;                            \
  |  |  254|      4|    }    /* else fall through. */               \
  |  |  255|  99.1k|    }
  ------------------
  427|  99.1k|        group_number,
  428|  99.1k|        &dbg->de_debug_weaknames,
  429|  99.1k|        DW_DLE_DEBUG_WEAKNAMES_DUPLICATE,0,
  430|  99.1k|        FALSE,err);
  431|       |
  432|  99.1k|    SET_UP_SECTION(dbg,scn_name,".debug_macinfo",
  ------------------
  |  |  243|  99.1k|    {                                           \
  |  |  244|  99.1k|    int lerr = 0;                               \
  |  |  245|  99.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.1k|        (mname),  /* actual section name */     \
  |  |  247|  99.1k|        (mtarg),    /* std section name */      \
  |  |  248|  99.1k|        /* scn_number from macro use context */ \
  |  |  249|  99.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.1k|        (minfo),                                \
  |  |  251|  99.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 23, False: 99.1k]
  |  |  ------------------
  |  |  253|     23|        return lerr;                            \
  |  |  254|     23|    }    /* else fall through. */               \
  |  |  255|  99.1k|    }
  ------------------
  433|  99.1k|        group_number,
  434|  99.1k|        &dbg->de_debug_macinfo,
  435|  99.1k|        DW_DLE_DEBUG_MACINFO_DUPLICATE,0,
  436|  99.1k|        TRUE,err);
  437|       |    /*  ".debug_macinfo.dwo" is not allowed.  */
  438|       |
  439|       |    /* DWARF5 */
  440|  99.1k|    SET_UP_SECTION(dbg,scn_name,".debug_macro",
  ------------------
  |  |  243|  99.1k|    {                                           \
  |  |  244|  99.1k|    int lerr = 0;                               \
  |  |  245|  99.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.1k|        (mname),  /* actual section name */     \
  |  |  247|  99.1k|        (mtarg),    /* std section name */      \
  |  |  248|  99.1k|        /* scn_number from macro use context */ \
  |  |  249|  99.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.1k|        (minfo),                                \
  |  |  251|  99.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 11, False: 99.1k]
  |  |  ------------------
  |  |  253|     11|        return lerr;                            \
  |  |  254|     11|    }    /* else fall through. */               \
  |  |  255|  99.1k|    }
  ------------------
  441|  99.1k|        group_number,
  442|  99.1k|        &dbg->de_debug_macro,
  443|  99.1k|        DW_DLE_DEBUG_MACRO_DUPLICATE,0,
  444|  99.1k|        TRUE,err);
  445|       |    /* DWARF5 */
  446|  99.1k|    SET_UP_SECTION(dbg,scn_name,".debug_macro.dwo",
  ------------------
  |  |  243|  99.1k|    {                                           \
  |  |  244|  99.1k|    int lerr = 0;                               \
  |  |  245|  99.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.1k|        (mname),  /* actual section name */     \
  |  |  247|  99.1k|        (mtarg),    /* std section name */      \
  |  |  248|  99.1k|        /* scn_number from macro use context */ \
  |  |  249|  99.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.1k|        (minfo),                                \
  |  |  251|  99.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 9, False: 99.1k]
  |  |  ------------------
  |  |  253|      9|        return lerr;                            \
  |  |  254|      9|    }    /* else fall through. */               \
  |  |  255|  99.1k|    }
  ------------------
  447|  99.1k|        DW_GROUPNUMBER_DWO,
  448|  99.1k|        &dbg->de_debug_macro,
  449|  99.1k|        DW_DLE_DEBUG_MACRO_DUPLICATE,0,
  450|  99.1k|        TRUE,err);
  451|  99.1k|    SET_UP_SECTION(dbg,scn_name,".debug_ranges",
  ------------------
  |  |  243|  99.1k|    {                                           \
  |  |  244|  99.1k|    int lerr = 0;                               \
  |  |  245|  99.1k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.1k|        (mname),  /* actual section name */     \
  |  |  247|  99.1k|        (mtarg),    /* std section name */      \
  |  |  248|  99.1k|        /* scn_number from macro use context */ \
  |  |  249|  99.1k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.1k|        (minfo),                                \
  |  |  251|  99.1k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.1k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.1k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 6, False: 99.0k]
  |  |  ------------------
  |  |  253|      6|        return lerr;                            \
  |  |  254|      6|    }    /* else fall through. */               \
  |  |  255|  99.1k|    }
  ------------------
  452|  99.1k|        group_number,
  453|  99.1k|        &dbg->de_debug_ranges,
  454|  99.1k|        DW_DLE_DEBUG_RANGES_DUPLICATE,0,
  455|  99.1k|        TRUE,err);
  456|       |    /*  No .debug_ranges.dwo allowed. */
  457|       |
  458|       |    /* New DWARF5 */
  459|  99.0k|    SET_UP_SECTION(dbg,scn_name,".debug_sup",
  ------------------
  |  |  243|  99.0k|    {                                           \
  |  |  244|  99.0k|    int lerr = 0;                               \
  |  |  245|  99.0k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  99.0k|        (mname),  /* actual section name */     \
  |  |  247|  99.0k|        (mtarg),    /* std section name */      \
  |  |  248|  99.0k|        /* scn_number from macro use context */ \
  |  |  249|  99.0k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  99.0k|        (minfo),                                \
  |  |  251|  99.0k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  99.0k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  99.0k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 477, False: 98.6k]
  |  |  ------------------
  |  |  253|    477|        return lerr;                            \
  |  |  254|    477|    }    /* else fall through. */               \
  |  |  255|  99.0k|    }
  ------------------
  460|  99.0k|        group_number,
  461|  99.0k|        &dbg->de_debug_sup,
  462|  99.0k|        DW_DLE_DEBUG_SUP_DUPLICATE,0,
  463|  99.0k|        TRUE,err);
  464|       |    /* No .debug_sup.dwo allowed. */
  465|       |
  466|       |    /*  .symtab and .strtab have to be in any group.  */
  467|  98.6k|    SET_UP_SECTION(dbg,scn_name,".symtab",
  ------------------
  |  |  243|  98.6k|    {                                           \
  |  |  244|  98.6k|    int lerr = 0;                               \
  |  |  245|  98.6k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  98.6k|        (mname),  /* actual section name */     \
  |  |  247|  98.6k|        (mtarg),    /* std section name */      \
  |  |  248|  98.6k|        /* scn_number from macro use context */ \
  |  |  249|  98.6k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  98.6k|        (minfo),                                \
  |  |  251|  98.6k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  98.6k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  98.6k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 69, False: 98.5k]
  |  |  ------------------
  |  |  253|     69|        return lerr;                            \
  |  |  254|     69|    }    /* else fall through. */               \
  |  |  255|  98.6k|    }
  ------------------
  468|  98.6k|        group_number,
  469|  98.6k|        &dbg->de_elf_symtab,
  470|  98.6k|        DW_DLE_DEBUG_SYMTAB_ERR,0,
  471|  98.6k|        FALSE,err);
  472|  98.5k|    SET_UP_SECTION(dbg,scn_name,".strtab",
  ------------------
  |  |  243|  98.5k|    {                                           \
  |  |  244|  98.5k|    int lerr = 0;                               \
  |  |  245|  98.5k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  98.5k|        (mname),  /* actual section name */     \
  |  |  247|  98.5k|        (mtarg),    /* std section name */      \
  |  |  248|  98.5k|        /* scn_number from macro use context */ \
  |  |  249|  98.5k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  98.5k|        (minfo),                                \
  |  |  251|  98.5k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  98.5k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  98.5k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 101, False: 98.4k]
  |  |  ------------------
  |  |  253|    101|        return lerr;                            \
  |  |  254|    101|    }    /* else fall through. */               \
  |  |  255|  98.5k|    }
  ------------------
  473|  98.5k|        group_number,
  474|  98.5k|        &dbg->de_elf_strtab,
  475|  98.5k|        DW_DLE_DEBUG_STRTAB_ERR,0,
  476|  98.5k|        FALSE,err);
  477|       |
  478|       |    /* New DWARF5 */
  479|  98.4k|    SET_UP_SECTION(dbg,scn_name,".debug_addr",
  ------------------
  |  |  243|  98.4k|    {                                           \
  |  |  244|  98.4k|    int lerr = 0;                               \
  |  |  245|  98.4k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  98.4k|        (mname),  /* actual section name */     \
  |  |  247|  98.4k|        (mtarg),    /* std section name */      \
  |  |  248|  98.4k|        /* scn_number from macro use context */ \
  |  |  249|  98.4k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  98.4k|        (minfo),                                \
  |  |  251|  98.4k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  98.4k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  98.4k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 10, False: 98.4k]
  |  |  ------------------
  |  |  253|     10|        return lerr;                            \
  |  |  254|     10|    }    /* else fall through. */               \
  |  |  255|  98.4k|    }
  ------------------
  480|  98.4k|        group_number,
  481|  98.4k|        &dbg->de_debug_addr,
  482|  98.4k|        DW_DLE_DEBUG_ADDR_DUPLICATE,0,
  483|  98.4k|        TRUE,err);
  484|       |    /*  No .debug_addr.dwo allowed.  */
  485|       |
  486|       |    /* gdb added this. */
  487|  98.4k|    SET_UP_SECTION(dbg,scn_name,".gdb_index",
  ------------------
  |  |  243|  98.4k|    {                                           \
  |  |  244|  98.4k|    int lerr = 0;                               \
  |  |  245|  98.4k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  98.4k|        (mname),  /* actual section name */     \
  |  |  247|  98.4k|        (mtarg),    /* std section name */      \
  |  |  248|  98.4k|        /* scn_number from macro use context */ \
  |  |  249|  98.4k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  98.4k|        (minfo),                                \
  |  |  251|  98.4k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  98.4k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  98.4k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 21, False: 98.4k]
  |  |  ------------------
  |  |  253|     21|        return lerr;                            \
  |  |  254|     21|    }    /* else fall through. */               \
  |  |  255|  98.4k|    }
  ------------------
  488|  98.4k|        group_number,
  489|  98.4k|        &dbg->de_debug_gdbindex,
  490|  98.4k|        DW_DLE_DUPLICATE_GDB_INDEX,0,
  491|  98.4k|        FALSE,err);
  492|       |
  493|       |    /* New DWARF5 */
  494|  98.4k|    SET_UP_SECTION(dbg,scn_name,".debug_names",
  ------------------
  |  |  243|  98.4k|    {                                           \
  |  |  244|  98.4k|    int lerr = 0;                               \
  |  |  245|  98.4k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  98.4k|        (mname),  /* actual section name */     \
  |  |  247|  98.4k|        (mtarg),    /* std section name */      \
  |  |  248|  98.4k|        /* scn_number from macro use context */ \
  |  |  249|  98.4k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  98.4k|        (minfo),                                \
  |  |  251|  98.4k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  98.4k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  98.4k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 16, False: 98.4k]
  |  |  ------------------
  |  |  253|     16|        return lerr;                            \
  |  |  254|     16|    }    /* else fall through. */               \
  |  |  255|  98.4k|    }
  ------------------
  495|  98.4k|        group_number,
  496|  98.4k|        &dbg->de_debug_names,
  497|  98.4k|        /*13*/ DW_DLE_DEBUG_NAMES_DUPLICATE,0,
  498|  98.4k|        FALSE,err);
  499|       |    /* No .debug_names.dwo allowed. */
  500|       |
  501|       |    /* gdb added this in DW4. It is in standard DWARF5  */
  502|  98.4k|    SET_UP_SECTION(dbg,scn_name,".debug_cu_index",
  ------------------
  |  |  243|  98.4k|    {                                           \
  |  |  244|  98.4k|    int lerr = 0;                               \
  |  |  245|  98.4k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  98.4k|        (mname),  /* actual section name */     \
  |  |  247|  98.4k|        (mtarg),    /* std section name */      \
  |  |  248|  98.4k|        /* scn_number from macro use context */ \
  |  |  249|  98.4k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  98.4k|        (minfo),                                \
  |  |  251|  98.4k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  98.4k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  98.4k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 402, False: 97.9k]
  |  |  ------------------
  |  |  253|    402|        return lerr;                            \
  |  |  254|    402|    }    /* else fall through. */               \
  |  |  255|  98.4k|    }
  ------------------
  503|  98.4k|        DW_GROUPNUMBER_DWO,
  504|  98.4k|        &dbg->de_debug_cu_index,
  505|  98.4k|        DW_DLE_DUPLICATE_CU_INDEX,0,
  506|  98.4k|        FALSE,err);
  507|       |    /* gdb added this in DW4. It is in standard DWARF5 */
  508|  97.9k|    SET_UP_SECTION(dbg,scn_name,".debug_tu_index",
  ------------------
  |  |  243|  97.9k|    {                                           \
  |  |  244|  97.9k|    int lerr = 0;                               \
  |  |  245|  97.9k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  97.9k|        (mname),  /* actual section name */     \
  |  |  247|  97.9k|        (mtarg),    /* std section name */      \
  |  |  248|  97.9k|        /* scn_number from macro use context */ \
  |  |  249|  97.9k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  97.9k|        (minfo),                                \
  |  |  251|  97.9k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  97.9k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  97.9k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 160, False: 97.8k]
  |  |  ------------------
  |  |  253|    160|        return lerr;                            \
  |  |  254|    160|    }    /* else fall through. */               \
  |  |  255|  97.9k|    }
  ------------------
  509|  97.9k|        DW_GROUPNUMBER_DWO,
  510|  97.9k|        &dbg->de_debug_tu_index,
  511|  97.9k|        DW_DLE_DUPLICATE_TU_INDEX,0,
  512|  97.9k|        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|  97.8k|    SET_UP_SECTION(dbg,scn_name,".gnu_debuglink",
  ------------------
  |  |  243|  97.8k|    {                                           \
  |  |  244|  97.8k|    int lerr = 0;                               \
  |  |  245|  97.8k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  97.8k|        (mname),  /* actual section name */     \
  |  |  247|  97.8k|        (mtarg),    /* std section name */      \
  |  |  248|  97.8k|        /* scn_number from macro use context */ \
  |  |  249|  97.8k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  97.8k|        (minfo),                                \
  |  |  251|  97.8k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  97.8k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  97.8k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 332, False: 97.5k]
  |  |  ------------------
  |  |  253|    332|        return lerr;                            \
  |  |  254|    332|    }    /* else fall through. */               \
  |  |  255|  97.8k|    }
  ------------------
  518|  97.8k|        DW_GROUPNUMBER_DWO,
  519|  97.8k|        &dbg->de_gnu_debuglink,
  520|  97.8k|        DW_DLE_DUPLICATE_GNU_DEBUGLINK,0,
  521|  97.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|  97.5k|    SET_UP_SECTION(dbg,scn_name,".note.gnu.build-id",
  ------------------
  |  |  243|  97.5k|    {                                           \
  |  |  244|  97.5k|    int lerr = 0;                               \
  |  |  245|  97.5k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  97.5k|        (mname),  /* actual section name */     \
  |  |  247|  97.5k|        (mtarg),    /* std section name */      \
  |  |  248|  97.5k|        /* scn_number from macro use context */ \
  |  |  249|  97.5k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  97.5k|        (minfo),                                \
  |  |  251|  97.5k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  97.5k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  97.5k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 549, False: 96.9k]
  |  |  ------------------
  |  |  253|    549|        return lerr;                            \
  |  |  254|    549|    }    /* else fall through. */               \
  |  |  255|  97.5k|    }
  ------------------
  527|  97.5k|        DW_GROUPNUMBER_DWO,
  528|  97.5k|        &dbg->de_note_gnu_buildid,
  529|  97.5k|        DW_DLE_DUPLICATE_NOTE_GNU_BUILD_ID,0,
  530|  97.5k|        TRUE,err);
  531|       |
  532|       |    /* GNU added this. It is not part of DWARF */
  533|  96.9k|    SET_UP_SECTION(dbg,scn_name,".debug_gnu_pubtypes.dwo",
  ------------------
  |  |  243|  96.9k|    {                                           \
  |  |  244|  96.9k|    int lerr = 0;                               \
  |  |  245|  96.9k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  96.9k|        (mname),  /* actual section name */     \
  |  |  247|  96.9k|        (mtarg),    /* std section name */      \
  |  |  248|  96.9k|        /* scn_number from macro use context */ \
  |  |  249|  96.9k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  96.9k|        (minfo),                                \
  |  |  251|  96.9k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  96.9k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  96.9k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 6, False: 96.9k]
  |  |  ------------------
  |  |  253|      6|        return lerr;                            \
  |  |  254|      6|    }    /* else fall through. */               \
  |  |  255|  96.9k|    }
  ------------------
  534|  96.9k|        DW_GROUPNUMBER_DWO,
  535|  96.9k|        &dbg->de_debug_gnu_pubtypes,
  536|  96.9k|        DW_DLE_DUPLICATE_GNU_DEBUG_PUBTYPES,0,
  537|  96.9k|        FALSE,err);
  538|  96.9k|    SET_UP_SECTION(dbg,scn_name,".debug_gnu_pubtypes",
  ------------------
  |  |  243|  96.9k|    {                                           \
  |  |  244|  96.9k|    int lerr = 0;                               \
  |  |  245|  96.9k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  96.9k|        (mname),  /* actual section name */     \
  |  |  247|  96.9k|        (mtarg),    /* std section name */      \
  |  |  248|  96.9k|        /* scn_number from macro use context */ \
  |  |  249|  96.9k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  96.9k|        (minfo),                                \
  |  |  251|  96.9k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  96.9k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  96.9k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 10, False: 96.9k]
  |  |  ------------------
  |  |  253|     10|        return lerr;                            \
  |  |  254|     10|    }    /* else fall through. */               \
  |  |  255|  96.9k|    }
  ------------------
  539|  96.9k|        group_number,
  540|  96.9k|        &dbg->de_debug_gnu_pubtypes,
  541|  96.9k|        DW_DLE_DUPLICATE_GNU_DEBUG_PUBTYPES,0,
  542|  96.9k|        FALSE,err);
  543|  96.9k|    SET_UP_SECTION(dbg,scn_name,".debug_gnu_pubnames.dwo",
  ------------------
  |  |  243|  96.9k|    {                                           \
  |  |  244|  96.9k|    int lerr = 0;                               \
  |  |  245|  96.9k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  96.9k|        (mname),  /* actual section name */     \
  |  |  247|  96.9k|        (mtarg),    /* std section name */      \
  |  |  248|  96.9k|        /* scn_number from macro use context */ \
  |  |  249|  96.9k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  96.9k|        (minfo),                                \
  |  |  251|  96.9k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  96.9k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  96.9k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 7, False: 96.9k]
  |  |  ------------------
  |  |  253|      7|        return lerr;                            \
  |  |  254|      7|    }    /* else fall through. */               \
  |  |  255|  96.9k|    }
  ------------------
  544|  96.9k|        DW_GROUPNUMBER_DWO,
  545|  96.9k|        &dbg->de_debug_gnu_pubnames,
  546|  96.9k|        DW_DLE_DUPLICATE_GNU_DEBUG_PUBNAMES,0,
  547|  96.9k|        FALSE,err);
  548|  96.9k|    SET_UP_SECTION(dbg,scn_name,".debug_gnu_pubnames",
  ------------------
  |  |  243|  96.9k|    {                                           \
  |  |  244|  96.9k|    int lerr = 0;                               \
  |  |  245|  96.9k|    lerr =  set_up_section((mdbg),              \
  |  |  246|  96.9k|        (mname),  /* actual section name */     \
  |  |  247|  96.9k|        (mtarg),    /* std section name */      \
  |  |  248|  96.9k|        /* scn_number from macro use context */ \
  |  |  249|  96.9k|        scn_number,(mtarg),(mgrp),              \
  |  |  250|  96.9k|        (minfo),                                \
  |  |  251|  96.9k|        (me1),(me2),(mdw),(mer));               \
  |  |  252|  96.9k|    if (lerr != DW_DLV_NO_ENTRY) {              \
  |  |  ------------------
  |  |  |  |  121|  96.9k|#define DW_DLV_NO_ENTRY -1
  |  |  ------------------
  |  |  |  Branch (252:9): [True: 13, False: 96.9k]
  |  |  ------------------
  |  |  253|     13|        return lerr;                            \
  |  |  254|     13|    }    /* else fall through. */               \
  |  |  255|  96.9k|    }
  ------------------
  549|  96.9k|        group_number,
  550|  96.9k|        &dbg->de_debug_gnu_pubnames,
  551|  96.9k|        DW_DLE_DUPLICATE_GNU_DEBUG_PUBNAMES,0,
  552|  96.9k|        FALSE,err);
  553|  96.9k|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|  96.9k|#define DW_DLV_NO_ENTRY -1
  ------------------
  554|  96.9k|}
dwarf_setup_sections.c:set_up_section:
  158|  4.54M|{
  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|  4.54M|#define SECNAMEMAX 30
  165|  4.54M|    size_t secnamelen = strlen(secname);
  166|       |    /* static const char *dprefix = ".debug_"; */
  167|  4.54M|#define DPREFIXLEN 7
  168|  4.54M|    static const char *zprefix = ".zdebug_";
  169|  4.54M|#define ZPREFIXLEN 8
  170|  4.54M|    int havezdebug = FALSE;
  ------------------
  |  |   36|  4.54M|#define FALSE 0
  ------------------
  171|  4.54M|    int namesmatch = FALSE;
  ------------------
  |  |   36|  4.54M|#define FALSE 0
  ------------------
  172|  4.54M|    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|  4.54M|    if (secnamelen >= SECNAMEMAX) {
  ------------------
  |  |  164|  4.54M|#define SECNAMEMAX 30
  ------------------
  |  Branch (182:9): [True: 26.9k, False: 4.52M]
  ------------------
  183|       |        /*  This is not the target section.
  184|       |            our caller will keep looking. */
  185|  26.9k|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|  26.9k|#define DW_DLV_NO_ENTRY -1
  ------------------
  186|  26.9k|    }
  187|  4.52M|    havezdebug = !strncmp(secname,zprefix,ZPREFIXLEN);
  ------------------
  |  |  169|  4.52M|#define ZPREFIXLEN 8
  ------------------
  188|  4.52M|    if (havezdebug) {
  ------------------
  |  Branch (188:9): [True: 2.87M, False: 1.64M]
  ------------------
  189|  2.87M|        postzprefix = secname+ZPREFIXLEN;
  ------------------
  |  |  169|  2.87M|#define ZPREFIXLEN 8
  ------------------
  190|  2.87M|    }
  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|  4.52M|    if (both_strings_nonempty(postzprefix,targname,DPREFIXLEN) &&
  ------------------
  |  |  167|  4.52M|#define DPREFIXLEN 7
  ------------------
  |  Branch (203:9): [True: 2.74M, False: 1.77M]
  ------------------
  204|  2.74M|        !strcmp(postzprefix,targname+DPREFIXLEN)) {
  ------------------
  |  |  167|  2.74M|#define DPREFIXLEN 7
  ------------------
  |  Branch (204:9): [True: 133, False: 2.74M]
  ------------------
  205|       |            /*  zprefix version matches the object section
  206|       |                name so the section is compressed and is
  207|       |                the section this targname applies to. */
  208|    133|        namesmatch = TRUE;
  ------------------
  |  |   33|    133|#define TRUE 1
  ------------------
  209|  4.52M|    } else if (!strcmp(secname,targname)) {
  ------------------
  |  Branch (209:16): [True: 2.59k, False: 4.52M]
  ------------------
  210|  2.59k|        namesmatch = TRUE;
  ------------------
  |  |   33|  2.59k|#define TRUE 1
  ------------------
  211|  4.52M|    } else { /*  Fall to next statement */ }
  212|  4.52M|#undef ZPREFIXLEN
  213|  4.52M|#undef DPREFIXLEN
  214|  4.52M|#undef SECNAMEMAX
  215|  4.52M|    if (!namesmatch) {
  ------------------
  |  Branch (215:9): [True: 4.52M, False: 2.72k]
  ------------------
  216|       |        /*  This is not the target section.
  217|       |            our caller will keep looking. */
  218|  4.52M|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|  4.52M|#define DW_DLV_NO_ENTRY -1
  ------------------
  219|  4.52M|    }
  220|       |
  221|       |    /* SETUP_SECTION. See also BUILDING_SECTIONS, BUILDING_MAP  */
  222|  2.72k|    {
  223|       |        /*  The section name is a match with targname, or
  224|       |            the .zdebug version of targname. */
  225|  2.72k|        int sectionerr = 0;
  226|       |
  227|  2.72k|        sectionerr = add_debug_section_info(dbg,secname,
  228|  2.72k|            sec_standard_name,
  229|  2.72k|            obj_sec_num,
  230|  2.72k|            secdata,
  231|  2.72k|            groupnum_of_sec,
  232|  2.72k|            duperr,emptyerr, have_dwarf,
  233|  2.72k|            havezdebug,err);
  234|  2.72k|        if (sectionerr != DW_DLV_OK) {
  ------------------
  |  |  122|  2.72k|#define DW_DLV_OK        0
  ------------------
  |  Branch (234:13): [True: 43, False: 2.68k]
  ------------------
  235|       |            /* *err is set already */
  236|     43|            return sectionerr;
  237|     43|        }
  238|  2.72k|    }
  239|  2.68k|    return DW_DLV_OK;
  ------------------
  |  |  122|  2.68k|#define DW_DLV_OK        0
  ------------------
  240|  2.72k|}
dwarf_setup_sections.c:both_strings_nonempty:
  127|  4.52M|{
  128|  4.52M|    const char *s3 = 0;
  129|  4.52M|    if (!s1 || !s2) {
  ------------------
  |  Branch (129:9): [True: 1.64M, False: 2.87M]
  |  Branch (129:16): [True: 0, False: 2.87M]
  ------------------
  130|  1.64M|        return FALSE;
  ------------------
  |  |   36|  1.64M|#define FALSE 0
  ------------------
  131|  1.64M|    }
  132|  2.87M|    s3 = s2 + offset;
  133|  2.87M|    if (!s1[0] || !s3[0]) {
  ------------------
  |  Branch (133:9): [True: 7.95k, False: 2.87M]
  |  Branch (133:19): [True: 124k, False: 2.74M]
  ------------------
  134|   132k|        return FALSE;
  ------------------
  |  |   36|   132k|#define FALSE 0
  ------------------
  135|   132k|    }
  136|  2.74M|    return TRUE;
  ------------------
  |  |   33|  2.74M|#define TRUE 1
  ------------------
  137|  2.87M|}
dwarf_setup_sections.c:add_debug_section_info:
   77|  2.72k|{
   78|  2.72k|    unsigned total_entries = dbg->de_debug_sections_total_entries;
   79|  2.72k|    if (secdata->dss_is_in_use) {
  ------------------
  |  Branch (79:9): [True: 43, False: 2.68k]
  ------------------
   80|     43|        *err = duperr;
   81|     43|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     43|#define DW_DLV_ERROR     1
  ------------------
   82|     43|    }
   83|  2.68k|    if (total_entries < DWARF_MAX_DEBUG_SECTIONS) {
  ------------------
  |  |  592|  2.68k|#define DWARF_MAX_DEBUG_SECTIONS 50
  ------------------
  |  Branch (83:9): [True: 2.68k, False: 0]
  ------------------
   84|  2.68k|        struct Dwarf_dbg_sect_s *debug_section =
   85|  2.68k|            &dbg->de_debug_sections[total_entries];
   86|  2.68k|        secdata->dss_is_in_use = TRUE;
  ------------------
  |  |   33|  2.68k|#define TRUE 1
  ------------------
   87|  2.68k|        debug_section->ds_name = name;
   88|  2.68k|        debug_section->ds_number = obj_sec_num;
   89|  2.68k|        debug_section->ds_secdata = secdata;
   90|  2.68k|        debug_section->ds_groupnumber =  groupnum;
   91|  2.68k|        secdata->dss_name = name; /* Actual name from object file. */
   92|  2.68k|        secdata->dss_standard_name = standard_section_name;
   93|  2.68k|        secdata->dss_number = obj_sec_num;
   94|  2.68k|        secdata->dss_zdebug_requires_decompress =
   95|  2.68k|            (Dwarf_Small)havezdebug;
   96|  2.68k|        secdata->dss_computed_mmap_offset = 0;
   97|  2.68k|        secdata->dss_computed_mmap_len = 0;
   98|  2.68k|        secdata->dss_mmap_realarea = 0;
   99|  2.68k|        secdata->dss_was_alloc = FALSE;
  ------------------
  |  |   36|  2.68k|#define FALSE 0
  ------------------
  100|       |        /*  Just gets current global pref */
  101|  2.68k|#ifndef TESTING
  102|  2.68k|        secdata->dss_load_preference = dwarf_set_load_preference(0);
  103|  2.68k|#endif /* TESTING*/
  104|       |        /* We don't yet know about SHF_COMPRESSED */
  105|  2.68k|        debug_section->ds_duperr = duperr;
  106|  2.68k|        debug_section->ds_emptyerr = emptyerr;
  107|  2.68k|        debug_section->ds_have_dwarf = have_dwarf;
  108|  2.68k|        debug_section->ds_have_zdebug = havezdebug;
  109|  2.68k|        ++dbg->de_debug_sections_total_entries;
  110|  2.68k|        return DW_DLV_OK;
  ------------------
  |  |  122|  2.68k|#define DW_DLV_OK        0
  ------------------
  111|  2.68k|    }
  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.68k|}

dwarfstring_constructor:
   65|  4.29k|{
   66|  4.29k|    g->s_data = "";
   67|  4.29k|    g->s_size = 0;
   68|  4.29k|    g->s_avail = 0;
   69|  4.29k|    g->s_malloc = FALSE;
  ------------------
  |  |   36|  4.29k|#define FALSE 0
  ------------------
   70|  4.29k|    return TRUE;
  ------------------
  |  |   33|  4.29k|#define TRUE 1
  ------------------
   71|  4.29k|}
dwarfstring_reset:
  120|    607|{
  121|    607|    if (!g->s_size) {
  ------------------
  |  Branch (121:9): [True: 312, False: 295]
  ------------------
  122|       |        /* In initial condition, nothing to do. */
  123|    312|        return TRUE;
  ------------------
  |  |   33|    312|#define TRUE 1
  ------------------
  124|    312|    }
  125|    295|    g->s_avail   = g->s_size;
  126|    295|    g->s_data[0] = 0;
  127|    295|    return TRUE;
  ------------------
  |  |   33|    295|#define TRUE 1
  ------------------
  128|    607|}
dwarfstring_destructor:
  163|  1.78k|{
  164|  1.78k|    if (g->s_malloc) {
  ------------------
  |  Branch (164:9): [True: 1.16k, False: 616]
  ------------------
  165|  1.16k|        free(g->s_data);
  166|  1.16k|        g->s_data   = 0;
  167|  1.16k|        g->s_malloc = 0;
  168|  1.16k|    }
  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.78k|    dwarfstring_constructor(g);
  173|  1.78k|}
dwarfstring_append_length:
  182|   140k|{
  183|       |    /*  lastpos is the length of characters
  184|       |        without the null-terminator  we call it strlen */
  185|   140k|    size_t lastpos = g->s_size - g->s_avail;
  186|   140k|    int r          = 0;
  187|       |
  188|   140k|    if (!str  || slen ==0) {
  ------------------
  |  Branch (188:9): [True: 0, False: 140k]
  |  Branch (188:18): [True: 48.2k, False: 91.8k]
  ------------------
  189|  48.2k|        return TRUE;
  ------------------
  |  |   33|  48.2k|#define TRUE 1
  ------------------
  190|  48.2k|    }
  191|  91.8k|    if (slen >= g->s_avail) {
  ------------------
  |  Branch (191:9): [True: 32.8k, False: 58.9k]
  ------------------
  192|  32.8k|        size_t newlen = 0;
  193|       |
  194|  32.8k|        newlen = g->s_size + slen+2;
  195|  32.8k|        r = dwarfstring_add_to(g,newlen);
  196|  32.8k|        if (!r) {
  ------------------
  |  Branch (196:13): [True: 0, False: 32.8k]
  ------------------
  197|       |            /* Unable to resize, dare not do anything. */
  198|      0|            return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  199|      0|        }
  200|  32.8k|    }
  201|  91.8k|    memcpy(g->s_data + lastpos,str,slen);
  202|  91.8k|    g->s_avail -= slen;
  203|       |    /*  Adding string terminating null byte.
  204|       |        Space is guaranteed available to do this.*/
  205|  91.8k|    g->s_data[g->s_size - g->s_avail] = 0;
  206|  91.8k|    return TRUE;
  ------------------
  |  |   33|  91.8k|#define TRUE 1
  ------------------
  207|  91.8k|}
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.37k|{
  224|  3.37k|    return g->s_data;
  225|  3.37k|}
dwarfstring_strlen:
  229|  1.54k|{
  230|  1.54k|    return g->s_size - g->s_avail;
  231|  1.54k|}
dwarfstring_append_printf_s:
  276|     91|{
  277|     91|    size_t stringlenszt = 0;
  278|     91|    size_t next = 0;
  279|     91|    long val = 0;
  280|     91|    char *endptr = 0;
  281|     91|    const char *numptr = 0;
  282|       |    /* was %[-]fixedlen.  Zero means no len provided. */
  283|     91|    size_t fixedlen = 0;
  284|       |    /* was %-, nonzero means left-justify */
  285|     91|    long leftjustify = 0;
  286|     91|    size_t prefixlen = 0;
  287|     91|    int res = 0;
  288|       |
  289|     91|    if (!s) {
  ------------------
  |  Branch (289:9): [True: 0, False: 91]
  ------------------
  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|     91|    stringlenszt = strlen(s);
  295|     91|    if (!format) {
  ------------------
  |  Branch (295:9): [True: 0, False: 91]
  ------------------
  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|  3.96k|    while (format[next] && format[next] != '%') {
  ------------------
  |  Branch (300:12): [True: 3.96k, False: 0]
  |  Branch (300:28): [True: 3.87k, False: 91]
  ------------------
  301|  3.87k|        ++next;
  302|  3.87k|        ++prefixlen;
  303|  3.87k|    }
  304|     91|    if (prefixlen) {
  ------------------
  |  Branch (304:9): [True: 91, False: 0]
  ------------------
  305|     91|        dwarfstring_append_length(data,format,prefixlen);
  306|       |        /*  Fall through whether return value TRUE or FALSE */
  307|     91|    }
  308|     91|    if (format[next] != '%') {
  ------------------
  |  Branch (308:9): [True: 0, False: 91]
  ------------------
  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|     91|    next++;
  315|     91|    if (!format[next]) {
  ------------------
  |  Branch (315:9): [True: 0, False: 91]
  ------------------
  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|     91|    if (format[next] == ' ') {
  ------------------
  |  Branch (320:9): [True: 0, False: 91]
  ------------------
  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|     91|    if (format[next] == '-') {
  ------------------
  |  Branch (326:9): [True: 0, False: 91]
  ------------------
  327|      0|        leftjustify++;
  328|      0|        next++;
  329|      0|    }
  330|     91|    numptr = format+next;
  331|     91|    val = strtol(numptr,&endptr,10);
  332|     91|    if ( endptr != numptr) {
  ------------------
  |  Branch (332:10): [True: 0, False: 91]
  ------------------
  333|      0|        fixedlen = val;
  334|      0|    }
  335|     91|    next = (endptr - format);
  336|     91|    if (format[next] != 's') {
  ------------------
  |  Branch (336:9): [True: 0, False: 91]
  ------------------
  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|     91|    next++;
  342|       |
  343|     91|    if (fixedlen && (stringlenszt >= fixedlen)) {
  ------------------
  |  Branch (343:9): [True: 0, False: 91]
  |  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|     91|    if (leftjustify) {
  ------------------
  |  Branch (348:9): [True: 0, False: 91]
  ------------------
  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|     91|    } else {
  358|     91|        if (fixedlen && fixedlen < stringlenszt) {
  ------------------
  |  Branch (358:13): [True: 0, False: 91]
  |  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|     91|        } else {
  364|     91|            if (fixedlen) {
  ------------------
  |  Branch (364:17): [True: 0, False: 91]
  ------------------
  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|     91|            res = dwarfstring_append_length(data,s,stringlenszt);
  373|     91|            if (res == FALSE) {
  ------------------
  |  |   36|     91|#define FALSE 0
  ------------------
  |  Branch (373:17): [True: 0, False: 91]
  ------------------
  374|      0|                return res;
  375|      0|            }
  376|     91|        }
  377|     91|    }
  378|     91|    if (!format[next]) {
  ------------------
  |  Branch (378:9): [True: 0, False: 91]
  ------------------
  379|      0|        return TRUE;
  ------------------
  |  |   33|      0|#define TRUE 1
  ------------------
  380|      0|    }
  381|     91|    {
  382|     91|        char * startpt = format+next;
  383|     91|        size_t suffixlen = strlen(startpt);
  384|       |
  385|     91|        res = dwarfstring_append_length(data,startpt,suffixlen);
  386|     91|    }
  387|     91|    return res;
  388|     91|}
dwarfstring_append_printf_u:
  690|  47.8k|{
  691|       |
  692|  47.8k|    size_t next = 0;
  693|  47.8k|    long val = 0;
  694|  47.8k|    char *endptr = 0;
  695|  47.8k|    const char *numptr = 0;
  696|  47.8k|    size_t fixedlen = 0;
  697|  47.8k|    int leadingzero = 0;
  698|  47.8k|    int lcount = 0;
  699|  47.8k|    int ucount = 0;
  700|  47.8k|    int dcount = 0;
  701|  47.8k|    int xcount = 0;
  702|  47.8k|    int Xcount = 0;
  703|  47.8k|    char *ctable = 0;
  704|  47.8k|    size_t divisor = 0;
  705|  47.8k|    size_t prefixlen = 0;
  706|       |
  707|  47.8k|    if (!format) {
  ------------------
  |  Branch (707:9): [True: 0, False: 47.8k]
  ------------------
  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|  57.7k|    while (format[next] && format[next] != '%') {
  ------------------
  |  Branch (712:12): [True: 57.7k, False: 0]
  |  Branch (712:28): [True: 9.83k, False: 47.8k]
  ------------------
  713|  9.83k|        ++next;
  714|  9.83k|        ++prefixlen;
  715|  9.83k|    }
  716|  47.8k|    dwarfstring_append_length(data,format,prefixlen);
  717|  47.8k|    if (format[next] != '%') {
  ------------------
  |  Branch (717:9): [True: 0, False: 47.8k]
  ------------------
  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|  47.8k|    next++;
  724|  47.8k|    if (!format[next]) {
  ------------------
  |  Branch (724:9): [True: 0, False: 47.8k]
  ------------------
  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|  47.8k|    if (format[next] == ' ') {
  ------------------
  |  Branch (729:9): [True: 0, False: 47.8k]
  ------------------
  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|  47.8k|    if (format[next] == '-') {
  ------------------
  |  Branch (734:9): [True: 0, False: 47.8k]
  ------------------
  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|  47.8k|    if (format[next] == '0') {
  ------------------
  |  Branch (740:9): [True: 47.6k, False: 259]
  ------------------
  741|  47.6k|        leadingzero = 1;
  742|  47.6k|        next++;
  743|  47.6k|    }
  744|  47.8k|    numptr = format+next;
  745|  47.8k|    val = strtol(numptr,&endptr,10);
  746|  47.8k|    if ( endptr != numptr) {
  ------------------
  |  Branch (746:10): [True: 47.6k, False: 259]
  ------------------
  747|  47.6k|        fixedlen = val;
  748|  47.6k|    }
  749|  47.8k|    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|  47.8k|    if (format[next] == 'l') {
  ------------------
  |  Branch (766:9): [True: 28, False: 47.8k]
  ------------------
  767|     28|        lcount++;
  768|     28|        next++;
  769|     28|    }
  770|  47.8k|    if (format[next] == 'l') {
  ------------------
  |  Branch (770:9): [True: 0, False: 47.8k]
  ------------------
  771|      0|        lcount++;
  772|      0|        next++;
  773|      0|    }
  774|  47.8k|    if (format[next] == 'l') {
  ------------------
  |  Branch (774:9): [True: 0, False: 47.8k]
  ------------------
  775|      0|        lcount++;
  776|      0|        next++;
  777|      0|    }
  778|  47.8k|    if (format[next] == 'u') {
  ------------------
  |  Branch (778:9): [True: 231, False: 47.6k]
  ------------------
  779|    231|        ucount++;
  780|    231|        next++;
  781|    231|    }
  782|  47.8k|    if (format[next] == 'd') {
  ------------------
  |  Branch (782:9): [True: 0, False: 47.8k]
  ------------------
  783|      0|        dcount++;
  784|      0|        next++;
  785|      0|    }
  786|  47.8k|    if (format[next] == 'x') {
  ------------------
  |  Branch (786:9): [True: 47.6k, False: 231]
  ------------------
  787|  47.6k|        xcount++;
  788|  47.6k|        next++;
  789|  47.6k|    }
  790|  47.8k|    if (format[next] == 'X') {
  ------------------
  |  Branch (790:9): [True: 0, False: 47.8k]
  ------------------
  791|      0|        Xcount++;
  792|      0|        next++;
  793|      0|    }
  794|  47.8k|    if (format[next] == 's') {
  ------------------
  |  Branch (794:9): [True: 0, False: 47.8k]
  ------------------
  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|  47.8k|    if ( (Xcount +xcount+dcount+ucount) > 1) {
  ------------------
  |  Branch (800:10): [True: 0, False: 47.8k]
  ------------------
  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|  47.8k|    if ( (Xcount +xcount+dcount+ucount) == 0) {
  ------------------
  |  Branch (806:10): [True: 0, False: 47.8k]
  ------------------
  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|  47.8k|    if (lcount > 2) {
  ------------------
  |  Branch (812:9): [True: 0, False: 47.8k]
  ------------------
  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|  47.8k|    if (dcount > 0) {
  ------------------
  |  Branch (818:9): [True: 0, False: 47.8k]
  ------------------
  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|  47.8k|    if (ucount) {
  ------------------
  |  Branch (824:9): [True: 231, False: 47.6k]
  ------------------
  825|    231|        divisor = 10;
  826|    231|        ctable = dtable;
  827|  47.6k|    } else {
  828|  47.6k|        divisor = 16;
  829|  47.6k|        if (xcount) {
  ------------------
  |  Branch (829:13): [True: 47.6k, False: 0]
  ------------------
  830|  47.6k|            ctable = xtable;
  831|  47.6k|        } else {
  832|      0|            ctable = Xtable;
  833|      0|        }
  834|  47.6k|    }
  835|  47.8k|    {
  836|  47.8k|        char digbuf[36];
  837|  47.8k|        char *digptr = 0;
  838|  47.8k|        unsigned digcharlen = 0;
  839|  47.8k|        dwarfstring_u remaining = v;
  840|       |
  841|  47.8k|        if (divisor == 16) {
  ------------------
  |  Branch (841:13): [True: 47.6k, False: 231]
  ------------------
  842|  47.6k|            digptr = digbuf+sizeof(digbuf) -1;
  843|  54.2k|            for ( ;; ) {
  844|  54.2k|                dwarfstring_u dig;
  845|  54.2k|                dig = remaining & 0xf;
  846|  54.2k|                remaining = remaining >> 4;
  847|  54.2k|                *digptr = ctable[dig];
  848|  54.2k|                ++digcharlen;
  849|  54.2k|                if (!remaining) {
  ------------------
  |  Branch (849:21): [True: 47.6k, False: 6.62k]
  ------------------
  850|  47.6k|                    break;
  851|  47.6k|                }
  852|  6.62k|                --digptr;
  853|  6.62k|            }
  854|  47.6k|        } else {
  855|    231|            digptr = digbuf+sizeof(digbuf) -1;
  856|    231|            *digptr = 0;
  857|    231|            --digptr;
  858|  1.46k|            for ( ;; ) {
  859|  1.46k|                dwarfstring_u dig;
  860|  1.46k|                dig = remaining % divisor;
  861|  1.46k|                remaining /= divisor;
  862|  1.46k|                *digptr = ctable[dig];
  863|  1.46k|                ++digcharlen;
  864|  1.46k|                if (!remaining) {
  ------------------
  |  Branch (864:21): [True: 231, False: 1.23k]
  ------------------
  865|    231|                    break;
  866|    231|                }
  867|  1.23k|                --digptr;
  868|  1.23k|            }
  869|    231|        }
  870|  47.8k|        if (fixedlen <= digcharlen) {
  ------------------
  |  Branch (870:13): [True: 6.81k, False: 41.0k]
  ------------------
  871|  6.81k|            dwarfstring_append_length(data,digptr,digcharlen);
  872|  41.0k|        } else {
  873|  41.0k|            if (!leadingzero) {
  ------------------
  |  Branch (873:17): [True: 0, False: 41.0k]
  ------------------
  874|      0|                size_t justcount = fixedlen - digcharlen;
  875|      0|                _dwarfstring_append_spaces(data,justcount);
  876|      0|                dwarfstring_append_length(data,digptr,digcharlen);
  877|  41.0k|            } else {
  878|  41.0k|                size_t prefixcount = fixedlen - digcharlen;
  879|  41.0k|                _dwarfstring_append_zeros(data,prefixcount);
  880|  41.0k|                dwarfstring_append_length(data,digptr,digcharlen);
  881|  41.0k|            }
  882|  41.0k|        }
  883|  47.8k|    }
  884|  47.8k|    if (format[next]) {
  ------------------
  |  Branch (884:9): [True: 259, False: 47.6k]
  ------------------
  885|    259|        size_t trailinglen = strlen(format+next);
  886|    259|        dwarfstring_append_length(data,format+next,trailinglen);
  887|    259|    }
  888|  47.8k|    return FALSE;
  ------------------
  |  |   36|  47.8k|#define FALSE 0
  ------------------
  889|  47.8k|}
dwarf_string.c:dwarfstring_add_to:
   78|  32.8k|{
   79|  32.8k|    char *b          = 0;
   80|       |    /*  s_size - s_avail is the string without counting
   81|       |        the null following the string. So, is  strlen()  */
   82|  32.8k|    size_t lastpos   = g->s_size - g->s_avail;
   83|  32.8k|    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|  32.8k|    if (malloclen < minimumnewlen) {
  ------------------
  |  Branch (87:9): [True: 1.07k, False: 31.7k]
  ------------------
   88|  1.07k|        malloclen = minimumnewlen;
   89|  1.07k|    }
   90|       |    /*  Not zeroing the new buffer block. */
   91|  32.8k|    b = malloc(malloclen);
   92|  32.8k|    if (!b) {
  ------------------
  |  Branch (92:9): [True: 0, False: 32.8k]
  ------------------
   93|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
   94|      0|    }
   95|  32.8k|    if (lastpos > 0) {
  ------------------
  |  Branch (95:9): [True: 31.5k, False: 1.29k]
  ------------------
   96|       |        /* Copying the non-null bytes in s_data. */
   97|  31.5k|        memcpy(b,g->s_data,lastpos);
   98|  31.5k|    }
   99|  32.8k|    if (g->s_malloc) {
  ------------------
  |  Branch (99:9): [True: 31.6k, False: 1.16k]
  ------------------
  100|  31.6k|        free(g->s_data);
  101|  31.6k|        g->s_data = 0;
  102|  31.6k|    }
  103|  32.8k|    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|  32.8k|    g->s_data[lastpos] = 0;
  112|  32.8k|    g->s_size = newlen;
  113|  32.8k|    g->s_avail = newlen - lastpos;
  114|  32.8k|    g->s_malloc = TRUE;
  ------------------
  |  |   33|  32.8k|#define TRUE 1
  ------------------
  115|  32.8k|    return TRUE;
  ------------------
  |  |   33|  32.8k|#define TRUE 1
  ------------------
  116|  32.8k|}
dwarf_string.c:_dwarfstring_append_zeros:
  255|  41.0k|{
  256|  41.0k|    int res = 0;
  257|  41.0k|    static char zeros[] = {
  258|  41.0k|        "0000000000000000000000000000000000000000"};
  259|  41.0k|    size_t charct = sizeof(zeros)-1;
  260|       |
  261|  41.0k|    while (l > charct) {
  ------------------
  |  Branch (261:12): [True: 0, False: 41.0k]
  ------------------
  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|  41.0k|    dwarfstring_append_length(data,zeros,l);
  270|  41.0k|    return res;
  271|  41.0k|}

_dwarf_initialize_search_hash:
  183|  5.53k|{
  184|  5.53k|    unsigned long prime_to_use = primes[0];
  185|  5.53k|    unsigned entry_index = 0;
  186|  5.53k|    unsigned k = 0;
  187|  5.53k|    struct hs_base *base = 0;
  188|       |
  189|  5.53k|    base = *(struct hs_base **)treeptr;
  190|  5.53k|    if (base) {
  ------------------
  |  Branch (190:9): [True: 0, False: 5.53k]
  ------------------
  191|       |        /* initialized already. */
  192|      0|        return base ;
  193|      0|    }
  194|  5.53k|    base = calloc(1, sizeof(struct hs_base));
  195|  5.53k|    if (!base) {
  ------------------
  |  Branch (195:9): [True: 0, False: 5.53k]
  ------------------
  196|       |        /* Out of memory. */
  197|      0|        return NULL ;
  198|      0|    }
  199|  5.53k|    prime_to_use = primes[0];
  200|  6.39k|    while(size_estimate && (size_estimate > prime_to_use)) {
  ------------------
  |  Branch (200:11): [True: 6.35k, False: 39]
  |  Branch (200:28): [True: 866, False: 5.49k]
  ------------------
  201|    866|        k = k +1;
  202|    866|        prime_to_use = primes[k];
  203|    866|        if (prime_to_use == 0) {
  ------------------
  |  Branch (203:13): [True: 0, False: 866]
  ------------------
  204|       |            /* Oops. Too large. */
  205|      0|            free(base);
  206|      0|            return NULL;
  207|      0|        }
  208|    866|        entry_index = k;
  209|    866|    }
  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.53k|    base->tablesize_ = prime_to_use;
  217|  5.53k|    base->allowed_fill_ = calculate_allowed_fill(allowed_fill_percent,
  218|  5.53k|        prime_to_use);
  219|  5.53k|    if (base->allowed_fill_< (base->tablesize_/2)) {
  ------------------
  |  Branch (219:9): [True: 0, False: 5.53k]
  ------------------
  220|      0|        free(base);
  221|       |        /* Oops. We are in trouble. Coding mistake here.  */
  222|      0|        return NULL;
  223|      0|    }
  224|  5.53k|    base->record_count_ = 0;
  225|  5.53k|    base->tablesize_entry_index_ = entry_index;
  226|       |    /*  hashtab_ is an array of hs_entry,
  227|       |        indexes 0 through tablesize_ -1. */
  228|  5.53k|    base->hashfunc_ = hashfunc;
  229|  5.53k|    base->hashtab_ = calloc(base->tablesize_,
  230|  5.53k|        sizeof(struct ts_entry));
  231|  5.53k|    if (!base->hashtab_) {
  ------------------
  |  Branch (231:9): [True: 0, False: 5.53k]
  ------------------
  232|      0|        free(base);
  233|      0|        return NULL;
  234|      0|    }
  235|  5.53k|    *treeptr = base;
  236|  5.53k|    return base;
  237|  5.53k|}
_dwarf_tsearch:
  520|   118k|{
  521|   118k|    struct hs_base **rootp = (struct hs_base **)headin;
  522|   118k|    struct hs_base *head = *rootp;
  523|   118k|    struct ts_entry *r = 0;
  524|   118k|    int inserted = 0;
  525|       |    /* nullme won't be set. */
  526|   118k|    struct ts_entry *nullme = 0;
  527|       |
  528|   118k|    if (!head) {
  ------------------
  |  Branch (528:9): [True: 0, False: 118k]
  ------------------
  529|       |        /* something is wrong here, not initialized. */
  530|      0|        return NULL;
  531|      0|    }
  532|   118k|    r = _tsearch_inner(key,head,compar,want_insert,&inserted,&nullme);
  533|   118k|    if (!r) {
  ------------------
  |  Branch (533:9): [True: 0, False: 118k]
  ------------------
  534|      0|        return NULL;
  535|      0|    }
  536|   118k|    return (void *)&(r->keyptr);
  537|   118k|}
_dwarf_tfind:
  543|   329k|{
  544|       |    /*  Nothing will change, but we discard const
  545|       |        so we can use tsearch_inner(). */
  546|   329k|    struct hs_base **proot = (struct hs_base **)rootp;
  547|   329k|    struct hs_base *head = *proot;
  548|   329k|    struct ts_entry *r = 0;
  549|       |    /* inserted flag won't be set. */
  550|   329k|    int inserted = 0;
  551|       |    /* nullme won't be set. */
  552|   329k|    struct ts_entry * nullme = 0;
  553|       |    /* Get to actual tree. */
  554|       |
  555|   329k|    if (!head) {
  ------------------
  |  Branch (555:9): [True: 0, False: 329k]
  ------------------
  556|      0|        return NULL;
  557|      0|    }
  558|       |
  559|   329k|    r = _tsearch_inner(key,head,compar,only_find,&inserted,&nullme);
  560|   329k|    if (!r) {
  ------------------
  |  Branch (560:9): [True: 222k, False: 107k]
  ------------------
  561|   222k|        return NULL;
  562|   222k|    }
  563|   107k|    return (void *)(&(r->keyptr));
  564|   329k|}
_dwarf_tdelete:
  572|     62|{
  573|     62|    struct hs_base **proot = (struct hs_base **)rootp;
  574|     62|    struct hs_base *head = *proot;
  575|     62|    struct ts_entry *found = 0;
  576|       |    /* inserted flag won't be set. */
  577|     62|    int inserted = 0;
  578|     62|    struct ts_entry * parentp = 0;
  579|       |
  580|     62|    if (!head) {
  ------------------
  |  Branch (580:9): [True: 0, False: 62]
  ------------------
  581|      0|        return NULL;
  582|      0|    }
  583|       |
  584|     62|    found = _tsearch_inner(key,head,compar,want_delete,&inserted,
  585|     62|        &parentp);
  586|     62|    if (found) {
  ------------------
  |  Branch (586:9): [True: 62, False: 0]
  ------------------
  587|     62|        if (parentp) {
  ------------------
  |  Branch (587:13): [True: 0, False: 62]
  ------------------
  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|     62|        if (found->next) {
  ------------------
  |  Branch (598:13): [True: 0, False: 62]
  ------------------
  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|     62|        } 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|     62|            head->record_count_--;
  614|     62|            found->next = 0;
  615|     62|            found->keyptr = 0;
  616|     62|            found->entryused = 0;
  617|     62|            return NULL;
  618|     62|        }
  619|     62|    }
  620|      0|    return NULL;
  621|     62|}
_dwarf_twalk:
  648|    241|{
  649|    241|    const struct hs_base *head = (const struct hs_base *)rootp;
  650|    241|    struct ts_entry *root = 0;
  651|    241|    if (!head) {
  ------------------
  |  Branch (651:9): [True: 32, False: 209]
  ------------------
  652|     32|        return;
  653|     32|    }
  654|    209|    root = head->hashtab_;
  655|       |    /* Get to actual tree. */
  656|    209|    _dwarf_twalk_inner(head,root,action);
  657|    209|}
_dwarf_tdestroy:
  702|  6.77k|{
  703|  6.77k|    struct hs_base *head = (struct hs_base *)rootp;
  704|  6.77k|    struct ts_entry *root = 0;
  705|  6.77k|    if (!head) {
  ------------------
  |  Branch (705:9): [True: 1.23k, False: 5.53k]
  ------------------
  706|  1.23k|        return;
  707|  1.23k|    }
  708|  5.53k|    root = head->hashtab_;
  709|  5.53k|    _dwarf_tdestroy_inner(head,free_node);
  710|  5.53k|    free(root);
  711|  5.53k|    free(head);
  712|  5.53k|}
dwarf_tsearchhash.c:calculate_allowed_fill:
  159|  5.54k|{
  160|  5.54k|    unsigned long v = 0;
  161|  5.54k|    if (ct < 100000) {
  ------------------
  |  Branch (161:9): [True: 5.54k, False: 0]
  ------------------
  162|  5.54k|        unsigned long v2 = (ct *fill_percent)/100;
  163|  5.54k|        return v2;
  164|  5.54k|    }
  165|      0|    v = (ct /100)*fill_percent;
  166|      0|    return v;
  167|  5.54k|}
dwarf_tsearchhash.c:_tsearch_inner:
  447|   538k|{
  448|   538k|    struct ts_entry *s =0;
  449|   538k|    struct ts_entry *c =0;
  450|   538k|    struct ts_entry *q =0;
  451|   538k|    int kc = 0;
  452|   538k|    DW_TSHASHTYPE keyhash =  0;
  ------------------
  |  |   54|   538k|#define DW_TSHASHTYPE uintptr_t
  ------------------
  453|   538k|    DW_TSHASHTYPE hindx = 0;
  ------------------
  |  |   54|   538k|#define DW_TSHASHTYPE uintptr_t
  ------------------
  454|   538k|    struct ts_entry *chain_parent = 0;
  455|       |
  456|   538k|    if (! head->hashfunc_) {
  ------------------
  |  Branch (456:9): [True: 0, False: 538k]
  ------------------
  457|       |        /* Not fully initialized. */
  458|      0|        return NULL;
  459|      0|    }
  460|   538k|    keyhash =  head->hashfunc_(key);
  461|   538k|    if (intent == want_insert) {
  ------------------
  |  Branch (461:9): [True: 208k, False: 329k]
  ------------------
  462|   208k|        if (head->record_count_ > head->allowed_fill_) {
  ------------------
  |  Branch (462:13): [True: 12, False: 208k]
  ------------------
  463|     12|            resize_table(head,compar);
  464|     12|        }
  465|   208k|    }
  466|   538k|    hindx = keyhash%head->tablesize_;
  467|   538k|    s = &head->hashtab_[hindx];
  468|   538k|    if (!s->entryused) {
  ------------------
  |  Branch (468:9): [True: 430k, False: 107k]
  ------------------
  469|       |        /* Not found. */
  470|   430k|        if (intent != want_insert) {
  ------------------
  |  Branch (470:13): [True: 222k, False: 208k]
  ------------------
  471|   222k|            return NULL;
  472|   222k|        }
  473|       |        /*  Insert in the base hash table in an
  474|       |            empty slot. */
  475|   208k|        *inserted = 1;
  476|   208k|        head->record_count_++;
  477|   208k|        s->keyptr = (const void *)key;
  478|   208k|        s->entryused = 1;
  479|   208k|        s->next = 0;
  480|   208k|        return s;
  481|   430k|    }
  482|   107k|    kc = compar(key,s->keyptr);
  483|   107k|    if (kc == 0 ) {
  ------------------
  |  Branch (483:9): [True: 107k, False: 0]
  ------------------
  484|       |        /* found! */
  485|   107k|        if (intent == want_delete) {
  ------------------
  |  Branch (485:13): [True: 62, False: 107k]
  ------------------
  486|     62|            *owner_ptr = 0;
  487|     62|        }
  488|   107k|        return (void *)&(s->keyptr);
  489|   107k|    }
  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|   100k|        for ( ; ix < tsize; ix++,p++) {
  ------------------
  |  Branch (393:17): [True: 100k, False: 12]
  ------------------
  394|   100k|            int inserted = 0;
  395|   100k|            struct ts_entry*n = 0;
  396|   100k|            if (fillnewfail) {
  ------------------
  |  Branch (396:17): [True: 0, False: 100k]
  ------------------
  397|      0|                break;
  398|      0|            }
  399|   100k|            if (p->keyptr) {
  ------------------
  |  Branch (399:17): [True: 90.4k, False: 10.0k]
  ------------------
  400|  90.4k|                _tsearch_inner(p->keyptr,
  401|  90.4k|                    &newhead,compar,
  402|  90.4k|                    want_insert,
  403|  90.4k|                    &inserted,
  404|  90.4k|                    0);
  405|  90.4k|                if (!inserted) {
  ------------------
  |  Branch (405:21): [True: 0, False: 90.4k]
  ------------------
  406|      0|                    fillnewfail = 1;
  407|      0|                    break;
  408|      0|                }
  409|  90.4k|            }
  410|   100k|            for (n = p->next; n ; n = n->next) {
  ------------------
  |  Branch (410:31): [True: 0, False: 100k]
  ------------------
  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|   100k|        }
  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|    209|{
  630|    209|    unsigned long ix = 0;
  631|    209|    int depth = 0;
  632|    209|    unsigned long tsize = h->tablesize_;
  633|   114k|    for ( ; ix < tsize; ix++,p++) {
  ------------------
  |  Branch (633:13): [True: 113k, False: 209]
  ------------------
  634|   113k|        struct ts_entry*n = 0;
  635|   113k|        if (p->keyptr) {
  ------------------
  |  Branch (635:13): [True: 294, False: 113k]
  ------------------
  636|    294|            action((void *)(&(p->keyptr)),dwarf_leaf,depth);
  637|    294|        }
  638|   113k|        for (n = p->next; n ; n = n->next) {
  ------------------
  |  Branch (638:27): [True: 0, False: 113k]
  ------------------
  639|      0|            action((void *)(&(n->keyptr)),dwarf_leaf,depth);
  640|      0|        }
  641|   113k|    }
  642|    209|}
dwarf_tsearchhash.c:_dwarf_tdestroy_inner:
  662|  5.54k|{
  663|  5.54k|    unsigned long ix = 0;
  664|  5.54k|    unsigned long tsize = h->tablesize_;
  665|  5.54k|    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.73M|    for ( ; ix < tsize; ix++,p++) {
  ------------------
  |  Branch (671:13): [True: 6.73M, False: 5.54k]
  ------------------
  672|  6.73M|        struct ts_entry*n = 0;
  673|  6.73M|        struct ts_entry*prev = 0;
  674|  6.73M|        if (p->keyptr && p->entryused) {
  ------------------
  |  Branch (674:13): [True: 208k, False: 6.52M]
  |  Branch (674:26): [True: 208k, False: 0]
  ------------------
  675|   208k|            if (free_node) {
  ------------------
  |  Branch (675:17): [True: 118k, False: 90.4k]
  ------------------
  676|   118k|                free_node((void *)(p->keyptr));
  677|   118k|            }
  678|   208k|            --h->record_count_;
  679|   208k|        }
  680|       |        /* Now walk and free up the chain entries. */
  681|  6.73M|        for (n = p->next; n ; ) {
  ------------------
  |  Branch (681:27): [True: 0, False: 6.73M]
  ------------------
  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.73M|    }
  691|  5.54k|}

_dwarf_check_string_valid:
 1145|    203|{
 1146|    203|    Dwarf_Small *start = areaptr;
 1147|    203|    Dwarf_Small *p = strptr;
 1148|    203|    Dwarf_Small *end = areaendptr;
 1149|       |
 1150|    203|    if (p < start) {
  ------------------
  |  Branch (1150:9): [True: 0, False: 203]
  ------------------
 1151|      0|        _dwarf_error(dbg,error,suggested_error);
 1152|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1153|      0|    }
 1154|    203|    if (p >= end) {
  ------------------
  |  Branch (1154:9): [True: 0, False: 203]
  ------------------
 1155|      0|        _dwarf_error(dbg,error,suggested_error);
 1156|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1157|      0|    }
 1158|    203|    if (dbg->de_assume_string_in_bounds) {
  ------------------
  |  Branch (1158:9): [True: 0, False: 203]
  ------------------
 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|  8.62k|    while (p < end) {
  ------------------
  |  Branch (1163:12): [True: 8.61k, False: 6]
  ------------------
 1164|  8.61k|        if (*p == 0) {
  ------------------
  |  Branch (1164:13): [True: 197, False: 8.42k]
  ------------------
 1165|    197|            return DW_DLV_OK;
  ------------------
  |  |  122|    197|#define DW_DLV_OK        0
  ------------------
 1166|    197|        }
 1167|  8.42k|        ++p;
 1168|  8.42k|    }
 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|    203|}

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

