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

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

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

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

_dwarf_load_elf_symtab_symbols:
 1008|  2.66k|{
 1009|  2.66k|    int res = 0;
 1010|  2.66k|    struct generic_symentry *gsym = 0;
 1011|  2.66k|    Dwarf_Unsigned count = 0;
 1012|  2.66k|    Dwarf_Unsigned secnum = ep->f_symtab_sect_index;
 1013|  2.66k|    struct generic_shdr * psh = 0;
 1014|       |
 1015|  2.66k|    if (!secnum) {
  ------------------
  |  Branch (1015:9): [True: 2.59k, False: 62]
  ------------------
 1016|  2.59k|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|  2.59k|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1017|  2.59k|    }
 1018|     62|    psh = ep->f_shdr + secnum;
 1019|     62|    if (psh->gh_size > ep->f_filesize) {
  ------------------
  |  Branch (1019:9): [True: 0, False: 62]
  ------------------
 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|     62|    res = _dwarf_generic_elf_load_symbols(ep,
 1024|     62|        secnum,
 1025|     62|        psh,
 1026|     62|        &gsym,
 1027|     62|        &count,errcode);
 1028|     62|    if (res == DW_DLV_OK) {
  ------------------
  |  |   59|     62|#define DW_DLV_OK         0
  ------------------
  |  Branch (1028:9): [True: 44, False: 18]
  ------------------
 1029|     44|        ep->f_symtab = gsym;
 1030|     44|        ep->f_loc_symtab.g_count = count;
 1031|     44|    }
 1032|     62|    return res;
 1033|     62|}
_dwarf_load_elf_symstr:
 1214|  2.75k|{
 1215|  2.75k|    struct generic_shdr *strpsh = 0;
 1216|  2.75k|    int res = 0;
 1217|  2.75k|    Dwarf_Unsigned strsectindex  =0;
 1218|  2.75k|    Dwarf_Unsigned strsectlength = 0;
 1219|  2.75k|    Dwarf_Unsigned flags = 0;
 1220|       |
 1221|  2.75k|    if (!ep->f_symtab_sect_strings_sect_index) {
  ------------------
  |  Branch (1221:9): [True: 2.53k, False: 216]
  ------------------
 1222|  2.53k|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|  2.53k|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1223|  2.53k|    }
 1224|    216|    strsectindex = ep->f_symtab_sect_strings_sect_index;
 1225|    216|    strsectlength = ep->f_symtab_sect_strings_max;
 1226|    216|    strpsh = ep->f_shdr + strsectindex;
 1227|    216|    if (strsectindex == ep->f_elf_shstrings_index) {
  ------------------
  |  Branch (1227:9): [True: 63, False: 153]
  ------------------
 1228|       |        /*  content loaded already by
 1229|       |            _dwarf_elf_load_sectstrings() as
 1230|       |            they are the same section number. */
 1231|     63|        ep->f_symtab_sect_strings_sect_index = strpsh->gh_secnum;
 1232|     63|        ep->f_symtab_sect_strings_max = ep->f_elf_shstrings_max;
 1233|     63|        ep->f_symtab_sect_strings = strpsh->gh_content;
 1234|     63|        return DW_DLV_OK;
  ------------------
  |  |   59|     63|#define DW_DLV_OK         0
  ------------------
 1235|     63|    }
 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|    153|    if (strpsh->gh_sht_group_array ||
  ------------------
  |  Branch (1240:9): [True: 1, False: 152]
  ------------------
 1241|    152|        strpsh->gh_sht_group_array_count ||
  ------------------
  |  Branch (1241:9): [True: 0, False: 152]
  ------------------
 1242|    152|        strpsh->gh_content) {
  ------------------
  |  Branch (1242:9): [True: 0, False: 152]
  ------------------
 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|    152|    if (strsectlength > ep->f_filesize ||
  ------------------
  |  Branch (1249:9): [True: 0, False: 152]
  ------------------
 1250|    152|        strpsh->gh_offset >ep->f_filesize ||
  ------------------
  |  Branch (1250:9): [True: 80, False: 72]
  ------------------
 1251|     72|        (strsectlength + strpsh->gh_offset) >
  ------------------
  |  Branch (1251:9): [True: 10, False: 62]
  ------------------
 1252|     90|            ep->f_filesize) {
 1253|     90|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|     90|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1254|     90|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     90|#define DW_DLV_ERROR      1
  ------------------
 1255|     90|    }
 1256|     62|    if (ep->f_symtab_sect_strings_sect_index ==
  ------------------
  |  Branch (1256:9): [True: 0, False: 62]
  ------------------
 1257|     62|        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|     62|    ep->f_symtab_sect_strings = calloc(1,strsectlength+1);
 1263|     62|    flags = strpsh->gh_flags;
 1264|     62|    if (!ep->f_symtab_sect_strings) {
  ------------------
  |  Branch (1264:9): [True: 0, False: 62]
  ------------------
 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|     62|    strpsh->gh_load_type = Dwarf_Alloc_Malloc;
 1272|     62|    res = RRMOA(ep->f_fd,ep->f_symtab_sect_strings,
  ------------------
  |  |   65|     62|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     62|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1273|     62|        strpsh->gh_offset,
 1274|     62|        strsectlength,
 1275|     62|        ep->f_filesize,errcode);
 1276|     62|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     62|#define DW_DLV_OK         0
  ------------------
  |  Branch (1276:9): [True: 1, False: 61]
  ------------------
 1277|      1|        free(ep->f_symtab_sect_strings);
 1278|      1|        ep->f_symtab_sect_strings = 0;
 1279|      1|        return res;
 1280|      1|    }
 1281|     61|    strpsh->gh_content = ep->f_symtab_sect_strings;
 1282|     61|    strpsh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|     61|#define TRUE 1
  ------------------
 1283|     61|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|     61|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (1283:9): [True: 2, False: 59]
  ------------------
 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|     59|    return DW_DLV_OK;
  ------------------
  |  |   59|     59|#define DW_DLV_OK         0
  ------------------
 1302|     61|}
_dwarf_load_elf_relx:
 1796|  35.6k|{
 1797|  35.6k|    struct generic_shdr *gshdr = 0;
 1798|  35.6k|    Dwarf_Unsigned seccount = 0;
 1799|  35.6k|    unsigned offsetsize = 0;
 1800|  35.6k|    struct generic_rela *grp = 0;
 1801|  35.6k|    Dwarf_Unsigned count_read = 0;
 1802|  35.6k|    int res = 0;
 1803|  35.6k|    unsigned oksec = 0;
 1804|  35.6k|    enum RelocOffsetSize localoffsize = RelocOffset32;
 1805|       |
 1806|       |    /*  ASSERT: Caller guarantees localr is
 1807|       |        a valid RelocRela  */
 1808|  35.6k|    if (!ep) {
  ------------------
  |  Branch (1808:9): [True: 0, False: 35.6k]
  ------------------
 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|  35.6k|    offsetsize = ep->f_offsetsize;
 1813|  35.6k|    seccount = ep->f_loc_shdr.g_count;
 1814|  35.6k|    if (secnum >= seccount) {
  ------------------
  |  Branch (1814:9): [True: 0, False: 35.6k]
  ------------------
 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|  35.6k|    gshdr = ep->f_shdr +secnum;
 1819|  35.6k|    if (is_empty_section(gshdr->gh_type)) {
  ------------------
  |  Branch (1819:9): [True: 30.0k, False: 5.54k]
  ------------------
 1820|       |
 1821|  30.0k|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|  30.0k|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1822|  30.0k|    }
 1823|       |
 1824|  5.54k|    res = this_rel_is_a_section_dwarf_related(ep,gshdr,
 1825|  5.54k|        &oksec,errcode);
 1826|  5.54k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  5.54k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1826:9): [True: 73, False: 5.46k]
  ------------------
 1827|     73|        return res;
 1828|     73|    }
 1829|  5.46k|    if (!oksec) {
  ------------------
  |  Branch (1829:9): [True: 3.50k, False: 1.96k]
  ------------------
 1830|  3.50k|        return DW_DLV_OK;
  ------------------
  |  |   59|  3.50k|#define DW_DLV_OK         0
  ------------------
 1831|  3.50k|    }
 1832|       |    /*  We will actually read these relocations. */
 1833|  1.96k|    if (offsetsize == 64) {
  ------------------
  |  Branch (1833:9): [True: 806, False: 1.16k]
  ------------------
 1834|    806|        localoffsize = RelocOffset64;
 1835|  1.16k|    } else if (offsetsize == 32) {
  ------------------
  |  Branch (1835:16): [True: 1.16k, False: 0]
  ------------------
 1836|  1.16k|        localoffsize = RelocOffset32;
 1837|  1.16k|    } else {
 1838|      0|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|      0|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
 1839|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1840|      0|    }
 1841|       |    /*  ASSERT: localoffsize is now a valid enum value,
 1842|       |        one of the two defined. */
 1843|  1.96k|    res = _dwarf_elf_load_a_relx_batch(ep,
 1844|  1.96k|        gshdr,&grp,&count_read,localr,localoffsize,errcode);
 1845|  1.96k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  1.96k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1845:9): [True: 170, False: 1.79k]
  ------------------
 1846|    170|        return res;
 1847|    170|    }
 1848|  1.79k|    if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |   58|  1.79k|#define DW_DLV_NO_ENTRY  -1
  ------------------
  |  Branch (1848:9): [True: 401, False: 1.39k]
  ------------------
 1849|    401|        return res;
 1850|    401|    }
 1851|  1.39k|    gshdr->gh_rels = grp;
 1852|  1.39k|    gshdr->gh_relcount = count_read;
 1853|  1.39k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.39k|#define DW_DLV_OK         0
  ------------------
 1854|  1.79k|}
_dwarf_load_elf_header:
 1993|  4.49k|{
 1994|  4.49k|    unsigned offsetsize = ep->f_offsetsize;
 1995|  4.49k|    int res = 0;
 1996|       |
 1997|  4.49k|    if (offsetsize == 32) {
  ------------------
  |  Branch (1997:9): [True: 2.86k, False: 1.63k]
  ------------------
 1998|  2.86k|        res = elf_load_elf_header32(ep,errcode);
 1999|  2.86k|    } else if (offsetsize == 64) {
  ------------------
  |  Branch (1999:16): [True: 1.63k, False: 0]
  ------------------
 2000|  1.63k|        if (sizeof(Dwarf_Unsigned) < 8) {
  ------------------
  |  Branch (2000:13): [Folded, False: 1.63k]
  ------------------
 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.63k|        res = elf_load_elf_header64(ep,errcode);
 2005|  1.63k|    } 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.49k|    return res;
 2010|  4.49k|}
_dwarf_load_elf_sectheaders:
 2379|  4.41k|{
 2380|  4.41k|    int res = 0;
 2381|       |
 2382|  4.41k|    if (ep->f_offsetsize == 32) {
  ------------------
  |  Branch (2382:9): [True: 2.82k, False: 1.58k]
  ------------------
 2383|  2.82k|        res  = elf_load_sectheaders32(ep,ep->f_ehdr->ge_shoff,
 2384|  2.82k|            ep->f_ehdr->ge_shentsize,
 2385|  2.82k|            ep->f_ehdr->ge_shnum,errcode);
 2386|  2.82k|    } else  if (ep->f_offsetsize == 64) {
  ------------------
  |  Branch (2386:17): [True: 1.58k, False: 0]
  ------------------
 2387|  1.58k|        res  = elf_load_sectheaders64(ep,ep->f_ehdr->ge_shoff,
 2388|  1.58k|            ep->f_ehdr->ge_shentsize,
 2389|  1.58k|            ep->f_ehdr->ge_shnum,errcode);
 2390|  1.58k|    } else {
 2391|      0|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|      0|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
 2392|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2393|      0|    }
 2394|  4.41k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  4.41k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2394:9): [True: 1.16k, False: 3.25k]
  ------------------
 2395|  1.16k|        return res;
 2396|  1.16k|    }
 2397|  3.25k|    res  = _dwarf_elf_load_sectstrings(ep,
 2398|  3.25k|        ep->f_ehdr->ge_shstrndx,errcode);
 2399|  3.25k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  3.25k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2399:9): [True: 159, False: 3.09k]
  ------------------
 2400|    159|        return res;
 2401|    159|    }
 2402|  3.09k|    res  = _dwarf_elf_load_sect_namestrings(ep,errcode);
 2403|  3.09k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  3.09k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2403:9): [True: 48, False: 3.04k]
  ------------------
 2404|     48|        return res;
 2405|     48|    }
 2406|  3.04k|    res  = _dwarf_elf_find_sym_sections(ep,errcode);
 2407|  3.04k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  3.04k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2407:9): [True: 45, False: 3.00k]
  ------------------
 2408|     45|        return res;
 2409|     45|    }
 2410|  3.00k|    res = _dwarf_elf_setup_all_section_groups(ep,errcode);
 2411|  3.00k|    return res;
 2412|  3.04k|}
dwarf_elf_load_headers.c:_dwarf_generic_elf_load_symbols:
  970|     62|{
  971|     62|    int res = 0;
  972|     62|    struct generic_symentry *gsym = 0;
  973|     62|    Dwarf_Unsigned count = 0;
  974|       |
  975|     62|    if (!secnum) {
  ------------------
  |  Branch (975:9): [True: 0, False: 62]
  ------------------
  976|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  977|      0|    }
  978|     62|    if (psh->gh_size > ep->f_filesize) {
  ------------------
  |  Branch (978:9): [True: 0, False: 62]
  ------------------
  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|     62|    if (ep->f_offsetsize == 32) {
  ------------------
  |  Branch (982:9): [True: 37, False: 25]
  ------------------
  983|     37|        res = _dwarf_generic_elf_load_symbols32(ep,
  984|     37|            &gsym,psh,
  985|     37|            &count,errcode);
  986|     37|    } else if (ep->f_offsetsize == 64) {
  ------------------
  |  Branch (986:16): [True: 25, False: 0]
  ------------------
  987|     25|        res = _dwarf_generic_elf_load_symbols64(ep,
  988|     25|            &gsym,psh,
  989|     25|            &count,errcode);
  990|     25|    } 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|     62|    if (res == DW_DLV_OK) {
  ------------------
  |  |   59|     62|#define DW_DLV_OK         0
  ------------------
  |  Branch (994:9): [True: 44, False: 18]
  ------------------
  995|     44|        *gsym_out = gsym;
  996|     44|        *count_out = count;
  997|     44|    } else {
  998|     18|        free(psh->gh_content);
  999|     18|        psh->gh_content = 0;
 1000|     18|        psh->gh_was_alloc = FALSE;
  ------------------
  |  |   36|     18|#define FALSE 0
  ------------------
 1001|     18|    }
 1002|     62|    return res;
 1003|     62|}
dwarf_elf_load_headers.c:_dwarf_generic_elf_load_symbols32:
  748|     37|{
  749|     37|    Dwarf_Unsigned  ecount = 0;
  750|     37|    Dwarf_Unsigned  size2 = 0;
  751|     37|    Dwarf_Unsigned  offset =0;
  752|     37|    Dwarf_Unsigned  size =0;
  753|     37|    Dwarf_Unsigned  i = 0;
  754|     37|    dw_elf32_sym   *psym = 0;
  755|     37|    struct generic_symentry * gsym = 0;
  756|     37|    struct generic_symentry * orig_gsym = 0;
  757|     37|    Dwarf_Unsigned flags = 0;
  758|     37|    Dwarf_Small   *content = 0;
  759|     37|    int            res = 0;
  760|       |
  761|     37|    flags = psh->gh_flags;
  762|     37|    size = psh->gh_size;
  763|     37|    offset = psh->gh_offset;
  764|     37|    if (psh->gh_content) {
  ------------------
  |  Branch (764:9): [True: 4, False: 33]
  ------------------
  765|      4|        *errcode = DW_DLE_ELF_SECTION_ERROR;
  ------------------
  |  | 1492|      4|#define DW_DLE_ELF_SECTION_ERROR               446
  ------------------
  766|      4|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
  767|      4|    }
  768|     33|    if (psh->gh_sht_group_array ||
  ------------------
  |  Branch (768:9): [True: 0, False: 33]
  ------------------
  769|     33|        psh->gh_sht_group_array_count ||
  ------------------
  |  Branch (769:9): [True: 0, False: 33]
  ------------------
  770|     33|        psh->gh_content) {
  ------------------
  |  Branch (770:9): [True: 0, False: 33]
  ------------------
  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|     33|    content = calloc(1,size);
  775|     33|    if (!content) {
  ------------------
  |  Branch (775:9): [True: 0, False: 33]
  ------------------
  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|     33|    res = RRMOA(ep->f_fd,content,offset,size,
  ------------------
  |  |   65|     33|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     33|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  780|     33|        ep->f_filesize,errcode);
  781|     33|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     33|#define DW_DLV_OK         0
  ------------------
  |  Branch (781:9): [True: 3, False: 30]
  ------------------
  782|      3|        free(content);
  783|      3|        return res;
  784|      3|    }
  785|     30|    psh->gh_content = (char *)content;
  786|     30|    psh->gh_load_type = Dwarf_Alloc_Malloc;
  787|     30|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|     30|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (787:9): [True: 1, False: 29]
  ------------------
  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|     29|    size = psh->gh_size;
  805|     29|    ecount = (long)(size/sizeof(dw_elf32_sym));
  806|     29|    size2 = ecount * sizeof(dw_elf32_sym);
  807|     29|    if (size != size2) {
  ------------------
  |  Branch (807:9): [True: 3, False: 26]
  ------------------
  808|      3|        free(psh->gh_content);
  809|      3|        psh->gh_content = 0;
  810|      3|        *errcode = DW_DLE_SYMBOL_SECTION_SIZE_ERROR;
  ------------------
  |  | 1536|      3|#define DW_DLE_SYMBOL_SECTION_SIZE_ERROR       490
  ------------------
  811|      3|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
  812|      3|    }
  813|     26|    if (size >= ep->f_filesize ) {
  ------------------
  |  Branch (813:9): [True: 0, False: 26]
  ------------------
  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|     26|    psym = (dw_elf32_sym *)psh->gh_content;
  820|     26|    gsym = calloc(ecount,sizeof(struct generic_symentry));
  821|     26|    if (!gsym) {
  ------------------
  |  Branch (821:9): [True: 0, False: 26]
  ------------------
  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|     26|    orig_gsym = gsym;
  828|  28.9k|    for ( i = 0; i < ecount; ++i,++psym,++gsym) {
  ------------------
  |  Branch (828:18): [True: 28.8k, False: 26]
  ------------------
  829|  28.8k|        Dwarf_Unsigned bind = 0;
  830|  28.8k|        Dwarf_Unsigned type = 0;
  831|       |
  832|  28.8k|        ASNAR(ep->f_copy_word,gsym->gs_name,psym->st_name);
  ------------------
  |  |   53|  28.8k|    do {                                        \
  |  |   54|  28.8k|        (t) = 0;                                \
  |  |   55|  28.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  28.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 28.8k]
  |  |  ------------------
  ------------------
  833|  28.8k|        ASNAR(ep->f_copy_word,gsym->gs_value,psym->st_value);
  ------------------
  |  |   53|  28.8k|    do {                                        \
  |  |   54|  28.8k|        (t) = 0;                                \
  |  |   55|  28.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  28.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 28.8k]
  |  |  ------------------
  ------------------
  834|  28.8k|        ASNAR(ep->f_copy_word,gsym->gs_size,psym->st_size);
  ------------------
  |  |   53|  28.8k|    do {                                        \
  |  |   54|  28.8k|        (t) = 0;                                \
  |  |   55|  28.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  28.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 28.8k]
  |  |  ------------------
  ------------------
  835|  28.8k|        ASNAR(ep->f_copy_word,gsym->gs_info,psym->st_info);
  ------------------
  |  |   53|  28.8k|    do {                                        \
  |  |   54|  28.8k|        (t) = 0;                                \
  |  |   55|  28.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  28.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 28.8k]
  |  |  ------------------
  ------------------
  836|  28.8k|        ASNAR(ep->f_copy_word,gsym->gs_other,psym->st_other);
  ------------------
  |  |   53|  28.8k|    do {                                        \
  |  |   54|  28.8k|        (t) = 0;                                \
  |  |   55|  28.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  28.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 28.8k]
  |  |  ------------------
  ------------------
  837|  28.8k|        ASNAR(ep->f_copy_word,gsym->gs_shndx,psym->st_shndx);
  ------------------
  |  |   53|  28.8k|    do {                                        \
  |  |   54|  28.8k|        (t) = 0;                                \
  |  |   55|  28.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  28.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 28.8k]
  |  |  ------------------
  ------------------
  838|  28.8k|        bind = gsym->gs_info >> 4;
  839|  28.8k|        type = gsym->gs_info & 0xf;
  840|  28.8k|        gsym->gs_bind = bind;
  841|  28.8k|        gsym->gs_type = type;
  842|  28.8k|    }
  843|     26|    psh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|     26|#define TRUE 1
  ------------------
  844|     26|    psh->gh_load_type = Dwarf_Alloc_Malloc;
  845|     26|    *count_out = ecount;
  846|     26|    *gsym_out = orig_gsym;
  847|     26|    return DW_DLV_OK;
  ------------------
  |  |   59|     26|#define DW_DLV_OK         0
  ------------------
  848|     26|}
dwarf_elf_load_headers.c:_dwarf_generic_elf_load_symbols64:
  856|     25|{
  857|     25|    Dwarf_Unsigned ecount = 0;
  858|     25|    Dwarf_Unsigned size = 0;
  859|     25|    Dwarf_Unsigned offset = 0;
  860|     25|    Dwarf_Unsigned size2 = 0;
  861|     25|    Dwarf_Unsigned i = 0;
  862|     25|    dw_elf64_sym  *psym = 0;
  863|     25|    struct generic_symentry * gsym = 0;
  864|     25|    struct generic_symentry * orig_gsym = 0;
  865|     25|    int            res = 0;
  866|     25|    Dwarf_Unsigned flags = 0;
  867|     25|    char *         content = 0;
  868|       |
  869|     25|    flags = psh->gh_flags;
  870|     25|    size = psh->gh_size;
  871|     25|    offset = psh->gh_offset;
  872|     25|    if (psh->gh_sht_group_array ||
  ------------------
  |  Branch (872:9): [True: 0, False: 25]
  ------------------
  873|     25|        psh->gh_sht_group_array_count ||
  ------------------
  |  Branch (873:9): [True: 0, False: 25]
  ------------------
  874|     25|        psh->gh_content) {
  ------------------
  |  Branch (874:9): [True: 0, False: 25]
  ------------------
  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|     25|    content = calloc(1,size);
  879|     25|    if (!content) {
  ------------------
  |  Branch (879:9): [True: 0, False: 25]
  ------------------
  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|     25|    res = RRMOA(ep->f_fd,content,offset,size,
  ------------------
  |  |   65|     25|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     25|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  884|     25|        ep->f_filesize,errcode);
  885|     25|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     25|#define DW_DLV_OK         0
  ------------------
  |  Branch (885:9): [True: 2, False: 23]
  ------------------
  886|      2|        free(content);
  887|      2|        return res;
  888|      2|    }
  889|     23|    psh->gh_content = content;
  890|     23|    psh->gh_load_type = Dwarf_Alloc_Malloc;
  891|     23|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|     23|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (891:9): [True: 1, False: 22]
  ------------------
  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|     22|    size = psh->gh_size;
  910|     22|    ecount = (long)(size/sizeof(dw_elf64_sym));
  911|     22|    size2 = ecount * sizeof(dw_elf64_sym);
  912|     22|    if (size != size2) {
  ------------------
  |  Branch (912:9): [True: 4, False: 18]
  ------------------
  913|      4|        free(psh->gh_content);
  914|      4|        psh->gh_content = 0;
  915|      4|        *errcode = DW_DLE_SYMBOL_SECTION_SIZE_ERROR;
  ------------------
  |  | 1536|      4|#define DW_DLE_SYMBOL_SECTION_SIZE_ERROR       490
  ------------------
  916|      4|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
  917|      4|    }
  918|     18|    if (size >= ep->f_filesize ) {
  ------------------
  |  Branch (918:9): [True: 0, False: 18]
  ------------------
  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|     18|    psym = (dw_elf64_sym *)psh->gh_content;
  925|     18|    gsym = calloc(ecount,sizeof(struct generic_symentry));
  926|     18|    if (!gsym) {
  ------------------
  |  Branch (926:9): [True: 0, False: 18]
  ------------------
  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|     18|    res = RRMOA(ep->f_fd,psym,offset,size,
  ------------------
  |  |   65|     18|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     18|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  933|     18|        ep->f_filesize,errcode);
  934|     18|    if (res!= DW_DLV_OK) {
  ------------------
  |  |   59|     18|#define DW_DLV_OK         0
  ------------------
  |  Branch (934:9): [True: 0, False: 18]
  ------------------
  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|     18|    orig_gsym = gsym;
  942|    671|    for ( i = 0; i < ecount; ++i,++psym,++gsym) {
  ------------------
  |  Branch (942:18): [True: 653, False: 18]
  ------------------
  943|    653|        Dwarf_Unsigned bind = 0;
  944|    653|        Dwarf_Unsigned type = 0;
  945|       |
  946|    653|        ASNAR(ep->f_copy_word,gsym->gs_name,psym->st_name);
  ------------------
  |  |   53|    653|    do {                                        \
  |  |   54|    653|        (t) = 0;                                \
  |  |   55|    653|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    653|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 653]
  |  |  ------------------
  ------------------
  947|    653|        ASNAR(ep->f_copy_word,gsym->gs_value,psym->st_value);
  ------------------
  |  |   53|    653|    do {                                        \
  |  |   54|    653|        (t) = 0;                                \
  |  |   55|    653|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    653|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 653]
  |  |  ------------------
  ------------------
  948|    653|        ASNAR(ep->f_copy_word,gsym->gs_size,psym->st_size);
  ------------------
  |  |   53|    653|    do {                                        \
  |  |   54|    653|        (t) = 0;                                \
  |  |   55|    653|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    653|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 653]
  |  |  ------------------
  ------------------
  949|    653|        ASNAR(ep->f_copy_word,gsym->gs_info,psym->st_info);
  ------------------
  |  |   53|    653|    do {                                        \
  |  |   54|    653|        (t) = 0;                                \
  |  |   55|    653|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    653|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 653]
  |  |  ------------------
  ------------------
  950|    653|        ASNAR(ep->f_copy_word,gsym->gs_other,psym->st_other);
  ------------------
  |  |   53|    653|    do {                                        \
  |  |   54|    653|        (t) = 0;                                \
  |  |   55|    653|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    653|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 653]
  |  |  ------------------
  ------------------
  951|    653|        ASNAR(ep->f_copy_word,gsym->gs_shndx,psym->st_shndx);
  ------------------
  |  |   53|    653|    do {                                        \
  |  |   54|    653|        (t) = 0;                                \
  |  |   55|    653|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    653|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 653]
  |  |  ------------------
  ------------------
  952|    653|        bind = gsym->gs_info >> 4;
  953|    653|        type = gsym->gs_info & 0xf;
  954|    653|        gsym->gs_bind = bind;
  955|    653|        gsym->gs_type = type;
  956|    653|    }
  957|     18|    psh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|     18|#define TRUE 1
  ------------------
  958|     18|    *count_out = ecount;
  959|     18|    *gsym_out = orig_gsym;
  960|     18|    return DW_DLV_OK;
  ------------------
  |  |   59|     18|#define DW_DLV_OK         0
  ------------------
  961|     18|}
dwarf_elf_load_headers.c:is_empty_section:
  352|   712k|{
  353|   712k|    if (type == SHT_NOBITS) {
  ------------------
  |  |   87|   712k|#define SHT_NOBITS 8
  ------------------
  |  Branch (353:9): [True: 7.53k, False: 705k]
  ------------------
  354|  7.53k|        return TRUE;
  ------------------
  |  |   33|  7.53k|#define TRUE 1
  ------------------
  355|  7.53k|    }
  356|   705k|    if (type == SHT_NULL) {
  ------------------
  |  |   44|   705k|#define SHT_NULL 0
  ------------------
  |  Branch (356:9): [True: 627k, False: 77.9k]
  ------------------
  357|   627k|        return TRUE;
  ------------------
  |  |   33|   627k|#define TRUE 1
  ------------------
  358|   627k|    }
  359|  77.9k|    return FALSE;
  ------------------
  |  |   36|  77.9k|#define FALSE 0
  ------------------
  360|   705k|}
dwarf_elf_load_headers.c:this_rel_is_a_section_dwarf_related:
 1764|  5.54k|{
 1765|  5.54k|    Dwarf_Unsigned oksecnum = 0;
 1766|  5.54k|    struct generic_shdr *gstarg = 0;
 1767|       |
 1768|  5.54k|    if (gshdr->gh_type != SHT_RELA &&
  ------------------
  |  |   56|  11.0k|#define SHT_RELA 4
  ------------------
  |  Branch (1768:9): [True: 3.33k, False: 2.20k]
  ------------------
 1769|  3.33k|        gshdr->gh_type != SHT_REL)  {
  ------------------
  |  |   59|  3.33k|#define SHT_REL 9
  ------------------
  |  Branch (1769:9): [True: 1.61k, False: 1.71k]
  ------------------
 1770|  1.61k|        *oksecnum_out = 0;
 1771|  1.61k|        return DW_DLV_OK;
  ------------------
  |  |   59|  1.61k|#define DW_DLV_OK         0
  ------------------
 1772|  1.61k|    }
 1773|  3.92k|    oksecnum = gshdr->gh_reloc_target_secnum;
 1774|  3.92k|    if (oksecnum >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (1774:9): [True: 73, False: 3.85k]
  ------------------
 1775|     73|        *oksecnum_out = 0;
 1776|     73|        *errcode = DW_DLE_ELF_SECTION_ERROR;
  ------------------
  |  | 1492|     73|#define DW_DLE_ELF_SECTION_ERROR               446
  ------------------
 1777|     73|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     73|#define DW_DLV_ERROR      1
  ------------------
 1778|     73|    }
 1779|  3.85k|    gstarg = ep->f_shdr+oksecnum;
 1780|  3.85k|    if (!gstarg->gh_is_dwarf) {
  ------------------
  |  Branch (1780:9): [True: 1.88k, False: 1.96k]
  ------------------
 1781|  1.88k|        *oksecnum_out = 0; /* no reloc needed. */
 1782|  1.88k|        return DW_DLV_OK;
  ------------------
  |  |   59|  1.88k|#define DW_DLV_OK         0
  ------------------
 1783|  1.88k|    }
 1784|  1.96k|    *oksecnum_out = (unsigned)oksecnum;
 1785|  1.96k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.96k|#define DW_DLV_OK         0
  ------------------
 1786|  3.85k|}
dwarf_elf_load_headers.c:_dwarf_elf_load_a_relx_batch:
 1613|  1.96k|{
 1614|  1.96k|    Dwarf_Unsigned count = 0;
 1615|  1.96k|    Dwarf_Unsigned size = 0;
 1616|  1.96k|    Dwarf_Unsigned flags = 0;
 1617|  1.96k|    Dwarf_Unsigned size2 = 0;
 1618|  1.96k|    Dwarf_Unsigned sizeg = 0;
 1619|  1.96k|    Dwarf_Unsigned offset = 0;
 1620|  1.96k|    int            res = 0;
 1621|  1.96k|    Dwarf_Unsigned object_reclen = 0;
 1622|  1.96k|    struct generic_rela *grel = 0;
 1623|  1.96k|    char *         relp = 0;
 1624|  1.96k|    int            local_alloc = FALSE;
  ------------------
  |  |   36|  1.96k|#define FALSE 0
  ------------------
 1625|       |
 1626|       |    /*  ASSERT: Caller guarantees localoffsetsize
 1627|       |        is a valid 4 or 8. */
 1628|       |    /*  ASSERT: Caller guarantees localrela is one
 1629|       |        of the 2 valid values 1 or 2 */
 1630|       |
 1631|  1.96k|    flags = gsh->gh_flags;
 1632|  1.96k|    offset = gsh->gh_offset;
 1633|  1.96k|    size = gsh->gh_size;
 1634|  1.96k|    if (size == 0) {
  ------------------
  |  Branch (1634:9): [True: 401, False: 1.56k]
  ------------------
 1635|    401|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|    401|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1636|    401|    }
 1637|  1.56k|    relp = (char *)gsh->gh_content;
 1638|  1.56k|    if (!relp) {
  ------------------
  |  Branch (1638:9): [True: 1.29k, False: 273]
  ------------------
 1639|  1.29k|        relp = (char *)malloc(size);
 1640|  1.29k|        local_alloc = TRUE;
  ------------------
  |  |   33|  1.29k|#define TRUE 1
  ------------------
 1641|  1.29k|    }
 1642|  1.56k|    if (!relp) {
  ------------------
  |  Branch (1642:9): [True: 0, False: 1.56k]
  ------------------
 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.56k|    if ((offset > ep->f_filesize)||
  ------------------
  |  Branch (1646:9): [True: 105, False: 1.46k]
  ------------------
 1647|  1.46k|        (size > ep->f_filesize) ||
  ------------------
  |  Branch (1647:9): [True: 0, False: 1.46k]
  ------------------
 1648|  1.46k|        ((size +offset) > ep->f_filesize)) {
  ------------------
  |  Branch (1648:9): [True: 19, False: 1.44k]
  ------------------
 1649|    124|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|    124|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1650|    124|        if (local_alloc) {
  ------------------
  |  Branch (1650:13): [True: 124, False: 0]
  ------------------
 1651|    124|            free(relp);
 1652|    124|        }
 1653|    124|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    124|#define DW_DLV_ERROR      1
  ------------------
 1654|    124|    }
 1655|  1.44k|    res = RRMOA(ep->f_fd,relp,offset,size,
  ------------------
  |  |   65|  1.44k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  1.44k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1656|  1.44k|        ep->f_filesize,errcode);
 1657|  1.44k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.44k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1657:9): [True: 0, False: 1.44k]
  ------------------
 1658|      0|        free(relp);
 1659|      0|        free(grel);
 1660|      0|        return res;
 1661|      0|    }
 1662|  1.44k|    if (local_alloc) {
  ------------------
  |  Branch (1662:9): [True: 1.16k, False: 273]
  ------------------
 1663|  1.16k|        gsh->gh_content = relp;
 1664|  1.16k|        gsh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|  1.16k|#define TRUE 1
  ------------------
 1665|  1.16k|        gsh->gh_load_type = Dwarf_Alloc_Malloc;
 1666|  1.16k|    }
 1667|  1.44k|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|  1.44k|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (1667:9): [True: 5, False: 1.43k]
  ------------------
 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|      5|        *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      5|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
 1677|      5|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      5|#define DW_DLV_ERROR      1
  ------------------
 1678|      5|#endif /* COMPRESSED TEST */
 1679|      5|    }
 1680|  1.43k|    size = gsh->gh_size;
 1681|  1.43k|    if (localoffsize == RelocOffset32) {
  ------------------
  |  Branch (1681:9): [True: 839, False: 597]
  ------------------
 1682|    839|        if (localrela ==  RelocIsRela) {
  ------------------
  |  Branch (1682:13): [True: 320, False: 519]
  ------------------
 1683|    320|            object_reclen = sizeof(dw_elf32_rela);
 1684|    320|            count = (long)(size/object_reclen);
 1685|    320|            size2 = count * object_reclen;
 1686|    320|            if (size != size2) {
  ------------------
  |  Branch (1686:17): [True: 18, False: 302]
  ------------------
 1687|     18|                *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|     18|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1688|     18|                return DW_DLV_ERROR;
  ------------------
  |  |   60|     18|#define DW_DLV_ERROR      1
  ------------------
 1689|     18|            }
 1690|    519|        } else {
 1691|    519|            object_reclen = sizeof(dw_elf32_rel);
 1692|    519|            count = (long)(size/object_reclen);
 1693|    519|            size2 = count * object_reclen;
 1694|    519|            if (size != size2) {
  ------------------
  |  Branch (1694:17): [True: 5, False: 514]
  ------------------
 1695|      5|                *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      5|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1696|      5|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      5|#define DW_DLV_ERROR      1
  ------------------
 1697|      5|            }
 1698|    519|        }
 1699|    839|    } else {
 1700|    597|        if (localrela ==  RelocIsRela) {
  ------------------
  |  Branch (1700:13): [True: 328, False: 269]
  ------------------
 1701|    328|            object_reclen = sizeof(dw_elf64_rela);
 1702|    328|            count = (long)(size/object_reclen);
 1703|    328|            size2 = count * object_reclen;
 1704|    328|            if (size != size2) {
  ------------------
  |  Branch (1704:17): [True: 12, False: 316]
  ------------------
 1705|     12|                *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|     12|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1706|     12|                return DW_DLV_ERROR;
  ------------------
  |  |   60|     12|#define DW_DLV_ERROR      1
  ------------------
 1707|     12|            }
 1708|    328|        } else {
 1709|    269|            object_reclen = sizeof(dw_elf64_rel);
 1710|    269|            count = (long)(size/object_reclen);
 1711|    269|            size2 = count * object_reclen;
 1712|    269|            if (size != size2) {
  ------------------
  |  Branch (1712:17): [True: 6, False: 263]
  ------------------
 1713|      6|                *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      6|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1714|      6|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      6|#define DW_DLV_ERROR      1
  ------------------
 1715|      6|            }
 1716|    269|        }
 1717|    597|    }
 1718|       |
 1719|  1.39k|    sizeg = count*sizeof(struct generic_rela);
 1720|  1.39k|    grel = (struct generic_rela *)malloc(sizeg);
 1721|  1.39k|    if (!grel) {
  ------------------
  |  Branch (1721:9): [True: 0, False: 1.39k]
  ------------------
 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.39k|    if (localoffsize == RelocOffset32) {
  ------------------
  |  Branch (1725:9): [True: 816, False: 579]
  ------------------
 1726|    816|        if (localrela ==  RelocIsRela) {
  ------------------
  |  Branch (1726:13): [True: 302, False: 514]
  ------------------
 1727|    302|            res = generic_rel_from_rela32(ep,gsh,
 1728|    302|                (dw_elf32_rela *)gsh->gh_content,grel,errcode);
 1729|    514|        } else {
 1730|    514|            res = generic_rel_from_rel32(ep,gsh,
 1731|    514|                (dw_elf32_rel *)gsh->gh_content,grel,errcode);
 1732|    514|        }
 1733|    816|    } else {
 1734|    579|        if (localrela ==  RelocIsRela) {
  ------------------
  |  Branch (1734:13): [True: 316, False: 263]
  ------------------
 1735|    316|            res = generic_rel_from_rela64(ep,gsh,
 1736|    316|                (dw_elf64_rela *)gsh->gh_content,grel,errcode);
 1737|    316|        } else {
 1738|    263|            res = generic_rel_from_rel64(ep,gsh,
 1739|    263|                (dw_elf64_rel *)gsh->gh_content,grel,errcode);
 1740|    263|        }
 1741|    579|    }
 1742|  1.39k|    if (res == DW_DLV_OK) {
  ------------------
  |  |   59|  1.39k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1742:9): [True: 1.39k, False: 0]
  ------------------
 1743|  1.39k|        gsh->gh_relcount = count;
 1744|  1.39k|        gsh->gh_rels = grel;
 1745|  1.39k|        *count_out = count;
 1746|  1.39k|        *grel_out = grel;
 1747|  1.39k|        return res;
 1748|  1.39k|    }
 1749|       |    /* Some sort of issue */
 1750|      0|    count_out = 0;
 1751|      0|    free(grel);
 1752|      0|    return res;
 1753|  1.39k|}
dwarf_elf_load_headers.c:generic_rel_from_rela32:
 1042|    302|{
 1043|    302|    Dwarf_Unsigned ecount = 0;
 1044|    302|    Dwarf_Unsigned size = gsh->gh_size;
 1045|    302|    Dwarf_Unsigned size2 = 0;
 1046|    302|    Dwarf_Unsigned i = 0;
 1047|       |
 1048|    302|    ecount = size/sizeof(dw_elf32_rela);
 1049|    302|    size2 = ecount * sizeof(dw_elf32_rela);
 1050|    302|    if (size >= ep->f_filesize) {
  ------------------
  |  Branch (1050:9): [True: 0, False: 302]
  ------------------
 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|    302|    if (size != size2) {
  ------------------
  |  Branch (1054:9): [True: 0, False: 302]
  ------------------
 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|  25.2k|    for ( i = 0; i < ecount; ++i,++relp,++grel) {
  ------------------
  |  Branch (1058:18): [True: 24.9k, False: 302]
  ------------------
 1059|  24.9k|        ASNAR(ep->f_copy_word,grel->gr_offset,relp->r_offset);
  ------------------
  |  |   53|  24.9k|    do {                                        \
  |  |   54|  24.9k|        (t) = 0;                                \
  |  |   55|  24.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  24.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 24.9k]
  |  |  ------------------
  ------------------
 1060|  24.9k|        ASNAR(ep->f_copy_word,grel->gr_info,relp->r_info);
  ------------------
  |  |   53|  24.9k|    do {                                        \
  |  |   54|  24.9k|        (t) = 0;                                \
  |  |   55|  24.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  24.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 24.9k]
  |  |  ------------------
  ------------------
 1061|       |        /* addend signed */
 1062|  24.9k|        ASNAR(ep->f_copy_word,grel->gr_addend,relp->r_addend);
  ------------------
  |  |   53|  24.9k|    do {                                        \
  |  |   54|  24.9k|        (t) = 0;                                \
  |  |   55|  24.9k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  24.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 24.9k]
  |  |  ------------------
  ------------------
 1063|  24.9k|        SIGN_EXTEND(grel->gr_addend,sizeof(relp->r_addend));
  ------------------
  |  |  102|  24.9k|    do {                                                          \
  |  |  103|  24.9k|        if (*(Dwarf_Sbyte *)((char *)&(dest)+ ((length)-1)) < 0) { \
  |  |  ------------------
  |  |  |  Branch (103:13): [True: 3.97k, False: 20.9k]
  |  |  ------------------
  |  |  104|  3.97k|            memcpy((char *)&(dest)+(length),                      \
  |  |  105|  3.97k|                "\xff\xff\xff\xff\xff\xff\xff\xff",               \
  |  |  106|  3.97k|                sizeof(dest) - (length));                         \
  |  |  107|  3.97k|        }                                                         \
  |  |  108|  24.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (108:14): [Folded, False: 24.9k]
  |  |  ------------------
  ------------------
 1064|  24.9k|        grel->gr_sym  = grel->gr_info>>8; /* ELF32_R_SYM */
 1065|  24.9k|        grel->gr_type = grel->gr_info & 0xff;
 1066|  24.9k|        grel->gr_is_rela = TRUE;
  ------------------
  |  |   33|  24.9k|#define TRUE 1
  ------------------
 1067|  24.9k|    }
 1068|    302|    return DW_DLV_OK;
  ------------------
  |  |   59|    302|#define DW_DLV_OK         0
  ------------------
 1069|    302|}
dwarf_elf_load_headers.c:generic_rel_from_rel32:
 1131|    514|{
 1132|    514|    Dwarf_Unsigned ecount = 0;
 1133|    514|    Dwarf_Unsigned size = gsh->gh_size;
 1134|    514|    Dwarf_Unsigned size2 = 0;
 1135|    514|    Dwarf_Unsigned i = 0;
 1136|       |
 1137|    514|    ecount = size/sizeof(dw_elf32_rel);
 1138|    514|    size2 = ecount * sizeof(dw_elf32_rel);
 1139|    514|    if (size >= ep->f_filesize) {
  ------------------
  |  Branch (1139:9): [True: 0, False: 514]
  ------------------
 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|    514|    if (size != size2) {
  ------------------
  |  Branch (1143:9): [True: 0, False: 514]
  ------------------
 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|   109k|    for ( i = 0; i < ecount; ++i,++relp,++grel) {
  ------------------
  |  Branch (1147:18): [True: 109k, False: 514]
  ------------------
 1148|   109k|        ASNAR(ep->f_copy_word,grel->gr_offset,relp->r_offset);
  ------------------
  |  |   53|   109k|    do {                                        \
  |  |   54|   109k|        (t) = 0;                                \
  |  |   55|   109k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   109k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 109k]
  |  |  ------------------
  ------------------
 1149|   109k|        ASNAR(ep->f_copy_word,grel->gr_info,relp->r_info);
  ------------------
  |  |   53|   109k|    do {                                        \
  |  |   54|   109k|        (t) = 0;                                \
  |  |   55|   109k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   109k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 109k]
  |  |  ------------------
  ------------------
 1150|   109k|        grel->gr_addend  = 0; /* Unused for plain .rel */
 1151|   109k|        grel->gr_sym  = grel->gr_info >>8; /* ELF32_R_SYM */
 1152|   109k|        grel->gr_is_rela = FALSE;
  ------------------
  |  |   36|   109k|#define FALSE 0
  ------------------
 1153|   109k|        grel->gr_type = grel->gr_info & 0xff;
 1154|   109k|    }
 1155|    514|    return DW_DLV_OK;
  ------------------
  |  |   59|    514|#define DW_DLV_OK         0
  ------------------
 1156|    514|}
dwarf_elf_load_headers.c:generic_rel_from_rela64:
 1077|    316|{
 1078|    316|    Dwarf_Unsigned ecount = 0;
 1079|    316|    Dwarf_Unsigned size = gsh->gh_size;
 1080|    316|    Dwarf_Unsigned size2 = 0;
 1081|    316|    Dwarf_Unsigned i = 0;
 1082|    316|    int objlittleendian = (ep->f_endian == DW_END_little);
  ------------------
  |  | 1115|    316|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1083|    316|    int ismips64 = (ep->f_machine == EM_MIPS);
  ------------------
  |  |  209|    316|#define EM_MIPS          8
  ------------------
 1084|    316|    int issparcv9 = (ep->f_machine == EM_SPARCV9);
  ------------------
  |  |  263|    316|#define EM_SPARCV9       43
  ------------------
 1085|       |
 1086|    316|    ecount = size/sizeof(dw_elf64_rela);
 1087|    316|    size2 = ecount * sizeof(dw_elf64_rela);
 1088|    316|    if (size >= ep->f_filesize) {
  ------------------
  |  Branch (1088:9): [True: 0, False: 316]
  ------------------
 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|    316|    if (size != size2) {
  ------------------
  |  Branch (1092:9): [True: 0, False: 316]
  ------------------
 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|  18.1k|    for ( i = 0; i < ecount; ++i,++relp,++grel) {
  ------------------
  |  Branch (1096:18): [True: 17.8k, False: 316]
  ------------------
 1097|  17.8k|        ASNAR(ep->f_copy_word,grel->gr_offset,relp->r_offset);
  ------------------
  |  |   53|  17.8k|    do {                                        \
  |  |   54|  17.8k|        (t) = 0;                                \
  |  |   55|  17.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  17.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 17.8k]
  |  |  ------------------
  ------------------
 1098|  17.8k|        ASNAR(ep->f_copy_word,grel->gr_info,relp->r_info);
  ------------------
  |  |   53|  17.8k|    do {                                        \
  |  |   54|  17.8k|        (t) = 0;                                \
  |  |   55|  17.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  17.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 17.8k]
  |  |  ------------------
  ------------------
 1099|  17.8k|        ASNAR(ep->f_copy_word,grel->gr_addend,relp->r_addend);
  ------------------
  |  |   53|  17.8k|    do {                                        \
  |  |   54|  17.8k|        (t) = 0;                                \
  |  |   55|  17.8k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  17.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 17.8k]
  |  |  ------------------
  ------------------
 1100|  17.8k|        SIGN_EXTEND(grel->gr_addend,sizeof(relp->r_addend));
  ------------------
  |  |  102|  17.8k|    do {                                                          \
  |  |  103|  17.8k|        if (*(Dwarf_Sbyte *)((char *)&(dest)+ ((length)-1)) < 0) { \
  |  |  ------------------
  |  |  |  Branch (103:13): [True: 924, False: 16.9k]
  |  |  ------------------
  |  |  104|    924|            memcpy((char *)&(dest)+(length),                      \
  |  |  105|    924|                "\xff\xff\xff\xff\xff\xff\xff\xff",               \
  |  |  106|    924|                sizeof(dest) - (length));                         \
  |  |  107|    924|        }                                                         \
  |  |  108|  17.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (108:14): [Folded, False: 17.8k]
  |  |  ------------------
  ------------------
 1101|  17.8k|        if (ismips64 && objlittleendian ) {
  ------------------
  |  Branch (1101:13): [True: 1.43k, False: 16.4k]
  |  Branch (1101:25): [True: 1.14k, False: 293]
  ------------------
 1102|  1.14k|            char realsym[4];
 1103|       |
 1104|  1.14k|            memcpy(realsym,&relp->r_info,sizeof(realsym));
 1105|  1.14k|            ASNAR(ep->f_copy_word,grel->gr_sym,realsym);
  ------------------
  |  |   53|  1.14k|    do {                                        \
  |  |   54|  1.14k|        (t) = 0;                                \
  |  |   55|  1.14k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.14k]
  |  |  ------------------
  ------------------
 1106|  1.14k|            grel->gr_type  = relp->r_info[7];
 1107|  1.14k|            grel->gr_type2 = relp->r_info[6];
 1108|  1.14k|            grel->gr_type3 = relp->r_info[5];
 1109|  16.6k|        } else if (issparcv9) {
  ------------------
  |  Branch (1109:20): [True: 324, False: 16.3k]
  ------------------
 1110|       |            /*  Always Big Endian?  */
 1111|    324|            char realsym[4];
 1112|       |
 1113|    324|            memcpy(realsym,&relp->r_info,sizeof(realsym));
 1114|    324|            ASNAR(ep->f_copy_word,grel->gr_sym,realsym);
  ------------------
  |  |   53|    324|    do {                                        \
  |  |   54|    324|        (t) = 0;                                \
  |  |   55|    324|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    324|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 324]
  |  |  ------------------
  ------------------
 1115|    324|            grel->gr_type  = relp->r_info[7];
 1116|  16.3k|        } else {
 1117|  16.3k|            grel->gr_sym  = grel->gr_info >> 32;
 1118|  16.3k|            grel->gr_type = grel->gr_info & 0xffffffff;
 1119|  16.3k|        }
 1120|  17.8k|        grel->gr_is_rela = TRUE;
  ------------------
  |  |   33|  17.8k|#define TRUE 1
  ------------------
 1121|  17.8k|    }
 1122|    316|    return DW_DLV_OK;
  ------------------
  |  |   59|    316|#define DW_DLV_OK         0
  ------------------
 1123|    316|}
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.20k|    for ( i = 0; i < ecount; ++i,++relp,++grel) {
  ------------------
  |  Branch (1183:18): [True: 8.94k, False: 263]
  ------------------
 1184|  8.94k|        ASNAR(ep->f_copy_word,grel->gr_offset,relp->r_offset);
  ------------------
  |  |   53|  8.94k|    do {                                        \
  |  |   54|  8.94k|        (t) = 0;                                \
  |  |   55|  8.94k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  8.94k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 8.94k]
  |  |  ------------------
  ------------------
 1185|  8.94k|        ASNAR(ep->f_copy_word,grel->gr_info,relp->r_info);
  ------------------
  |  |   53|  8.94k|    do {                                        \
  |  |   54|  8.94k|        (t) = 0;                                \
  |  |   55|  8.94k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  8.94k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 8.94k]
  |  |  ------------------
  ------------------
 1186|  8.94k|        grel->gr_addend  = 0; /* Unused for plain .rel */
 1187|  8.94k|        if (ismips64 && objlittleendian ) {
  ------------------
  |  Branch (1187:13): [True: 2.42k, False: 6.51k]
  |  Branch (1187:25): [True: 2.20k, False: 222]
  ------------------
 1188|  2.20k|            char realsym[4];
 1189|       |
 1190|  2.20k|            memcpy(realsym,&relp->r_info,sizeof(realsym));
 1191|  2.20k|            ASNAR(ep->f_copy_word,grel->gr_sym,realsym);
  ------------------
  |  |   53|  2.20k|    do {                                        \
  |  |   54|  2.20k|        (t) = 0;                                \
  |  |   55|  2.20k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.20k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.20k]
  |  |  ------------------
  ------------------
 1192|  2.20k|            grel->gr_type  = relp->r_info[7];
 1193|  2.20k|            grel->gr_type2 = relp->r_info[6];
 1194|  2.20k|            grel->gr_type3 = relp->r_info[5];
 1195|  6.73k|        } else if (issparcv9) {
  ------------------
  |  Branch (1195:20): [True: 805, False: 5.92k]
  ------------------
 1196|       |            /*  Always Big Endian?  */
 1197|    805|            char realsym[4];
 1198|       |
 1199|    805|            memcpy(realsym,&relp->r_info,sizeof(realsym));
 1200|    805|            ASNAR(ep->f_copy_word,grel->gr_sym,realsym);
  ------------------
  |  |   53|    805|    do {                                        \
  |  |   54|    805|        (t) = 0;                                \
  |  |   55|    805|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    805|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 805]
  |  |  ------------------
  ------------------
 1201|    805|            grel->gr_type  = relp->r_info[7];
 1202|  5.92k|        } else {
 1203|  5.92k|            grel->gr_sym  = grel->gr_info >>32;
 1204|  5.92k|            grel->gr_type = grel->gr_info & 0xffffffff;
 1205|  5.92k|        }
 1206|  8.94k|        grel->gr_is_rela = FALSE;
  ------------------
  |  |   36|  8.94k|#define FALSE 0
  ------------------
 1207|  8.94k|    }
 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|  2.86k|{
 1935|  2.86k|    int res = 0;
 1936|  2.86k|    dw_elf32_ehdr ehdr32;
 1937|  2.86k|    struct generic_ehdr *ehdr = 0;
 1938|       |
 1939|  2.86k|    ehdr32 = eh32_zero;
 1940|  2.86k|    res = RRMOA(ep->f_fd,&ehdr32,0,sizeof(ehdr32),
  ------------------
  |  |   65|  2.86k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  2.86k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1941|  2.86k|        ep->f_filesize,errcode);
 1942|  2.86k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.86k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1942:9): [True: 4, False: 2.85k]
  ------------------
 1943|      4|        return res;
 1944|      4|    }
 1945|  2.85k|    ehdr = (struct generic_ehdr *)calloc(1,
 1946|  2.85k|        sizeof(struct generic_ehdr));
 1947|  2.85k|    if (!ehdr) {
  ------------------
  |  Branch (1947:9): [True: 0, False: 2.85k]
  ------------------
 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|  2.85k|    res  = generic_ehdr_from_32(ep,ehdr,&ehdr32,errcode);
 1952|  2.85k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.85k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1952:9): [True: 30, False: 2.82k]
  ------------------
 1953|     30|        free(ehdr);
 1954|     30|        return res;
 1955|     30|    }
 1956|  2.82k|    ep->f_machine = (unsigned)ehdr->ge_machine;
 1957|  2.82k|    ep->f_flags = ehdr->ge_flags;
 1958|  2.82k|    return res;
 1959|  2.85k|}
dwarf_elf_load_headers.c:generic_ehdr_from_32:
  366|  2.85k|{
  367|  2.85k|    int i = 0;
  368|       |
  369|  48.5k|    for (i = 0; i < EI_NIDENT; ++i) {
  ------------------
  |  |  926|  48.5k|#define EI_NIDENT 16
  ------------------
  |  Branch (369:17): [True: 45.7k, False: 2.85k]
  ------------------
  370|  45.7k|        ehdr->ge_ident[i] = e->e_ident[i];
  371|  45.7k|    }
  372|  2.85k|    ASNAR(ep->f_copy_word,ehdr->ge_type,e->e_type);
  ------------------
  |  |   53|  2.85k|    do {                                        \
  |  |   54|  2.85k|        (t) = 0;                                \
  |  |   55|  2.85k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.85k]
  |  |  ------------------
  ------------------
  373|  2.85k|    ASNAR(ep->f_copy_word,ehdr->ge_machine,e->e_machine);
  ------------------
  |  |   53|  2.85k|    do {                                        \
  |  |   54|  2.85k|        (t) = 0;                                \
  |  |   55|  2.85k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.85k]
  |  |  ------------------
  ------------------
  374|  2.85k|    ASNAR(ep->f_copy_word,ehdr->ge_version,e->e_version);
  ------------------
  |  |   53|  2.85k|    do {                                        \
  |  |   54|  2.85k|        (t) = 0;                                \
  |  |   55|  2.85k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.85k]
  |  |  ------------------
  ------------------
  375|  2.85k|    ASNAR(ep->f_copy_word,ehdr->ge_entry,e->e_entry);
  ------------------
  |  |   53|  2.85k|    do {                                        \
  |  |   54|  2.85k|        (t) = 0;                                \
  |  |   55|  2.85k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.85k]
  |  |  ------------------
  ------------------
  376|  2.85k|    ASNAR(ep->f_copy_word,ehdr->ge_phoff,e->e_phoff);
  ------------------
  |  |   53|  2.85k|    do {                                        \
  |  |   54|  2.85k|        (t) = 0;                                \
  |  |   55|  2.85k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.85k]
  |  |  ------------------
  ------------------
  377|  2.85k|    ASNAR(ep->f_copy_word,ehdr->ge_shoff,e->e_shoff);
  ------------------
  |  |   53|  2.85k|    do {                                        \
  |  |   54|  2.85k|        (t) = 0;                                \
  |  |   55|  2.85k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.85k]
  |  |  ------------------
  ------------------
  378|  2.85k|    ASNAR(ep->f_copy_word,ehdr->ge_flags,e->e_flags);
  ------------------
  |  |   53|  2.85k|    do {                                        \
  |  |   54|  2.85k|        (t) = 0;                                \
  |  |   55|  2.85k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.85k]
  |  |  ------------------
  ------------------
  379|  2.85k|    ASNAR(ep->f_copy_word,ehdr->ge_ehsize,e->e_ehsize);
  ------------------
  |  |   53|  2.85k|    do {                                        \
  |  |   54|  2.85k|        (t) = 0;                                \
  |  |   55|  2.85k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.85k]
  |  |  ------------------
  ------------------
  380|  2.85k|    ASNAR(ep->f_copy_word,ehdr->ge_phentsize,e->e_phentsize);
  ------------------
  |  |   53|  2.85k|    do {                                        \
  |  |   54|  2.85k|        (t) = 0;                                \
  |  |   55|  2.85k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.85k]
  |  |  ------------------
  ------------------
  381|  2.85k|    ASNAR(ep->f_copy_word,ehdr->ge_phnum,e->e_phnum);
  ------------------
  |  |   53|  2.85k|    do {                                        \
  |  |   54|  2.85k|        (t) = 0;                                \
  |  |   55|  2.85k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.85k]
  |  |  ------------------
  ------------------
  382|  2.85k|    ASNAR(ep->f_copy_word,ehdr->ge_shentsize,e->e_shentsize);
  ------------------
  |  |   53|  2.85k|    do {                                        \
  |  |   54|  2.85k|        (t) = 0;                                \
  |  |   55|  2.85k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.85k]
  |  |  ------------------
  ------------------
  383|  2.85k|    ASNAR(ep->f_copy_word,ehdr->ge_shnum,e->e_shnum);
  ------------------
  |  |   53|  2.85k|    do {                                        \
  |  |   54|  2.85k|        (t) = 0;                                \
  |  |   55|  2.85k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.85k]
  |  |  ------------------
  ------------------
  384|  2.85k|    ASNAR(ep->f_copy_word,ehdr->ge_shstrndx,e->e_shstrndx);
  ------------------
  |  |   53|  2.85k|    do {                                        \
  |  |   54|  2.85k|        (t) = 0;                                \
  |  |   55|  2.85k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.85k]
  |  |  ------------------
  ------------------
  385|  2.85k|    if (!ehdr->ge_shoff) {
  ------------------
  |  Branch (385:9): [True: 1, False: 2.85k]
  ------------------
  386|      1|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      1|#define DW_DLV_NO_ENTRY  -1
  ------------------
  387|      1|    }
  388|  2.85k|    if (ehdr->ge_shoff < sizeof(dw_elf32_ehdr)) {
  ------------------
  |  Branch (388:9): [True: 5, False: 2.85k]
  ------------------
  389|       |        /* offset is inside the header! */
  390|      5|        *errcode = DW_DLE_TOO_FEW_SECTIONS;
  ------------------
  |  | 1540|      5|#define DW_DLE_TOO_FEW_SECTIONS                494
  ------------------
  391|      5|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      5|#define DW_DLV_ERROR      1
  ------------------
  392|      5|    }
  393|  2.85k|    if (ehdr->ge_shstrndx == SHN_XINDEX) {
  ------------------
  |  |  302|  2.85k|#define SHN_XINDEX 0xffff
  ------------------
  |  Branch (393:9): [True: 46, False: 2.80k]
  ------------------
  394|     46|        ehdr->ge_strndx_extended = TRUE;
  ------------------
  |  |   33|     46|#define TRUE 1
  ------------------
  395|  2.80k|    } else {
  396|  2.80k|        ehdr->ge_strndx_in_strndx = TRUE;
  ------------------
  |  |   33|  2.80k|#define TRUE 1
  ------------------
  397|  2.80k|        if (ehdr->ge_shstrndx < 1) {
  ------------------
  |  Branch (397:13): [True: 4, False: 2.80k]
  ------------------
  398|      4|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|      4|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
  399|      4|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
  400|      4|        }
  401|  2.80k|    }
  402|       |    /*  If !ge_strndx_extended && !ehdr->ge_shnum
  403|       |        this is a very unusual case.  */
  404|  2.84k|    if (!ehdr->ge_shnum) {
  ------------------
  |  Branch (404:9): [True: 104, False: 2.74k]
  ------------------
  405|    104|        ehdr->ge_shnum_extended = TRUE;
  ------------------
  |  |   33|    104|#define TRUE 1
  ------------------
  406|  2.74k|    } else {
  407|  2.74k|        ehdr->ge_shnum_in_shnum = TRUE;
  ------------------
  |  |   33|  2.74k|#define TRUE 1
  ------------------
  408|  2.74k|        if (!ehdr->ge_shnum) {
  ------------------
  |  Branch (408:13): [True: 0, False: 2.74k]
  ------------------
  409|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  410|      0|        }
  411|  2.74k|        if (ehdr->ge_shnum < 3) {
  ------------------
  |  Branch (411:13): [True: 2, False: 2.74k]
  ------------------
  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.74k|    }
  416|  2.84k|    if (ehdr->ge_shnum_in_shnum &&
  ------------------
  |  Branch (416:9): [True: 2.74k, False: 104]
  ------------------
  417|  2.74k|        ehdr->ge_strndx_in_strndx &&
  ------------------
  |  Branch (417:9): [True: 2.70k, False: 39]
  ------------------
  418|  2.70k|        (ehdr->ge_shstrndx >= ehdr->ge_shnum)) {
  ------------------
  |  Branch (418:9): [True: 18, False: 2.68k]
  ------------------
  419|     18|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|     18|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
  420|     18|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     18|#define DW_DLV_ERROR      1
  ------------------
  421|     18|    }
  422|       |
  423|  2.82k|    ep->f_machine = (unsigned int)ehdr->ge_machine;
  424|  2.82k|    ep->f_ftype = (unsigned int)ehdr->ge_type;
  425|  2.82k|    ep->f_ehdr = ehdr;
  426|  2.82k|    ep->f_loc_ehdr.g_name = "Elf File Header";
  427|  2.82k|    ep->f_loc_ehdr.g_offset = 0;
  428|  2.82k|    ep->f_loc_ehdr.g_count = 1;
  429|  2.82k|    ep->f_loc_ehdr.g_entrysize = sizeof(dw_elf32_ehdr);
  430|  2.82k|    ep->f_loc_ehdr.g_totalsize = sizeof(dw_elf32_ehdr);
  431|  2.82k|    return DW_DLV_OK;
  ------------------
  |  |   59|  2.82k|#define DW_DLV_OK         0
  ------------------
  432|  2.84k|}
dwarf_elf_load_headers.c:elf_load_elf_header64:
 1963|  1.63k|{
 1964|  1.63k|    int res = 0;
 1965|  1.63k|    dw_elf64_ehdr ehdr64;
 1966|  1.63k|    struct generic_ehdr *ehdr = 0;
 1967|       |
 1968|  1.63k|    ehdr64 = eh64_zero;
 1969|  1.63k|    res = RRMOA(ep->f_fd,&ehdr64,0,sizeof(ehdr64),
  ------------------
  |  |   65|  1.63k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  1.63k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1970|  1.63k|        ep->f_filesize,errcode);
 1971|  1.63k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.63k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1971:9): [True: 3, False: 1.63k]
  ------------------
 1972|      3|        return res;
 1973|      3|    }
 1974|  1.63k|    ehdr = (struct generic_ehdr *)calloc(1,
 1975|  1.63k|        sizeof(struct generic_ehdr));
 1976|  1.63k|    if (!ehdr) {
  ------------------
  |  Branch (1976:9): [True: 0, False: 1.63k]
  ------------------
 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.63k|    res  = generic_ehdr_from_64(ep,ehdr,&ehdr64,errcode);
 1981|  1.63k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.63k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1981:9): [True: 41, False: 1.58k]
  ------------------
 1982|     41|        free(ehdr);
 1983|     41|        return res;
 1984|     41|    }
 1985|  1.58k|    ep->f_machine = (unsigned)ehdr->ge_machine;
 1986|  1.58k|    ep->f_flags = ehdr->ge_flags;
 1987|  1.58k|    return res;
 1988|  1.63k|}
dwarf_elf_load_headers.c:generic_ehdr_from_64:
  438|  1.63k|{
  439|  1.63k|    int i = 0;
  440|       |
  441|  27.7k|    for (i = 0; i < EI_NIDENT; ++i) {
  ------------------
  |  |  926|  27.7k|#define EI_NIDENT 16
  ------------------
  |  Branch (441:17): [True: 26.0k, False: 1.63k]
  ------------------
  442|  26.0k|        ehdr->ge_ident[i] = e->e_ident[i];
  443|  26.0k|    }
  444|  1.63k|    ASNAR(ep->f_copy_word,ehdr->ge_type,e->e_type);
  ------------------
  |  |   53|  1.63k|    do {                                        \
  |  |   54|  1.63k|        (t) = 0;                                \
  |  |   55|  1.63k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.63k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.63k]
  |  |  ------------------
  ------------------
  445|  1.63k|    ASNAR(ep->f_copy_word,ehdr->ge_machine,e->e_machine);
  ------------------
  |  |   53|  1.63k|    do {                                        \
  |  |   54|  1.63k|        (t) = 0;                                \
  |  |   55|  1.63k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.63k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.63k]
  |  |  ------------------
  ------------------
  446|  1.63k|    ASNAR(ep->f_copy_word,ehdr->ge_version,e->e_version);
  ------------------
  |  |   53|  1.63k|    do {                                        \
  |  |   54|  1.63k|        (t) = 0;                                \
  |  |   55|  1.63k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.63k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.63k]
  |  |  ------------------
  ------------------
  447|  1.63k|    ASNAR(ep->f_copy_word,ehdr->ge_entry,e->e_entry);
  ------------------
  |  |   53|  1.63k|    do {                                        \
  |  |   54|  1.63k|        (t) = 0;                                \
  |  |   55|  1.63k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.63k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.63k]
  |  |  ------------------
  ------------------
  448|  1.63k|    ASNAR(ep->f_copy_word,ehdr->ge_phoff,e->e_phoff);
  ------------------
  |  |   53|  1.63k|    do {                                        \
  |  |   54|  1.63k|        (t) = 0;                                \
  |  |   55|  1.63k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.63k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.63k]
  |  |  ------------------
  ------------------
  449|  1.63k|    ASNAR(ep->f_copy_word,ehdr->ge_shoff,e->e_shoff);
  ------------------
  |  |   53|  1.63k|    do {                                        \
  |  |   54|  1.63k|        (t) = 0;                                \
  |  |   55|  1.63k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.63k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.63k]
  |  |  ------------------
  ------------------
  450|  1.63k|    ASNAR(ep->f_copy_word,ehdr->ge_flags,e->e_flags);
  ------------------
  |  |   53|  1.63k|    do {                                        \
  |  |   54|  1.63k|        (t) = 0;                                \
  |  |   55|  1.63k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.63k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.63k]
  |  |  ------------------
  ------------------
  451|  1.63k|    ASNAR(ep->f_copy_word,ehdr->ge_ehsize,e->e_ehsize);
  ------------------
  |  |   53|  1.63k|    do {                                        \
  |  |   54|  1.63k|        (t) = 0;                                \
  |  |   55|  1.63k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.63k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.63k]
  |  |  ------------------
  ------------------
  452|  1.63k|    ASNAR(ep->f_copy_word,ehdr->ge_phentsize,e->e_phentsize);
  ------------------
  |  |   53|  1.63k|    do {                                        \
  |  |   54|  1.63k|        (t) = 0;                                \
  |  |   55|  1.63k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.63k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.63k]
  |  |  ------------------
  ------------------
  453|  1.63k|    ASNAR(ep->f_copy_word,ehdr->ge_phnum,e->e_phnum);
  ------------------
  |  |   53|  1.63k|    do {                                        \
  |  |   54|  1.63k|        (t) = 0;                                \
  |  |   55|  1.63k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.63k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.63k]
  |  |  ------------------
  ------------------
  454|  1.63k|    ASNAR(ep->f_copy_word,ehdr->ge_shentsize,e->e_shentsize);
  ------------------
  |  |   53|  1.63k|    do {                                        \
  |  |   54|  1.63k|        (t) = 0;                                \
  |  |   55|  1.63k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.63k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.63k]
  |  |  ------------------
  ------------------
  455|  1.63k|    ASNAR(ep->f_copy_word,ehdr->ge_shnum,e->e_shnum);
  ------------------
  |  |   53|  1.63k|    do {                                        \
  |  |   54|  1.63k|        (t) = 0;                                \
  |  |   55|  1.63k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.63k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.63k]
  |  |  ------------------
  ------------------
  456|  1.63k|    ASNAR(ep->f_copy_word,ehdr->ge_shstrndx,e->e_shstrndx);
  ------------------
  |  |   53|  1.63k|    do {                                        \
  |  |   54|  1.63k|        (t) = 0;                                \
  |  |   55|  1.63k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.63k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.63k]
  |  |  ------------------
  ------------------
  457|  1.63k|    if (!ehdr->ge_shoff) {
  ------------------
  |  Branch (457:9): [True: 1, False: 1.62k]
  ------------------
  458|      1|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      1|#define DW_DLV_NO_ENTRY  -1
  ------------------
  459|      1|    }
  460|  1.62k|    if (ehdr->ge_shoff < sizeof(dw_elf64_ehdr)) {
  ------------------
  |  Branch (460:9): [True: 6, False: 1.62k]
  ------------------
  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.62k|    if (ehdr->ge_shstrndx == SHN_XINDEX) {
  ------------------
  |  |  302|  1.62k|#define SHN_XINDEX 0xffff
  ------------------
  |  Branch (465:9): [True: 406, False: 1.21k]
  ------------------
  466|    406|        ehdr->ge_strndx_extended = TRUE;
  ------------------
  |  |   33|    406|#define TRUE 1
  ------------------
  467|  1.21k|    } else {
  468|  1.21k|        ehdr->ge_strndx_in_strndx = TRUE;
  ------------------
  |  |   33|  1.21k|#define TRUE 1
  ------------------
  469|  1.21k|        if (ehdr->ge_shstrndx < 1) {
  ------------------
  |  Branch (469:13): [True: 6, False: 1.21k]
  ------------------
  470|      6|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|      6|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
  471|      6|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      6|#define DW_DLV_ERROR      1
  ------------------
  472|      6|        }
  473|  1.21k|    }
  474|  1.61k|    if (!ehdr->ge_shnum) {
  ------------------
  |  Branch (474:9): [True: 182, False: 1.43k]
  ------------------
  475|    182|        ehdr->ge_shnum_extended = TRUE;
  ------------------
  |  |   33|    182|#define TRUE 1
  ------------------
  476|  1.43k|    } else {
  477|  1.43k|        ehdr->ge_shnum_in_shnum = TRUE;
  ------------------
  |  |   33|  1.43k|#define TRUE 1
  ------------------
  478|  1.43k|        if (!ehdr->ge_shnum) {
  ------------------
  |  Branch (478:13): [True: 0, False: 1.43k]
  ------------------
  479|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  480|      0|        }
  481|  1.43k|        if (ehdr->ge_shnum < 3) {
  ------------------
  |  Branch (481:13): [True: 4, False: 1.43k]
  ------------------
  482|      4|            *errcode = DW_DLE_TOO_FEW_SECTIONS;
  ------------------
  |  | 1540|      4|#define DW_DLE_TOO_FEW_SECTIONS                494
  ------------------
  483|      4|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
  484|      4|        }
  485|  1.43k|    }
  486|  1.61k|    if (ehdr->ge_shnum_in_shnum &&
  ------------------
  |  Branch (486:9): [True: 1.43k, False: 182]
  ------------------
  487|  1.43k|        ehdr->ge_strndx_in_strndx &&
  ------------------
  |  Branch (487:9): [True: 1.03k, False: 397]
  ------------------
  488|  1.03k|        (ehdr->ge_shstrndx >= ehdr->ge_shnum)) {
  ------------------
  |  Branch (488:9): [True: 24, False: 1.01k]
  ------------------
  489|     24|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|     24|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
  490|     24|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     24|#define DW_DLV_ERROR      1
  ------------------
  491|     24|    }
  492|  1.58k|    ep->f_machine = (unsigned int)ehdr->ge_machine;
  493|  1.58k|    ep->f_ftype = (unsigned int)ehdr->ge_type;
  494|  1.58k|    ep->f_ehdr = ehdr;
  495|  1.58k|    ep->f_loc_ehdr.g_name = "Elf File Header";
  496|  1.58k|    ep->f_loc_ehdr.g_offset = 0;
  497|  1.58k|    ep->f_loc_ehdr.g_count = 1;
  498|  1.58k|    ep->f_loc_ehdr.g_entrysize = sizeof(dw_elf64_ehdr);
  499|  1.58k|    ep->f_loc_ehdr.g_totalsize = sizeof(dw_elf64_ehdr);
  500|  1.58k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.58k|#define DW_DLV_OK         0
  ------------------
  501|  1.61k|}
dwarf_elf_load_headers.c:elf_load_sectheaders32:
 1450|  2.82k|{
 1451|  2.82k|    Dwarf_Unsigned generic_count = 0;
 1452|  2.82k|    Dwarf_Unsigned shdr_count = 0;
 1453|  2.82k|    Dwarf_Bool have_shdr_count = FALSE;
  ------------------
  |  |   36|  2.82k|#define FALSE 0
  ------------------
 1454|  2.82k|    Dwarf_Unsigned shstrndx_number = 0;
 1455|  2.82k|    Dwarf_Bool have_shstrndx_number = FALSE;
  ------------------
  |  |   36|  2.82k|#define FALSE 0
  ------------------
 1456|  2.82k|    struct generic_ehdr *ehp = 0;
 1457|  2.82k|    int res = 0;
 1458|       |
 1459|  2.82k|    if (entsize < sizeof(dw_elf32_shdr)) {
  ------------------
  |  Branch (1459:9): [True: 7, False: 2.82k]
  ------------------
 1460|      7|        *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      7|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1461|      7|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      7|#define DW_DLV_ERROR      1
  ------------------
 1462|      7|    }
 1463|  2.82k|    ehp = ep->f_ehdr;
 1464|  2.82k|    if (!ehp->ge_shnum_in_shnum || !ehp->ge_strndx_in_strndx) {
  ------------------
  |  Branch (1464:9): [True: 100, False: 2.72k]
  |  Branch (1464:36): [True: 39, False: 2.68k]
  ------------------
 1465|    139|        res = get_counts_from_sec32_zero(ep,offset,
 1466|    139|            &have_shdr_count,&shdr_count,
 1467|    139|            &have_shstrndx_number,&shstrndx_number,
 1468|    139|            errcode);
 1469|    139|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    139|#define DW_DLV_OK         0
  ------------------
  |  Branch (1469:13): [True: 78, False: 61]
  ------------------
 1470|     78|            return res;
 1471|     78|        }
 1472|     61|        if (have_shdr_count) {
  ------------------
  |  Branch (1472:13): [True: 61, False: 0]
  ------------------
 1473|     61|            count = shdr_count;
 1474|     61|        }
 1475|     61|    }
 1476|  2.74k|    if (count == 0) {
  ------------------
  |  Branch (1476:9): [True: 0, False: 2.74k]
  ------------------
 1477|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1478|      0|    }
 1479|  2.74k|    if ((offset > ep->f_filesize)||
  ------------------
  |  Branch (1479:9): [True: 49, False: 2.69k]
  ------------------
 1480|  2.69k|        (entsize > 200)||
  ------------------
  |  Branch (1480:9): [True: 21, False: 2.67k]
  ------------------
 1481|  2.67k|        (count > ep->f_filesize) ||
  ------------------
  |  Branch (1481:9): [True: 54, False: 2.61k]
  ------------------
 1482|  2.61k|        ((count *entsize +offset) > ep->f_filesize)) {
  ------------------
  |  Branch (1482:9): [True: 22, False: 2.59k]
  ------------------
 1483|    146|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|    146|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1484|    146|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    146|#define DW_DLV_ERROR      1
  ------------------
 1485|    146|    }
 1486|  2.59k|    res = generic_shdr_from_shdr32(ep,&generic_count,
 1487|  2.59k|        offset,entsize,count,errcode);
 1488|  2.59k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.59k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1488:9): [True: 166, False: 2.43k]
  ------------------
 1489|    166|        return res;
 1490|    166|    }
 1491|  2.43k|    if (generic_count != count) {
  ------------------
  |  Branch (1491:9): [True: 0, False: 2.43k]
  ------------------
 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.43k|    return DW_DLV_OK;
  ------------------
  |  |   59|  2.43k|#define DW_DLV_OK         0
  ------------------
 1496|  2.43k|}
dwarf_elf_load_headers.c:get_counts_from_sec32_zero:
 1403|    139|{
 1404|    139|    dw_elf32_shdr       shd32;
 1405|    139|    struct generic_shdr shdg;
 1406|    139|    int res = 0;
 1407|    139|    Dwarf_Unsigned size = sizeof(shd32);
 1408|    139|    struct generic_ehdr * geh  = ep->f_ehdr;
 1409|       |
 1410|    139|    shd32 =  shd32zero;
 1411|    139|    shdg  = shdgzero;
 1412|    139|    res = RRMOA(ep->f_fd,&shd32,offset,size,
  ------------------
  |  |   65|    139|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    139|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1413|    139|        ep->f_filesize,errcode);
 1414|    139|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    139|#define DW_DLV_OK         0
  ------------------
  |  Branch (1414:9): [True: 42, False: 97]
  ------------------
 1415|     42|        return res;
 1416|     42|    }
 1417|     97|    copysection32(ep,&shdg,&shd32);
 1418|     97|    if (geh->ge_shnum_extended) {
  ------------------
  |  Branch (1418:9): [True: 71, False: 26]
  ------------------
 1419|     71|        geh->ge_shnum = shdg.gh_size;
 1420|     71|        geh->ge_shnum_in_shnum = TRUE;
  ------------------
  |  |   33|     71|#define TRUE 1
  ------------------
 1421|     71|        if (geh->ge_shnum  < 3) {
  ------------------
  |  Branch (1421:13): [True: 2, False: 69]
  ------------------
 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|     71|    }
 1426|     95|    *have_shdr_count = TRUE;
  ------------------
  |  |   33|     95|#define TRUE 1
  ------------------
 1427|     95|    *shdr_count = geh->ge_shnum;
 1428|     95|    if (geh->ge_strndx_extended) {
  ------------------
  |  Branch (1428:9): [True: 31, False: 64]
  ------------------
 1429|     31|        geh->ge_shstrndx = shdg.gh_link;
 1430|     31|        geh->ge_strndx_in_strndx = TRUE;
  ------------------
  |  |   33|     31|#define TRUE 1
  ------------------
 1431|     31|    }
 1432|     95|    if (geh->ge_shnum_in_shnum &&
  ------------------
  |  Branch (1432:9): [True: 95, False: 0]
  ------------------
 1433|     95|        geh->ge_strndx_in_strndx&&
  ------------------
  |  Branch (1433:9): [True: 95, False: 0]
  ------------------
 1434|     95|        (geh->ge_shstrndx >= geh->ge_shnum)) {
  ------------------
  |  Branch (1434:9): [True: 34, False: 61]
  ------------------
 1435|     34|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|     34|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
 1436|     34|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     34|#define DW_DLV_ERROR      1
  ------------------
 1437|     34|    }
 1438|     61|    *have_shstrndx_number = TRUE;
  ------------------
  |  |   33|     61|#define TRUE 1
  ------------------
 1439|     61|    *shstrndx_number = geh->ge_shstrndx;
 1440|     61|    return DW_DLV_OK;
  ------------------
  |  |   59|     61|#define DW_DLV_OK         0
  ------------------
 1441|     95|}
dwarf_elf_load_headers.c:copysection32:
  508|   181k|{
  509|   181k|    ASNAR(ep->f_copy_word,gshdr->gh_name,psh->sh_name);
  ------------------
  |  |   53|   181k|    do {                                        \
  |  |   54|   181k|        (t) = 0;                                \
  |  |   55|   181k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   181k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 181k]
  |  |  ------------------
  ------------------
  510|   181k|    ASNAR(ep->f_copy_word,gshdr->gh_type,psh->sh_type);
  ------------------
  |  |   53|   181k|    do {                                        \
  |  |   54|   181k|        (t) = 0;                                \
  |  |   55|   181k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   181k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 181k]
  |  |  ------------------
  ------------------
  511|   181k|    ASNAR(ep->f_copy_word,gshdr->gh_flags,psh->sh_flags);
  ------------------
  |  |   53|   181k|    do {                                        \
  |  |   54|   181k|        (t) = 0;                                \
  |  |   55|   181k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   181k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 181k]
  |  |  ------------------
  ------------------
  512|   181k|    ASNAR(ep->f_copy_word,gshdr->gh_addr,psh->sh_addr);
  ------------------
  |  |   53|   181k|    do {                                        \
  |  |   54|   181k|        (t) = 0;                                \
  |  |   55|   181k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   181k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 181k]
  |  |  ------------------
  ------------------
  513|   181k|    ASNAR(ep->f_copy_word,gshdr->gh_offset,psh->sh_offset);
  ------------------
  |  |   53|   181k|    do {                                        \
  |  |   54|   181k|        (t) = 0;                                \
  |  |   55|   181k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   181k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 181k]
  |  |  ------------------
  ------------------
  514|   181k|    ASNAR(ep->f_copy_word,gshdr->gh_size,psh->sh_size);
  ------------------
  |  |   53|   181k|    do {                                        \
  |  |   54|   181k|        (t) = 0;                                \
  |  |   55|   181k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   181k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 181k]
  |  |  ------------------
  ------------------
  515|   181k|    ASNAR(ep->f_copy_word,gshdr->gh_link,psh->sh_link);
  ------------------
  |  |   53|   181k|    do {                                        \
  |  |   54|   181k|        (t) = 0;                                \
  |  |   55|   181k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   181k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 181k]
  |  |  ------------------
  ------------------
  516|   181k|    ASNAR(ep->f_copy_word,gshdr->gh_info,psh->sh_info);
  ------------------
  |  |   53|   181k|    do {                                        \
  |  |   54|   181k|        (t) = 0;                                \
  |  |   55|   181k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   181k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 181k]
  |  |  ------------------
  ------------------
  517|   181k|    ASNAR(ep->f_copy_word,gshdr->gh_addralign,psh->sh_addralign);
  ------------------
  |  |   53|   181k|    do {                                        \
  |  |   54|   181k|        (t) = 0;                                \
  |  |   55|   181k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   181k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 181k]
  |  |  ------------------
  ------------------
  518|   181k|    ASNAR(ep->f_copy_word,gshdr->gh_entsize,psh->sh_entsize);
  ------------------
  |  |   53|   181k|    do {                                        \
  |  |   54|   181k|        (t) = 0;                                \
  |  |   55|   181k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   181k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 181k]
  |  |  ------------------
  ------------------
  519|   181k|}
dwarf_elf_load_headers.c:generic_shdr_from_shdr32:
  528|  2.59k|{
  529|  2.59k|    dw_elf32_shdr          *psh =0;
  530|  2.59k|    dw_elf32_shdr          *orig_psh =0;
  531|  2.59k|    struct generic_ehdr *ehdr = ep->f_ehdr;
  532|  2.59k|    struct generic_shdr *gshdr =0;
  533|  2.59k|    struct generic_shdr *orig_gshdr =0;
  534|  2.59k|    Dwarf_Unsigned i = 0;
  535|  2.59k|    int res = 0;
  536|       |
  537|  2.59k|    *count_out = 0;
  538|  2.59k|    psh = (dw_elf32_shdr *)calloc(count , entsize);
  539|  2.59k|    if (!psh) {
  ------------------
  |  Branch (539:9): [True: 0, False: 2.59k]
  ------------------
  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.59k|    gshdr = (struct generic_shdr *)calloc(count,sizeof(*gshdr));
  544|  2.59k|    if (!gshdr) {
  ------------------
  |  Branch (544:9): [True: 0, False: 2.59k]
  ------------------
  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.59k|    orig_psh = psh;
  551|  2.59k|    orig_gshdr = gshdr;
  552|  2.59k|    res = RRMOA(ep->f_fd,psh,offset,count*entsize,
  ------------------
  |  |   65|  2.59k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  2.59k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  553|  2.59k|        ep->f_filesize,errcode);
  554|  2.59k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.59k|#define DW_DLV_OK         0
  ------------------
  |  Branch (554:9): [True: 0, False: 2.59k]
  ------------------
  555|      0|        free(orig_psh);
  556|      0|        free(orig_gshdr);
  557|      0|        return res;
  558|      0|    }
  559|   183k|    for (i = 0; i < count;
  ------------------
  |  Branch (559:17): [True: 181k, False: 2.43k]
  ------------------
  560|   181k|        ++i,  psh++,gshdr++) {
  561|   181k|        int isempty     = FALSE;
  ------------------
  |  |   36|   181k|#define FALSE 0
  ------------------
  562|   181k|        int bitsoncount = 0;
  563|       |
  564|   181k|        gshdr->gh_secnum = i;
  565|   181k|        copysection32(ep,gshdr,psh);
  566|   181k|        if (gshdr->gh_size >= ep->f_filesize &&
  ------------------
  |  Branch (566:13): [True: 598, False: 180k]
  ------------------
  567|    598|            gshdr->gh_type != SHT_NOBITS) {
  ------------------
  |  |   87|    598|#define SHT_NOBITS 8
  ------------------
  |  Branch (567:13): [True: 13, False: 585]
  ------------------
  568|     13|            free(orig_psh);
  569|     13|            free(orig_gshdr);
  570|     13|            *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|     13|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
  571|     13|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     13|#define DW_DLV_ERROR      1
  ------------------
  572|     13|        }
  573|   181k|        isempty = is_empty_section(gshdr->gh_type);
  574|   181k|        if (i == 0) {
  ------------------
  |  Branch (574:13): [True: 2.59k, False: 178k]
  ------------------
  575|  2.59k|            Dwarf_Unsigned shnum = 0;
  576|  2.59k|            Dwarf_Unsigned shstrx = 0;
  577|       |
  578|       |            /*  Catch errors asap */
  579|  2.59k|            if (!ehdr->ge_shnum_extended) {
  ------------------
  |  Branch (579:17): [True: 2.58k, False: 7]
  ------------------
  580|  2.58k|                shnum = gshdr->gh_size;
  581|  2.58k|            }
  582|  2.59k|            if (!ehdr->ge_strndx_extended) {
  ------------------
  |  Branch (582:17): [True: 2.58k, False: 8]
  ------------------
  583|  2.58k|                shstrx = gshdr->gh_link;
  584|  2.58k|            }
  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.59k|            if (!isempty || gshdr->gh_name || gshdr->gh_flags ||
  ------------------
  |  Branch (590:17): [True: 2, False: 2.59k]
  |  Branch (590:29): [True: 32, False: 2.55k]
  |  Branch (590:47): [True: 27, False: 2.53k]
  ------------------
  591|  2.53k|                shnum || shstrx ||
  ------------------
  |  Branch (591:17): [True: 9, False: 2.52k]
  |  Branch (591:26): [True: 1, False: 2.52k]
  ------------------
  592|  2.52k|                gshdr->gh_addr ||
  ------------------
  |  Branch (592:17): [True: 29, False: 2.49k]
  ------------------
  593|  2.49k|                gshdr->gh_info) {
  ------------------
  |  Branch (593:17): [True: 28, False: 2.46k]
  ------------------
  594|    128|                free(orig_psh);
  595|    128|                free(orig_gshdr);
  596|    128|                *errcode = DW_DLE_IMPROPER_SECTION_ZERO;
  ------------------
  |  | 1543|    128|#define DW_DLE_IMPROPER_SECTION_ZERO           497
  ------------------
  597|    128|                return DW_DLV_ERROR;
  ------------------
  |  |   60|    128|#define DW_DLV_ERROR      1
  ------------------
  598|    128|            }
  599|  2.59k|        }
  600|   181k|        bitsoncount = getbitsoncount(gshdr->gh_flags);
  601|   181k|        if (bitsoncount > 8) {
  ------------------
  |  Branch (601:13): [True: 25, False: 181k]
  ------------------
  602|     25|            free(orig_psh);
  603|     25|            free(orig_gshdr);
  604|     25|            *errcode = DW_DLE_BAD_SECTION_FLAGS;
  ------------------
  |  | 1542|     25|#define DW_DLE_BAD_SECTION_FLAGS               496
  ------------------
  605|     25|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     25|#define DW_DLV_ERROR      1
  ------------------
  606|     25|        }
  607|       |
  608|   181k|        if (gshdr->gh_type == SHT_REL || gshdr->gh_type == SHT_RELA){
  ------------------
  |  |   59|   362k|#define SHT_REL 9
  ------------------
                      if (gshdr->gh_type == SHT_REL || gshdr->gh_type == SHT_RELA){
  ------------------
  |  |   56|   179k|#define SHT_RELA 4
  ------------------
  |  Branch (608:13): [True: 1.71k, False: 179k]
  |  Branch (608:42): [True: 2.86k, False: 176k]
  ------------------
  609|  4.57k|            gshdr->gh_reloc_target_secnum = gshdr->gh_info;
  610|  4.57k|        }
  611|   181k|    }
  612|  2.43k|    free(orig_psh);
  613|  2.43k|    *count_out = count;
  614|  2.43k|    ep->f_shdr = orig_gshdr;
  615|  2.43k|    ep->f_loc_shdr.g_name = "Section Header";
  616|  2.43k|    ep->f_loc_shdr.g_count = count;
  617|  2.43k|    ep->f_loc_shdr.g_offset = offset;
  618|  2.43k|    ep->f_loc_shdr.g_entrysize = sizeof(dw_elf32_shdr);
  619|  2.43k|    ep->f_loc_shdr.g_totalsize = sizeof(dw_elf32_shdr)*count;
  620|  2.43k|    return DW_DLV_OK;
  ------------------
  |  |   59|  2.43k|#define DW_DLV_OK         0
  ------------------
  621|  2.59k|}
dwarf_elf_load_headers.c:getbitsoncount:
  152|   190k|{
  153|   190k|    int           bitscount = 0;
  154|   190k|    Dwarf_Unsigned v = v_in;
  155|       |
  156|   291k|    while (v) {
  ------------------
  |  Branch (156:12): [True: 100k, False: 190k]
  ------------------
  157|   100k|        unsigned int nibble = v & 0xf;
  158|   100k|        bitscount += nibblecounts[nibble];
  159|   100k|        v >>= 4;
  160|   100k|    }
  161|   190k|    return bitscount;
  162|   190k|}
dwarf_elf_load_headers.c:elf_load_sectheaders64:
 1555|  1.58k|{
 1556|  1.58k|    Dwarf_Unsigned generic_count = 0;
 1557|  1.58k|    Dwarf_Unsigned shdr_count = 0;
 1558|  1.58k|    Dwarf_Bool have_shdr_count = FALSE;
  ------------------
  |  |   36|  1.58k|#define FALSE 0
  ------------------
 1559|  1.58k|    Dwarf_Unsigned shstrndx_number = 0;
 1560|  1.58k|    Dwarf_Bool have_shstrndx_number = FALSE;
  ------------------
  |  |   36|  1.58k|#define FALSE 0
  ------------------
 1561|  1.58k|    struct generic_ehdr *ehp = 0;
 1562|  1.58k|    int res = 0;
 1563|       |
 1564|  1.58k|    ehp = ep->f_ehdr;
 1565|  1.58k|    if (!ehp->ge_shnum_in_shnum || !ehp->ge_strndx_in_strndx ) {
  ------------------
  |  Branch (1565:9): [True: 182, False: 1.40k]
  |  Branch (1565:36): [True: 397, False: 1.01k]
  ------------------
 1566|    579|        res = get_counts_from_sec64_zero(ep,offset,
 1567|    579|            &have_shdr_count,&shdr_count,
 1568|    579|            &have_shstrndx_number,&shstrndx_number,
 1569|    579|            errcode);
 1570|    579|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    579|#define DW_DLV_OK         0
  ------------------
  |  Branch (1570:13): [True: 80, False: 499]
  ------------------
 1571|     80|            return res;
 1572|     80|        }
 1573|    499|        if (have_shdr_count) {
  ------------------
  |  Branch (1573:13): [True: 499, False: 0]
  ------------------
 1574|    499|            count = shdr_count;
 1575|    499|        }
 1576|    499|    }
 1577|  1.50k|    if (count == 0) {
  ------------------
  |  Branch (1577:9): [True: 0, False: 1.50k]
  ------------------
 1578|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1579|      0|    }
 1580|  1.50k|    if (entsize < sizeof(dw_elf64_shdr)) {
  ------------------
  |  Branch (1580:9): [True: 35, False: 1.47k]
  ------------------
 1581|     35|        *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|     35|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1582|     35|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     35|#define DW_DLV_ERROR      1
  ------------------
 1583|     35|    }
 1584|  1.47k|    if ((offset > ep->f_filesize)||
  ------------------
  |  Branch (1584:9): [True: 102, False: 1.37k]
  ------------------
 1585|  1.37k|        (entsize > 200)||
  ------------------
  |  Branch (1585:9): [True: 24, False: 1.34k]
  ------------------
 1586|  1.34k|        (count > ep->f_filesize) ||
  ------------------
  |  Branch (1586:9): [True: 97, False: 1.25k]
  ------------------
 1587|  1.25k|        ((count *entsize +offset) > ep->f_filesize)) {
  ------------------
  |  Branch (1587:9): [True: 39, False: 1.21k]
  ------------------
 1588|    262|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|    262|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1589|    262|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    262|#define DW_DLV_ERROR      1
  ------------------
 1590|    262|    }
 1591|       |
 1592|  1.21k|    res = generic_shdr_from_shdr64(ep,&generic_count,
 1593|  1.21k|        offset,entsize,count,errcode);
 1594|  1.21k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.21k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1594:9): [True: 386, False: 826]
  ------------------
 1595|    386|        return res;
 1596|    386|    }
 1597|    826|    if (generic_count != count) {
  ------------------
  |  Branch (1597:9): [True: 0, False: 826]
  ------------------
 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|    826|    return DW_DLV_OK;
  ------------------
  |  |   59|    826|#define DW_DLV_OK         0
  ------------------
 1602|    826|}
dwarf_elf_load_headers.c:get_counts_from_sec64_zero:
 1509|    579|{
 1510|    579|    dw_elf64_shdr       shd64;
 1511|    579|    struct generic_shdr shdg;
 1512|    579|    int res = 0;
 1513|    579|    Dwarf_Unsigned size = sizeof(shd64);
 1514|    579|    struct generic_ehdr * geh  = ep->f_ehdr;
 1515|       |
 1516|    579|    shd64 =  shd64zero;
 1517|    579|    shdg  = shdgzero;
 1518|    579|    res = RRMOA(ep->f_fd,&shd64,offset,size,
  ------------------
  |  |   65|    579|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    579|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1519|    579|        ep->f_filesize,errcode);
 1520|    579|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    579|#define DW_DLV_OK         0
  ------------------
  |  Branch (1520:9): [True: 64, False: 515]
  ------------------
 1521|     64|        return res;
 1522|     64|    }
 1523|    515|    copysection64(ep,&shdg,&shd64);
 1524|    515|    if (geh->ge_shnum_extended) {
  ------------------
  |  Branch (1524:9): [True: 142, False: 373]
  ------------------
 1525|    142|        geh->ge_shnum = shdg.gh_size;
 1526|    142|        geh->ge_shnum_in_shnum = TRUE;
  ------------------
  |  |   33|    142|#define TRUE 1
  ------------------
 1527|    142|        if (geh->ge_shnum  < 3) {
  ------------------
  |  Branch (1527:13): [True: 2, False: 140]
  ------------------
 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|    142|    }
 1532|    513|    *have_shdr_count = TRUE;
  ------------------
  |  |   33|    513|#define TRUE 1
  ------------------
 1533|    513|    *shdr_count = geh->ge_shnum;
 1534|    513|    if (geh->ge_strndx_extended) {
  ------------------
  |  Branch (1534:9): [True: 380, False: 133]
  ------------------
 1535|    380|        geh->ge_shstrndx = shdg.gh_link;
 1536|    380|        geh->ge_strndx_in_strndx = TRUE;
  ------------------
  |  |   33|    380|#define TRUE 1
  ------------------
 1537|    380|    }
 1538|    513|    if (geh->ge_shnum_in_shnum    &&
  ------------------
  |  Branch (1538:9): [True: 513, False: 0]
  ------------------
 1539|    513|        geh->ge_strndx_in_strndx &&
  ------------------
  |  Branch (1539:9): [True: 513, False: 0]
  ------------------
 1540|    513|        (geh->ge_shstrndx >= geh->ge_shnum)) {
  ------------------
  |  Branch (1540:9): [True: 14, False: 499]
  ------------------
 1541|     14|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|     14|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
 1542|     14|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     14|#define DW_DLV_ERROR      1
  ------------------
 1543|     14|    }
 1544|       |
 1545|    499|    *have_shstrndx_number = TRUE;
  ------------------
  |  |   33|    499|#define TRUE 1
  ------------------
 1546|    499|    *shstrndx_number = geh->ge_shstrndx;
 1547|    499|    return DW_DLV_OK;
  ------------------
  |  |   59|    499|#define DW_DLV_OK         0
  ------------------
 1548|    513|}
dwarf_elf_load_headers.c:copysection64:
  628|  10.1k|{
  629|  10.1k|    ASNAR(ep->f_copy_word,gshdr->gh_name,psh->sh_name);
  ------------------
  |  |   53|  10.1k|    do {                                        \
  |  |   54|  10.1k|        (t) = 0;                                \
  |  |   55|  10.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  10.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 10.1k]
  |  |  ------------------
  ------------------
  630|  10.1k|    ASNAR(ep->f_copy_word,gshdr->gh_type,psh->sh_type);
  ------------------
  |  |   53|  10.1k|    do {                                        \
  |  |   54|  10.1k|        (t) = 0;                                \
  |  |   55|  10.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  10.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 10.1k]
  |  |  ------------------
  ------------------
  631|  10.1k|    ASNAR(ep->f_copy_word,gshdr->gh_flags,psh->sh_flags);
  ------------------
  |  |   53|  10.1k|    do {                                        \
  |  |   54|  10.1k|        (t) = 0;                                \
  |  |   55|  10.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  10.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 10.1k]
  |  |  ------------------
  ------------------
  632|  10.1k|    ASNAR(ep->f_copy_word,gshdr->gh_addr,psh->sh_addr);
  ------------------
  |  |   53|  10.1k|    do {                                        \
  |  |   54|  10.1k|        (t) = 0;                                \
  |  |   55|  10.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  10.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 10.1k]
  |  |  ------------------
  ------------------
  633|  10.1k|    ASNAR(ep->f_copy_word,gshdr->gh_offset,psh->sh_offset);
  ------------------
  |  |   53|  10.1k|    do {                                        \
  |  |   54|  10.1k|        (t) = 0;                                \
  |  |   55|  10.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  10.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 10.1k]
  |  |  ------------------
  ------------------
  634|  10.1k|    ASNAR(ep->f_copy_word,gshdr->gh_size,psh->sh_size);
  ------------------
  |  |   53|  10.1k|    do {                                        \
  |  |   54|  10.1k|        (t) = 0;                                \
  |  |   55|  10.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  10.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 10.1k]
  |  |  ------------------
  ------------------
  635|  10.1k|    ASNAR(ep->f_copy_word,gshdr->gh_link,psh->sh_link);
  ------------------
  |  |   53|  10.1k|    do {                                        \
  |  |   54|  10.1k|        (t) = 0;                                \
  |  |   55|  10.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  10.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 10.1k]
  |  |  ------------------
  ------------------
  636|  10.1k|    ASNAR(ep->f_copy_word,gshdr->gh_info,psh->sh_info);
  ------------------
  |  |   53|  10.1k|    do {                                        \
  |  |   54|  10.1k|        (t) = 0;                                \
  |  |   55|  10.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  10.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 10.1k]
  |  |  ------------------
  ------------------
  637|  10.1k|    ASNAR(ep->f_copy_word,gshdr->gh_addralign,psh->sh_addralign);
  ------------------
  |  |   53|  10.1k|    do {                                        \
  |  |   54|  10.1k|        (t) = 0;                                \
  |  |   55|  10.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  10.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 10.1k]
  |  |  ------------------
  ------------------
  638|  10.1k|    ASNAR(ep->f_copy_word,gshdr->gh_entsize,psh->sh_entsize);
  ------------------
  |  |   53|  10.1k|    do {                                        \
  |  |   54|  10.1k|        (t) = 0;                                \
  |  |   55|  10.1k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  10.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 10.1k]
  |  |  ------------------
  ------------------
  639|  10.1k|}
dwarf_elf_load_headers.c:generic_shdr_from_shdr64:
  648|  1.21k|{
  649|  1.21k|    dw_elf64_shdr          *psh =0;
  650|  1.21k|    dw_elf64_shdr          *orig_psh =0;
  651|  1.21k|    struct generic_shdr *gshdr =0;
  652|  1.21k|    struct generic_shdr *orig_gshdr =0;
  653|  1.21k|    struct generic_ehdr *ehdr = ep->f_ehdr;
  654|  1.21k|    Dwarf_Unsigned i = 0;
  655|  1.21k|    int res = 0;
  656|       |
  657|  1.21k|    *count_out = 0;
  658|  1.21k|    psh = (dw_elf64_shdr *)calloc(count , entsize);
  659|  1.21k|    if (!psh) {
  ------------------
  |  Branch (659:9): [True: 0, False: 1.21k]
  ------------------
  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.21k|    gshdr = (struct generic_shdr *)calloc(count,sizeof(*gshdr));
  664|  1.21k|    if (gshdr == 0) {
  ------------------
  |  Branch (664:9): [True: 0, False: 1.21k]
  ------------------
  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.21k|    orig_psh = psh;
  670|  1.21k|    orig_gshdr = gshdr;
  671|  1.21k|    res = RRMOA(ep->f_fd,psh,offset,count*entsize,
  ------------------
  |  |   65|  1.21k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  1.21k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  672|  1.21k|        ep->f_filesize,errcode);
  673|  1.21k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.21k|#define DW_DLV_OK         0
  ------------------
  |  Branch (673:9): [True: 0, False: 1.21k]
  ------------------
  674|      0|        free(orig_psh);
  675|      0|        free(orig_gshdr);
  676|      0|        return res;
  677|      0|    }
  678|  10.4k|    for ( i = 0; i < count;
  ------------------
  |  Branch (678:18): [True: 9.61k, False: 826]
  ------------------
  679|  9.61k|        ++i,  psh++,gshdr++) {
  680|  9.61k|        int bitsoncount = 0;
  681|  9.61k|        int isempty = FALSE;
  ------------------
  |  |   36|  9.61k|#define FALSE 0
  ------------------
  682|       |
  683|  9.61k|        gshdr->gh_secnum = i;
  684|  9.61k|        copysection64(ep,gshdr,psh);
  685|  9.61k|        if (gshdr->gh_size >= ep->f_filesize &&
  ------------------
  |  Branch (685:13): [True: 673, False: 8.93k]
  ------------------
  686|    673|            gshdr->gh_type != SHT_NOBITS) {
  ------------------
  |  |   87|    673|#define SHT_NOBITS 8
  ------------------
  |  Branch (686:13): [True: 54, False: 619]
  ------------------
  687|     54|            free(orig_psh);
  688|     54|            free(orig_gshdr);
  689|     54|            *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|     54|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
  690|     54|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     54|#define DW_DLV_ERROR      1
  ------------------
  691|     54|        }
  692|  9.55k|        isempty = is_empty_section(gshdr->gh_type);
  693|  9.55k|        if (i == 0) {
  ------------------
  |  Branch (693:13): [True: 1.19k, False: 8.35k]
  ------------------
  694|  1.19k|            Dwarf_Unsigned shnum = 0;
  695|  1.19k|            Dwarf_Unsigned shstrx = 0;
  696|       |
  697|       |            /*  Catch errors asap */
  698|  1.19k|            if (!ehdr->ge_shnum_extended) {
  ------------------
  |  Branch (698:17): [True: 1.19k, False: 2]
  ------------------
  699|  1.19k|                shnum = gshdr->gh_size;
  700|  1.19k|            }
  701|  1.19k|            if (!ehdr->ge_strndx_extended) {
  ------------------
  |  Branch (701:17): [True: 850, False: 347]
  ------------------
  702|    850|                shstrx = gshdr->gh_link;
  703|    850|            }
  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.19k|            if (!isempty || gshdr->gh_name || gshdr->gh_flags ||
  ------------------
  |  Branch (708:17): [True: 3, False: 1.19k]
  |  Branch (708:29): [True: 29, False: 1.16k]
  |  Branch (708:47): [True: 123, False: 1.04k]
  ------------------
  709|  1.04k|                shnum || shstrx ||
  ------------------
  |  Branch (709:17): [True: 2, False: 1.04k]
  |  Branch (709:26): [True: 1, False: 1.03k]
  ------------------
  710|  1.03k|                gshdr->gh_addr ||
  ------------------
  |  Branch (710:17): [True: 79, False: 960]
  ------------------
  711|    960|                gshdr->gh_info) {
  ------------------
  |  Branch (711:17): [True: 19, False: 941]
  ------------------
  712|    256|                free(orig_psh);
  713|    256|                free(orig_gshdr);
  714|    256|                *errcode = DW_DLE_IMPROPER_SECTION_ZERO;
  ------------------
  |  | 1543|    256|#define DW_DLE_IMPROPER_SECTION_ZERO           497
  ------------------
  715|    256|                return DW_DLV_ERROR;
  ------------------
  |  |   60|    256|#define DW_DLV_ERROR      1
  ------------------
  716|    256|            }
  717|  1.19k|        }
  718|  9.30k|        bitsoncount = getbitsoncount(gshdr->gh_flags);
  719|  9.30k|        if (bitsoncount > 8) {
  ------------------
  |  Branch (719:13): [True: 76, False: 9.22k]
  ------------------
  720|     76|            free(orig_psh);
  721|     76|            free(orig_gshdr);
  722|     76|            *errcode = DW_DLE_BAD_SECTION_FLAGS;
  ------------------
  |  | 1542|     76|#define DW_DLE_BAD_SECTION_FLAGS               496
  ------------------
  723|     76|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     76|#define DW_DLV_ERROR      1
  ------------------
  724|     76|        }
  725|       |
  726|  9.22k|        if (gshdr->gh_type == SHT_REL ||
  ------------------
  |  |   59|  18.4k|#define SHT_REL 9
  ------------------
  |  Branch (726:13): [True: 613, False: 8.61k]
  ------------------
  727|  8.61k|            gshdr->gh_type == SHT_RELA){
  ------------------
  |  |   56|  8.61k|#define SHT_RELA 4
  ------------------
  |  Branch (727:13): [True: 1.30k, False: 7.31k]
  ------------------
  728|  1.91k|            gshdr->gh_reloc_target_secnum = gshdr->gh_info;
  729|  1.91k|        }
  730|  9.22k|    }
  731|    826|    free(orig_psh);
  732|    826|    *count_out = count;
  733|    826|    ep->f_shdr = orig_gshdr;
  734|    826|    ep->f_loc_shdr.g_name = "Section Header";
  735|    826|    ep->f_loc_shdr.g_count = count;
  736|    826|    ep->f_loc_shdr.g_offset = offset;
  737|    826|    ep->f_loc_shdr.g_entrysize = sizeof(dw_elf64_shdr);
  738|    826|    ep->f_loc_shdr.g_totalsize = sizeof(dw_elf64_shdr)*count;
  739|    826|    return DW_DLV_OK;
  ------------------
  |  |   59|    826|#define DW_DLV_OK         0
  ------------------
  740|  1.21k|}
dwarf_elf_load_headers.c:_dwarf_elf_load_sectstrings:
 1313|  3.25k|{
 1314|  3.25k|    int res = 0;
 1315|  3.25k|    struct generic_shdr *psh = 0;
 1316|  3.25k|    Dwarf_Unsigned secoffset = 0;
 1317|  3.25k|    Dwarf_Unsigned flags =  0;
 1318|       |
 1319|  3.25k|    if (stringsection >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (1319:9): [True: 0, False: 3.25k]
  ------------------
 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.25k|    psh = ep->f_shdr+stringsection;
 1324|  3.25k|    flags = psh->gh_flags;
 1325|       |
 1326|  3.25k|    secoffset = psh->gh_offset;
 1327|  3.25k|    if (is_empty_section(psh->gh_type)) {
  ------------------
  |  Branch (1327:9): [True: 29, False: 3.22k]
  ------------------
 1328|     29|        *errcode = DW_DLE_ELF_STRING_SECTION_MISSING;
  ------------------
  |  | 1489|     29|#define DW_DLE_ELF_STRING_SECTION_MISSING      443
  ------------------
 1329|     29|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     29|#define DW_DLV_ERROR      1
  ------------------
 1330|     29|    }
 1331|  3.22k|    if (secoffset >= ep->f_filesize ||
  ------------------
  |  Branch (1331:9): [True: 104, False: 3.12k]
  ------------------
 1332|  3.12k|        psh->gh_size > ep->f_filesize ||
  ------------------
  |  Branch (1332:9): [True: 0, False: 3.12k]
  ------------------
 1333|  3.12k|        (secoffset + psh->gh_size) > ep->f_filesize) {
  ------------------
  |  Branch (1333:9): [True: 18, False: 3.10k]
  ------------------
 1334|    122|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|    122|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1335|    122|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    122|#define DW_DLV_ERROR      1
  ------------------
 1336|    122|    }
 1337|  3.10k|    if (psh->gh_content) {
  ------------------
  |  Branch (1337:9): [True: 0, False: 3.10k]
  ------------------
 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.10k|    psh->gh_content = (char *)calloc(1,psh->gh_size+1);
 1343|  3.10k|    if (!psh->gh_content) {
  ------------------
  |  Branch (1343:9): [True: 0, False: 3.10k]
  ------------------
 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.10k|    res = RRMOA(ep->f_fd,psh->gh_content,secoffset,
  ------------------
  |  |   65|  3.10k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  3.10k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1348|  3.10k|        psh->gh_size,
 1349|  3.10k|        ep->f_filesize,errcode);
 1350|  3.10k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  3.10k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1350:9): [True: 0, False: 3.10k]
  ------------------
 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.10k|    psh->gh_load_type = Dwarf_Alloc_Malloc;
 1358|  3.10k|    psh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|  3.10k|#define TRUE 1
  ------------------
 1359|  3.10k|    ep->f_elf_shstrings_index = stringsection;
 1360|  3.10k|    ep->f_elf_shstrings_max = psh->gh_size;
 1361|  3.10k|    ep->f_elf_shstrings_length = psh->gh_size;
 1362|  3.10k|    ep->f_elf_shstrings_data = psh->gh_content;
 1363|  3.10k|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  288|  3.10k|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (1363:9): [True: 8, False: 3.09k]
  ------------------
 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|      8|        free(psh->gh_content);
 1377|      8|        psh->gh_content = 0;
 1378|      8|        ep->f_elf_shstrings_max = 0;
 1379|      8|        ep->f_elf_shstrings_length = 0;
 1380|      8|        ep->f_elf_shstrings_data = 0;
 1381|      8|        psh->gh_was_alloc = FALSE;
  ------------------
  |  |   36|      8|#define FALSE 0
  ------------------
 1382|      8|        *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      8|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
 1383|      8|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      8|#define DW_DLV_ERROR      1
  ------------------
 1384|      8|#endif /* COMPRESSED TEST */
 1385|      8|    }
 1386|  3.09k|    return DW_DLV_OK;
  ------------------
  |  |   59|  3.09k|#define DW_DLV_OK         0
  ------------------
 1387|  3.10k|}
dwarf_elf_load_headers.c:_dwarf_elf_load_sect_namestrings:
 1887|  3.09k|{
 1888|  3.09k|    struct generic_shdr *gshdr = 0;
 1889|  3.09k|    Dwarf_Unsigned generic_count = 0;
 1890|  3.09k|    Dwarf_Unsigned i = 1;
 1891|  3.09k|    const char *stringsecbase = 0;
 1892|       |
 1893|  3.09k|    stringsecbase = ep->f_elf_shstrings_data;
 1894|  3.09k|    gshdr = ep->f_shdr;
 1895|  3.09k|    generic_count = ep->f_loc_shdr.g_count;
 1896|       |    /*  Here we ensure gh_namestring set to something with
 1897|       |        null termination */
 1898|   165k|    for (i = 0; i < generic_count; i++, ++gshdr) {
  ------------------
  |  Branch (1898:17): [True: 162k, False: 3.04k]
  ------------------
 1899|   162k|        const char *namestr =
 1900|   162k|            "<No valid Elf section strings exist>";
 1901|   162k|        int res = 0;
 1902|       |
 1903|   162k|        if (!ep->f_ehdr->ge_shstrndx || !stringsecbase) {
  ------------------
  |  Branch (1903:13): [True: 0, False: 162k]
  |  Branch (1903:41): [True: 0, False: 162k]
  ------------------
 1904|      0|            gshdr->gh_namestring = namestr;
 1905|      0|            continue;
 1906|      0|        }
 1907|   162k|        namestr = "<Invalid sh_name value. Corrupt Elf.>";
 1908|   162k|        res = validate_section_name_string(ep->f_elf_shstrings_length,
 1909|   162k|            gshdr->gh_name, stringsecbase,
 1910|   162k|            errcode);
 1911|   162k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|   162k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1911:13): [True: 48, False: 162k]
  ------------------
 1912|     48|            gshdr->gh_namestring = namestr;
 1913|     48|            if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|     48|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1913:17): [True: 48, False: 0]
  ------------------
 1914|     48|                return res;
 1915|     48|            }
 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|   162k|        } else {
 1920|   162k|            gshdr->gh_namestring = stringsecbase + gshdr->gh_name;
 1921|   162k|        }
 1922|   162k|    }
 1923|  3.04k|    return DW_DLV_OK;
  ------------------
  |  |   59|  3.04k|#define DW_DLV_OK         0
  ------------------
 1924|  3.09k|}
dwarf_elf_load_headers.c:validate_section_name_string:
 1861|   162k|{
 1862|   162k|    const char *endpoint = strings_start + section_length;
 1863|   162k|    const char *cur = 0;
 1864|       |
 1865|   162k|    if (section_length <= string_loc_index) {
  ------------------
  |  Branch (1865:9): [True: 44, False: 162k]
  ------------------
 1866|     44|        *errcode = DW_DLE_SECTION_STRING_OFFSET_BAD;
  ------------------
  |  | 1483|     44|#define DW_DLE_SECTION_STRING_OFFSET_BAD       437
  ------------------
 1867|     44|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     44|#define DW_DLV_ERROR      1
  ------------------
 1868|     44|    }
 1869|   162k|    cur = string_loc_index+strings_start;
 1870|  9.35M|    for ( ; cur < endpoint;++cur) {
  ------------------
  |  Branch (1870:13): [True: 9.35M, False: 4]
  ------------------
 1871|  9.35M|        if (!*cur) {
  ------------------
  |  Branch (1871:13): [True: 162k, False: 9.19M]
  ------------------
 1872|   162k|            return DW_DLV_OK;
  ------------------
  |  |   59|   162k|#define DW_DLV_OK         0
  ------------------
 1873|   162k|        }
 1874|  9.35M|    }
 1875|      4|    *errcode = DW_DLE_SECTION_STRING_OFFSET_BAD;
  ------------------
  |  | 1483|      4|#define DW_DLE_SECTION_STRING_OFFSET_BAD       437
  ------------------
 1876|      4|    return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
 1877|   162k|}
dwarf_elf_load_headers.c:_dwarf_elf_find_sym_sections:
 2337|  3.04k|{
 2338|  3.04k|    struct generic_shdr* psh = 0;
 2339|  3.04k|    Dwarf_Unsigned i = 0;
 2340|  3.04k|    Dwarf_Unsigned count = 0;
 2341|  3.04k|    int res = 0;
 2342|       |
 2343|  3.04k|    count = ep->f_loc_shdr.g_count;
 2344|  3.04k|    psh = ep->f_shdr;
 2345|   165k|    for (i = 0; i < count; ++psh,++i) {
  ------------------
  |  Branch (2345:17): [True: 162k, False: 3.04k]
  ------------------
 2346|   162k|        const char *name = psh->gh_namestring;
 2347|   162k|        if (is_empty_section(psh->gh_type)) {
  ------------------
  |  Branch (2347:13): [True: 145k, False: 17.5k]
  ------------------
 2348|       |            /*  No data here. */
 2349|   145k|            continue;
 2350|   145k|        }
 2351|  17.5k|        if (!strcmp(name,".dynsym")) {
  ------------------
  |  Branch (2351:13): [True: 211, False: 17.2k]
  ------------------
 2352|    211|            ep->f_dynsym_sect_index = i;
 2353|    211|            ep->f_loc_dynsym.g_offset = psh->gh_offset;
 2354|  17.2k|        } else if (!strcmp(name,".dynstr")) {
  ------------------
  |  Branch (2354:20): [True: 212, False: 17.0k]
  ------------------
 2355|    212|            ep->f_dynsym_sect_strings_sect_index = i;
 2356|    212|            ep->f_dynsym_sect_strings_max = psh->gh_size;
 2357|  17.0k|        } else if (!strcmp(name,".symtab")) {
  ------------------
  |  Branch (2357:20): [True: 444, False: 16.6k]
  ------------------
 2358|    444|            ep->f_symtab_sect_index = i;
 2359|    444|            ep->f_loc_symtab.g_offset = psh->gh_offset;
 2360|  16.6k|        } else if (!strcmp(name,".strtab")) {
  ------------------
  |  Branch (2360:20): [True: 533, False: 16.1k]
  ------------------
 2361|    533|            ep->f_symtab_sect_strings_sect_index = i;
 2362|    533|            ep->f_symtab_sect_strings_max = psh->gh_size;
 2363|  16.1k|        } else if (!strcmp(name,".dynamic")) {
  ------------------
  |  Branch (2363:20): [True: 236, False: 15.8k]
  ------------------
 2364|    236|            ep->f_dynamic_sect_index = i;
 2365|    236|            ep->f_loc_dynamic.g_offset = psh->gh_offset;
 2366|    236|        }
 2367|  17.5k|    }
 2368|  3.04k|    res = validate_links(ep,ep->f_symtab_sect_index,
 2369|  3.04k|        ep->f_symtab_sect_strings_sect_index,errcode);
 2370|  3.04k|    if (res!= DW_DLV_OK) {
  ------------------
  |  |   59|  3.04k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2370:9): [True: 45, False: 3.00k]
  ------------------
 2371|     45|        return res;
 2372|     45|    }
 2373|  3.00k|    return DW_DLV_OK;
  ------------------
  |  |   59|  3.00k|#define DW_DLV_OK         0
  ------------------
 2374|  3.04k|}
dwarf_elf_load_headers.c:validate_links:
 2018|  3.04k|{
 2019|  3.04k|    struct generic_shdr* pshk = 0;
 2020|       |
 2021|  3.04k|    if (!knownsect) {
  ------------------
  |  Branch (2021:9): [True: 2.94k, False: 109]
  ------------------
 2022|  2.94k|        return DW_DLV_OK;
  ------------------
  |  |   59|  2.94k|#define DW_DLV_OK         0
  ------------------
 2023|  2.94k|    }
 2024|    109|    if (!string_sect) {
  ------------------
  |  Branch (2024:9): [True: 12, False: 97]
  ------------------
 2025|     12|        *errcode = DW_DLE_ELF_STRING_SECTION_ERROR;
  ------------------
  |  | 1493|     12|#define DW_DLE_ELF_STRING_SECTION_ERROR        447
  ------------------
 2026|     12|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     12|#define DW_DLV_ERROR      1
  ------------------
 2027|     12|    }
 2028|     97|    pshk = ep->f_shdr + knownsect;
 2029|     97|    if (string_sect != pshk->gh_link) {
  ------------------
  |  Branch (2029:9): [True: 33, False: 64]
  ------------------
 2030|     33|        *errcode = DW_DLE_ELF_SECTION_LINK_ERROR;
  ------------------
  |  | 1486|     33|#define DW_DLE_ELF_SECTION_LINK_ERROR          440
  ------------------
 2031|     33|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     33|#define DW_DLV_ERROR      1
  ------------------
 2032|     33|    }
 2033|     64|    return DW_DLV_OK;
  ------------------
  |  |   59|     64|#define DW_DLV_OK         0
  ------------------
 2034|     97|}
dwarf_elf_load_headers.c:_dwarf_elf_setup_all_section_groups:
 2258|  3.00k|{
 2259|  3.00k|    struct generic_shdr* psh = 0;
 2260|  3.00k|    Dwarf_Unsigned i = 0;
 2261|  3.00k|    Dwarf_Unsigned count = 0;
 2262|  3.00k|    int res = 0;
 2263|       |
 2264|  3.00k|    count = ep->f_loc_shdr.g_count;
 2265|  3.00k|    psh = ep->f_shdr;
 2266|       |
 2267|       |    /* Does step A and step B */
 2268|   163k|    for (i = 0; i < count; ++psh,++i) {
  ------------------
  |  Branch (2268:17): [True: 160k, False: 2.75k]
  ------------------
 2269|   160k|        const char *name = psh->gh_namestring;
 2270|       |
 2271|   160k|        if (is_empty_section(psh->gh_type)) {
  ------------------
  |  Branch (2271:13): [True: 144k, False: 16.0k]
  ------------------
 2272|       |            /*  No data here. */
 2273|   144k|            continue;
 2274|   144k|        }
 2275|  16.0k|        if (elf_sht_groupsec(psh->gh_type,name)) {
  ------------------
  |  Branch (2275:13): [True: 1.34k, False: 14.6k]
  ------------------
 2276|  1.34k|            ep->f_shf_group_flag_section_count++;
 2277|  14.6k|        } else {
 2278|  14.6k|            continue;
 2279|  14.6k|        }
 2280|       |        /* Looks like a section group. Do Step A. */
 2281|  1.34k|        res  =read_gs_section_group(ep,psh,errcode);
 2282|  1.34k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.34k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2282:13): [True: 249, False: 1.09k]
  ------------------
 2283|    249|            return res;
 2284|    249|        }
 2285|  1.34k|    }
 2286|       |    /*  Any sections not marked above or here are in
 2287|       |        grep DW_GROUPNUMBER_BASE (1).
 2288|       |        Section C. */
 2289|  2.75k|    psh = ep->f_shdr;
 2290|   162k|    for (i = 0; i < count; ++psh,++i) {
  ------------------
  |  Branch (2290:17): [True: 159k, False: 2.75k]
  ------------------
 2291|   159k|        const char *name = psh->gh_namestring;
 2292|   159k|        int is_rel = FALSE;
  ------------------
  |  |   36|   159k|#define FALSE 0
  ------------------
 2293|   159k|        int is_rela = FALSE;
  ------------------
  |  |   36|   159k|#define FALSE 0
  ------------------
 2294|       |
 2295|   159k|        if (is_empty_section(psh->gh_type)) {
  ------------------
  |  Branch (2295:13): [True: 144k, False: 15.4k]
  ------------------
 2296|       |            /*  No data here. */
 2297|   144k|            continue;
 2298|   144k|        }
 2299|  15.4k|        if (elf_sht_groupsec(psh->gh_type,name)) {
  ------------------
  |  Branch (2299:13): [True: 1.03k, False: 14.4k]
  ------------------
 2300|  1.03k|            continue;
 2301|  1.03k|        }
 2302|       |        /* Not a section group */
 2303|  14.4k|        if (string_endswith(name,".dwo")) {
  ------------------
  |  Branch (2303:13): [True: 1.25k, False: 13.1k]
  ------------------
 2304|  1.25k|            if (psh->gh_section_group_number) {
  ------------------
  |  Branch (2304:17): [True: 1, False: 1.25k]
  ------------------
 2305|       |                /* multi-assignment to groups. Oops. */
 2306|      1|                *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      1|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2307|      1|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
 2308|      1|            }
 2309|  1.25k|            psh->gh_is_dwarf = TRUE;
  ------------------
  |  |   33|  1.25k|#define TRUE 1
  ------------------
 2310|  1.25k|            psh->gh_section_group_number = DW_GROUPNUMBER_DWO;
  ------------------
  |  |  128|  1.25k|#define DW_GROUPNUMBER_DWO  2
  ------------------
 2311|  1.25k|            ep->f_dwo_group_section_count++;
 2312|  13.1k|        } else if (_dwarf_load_elf_section_is_dwarf(name,
  ------------------
  |  Branch (2312:20): [True: 6.93k, False: 6.20k]
  ------------------
 2313|  13.1k|            psh->gh_type,
 2314|  13.1k|            &is_rela,&is_rel)) {
 2315|  6.93k|            if (!psh->gh_section_group_number) {
  ------------------
  |  Branch (2315:17): [True: 6.88k, False: 55]
  ------------------
 2316|  6.88k|                psh->gh_section_group_number = DW_GROUPNUMBER_BASE;
  ------------------
  |  |  127|  6.88k|#define DW_GROUPNUMBER_BASE 1
  ------------------
 2317|  6.88k|            }
 2318|  6.93k|            psh->gh_is_dwarf = TRUE;
  ------------------
  |  |   33|  6.93k|#define TRUE 1
  ------------------
 2319|  6.93k|        } else {
 2320|       |            /* Do nothing. */
 2321|  6.20k|        }
 2322|  14.4k|    }
 2323|  2.75k|    if (ep->f_sht_group_type_section_count) {
  ------------------
  |  Branch (2323:9): [True: 248, False: 2.50k]
  ------------------
 2324|       |        /*  Not ARM. Done. */
 2325|    248|    }
 2326|  2.75k|    if (!ep->f_shf_group_flag_section_count) {
  ------------------
  |  Branch (2326:9): [True: 2.46k, False: 291]
  ------------------
 2327|       |        /*  Nothing more to do. */
 2328|  2.46k|        return DW_DLV_OK;
  ------------------
  |  |   59|  2.46k|#define DW_DLV_OK         0
  ------------------
 2329|  2.46k|    }
 2330|    291|    return DW_DLV_OK;
  ------------------
  |  |   59|    291|#define DW_DLV_OK         0
  ------------------
 2331|  2.75k|}
dwarf_elf_load_headers.c:elf_sht_groupsec:
 2058|  31.4k|{
 2059|       |    /*  ARM compilers name SHT group "__ARM_grp<long name here>"
 2060|       |        not .group */
 2061|  31.4k|    if ((type == SHT_GROUP) || (!strcmp(sname,".group"))){
  ------------------
  |  |   99|  31.4k|#define SHT_GROUP  17
  ------------------
  |  Branch (2061:9): [True: 2.29k, False: 29.1k]
  |  Branch (2061:32): [True: 77, False: 29.0k]
  ------------------
 2062|  2.37k|        return TRUE;
  ------------------
  |  |   33|  2.37k|#define TRUE 1
  ------------------
 2063|  2.37k|    }
 2064|  29.0k|    return FALSE;
  ------------------
  |  |   36|  29.0k|#define FALSE 0
  ------------------
 2065|  31.4k|}
dwarf_elf_load_headers.c:read_gs_section_group:
 2077|  1.34k|{
 2078|  1.34k|    Dwarf_Unsigned i = 0;
 2079|  1.34k|    int res = 0;
 2080|       |
 2081|  1.34k|    if (!psh->gh_sht_group_array) {
  ------------------
  |  Branch (2081:9): [True: 1.34k, False: 0]
  ------------------
 2082|  1.34k|        Dwarf_Unsigned seclen = psh->gh_size;
 2083|  1.34k|        char *data = 0;
 2084|  1.34k|        char *dp = 0;
 2085|  1.34k|        Dwarf_Unsigned flags = psh->gh_flags;
 2086|  1.34k|        Dwarf_Unsigned* grouparray = 0;
 2087|  1.34k|        char dblock[4];
 2088|  1.34k|        Dwarf_Unsigned va = 0;
 2089|  1.34k|        Dwarf_Unsigned count = 0;
 2090|  1.34k|        Dwarf_Unsigned groupmallocsize = 0;
 2091|  1.34k|        int foundone = 0;
 2092|       |
 2093|  1.34k|        if (seclen >= ep->f_filesize) {
  ------------------
  |  Branch (2093:13): [True: 0, False: 1.34k]
  ------------------
 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.34k|        if (seclen < DWARF_32BIT_SIZE) {
  ------------------
  |  |  133|  1.34k|#define DWARF_32BIT_SIZE 4
  ------------------
  |  Branch (2097:13): [True: 3, False: 1.33k]
  ------------------
 2098|      3|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      3|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2099|      3|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
 2100|      3|        }
 2101|  1.33k|        if (psh->gh_content) {
  ------------------
  |  Branch (2101:13): [True: 6, False: 1.33k]
  ------------------
 2102|       |            /* Should NOT be set earlier! */
 2103|      6|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      6|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2104|      6|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      6|#define DW_DLV_ERROR      1
  ------------------
 2105|      6|        }
 2106|  1.33k|        data = malloc(seclen);
 2107|  1.33k|        if (!data) {
  ------------------
  |  Branch (2107:13): [True: 0, False: 1.33k]
  ------------------
 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.33k|        dp = data;
 2112|  1.33k|        if (psh->gh_entsize != DWARF_32BIT_SIZE) {
  ------------------
  |  |  133|  1.33k|#define DWARF_32BIT_SIZE 4
  ------------------
  |  Branch (2112:13): [True: 103, False: 1.22k]
  ------------------
 2113|    103|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|    103|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2114|    103|            free(data);
 2115|    103|            return DW_DLV_ERROR;
  ------------------
  |  |   60|    103|#define DW_DLV_ERROR      1
  ------------------
 2116|    103|        }
 2117|  1.22k|        if (!psh->gh_entsize) {
  ------------------
  |  Branch (2117:13): [True: 0, False: 1.22k]
  ------------------
 2118|      0|            free(data);
 2119|      0|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      0|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2120|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2121|      0|        }
 2122|  1.22k|        count = seclen/psh->gh_entsize;
 2123|  1.22k|        if (count >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (2123:13): [True: 7, False: 1.22k]
  ------------------
 2124|       |            /* Impossible */
 2125|      7|            free(data);
 2126|      7|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      7|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2127|      7|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      7|#define DW_DLV_ERROR      1
  ------------------
 2128|      7|        }
 2129|  1.22k|        res = RRMOA(ep->f_fd,data,psh->gh_offset,seclen,
  ------------------
  |  |   65|  1.22k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  1.22k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 2130|  1.22k|            ep->f_filesize,errcode);
 2131|  1.22k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.22k|#define DW_DLV_OK         0
  ------------------
  |  Branch (2131:13): [True: 2, False: 1.22k]
  ------------------
 2132|      2|            free(data);
 2133|      2|            return res;
 2134|      2|        }
 2135|  1.22k|        psh->gh_content = data;
 2136|  1.22k|        data = 0; /* Do not use data before returning */
 2137|  1.22k|        psh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|  1.22k|#define TRUE 1
  ------------------
 2138|  1.22k|        psh->gh_load_type = Dwarf_Alloc_Malloc;
 2139|  1.22k|        if (flags & SHF_COMPRESSED) {
  ------------------
  |  |  288|  1.22k|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (2139:13): [True: 4, False: 1.21k]
  ------------------
 2140|       |#if defined(HAVE_ZLIB) && defined(HAVE_ZSTD)
 2141|       |            *errcode = 0;
 2142|       |            _dwarf_do_decompress_elf(ep,psh,errcode);
 2143|       |            /* decompress and set new section size */
 2144|       |            if (*errcode) {
 2145|       |                return DW_DLV_ERROR;
 2146|       |            }
 2147|       |#else /* COMPRESSED TEST */
 2148|      4|            *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      4|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
 2149|      4|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
 2150|      4|#endif /* COMPRESSED TEST */
 2151|      4|        }
 2152|       |        /*  Adding 1 is silly but possibly avoids a warning
 2153|       |            from a particular compiler. */
 2154|  1.21k|        groupmallocsize =  (1+count) * sizeof(Dwarf_Unsigned);
 2155|  1.21k|        if (groupmallocsize >= ep->f_filesize) {
  ------------------
  |  Branch (2155:13): [True: 0, False: 1.21k]
  ------------------
 2156|      0|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      0|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2157|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2158|      0|        }
 2159|  1.21k|        grouparray = malloc(groupmallocsize);
 2160|  1.21k|        if (!grouparray) {
  ------------------
  |  Branch (2160:13): [True: 0, False: 1.21k]
  ------------------
 2161|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 2162|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2163|      0|        }
 2164|       |
 2165|  1.21k|        memcpy(dblock,dp,DWARF_32BIT_SIZE);
  ------------------
  |  |  133|  1.21k|#define DWARF_32BIT_SIZE 4
  ------------------
 2166|  1.21k|        ASNAR(memcpy,va,dblock);
  ------------------
  |  |   53|  1.21k|    do {                                        \
  |  |   54|  1.21k|        (t) = 0;                                \
  |  |   55|  1.21k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.21k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.21k]
  |  |  ------------------
  ------------------
 2167|       |        /* There is ambiguity on the endianness of this stuff. */
 2168|  1.21k|        if (va != 1 && va != 0x1000000) {
  ------------------
  |  Branch (2168:13): [True: 717, False: 499]
  |  Branch (2168:24): [True: 63, False: 654]
  ------------------
 2169|       |            /*  Could be corrupted elf object. */
 2170|     63|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|     63|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2171|     63|            free(grouparray);
 2172|     63|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     63|#define DW_DLV_ERROR      1
  ------------------
 2173|     63|        }
 2174|  1.15k|        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.15k|        dp = dp + DWARF_32BIT_SIZE;
  ------------------
  |  |  133|  1.15k|#define DWARF_32BIT_SIZE 4
  ------------------
 2179|  5.57k|        for ( i = 1; i < count; ++i,dp += DWARF_32BIT_SIZE) {
  ------------------
  |  |  133|  4.42k|#define DWARF_32BIT_SIZE 4
  ------------------
  |  Branch (2179:22): [True: 4.48k, False: 1.09k]
  ------------------
 2180|  4.48k|            Dwarf_Unsigned gseca = 0;
 2181|  4.48k|            Dwarf_Unsigned gsecb = 0;
 2182|  4.48k|            struct generic_shdr* targpsh = 0;
 2183|       |
 2184|  4.48k|            memcpy(dblock,dp,DWARF_32BIT_SIZE);
  ------------------
  |  |  133|  4.48k|#define DWARF_32BIT_SIZE 4
  ------------------
 2185|  4.48k|            ASNAR(memcpy,gseca,dblock);
  ------------------
  |  |   53|  4.48k|    do {                                        \
  |  |   54|  4.48k|        (t) = 0;                                \
  |  |   55|  4.48k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.48k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.48k]
  |  |  ------------------
  ------------------
 2186|       |            /*  Loading gseca and gsecb with different endianness.
 2187|       |                Only one of them can be of any use. */
 2188|  4.48k|            ASNAR(_dwarf_memcpy_swap_bytes,gsecb,dblock);
  ------------------
  |  |   53|  4.48k|    do {                                        \
  |  |   54|  4.48k|        (t) = 0;                                \
  |  |   55|  4.48k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  4.48k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 4.48k]
  |  |  ------------------
  ------------------
 2189|  4.48k|            if (!gseca) {
  ------------------
  |  Branch (2189:17): [True: 3, False: 4.47k]
  ------------------
 2190|       |                /*  zero! Oops. No point in looking at gsecb */
 2191|      3|                free(grouparray);
 2192|      3|                *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      3|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2193|      3|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
 2194|      3|            }
 2195|  4.47k|            if (gseca >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (2195:17): [True: 2.81k, False: 1.66k]
  ------------------
 2196|       |                /*  Might be confused endianness by
 2197|       |                    the compiler generating the SHT_GROUP.
 2198|       |                    This is pretty horrible. */
 2199|  2.81k|                if (gsecb >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (2199:21): [True: 55, False: 2.75k]
  ------------------
 2200|     55|                    *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|     55|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2201|     55|                    free(grouparray);
 2202|     55|                    return DW_DLV_ERROR;
  ------------------
  |  |   60|     55|#define DW_DLV_ERROR      1
  ------------------
 2203|     55|                }
 2204|       |                /*  Looks as though gsecb is the correct
 2205|       |                    interpretation.  Yes, ugly. */
 2206|  2.75k|                gseca = gsecb;
 2207|  2.75k|            }
 2208|  4.42k|            grouparray[i] = gseca;
 2209|  4.42k|            targpsh = ep->f_shdr + gseca;
 2210|  4.42k|            if (_dwarf_ignorethissection(targpsh->gh_namestring)){
  ------------------
  |  Branch (2210:17): [True: 3.50k, False: 923]
  ------------------
 2211|  3.50k|                continue;
 2212|  3.50k|            }
 2213|    923|            if (targpsh->gh_section_group_number) {
  ------------------
  |  Branch (2213:17): [True: 3, False: 920]
  ------------------
 2214|       |                /* multi-assignment to groups. Oops. */
 2215|      3|                free(grouparray);
 2216|      3|                *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      3|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2217|      3|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
 2218|      3|            }
 2219|    920|            targpsh->gh_section_group_number =
 2220|    920|                ep->f_sg_next_group_number;
 2221|    920|            foundone = 1;
 2222|    920|        }
 2223|  1.09k|        if (foundone) {
  ------------------
  |  Branch (2223:13): [True: 352, False: 740]
  ------------------
 2224|    352|            ++ep->f_sg_next_group_number;
 2225|    352|            ++ep->f_sht_group_type_section_count;
 2226|    352|        }
 2227|  1.09k|        psh->gh_sht_group_array = grouparray;
 2228|  1.09k|        psh->gh_sht_group_array_count = count;
 2229|  1.09k|    }
 2230|  1.09k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.09k|#define DW_DLV_OK         0
  ------------------
 2231|  1.34k|}
dwarf_elf_load_headers.c:string_endswith:
 2038|  14.4k|{
 2039|  14.4k|    size_t len = strlen(n);
 2040|  14.4k|    size_t qlen = strlen(q);
 2041|  14.4k|    const char *startpt = 0;
 2042|       |
 2043|  14.4k|    if ( len < qlen) {
  ------------------
  |  Branch (2043:10): [True: 1.38k, False: 13.0k]
  ------------------
 2044|  1.38k|        return FALSE;
  ------------------
  |  |   36|  1.38k|#define FALSE 0
  ------------------
 2045|  1.38k|    }
 2046|  13.0k|    startpt = n + (len-qlen);
 2047|  13.0k|    if (strcmp(startpt,q)) {
  ------------------
  |  Branch (2047:9): [True: 11.7k, False: 1.25k]
  ------------------
 2048|  11.7k|        return FALSE;
  ------------------
  |  |   36|  11.7k|#define FALSE 0
  ------------------
 2049|  11.7k|    }
 2050|  1.25k|    return TRUE;
  ------------------
  |  |   33|  1.25k|#define TRUE 1
  ------------------
 2051|  13.0k|}
dwarf_elf_load_headers.c:_dwarf_load_elf_section_is_dwarf:
  310|  13.1k|{
  311|  13.1k|    *is_rel = FALSE;
  ------------------
  |  |   36|  13.1k|#define FALSE 0
  ------------------
  312|  13.1k|    *is_rela = FALSE;
  ------------------
  |  |   36|  13.1k|#define FALSE 0
  ------------------
  313|  13.1k|    if (_dwarf_ignorethissection(sname)) {
  ------------------
  |  Branch (313:9): [True: 1.38k, False: 11.7k]
  ------------------
  314|  1.38k|        return FALSE;
  ------------------
  |  |   36|  1.38k|#define FALSE 0
  ------------------
  315|  1.38k|    }
  316|  11.7k|    if (sectype == SHT_REL) {
  ------------------
  |  |   59|  11.7k|#define SHT_REL 9
  ------------------
  |  Branch (316:9): [True: 1.35k, False: 10.4k]
  ------------------
  317|  1.35k|        return TRUE;
  ------------------
  |  |   33|  1.35k|#define TRUE 1
  ------------------
  318|  1.35k|    }
  319|  10.4k|    if (sectype == SHT_RELA) {
  ------------------
  |  |   56|  10.4k|#define SHT_RELA 4
  ------------------
  |  Branch (319:9): [True: 2.09k, False: 8.30k]
  ------------------
  320|  2.09k|        *is_rela = TRUE;
  ------------------
  |  |   33|  2.09k|#define TRUE 1
  ------------------
  321|  2.09k|        return TRUE;
  ------------------
  |  |   33|  2.09k|#define TRUE 1
  ------------------
  322|  2.09k|    }
  323|  8.30k|    if (!strncmp(sname,".rel",4)) {
  ------------------
  |  Branch (323:9): [True: 1.40k, False: 6.90k]
  ------------------
  324|  1.40k|        if (!strncmp(sname,".rela.",6)) {
  ------------------
  |  Branch (324:13): [True: 409, False: 996]
  ------------------
  325|    409|            *is_rela = TRUE;
  ------------------
  |  |   33|    409|#define TRUE 1
  ------------------
  326|    409|            return TRUE;
  ------------------
  |  |   33|    409|#define TRUE 1
  ------------------
  327|    409|        }
  328|    996|        if (!strncmp(sname,".rel.",5)) {
  ------------------
  |  Branch (328:13): [True: 722, False: 274]
  ------------------
  329|    722|            *is_rela = TRUE;
  ------------------
  |  |   33|    722|#define TRUE 1
  ------------------
  330|    722|            return TRUE;
  ------------------
  |  |   33|    722|#define TRUE 1
  ------------------
  331|    722|        }
  332|       |        /*  Else something is goofy/Impossible */
  333|    274|        return FALSE;
  ------------------
  |  |   36|    274|#define FALSE 0
  ------------------
  334|    996|    }
  335|  6.90k|    if (!strncmp(sname,".debug_",7)) {
  ------------------
  |  Branch (335:9): [True: 1.23k, False: 5.67k]
  ------------------
  336|  1.23k|        return TRUE;
  ------------------
  |  |   33|  1.23k|#define TRUE 1
  ------------------
  337|  1.23k|    }
  338|  5.67k|    if (!strncmp(sname,".zdebug_",8)) {
  ------------------
  |  Branch (338:9): [True: 523, False: 5.14k]
  ------------------
  339|    523|        return TRUE;
  ------------------
  |  |   33|    523|#define TRUE 1
  ------------------
  340|    523|    }
  341|  5.14k|    if (!strcmp(sname,".eh_frame")) {
  ------------------
  |  Branch (341:9): [True: 324, False: 4.82k]
  ------------------
  342|    324|        return TRUE;
  ------------------
  |  |   33|    324|#define TRUE 1
  ------------------
  343|    324|    }
  344|  4.82k|    if (!strncmp(sname,".gdb_index",10)) {
  ------------------
  |  Branch (344:9): [True: 280, False: 4.54k]
  ------------------
  345|    280|        return TRUE;
  ------------------
  |  |   33|    280|#define TRUE 1
  ------------------
  346|    280|    }
  347|  4.54k|    return FALSE;
  ------------------
  |  |   36|  4.54k|#define FALSE 0
  ------------------
  348|  4.82k|}

_dwarf_elf_nlsetup:
  917|  4.49k|{
  918|  4.49k|    Dwarf_Obj_Access_Interface_a *binary_interface = 0;
  919|  4.49k|    dwarf_elf_object_access_internals_t *intfc = 0;
  920|  4.49k|    int res = DW_DLV_OK;
  ------------------
  |  |   59|  4.49k|#define DW_DLV_OK         0
  ------------------
  921|  4.49k|    int localerrnum = 0;
  922|       |
  923|  4.49k|    res = _dwarf_elf_object_access_init(
  924|  4.49k|        fd,
  925|  4.49k|        ftype,endian,offsetsize,filesize,
  926|  4.49k|        &binary_interface,
  927|  4.49k|        &localerrnum);
  928|  4.49k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  4.49k|#define DW_DLV_OK         0
  ------------------
  |  Branch (928:9): [True: 2.09k, False: 2.39k]
  ------------------
  929|  2.09k|        if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |   58|  2.09k|#define DW_DLV_NO_ENTRY  -1
  ------------------
  |  Branch (929:13): [True: 2, False: 2.09k]
  ------------------
  930|      2|            return res;
  931|      2|        }
  932|  2.09k|        _dwarf_error(NULL, error, localerrnum);
  933|  2.09k|        return DW_DLV_ERROR;
  ------------------
  |  |   60|  2.09k|#define DW_DLV_ERROR      1
  ------------------
  934|  2.09k|    }
  935|       |    /*  allocates and initializes Dwarf_Debug,
  936|       |        generic code */
  937|  2.39k|    res = dwarf_object_init_b(binary_interface, errhand, errarg,
  938|  2.39k|        groupnumber, dbg, error);
  939|  2.39k|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|  2.39k|#define DW_DLV_OK         0
  ------------------
  |  Branch (939:9): [True: 1.81k, False: 585]
  ------------------
  940|  1.81k|        _dwarf_destruct_elf_nlaccess(binary_interface);
  941|  1.81k|        return res;
  942|  1.81k|    }
  943|    585|    intfc = binary_interface->ai_object;
  944|    585|    intfc->f_path = strdup(true_path);
  945|    585|    (*dbg)->de_obj_machine = intfc->f_machine;
  946|    585|    (*dbg)->de_obj_type = intfc->f_ftype; /* ET_REL etc */
  947|    585|    (*dbg)->de_obj_flags = intfc->f_flags;
  948|    585|    return res;
  949|  2.39k|}
dwarf_elfread.c:_dwarf_destruct_elf_nlaccess:
  821|  4.49k|{
  822|  4.49k|    struct Dwarf_Obj_Access_Interface_a_s *aip =
  823|  4.49k|        (struct Dwarf_Obj_Access_Interface_a_s *)obj;
  824|  4.49k|    dwarf_elf_object_access_internals_t *ep = 0;
  825|  4.49k|    struct generic_shdr *shp = 0;
  826|  4.49k|    Dwarf_Unsigned shcount = 0;
  827|  4.49k|    Dwarf_Unsigned i = 0;
  828|       |
  829|  4.49k|    ep = (dwarf_elf_object_access_internals_t *)aip->ai_object;
  830|  4.49k|    shp = ep->f_shdr;
  831|  4.49k|    shcount = ep->f_loc_shdr.g_count;
  832|   172k|    for (i = 0; i < shcount; ++i,++shp) {
  ------------------
  |  Branch (832:17): [True: 168k, False: 4.49k]
  ------------------
  833|   168k|        enum Dwarf_Sec_Alloc_Pref alloc = shp->gh_load_type;
  834|   168k|        free(shp->gh_rels);
  835|   168k|        shp->gh_rels = 0;
  836|   168k|        switch(alloc) {
  837|  5.96k|        case Dwarf_Alloc_Malloc:
  ------------------
  |  Branch (837:9): [True: 5.96k, False: 162k]
  ------------------
  838|  5.96k|            if (shp->gh_was_alloc) {
  ------------------
  |  Branch (838:17): [True: 5.94k, False: 22]
  ------------------
  839|  5.94k|                free(shp->gh_content);
  840|  5.94k|                shp->gh_content = 0;
  841|  5.94k|            }
  842|  5.96k|            break;
  843|      0|#ifdef HAVE_FULL_MMAP
  844|      0|        case Dwarf_Alloc_Mmap: {
  ------------------
  |  Branch (844:9): [True: 0, False: 168k]
  ------------------
  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|   162k|        default: break;
  ------------------
  |  Branch (855:9): [True: 162k, False: 5.96k]
  ------------------
  856|       |            /*  something disastrously wrong. No free/mmap */
  857|   168k|        } /* end switch on alloc */
  858|   168k|        shp->gh_content = 0;
  859|   168k|        shp->gh_mmap_realarea = (char *)-1;
  860|   168k|        shp->gh_computed_mmaplen = 0;
  861|   168k|        free(shp->gh_sht_group_array);
  862|   168k|        shp->gh_sht_group_array = 0;
  863|   168k|        shp->gh_sht_group_array_count = 0;
  864|   168k|    }
  865|  4.49k|    free(ep->f_ehdr);
  866|  4.49k|    ep->f_ehdr = 0;
  867|  4.49k|    ep->f_loc_shdr.g_count = 0;
  868|  4.49k|    free(ep->f_phdr);
  869|  4.49k|    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.49k|    ep->f_elf_shstrings_data = 0;
  876|  4.49k|    ep->f_elf_shstrings_length = 0;
  877|  4.49k|    ep->f_elf_shstrings_max = 0;
  878|  4.49k|    ep->f_elf_shstrings_index = 0;
  879|  4.49k|    ep->f_symtab_sect_strings = 0;
  880|  4.49k|    ep->f_symtab_sect_strings_max = 0;
  881|  4.49k|    ep->f_symtab_sect_strings_sect_index = 0;
  882|       |
  883|  4.49k|    free(ep->f_dynsym_sect_strings);
  884|  4.49k|    ep->f_dynsym_sect_strings = 0;
  885|  4.49k|    free(ep->f_dynamic);
  886|  4.49k|    ep->f_dynamic = 0;
  887|  4.49k|    free(ep->f_symtab);
  888|  4.49k|    ep->f_symtab = 0;
  889|  4.49k|    free(ep->f_dynsym);
  890|  4.49k|    ep->f_dynsym = 0;
  891|  4.49k|    free(ep->f_shdr);
  892|  4.49k|    ep->f_shdr = 0;
  893|       |    /* if TRUE close f_fd on destruct.*/
  894|  4.49k|    if (ep->f_destruct_close_fd) {
  ------------------
  |  Branch (894:9): [True: 0, False: 4.49k]
  ------------------
  895|      0|        _dwarf_closer(ep->f_fd);
  896|      0|    }
  897|  4.49k|    ep->f_ident[0] = 'X';
  898|  4.49k|    free(ep->f_path);
  899|  4.49k|    ep->f_path = 0;
  900|  4.49k|    free(ep);
  901|  4.49k|    ep = 0;
  902|  4.49k|    free(aip);
  903|  4.49k|    aip = 0;
  904|  4.49k|}
dwarf_elfread.c:_dwarf_elf_object_access_init:
 1115|  4.49k|{
 1116|       |
 1117|  4.49k|    int res = 0;
 1118|  4.49k|    dwarf_elf_object_access_internals_t *internals = 0;
 1119|  4.49k|    Dwarf_Obj_Access_Interface_a *intfc = 0;
 1120|       |
 1121|  4.49k|    internals = malloc(sizeof(dwarf_elf_object_access_internals_t));
 1122|  4.49k|    if (!internals) {
  ------------------
  |  Branch (1122:9): [True: 0, False: 4.49k]
  ------------------
 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.49k|    memset(internals,0,sizeof(*internals));
 1128|  4.49k|    res = _dwarf_elf_object_access_internals_init(internals,
 1129|  4.49k|        fd,
 1130|  4.49k|        ftype, endian, offsetsize, filesize,
 1131|  4.49k|        localerrnum);
 1132|  4.49k|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|  4.49k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1132:9): [True: 2.09k, False: 2.39k]
  ------------------
 1133|  2.09k|        return res;
 1134|  2.09k|    }
 1135|       |
 1136|  2.39k|    intfc = malloc(sizeof(Dwarf_Obj_Access_Interface_a));
 1137|  2.39k|    if (!intfc) {
  ------------------
  |  Branch (1137:9): [True: 0, False: 2.39k]
  ------------------
 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.39k|    memset(intfc,0,sizeof(*intfc));
 1144|       |
 1145|       |    /* Initialize the interface struct */
 1146|  2.39k|    intfc->ai_object = internals;
 1147|  2.39k|    intfc->ai_methods = &elf_nlmethods;
 1148|  2.39k|    *binary_interface = intfc;
 1149|  2.39k|    return DW_DLV_OK;
  ------------------
  |  |   59|  2.39k|#define DW_DLV_OK         0
  ------------------
 1150|  2.39k|}
dwarf_elfread.c:_dwarf_elf_object_access_internals_init:
  981|  4.49k|{
  982|  4.49k|    dwarf_elf_object_access_internals_t * intfc = internals;
  983|  4.49k|    Dwarf_Unsigned i  = 0;
  984|  4.49k|    struct Dwarf_Obj_Access_Interface_a_s *localdoas;
  985|  4.49k|    int res = 0;
  986|       |
  987|       |    /*  Must malloc as _dwarf_destruct_elf_access()
  988|       |        forces that due to other uses. */
  989|  4.49k|    localdoas = (struct Dwarf_Obj_Access_Interface_a_s *)
  990|  4.49k|        malloc(sizeof(struct Dwarf_Obj_Access_Interface_a_s));
  991|  4.49k|    if (!localdoas) {
  ------------------
  |  Branch (991:9): [True: 0, False: 4.49k]
  ------------------
  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.49k|    memset(localdoas,0,sizeof(struct Dwarf_Obj_Access_Interface_a_s));
  997|       |    /*  E is used with libelf. F with this elf reader. */
  998|  4.49k|    intfc->f_ident[0]    = 'F';
  999|  4.49k|    intfc->f_ident[1]    = '1';
 1000|  4.49k|    intfc->f_fd          = fd;
 1001|  4.49k|    intfc->f_is_64bit    = ((offsetsize==64)?TRUE:FALSE);
  ------------------
  |  |   33|  1.63k|#define TRUE 1
  ------------------
                  intfc->f_is_64bit    = ((offsetsize==64)?TRUE:FALSE);
  ------------------
  |  |   36|  2.86k|#define FALSE 0
  ------------------
  |  Branch (1001:29): [True: 1.63k, False: 2.86k]
  ------------------
 1002|  4.49k|    intfc->f_offsetsize  = (Dwarf_Small)offsetsize;
 1003|  4.49k|    intfc->f_pointersize = (Dwarf_Small)offsetsize;
 1004|  4.49k|    intfc->f_filesize    = filesize;
 1005|  4.49k|    intfc->f_ftype       = ftype;
 1006|  4.49k|    intfc->f_destruct_close_fd = FALSE;
  ------------------
  |  |   36|  4.49k|#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.49k|    if (endian == DW_END_little ) {
  ------------------
  |  | 1115|  4.49k|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  |  Branch (1017:9): [True: 1.47k, False: 3.02k]
  ------------------
 1018|  1.47k|        intfc->f_copy_word = _dwarf_memcpy_noswap_bytes;
 1019|  1.47k|        intfc->f_endian = DW_END_little;
  ------------------
  |  | 1115|  1.47k|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1020|  3.02k|    } else {
 1021|  3.02k|        intfc->f_copy_word = _dwarf_memcpy_swap_bytes;
 1022|  3.02k|        intfc->f_endian = DW_END_big;
  ------------------
  |  | 1114|  3.02k|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
 1023|  3.02k|    }
 1024|  4.49k|#endif /* LITTLE- BIG-ENDIAN */
 1025|       |    /*  The following sets f_machine. */
 1026|  4.49k|    res = _dwarf_load_elf_header(intfc,errcode);
 1027|  4.49k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  4.49k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1027:9): [True: 78, False: 4.41k]
  ------------------
 1028|     78|        localdoas->ai_object = intfc;
 1029|     78|        localdoas->ai_methods = 0;
 1030|     78|        _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1031|     78|        localdoas = 0;
 1032|     78|        return res;
 1033|     78|    }
 1034|       |    /* Not loading progheaders */
 1035|  4.41k|    res = _dwarf_load_elf_sectheaders(intfc,errcode);
 1036|  4.41k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  4.41k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1036:9): [True: 1.66k, False: 2.75k]
  ------------------
 1037|  1.66k|        localdoas->ai_object = intfc;
 1038|  1.66k|        localdoas->ai_methods = 0;
 1039|  1.66k|        _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1040|  1.66k|        localdoas = 0;
 1041|  1.66k|        return res;
 1042|       |
 1043|  1.66k|    }
 1044|       |    /* We are not looking at symbol strings for now. */
 1045|  2.75k|    res = _dwarf_load_elf_symstr(intfc,errcode);
 1046|  2.75k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  2.75k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1046:9): [True: 94, False: 2.66k]
  ------------------
 1047|     94|        localdoas->ai_object = intfc;
 1048|     94|        localdoas->ai_methods = 0;
 1049|     94|        _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1050|     94|        localdoas = 0;
 1051|     94|        return res;
 1052|     94|    }
 1053|  2.66k|    res  = _dwarf_load_elf_symtab_symbols(intfc,errcode);
 1054|  2.66k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  2.66k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1054:9): [True: 18, False: 2.64k]
  ------------------
 1055|     18|        localdoas->ai_object = intfc;
 1056|     18|        localdoas->ai_methods = 0;
 1057|     18|        _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1058|     18|        localdoas = 0;
 1059|     18|        return res;
 1060|     18|    }
 1061|   157k|    for ( i = 1; i < intfc->f_loc_shdr.g_count; ++i) {
  ------------------
  |  Branch (1061:18): [True: 155k, False: 2.39k]
  ------------------
 1062|   155k|        struct generic_shdr *shp = 0;
 1063|   155k|        Dwarf_Unsigned section_type = 0;
 1064|   155k|        enum RelocRela localrel = RelocIsRela;
 1065|       |
 1066|   155k|        shp = intfc->f_shdr +i;
 1067|   155k|        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|   155k|        if (!shp->gh_namestring || !shp->gh_namestring[0]) {
  ------------------
  |  Branch (1071:13): [True: 0, False: 155k]
  |  Branch (1071:36): [True: 1.58k, False: 153k]
  ------------------
 1072|       |            /*  A serious error which we ignore here
 1073|       |                as it will be caught elsewhere
 1074|       |                if necessary. */
 1075|  1.58k|            continue;
 1076|   153k|        } else if (section_type == SHT_REL) {
  ------------------
  |  |   59|   153k|#define SHT_REL 9
  ------------------
  |  Branch (1076:20): [True: 1.71k, False: 152k]
  ------------------
 1077|  1.71k|            localrel = RelocIsRel;
 1078|   152k|        } else if (section_type == SHT_RELA) {
  ------------------
  |  |   56|   152k|#define SHT_RELA 4
  ------------------
  |  Branch (1078:20): [True: 2.20k, False: 149k]
  ------------------
 1079|  2.20k|            localrel = RelocIsRela;
 1080|   149k|        } else if (!strncmp(".rel.",shp->gh_namestring,5)) {
  ------------------
  |  Branch (1080:20): [True: 7.04k, False: 142k]
  ------------------
 1081|  7.04k|            localrel = RelocIsRel;
 1082|   142k|        } else if (!strncmp(".rela.",shp->gh_namestring,6)) {
  ------------------
  |  Branch (1082:20): [True: 24.6k, False: 118k]
  ------------------
 1083|  24.6k|            localrel = RelocIsRela;
 1084|   118k|        } else {
 1085|   118k|            continue;
 1086|   118k|        }
 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|  35.6k|        res = _dwarf_load_elf_relx(intfc,i,localrel,errcode);
 1093|  35.6k|        if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  35.6k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1093:13): [True: 243, False: 35.3k]
  ------------------
 1094|    243|            localdoas->ai_object = intfc;
 1095|    243|            localdoas->ai_methods = 0;
 1096|    243|            _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1097|    243|            localdoas = 0;
 1098|    243|            return res;
 1099|    243|        }
 1100|  35.6k|    }
 1101|  2.39k|    free(localdoas);
 1102|  2.39k|    localdoas = 0;
 1103|  2.39k|    return DW_DLV_OK;
  ------------------
  |  |   59|  2.39k|#define DW_DLV_OK         0
  ------------------
 1104|  2.64k|}
dwarf_elfread.c:elf_get_nolibelf_section_info:
  185|   268k|{
  186|   268k|    dwarf_elf_object_access_internals_t *elf =
  187|   268k|        (dwarf_elf_object_access_internals_t*)(obj);
  188|       |
  189|   268k|    (void)error;
  190|   268k|    if (section_index < elf->f_loc_shdr.g_count) {
  ------------------
  |  Branch (190:9): [True: 268k, False: 0]
  ------------------
  191|   268k|        struct generic_shdr *sp = 0;
  192|       |
  193|   268k|        sp = elf->f_shdr + section_index;
  194|   268k|        return_section->as_addr      = sp->gh_addr;
  195|   268k|        return_section->as_type      = sp->gh_type;
  196|   268k|        return_section->as_size      = sp->gh_size;
  197|   268k|        return_section->as_name      = sp->gh_namestring;
  198|   268k|        return_section->as_link      = sp->gh_link;
  199|   268k|        return_section->as_info      = sp->gh_info;
  200|   268k|        return_section->as_flags     = sp->gh_flags;
  201|   268k|        return_section->as_entrysize = sp->gh_entsize;
  202|   268k|        return_section->as_offset    = sp->gh_offset;
  203|   268k|        return DW_DLV_OK;
  ------------------
  |  |   59|   268k|#define DW_DLV_OK         0
  ------------------
  204|   268k|    }
  205|      0|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  206|   268k|}
dwarf_elfread.c:elf_get_nolibelf_byte_order:
  147|  2.39k|{
  148|  2.39k|    dwarf_elf_object_access_internals_t *elf =
  149|  2.39k|        (dwarf_elf_object_access_internals_t*)(obj);
  150|  2.39k|    return (Dwarf_Small)elf->f_endian;
  151|  2.39k|}
dwarf_elfread.c:elf_get_nolibelf_length_size:
  154|  2.39k|{
  155|  2.39k|    dwarf_elf_object_access_internals_t *elf =
  156|  2.39k|        (dwarf_elf_object_access_internals_t*)(obj);
  157|  2.39k|    return elf->f_offsetsize/8;
  158|  2.39k|}
dwarf_elfread.c:elf_get_nolibelf_pointer_size:
  161|  2.39k|{
  162|  2.39k|    dwarf_elf_object_access_internals_t *elf =
  163|  2.39k|        (dwarf_elf_object_access_internals_t*)(obj);
  164|  2.39k|    return elf->f_pointersize/8;
  165|  2.39k|}
dwarf_elfread.c:elf_get_nolibelf_file_size:
  168|  2.39k|{
  169|  2.39k|    dwarf_elf_object_access_internals_t *elf =
  170|  2.39k|        (dwarf_elf_object_access_internals_t*)(obj);
  171|  2.39k|    return elf->f_filesize;
  172|  2.39k|}
dwarf_elfread.c:elf_get_nolibelf_section_count:
  175|  2.39k|{
  176|  2.39k|    dwarf_elf_object_access_internals_t *elf =
  177|  2.39k|        (dwarf_elf_object_access_internals_t*)(obj);
  178|  2.39k|    return elf->f_loc_shdr.g_count;
  179|  2.39k|}
dwarf_elfread.c:elf_load_nolibelf_section:
  250|  1.89k|{
  251|       |    /*  Linux kernel read size limit 0x7ffff000,
  252|       |        Without any good reason, limit our reads
  253|       |        to a bit less. */
  254|  1.89k|    const Dwarf_Unsigned read_size_limit = 0x7ff00000;
  255|  1.89k|    Dwarf_Unsigned read_offset = 0;
  256|  1.89k|    Dwarf_Unsigned read_size = 0;
  257|  1.89k|    Dwarf_Unsigned remaining_bytes = 0;
  258|  1.89k|    Dwarf_Small *  read_target = 0;
  259|  1.89k|    dwarf_elf_object_access_internals_t *elf =
  260|  1.89k|        (dwarf_elf_object_access_internals_t*)(obj);
  261|  1.89k|    struct generic_shdr *sp = 0;
  262|  1.89k|    int decompressme = FALSE;
  ------------------
  |  |   36|  1.89k|#define FALSE 0
  ------------------
  263|  1.89k|    int res = 0;
  264|       |
  265|  1.89k|    res = elf_load_find_sec_ptr(obj,section_index,&sp,
  266|  1.89k|        &decompressme,errorc);
  267|  1.89k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.89k|#define DW_DLV_OK         0
  ------------------
  |  Branch (267:9): [True: 0, False: 1.89k]
  ------------------
  268|      0|        return res;
  269|      0|    }
  270|  1.89k|    if (sp->gh_content) {
  ------------------
  |  Branch (270:9): [True: 1.14k, False: 755]
  ------------------
  271|  1.14k|        *return_data = (Dwarf_Small *)sp->gh_content;
  272|  1.14k|        return DW_DLV_OK;
  ------------------
  |  |   59|  1.14k|#define DW_DLV_OK         0
  ------------------
  273|  1.14k|    }
  274|       |    /*  Guarding against bad values and
  275|       |        against overflow */
  276|    755|    if (sp->gh_size > elf->f_filesize ||
  ------------------
  |  Branch (276:9): [True: 305, False: 450]
  ------------------
  277|    450|        sp->gh_offset > elf->f_filesize ||
  ------------------
  |  Branch (277:9): [True: 79, False: 371]
  ------------------
  278|    371|        (sp->gh_size + sp->gh_offset) >
  ------------------
  |  Branch (278:9): [True: 14, False: 357]
  ------------------
  279|    398|            elf->f_filesize) {
  280|    398|        *errorc = DW_DLE_ELF_SECTION_ERROR;
  ------------------
  |  | 1492|    398|#define DW_DLE_ELF_SECTION_ERROR               446
  ------------------
  281|    398|        return DW_DLV_ERROR;
  ------------------
  |  |   60|    398|#define DW_DLV_ERROR      1
  ------------------
  282|    398|    }
  283|       |
  284|    357|    sp->gh_load_type = Dwarf_Alloc_Malloc;
  285|    357|    sp->gh_content = malloc((size_t)sp->gh_size);
  286|    357|    if (!sp->gh_content) {
  ------------------
  |  Branch (286:9): [True: 0, False: 357]
  ------------------
  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|    357|    remaining_bytes = sp->gh_size;
  293|    357|    read_size = remaining_bytes;
  294|    357|    read_offset = sp->gh_offset;
  295|    357|    read_target = (Dwarf_Small*)sp->gh_content;
  296|    714|    for ( ; remaining_bytes > 0; read_size = remaining_bytes ) {
  ------------------
  |  Branch (296:13): [True: 357, False: 357]
  ------------------
  297|    357|        if (read_size > read_size_limit) {
  ------------------
  |  Branch (297:13): [True: 0, False: 357]
  ------------------
  298|      0|            read_size = read_size_limit;
  299|      0|        }
  300|    357|        res = RRMOA(elf->f_fd,
  ------------------
  |  |   65|    357|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    357|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  301|    357|            (void *)read_target, read_offset,
  302|    357|            read_size,
  303|    357|            elf->f_filesize, errorc);
  304|    357|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    357|#define DW_DLV_OK         0
  ------------------
  |  Branch (304:13): [True: 0, False: 357]
  ------------------
  305|      0|            free(sp->gh_content);
  306|      0|            sp->gh_content = 0;
  307|      0|            return res;
  308|      0|        }
  309|    357|        remaining_bytes -= read_size;
  310|    357|        read_offset += read_size;
  311|    357|        read_target += read_size;
  312|    357|    }
  313|    357|    sp->gh_was_alloc = TRUE;
  ------------------
  |  |   33|    357|#define TRUE 1
  ------------------
  314|    357|    sp->gh_load_type = Dwarf_Alloc_Malloc;
  315|       |
  316|    357|    if (decompressme) {
  ------------------
  |  Branch (316:9): [True: 4, False: 353]
  ------------------
  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|    353|    *return_data = (Dwarf_Small *)sp->gh_content;
  335|    353|    return DW_DLV_OK;
  ------------------
  |  |   59|    353|#define DW_DLV_OK         0
  ------------------
  336|    357|}
dwarf_elfread.c:elf_load_find_sec_ptr:
  212|  3.79k|{
  213|  3.79k|    dwarf_elf_object_access_internals_t *elf =
  214|  3.79k|        (dwarf_elf_object_access_internals_t*)(obj);
  215|       |
  216|  3.79k|    (void)errorc;
  217|  3.79k|    if (0 < section_index &&
  ------------------
  |  Branch (217:9): [True: 3.79k, False: 3]
  ------------------
  218|  3.79k|        section_index < elf->f_loc_shdr.g_count) {
  ------------------
  |  Branch (218:9): [True: 3.79k, False: 0]
  ------------------
  219|  3.79k|        struct generic_shdr *sp =
  220|  3.79k|            elf->f_shdr + section_index;
  221|       |
  222|  3.79k|        if (!sp->gh_size) {
  ------------------
  |  Branch (222:13): [True: 0, False: 3.79k]
  ------------------
  223|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  224|      0|        }
  225|  3.79k|        *sp_inout = sp;
  226|  3.79k|        if (sp->gh_flags & SHF_COMPRESSED) {
  ------------------
  |  |  288|  3.79k|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (226:13): [True: 30, False: 3.76k]
  ------------------
  227|     30|            switch(sp->gh_type) {
  228|      2|            case SHT_STRTAB:
  ------------------
  |  |   53|      2|#define SHT_STRTAB 3
  ------------------
  |  Branch (228:13): [True: 2, False: 28]
  ------------------
  229|      4|            case SHT_SYMTAB:
  ------------------
  |  |   50|      4|#define SHT_SYMTAB 2
  ------------------
  |  Branch (229:13): [True: 2, False: 28]
  ------------------
  230|      8|            case SHT_REL:
  ------------------
  |  |   59|      8|#define SHT_REL 9
  ------------------
  |  Branch (230:13): [True: 4, False: 26]
  ------------------
  231|     14|            case SHT_RELA:
  ------------------
  |  |   56|     14|#define SHT_RELA 4
  ------------------
  |  Branch (231:13): [True: 6, False: 24]
  ------------------
  232|     14|                *decompressme = TRUE;
  ------------------
  |  |   33|     14|#define TRUE 1
  ------------------
  233|     14|                break;
  234|     10|            case SHT_NOBITS:
  ------------------
  |  |   87|     10|#define SHT_NOBITS 8
  ------------------
  |  Branch (234:13): [True: 10, False: 20]
  ------------------
  235|     16|            default:
  ------------------
  |  Branch (235:13): [True: 6, False: 24]
  ------------------
  236|     16|                break;
  237|     30|            }
  238|     30|        }
  239|  3.79k|        return DW_DLV_OK;
  ------------------
  |  |   59|  3.79k|#define DW_DLV_OK         0
  ------------------
  240|  3.79k|    }
  241|      3|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      3|#define DW_DLV_NO_ENTRY  -1
  ------------------
  242|  3.79k|}
dwarf_elfread.c:elf_relocations_nolibelf:
  762|    103|{
  763|    103|    int res = DW_DLV_ERROR;
  ------------------
  |  |   60|    103|#define DW_DLV_ERROR      1
  ------------------
  764|    103|    dwarf_elf_object_access_internals_t*obj = 0;
  765|    103|    struct Dwarf_Section_s * relocatablesec = 0;
  766|    103|    Dwarf_Unsigned section_with_reloc_records = 0;
  767|       |
  768|    103|    if (section_index == 0) {
  ------------------
  |  Branch (768:9): [True: 0, False: 103]
  ------------------
  769|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  770|      0|    }
  771|    103|    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|    103|    res = find_section_to_relocate(dbg, section_index,
  778|    103|        &relocatablesec, errorc);
  779|    103|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    103|#define DW_DLV_OK         0
  ------------------
  |  Branch (779:9): [True: 103, False: 0]
  ------------------
  780|    103|        return res;
  781|    103|    }
  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|    103|{
  561|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_info,relocatablesec);
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  562|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_abbrev,relocatablesec);
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  563|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_line,relocatablesec);
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  564|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_loc,relocatablesec);
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  565|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_aranges,relocatablesec);
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  566|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_macinfo,relocatablesec);
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  567|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_pubnames,
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  568|    103|        relocatablesec);
  569|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_names,
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  570|    103|        relocatablesec);
  571|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_ranges,relocatablesec);
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  572|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_frame,
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  573|    103|        relocatablesec);
  574|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_frame_eh_gnu,
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  575|    103|        relocatablesec);
  576|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_pubtypes,
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  577|    103|        relocatablesec);
  578|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_funcnames,
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  579|    103|        relocatablesec);
  580|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_typenames,
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  581|    103|        relocatablesec);
  582|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_varnames,
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  583|    103|        relocatablesec);
  584|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_weaknames,
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  585|    103|        relocatablesec);
  586|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_types,relocatablesec);
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  587|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_macro,relocatablesec);
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  588|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_rnglists,
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  589|    103|        relocatablesec);
  590|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_loclists,
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  591|    103|        relocatablesec);
  592|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_aranges,
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  593|    103|        relocatablesec);
  594|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_sup,
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  595|    103|        relocatablesec);
  596|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_str_offsets,
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  597|    103|        relocatablesec);
  598|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_addr,relocatablesec);
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  599|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_gnu_pubnames,
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  600|    103|        relocatablesec);
  601|    103|    MATCH_REL_SEC(section_index,dbg->de_debug_gnu_pubtypes,
  ------------------
  |  |  551|    103|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|    103|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 103]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  602|    103|        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|    103|    *errorc = DW_DLE_RELOC_SECTION_MISMATCH;
  ------------------
  |  | 1259|    103|#define DW_DLE_RELOC_SECTION_MISMATCH          214
  ------------------
  610|    103|    return DW_DLV_ERROR;
  ------------------
  |  |   60|    103|#define DW_DLV_ERROR      1
  ------------------
  611|    103|}
dwarf_elfread.c:elf_load_nolibelf_section_a:
  453|  1.90k|{
  454|  1.90k|    int res  = 0;
  455|  1.90k|    enum Dwarf_Sec_Alloc_Pref alloc_type_in = *dw_alloc_type;
  456|  1.90k|    struct generic_shdr *sp = 0;
  457|  1.90k|    int decompressme = FALSE;
  ------------------
  |  |   36|  1.90k|#define FALSE 0
  ------------------
  458|       |
  459|  1.90k|    res = elf_load_find_sec_ptr(obj,dw_section_index,&sp,
  460|  1.90k|        &decompressme,errc);
  461|  1.90k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.90k|#define DW_DLV_OK         0
  ------------------
  |  Branch (461:9): [True: 3, False: 1.89k]
  ------------------
  462|      3|        return res;
  463|      3|    }
  464|  1.89k|    if (alloc_type_in == Dwarf_Alloc_Malloc ||
  ------------------
  |  Branch (464:9): [True: 1.89k, False: 0]
  ------------------
  465|  1.89k|        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|  1.89k|        res = elf_load_nolibelf_section(obj,dw_section_index,
  469|  1.89k|            return_data_ptr,errc);
  470|  1.89k|        *return_mmap_base_ptr = 0;
  471|  1.89k|        *return_mmap_offset = 0;
  472|  1.89k|        *return_mmap_len = 0;
  473|  1.89k|        *dw_alloc_type = Dwarf_Alloc_Malloc;
  474|       |        /* *return_data_len =  not set */
  475|  1.89k|        return res;
  476|  1.89k|    }
  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.73k|{
  112|  5.73k|    _dwarf_error_string(dbg,error,errval,0);
  113|  5.73k|}
_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.32k, False: 19.3k]
  |  Branch (193:17): [True: 0, False: 1.32k]
  ------------------
  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.29k|{
  454|  8.29k|    unsigned ftype = 0;
  455|  8.29k|    unsigned endian = 0;
  456|  8.29k|    unsigned offsetsize = 0;
  457|  8.29k|    unsigned universalnumber = 0;
  458|  8.29k|    Dwarf_Unsigned   filesize = 0;
  459|  8.29k|    int res = 0;
  460|  8.29k|    int errcode = 0;
  461|       |
  462|  8.29k|    if (!ret_dbg) {
  ------------------
  |  Branch (462:9): [True: 0, False: 8.29k]
  ------------------
  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.29k|    *ret_dbg = 0;
  468|       |
  469|  8.29k|    res = _dwarf_object_detector_fd_a(fd,
  470|  8.29k|        &ftype,
  471|  8.29k|        &endian,&offsetsize,0,
  472|  8.29k|        &filesize,&errcode);
  473|  8.29k|    if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|  8.29k|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (473:9): [True: 415, False: 7.87k]
  ------------------
  474|    415|        return res;
  475|    415|    }
  476|  7.87k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|  7.87k|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (476:9): [True: 21, False: 7.85k]
  ------------------
  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.85k|    switch(ftype) {
  481|  4.49k|    case DW_FTYPE_ELF: {
  ------------------
  |  |  114|  4.49k|#define DW_FTYPE_ELF        1  /* Unix/Linux/etc */
  ------------------
  |  Branch (481:5): [True: 4.49k, False: 3.36k]
  ------------------
  482|  4.49k|        int res2 = 0;
  483|       |
  484|  4.49k|        res2 = _dwarf_elf_nlsetup(fd,"",
  485|  4.49k|            ftype,endian,offsetsize,filesize,
  486|  4.49k|            group_number,errhand,errarg,ret_dbg,error);
  487|  4.49k|        if (res2 != DW_DLV_OK) {
  ------------------
  |  |  122|  4.49k|#define DW_DLV_OK        0
  ------------------
  |  Branch (487:13): [True: 3.90k, False: 585]
  ------------------
  488|  3.90k|            return res2;
  489|  3.90k|        }
  490|    585|        set_global_paths_init(*ret_dbg,error);
  491|    585|        return res2;
  492|  4.49k|        }
  493|    563|    case DW_FTYPE_APPLEUNIVERSAL:
  ------------------
  |  |  118|    563|#define DW_FTYPE_APPLEUNIVERSAL    5
  ------------------
  |  Branch (493:5): [True: 563, False: 7.29k]
  ------------------
  494|  2.60k|    case DW_FTYPE_MACH_O: {
  ------------------
  |  |  115|  2.60k|#define DW_FTYPE_MACH_O     2  /* Macos. */
  ------------------
  |  Branch (494:5): [True: 2.04k, False: 5.81k]
  ------------------
  495|  2.60k|        int resm = 0;
  496|       |
  497|  2.60k|        resm = _dwarf_macho_setup(fd,"",
  498|  2.60k|            universalnumber,
  499|  2.60k|            ftype,endian,offsetsize,filesize,
  500|  2.60k|            group_number,errhand,errarg,ret_dbg,error);
  501|  2.60k|        if (resm != DW_DLV_OK) {
  ------------------
  |  |  122|  2.60k|#define DW_DLV_OK        0
  ------------------
  |  Branch (501:13): [True: 2.43k, False: 171]
  ------------------
  502|  2.43k|            return resm;
  503|  2.43k|        }
  504|    171|        set_global_paths_init(*ret_dbg,error);
  505|    171|        return resm;
  506|  2.60k|        }
  507|       |
  508|    756|    case DW_FTYPE_PE: {
  ------------------
  |  |  116|    756|#define DW_FTYPE_PE         3  /* Windows */
  ------------------
  |  Branch (508:5): [True: 756, False: 7.09k]
  ------------------
  509|    756|        int resp = 0;
  510|       |
  511|    756|        resp = _dwarf_pe_setup(fd,
  512|    756|            "",
  513|    756|            ftype,endian,offsetsize,filesize,
  514|    756|            group_number,errhand,errarg,ret_dbg,error);
  515|    756|        if (resp != DW_DLV_OK) {
  ------------------
  |  |  122|    756|#define DW_DLV_OK        0
  ------------------
  |  Branch (515:13): [True: 578, False: 178]
  ------------------
  516|    578|            return resp;
  517|    578|        }
  518|    178|        set_global_paths_init(*ret_dbg,error);
  519|    178|        return resp;
  520|    756|        }
  521|      1|    default: break;
  ------------------
  |  Branch (521:5): [True: 1, False: 7.85k]
  ------------------
  522|  7.85k|    }
  523|  7.85k|    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.29k|{
  538|       |#ifdef LIBDWARF_MALLOC
  539|       |    _libdwarf_finish();
  540|       |#endif
  541|  8.29k|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|  8.29k|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|    934|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   33|  7.35k|#define TRUE 1
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   36|    934|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 7.35k, False: 934]
  |  |  |  Branch (159:7): [True: 7.35k, False: 934]
  |  |  |  Branch (159:15): [True: 0, False: 934]
  |  |  ------------------
  ------------------
  542|  7.35k|        _dwarf_free_static_errlist();
  543|  7.35k|        return DW_DLV_OK;
  ------------------
  |  |  122|  7.35k|#define DW_DLV_OK        0
  ------------------
  544|  7.35k|    }
  545|    934|    if (dbg->de_obj_file) {
  ------------------
  |  Branch (545:9): [True: 934, 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|    934|        char otype  = *(char *)(dbg->de_obj_file->ai_object);
  550|       |
  551|    934|        switch(otype) {
  552|      0|        case 'E': /* libelf. Impossible for years now. */
  ------------------
  |  Branch (552:9): [True: 0, False: 934]
  ------------------
  553|      0|            break;
  554|    585|        case 'F':
  ------------------
  |  Branch (554:9): [True: 585, False: 349]
  ------------------
  555|       |            /* Non-libelf elf access */
  556|    756|        case 'M':
  ------------------
  |  Branch (556:9): [True: 171, False: 763]
  ------------------
  557|    934|        case 'P':
  ------------------
  |  Branch (557:9): [True: 178, False: 756]
  ------------------
  558|       |            /* These take care of data alloc/mmap
  559|       |                by object type. */
  560|    934|            dbg->de_obj_file->ai_methods->om_finish(dbg->de_obj_file);
  561|    934|        default:
  ------------------
  |  Branch (561:9): [True: 0, False: 934]
  ------------------
  562|       |            /*  Do nothing. A serious internal error */
  563|    934|            break;
  564|    934|        }
  565|    934|    }
  566|    934|    if (dbg->de_owns_fd) {
  ------------------
  |  Branch (566:9): [True: 0, False: 934]
  ------------------
  567|      0|        _dwarf_closer(dbg->de_fd);
  568|      0|        dbg->de_owns_fd = FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  569|      0|    }
  570|    934|    free((void *)dbg->de_path);
  571|    934|    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|    934|    return dwarf_object_finish(dbg);
  582|    934|}
dwarf_generic_init.c:set_global_paths_init:
  132|    934|{
  133|    934|    int res = 0;
  134|       |
  135|    934|    res = dwarf_add_debuglink_global_path(dbg,
  136|    934|        "/usr/lib/debug",error);
  137|    934|    return res;
  138|    934|}

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

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

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

_dwarf_dealloc_loclists_context:
  674|  3.18k|{
  675|  3.18k|    Dwarf_Unsigned i = 0;
  676|  3.18k|    Dwarf_Loclists_Context * loccon = 0;
  677|       |
  678|  3.18k|    if (!dbg->de_loclists_context) {
  ------------------
  |  Branch (678:9): [True: 3.18k, False: 0]
  ------------------
  679|  3.18k|        return;
  680|  3.18k|    }
  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|  46.5k|{
  132|  46.5k|    unsigned char *cp = (unsigned char *)s;
  133|   355k|    for (  ; *cp ; ++cp) {
  ------------------
  |  Branch (133:14): [True: 309k, False: 46.5k]
  ------------------
  134|   309k|        if (*cp < 0x20 || *cp > 0x7e) {
  ------------------
  |  Branch (134:13): [True: 13, False: 309k]
  |  Branch (134:27): [True: 25, False: 309k]
  ------------------
  135|     38|            return TRUE;
  ------------------
  |  |   33|     38|#define TRUE 1
  ------------------
  136|     38|        }
  137|   309k|    }
  138|  46.5k|    return FALSE;
  ------------------
  |  |   36|  46.5k|#define FALSE 0
  ------------------
  139|  46.5k|}
_dwarf_load_macho_header:
  396|  2.08k|{
  397|  2.08k|    int res = 0;
  398|       |
  399|  2.08k|    if (mfp->mo_offsetsize == 32) {
  ------------------
  |  Branch (399:9): [True: 1.29k, False: 792]
  ------------------
  400|  1.29k|        res = load_macho_header32(mfp,errcode);
  401|  1.29k|    } else if (mfp->mo_offsetsize == 64) {
  ------------------
  |  Branch (401:16): [True: 792, False: 0]
  ------------------
  402|    792|        res = _dwarf_load_macho_header64(mfp,errcode);
  403|    792|    } else {
  404|      0|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|      0|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
  405|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  406|      0|    }
  407|  2.08k|    return res;
  408|  2.08k|}
_dwarf_load_macho_commands:
  768|  1.93k|{
  769|  1.93k|    Dwarf_Unsigned cmdi = 0;
  770|  1.93k|    Dwarf_Unsigned curoff = mfp->mo_command_start_offset;
  771|  1.93k|    struct load_command mc;
  772|  1.93k|    struct generic_macho_command *mcp = 0;
  773|  1.93k|    unsigned segment_command_count = 0;
  774|  1.93k|    int res = 0;
  775|  1.93k|    Dwarf_Unsigned inner = mfp->mo_inner_offset;
  776|  1.93k|    Dwarf_Unsigned commandsizetotal = 0;
  777|       |
  778|  1.93k|    if (mfp->mo_command_count >= mfp->mo_filesize) {
  ------------------
  |  Branch (778:9): [True: 30, False: 1.90k]
  ------------------
  779|       |        /* corrupt object. */
  780|     30|        *errcode = DW_DLE_MACH_O_SEGOFFSET_BAD;
  ------------------
  |  | 1462|     30|#define DW_DLE_MACH_O_SEGOFFSET_BAD            416
  ------------------
  781|     30|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     30|#define DW_DLV_ERROR      1
  ------------------
  782|     30|    }
  783|  1.90k|    if ((curoff + mfp->mo_command_count * sizeof(mc)) >=
  ------------------
  |  Branch (783:9): [True: 35, False: 1.86k]
  ------------------
  784|  1.90k|        mfp->mo_filesize) {
  785|       |        /* corrupt object. */
  786|     35|        *errcode = DW_DLE_MACH_O_SEGOFFSET_BAD;
  ------------------
  |  | 1462|     35|#define DW_DLE_MACH_O_SEGOFFSET_BAD            416
  ------------------
  787|     35|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     35|#define DW_DLV_ERROR      1
  ------------------
  788|     35|    }
  789|       |
  790|  1.86k|    mfp->mo_commands = (struct generic_macho_command *) calloc(
  791|  1.86k|        mfp->mo_command_count,sizeof(struct generic_macho_command));
  792|  1.86k|    if (!mfp->mo_commands) {
  ------------------
  |  Branch (792:9): [True: 0, False: 1.86k]
  ------------------
  793|       |        /* out of memory */
  794|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  795|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  796|      0|    }
  797|  1.86k|    mcp = mfp->mo_commands;
  798|   552k|    for ( ; cmdi < mfp->mo_header.ncmds; ++cmdi,++mcp ) {
  ------------------
  |  Branch (798:13): [True: 550k, False: 1.80k]
  ------------------
  799|   550k|        res = RRMOA(mfp->mo_fd, &mc,
  ------------------
  |  |   65|   550k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|   550k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  800|   550k|            inner+curoff, sizeof(mc),
  801|   550k|            inner+mfp->mo_filesize, errcode);
  802|   550k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|   550k|#define DW_DLV_OK         0
  ------------------
  |  Branch (802:13): [True: 3, False: 550k]
  ------------------
  803|      3|            free(mfp->mo_commands);
  804|      3|            mfp->mo_commands = 0;
  805|      3|            return res;
  806|      3|        }
  807|   550k|        ASNAR(mfp->mo_copy_word,mcp->cmd,mc.cmd);
  ------------------
  |  |   53|   550k|    do {                                        \
  |  |   54|   550k|        (t) = 0;                                \
  |  |   55|   550k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   550k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 550k]
  |  |  ------------------
  ------------------
  808|   550k|        ASNAR(mfp->mo_copy_word,mcp->cmdsize,mc.cmdsize);
  ------------------
  |  |   53|   550k|    do {                                        \
  |  |   54|   550k|        (t) = 0;                                \
  |  |   55|   550k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   550k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 550k]
  |  |  ------------------
  ------------------
  809|   550k|        commandsizetotal += mcp->cmdsize;
  810|   550k|        mcp->offset_this_command = curoff;
  811|   550k|        curoff += mcp->cmdsize;
  812|   550k|        if (mcp->cmdsize > mfp->mo_filesize ||
  ------------------
  |  Branch (812:13): [True: 45, False: 550k]
  ------------------
  813|   550k|            curoff > mfp->mo_filesize) {
  ------------------
  |  Branch (813:13): [True: 18, False: 550k]
  ------------------
  814|       |            /* corrupt object */
  815|     63|            free(mfp->mo_commands);
  816|     63|            mfp->mo_commands = 0;
  817|     63|            *errcode = DW_DLE_FILE_OFFSET_BAD;
  ------------------
  |  | 1463|     63|#define DW_DLE_FILE_OFFSET_BAD                 417
  ------------------
  818|     63|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     63|#define DW_DLV_ERROR      1
  ------------------
  819|     63|        }
  820|   550k|        if (mcp->cmd == LC_SEGMENT || mcp->cmd == LC_SEGMENT_64) {
  ------------------
  |  |  360|  1.10M|#define LC_SEGMENT    0x1    /* segment of this file to be mapped */
  ------------------
                      if (mcp->cmd == LC_SEGMENT || mcp->cmd == LC_SEGMENT_64) {
  ------------------
  |  |  407|   378k|#define    LC_SEGMENT_64    0x19
  ------------------
  |  Branch (820:13): [True: 172k, False: 378k]
  |  Branch (820:39): [True: 185k, False: 192k]
  ------------------
  821|   358k|            segment_command_count++;
  822|   358k|        }
  823|   550k|    }
  824|  1.80k|    mfp->mo_segment_count = segment_command_count;
  825|  1.80k|    mfp->mo_segment_size_total = commandsizetotal;
  826|  1.80k|    res = _dwarf_macho_load_segment_commands(mfp,errcode);
  827|  1.80k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.80k|#define DW_DLV_OK         0
  ------------------
  |  Branch (827:9): [True: 463, False: 1.33k]
  ------------------
  828|    463|        free(mfp->mo_commands);
  829|    463|        mfp->mo_commands = 0;
  830|    463|        return res;
  831|    463|    }
  832|  1.33k|    res = _dwarf_macho_load_dwarf_sections(mfp,errcode);
  833|  1.33k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.33k|#define DW_DLV_OK         0
  ------------------
  |  Branch (833:9): [True: 797, False: 540]
  ------------------
  834|    797|        free(mfp->mo_commands);
  835|    797|        mfp->mo_commands = 0;
  836|    797|    }
  837|  1.33k|    return res;
  838|  1.80k|}
_dwarf_macho_setup:
  851|  2.60k|{
  852|  2.60k|    Dwarf_Obj_Access_Interface_a *binary_interface = 0;
  853|  2.60k|    dwarf_macho_object_access_internals_t *intfc = 0;
  854|  2.60k|    int res = DW_DLV_OK;
  ------------------
  |  |   59|  2.60k|#define DW_DLV_OK         0
  ------------------
  855|  2.60k|    int localerrnum = 0;
  856|  2.60k|    unsigned universalbinary_count = 0;
  857|       |
  858|  2.60k|    res = _dwarf_macho_object_access_init(
  859|  2.60k|        fd,
  860|  2.60k|        universalnumber,
  861|  2.60k|        ftype,endian,offsetsize,
  862|  2.60k|        &universalbinary_count,
  863|  2.60k|        filesize,
  864|  2.60k|        &binary_interface,
  865|  2.60k|        &localerrnum);
  866|  2.60k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.60k|#define DW_DLV_OK         0
  ------------------
  |  Branch (866:9): [True: 2.06k, False: 540]
  ------------------
  867|  2.06k|        if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |   58|  2.06k|#define DW_DLV_NO_ENTRY  -1
  ------------------
  |  Branch (867:13): [True: 0, False: 2.06k]
  ------------------
  868|      0|            return res;
  869|      0|        }
  870|  2.06k|        _dwarf_error(NULL, error, localerrnum);
  871|  2.06k|        return DW_DLV_ERROR;
  ------------------
  |  |   60|  2.06k|#define DW_DLV_ERROR      1
  ------------------
  872|  2.06k|    }
  873|       |    /*  allocates and initializes Dwarf_Debug,
  874|       |        generic code */
  875|    540|    res = dwarf_object_init_b(binary_interface, errhand, errarg,
  876|    540|        groupnumber, dbg, error);
  877|    540|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|    540|#define DW_DLV_OK         0
  ------------------
  |  Branch (877:9): [True: 369, False: 171]
  ------------------
  878|    369|        _dwarf_destruct_macho_access(binary_interface);
  879|    369|        return res;
  880|    369|    }
  881|    171|    intfc = binary_interface->ai_object;
  882|    171|    intfc->mo_path = strdup(true_path);
  883|    171|    (*dbg)->de_obj_flags = intfc->mo_flags;
  884|    171|    (*dbg)->de_obj_machine = intfc->mo_machine;
  885|    171|    (*dbg)->de_universalbinary_index = universalnumber;
  886|    171|    (*dbg)->de_universalbinary_count = universalbinary_count;
  887|    171|    return res;
  888|    540|}
_dwarf_dealloc_universal_head:
 1343|     88|{
 1344|     88|    if (!dw_head) {
  ------------------
  |  Branch (1344:9): [True: 0, False: 88]
  ------------------
 1345|      0|        return;
 1346|      0|    }
 1347|     88|    free(dw_head->au_arches);
 1348|     88|    dw_head->au_arches = 0;
 1349|     88|    free(dw_head);
 1350|     88|}
dwarf_machoread.c:load_macho_header32:
  356|  1.29k|{
  357|  1.29k|    struct mach_header mh32;
  358|  1.29k|    int res = 0;
  359|  1.29k|    Dwarf_Unsigned inner = mfp->mo_inner_offset;
  360|       |
  361|  1.29k|    if (sizeof(mh32) > mfp->mo_filesize) {
  ------------------
  |  Branch (361:9): [True: 15, False: 1.27k]
  ------------------
  362|     15|        *errcode = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|     15|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  363|     15|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     15|#define DW_DLV_ERROR      1
  ------------------
  364|     15|    }
  365|  1.27k|    res = RRMOA(mfp->mo_fd, &mh32, inner, sizeof(mh32),
  ------------------
  |  |   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));
  ------------------
  366|  1.27k|        (inner+mfp->mo_filesize), errcode);
  367|  1.27k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.27k|#define DW_DLV_OK         0
  ------------------
  |  Branch (367:9): [True: 0, False: 1.27k]
  ------------------
  368|      0|        return res;
  369|      0|    }
  370|       |    /* Do not adjust endianness of magic, leave as-is. */
  371|  1.27k|    ASNAR(memcpy,mfp->mo_header.magic,mh32.magic);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  372|  1.27k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.cputype,mh32.cputype);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  373|  1.27k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.cpusubtype,
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  374|  1.27k|        mh32.cpusubtype);
  375|  1.27k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.filetype,mh32.filetype);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  376|  1.27k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.ncmds,mh32.ncmds);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  377|  1.27k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.sizeofcmds,
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  378|  1.27k|        mh32.sizeofcmds);
  379|  1.27k|    ASNAR(mfp->mo_copy_word,mfp->mo_header.flags,mh32.flags);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
  380|  1.27k|    mfp->mo_header.reserved = 0;
  381|  1.27k|    mfp->mo_command_count = (unsigned int)mfp->mo_header.ncmds;
  382|  1.27k|    if (mfp->mo_header.sizeofcmds >= mfp->mo_filesize ||
  ------------------
  |  Branch (382:9): [True: 55, False: 1.22k]
  ------------------
  383|  1.22k|        mfp->mo_header.sizeofcmds >= MAX_COMMANDS_SIZE ) {
  ------------------
  |  |   42|  1.22k|#define MAX_COMMANDS_SIZE  30000
  ------------------
  |  Branch (383:9): [True: 1, False: 1.22k]
  ------------------
  384|     56|        *errcode = DW_DLE_MACHO_CORRUPT_HEADER;
  ------------------
  |  | 1532|     56|#define DW_DLE_MACHO_CORRUPT_HEADER            486
  ------------------
  385|     56|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     56|#define DW_DLV_ERROR      1
  ------------------
  386|     56|    }
  387|  1.22k|    mfp->mo_machine = mfp->mo_header.cputype;
  388|  1.22k|    mfp->mo_flags = mfp->mo_header.flags;
  389|  1.22k|    mfp->mo_command_start_offset = sizeof(mh32);
  390|  1.22k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.22k|#define DW_DLV_OK         0
  ------------------
  391|  1.27k|}
dwarf_machoread.c:_dwarf_macho_load_segment_commands:
  471|  1.80k|{
  472|  1.80k|    Dwarf_Unsigned i = 0;
  473|  1.80k|    Dwarf_Unsigned segtotsize = 0;
  474|  1.80k|    int            res = 0;
  475|  1.80k|    struct generic_macho_command *mmp = 0;
  476|  1.80k|    struct generic_macho_segment_command *msp = 0;
  477|       |
  478|  1.80k|    if (mfp->mo_segment_count < 1) {
  ------------------
  |  Branch (478:9): [True: 122, False: 1.67k]
  ------------------
  479|    122|        return DW_DLV_OK;
  ------------------
  |  |   59|    122|#define DW_DLV_OK         0
  ------------------
  480|    122|    }
  481|  1.67k|    res = _dwarf_uint64_mult(mfp->mo_segment_count,
  482|  1.67k|        sizeof(struct generic_macho_segment_command),
  483|  1.67k|        &segtotsize);
  484|  1.67k|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  1.67k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (484:9): [True: 0, False: 1.67k]
  ------------------
  485|      0|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|      0|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  486|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  487|      0|    }
  488|       |#if 0 /* inappropriate test */
  489|       |    Not appropriate, segtotsize is internal space,not file space.
  490|       |    if (segtotsize > MAX_COMMANDS_SIZE ) {
  491|       |        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  492|       |        return DW_DLV_ERROR;
  493|       |    }
  494|       |#endif
  495|       |
  496|  1.67k|    mfp->mo_segment_commands =
  497|  1.67k|        (struct generic_macho_segment_command *)
  498|  1.67k|        calloc(1, segtotsize);
  499|  1.67k|    if (!mfp->mo_segment_commands) {
  ------------------
  |  Branch (499:9): [True: 0, False: 1.67k]
  ------------------
  500|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  501|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  502|      0|    }
  503|       |
  504|  1.67k|    mmp = mfp->mo_commands;
  505|  1.67k|    msp = mfp->mo_segment_commands;
  506|       |
  507|       |    /*  This is a heuristic sanity check for a badly
  508|       |        damaged object.
  509|       |        See dwarfbug DW202412-009. */
  510|  1.67k|    if ( mfp->mo_header.sizeofcmds > MAX_COMMANDS_SIZE) {
  ------------------
  |  |   42|  1.67k|#define MAX_COMMANDS_SIZE  30000
  ------------------
  |  Branch (510:10): [True: 0, False: 1.67k]
  ------------------
  511|      0|        *errcode = DW_DLE_MACHO_SEGMENT_COUNT_HEURISTIC_FAIL;
  ------------------
  |  | 1553|      0|#define DW_DLE_MACHO_SEGMENT_COUNT_HEURISTIC_FAIL 507
  ------------------
  512|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  513|      0|    }
  514|   425k|    for (i = 0 ; i < mfp->mo_command_count; ++i,++mmp) {
  ------------------
  |  Branch (514:18): [True: 423k, False: 1.21k]
  ------------------
  515|   423k|        unsigned cmd = (unsigned)mmp->cmd;
  516|       |
  517|   423k|        if (cmd == LC_SEGMENT) {
  ------------------
  |  |  360|   423k|#define LC_SEGMENT    0x1    /* segment of this file to be mapped */
  ------------------
  |  Branch (517:13): [True: 172k, False: 251k]
  ------------------
  518|   172k|            res = load_segment_command_content32(mfp,mmp,msp,
  519|   172k|                i,errcode);
  520|   172k|            ++msp;
  521|   251k|        } else if (cmd == LC_SEGMENT_64) {
  ------------------
  |  |  407|   251k|#define    LC_SEGMENT_64    0x19
  ------------------
  |  Branch (521:20): [True: 184k, False: 66.8k]
  ------------------
  522|   184k|            res = _dwarf_load_segment_command_content64(mfp,mmp,msp,
  523|   184k|                i,errcode);
  524|   184k|            ++msp;
  525|   184k|        } else { /* fall through, not a command of interest */ }
  526|   423k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|   423k|#define DW_DLV_OK         0
  ------------------
  |  Branch (526:13): [True: 463, False: 423k]
  ------------------
  527|    463|            free(mfp->mo_segment_commands);
  528|    463|            mfp->mo_segment_commands = 0;
  529|    463|            return res;
  530|    463|        }
  531|   423k|    }
  532|  1.21k|    return DW_DLV_OK;
  ------------------
  |  |   59|  1.21k|#define DW_DLV_OK         0
  ------------------
  533|  1.67k|}
dwarf_machoread.c:load_segment_command_content32:
  417|   172k|{
  418|   172k|    struct segment_command sc;
  419|   172k|    int res = 0;
  420|   172k|    Dwarf_Unsigned filesize = mfp->mo_filesize;
  421|   172k|    Dwarf_Unsigned segoffset = mmp->offset_this_command;
  422|   172k|    Dwarf_Unsigned afterseghdr = segoffset + sizeof(sc);
  423|   172k|    Dwarf_Unsigned inner = mfp->mo_inner_offset;
  424|       |
  425|   172k|    if (segoffset > filesize ||
  ------------------
  |  Branch (425:9): [True: 0, False: 172k]
  ------------------
  426|   172k|        mmp->cmdsize > filesize ||
  ------------------
  |  Branch (426:9): [True: 0, False: 172k]
  ------------------
  427|   172k|        (mmp->cmdsize + segoffset) > filesize ) {
  ------------------
  |  Branch (427:9): [True: 0, False: 172k]
  ------------------
  428|      0|        *errcode = DW_DLE_MACH_O_SEGOFFSET_BAD;
  ------------------
  |  | 1462|      0|#define DW_DLE_MACH_O_SEGOFFSET_BAD            416
  ------------------
  429|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  430|      0|    }
  431|   172k|    res = RRMOA(mfp->mo_fd, &sc, (inner+segoffset),
  ------------------
  |  |   65|   172k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|   172k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  432|   172k|        sizeof(sc), (inner+filesize), errcode);
  433|   172k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|   172k|#define DW_DLV_OK         0
  ------------------
  |  Branch (433:9): [True: 52, False: 172k]
  ------------------
  434|     52|        return res;
  435|     52|    }
  436|   172k|    ASNAR(mfp->mo_copy_word,msp->cmd,sc.cmd);
  ------------------
  |  |   53|   172k|    do {                                        \
  |  |   54|   172k|        (t) = 0;                                \
  |  |   55|   172k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   172k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 172k]
  |  |  ------------------
  ------------------
  437|   172k|    ASNAR(mfp->mo_copy_word,msp->cmdsize,sc.cmdsize);
  ------------------
  |  |   53|   172k|    do {                                        \
  |  |   54|   172k|        (t) = 0;                                \
  |  |   55|   172k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   172k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 172k]
  |  |  ------------------
  ------------------
  438|   172k|    _dwarf_safe_strcpy(msp->segname,sizeof(msp->segname),
  439|   172k|        sc.segname,sizeof(sc.segname));
  440|   172k|    ASNAR(mfp->mo_copy_word,msp->vmaddr,sc.vmaddr);
  ------------------
  |  |   53|   172k|    do {                                        \
  |  |   54|   172k|        (t) = 0;                                \
  |  |   55|   172k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   172k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 172k]
  |  |  ------------------
  ------------------
  441|   172k|    ASNAR(mfp->mo_copy_word,msp->vmsize,sc.vmsize);
  ------------------
  |  |   53|   172k|    do {                                        \
  |  |   54|   172k|        (t) = 0;                                \
  |  |   55|   172k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   172k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 172k]
  |  |  ------------------
  ------------------
  442|   172k|    ASNAR(mfp->mo_copy_word,msp->fileoff,sc.fileoff);
  ------------------
  |  |   53|   172k|    do {                                        \
  |  |   54|   172k|        (t) = 0;                                \
  |  |   55|   172k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   172k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 172k]
  |  |  ------------------
  ------------------
  443|   172k|    ASNAR(mfp->mo_copy_word,msp->filesize,sc.filesize);
  ------------------
  |  |   53|   172k|    do {                                        \
  |  |   54|   172k|        (t) = 0;                                \
  |  |   55|   172k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   172k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 172k]
  |  |  ------------------
  ------------------
  444|   172k|    if (msp->fileoff > mfp->mo_filesize ||
  ------------------
  |  Branch (444:9): [True: 46, False: 172k]
  ------------------
  445|   172k|        msp->filesize > mfp->mo_filesize) {
  ------------------
  |  Branch (445:9): [True: 47, False: 172k]
  ------------------
  446|       |        /* corrupt */
  447|     93|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|     93|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  448|     93|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     93|#define DW_DLV_ERROR      1
  ------------------
  449|     93|    }
  450|   172k|    if ((msp->fileoff+msp->filesize ) > filesize) {
  ------------------
  |  Branch (450:9): [True: 22, False: 172k]
  ------------------
  451|       |        /* corrupt */
  452|     22|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|     22|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  453|     22|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     22|#define DW_DLV_ERROR      1
  ------------------
  454|     22|    }
  455|   172k|    ASNAR(mfp->mo_copy_word,msp->maxprot,sc.maxprot);
  ------------------
  |  |   53|   172k|    do {                                        \
  |  |   54|   172k|        (t) = 0;                                \
  |  |   55|   172k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   172k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 172k]
  |  |  ------------------
  ------------------
  456|   172k|    ASNAR(mfp->mo_copy_word,msp->initprot,sc.initprot);
  ------------------
  |  |   53|   172k|    do {                                        \
  |  |   54|   172k|        (t) = 0;                                \
  |  |   55|   172k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   172k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 172k]
  |  |  ------------------
  ------------------
  457|   172k|    ASNAR(mfp->mo_copy_word,msp->nsects,sc.nsects);
  ------------------
  |  |   53|   172k|    do {                                        \
  |  |   54|   172k|        (t) = 0;                                \
  |  |   55|   172k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   172k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 172k]
  |  |  ------------------
  ------------------
  458|   172k|    if (msp->nsects >= mfp->mo_filesize) {
  ------------------
  |  Branch (458:9): [True: 28, False: 172k]
  ------------------
  459|     28|        *errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
  ------------------
  |  | 1533|     28|#define DW_DLE_MACHO_CORRUPT_COMMAND           487
  ------------------
  460|     28|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     28|#define DW_DLV_ERROR      1
  ------------------
  461|     28|    }
  462|   172k|    ASNAR(mfp->mo_copy_word,msp->flags,sc.flags);
  ------------------
  |  |   53|   172k|    do {                                        \
  |  |   54|   172k|        (t) = 0;                                \
  |  |   55|   172k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   172k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 172k]
  |  |  ------------------
  ------------------
  463|   172k|    msp->macho_command_index = mmpindex;
  464|   172k|    msp->sectionsoffset = afterseghdr;
  465|   172k|    return DW_DLV_OK;
  ------------------
  |  |   59|   172k|#define DW_DLV_OK         0
  ------------------
  466|   172k|}
dwarf_machoread.c:_dwarf_macho_load_dwarf_sections:
  726|  1.33k|{
  727|  1.33k|    Dwarf_Unsigned segi = 0;
  728|  1.33k|    Dwarf_Unsigned ftype = mfp->mo_header.filetype;
  729|       |
  730|  1.33k|    struct generic_macho_segment_command *segp =
  731|  1.33k|        mfp->mo_segment_commands;
  732|  1.33k|    if (ftype != MH_DSYM &&
  ------------------
  |  |  198|  2.67k|#define    MH_DSYM        0xa /* companion file with only debug */
  ------------------
  |  Branch (732:9): [True: 1.06k, False: 275]
  ------------------
  733|  1.06k|        ftype != MH_EXECUTE &&
  ------------------
  |  |  189|  2.39k|#define    MH_EXECUTE    0x2        /* demand paged executable file */
  ------------------
  |  Branch (733:9): [True: 1.03k, False: 27]
  ------------------
  734|  1.03k|        ftype != MH_OBJECT) {
  ------------------
  |  |  188|  1.03k|#define    MH_OBJECT    0x1        /* relocatable object file */
  ------------------
  |  Branch (734:9): [True: 110, False: 925]
  ------------------
  735|       |        /* We do not think it can have DWARF */
  736|    110|        return DW_DLV_OK;
  ------------------
  |  |   59|    110|#define DW_DLV_OK         0
  ------------------
  737|    110|    }
  738|  1.22k|    if (mfp->mo_segment_count > MAX_COMMANDS_SIZE) {
  ------------------
  |  |   42|  1.22k|#define MAX_COMMANDS_SIZE  30000
  ------------------
  |  Branch (738:9): [True: 2, False: 1.22k]
  ------------------
  739|       |        /*  It's really bad, the size is supposed to be size on disk,
  740|       |            so this is a likely silly check. */
  741|      2|        *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      2|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  742|      2|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
  743|      2|    }
  744|  61.8k|    for ( ; segi < mfp->mo_segment_count; ++segi,++segp) {
  ------------------
  |  Branch (744:13): [True: 61.4k, False: 430]
  ------------------
  745|  61.4k|        int res = 0;
  746|  61.4k|        if (0 == strcmp(segp->segname,"__PAGEZERO")) {
  ------------------
  |  Branch (746:13): [True: 457, False: 60.9k]
  ------------------
  747|    457|            continue;
  748|    457|        }
  749|  60.9k|        if (0 ==strcmp(segp->segname,"__LINKEDIT")) {
  ------------------
  |  Branch (749:13): [True: 261, False: 60.7k]
  ------------------
  750|    261|            continue;
  751|    261|        }
  752|  60.7k|        if (0 ==strcmp(segp->segname,"__DATA")) {
  ------------------
  |  Branch (752:13): [True: 230, False: 60.4k]
  ------------------
  753|    230|            continue;
  754|    230|        }
  755|  60.4k|        res = _dwarf_macho_load_dwarf_section_details(mfp,
  756|  60.4k|            segp,segi,errcode);
  757|  60.4k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  60.4k|#define DW_DLV_OK         0
  ------------------
  |  Branch (757:13): [True: 795, False: 59.6k]
  ------------------
  758|    795|            return res;
  759|    795|        }
  760|  60.4k|    }
  761|    430|    return DW_DLV_OK;
  ------------------
  |  |   59|    430|#define DW_DLV_OK         0
  ------------------
  762|  1.22k|}
dwarf_machoread.c:_dwarf_macho_load_dwarf_section_details:
  707|  60.4k|{
  708|  60.4k|    int res = 0;
  709|       |
  710|  60.4k|    if (mfp->mo_offsetsize == 32) {
  ------------------
  |  Branch (710:9): [True: 12.8k, False: 47.6k]
  ------------------
  711|  12.8k|        res = _dwarf_macho_load_dwarf_section_details32(mfp,
  712|  12.8k|            segp,segi,errcode);
  713|  47.6k|    } else if (mfp->mo_offsetsize == 64) {
  ------------------
  |  Branch (713:16): [True: 47.6k, False: 0]
  ------------------
  714|  47.6k|        res = _dwarf_macho_load_dwarf_section_details64(mfp,
  715|  47.6k|            segp,segi,errcode);
  716|  47.6k|    } else {
  717|      0|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|      0|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
  718|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  719|      0|    }
  720|  60.4k|    return res;
  721|  60.4k|}
dwarf_machoread.c:_dwarf_macho_load_dwarf_section_details32:
  540|  12.8k|{
  541|  12.8k|    int res = 0;
  542|  12.8k|    Dwarf_Unsigned seci = 0;
  543|  12.8k|    Dwarf_Unsigned seccount = segp->nsects;
  544|  12.8k|    Dwarf_Unsigned secalloc = seccount+1;
  545|       |
  546|       |    /* offset of sections being added */
  547|  12.8k|    Dwarf_Unsigned curoff = segp->sectionsoffset;
  548|  12.8k|    Dwarf_Unsigned shdrlen = sizeof(struct section);
  549|  12.8k|    Dwarf_Unsigned newcount = 0;
  550|  12.8k|    struct generic_macho_section *secs = 0;
  551|       |
  552|  12.8k|    if (mfp->mo_dwarf_sections) {
  ------------------
  |  Branch (552:9): [True: 12.3k, False: 536]
  ------------------
  553|  12.3k|        Dwarf_Unsigned secssizetot = 0;
  554|  12.3k|        struct generic_macho_section * originalsections =
  555|  12.3k|            mfp->mo_dwarf_sections;
  556|       |
  557|  12.3k|        if (!seccount) {
  ------------------
  |  Branch (557:13): [True: 532, False: 11.8k]
  ------------------
  558|       |            /* No sections. Odd. Unexpected. */
  559|    532|            return DW_DLV_OK;
  ------------------
  |  |   59|    532|#define DW_DLV_OK         0
  ------------------
  560|    532|        }
  561|  11.8k|        newcount = mfp->mo_dwarf_sectioncount + seccount;
  562|  11.8k|        res = _dwarf_uint64_mult(newcount,
  563|  11.8k|            sizeof(struct generic_macho_section),
  564|  11.8k|            &secssizetot);
  565|  11.8k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  11.8k|#define DW_DLV_OK         0
  ------------------
  |  Branch (565:13): [True: 0, False: 11.8k]
  ------------------
  566|       |            /* overflow */
  567|      0|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      0|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  568|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  569|      0|        }
  570|  11.8k|        if (secssizetot > mfp->mo_filesize ) {
  ------------------
  |  Branch (570:13): [True: 137, False: 11.6k]
  ------------------
  571|       |
  572|       |            /*  Really supposed to refer to size on disk, this
  573|       |                is therefore approximate test. */
  574|    137|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|    137|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  575|    137|            return DW_DLV_ERROR;
  ------------------
  |  |   60|    137|#define DW_DLV_ERROR      1
  ------------------
  576|    137|        }
  577|       |
  578|  11.6k|        secs = (struct generic_macho_section *)calloc(
  579|  11.6k|            1,secssizetot);
  580|  11.6k|        if (!secs) {
  ------------------
  |  Branch (580:13): [True: 0, False: 11.6k]
  ------------------
  581|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  582|      0|            return DW_DLV_OK;
  ------------------
  |  |   59|      0|#define DW_DLV_OK         0
  ------------------
  583|      0|        }
  584|  11.6k|        memcpy(secs,mfp->mo_dwarf_sections,
  585|  11.6k|            mfp->mo_dwarf_sectioncount*
  586|  11.6k|            sizeof(struct generic_macho_section));
  587|  11.6k|        mfp->mo_dwarf_sections = secs;
  588|  11.6k|        seci =  mfp->mo_dwarf_sectioncount ;
  589|  11.6k|        mfp->mo_dwarf_sectioncount = newcount;
  590|  11.6k|        free(originalsections);
  591|  11.6k|        secs += seci;
  592|  11.6k|        secs->offset_of_sec_rec = curoff;
  593|  11.6k|        secalloc = newcount;
  594|  11.6k|    } else {
  595|    536|        Dwarf_Unsigned secssizetot = 0;
  596|       |
  597|    536|        newcount = secalloc;
  598|    536|        res = _dwarf_uint64_mult(newcount,
  599|    536|            sizeof(struct generic_macho_section),
  600|    536|            &secssizetot);
  601|    536|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    536|#define DW_DLV_OK         0
  ------------------
  |  Branch (601:13): [True: 0, False: 536]
  ------------------
  602|       |            /* overflow */
  603|      0|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      0|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  604|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  605|      0|        }
  606|    536|        if (secssizetot > mfp->mo_filesize ) {
  ------------------
  |  Branch (606:13): [True: 185, False: 351]
  ------------------
  607|       |            /*  Really supposed to refer to size on disk, this
  608|       |                is therefore approximate sanity test. */
  609|    185|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|    185|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  610|    185|            return DW_DLV_ERROR;
  ------------------
  |  |   60|    185|#define DW_DLV_ERROR      1
  ------------------
  611|    185|        }
  612|    351|        secs = (struct generic_macho_section *)calloc(
  613|    351|            1,secssizetot);
  614|    351|        if (!secs) {
  ------------------
  |  Branch (614:13): [True: 0, False: 351]
  ------------------
  615|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  616|      0|            return DW_DLV_OK;
  ------------------
  |  |   59|      0|#define DW_DLV_OK         0
  ------------------
  617|      0|        }
  618|    351|        mfp->mo_dwarf_sections = secs;
  619|    351|        mfp->mo_dwarf_sectioncount = secalloc;
  620|    351|        secs->offset_of_sec_rec = curoff;
  621|       |        /*  Leave 0 section all zeros except our offset,
  622|       |            elf-like in a sense */
  623|    351|        secs->dwarfsectname = "";
  624|    351|        seci = 1;
  625|    351|        ++secs;
  626|    351|    }
  627|       |
  628|  27.6k|    for (; seci < secalloc; ++seci,++secs,curoff += shdrlen ) {
  ------------------
  |  Branch (628:12): [True: 15.7k, False: 11.8k]
  ------------------
  629|  15.7k|        struct section mosec;
  630|  15.7k|        Dwarf_Unsigned endoffset = 0;
  631|  15.7k|        Dwarf_Unsigned inner = mfp->mo_inner_offset;
  632|  15.7k|        Dwarf_Unsigned offplussize = 0;
  633|  15.7k|        Dwarf_Unsigned innercur = 0;
  634|       |
  635|  15.7k|        endoffset = curoff + sizeof(mosec);
  636|  15.7k|        if (curoff >=  mfp->mo_filesize ||
  ------------------
  |  Branch (636:13): [True: 1, False: 15.7k]
  ------------------
  637|  15.7k|            endoffset > mfp->mo_filesize) {
  ------------------
  |  Branch (637:13): [True: 7, False: 15.7k]
  ------------------
  638|      8|            *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      8|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  639|      8|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      8|#define DW_DLV_ERROR      1
  ------------------
  640|      8|        }
  641|  15.7k|        innercur = inner+curoff;
  642|  15.7k|        if (innercur < inner || innercur <curoff) {
  ------------------
  |  Branch (642:13): [True: 0, False: 15.7k]
  |  Branch (642:33): [True: 0, False: 15.7k]
  ------------------
  643|      0|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      0|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  644|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  645|      0|        }
  646|  15.7k|        offplussize = inner+mfp->mo_filesize;
  647|  15.7k|        if (offplussize < inner || offplussize <mfp->mo_filesize) {
  ------------------
  |  Branch (647:13): [True: 0, False: 15.7k]
  |  Branch (647:36): [True: 0, False: 15.7k]
  ------------------
  648|      0|            *errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      0|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  649|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  650|      0|        }
  651|  15.7k|        res = RRMOA(mfp->mo_fd, &mosec,
  ------------------
  |  |   65|  15.7k|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|  15.7k|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  652|  15.7k|            innercur, sizeof(mosec),
  653|  15.7k|            offplussize, errcode);
  654|  15.7k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  15.7k|#define DW_DLV_OK         0
  ------------------
  |  Branch (654:13): [True: 0, False: 15.7k]
  ------------------
  655|      0|            return res;
  656|      0|        }
  657|  15.7k|        _dwarf_safe_strcpy(secs->sectname,
  658|  15.7k|            sizeof(secs->sectname),
  659|  15.7k|            mosec.sectname,sizeof(mosec.sectname));
  660|  15.7k|        if (_dwarf_not_ascii(secs->sectname) ) {
  ------------------
  |  Branch (660:13): [True: 27, False: 15.6k]
  ------------------
  661|     27|            *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|     27|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  662|     27|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     27|#define DW_DLV_ERROR      1
  ------------------
  663|     27|        }
  664|  15.6k|        _dwarf_safe_strcpy(secs->segname, sizeof(secs->segname),
  665|  15.6k|            mosec.segname,sizeof(mosec.segname));
  666|  15.6k|        ASNAR(mfp->mo_copy_word,secs->addr,mosec.addr);
  ------------------
  |  |   53|  15.6k|    do {                                        \
  |  |   54|  15.6k|        (t) = 0;                                \
  |  |   55|  15.6k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  15.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 15.6k]
  |  |  ------------------
  ------------------
  667|  15.6k|        ASNAR(mfp->mo_copy_word,secs->size,mosec.size);
  ------------------
  |  |   53|  15.6k|    do {                                        \
  |  |   54|  15.6k|        (t) = 0;                                \
  |  |   55|  15.6k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  15.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 15.6k]
  |  |  ------------------
  ------------------
  668|  15.6k|        ASNAR(mfp->mo_copy_word,secs->offset,mosec.offset);
  ------------------
  |  |   53|  15.6k|    do {                                        \
  |  |   54|  15.6k|        (t) = 0;                                \
  |  |   55|  15.6k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  15.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 15.6k]
  |  |  ------------------
  ------------------
  669|  15.6k|        ASNAR(mfp->mo_copy_word,secs->align,mosec.align);
  ------------------
  |  |   53|  15.6k|    do {                                        \
  |  |   54|  15.6k|        (t) = 0;                                \
  |  |   55|  15.6k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  15.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 15.6k]
  |  |  ------------------
  ------------------
  670|  15.6k|        ASNAR(mfp->mo_copy_word,secs->reloff,mosec.reloff);
  ------------------
  |  |   53|  15.6k|    do {                                        \
  |  |   54|  15.6k|        (t) = 0;                                \
  |  |   55|  15.6k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  15.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 15.6k]
  |  |  ------------------
  ------------------
  671|  15.6k|        ASNAR(mfp->mo_copy_word,secs->nreloc,mosec.nreloc);
  ------------------
  |  |   53|  15.6k|    do {                                        \
  |  |   54|  15.6k|        (t) = 0;                                \
  |  |   55|  15.6k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  15.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 15.6k]
  |  |  ------------------
  ------------------
  672|  15.6k|        ASNAR(mfp->mo_copy_word,secs->flags,mosec.flags);
  ------------------
  |  |   53|  15.6k|    do {                                        \
  |  |   54|  15.6k|        (t) = 0;                                \
  |  |   55|  15.6k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  15.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 15.6k]
  |  |  ------------------
  ------------------
  673|       |        /*offplussize = secs->offset+secs->size; */
  674|  15.6k|        res = _dwarf_uint64_add(secs->offset,secs->size,
  675|  15.6k|            &offplussize);
  676|  15.6k|        if (res == DW_DLV_ERROR){
  ------------------
  |  |   60|  15.6k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (676:13): [True: 0, False: 15.6k]
  ------------------
  677|       |            /* overflow in add */
  678|      0|            *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|      0|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  679|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  680|      0|        }
  681|       |        /*  __text section size apparently refers to executable,
  682|       |            not dSYM, so do not check here:
  683|       |            No check for __text.
  684|       |            So all sections in __DWARF checked  */
  685|  15.6k|        if (0 == strcmp(secs->segname,"__DWARF")) {
  ------------------
  |  Branch (685:13): [True: 5.46k, False: 10.2k]
  ------------------
  686|  5.46k|            if (secs->offset > mfp->mo_filesize ||
  ------------------
  |  Branch (686:17): [True: 36, False: 5.42k]
  ------------------
  687|  5.42k|                secs->size > mfp->mo_filesize ||
  ------------------
  |  Branch (687:17): [True: 54, False: 5.37k]
  ------------------
  688|  5.37k|                offplussize > mfp->mo_filesize) {
  ------------------
  |  Branch (688:17): [True: 17, False: 5.35k]
  ------------------
  689|    107|                *errcode  = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
  ------------------
  |  | 1534|    107|#define DW_DLE_MACHO_CORRUPT_SECTIONDETAILS    488
  ------------------
  690|    107|                return DW_DLV_ERROR;
  ------------------
  |  |   60|    107|#define DW_DLV_ERROR      1
  ------------------
  691|    107|            }
  692|  5.46k|        }
  693|  15.5k|        secs->reserved1 = 0;
  694|  15.5k|        secs->reserved2 = 0;
  695|  15.5k|        secs->reserved3 = 0;
  696|  15.5k|        secs->generic_segment_num  = segi;
  697|  15.5k|        secs->offset_of_sec_rec = curoff;
  698|  15.5k|    }
  699|  11.8k|    return DW_DLV_OK;
  ------------------
  |  |   59|  11.8k|#define DW_DLV_OK         0
  ------------------
  700|  12.0k|}
dwarf_machoread.c:_dwarf_destruct_macho_access:
  336|    540|{
  337|    540|    struct Dwarf_Obj_Access_Interface_a_s * aip =
  338|    540|        (struct Dwarf_Obj_Access_Interface_a_s *)obj;
  339|       |
  340|    540|    dwarf_macho_object_access_internals_t *mp = 0;
  341|       |
  342|    540|    if (!aip) {
  ------------------
  |  Branch (342:9): [True: 0, False: 540]
  ------------------
  343|      0|        return;
  344|      0|    }
  345|    540|    mp = (dwarf_macho_object_access_internals_t *)aip->ai_object;
  346|    540|    _dwarf_destruct_macho_internals(mp);
  347|    540|    aip->ai_object = 0;
  348|    540|    free(aip);
  349|    540|    return;
  350|    540|}
dwarf_machoread.c:_dwarf_destruct_macho_internals:
  301|  2.60k|{
  302|  2.60k|    Dwarf_Unsigned i = 0;
  303|       |
  304|  2.60k|    if (mp->mo_destruct_close_fd) {
  ------------------
  |  Branch (304:9): [True: 0, False: 2.60k]
  ------------------
  305|      0|        _dwarf_closer(mp->mo_fd);
  306|      0|        mp->mo_fd = -1;
  307|      0|    }
  308|  2.60k|    if (mp->mo_commands){
  ------------------
  |  Branch (308:9): [True: 540, False: 2.06k]
  ------------------
  309|    540|        free(mp->mo_commands);
  310|    540|        mp->mo_commands = 0;
  311|    540|    }
  312|  2.60k|    if (mp->mo_segment_commands){
  ------------------
  |  Branch (312:9): [True: 1.21k, False: 1.38k]
  ------------------
  313|  1.21k|        free(mp->mo_segment_commands);
  314|  1.21k|        mp->mo_segment_commands = 0;
  315|  1.21k|    }
  316|  2.60k|    free((char *)mp->mo_path);
  317|  2.60k|    if (mp->mo_dwarf_sections) {
  ------------------
  |  Branch (317:9): [True: 913, False: 1.69k]
  ------------------
  318|    913|        struct generic_macho_section *sp = 0;
  319|       |
  320|    913|        sp = mp->mo_dwarf_sections;
  321|  49.5k|        for ( i=0; i < mp->mo_dwarf_sectioncount; ++i,++sp) {
  ------------------
  |  Branch (321:20): [True: 48.6k, False: 913]
  ------------------
  322|  48.6k|            if (sp->loaded_data) {
  ------------------
  |  Branch (322:17): [True: 9, False: 48.6k]
  ------------------
  323|      9|                free(sp->loaded_data);
  324|      9|                sp->loaded_data = 0;
  325|      9|            }
  326|  48.6k|        }
  327|    913|        free(mp->mo_dwarf_sections);
  328|    913|        mp->mo_dwarf_sections = 0;
  329|    913|    }
  330|  2.60k|    free(mp);
  331|  2.60k|    return;
  332|  2.60k|}
dwarf_machoread.c:_dwarf_macho_object_access_init:
 1086|  2.60k|{
 1087|  2.60k|    int res = 0;
 1088|  2.60k|    dwarf_macho_object_access_internals_t *internals = 0;
 1089|  2.60k|    Dwarf_Obj_Access_Interface_a *intfc = 0;
 1090|       |
 1091|  2.60k|    internals = malloc(
 1092|  2.60k|        sizeof(dwarf_macho_object_access_internals_t));
 1093|  2.60k|    if (!internals) {
  ------------------
  |  Branch (1093:9): [True: 0, False: 2.60k]
  ------------------
 1094|      0|        *localerrnum = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1095|       |        /* Impossible case, we hope. Give up. */
 1096|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1097|      0|    }
 1098|  2.60k|    memset(internals,0,sizeof(*internals));
 1099|  2.60k|    res = _dwarf_macho_object_access_internals_init(internals,
 1100|  2.60k|        fd,
 1101|  2.60k|        uninumber,
 1102|  2.60k|        ftype, endian, offsetsize,
 1103|  2.60k|        universalbinary_count,
 1104|  2.60k|        filesize,
 1105|  2.60k|        localerrnum);
 1106|  2.60k|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|  2.60k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1106:9): [True: 2.06k, False: 540]
  ------------------
 1107|  2.06k|        _dwarf_destruct_macho_internals(internals);
 1108|  2.06k|        return DW_DLV_ERROR;
  ------------------
  |  |   60|  2.06k|#define DW_DLV_ERROR      1
  ------------------
 1109|  2.06k|    }
 1110|    540|    intfc = malloc(sizeof(Dwarf_Obj_Access_Interface_a));
 1111|    540|    if (!intfc) {
  ------------------
  |  Branch (1111:9): [True: 0, False: 540]
  ------------------
 1112|       |        /* Impossible case, we hope. Give up. */
 1113|      0|        _dwarf_destruct_macho_internals(internals);
 1114|      0|        *localerrnum = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1115|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1116|      0|    }
 1117|       |    /* Initialize the interface struct */
 1118|    540|    intfc->ai_object = internals;
 1119|    540|    intfc->ai_methods = &macho_methods;
 1120|    540|    *binary_interface = intfc;
 1121|    540|    return DW_DLV_OK;
  ------------------
  |  |   59|    540|#define DW_DLV_OK         0
  ------------------
 1122|    540|}
dwarf_machoread.c:_dwarf_macho_object_access_internals_init:
  989|  2.60k|{
  990|  2.60k|    Dwarf_Unsigned i  = 0;
  991|  2.60k|    struct generic_macho_section *sp = 0;
  992|  2.60k|    int res = 0;
  993|  2.60k|    unsigned int   ftypei = ftype;
  994|  2.60k|    unsigned int   endiani = endian;
  995|  2.60k|    unsigned int   offsetsizei = offsetsize;
  996|  2.60k|    Dwarf_Unsigned filesizei = filesize;
  997|  2.60k|    Dwarf_Unsigned fileoffseti = 0;
  998|  2.60k|    unsigned int unibinarycounti = 0;
  999|       |
 1000|  2.60k|    if (ftype == DW_FTYPE_APPLEUNIVERSAL) {
  ------------------
  |  |  118|  2.60k|#define DW_FTYPE_APPLEUNIVERSAL    5
  ------------------
  |  Branch (1000:9): [True: 563, False: 2.04k]
  ------------------
 1001|    563|        res = _dwarf_macho_inner_object_fd(fd,
 1002|    563|            uninumber,
 1003|    563|            filesize,
 1004|    563|            &ftypei,&unibinarycounti,&endiani,
 1005|    563|            &offsetsizei,&fileoffseti,&filesizei,errcode);
 1006|    563|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    563|#define DW_DLV_OK         0
  ------------------
  |  Branch (1006:13): [True: 519, False: 44]
  ------------------
 1007|    519|            if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|    519|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1007:17): [True: 496, False: 23]
  ------------------
 1008|    496|            }
 1009|    519|            return res;
 1010|    519|        }
 1011|     44|        *unibinarycount = unibinarycounti;
 1012|     44|        endian = endiani;
 1013|     44|    }
 1014|       |
 1015|  2.08k|    internals->mo_ident[0]    = 'M';
 1016|  2.08k|    internals->mo_ident[1]    = '1';
 1017|  2.08k|    internals->mo_fd          = fd;
 1018|  2.08k|    internals->mo_offsetsize  = offsetsizei;
 1019|  2.08k|    internals->mo_pointersize = offsetsizei;
 1020|  2.08k|    internals->mo_inner_offset  =  fileoffseti;
 1021|  2.08k|    internals->mo_filesize    = filesizei;
 1022|  2.08k|    internals->mo_ftype       = ftypei;
 1023|  2.08k|    internals->mo_uninumber   = uninumber;
 1024|  2.08k|    internals->mo_universal_count = unibinarycounti;
 1025|       |
 1026|       |#ifdef WORDS_BIGENDIAN
 1027|       |    if (endian == DW_END_little ) {
 1028|       |        internals->mo_copy_word = _dwarf_memcpy_swap_bytes;
 1029|       |        internals->mo_endian = DW_END_little;
 1030|       |    } else {
 1031|       |        internals->mo_copy_word = _dwarf_memcpy_noswap_bytes;
 1032|       |        internals->mo_endian = DW_END_big;
 1033|       |    }
 1034|       |#else  /* LITTLE ENDIAN */
 1035|  2.08k|    if (endian == DW_END_little ) {
  ------------------
  |  | 1115|  2.08k|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  |  Branch (1035:9): [True: 565, False: 1.51k]
  ------------------
 1036|    565|        internals->mo_copy_word = _dwarf_memcpy_noswap_bytes;
 1037|    565|        internals->mo_endian = DW_END_little;
  ------------------
  |  | 1115|    565|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1038|  1.51k|    } else {
 1039|  1.51k|        internals->mo_copy_word = _dwarf_memcpy_swap_bytes;
 1040|  1.51k|        internals->mo_endian = DW_END_big;
  ------------------
  |  | 1114|  1.51k|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
 1041|  1.51k|    }
 1042|  2.08k|#endif /* LITTLE- BIG-ENDIAN */
 1043|  2.08k|    res = _dwarf_load_macho_header(internals,errcode);
 1044|  2.08k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  2.08k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1044:9): [True: 153, False: 1.93k]
  ------------------
 1045|    153|        return res;
 1046|    153|    }
 1047|       |    /* Load sections */
 1048|  1.93k|    res = _dwarf_load_macho_commands(internals,errcode);
 1049|  1.93k|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|  1.93k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1049:9): [True: 1.39k, False: 540]
  ------------------
 1050|  1.39k|        return res;
 1051|  1.39k|    }
 1052|    540|    if (internals->mo_dwarf_sections) {
  ------------------
  |  Branch (1052:9): [True: 371, False: 169]
  ------------------
 1053|    371|        sp = internals->mo_dwarf_sections+1;
 1054|    371|    } else {
 1055|       |        /*  There are no dwarf sections, but could be .text */
 1056|    169|    }
 1057|  20.8k|    for (i = 1; i < internals->mo_dwarf_sectioncount ; ++i,++sp) {
  ------------------
  |  Branch (1057:17): [True: 20.3k, False: 540]
  ------------------
 1058|  20.3k|        int j = 1;
 1059|  20.3k|        int lim = sizeof(SectionNames)/sizeof(SectionNames[0]);
 1060|  20.3k|        sp->dwarfsectname = "";
 1061|   435k|        for ( ; j < lim; ++j) {
  ------------------
  |  Branch (1061:17): [True: 416k, False: 19.3k]
  ------------------
 1062|   416k|            if (!strcmp(sp->sectname,SectionNames[j].ms_moname)) {
  ------------------
  |  Branch (1062:17): [True: 930, False: 415k]
  ------------------
 1063|    930|                sp->dwarfsectname = SectionNames[j].ms_dwname;
 1064|    930|                break;
 1065|    930|            }
 1066|   416k|        }
 1067|  20.3k|        if (sp->dwarfsectname[0] == 0) {
  ------------------
  |  Branch (1067:13): [True: 19.3k, False: 930]
  ------------------
 1068|       |            /* if not matched, keep the apple section name */
 1069|  19.3k|            sp->dwarfsectname = sp->sectname;
 1070|  19.3k|        }
 1071|  20.3k|    }
 1072|    540|    return DW_DLV_OK;
  ------------------
  |  |   59|    540|#define DW_DLV_OK         0
  ------------------
 1073|  1.93k|}
dwarf_machoread.c:_dwarf_macho_inner_object_fd:
  927|    563|{
  928|    563|    int res = 0;
  929|    563|    Dwarf_Universal_Head  head = 0;
  930|    563|    Dwarf_Unsigned innerbase = 0;
  931|    563|    Dwarf_Unsigned innersize = 0;
  932|       |
  933|    563|    res =  _dwarf_object_detector_universal_head_fd(
  934|    563|        fd, outer_filesize, unibinarycount,
  935|    563|        &head, errcode);
  936|    563|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    563|#define DW_DLV_OK         0
  ------------------
  |  Branch (936:9): [True: 475, False: 88]
  ------------------
  937|    475|        return res;
  938|    475|    }
  939|     88|    if (uninumber >= *unibinarycount) {
  ------------------
  |  Branch (939:9): [True: 4, False: 84]
  ------------------
  940|      4|        *errcode = DW_DLE_UNIVERSAL_BINARY_ERROR;
  ------------------
  |  | 1548|      4|#define DW_DLE_UNIVERSAL_BINARY_ERROR          502
  ------------------
  941|      4|        _dwarf_dealloc_universal_head(head);
  942|      4|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
  943|      4|    }
  944|       |    /*  Now find the precise details of uninumber
  945|       |        instance we want */
  946|       |
  947|     84|    innerbase = head->au_arches[uninumber].au_offset;
  948|     84|    innersize = head->au_arches[uninumber].au_size;
  949|     84|    if (innersize >= outer_filesize ||
  ------------------
  |  Branch (949:9): [True: 0, False: 84]
  ------------------
  950|     84|        innerbase >= outer_filesize) {
  ------------------
  |  Branch (950:9): [True: 0, False: 84]
  ------------------
  951|      0|        *errcode = DW_DLE_UNIVERSAL_BINARY_ERROR;
  ------------------
  |  | 1548|      0|#define DW_DLE_UNIVERSAL_BINARY_ERROR          502
  ------------------
  952|      0|        _dwarf_dealloc_universal_head(head);
  953|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  954|      0|    }
  955|       |    /* Now access inner to return its specs */
  956|     84|    {
  957|       |        /*  But ignore the size this returns!
  958|       |            we determined that above. the following call
  959|       |            does not get the inner size, we got that
  960|       |            just above here! */
  961|     84|        Dwarf_Unsigned fake_size = 0;
  962|       |
  963|     84|        res = _dwarf_object_detector_fd_a(fd,
  964|     84|            ftype,endian,offsetsize,innerbase,&fake_size,
  965|     84|            errcode);
  966|     84|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     84|#define DW_DLV_OK         0
  ------------------
  |  Branch (966:13): [True: 40, False: 44]
  ------------------
  967|     40|            _dwarf_dealloc_universal_head(head);
  968|     40|            return res;
  969|     40|        }
  970|     84|    }
  971|     44|    *fileoffset = innerbase;
  972|     44|    *filesize = innersize;
  973|     44|    _dwarf_dealloc_universal_head(head);
  974|     44|    return DW_DLV_OK;
  ------------------
  |  |   59|     44|#define DW_DLV_OK         0
  ------------------
  975|     84|}
dwarf_machoread.c:_dwarf_object_detector_universal_head_fd:
 1189|    563|{
 1190|    563|    struct Dwarf_Universal_Head_s  duhd;
 1191|    563|    struct Dwarf_Universal_Head_s *duhdp = 0;
 1192|    563|    struct  fat_header fh;
 1193|    563|    int     res = 0;
 1194|    563|    void (*word_swap) (void *, const void *, unsigned long);
 1195|    563|    int     locendian = 0;
 1196|    563|    int     locoffsetsize = 0;
 1197|       |
 1198|    563|    duhd = duhzero;
 1199|    563|    fh = fhzero;
 1200|       |    /*  A universal head is always at offset zero. */
 1201|    563|    duhd.au_filesize = dw_filesize;
 1202|    563|    if (sizeof(fh) >= dw_filesize) {
  ------------------
  |  Branch (1202:9): [True: 0, False: 563]
  ------------------
 1203|      0|        *errcode = DW_DLE_UNIVERSAL_BINARY_ERROR;
  ------------------
  |  | 1548|      0|#define DW_DLE_UNIVERSAL_BINARY_ERROR          502
  ------------------
 1204|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1205|      0|    }
 1206|    563|    res = RRMOA(fd,&fh,0,sizeof(fh), dw_filesize,errcode);
  ------------------
  |  |   65|    563|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    563|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1207|    563|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    563|#define DW_DLV_OK         0
  ------------------
  |  Branch (1207:9): [True: 0, False: 563]
  ------------------
 1208|      0|        return res;
 1209|       |
 1210|      0|    }
 1211|    563|    duhd.au_magic = magic_copy((unsigned char *)&fh.magic[0],4);
 1212|    563|    if (duhd.au_magic == FAT_MAGIC) {
  ------------------
  |  |   84|    563|#define FAT_MAGIC   0xcafebabe
  ------------------
  |  Branch (1212:9): [True: 93, False: 470]
  ------------------
 1213|     93|        locendian = DW_END_big;
  ------------------
  |  | 1114|     93|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
 1214|     93|        locoffsetsize = 32;
 1215|    470|    } else if (duhd.au_magic == FAT_CIGAM) {
  ------------------
  |  |   85|    470|#define FAT_CIGAM   0xbebafeca
  ------------------
  |  Branch (1215:16): [True: 158, False: 312]
  ------------------
 1216|    158|        locendian = DW_END_little;
  ------------------
  |  | 1115|    158|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1217|    158|        locoffsetsize = 32;
 1218|    312|    }else if (duhd.au_magic == FAT_MAGIC_64) {
  ------------------
  |  |   86|    312|#define FAT_MAGIC_64    0xcafebabf
  ------------------
  |  Branch (1218:15): [True: 107, False: 205]
  ------------------
 1219|    107|        locendian = DW_END_big;
  ------------------
  |  | 1114|    107|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
 1220|    107|        locoffsetsize = 64;
 1221|    205|    } else if (duhd.au_magic == FAT_CIGAM_64) {
  ------------------
  |  |   87|    205|#define FAT_CIGAM_64    0xbfbafeca
  ------------------
  |  Branch (1221:16): [True: 205, False: 0]
  ------------------
 1222|    205|        locendian = DW_END_little;
  ------------------
  |  | 1115|    205|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1223|    205|        locoffsetsize = 64;
 1224|    205|    } else {
 1225|      0|        *errcode = DW_DLE_FILE_WRONG_TYPE;
  ------------------
  |  | 1458|      0|#define DW_DLE_FILE_WRONG_TYPE                 412
  ------------------
 1226|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1227|      0|    }
 1228|       |#ifdef WORDS_BIGENDIAN
 1229|       |    if (locendian == DW_END_little) {
 1230|       |        word_swap = _dwarf_memcpy_swap_bytes;
 1231|       |    } else {
 1232|       |        word_swap = _dwarf_memcpy_noswap_bytes;
 1233|       |    }
 1234|       |#else  /* LITTLE ENDIAN */
 1235|    563|    if (locendian == DW_END_little) {
  ------------------
  |  | 1115|    563|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  |  Branch (1235:9): [True: 363, False: 200]
  ------------------
 1236|    363|        word_swap = _dwarf_memcpy_noswap_bytes;
 1237|    363|    } else {
 1238|    200|        word_swap = _dwarf_memcpy_swap_bytes;
 1239|    200|    }
 1240|    563|#endif /* LITTLE- BIG-ENDIAN */
 1241|    563|    ASNAR(word_swap,duhd.au_count,fh.nfat_arch);
  ------------------
  |  |   53|    563|    do {                                        \
  |  |   54|    563|        (t) = 0;                                \
  |  |   55|    563|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    563|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 563]
  |  |  ------------------
  ------------------
 1242|       |    /*  The limit is a first-cut safe heuristic. */
 1243|    563|    if (duhd.au_count >= (dw_filesize/2) ) {
  ------------------
  |  Branch (1243:9): [True: 47, False: 516]
  ------------------
 1244|     47|        *errcode = DW_DLE_UNIVERSAL_BINARY_ERROR ;
  ------------------
  |  | 1548|     47|#define DW_DLE_UNIVERSAL_BINARY_ERROR          502
  ------------------
 1245|     47|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     47|#define DW_DLV_ERROR      1
  ------------------
 1246|     47|    }
 1247|    516|    duhd.au_arches = (struct  Dwarf_Universal_Arch_s*)
 1248|    516|        calloc(duhd.au_count, sizeof(struct Dwarf_Universal_Arch_s));
 1249|    516|    if (!duhd.au_arches) {
  ------------------
  |  Branch (1249:9): [True: 0, False: 516]
  ------------------
 1250|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1251|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1252|      0|    }
 1253|    516|    if (locoffsetsize == 32) {
  ------------------
  |  Branch (1253:9): [True: 225, False: 291]
  ------------------
 1254|    225|        struct fat_arch * fa = 0;
 1255|       |
 1256|    225|        fa = (struct fat_arch *)calloc(duhd.au_count,
 1257|    225|            sizeof(struct fat_arch));
 1258|    225|        if (!fa) {
  ------------------
  |  Branch (1258:13): [True: 0, False: 225]
  ------------------
 1259|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1260|      0|            free(duhd.au_arches);
 1261|      0|            duhd.au_arches = 0;
 1262|      0|            free(fa);
 1263|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1264|      0|        }
 1265|    225|        if (sizeof(fh)+duhd.au_count*sizeof(*fa) >= dw_filesize) {
  ------------------
  |  Branch (1265:13): [True: 35, False: 190]
  ------------------
 1266|     35|            free(duhd.au_arches);
 1267|     35|            duhd.au_arches = 0;
 1268|     35|            free(fa);
 1269|     35|            *errcode = DW_DLE_FILE_OFFSET_BAD;
  ------------------
  |  | 1463|     35|#define DW_DLE_FILE_OFFSET_BAD                 417
  ------------------
 1270|     35|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     35|#define DW_DLV_ERROR      1
  ------------------
 1271|     35|        }
 1272|    190|        res = RRMOA(fd,fa,/*offset=*/sizeof(fh),
  ------------------
  |  |   65|    190|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    190|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1273|    190|            duhd.au_count*sizeof(*fa),
 1274|    190|            dw_filesize,errcode);
 1275|    190|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    190|#define DW_DLV_OK         0
  ------------------
  |  Branch (1275:13): [True: 0, False: 190]
  ------------------
 1276|      0|            free(duhd.au_arches);
 1277|      0|            duhd.au_arches = 0;
 1278|      0|            free(fa);
 1279|      0|            return res;
 1280|      0|        }
 1281|    190|        res = fill_in_uni_arch_32(fa,&duhd,word_swap,
 1282|    190|            errcode);
 1283|    190|        free(fa);
 1284|    190|        fa = 0;
 1285|    190|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    190|#define DW_DLV_OK         0
  ------------------
  |  Branch (1285:13): [True: 147, False: 43]
  ------------------
 1286|    147|            free(duhd.au_arches);
 1287|    147|            duhd.au_arches = 0;
 1288|    147|            return res;
 1289|    147|        }
 1290|    291|    } else { /* 64 */
 1291|    291|        struct fat_arch_64 * fa = 0;
 1292|    291|        fa = (struct fat_arch_64 *)calloc(duhd.au_count,
 1293|    291|            sizeof(struct fat_arch_64));
 1294|    291|        if (!fa) {
  ------------------
  |  Branch (1294:13): [True: 0, False: 291]
  ------------------
 1295|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1296|      0|            free(duhd.au_arches);
 1297|      0|            duhd.au_arches = 0;
 1298|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1299|      0|        }
 1300|    291|        if (sizeof(fh)+duhd.au_count*sizeof(*fa) >= dw_filesize) {
  ------------------
  |  Branch (1300:13): [True: 34, False: 257]
  ------------------
 1301|     34|            free(duhd.au_arches);
 1302|     34|            duhd.au_arches = 0;
 1303|     34|            free(fa);
 1304|     34|            *errcode = DW_DLE_FILE_OFFSET_BAD ;
  ------------------
  |  | 1463|     34|#define DW_DLE_FILE_OFFSET_BAD                 417
  ------------------
 1305|     34|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     34|#define DW_DLV_ERROR      1
  ------------------
 1306|     34|        }
 1307|    257|        res = RRMOA(fd,fa,/*offset*/sizeof(fh),
  ------------------
  |  |   65|    257|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    257|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1308|    257|            duhd.au_count*sizeof(fa),
 1309|    257|            dw_filesize,errcode);
 1310|    257|        if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|    257|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1310:13): [True: 0, False: 257]
  ------------------
 1311|      0|            free(duhd.au_arches);
 1312|      0|            duhd.au_arches = 0;
 1313|      0|            free(fa);
 1314|      0|            return res;
 1315|      0|        }
 1316|    257|        res = _dwarf_fill_in_uni_arch_64(fa,&duhd,word_swap,
 1317|    257|            errcode);
 1318|    257|        free(fa);
 1319|    257|        fa = 0;
 1320|    257|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    257|#define DW_DLV_OK         0
  ------------------
  |  Branch (1320:13): [True: 212, False: 45]
  ------------------
 1321|    212|            free(duhd.au_arches);
 1322|    212|            duhd.au_arches = 0;
 1323|    212|            return res;
 1324|    212|        }
 1325|    257|    }
 1326|       |
 1327|     88|    duhdp = malloc(sizeof(*duhdp));
 1328|     88|    if (!duhdp) {
  ------------------
  |  Branch (1328:9): [True: 0, False: 88]
  ------------------
 1329|      0|        free(duhd.au_arches);
 1330|      0|        duhd.au_arches = 0;
 1331|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1332|      0|        return res;
 1333|      0|    }
 1334|     88|    memcpy(duhdp,&duhd,sizeof(duhd));
 1335|     88|    *dw_contentcount = (unsigned int)duhd.au_count;
 1336|     88|    duhdp->au_arches = duhd.au_arches;
 1337|     88|    *dw_head = duhdp;
 1338|     88|    return DW_DLV_OK;
  ------------------
  |  |   59|     88|#define DW_DLV_OK         0
  ------------------
 1339|     88|}
dwarf_machoread.c:magic_copy:
 1126|    563|{
 1127|    563|    unsigned i = 0;
 1128|    563|    unsigned long v = 0;
 1129|       |
 1130|    563|    v = d[0];
 1131|  2.25k|    for (i = 1 ; i < len; ++i) {
  ------------------
  |  Branch (1131:18): [True: 1.68k, False: 563]
  ------------------
 1132|  1.68k|        v <<= 8;
 1133|  1.68k|        v |=  d[i];
 1134|  1.68k|    }
 1135|    563|    return v;
 1136|    563|}
dwarf_machoread.c:fill_in_uni_arch_32:
 1147|    190|{
 1148|    190|    Dwarf_Unsigned i = 0;
 1149|    190|    struct Dwarf_Universal_Arch_s * dua = 0;
 1150|       |
 1151|    190|    dua = duhd->au_arches;
 1152|  2.06k|    for ( ; i < duhd->au_count; ++i,++fa,++dua) {
  ------------------
  |  Branch (1152:13): [True: 2.02k, False: 43]
  ------------------
 1153|  2.02k|        ASNAR(word_swap,dua->au_cputype,fa->cputype);
  ------------------
  |  |   53|  2.02k|    do {                                        \
  |  |   54|  2.02k|        (t) = 0;                                \
  |  |   55|  2.02k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.02k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.02k]
  |  |  ------------------
  ------------------
 1154|  2.02k|        ASNAR(word_swap,dua->au_cpusubtype,fa->cpusubtype);
  ------------------
  |  |   53|  2.02k|    do {                                        \
  |  |   54|  2.02k|        (t) = 0;                                \
  |  |   55|  2.02k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.02k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.02k]
  |  |  ------------------
  ------------------
 1155|  2.02k|        ASNAR(word_swap,dua->au_offset,fa->offset);
  ------------------
  |  |   53|  2.02k|    do {                                        \
  |  |   54|  2.02k|        (t) = 0;                                \
  |  |   55|  2.02k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.02k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.02k]
  |  |  ------------------
  ------------------
 1156|  2.02k|        if (dua->au_offset >= duhd->au_filesize) {
  ------------------
  |  Branch (1156:13): [True: 58, False: 1.96k]
  ------------------
 1157|     58|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|     58|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
 1158|     58|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     58|#define DW_DLV_ERROR      1
  ------------------
 1159|     58|        }
 1160|  1.96k|        ASNAR(word_swap,dua->au_size,fa->size);
  ------------------
  |  |   53|  1.96k|    do {                                        \
  |  |   54|  1.96k|        (t) = 0;                                \
  |  |   55|  1.96k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.96k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.96k]
  |  |  ------------------
  ------------------
 1161|  1.96k|        if (dua->au_size >= duhd->au_filesize) {
  ------------------
  |  Branch (1161:13): [True: 51, False: 1.91k]
  ------------------
 1162|     51|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|     51|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
 1163|     51|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     51|#define DW_DLV_ERROR      1
  ------------------
 1164|     51|        }
 1165|  1.91k|        if ((dua->au_size+dua->au_offset) > duhd->au_filesize) {
  ------------------
  |  Branch (1165:13): [True: 7, False: 1.90k]
  ------------------
 1166|      7|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|      7|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
 1167|      7|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      7|#define DW_DLV_ERROR      1
  ------------------
 1168|      7|        }
 1169|       |
 1170|  1.90k|        ASNAR(word_swap,dua->au_align,fa->align);
  ------------------
  |  |   53|  1.90k|    do {                                        \
  |  |   54|  1.90k|        (t) = 0;                                \
  |  |   55|  1.90k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  1.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 1.90k]
  |  |  ------------------
  ------------------
 1171|  1.90k|        if (dua->au_align >= 32) {
  ------------------
  |  Branch (1171:13): [True: 31, False: 1.87k]
  ------------------
 1172|     31|            *errcode = DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR;
  ------------------
  |  | 1549|     31|#define DW_DLE_UNIV_BIN_OFFSET_SIZE_ERROR      503
  ------------------
 1173|     31|            return DW_DLV_ERROR;
  ------------------
  |  |   60|     31|#define DW_DLV_ERROR      1
  ------------------
 1174|     31|        }
 1175|  1.87k|        dua->au_reserved = 0;
 1176|  1.87k|    }
 1177|     43|    return DW_DLV_OK;
  ------------------
  |  |   59|     43|#define DW_DLV_OK         0
  ------------------
 1178|    190|}
dwarf_machoread.c:macho_get_section_info:
  227|  40.8k|{
  228|  40.8k|    dwarf_macho_object_access_internals_t *macho =
  229|  40.8k|        (dwarf_macho_object_access_internals_t*)(obj);
  230|       |
  231|  40.8k|    (void)error;
  232|  40.8k|    if (section_index < macho->mo_dwarf_sectioncount) {
  ------------------
  |  Branch (232:9): [True: 40.8k, False: 0]
  ------------------
  233|  40.8k|        struct generic_macho_section *sp = 0;
  234|       |
  235|  40.8k|        sp = macho->mo_dwarf_sections + section_index;
  236|  40.8k|        return_section->as_name   = sp->dwarfsectname;
  237|  40.8k|        return_section->as_type   = 0;
  238|  40.8k|        return_section->as_flags  = sp->flags;
  239|  40.8k|        return_section->as_addr   = sp->addr;
  240|  40.8k|        return_section->as_offset = sp->offset;
  241|  40.8k|        return_section->as_size   = sp->size;
  242|  40.8k|        return_section->as_link   = 0;
  243|  40.8k|        return_section->as_info   = 0;
  244|  40.8k|        return_section->as_addralign = 0;
  245|  40.8k|        return_section->as_entrysize = 0;
  246|  40.8k|        return DW_DLV_OK;
  ------------------
  |  |   59|  40.8k|#define DW_DLV_OK         0
  ------------------
  247|  40.8k|    }
  248|      0|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  249|  40.8k|}
dwarf_machoread.c:macho_get_byte_order:
  190|    540|{
  191|    540|    dwarf_macho_object_access_internals_t *macho =
  192|    540|        (dwarf_macho_object_access_internals_t*)(obj);
  193|    540|    return macho->mo_endian;
  194|    540|}
dwarf_machoread.c:macho_get_length_size:
  197|    540|{
  198|    540|    dwarf_macho_object_access_internals_t *macho =
  199|    540|        (dwarf_macho_object_access_internals_t*)(obj);
  200|    540|    return macho->mo_offsetsize/8;
  201|    540|}
dwarf_machoread.c:macho_get_pointer_size:
  204|    540|{
  205|    540|    dwarf_macho_object_access_internals_t *macho =
  206|    540|        (dwarf_macho_object_access_internals_t*)(obj);
  207|    540|    return macho->mo_pointersize/8;
  208|    540|}
dwarf_machoread.c:macho_get_file_size:
  210|    540|{
  211|    540|    dwarf_macho_object_access_internals_t *macho =
  212|    540|        (dwarf_macho_object_access_internals_t*)(obj);
  213|    540|    return macho->mo_filesize;
  214|    540|}
dwarf_machoread.c:macho_get_section_count:
  217|    540|{
  218|    540|    dwarf_macho_object_access_internals_t *macho =
  219|    540|        (dwarf_macho_object_access_internals_t*)(obj);
  220|    540|    return macho->mo_dwarf_sectioncount;
  221|    540|}
dwarf_machoread.c:macho_load_section:
  254|    152|{
  255|    152|    dwarf_macho_object_access_internals_t *macho =
  256|    152|        (dwarf_macho_object_access_internals_t*)(obj);
  257|       |
  258|    152|    if (0 < section_index &&
  ------------------
  |  Branch (258:9): [True: 152, False: 0]
  ------------------
  259|    152|        section_index < macho->mo_dwarf_sectioncount) {
  ------------------
  |  Branch (259:9): [True: 152, False: 0]
  ------------------
  260|    152|        int res = 0;
  261|    152|        Dwarf_Unsigned inner = macho->mo_inner_offset;
  262|       |
  263|    152|        struct generic_macho_section *sp =
  264|    152|            macho->mo_dwarf_sections + section_index;
  265|    152|        if (sp->loaded_data) {
  ------------------
  |  Branch (265:13): [True: 0, False: 152]
  ------------------
  266|      0|            *return_data = sp->loaded_data;
  267|      0|            return DW_DLV_OK;
  ------------------
  |  |   59|      0|#define DW_DLV_OK         0
  ------------------
  268|      0|        }
  269|    152|        if (!sp->size) {
  ------------------
  |  Branch (269:13): [True: 0, False: 152]
  ------------------
  270|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  271|      0|        }
  272|    152|        if ((sp->size + sp->offset) >
  ------------------
  |  Branch (272:13): [True: 139, False: 13]
  ------------------
  273|    152|            macho->mo_filesize) {
  274|    139|            *error = DW_DLE_FILE_TOO_SMALL;
  ------------------
  |  | 1469|    139|#define DW_DLE_FILE_TOO_SMALL                  423
  ------------------
  275|    139|            return DW_DLV_ERROR;
  ------------------
  |  |   60|    139|#define DW_DLV_ERROR      1
  ------------------
  276|    139|        }
  277|       |
  278|     13|        sp->loaded_data = malloc((size_t)sp->size);
  279|     13|        if (!sp->loaded_data) {
  ------------------
  |  Branch (279:13): [True: 4, False: 9]
  ------------------
  280|      4|            *error = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      4|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  281|      4|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
  282|      4|        }
  283|      9|        res = RRMOA(macho->mo_fd,
  ------------------
  |  |   65|      9|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|      9|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  284|      9|            sp->loaded_data, (inner+sp->offset),
  285|      9|            sp->size,
  286|      9|            (inner+macho->mo_filesize), error);
  287|      9|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|      9|#define DW_DLV_OK         0
  ------------------
  |  Branch (287:13): [True: 0, False: 9]
  ------------------
  288|      0|            free(sp->loaded_data);
  289|      0|            sp->loaded_data = 0;
  290|      0|            return res;
  291|      0|        }
  292|      9|        *return_data = sp->loaded_data;
  293|      9|        return DW_DLV_OK;
  ------------------
  |  |   59|      9|#define DW_DLV_OK         0
  ------------------
  294|      9|    }
  295|      0|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  296|    152|}

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

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

_dwarf_object_read_random:
   56|  1.01M|{
   57|  1.01M|    Dwarf_Unsigned endpoint = 0;
   58|  1.01M|    int res = 0;
   59|       |
   60|  1.01M|    if (loc >= filesize) {
  ------------------
  |  Branch (60:9): [True: 113, False: 1.01M]
  ------------------
   61|       |        /*  Seek can seek off the end. Lets not allow that.
   62|       |            The object is corrupt. */
   63|    113|        *errc = DW_DLE_SEEK_OFF_END;
  ------------------
  |  | 1490|    113|#define DW_DLE_SEEK_OFF_END                    444
  ------------------
   64|    113|        return DW_DLV_ERROR;
  ------------------
  |  |  123|    113|#define DW_DLV_ERROR     1
  ------------------
   65|    113|    }
   66|  1.01M|    endpoint = loc+size;
   67|  1.01M|    if (endpoint < loc) {
  ------------------
  |  Branch (67:9): [True: 0, False: 1.01M]
  ------------------
   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.01M|    if (endpoint > filesize) {
  ------------------
  |  Branch (72:9): [True: 84, False: 1.01M]
  ------------------
   73|       |        /*  Let us -not- try to read past end of object.
   74|       |            The object is corrupt. */
   75|     84|        *errc = DW_DLE_READ_OFF_END;
  ------------------
  |  | 1491|     84|#define DW_DLE_READ_OFF_END                    445
  ------------------
   76|     84|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     84|#define DW_DLV_ERROR     1
  ------------------
   77|     84|    }
   78|  1.01M|    res = _dwarf_seekr(fd,loc,SEEK_SET,0);
   79|  1.01M|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|  1.01M|#define DW_DLV_OK        0
  ------------------
  |  Branch (79:9): [True: 0, False: 1.01M]
  ------------------
   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.01M|    res = _dwarf_readr(fd,out_buf,size,0);
   84|  1.01M|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|  1.01M|#define DW_DLV_OK        0
  ------------------
  |  Branch (84:9): [True: 0, False: 1.01M]
  ------------------
   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.01M|    return DW_DLV_OK;
  ------------------
  |  |  122|  1.01M|#define DW_DLV_OK        0
  ------------------
   89|  1.01M|}

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

_dwarf_dealloc_rnglists_context:
  720|  3.18k|{
  721|  3.18k|    Dwarf_Unsigned i = 0;
  722|  3.18k|    Dwarf_Rnglists_Context * rngcon = 0;
  723|       |
  724|  3.18k|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|  3.18k|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|  3.18k|#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.18k|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 0, False: 3.18k]
  |  |  |  Branch (159:7): [True: 0, False: 3.18k]
  |  |  |  Branch (159:15): [True: 0, False: 3.18k]
  |  |  ------------------
  ------------------
  725|      0|        return;
  726|      0|    }
  727|  3.18k|    if (!dbg->de_rnglists_context) {
  ------------------
  |  Branch (727:9): [True: 3.18k, False: 0]
  ------------------
  728|  3.18k|        return;
  729|  3.18k|    }
  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|  34.6k|{
  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|  34.6k|    Dwarf_Unsigned computed = x * y;
  138|  34.6k|    Dwarf_Unsigned bigger = 0;
  139|       |
  140|  34.6k|    *result = computed;
  141|  34.6k|    if (!x || !y) {
  ------------------
  |  Branch (141:9): [True: 0, False: 34.6k]
  |  Branch (141:15): [True: 0, False: 34.6k]
  ------------------
  142|      0|        return DW_DLV_OK;
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
  143|      0|    }
  144|  34.6k|    bigger = (x > y)?x:y;
  ------------------
  |  Branch (144:14): [True: 24.9k, False: 9.76k]
  ------------------
  145|  34.6k|    if (computed < bigger)  {
  ------------------
  |  Branch (145:9): [True: 0, False: 34.6k]
  ------------------
  146|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  147|      0|    }
  148|  34.6k|    return DW_DLV_OK;
  ------------------
  |  |  122|  34.6k|#define DW_DLV_OK        0
  ------------------
  149|  34.6k|}
_dwarf_uint64_add:
  158|  46.5k|{
  159|  46.5k|    Dwarf_Unsigned computed = dw_lhs + dw_rhs;
  160|  46.5k|    Dwarf_Unsigned bigger = 0;
  161|       |
  162|  46.5k|    if (!dw_lhs || !dw_rhs) {
  ------------------
  |  Branch (162:9): [True: 20.5k, False: 25.9k]
  |  Branch (162:20): [True: 1.46k, False: 24.4k]
  ------------------
  163|  22.0k|        *result = computed;
  164|  22.0k|        return DW_DLV_OK;
  ------------------
  |  |  122|  22.0k|#define DW_DLV_OK        0
  ------------------
  165|  22.0k|    }
  166|  24.4k|    bigger = (dw_lhs > dw_rhs)?dw_lhs:dw_rhs;
  ------------------
  |  Branch (166:14): [True: 17.7k, False: 6.70k]
  ------------------
  167|  24.4k|    if (computed && computed < bigger)  {
  ------------------
  |  Branch (167:9): [True: 24.2k, False: 208]
  |  Branch (167:21): [True: 34, False: 24.2k]
  ------------------
  168|     34|        return DW_DLV_ERROR;
  ------------------
  |  |  123|     34|#define DW_DLV_ERROR     1
  ------------------
  169|     34|    }
  170|  24.4k|    *result = computed;
  171|  24.4k|    return DW_DLV_OK;
  ------------------
  |  |  122|  24.4k|#define DW_DLV_OK        0
  ------------------
  172|  24.4k|}

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

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

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

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

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

_dwarf_initialize_search_hash:
  183|  5.16k|{
  184|  5.16k|    unsigned long prime_to_use = primes[0];
  185|  5.16k|    unsigned entry_index = 0;
  186|  5.16k|    unsigned k = 0;
  187|  5.16k|    struct hs_base *base = 0;
  188|       |
  189|  5.16k|    base = *(struct hs_base **)treeptr;
  190|  5.16k|    if (base) {
  ------------------
  |  Branch (190:9): [True: 0, False: 5.16k]
  ------------------
  191|       |        /* initialized already. */
  192|      0|        return base ;
  193|      0|    }
  194|  5.16k|    base = calloc(1, sizeof(struct hs_base));
  195|  5.16k|    if (!base) {
  ------------------
  |  Branch (195:9): [True: 0, False: 5.16k]
  ------------------
  196|       |        /* Out of memory. */
  197|      0|        return NULL ;
  198|      0|    }
  199|  5.16k|    prime_to_use = primes[0];
  200|  5.90k|    while(size_estimate && (size_estimate > prime_to_use)) {
  ------------------
  |  Branch (200:11): [True: 5.85k, False: 49]
  |  Branch (200:28): [True: 740, False: 5.11k]
  ------------------
  201|    740|        k = k +1;
  202|    740|        prime_to_use = primes[k];
  203|    740|        if (prime_to_use == 0) {
  ------------------
  |  Branch (203:13): [True: 0, False: 740]
  ------------------
  204|       |            /* Oops. Too large. */
  205|      0|            free(base);
  206|      0|            return NULL;
  207|      0|        }
  208|    740|        entry_index = k;
  209|    740|    }
  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.16k|    base->tablesize_ = prime_to_use;
  217|  5.16k|    base->allowed_fill_ = calculate_allowed_fill(allowed_fill_percent,
  218|  5.16k|        prime_to_use);
  219|  5.16k|    if (base->allowed_fill_< (base->tablesize_/2)) {
  ------------------
  |  Branch (219:9): [True: 0, False: 5.16k]
  ------------------
  220|      0|        free(base);
  221|       |        /* Oops. We are in trouble. Coding mistake here.  */
  222|      0|        return NULL;
  223|      0|    }
  224|  5.16k|    base->record_count_ = 0;
  225|  5.16k|    base->tablesize_entry_index_ = entry_index;
  226|       |    /*  hashtab_ is an array of hs_entry,
  227|       |        indexes 0 through tablesize_ -1. */
  228|  5.16k|    base->hashfunc_ = hashfunc;
  229|  5.16k|    base->hashtab_ = calloc(base->tablesize_,
  230|  5.16k|        sizeof(struct ts_entry));
  231|  5.16k|    if (!base->hashtab_) {
  ------------------
  |  Branch (231:9): [True: 0, False: 5.16k]
  ------------------
  232|      0|        free(base);
  233|      0|        return NULL;
  234|      0|    }
  235|  5.16k|    *treeptr = base;
  236|  5.16k|    return base;
  237|  5.16k|}
_dwarf_tsearch:
  520|  83.4k|{
  521|  83.4k|    struct hs_base **rootp = (struct hs_base **)headin;
  522|  83.4k|    struct hs_base *head = *rootp;
  523|  83.4k|    struct ts_entry *r = 0;
  524|  83.4k|    int inserted = 0;
  525|       |    /* nullme won't be set. */
  526|  83.4k|    struct ts_entry *nullme = 0;
  527|       |
  528|  83.4k|    if (!head) {
  ------------------
  |  Branch (528:9): [True: 0, False: 83.4k]
  ------------------
  529|       |        /* something is wrong here, not initialized. */
  530|      0|        return NULL;
  531|      0|    }
  532|  83.4k|    r = _tsearch_inner(key,head,compar,want_insert,&inserted,&nullme);
  533|  83.4k|    if (!r) {
  ------------------
  |  Branch (533:9): [True: 0, False: 83.4k]
  ------------------
  534|      0|        return NULL;
  535|      0|    }
  536|  83.4k|    return (void *)&(r->keyptr);
  537|  83.4k|}
_dwarf_tfind:
  543|   244k|{
  544|       |    /*  Nothing will change, but we discard const
  545|       |        so we can use tsearch_inner(). */
  546|   244k|    struct hs_base **proot = (struct hs_base **)rootp;
  547|   244k|    struct hs_base *head = *proot;
  548|   244k|    struct ts_entry *r = 0;
  549|       |    /* inserted flag won't be set. */
  550|   244k|    int inserted = 0;
  551|       |    /* nullme won't be set. */
  552|   244k|    struct ts_entry * nullme = 0;
  553|       |    /* Get to actual tree. */
  554|       |
  555|   244k|    if (!head) {
  ------------------
  |  Branch (555:9): [True: 0, False: 244k]
  ------------------
  556|      0|        return NULL;
  557|      0|    }
  558|       |
  559|   244k|    r = _tsearch_inner(key,head,compar,only_find,&inserted,&nullme);
  560|   244k|    if (!r) {
  ------------------
  |  Branch (560:9): [True: 181k, False: 62.7k]
  ------------------
  561|   181k|        return NULL;
  562|   181k|    }
  563|  62.7k|    return (void *)(&(r->keyptr));
  564|   244k|}
_dwarf_tdelete:
  572|     50|{
  573|     50|    struct hs_base **proot = (struct hs_base **)rootp;
  574|     50|    struct hs_base *head = *proot;
  575|     50|    struct ts_entry *found = 0;
  576|       |    /* inserted flag won't be set. */
  577|     50|    int inserted = 0;
  578|     50|    struct ts_entry * parentp = 0;
  579|       |
  580|     50|    if (!head) {
  ------------------
  |  Branch (580:9): [True: 0, False: 50]
  ------------------
  581|      0|        return NULL;
  582|      0|    }
  583|       |
  584|     50|    found = _tsearch_inner(key,head,compar,want_delete,&inserted,
  585|     50|        &parentp);
  586|     50|    if (found) {
  ------------------
  |  Branch (586:9): [True: 50, False: 0]
  ------------------
  587|     50|        if (parentp) {
  ------------------
  |  Branch (587:13): [True: 0, False: 50]
  ------------------
  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|     50|        if (found->next) {
  ------------------
  |  Branch (598:13): [True: 0, False: 50]
  ------------------
  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|     50|        } 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|     50|            head->record_count_--;
  614|     50|            found->next = 0;
  615|     50|            found->keyptr = 0;
  616|     50|            found->entryused = 0;
  617|     50|            return NULL;
  618|     50|        }
  619|     50|    }
  620|      0|    return NULL;
  621|     50|}
_dwarf_twalk:
  648|    197|{
  649|    197|    const struct hs_base *head = (const struct hs_base *)rootp;
  650|    197|    struct ts_entry *root = 0;
  651|    197|    if (!head) {
  ------------------
  |  Branch (651:9): [True: 17, False: 180]
  ------------------
  652|     17|        return;
  653|     17|    }
  654|    180|    root = head->hashtab_;
  655|       |    /* Get to actual tree. */
  656|    180|    _dwarf_twalk_inner(head,root,action);
  657|    180|}
_dwarf_tdestroy:
  702|  6.37k|{
  703|  6.37k|    struct hs_base *head = (struct hs_base *)rootp;
  704|  6.37k|    struct ts_entry *root = 0;
  705|  6.37k|    if (!head) {
  ------------------
  |  Branch (705:9): [True: 1.20k, False: 5.16k]
  ------------------
  706|  1.20k|        return;
  707|  1.20k|    }
  708|  5.16k|    root = head->hashtab_;
  709|  5.16k|    _dwarf_tdestroy_inner(head,free_node);
  710|  5.16k|    free(root);
  711|  5.16k|    free(head);
  712|  5.16k|}
dwarf_tsearchhash.c:calculate_allowed_fill:
  159|  5.17k|{
  160|  5.17k|    unsigned long v = 0;
  161|  5.17k|    if (ct < 100000) {
  ------------------
  |  Branch (161:9): [True: 5.17k, False: 0]
  ------------------
  162|  5.17k|        unsigned long v2 = (ct *fill_percent)/100;
  163|  5.17k|        return v2;
  164|  5.17k|    }
  165|      0|    v = (ct /100)*fill_percent;
  166|      0|    return v;
  167|  5.17k|}
dwarf_tsearchhash.c:_tsearch_inner:
  447|   387k|{
  448|   387k|    struct ts_entry *s =0;
  449|   387k|    struct ts_entry *c =0;
  450|   387k|    struct ts_entry *q =0;
  451|   387k|    int kc = 0;
  452|   387k|    DW_TSHASHTYPE keyhash =  0;
  ------------------
  |  |   54|   387k|#define DW_TSHASHTYPE uintptr_t
  ------------------
  453|   387k|    DW_TSHASHTYPE hindx = 0;
  ------------------
  |  |   54|   387k|#define DW_TSHASHTYPE uintptr_t
  ------------------
  454|   387k|    struct ts_entry *chain_parent = 0;
  455|       |
  456|   387k|    if (! head->hashfunc_) {
  ------------------
  |  Branch (456:9): [True: 0, False: 387k]
  ------------------
  457|       |        /* Not fully initialized. */
  458|      0|        return NULL;
  459|      0|    }
  460|   387k|    keyhash =  head->hashfunc_(key);
  461|   387k|    if (intent == want_insert) {
  ------------------
  |  Branch (461:9): [True: 143k, False: 244k]
  ------------------
  462|   143k|        if (head->record_count_ > head->allowed_fill_) {
  ------------------
  |  Branch (462:13): [True: 11, False: 143k]
  ------------------
  463|     11|            resize_table(head,compar);
  464|     11|        }
  465|   143k|    }
  466|   387k|    hindx = keyhash%head->tablesize_;
  467|   387k|    s = &head->hashtab_[hindx];
  468|   387k|    if (!s->entryused) {
  ------------------
  |  Branch (468:9): [True: 325k, False: 62.8k]
  ------------------
  469|       |        /* Not found. */
  470|   325k|        if (intent != want_insert) {
  ------------------
  |  Branch (470:13): [True: 181k, False: 143k]
  ------------------
  471|   181k|            return NULL;
  472|   181k|        }
  473|       |        /*  Insert in the base hash table in an
  474|       |            empty slot. */
  475|   143k|        *inserted = 1;
  476|   143k|        head->record_count_++;
  477|   143k|        s->keyptr = (const void *)key;
  478|   143k|        s->entryused = 1;
  479|   143k|        s->next = 0;
  480|   143k|        return s;
  481|   325k|    }
  482|  62.8k|    kc = compar(key,s->keyptr);
  483|  62.8k|    if (kc == 0 ) {
  ------------------
  |  Branch (483:9): [True: 62.8k, False: 0]
  ------------------
  484|       |        /* found! */
  485|  62.8k|        if (intent == want_delete) {
  ------------------
  |  Branch (485:13): [True: 50, False: 62.7k]
  ------------------
  486|     50|            *owner_ptr = 0;
  487|     50|        }
  488|  62.8k|        return (void *)&(s->keyptr);
  489|  62.8k|    }
  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|     11|{
  351|     11|    struct hs_base newhead;
  352|     11|    unsigned new_entry_index = 0;
  353|     11|    unsigned long prime_to_use = 0;
  354|       |
  355|       |    /* Copy the values we have. */
  356|     11|    newhead = *head;
  357|       |    /* But drop the hashtab_ from new. calloc below. */
  358|     11|    newhead.hashtab_ = 0;
  359|     11|    newhead.record_count_ = 0;
  360|     11|    new_entry_index = head->tablesize_entry_index_ +1;
  361|     11|    prime_to_use = primes[new_entry_index];
  362|     11|    if (!prime_to_use) {
  ------------------
  |  Branch (362:9): [True: 0, False: 11]
  ------------------
  363|       |        /*  Oops, too large. Leave table size as is, though
  364|       |            it will get slow as it overfills. */
  365|      0|        return;
  366|      0|    }
  367|     11|    newhead.tablesize_ = prime_to_use;
  368|     11|    newhead.allowed_fill_ = calculate_allowed_fill(
  369|     11|        allowed_fill_percent, prime_to_use);
  370|     11|    if (newhead.allowed_fill_< (newhead.tablesize_/2)) {
  ------------------
  |  Branch (370:9): [True: 0, False: 11]
  ------------------
  371|       |        /* Oops. We are in trouble.  */
  372|      0|        return;
  373|      0|    }
  374|     11|    newhead.tablesize_entry_index_ = new_entry_index;
  375|     11|    newhead.hashtab_ = calloc(newhead.tablesize_,
  376|     11|        sizeof(struct ts_entry));
  377|     11|    if (!newhead.hashtab_) {
  ------------------
  |  Branch (377:9): [True: 0, False: 11]
  ------------------
  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|     11|    {
  384|       |        /*  Insert all the records from the old table into
  385|       |            the new table. */
  386|     11|        int fillnewfail = 0;
  387|     11|        unsigned long ix = 0;
  388|     11|        unsigned long tsize = head->tablesize_;
  389|     11|        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|  66.8k|        for ( ; ix < tsize; ix++,p++) {
  ------------------
  |  Branch (393:17): [True: 66.7k, False: 11]
  ------------------
  394|  66.7k|            int inserted = 0;
  395|  66.7k|            struct ts_entry*n = 0;
  396|  66.7k|            if (fillnewfail) {
  ------------------
  |  Branch (396:17): [True: 0, False: 66.7k]
  ------------------
  397|      0|                break;
  398|      0|            }
  399|  66.7k|            if (p->keyptr) {
  ------------------
  |  Branch (399:17): [True: 60.1k, False: 6.67k]
  ------------------
  400|  60.1k|                _tsearch_inner(p->keyptr,
  401|  60.1k|                    &newhead,compar,
  402|  60.1k|                    want_insert,
  403|  60.1k|                    &inserted,
  404|  60.1k|                    0);
  405|  60.1k|                if (!inserted) {
  ------------------
  |  Branch (405:21): [True: 0, False: 60.1k]
  ------------------
  406|      0|                    fillnewfail = 1;
  407|      0|                    break;
  408|      0|                }
  409|  60.1k|            }
  410|  66.7k|            for (n = p->next; n ; n = n->next) {
  ------------------
  |  Branch (410:31): [True: 0, False: 66.7k]
  ------------------
  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|  66.7k|        }
  423|     11|        if (fillnewfail) {
  ------------------
  |  Branch (423:13): [True: 0, False: 11]
  ------------------
  424|      0|            free(newhead.hashtab_);
  425|      0|            return;
  426|      0|        }
  427|     11|    }
  428|       |    /* Now get rid of the chain entries of the old table. */
  429|     11|    _dwarf_tdestroy_inner(head,0);
  430|       |    /* Now get rid of the old table itself. */
  431|     11|    free(head->hashtab_);
  432|     11|    head->hashtab_ = 0;
  433|     11|    *head = newhead;
  434|     11|    return;
  435|     11|}
dwarf_tsearchhash.c:_dwarf_twalk_inner:
  629|    180|{
  630|    180|    unsigned long ix = 0;
  631|    180|    int depth = 0;
  632|    180|    unsigned long tsize = h->tablesize_;
  633|  93.9k|    for ( ; ix < tsize; ix++,p++) {
  ------------------
  |  Branch (633:13): [True: 93.7k, False: 180]
  ------------------
  634|  93.7k|        struct ts_entry*n = 0;
  635|  93.7k|        if (p->keyptr) {
  ------------------
  |  Branch (635:13): [True: 254, False: 93.5k]
  ------------------
  636|    254|            action((void *)(&(p->keyptr)),dwarf_leaf,depth);
  637|    254|        }
  638|  93.7k|        for (n = p->next; n ; n = n->next) {
  ------------------
  |  Branch (638:27): [True: 0, False: 93.7k]
  ------------------
  639|      0|            action((void *)(&(n->keyptr)),dwarf_leaf,depth);
  640|      0|        }
  641|  93.7k|    }
  642|    180|}
dwarf_tsearchhash.c:_dwarf_tdestroy_inner:
  662|  5.17k|{
  663|  5.17k|    unsigned long ix = 0;
  664|  5.17k|    unsigned long tsize = h->tablesize_;
  665|  5.17k|    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|  5.84M|    for ( ; ix < tsize; ix++,p++) {
  ------------------
  |  Branch (671:13): [True: 5.83M, False: 5.17k]
  ------------------
  672|  5.83M|        struct ts_entry*n = 0;
  673|  5.83M|        struct ts_entry*prev = 0;
  674|  5.83M|        if (p->keyptr && p->entryused) {
  ------------------
  |  Branch (674:13): [True: 143k, False: 5.69M]
  |  Branch (674:26): [True: 143k, False: 0]
  ------------------
  675|   143k|            if (free_node) {
  ------------------
  |  Branch (675:17): [True: 83.3k, False: 60.1k]
  ------------------
  676|  83.3k|                free_node((void *)(p->keyptr));
  677|  83.3k|            }
  678|   143k|            --h->record_count_;
  679|   143k|        }
  680|       |        /* Now walk and free up the chain entries. */
  681|  5.83M|        for (n = p->next; n ; ) {
  ------------------
  |  Branch (681:27): [True: 0, False: 5.83M]
  ------------------
  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|  5.83M|    }
  691|  5.17k|}

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

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

