LLVMFuzzerTestOneInput:
   41|    225|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   42|    225|  char filename[256];
   43|       |#ifdef DWREGRESSIONTEMP
   44|       |  /* Under msys2, the /tmp/ results in an open fail */
   45|       |  sprintf(filename, "junklibfuzzer.%d", getpid());
   46|       |#else
   47|    225|  sprintf(filename, "/tmp/libfuzzer.%d", getpid());
   48|    225|#endif
   49|    225|  FILE *fp = fopen(filename, "wb");
   50|    225|  if (!fp) {
  ------------------
  |  Branch (50:7): [True: 0, False: 225]
  ------------------
   51|      0|    printf("FAIL libfuzzer cannot open temp as writeable %s\n",
   52|      0|        filename);
   53|      0|    return 0;
   54|      0|  }
   55|    225|  fwrite(data, size, 1, fp);
   56|    225|  fclose(fp);
   57|       |
   58|    225|  Dwarf_Debug dbg = 0;
   59|    225|  int res = DW_DLV_ERROR;
  ------------------
  |  |  123|    225|#define DW_DLV_ERROR     1
  ------------------
   60|    225|  Dwarf_Error error = 0;
   61|    225|  Dwarf_Handler errhand = 0;
   62|    225|  Dwarf_Ptr errarg = 0;
   63|    225|  int regtabrulecount = 0;
   64|    225|  int curopt = 0;
   65|       |
   66|    225|  int fd = open(filename, O_RDONLY | O_BINARY);
  ------------------
  |  |   21|    225|#define O_BINARY 0 /* So it does nothing in Linux/Unix */
  ------------------
   67|    225|  if (fd < 0) {
  ------------------
  |  Branch (67:7): [True: 0, False: 225]
  ------------------
   68|      0|    exit(EXIT_FAILURE);
   69|      0|  }
   70|       |
   71|    225|  res = dwarf_init_b(fd, DW_GROUPNUMBER_ANY, errhand, errarg, &dbg, &error);
  ------------------
  |  |  126|    225|#define DW_GROUPNUMBER_ANY  0
  ------------------
   72|       |
   73|    225|  if (res != DW_DLV_OK) {
  ------------------
  |  |  122|    225|#define DW_DLV_OK        0
  ------------------
  |  Branch (73:7): [True: 202, False: 23]
  ------------------
   74|    202|    dwarf_dealloc_error(dbg, error);
   75|    202|  } else {
   76|       |
   77|     23|    Dwarf_Dnames_Head dnames_h = 0;
   78|     23|    Dwarf_Off dw_offset_of_next_table = 0;
   79|     23|    res = dwarf_dnames_header(dbg, 0, &dnames_h, &dw_offset_of_next_table,
   80|     23|                              &error);
   81|       |
   82|     23|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     23|#define DW_DLV_OK        0
  ------------------
  |  Branch (82:9): [True: 17, False: 6]
  ------------------
   83|     17|      dwarf_dealloc_dnames(dnames_h);
   84|     17|      dwarf_finish(dbg);
   85|     17|      close(fd);
   86|     17|      unlink(filename);
   87|     17|      return 0;
   88|     17|    }
   89|       |
   90|      6|    Dwarf_Unsigned dw_index = 1;
   91|      6|    Dwarf_Unsigned dw_abbrev_offset = 0;
   92|      6|    Dwarf_Unsigned dw_abbrev_code = 0;
   93|      6|    Dwarf_Unsigned dw_abbrev_tag = 0;
   94|      6|    Dwarf_Unsigned dw_array_size = 256;
   95|       |    /*  This test code originally passed in uninitialized
   96|       |        pointers dw_idxattr_array and dw_form_array, which
   97|       |        we cannot protect against. But we can check for NULL
   98|       |        so now the variables are initialilized.
   99|       |        In any case this code does not call the function correctly,
  100|       |        but we leave that as written. David Anderson 30 May 2023 */
  101|      6|    Dwarf_Half *dw_idxattr_array = 0;
  102|      6|    Dwarf_Half *dw_form_array = 0;
  103|      6|    Dwarf_Unsigned dw_idxattr_count = 0;
  104|       |
  105|      6|    res = dwarf_dnames_abbrevtable(
  106|      6|        dnames_h, dw_index, &dw_abbrev_offset, &dw_abbrev_code, &dw_abbrev_tag,
  107|      6|        dw_array_size, dw_idxattr_array, dw_form_array, &dw_idxattr_count);
  108|      6|    if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|      6|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (108:9): [True: 6, False: 0]
  ------------------
  109|      6|    }
  110|       |
  111|      6|    Dwarf_Unsigned dw_comp_unit_count = 0;
  112|      6|    Dwarf_Unsigned dw_local_type_unit_count = 0;
  113|      6|    Dwarf_Unsigned dw_foreign_type_unit_count = 0;
  114|      6|    Dwarf_Unsigned dw_bucket_count = 0;
  115|      6|    Dwarf_Unsigned dw_name_count = 0;
  116|      6|    Dwarf_Unsigned dw_abbrev_table_size = 0;
  117|      6|    Dwarf_Unsigned dw_entry_pool_size = 0;
  118|      6|    Dwarf_Unsigned dw_augmentation_string_size = 0;
  119|      6|    char *dw_augmentation_string = 0;
  120|      6|    Dwarf_Unsigned dw_section_size = 0;
  121|      6|    Dwarf_Half dw_table_version = 0;
  122|      6|    Dwarf_Half dw_offset_size = 0;
  123|      6|    res = dwarf_dnames_sizes(
  124|      6|        dnames_h, &dw_comp_unit_count, &dw_local_type_unit_count,
  125|      6|        &dw_foreign_type_unit_count, &dw_bucket_count, &dw_name_count,
  126|      6|        &dw_abbrev_table_size, &dw_entry_pool_size,
  127|      6|        &dw_augmentation_string_size, &dw_augmentation_string, &dw_section_size,
  128|      6|        &dw_table_version, &dw_offset_size, &error);
  129|      6|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
  |  Branch (129:9): [True: 0, False: 6]
  ------------------
  130|      0|      dwarf_dealloc_dnames(dnames_h);
  131|      0|      dwarf_finish(dbg);
  132|      0|      close(fd);
  133|      0|      unlink(filename);
  134|      0|      return 0;
  135|      0|    }
  136|       |
  137|      6|    Dwarf_Unsigned dw_header_offset = 0;
  138|      6|    Dwarf_Unsigned dw_cu_table_offset = 0;
  139|      6|    Dwarf_Unsigned dw_tu_local_offset = 0;
  140|      6|    Dwarf_Unsigned dw_foreign_tu_offset = 0;
  141|      6|    Dwarf_Unsigned dw_bucket_offset = 0;
  142|      6|    Dwarf_Unsigned dw_hashes_offset = 0;
  143|      6|    Dwarf_Unsigned dw_stringoffsets_offset = 0;
  144|      6|    Dwarf_Unsigned dw_entryoffsets_offset = 0;
  145|      6|    Dwarf_Unsigned dw_abbrev_table_offset = 0;
  146|      6|    Dwarf_Unsigned dw_entry_pool_offset = 0;
  147|      6|    res = dwarf_dnames_offsets(
  148|      6|        dnames_h, &dw_header_offset, &dw_cu_table_offset, &dw_tu_local_offset,
  149|      6|        &dw_foreign_tu_offset, &dw_bucket_offset, &dw_hashes_offset,
  150|      6|        &dw_stringoffsets_offset, &dw_entryoffsets_offset,
  151|      6|        &dw_abbrev_table_offset, &dw_entry_pool_offset, &error);
  152|      6|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
  |  Branch (152:9): [True: 0, False: 6]
  ------------------
  153|      0|      dwarf_dealloc_dnames(dnames_h);
  154|      0|      dwarf_finish(dbg);
  155|      0|      close(fd);
  156|      0|      unlink(filename);
  157|      0|      return 0;
  158|      0|    }
  159|       |
  160|      6|    Dwarf_Unsigned dw_offset = 0;
  161|      6|    Dwarf_Sig8 dw_sig;
  162|      6|    res = dwarf_dnames_cu_table(dnames_h, "cu", 0, &dw_offset, &dw_sig, &error);
  163|      6|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
  |  Branch (163:9): [True: 0, False: 6]
  ------------------
  164|      0|      dwarf_dealloc_dnames(dnames_h);
  165|      0|      dwarf_finish(dbg);
  166|      0|      close(fd);
  167|      0|      unlink(filename);
  168|      0|      return 0;
  169|      0|    }
  170|       |
  171|      6|    dw_index = 0;
  172|      6|    Dwarf_Unsigned dw_indexcount;
  173|      6|    res = dwarf_dnames_bucket(dnames_h, 0, &dw_index, &dw_indexcount, &error);
  174|      6|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
  |  Branch (174:9): [True: 0, False: 6]
  ------------------
  175|      0|      dwarf_dealloc_dnames(dnames_h);
  176|      0|      dwarf_finish(dbg);
  177|      0|      close(fd);
  178|      0|      unlink(filename);
  179|      0|      return 0;
  180|      0|    }
  181|       |
  182|      6|    Dwarf_Unsigned dw_bucket_number = 0;
  183|      6|    Dwarf_Unsigned dw_hash_value = 0;
  184|      6|    Dwarf_Unsigned dw_offset_to_debug_str = 0;
  185|      6|    char *dw_ptrtostr = 0;
  186|      6|    Dwarf_Unsigned dw_offset_in_entrypool = 0;
  187|      6|    Dwarf_Unsigned dw_abbrev_number = 0;
  188|      6|    Dwarf_Half abbrev_tg = 0;
  189|      6|    dw_array_size = 10;
  190|      6|    Dwarf_Half idxattr_array[10];
  191|      6|    Dwarf_Half form_array[10];
  192|      6|    res = dwarf_dnames_name(
  193|      6|        dnames_h, 1, &dw_bucket_number, &dw_hash_value, &dw_offset_to_debug_str,
  194|      6|        &dw_ptrtostr, &dw_offset_in_entrypool, &dw_abbrev_number, &abbrev_tg,
  195|      6|        dw_array_size, idxattr_array, form_array, &dw_idxattr_count, &error);
  196|      6|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
  |  Branch (196:9): [True: 6, False: 0]
  ------------------
  197|      6|      dwarf_dealloc_dnames(dnames_h);
  198|      6|      dwarf_finish(dbg);
  199|      6|      close(fd);
  200|      6|      unlink(filename);
  201|      6|      return 0;
  202|      6|    }
  203|       |
  204|      0|    dwarf_dealloc_dnames(dnames_h);
  205|      0|  }
  206|       |
  207|    202|  dwarf_finish(dbg);
  208|    202|  close(fd);
  209|    202|  unlink(filename);
  210|    202|  return 0;
  211|    225|}

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

_dwarf_error_destructor:
  142|    218|{
  143|    218|    Dwarf_Error er = (Dwarf_Error)m;
  144|    218|    dwarfstring *erm = (dwarfstring *)er->er_msg;
  145|    218|    if (! erm) {
  ------------------
  |  Branch (145:9): [True: 161, False: 57]
  ------------------
  146|    161|        return;
  147|    161|    }
  148|       |#if DEBUG_ALLOC
  149|       |    printf("libdwarfdetector DEALLOC Now destruct error "
  150|       |        "string %s\n",dwarfstring_string(erm));
  151|       |    fflush(stdout);
  152|       |#endif /* DEBUG_ALLOC */
  153|     57|    dwarfstring_destructor(erm);
  154|     57|    free(erm);
  155|     57|    er->er_msg = 0;
  156|     57|    return;
  157|    218|}
_dwarf_add_to_static_err_list:
  232|    166|{
  233|    166|    unsigned i = 0;
  234|    166|    if (!error) {
  ------------------
  |  Branch (234:9): [True: 0, False: 166]
  ------------------
  235|      0|        return;
  236|      0|    }
  237|       |#ifdef DEBUG_ALLOC
  238|       |    printf("\nlibdwarfdetector add to static err list "
  239|       |        " 0x%lx\n",(unsigned long)(uintptr_t)error);
  240|       |    fflush(stdout);
  241|       |#endif /* DEBUG_ALLOC */
  242|    166|    for ( ; i <static_used; ++i) {
  ------------------
  |  Branch (242:13): [True: 165, False: 1]
  ------------------
  243|    165|        Dwarf_Error e = staticerrlist[i];
  244|    165|        if (e) {
  ------------------
  |  Branch (244:13): [True: 0, False: 165]
  ------------------
  245|      0|            continue;
  246|      0|        }
  247|       |#ifdef DEBUG_ALLOC
  248|       |        printf("libdwarfdetector add to static err list at %u\n",
  249|       |            i);
  250|       |        fflush(stdout);
  251|       |#endif /* DEBUG_ALLOC */
  252|    165|        staticerrlist[i] = error;
  253|    165|        return;
  254|    165|    }
  255|      1|    if (static_used < STATIC_ALLOWED) {
  ------------------
  |  |  189|      1|#define STATIC_ALLOWED 10 /* arbitrary, must be > 2, see below*/
  ------------------
  |  Branch (255:9): [True: 1, False: 0]
  ------------------
  256|      1|        staticerrlist[static_used] = error;
  257|      1|        ++static_used;
  258|      1|    }
  259|      1|}
_dwarf_free_static_errlist:
  296|    289|{
  297|    289|    unsigned i = 0;
  298|       |
  299|    578|    for ( ; i <static_used; ++i) {
  ------------------
  |  Branch (299:13): [True: 289, False: 289]
  ------------------
  300|    289|        Dwarf_Error e = staticerrlist[i];
  301|    289|        if (e) {
  ------------------
  |  Branch (301:13): [True: 0, False: 289]
  ------------------
  302|      0|            dw_empty_errlist_item(e);
  303|      0|            staticerrlist[i] = 0;
  304|      0|        }
  305|    289|    }
  306|    289|}
_dwarf_get_alloc:
  630|     71|{
  631|     71|    char * alloc_mem = 0;
  632|     71|    Dwarf_Unsigned basesize = 0;
  633|     71|    Dwarf_Unsigned size = 0;
  634|     71|    unsigned int type = alloc_type;
  635|     71|    short action = 0;
  636|       |
  637|     71|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|     71|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|     71|#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|     71|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 0, False: 71]
  |  |  |  Branch (159:7): [True: 0, False: 71]
  |  |  |  Branch (159:15): [True: 0, False: 71]
  |  |  ------------------
  ------------------
  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|     71|    if (type >= ALLOC_AREA_INDEX_TABLE_MAX) {
  ------------------
  |  |   48|     71|#define ALLOC_AREA_INDEX_TABLE_MAX 66
  ------------------
  |  Branch (647:9): [True: 0, False: 71]
  ------------------
  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|     71|    basesize = alloc_instance_basics[alloc_type].ia_struct_size;
  659|     71|    action = alloc_instance_basics[alloc_type].ia_multiply_count;
  660|     71|    if (action == MULTIPLY_NO) {
  ------------------
  |  |   91|     71|#define MULTIPLY_NO 0
  ------------------
  |  Branch (660:9): [True: 71, False: 0]
  ------------------
  661|       |        /* Usually count is 1, but do not assume it. */
  662|     71|        size = basesize;
  663|     71|    } 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|     71|    size += DW_RESERVE;
  ------------------
  |  |  176|     71|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
  673|     71|    alloc_mem = malloc(size);
  674|     71|    if (!alloc_mem) {
  ------------------
  |  Branch (674:9): [True: 0, False: 71]
  ------------------
  675|      0|        return NULL;
  676|      0|    }
  677|     71|    {
  678|     71|        char * ret_mem = alloc_mem + DW_RESERVE;
  ------------------
  |  |  176|     71|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
  679|     71|        void *key = ret_mem;
  680|     71|        struct reserve_data_s *r = (struct reserve_data_s*)alloc_mem;
  681|     71|        void *result = 0;
  682|       |
  683|     71|        memset(alloc_mem, 0, size);
  684|       |        /* We are not actually using rd_dbg, we are using rd_type. */
  685|     71|        r->rd_dbg = dbg;
  686|     71|        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|     71|        r->rd_length = (unsigned short)size;
  690|     71|        if (alloc_instance_basics[type].specialconstructor) {
  ------------------
  |  Branch (690:13): [True: 0, False: 71]
  ------------------
  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|     71|        if (global_de_alloc_tree_on) {
  ------------------
  |  Branch (715:13): [True: 71, False: 0]
  ------------------
  716|     71|            result = dwarf_tsearch((void *)key,
  ------------------
  |  |   76|     71|#define dwarf_tsearch  _dwarf_tsearch
  ------------------
  717|     71|                &dbg->de_alloc_tree,simple_compare_function);
  718|     71|            if (!result) {
  ------------------
  |  Branch (718:17): [True: 0, False: 71]
  ------------------
  719|       |                /*  Something badly wrong. Out of memory.
  720|       |                    pretend all is well. */
  721|      0|            }
  722|     71|        }
  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|     71|        return (ret_mem);
  731|     71|    }
  732|     71|}
dwarf_set_load_preference:
  780|    115|{
  781|    115|    enum Dwarf_Sec_Alloc_Pref prev_load_pref =
  782|    115|        _dwarf_global_load_preference;
  783|    115|#ifdef HAVE_FULL_MMAP
  784|       |    /*  Only set the preference if MMAP is available. */
  785|    115|    switch(dw_load_preference) {
  786|      0|    case  Dwarf_Alloc_Malloc:
  ------------------
  |  Branch (786:5): [True: 0, False: 115]
  ------------------
  787|      0|    case  Dwarf_Alloc_Mmap:
  ------------------
  |  Branch (787:5): [True: 0, False: 115]
  ------------------
  788|      0|        _dwarf_global_load_preference = dw_load_preference;
  789|      0|        break;
  790|    115|    case  Dwarf_Alloc_None:
  ------------------
  |  Branch (790:5): [True: 115, False: 0]
  ------------------
  791|    115|        break; /* ignore */
  792|      0|    default: break;
  ------------------
  |  Branch (792:5): [True: 0, False: 115]
  ------------------
  793|    115|    }
  794|       |#else
  795|       |    (void)dw_load_preference;
  796|       |#endif
  797|    115|    return prev_load_pref;
  798|    115|}
_dwarf_determine_section_allocation_type:
  852|    254|{
  853|       |#ifndef HAVE_FULL_MMAP
  854|       |    return _dwarf_global_load_preference;
  855|       |#else
  856|    254|    char *whichalloc = getenv("DWARF_WHICH_ALLOC");
  857|       |
  858|    254|    if (whichalloc) {
  ------------------
  |  Branch (858:9): [True: 0, False: 254]
  ------------------
  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|    254|    return _dwarf_global_load_preference;
  869|    254|#endif /* HAVE_FULL_MMAP */
  870|    254|}
dwarf_dealloc_error:
  876|    236|{
  877|    236|    dwarf_dealloc(dbg,err,DW_DLA_ERROR);
  ------------------
  |  |  995|    236|#define DW_DLA_ERROR           0x0e  /* Dwarf_Error */
  ------------------
  878|    236|}
dwarf_dealloc:
  955|    255|{
  956|    255|    unsigned int type = 0;
  957|    255|    char * malloc_addr = 0;
  958|    255|    struct reserve_data_s * r = 0;
  959|       |
  960|    255|    if (!space) {
  ------------------
  |  Branch (960:9): [True: 36, False: 219]
  ------------------
  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|     36|        return;
  967|     36|    }
  968|    219|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|    219|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|     53|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   33|    166|#define TRUE 1
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   36|     53|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 166, False: 53]
  |  |  |  Branch (159:7): [True: 166, False: 53]
  |  |  |  Branch (159:15): [True: 0, False: 53]
  |  |  ------------------
  ------------------
  969|       |        /*  App error, or an app that failed in a
  970|       |            dwarf_init*() or dwarf_elf_init*() call.
  971|       |
  972|       |        */
  973|    166|        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|    166|        return;
  980|    166|    }
  981|     53|    if (space == (Dwarf_Ptr)&_dwarf_failsafe_error) {
  ------------------
  |  Branch (981:9): [True: 0, False: 53]
  ------------------
  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|     53|    if (dbg && alloc_type == DW_DLA_ERROR) {
  ------------------
  |  |  995|     53|#define DW_DLA_ERROR           0x0e  /* Dwarf_Error */
  ------------------
  |  Branch (991:9): [True: 53, False: 0]
  |  Branch (991:16): [True: 34, False: 19]
  ------------------
  992|     34|        dbg = dbg->de_errors_dbg;
  993|     34|    }
  994|     53|    if (dbg && dbg->de_alloc_tree) {
  ------------------
  |  Branch (994:9): [True: 53, False: 0]
  |  Branch (994:16): [True: 53, False: 0]
  ------------------
  995|       |        /*  If it's a string in debug_info etc doing
  996|       |            (char *)space - DW_RESERVE is totally bogus. */
  997|     53|        if (alloc_type == DW_DLA_STRING &&
  ------------------
  |  |  982|    106|#define DW_DLA_STRING          0x01  /* char* */
  ------------------
  |  Branch (997:13): [True: 0, False: 53]
  ------------------
  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|     53|    }
 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|     53|    if ((uintptr_t)space > DW_RESERVE) {
  ------------------
  |  |  176|     53|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
  |  Branch (1023:9): [True: 53, False: 0]
  ------------------
 1024|     53|        malloc_addr = (char *)space - DW_RESERVE;
  ------------------
  |  |  176|     53|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
 1025|     53|    } else {
 1026|       |        /* Impossible */
 1027|      0|        return;
 1028|      0|    }
 1029|     53|    r =(struct reserve_data_s *)malloc_addr;
 1030|     53|    if (dbg && dbg != r->rd_dbg) {
  ------------------
  |  Branch (1030:9): [True: 53, False: 0]
  |  Branch (1030:16): [True: 0, False: 53]
  ------------------
 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|     53|    if (dbg && alloc_type != r->rd_type) {
  ------------------
  |  Branch (1042:9): [True: 53, False: 0]
  |  Branch (1042:16): [True: 0, False: 53]
  ------------------
 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|     53|    if (alloc_type == DW_DLA_ERROR) {
  ------------------
  |  |  995|     53|#define DW_DLA_ERROR           0x0e  /* Dwarf_Error */
  ------------------
  |  Branch (1055:9): [True: 34, False: 19]
  ------------------
 1056|     34|        Dwarf_Error ep = (Dwarf_Error)space;
 1057|       |
 1058|     34|        if (ep->er_static_alloc == DE_STATIC) {
  ------------------
  |  |   46|     34|#define DE_STATIC 1   /* Using global static var */
  ------------------
  |  Branch (1058:13): [True: 0, False: 34]
  ------------------
 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|     34|        if (ep->er_static_alloc == DE_MALLOC) {
  ------------------
  |  |   47|     34|#define DE_MALLOC 2   /* Using malloc space */
  ------------------
  |  Branch (1076:13): [True: 0, False: 34]
  ------------------
 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|     34|    }
 1089|       |    /*  alloc types are a defined library-private
 1090|       |        set of integers. Less than 256 of them. */
 1091|     53|    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|     53|    if (type >= ALLOC_AREA_INDEX_TABLE_MAX) {
  ------------------
  |  |   48|     53|#define ALLOC_AREA_INDEX_TABLE_MAX 66
  ------------------
  |  Branch (1104:9): [True: 0, False: 53]
  ------------------
 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|     53|    if (alloc_instance_basics[type].specialdestructor) {
  ------------------
  |  Branch (1114:9): [True: 51, False: 2]
  ------------------
 1115|     51|        alloc_instance_basics[type].specialdestructor(space);
 1116|     51|    }
 1117|     53|    if (dbg && dbg->de_alloc_tree) {
  ------------------
  |  Branch (1117:9): [True: 53, False: 0]
  |  Branch (1117:16): [True: 53, 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|     53|        void *key = space;
 1123|       |
 1124|     53|        dwarf_tdelete(key,&dbg->de_alloc_tree,
  ------------------
  |  |   78|     53|#define dwarf_tdelete  _dwarf_tdelete
  ------------------
 1125|     53|            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|     53|    }
 1136|     53|    r->rd_dbg  = (void *)(uintptr_t)0xfeadbeef;
 1137|     53|    r->rd_length = 0;
 1138|     53|    r->rd_type = 0;
 1139|     53|    free(malloc_addr);
 1140|     53|    return;
 1141|     53|}
_dwarf_get_debug:
 1149|     87|{
 1150|     87|    Dwarf_Debug dbg;
 1151|       |
 1152|     87|    dbg = (Dwarf_Debug) malloc(sizeof(struct Dwarf_Debug_s));
 1153|     87|    if (!dbg) {
  ------------------
  |  Branch (1153:9): [True: 0, False: 87]
  ------------------
 1154|      0|        return NULL;
 1155|      0|    }
 1156|     87|    memset(dbg, 0, sizeof(struct Dwarf_Debug_s));
 1157|       |    /* Set up for a dwarf_tsearch hash table */
 1158|     87|    dbg->de_magic = DBG_IS_VALID;
  ------------------
  |  |  596|     87|#define DBG_IS_VALID 0xebfdebfd
  ------------------
 1159|       |
 1160|       |    /*  See also dwarf_tsearchhash.c the prime number
 1161|       |        table 'primes[]'. */
 1162|     87|#define INIT_HASH_INIT_LIMIT 2000000
 1163|     87|    if (global_de_alloc_tree_on) {
  ------------------
  |  Branch (1163:9): [True: 87, False: 0]
  ------------------
 1164|       |        /*  The type of the dwarf_initialize_search_hash
 1165|       |            initial-size argument */
 1166|     87|        unsigned long size_est = (unsigned long)(filesize/30);
 1167|       |
 1168|     87|        if (size_est > INIT_HASH_INIT_LIMIT) {
  ------------------
  |  | 1162|     87|#define INIT_HASH_INIT_LIMIT 2000000
  ------------------
  |  Branch (1168:13): [True: 0, False: 87]
  ------------------
 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|     87|        dwarf_initialize_search_hash(&dbg->de_alloc_tree,
  ------------------
  |  |   82|     87|#define dwarf_initialize_search_hash _dwarf_initialize_search_hash
  ------------------
 1176|     87|            simple_value_hashfunc,size_est);
 1177|     87|    }
 1178|     87|    return dbg;
 1179|     87|}
_dwarf_malloc_section_free:
 1188|  2.79k|{
 1189|       |    /*  Compressed sections will be malloc not mmap
 1190|       |        by the time we get here.
 1191|       |        No matter what the preference was.  */
 1192|  2.79k|    switch(sec->dss_actual_load_type) {
 1193|    219|    case Dwarf_Alloc_Malloc:
  ------------------
  |  Branch (1193:5): [True: 219, False: 2.57k]
  ------------------
 1194|    219|        if (sec->dss_was_alloc) {
  ------------------
  |  Branch (1194:13): [True: 0, False: 219]
  ------------------
 1195|      0|            free(sec->dss_data);
 1196|      0|        }
 1197|    219|        break;
 1198|      0|    case Dwarf_Alloc_Mmap:
  ------------------
  |  Branch (1198:5): [True: 0, False: 2.79k]
  ------------------
 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|  2.57k|    case Dwarf_Alloc_None:
  ------------------
  |  Branch (1213:5): [True: 2.57k, False: 219]
  ------------------
 1214|  2.57k|    default:
  ------------------
  |  Branch (1214:5): [True: 0, False: 2.79k]
  ------------------
 1215|  2.57k|    break;
 1216|  2.79k|    }
 1217|  2.79k|    sec->dss_data = 0;
 1218|       |    /* sec->dss_size = 0; */
 1219|  2.79k|    sec->dss_was_alloc = FALSE;
  ------------------
  |  |   36|  2.79k|#define FALSE 0
  ------------------
 1220|  2.79k|    sec->dss_mmap_realarea = 0;
 1221|  2.79k|    sec->dss_computed_mmap_len = 0;
 1222|  2.79k|    sec->dss_computed_mmap_offset = 0;
 1223|  2.79k|}
_dwarf_free_all_of_one_debug:
 1261|     87|{
 1262|     87|    unsigned g = 0;
 1263|       |
 1264|     87|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|     87|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|     87|#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|     87|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 0, False: 87]
  |  |  |  Branch (159:7): [True: 0, False: 87]
  |  |  |  Branch (159:15): [True: 0, False: 87]
  |  |  ------------------
  ------------------
 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|     87|    if (dbg->de_cu_hashindex_data) {
  ------------------
  |  Branch (1273:9): [True: 1, False: 86]
  ------------------
 1274|      1|        dwarf_dealloc_xu_header(dbg->de_cu_hashindex_data);
 1275|      1|        dbg->de_cu_hashindex_data = 0;
 1276|      1|    }
 1277|     87|    if (dbg->de_tu_hashindex_data) {
  ------------------
  |  Branch (1277:9): [True: 1, False: 86]
  ------------------
 1278|      1|        dwarf_dealloc_xu_header(dbg->de_tu_hashindex_data);
 1279|      1|        dbg->de_tu_hashindex_data = 0;
 1280|      1|    }
 1281|     87|    if (dbg->de_printf_callback_null_device_handle) {
  ------------------
  |  Branch (1281:9): [True: 0, False: 87]
  ------------------
 1282|      0|        fclose(dbg->de_printf_callback_null_device_handle);
 1283|      0|        dbg->de_printf_callback_null_device_handle = 0;
 1284|      0|    }
 1285|     87|    freecontextlist(dbg,&dbg->de_info_reading);
 1286|     87|    freecontextlist(dbg,&dbg->de_types_reading);
 1287|       |    /* Housecleaning done. Now really free all the space. */
 1288|     87|    _dwarf_malloc_section_free(&dbg->de_debug_info);
 1289|     87|    _dwarf_malloc_section_free(&dbg->de_debug_types);
 1290|     87|    _dwarf_malloc_section_free(&dbg->de_debug_abbrev);
 1291|     87|    _dwarf_malloc_section_free(&dbg->de_debug_line);
 1292|     87|    _dwarf_malloc_section_free(&dbg->de_debug_line_str);
 1293|     87|    _dwarf_malloc_section_free(&dbg->de_debug_loc);
 1294|     87|    _dwarf_malloc_section_free(&dbg->de_debug_aranges);
 1295|     87|    _dwarf_malloc_section_free(&dbg->de_debug_macinfo);
 1296|     87|    _dwarf_malloc_section_free(&dbg->de_debug_macro);
 1297|     87|    _dwarf_malloc_section_free(&dbg->de_debug_names);
 1298|     87|    _dwarf_malloc_section_free(&dbg->de_debug_pubnames);
 1299|     87|    _dwarf_malloc_section_free(&dbg->de_debug_str);
 1300|     87|    _dwarf_malloc_section_free(&dbg->de_debug_sup);
 1301|     87|    _dwarf_malloc_section_free(&dbg->de_debug_frame);
 1302|     87|    _dwarf_malloc_section_free(&dbg->de_debug_frame_eh_gnu);
 1303|     87|    _dwarf_malloc_section_free(&dbg->de_debug_pubtypes);
 1304|     87|    _dwarf_malloc_section_free(&dbg->de_debug_funcnames);
 1305|     87|    _dwarf_malloc_section_free(&dbg->de_debug_typenames);
 1306|     87|    _dwarf_malloc_section_free(&dbg->de_debug_varnames);
 1307|     87|    _dwarf_malloc_section_free(&dbg->de_debug_weaknames);
 1308|     87|    _dwarf_malloc_section_free(&dbg->de_debug_ranges);
 1309|     87|    _dwarf_malloc_section_free(&dbg->de_debug_str_offsets);
 1310|     87|    _dwarf_malloc_section_free(&dbg->de_debug_addr);
 1311|     87|    _dwarf_malloc_section_free(&dbg->de_debug_gdbindex);
 1312|     87|    _dwarf_malloc_section_free(&dbg->de_debug_cu_index);
 1313|     87|    _dwarf_malloc_section_free(&dbg->de_debug_tu_index);
 1314|     87|    _dwarf_malloc_section_free(&dbg->de_debug_loclists);
 1315|     87|    _dwarf_malloc_section_free(&dbg->de_debug_rnglists);
 1316|     87|    _dwarf_malloc_section_free(&dbg->de_gnu_debuglink);
 1317|     87|    _dwarf_malloc_section_free(&dbg->de_note_gnu_buildid);
 1318|     87|    _dwarf_harmless_cleanout(&dbg->de_harmless_errors);
 1319|       |
 1320|     87|    _dwarf_dealloc_rnglists_context(dbg);
 1321|     87|    _dwarf_dealloc_loclists_context(dbg);
 1322|     87|    if (dbg->de_printf_callback.dp_buffer &&
  ------------------
  |  Branch (1322:9): [True: 0, False: 87]
  ------------------
 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|     87|    _dwarf_destroy_group_map(dbg);
 1327|       |    /*  de_alloc_tree might be NULL if
 1328|       |        global_de_alloc_tree_on is zero. */
 1329|     87|    if (dbg->de_alloc_tree) {
  ------------------
  |  Branch (1329:9): [True: 87, False: 0]
  ------------------
 1330|     87|        dbg->de_in_tdestroy = TRUE;
  ------------------
  |  |   33|     87|#define TRUE 1
  ------------------
 1331|     87|        dwarf_tdestroy(dbg->de_alloc_tree,tdestroy_free_node);
  ------------------
  |  |   80|     87|#define dwarf_tdestroy _dwarf_tdestroy
  ------------------
 1332|     87|        dbg->de_in_tdestroy = FALSE;
  ------------------
  |  |   36|     87|#define FALSE 0
  ------------------
 1333|     87|        dbg->de_alloc_tree = 0;
 1334|     87|    }
 1335|     87|    _dwarf_free_static_errlist();
 1336|       |    /*  first, walk the search and free()
 1337|       |        contents. */
 1338|       |    /*  Now  do the search tree itself */
 1339|     87|    if (dbg->de_tied_data.td_tied_search) {
  ------------------
  |  Branch (1339:9): [True: 0, False: 87]
  ------------------
 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|     87|    free((void *)dbg->de_path);
 1345|     87|    dbg->de_path = 0;
 1346|    110|    for (g = 0; g < dbg->de_gnu_global_path_count; ++g) {
  ------------------
  |  Branch (1346:17): [True: 23, False: 87]
  ------------------
 1347|     23|        free((char *)dbg->de_gnu_global_paths[g]);
 1348|     23|        dbg->de_gnu_global_paths[g] = 0;
 1349|     23|    }
 1350|     87|    free((void*)dbg->de_gnu_global_paths);
 1351|     87|    dbg->de_gnu_global_paths = 0;
 1352|     87|    dbg->de_gnu_global_path_count = 0;
 1353|     87|    memset(dbg, 0, sizeof(*dbg)); /* Prevent accidental use later. */
 1354|     87|    free(dbg);
 1355|     87|    return DW_DLV_OK;
  ------------------
  |  |  122|     87|#define DW_DLV_OK        0
  ------------------
 1356|     87|}
_dwarf_special_no_dbg_error_malloc:
 1369|    166|{
 1370|    166|    Dwarf_Error e = 0;
 1371|    166|    Dwarf_Unsigned len =  0;
 1372|    166|    struct reserve_data_s *base = 0;
 1373|    166|    char *mem = 0;
 1374|       |
 1375|    166|    len = sizeof(struct Dwarf_Error_s) + DW_RESERVE;
  ------------------
  |  |  176|    166|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
 1376|    166|    mem = (char *)malloc((size_t)len);
 1377|    166|    if (!mem) {
  ------------------
  |  Branch (1377:9): [True: 0, False: 166]
  ------------------
 1378|      0|        return 0;
 1379|      0|    }
 1380|    166|    memset(mem, 0, len);
 1381|    166|    base = (struct reserve_data_s *)mem;
 1382|    166|    base->rd_dbg = 0;
 1383|    166|    base->rd_length = (unsigned short)sizeof(struct Dwarf_Error_s);
 1384|    166|    base->rd_type = DW_DLA_ERROR;
  ------------------
  |  |  995|    166|#define DW_DLA_ERROR           0x0e  /* Dwarf_Error */
  ------------------
 1385|    166|    e = (Dwarf_Error)(mem+DW_RESERVE);
  ------------------
  |  |  176|    166|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
 1386|    166|    e->er_static_alloc = DE_MALLOC;
  ------------------
  |  |   47|    166|#define DE_MALLOC 2   /* Using malloc space */
  ------------------
 1387|    166|    return e;
 1388|    166|}
dwarf_alloc.c:dw_empty_errlist_item:
  198|    166|{
  199|    166|    unsigned i = 0;
  200|    166|    if (!e_in) {
  ------------------
  |  Branch (200:9): [True: 0, False: 166]
  ------------------
  201|      0|        return;
  202|      0|    }
  203|    332|    for ( ; i <static_used; ++i) {
  ------------------
  |  Branch (203:13): [True: 166, False: 166]
  ------------------
  204|    166|        Dwarf_Error e = staticerrlist[i];
  205|    166|        if (e != e_in) {
  ------------------
  |  Branch (205:13): [True: 0, False: 166]
  ------------------
  206|      0|            continue;
  207|      0|        }
  208|    166|        if (e->er_static_alloc == DE_MALLOC) {
  ------------------
  |  |   47|    166|#define DE_MALLOC 2   /* Using malloc space */
  ------------------
  |  Branch (208:13): [True: 166, False: 0]
  ------------------
  209|       |            /* e is the returned address, not
  210|       |                the base. Free by the base.  */
  211|    166|            void *mallocaddr = 0;
  212|       |
  213|    166|            if ( (uintptr_t)e > DW_RESERVE) {
  ------------------
  |  |  176|    166|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
  |  Branch (213:18): [True: 166, False: 0]
  ------------------
  214|    166|                mallocaddr = (char*)e - DW_RESERVE;
  ------------------
  |  |  176|    166|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
  215|    166|            } else {
  216|       |                /*  Impossible */
  217|      0|                continue;
  218|      0|            }
  219|    166|            _dwarf_error_destructor(e);
  220|    166|            free(mallocaddr);
  221|    166|        }
  222|    166|        staticerrlist[i] = 0;
  223|    166|    }
  224|    166|}
dwarf_alloc.c:simple_compare_function:
  599|     53|{
  600|     53|    DW_TSHASHTYPE lp = (DW_TSHASHTYPE)(uintptr_t)l;
  ------------------
  |  |   54|     53|#define DW_TSHASHTYPE uintptr_t
  ------------------
  601|     53|    DW_TSHASHTYPE rp = (DW_TSHASHTYPE)(uintptr_t)r;
  ------------------
  |  |   54|     53|#define DW_TSHASHTYPE uintptr_t
  ------------------
  602|     53|    if (lp < rp) {
  ------------------
  |  Branch (602:9): [True: 0, False: 53]
  ------------------
  603|      0|        return -1;
  604|      0|    }
  605|     53|    if (lp > rp) {
  ------------------
  |  Branch (605:9): [True: 0, False: 53]
  ------------------
  606|      0|        return 1;
  607|      0|    }
  608|     53|    return 0;
  609|     53|}
dwarf_alloc.c:simple_value_hashfunc:
  549|    124|{
  550|    124|    DW_TSHASHTYPE up = (DW_TSHASHTYPE)(uintptr_t)keyp;
  ------------------
  |  |   54|    124|#define DW_TSHASHTYPE uintptr_t
  ------------------
  551|    124|    return up;
  552|    124|}
dwarf_alloc.c:freecontextlist:
 1227|    174|{
 1228|    174|    Dwarf_CU_Context context = 0;
 1229|    174|    Dwarf_CU_Context nextcontext = 0;
 1230|    174|    for (context = dis->de_cu_context_list;
 1231|    174|        context; context = nextcontext) {
  ------------------
  |  Branch (1231:9): [True: 0, False: 174]
  ------------------
 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|    174|    dis->de_cu_context_list = 0;
 1248|    174|}
dwarf_alloc.c:tdestroy_free_node:
  560|     18|{
  561|     18|    char                  *m = 0;
  562|     18|    char                  *malloc_addr =  0;
  563|     18|    struct reserve_data_s *reserve =  0;
  564|     18|    unsigned int           type = 0;
  565|       |
  566|     18|    m = (char *)nodep;
  567|     18|    if ((uintptr_t)m > DW_RESERVE) {
  ------------------
  |  |  176|     18|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
  |  Branch (567:9): [True: 18, False: 0]
  ------------------
  568|     18|        malloc_addr = m - DW_RESERVE;
  ------------------
  |  |  176|     18|#define DW_RESERVE sizeof(struct reserve_size_s)
  ------------------
  569|     18|    } else {
  570|       |        /* impossible */
  571|      0|        return;
  572|      0|    }
  573|     18|    reserve = (struct reserve_data_s *)malloc_addr;
  574|     18|    type = reserve->rd_type;
  575|     18|    if (type >= ALLOC_AREA_INDEX_TABLE_MAX) {
  ------------------
  |  |   48|     18|#define ALLOC_AREA_INDEX_TABLE_MAX 66
  ------------------
  |  Branch (575:9): [True: 0, False: 18]
  ------------------
  576|       |        /* Internal error, corrupted data. */
  577|      0|        return;
  578|      0|    }
  579|     18|    if (!reserve->rd_dbg) {
  ------------------
  |  Branch (579:9): [True: 0, False: 18]
  ------------------
  580|       |        /*  Unused (corrupted?) node in the tree.
  581|       |            Should never happen. */
  582|      0|        return;
  583|      0|    }
  584|     18|    if (!reserve->rd_type) {
  ------------------
  |  Branch (584:9): [True: 0, False: 18]
  ------------------
  585|       |        /*  Unused (corrupted?) node in the tree.
  586|       |            Should never happen. */
  587|      0|        return;
  588|      0|    }
  589|     18|    if (alloc_instance_basics[type].specialdestructor) {
  ------------------
  |  Branch (589:9): [True: 18, False: 0]
  ------------------
  590|     18|        alloc_instance_basics[type].specialdestructor(m);
  591|     18|    }
  592|     18|    free(malloc_addr);
  593|     18|}

dwarf_add_debuglink_global_path:
 1069|     23|{
 1070|     23|    unsigned    glpath_count_in = 0;
 1071|     23|    unsigned    glpath_count_out = 0;
 1072|     23|    char      **glpaths = 0;
 1073|     23|    char       *path1 = 0;
 1074|       |
 1075|     23|    CHECK_DBG(dbg,error,"dwarf_add_debuglink_global_path()");
  ------------------
  |  |  190|     23|    do {                                                      \
  |  |  191|     23|        if (!(cd_dbg) || (cd_dbg)->de_magic != DBG_IS_VALID) {    \
  |  |  ------------------
  |  |  |  |  596|     23|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |  |  Branch (191:13): [True: 0, False: 23]
  |  |  |  Branch (191:26): [True: 0, False: 23]
  |  |  ------------------
  |  |  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|     23|    } while (0)
  |  |  ------------------
  |  |  |  Branch (199:14): [Folded, False: 23]
  |  |  ------------------
  ------------------
 1076|     23|    glpath_count_in = dbg->de_gnu_global_path_count;
 1077|     23|    glpath_count_out = glpath_count_in+1;
 1078|     23|    glpaths = (char **)malloc(sizeof(char *)*
 1079|     23|        glpath_count_out);
 1080|     23|    if (!glpaths) {
  ------------------
  |  Branch (1080:9): [True: 0, False: 23]
  ------------------
 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|     23|    if (glpath_count_in) {
  ------------------
  |  Branch (1084:9): [True: 0, False: 23]
  ------------------
 1085|      0|        memcpy(glpaths, dbg->de_gnu_global_paths,
 1086|      0|            sizeof(char *)*glpath_count_in);
 1087|      0|    }
 1088|     23|    path1 = strdup(pathname);
 1089|     23|    if (!path1) {
  ------------------
  |  Branch (1089:9): [True: 0, False: 23]
  ------------------
 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|     23|    free(dbg->de_gnu_global_paths);
 1095|     23|    glpaths[glpath_count_in] = path1;
 1096|     23|    dbg->de_gnu_global_paths = (const char **)glpaths;
 1097|     23|    dbg->de_gnu_global_path_count = glpath_count_out;
 1098|     23|    return DW_DLV_OK;
  ------------------
  |  |  122|     23|#define DW_DLV_OK        0
  ------------------
 1099|     23|}

dwarf_dnames_header:
  773|     23|{
  774|     23|    Dwarf_Unsigned    remaining    = 0;
  775|     23|    Dwarf_Dnames_Head dn           = 0;
  776|     23|    Dwarf_Unsigned    section_size = 0;
  777|     23|    Dwarf_Unsigned    usedspace    = 0;
  778|     23|    Dwarf_Unsigned    next_offset  = 0;
  779|     23|    Dwarf_Small      *start_section= 0;
  780|     23|    Dwarf_Small      *end_section  = 0;
  781|     23|    Dwarf_Small      *curptr       = 0;
  782|     23|    int              res           = 0;
  783|       |
  784|     23|    CHECK_DBG(dbg,error,"dwarf_dnames_header()");
  ------------------
  |  |  190|     23|    do {                                                      \
  |  |  191|     23|        if (!(cd_dbg) || (cd_dbg)->de_magic != DBG_IS_VALID) {    \
  |  |  ------------------
  |  |  |  |  596|     23|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |  |  Branch (191:13): [True: 0, False: 23]
  |  |  |  Branch (191:26): [True: 0, False: 23]
  |  |  ------------------
  |  |  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|     23|    } while (0)
  |  |  ------------------
  |  |  |  Branch (199:14): [Folded, False: 23]
  |  |  ------------------
  ------------------
  785|     23|    res = _dwarf_load_section(dbg, &dbg->de_debug_names, error);
  786|     23|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     23|#define DW_DLV_OK        0
  ------------------
  |  Branch (786:9): [True: 6, False: 17]
  ------------------
  787|      6|        return res;
  788|      6|    }
  789|     17|    section_size = dbg->de_debug_names.dss_size;
  790|     17|    if (!section_size){
  ------------------
  |  Branch (790:9): [True: 0, False: 17]
  ------------------
  791|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
  792|      0|    }
  793|     17|    res = _dwarf_load_section(dbg, &dbg->de_debug_str,error);
  794|     17|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|     17|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (794:9): [True: 0, False: 17]
  ------------------
  795|      0|        return res;
  796|      0|    }
  797|     17|    if (starting_offset >= section_size) {
  ------------------
  |  Branch (797:9): [True: 0, False: 17]
  ------------------
  798|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
  799|      0|    }
  800|     17|    start_section = dbg->de_debug_names.dss_data;
  801|     17|    curptr = start_section + starting_offset;
  802|     17|    end_section = start_section + section_size;
  803|     17|    dn =  (Dwarf_Dnames_Head)_dwarf_get_alloc(dbg,
  804|     17|        DW_DLA_DNAMES_HEAD, 1);
  ------------------
  |  | 1025|     17|#define DW_DLA_DNAMES_HEAD     0x3f  /* Dwarf_Dnames_Head */
  ------------------
  805|     17|    if (!dn) {
  ------------------
  |  Branch (805:9): [True: 0, False: 17]
  ------------------
  806|      0|        _dwarf_error_string(dbg, error, DW_DLE_ALLOC_FAIL,
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  807|      0|            "DW_DLE_ALLOC_FAIL: dwarf_get_alloc of "
  808|      0|            "a Dwarf_Dnames_Head record failed.");
  809|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  810|      0|    }
  811|     17|    dn->dn_magic = DWARF_DNAMES_MAGIC;
  ------------------
  |  |   49|     17|#define DWARF_DNAMES_MAGIC  0xabcd
  ------------------
  812|     17|    dn->dn_section_data = start_section;
  813|     17|    dn->dn_section_size = section_size;
  814|     17|    dn->dn_section_end = end_section;
  815|     17|    dn->dn_dbg = dbg;
  816|     17|    dn->dn_section_offset = starting_offset;
  817|     17|    dn->dn_indextable_data = curptr;
  818|     17|    remaining = dn->dn_section_size - starting_offset;
  819|     17|    res = read_a_name_table_header(dn,
  820|     17|        starting_offset,
  821|     17|        remaining,
  822|     17|        curptr,
  823|     17|        &usedspace,
  824|     17|        &next_offset,
  825|     17|        dn->dn_section_end,
  826|     17|        error);
  827|     17|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|     17|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (827:9): [True: 11, False: 6]
  ------------------
  828|     11|        dwarf_dealloc_dnames(dn);
  829|     11|        return res;
  830|     11|    }
  831|      6|    if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|      6|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (831:9): [True: 0, False: 6]
  ------------------
  832|       |        /*  Impossible. A bug. Or possibly
  833|       |            a bunch of zero pad? */
  834|      0|        dwarf_dealloc_dnames(dn);
  835|      0|        return res;
  836|      0|    }
  837|      6|    if (usedspace > section_size) {
  ------------------
  |  Branch (837:9): [True: 0, False: 6]
  ------------------
  838|      0|        dwarf_dealloc_dnames(dn);
  839|      0|        _dwarf_error_string(dbg, error,DW_DLE_DEBUG_NAMES_OFF_END,
  ------------------
  |  | 1421|      0|#define DW_DLE_DEBUG_NAMES_OFF_END             375
  ------------------
  840|      0|            "DW_DLE_DEBUG_NAMES_OFF_END: "
  841|      0|            " used space > section size");
  842|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  843|      0|    }
  844|      6|    remaining -= usedspace;
  845|      6|    if (remaining && remaining < 15) {
  ------------------
  |  Branch (845:9): [True: 6, False: 0]
  |  Branch (845:22): [True: 0, False: 6]
  ------------------
  846|       |        /*  No more content in here, just padding. Check for zero
  847|       |            in padding. */
  848|      0|        curptr += usedspace;
  849|      0|        for ( ; curptr < end_section; ++curptr) {
  ------------------
  |  Branch (849:17): [True: 0, False: 0]
  ------------------
  850|      0|            if (*curptr) {
  ------------------
  |  Branch (850:17): [True: 0, False: 0]
  ------------------
  851|       |                /*  Fixing Coverity Scan CID 581830
  852|       |                    resource leak if just call dealloc,
  853|       |                    so call local dealloc to do it. */
  854|      0|                dwarf_dealloc_dnames(dn);
  855|       |                /*  One could argue this is a harmless error,
  856|       |                    but for now assume it is real corruption. */
  857|      0|                _dwarf_error_string(dbg, error,
  858|      0|                    DW_DLE_DEBUG_NAMES_PAD_NON_ZERO,
  ------------------
  |  | 1420|      0|#define DW_DLE_DEBUG_NAMES_PAD_NON_ZERO        374
  ------------------
  859|      0|                    "DW_DLE_DEBUG_NAMES_PAD_NON_ZERO: "
  860|      0|                    "space at end of valid tables not zeros");
  861|      0|                return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  862|      0|            }
  863|      0|        }
  864|      0|    }
  865|      6|    *dn_out = dn;
  866|      6|    *offset_of_next_table = next_offset;
  867|      6|    return DW_DLV_OK;
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
  868|      6|}
dwarf_dealloc_dnames:
  890|     34|{
  891|     34|    if (!dn || dn->dn_magic != DWARF_DNAMES_MAGIC) {
  ------------------
  |  |   49|     17|#define DWARF_DNAMES_MAGIC  0xabcd
  ------------------
  |  Branch (891:9): [True: 17, False: 17]
  |  Branch (891:16): [True: 0, False: 17]
  ------------------
  892|     17|        return;
  893|     17|    }
  894|     17|    _dwarf_internal_dwarf_dealloc_dnames(dn);
  895|       |    /*  Now dn_magic 0 so the dwarf_dealloc
  896|       |        will just do the base record free. */
  897|     17|    dwarf_dealloc(dn->dn_dbg,dn,DW_DLA_DNAMES_HEAD);
  ------------------
  |  | 1025|     17|#define DW_DLA_DNAMES_HEAD     0x3f  /* Dwarf_Dnames_Head */
  ------------------
  898|     17|}
_dwarf_dnames_destructor:
  903|     17|{
  904|     17|    Dwarf_Dnames_Head dn = (Dwarf_Dnames_Head)m;
  905|     17|    if (!dn || dn->dn_magic != DWARF_DNAMES_MAGIC) {
  ------------------
  |  |   49|     17|#define DWARF_DNAMES_MAGIC  0xabcd
  ------------------
  |  Branch (905:9): [True: 0, False: 17]
  |  Branch (905:16): [True: 17, False: 0]
  ------------------
  906|     17|        return;
  907|     17|    }
  908|      0|    _dwarf_internal_dwarf_dealloc_dnames(dn);
  909|      0|}
dwarf_dnames_sizes:
  933|      6|{
  934|      6|    if (!dn || dn->dn_magic != DWARF_DNAMES_MAGIC) {
  ------------------
  |  |   49|      6|#define DWARF_DNAMES_MAGIC  0xabcd
  ------------------
  |  Branch (934:9): [True: 0, False: 6]
  |  Branch (934:16): [True: 0, False: 6]
  ------------------
  935|      0|        _dwarf_error_string(NULL, error,DW_DLE_DBG_NULL,
  ------------------
  |  | 1126|      0|#define DW_DLE_DBG_NULL                         81
  ------------------
  936|      0|            "DW_DLE_DBG_NULL: A call to dwarf_dnames_sizes() "
  937|      0|            "has a NULL Dwarf_Dnames_Head or an improper one.");
  938|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  939|      0|    }
  940|      6|    if (comp_unit_count) {
  ------------------
  |  Branch (940:9): [True: 6, False: 0]
  ------------------
  941|      6|        *comp_unit_count = dn->dn_comp_unit_count;
  942|      6|    }
  943|      6|    if (local_type_unit_count) {
  ------------------
  |  Branch (943:9): [True: 6, False: 0]
  ------------------
  944|      6|        *local_type_unit_count = dn->dn_local_type_unit_count;
  945|      6|    }
  946|      6|    if (foreign_type_unit_count) {
  ------------------
  |  Branch (946:9): [True: 6, False: 0]
  ------------------
  947|      6|        *foreign_type_unit_count = dn->dn_foreign_type_unit_count;
  948|      6|    }
  949|      6|    if (bucket_count) {
  ------------------
  |  Branch (949:9): [True: 6, False: 0]
  ------------------
  950|      6|        *bucket_count = dn->dn_bucket_count;
  951|      6|    }
  952|      6|    if (name_count) {
  ------------------
  |  Branch (952:9): [True: 6, False: 0]
  ------------------
  953|      6|        *name_count = dn->dn_name_count;
  954|      6|    }
  955|      6|    if (abbrev_table_size) {
  ------------------
  |  Branch (955:9): [True: 6, False: 0]
  ------------------
  956|      6|        *abbrev_table_size = dn->dn_abbrev_table_size;
  957|      6|    }
  958|      6|    if (entry_pool_size) {
  ------------------
  |  Branch (958:9): [True: 6, False: 0]
  ------------------
  959|      6|        *entry_pool_size = dn->dn_entry_pool_size;
  960|      6|    }
  961|      6|    if (augmentation_string_size) {
  ------------------
  |  Branch (961:9): [True: 6, False: 0]
  ------------------
  962|      6|        *augmentation_string_size = dn->dn_augmentation_string_size;
  963|      6|    }
  964|      6|    if (augmentation_string) {
  ------------------
  |  Branch (964:9): [True: 6, False: 0]
  ------------------
  965|      6|        *augmentation_string = dn->dn_augmentation_string;
  966|      6|    }
  967|      6|    if (section_size) {
  ------------------
  |  Branch (967:9): [True: 6, False: 0]
  ------------------
  968|      6|        *section_size = dn->dn_section_size;
  969|      6|    }
  970|      6|    if (table_version) {
  ------------------
  |  Branch (970:9): [True: 6, False: 0]
  ------------------
  971|      6|        *table_version = dn->dn_version;
  972|      6|    }
  973|      6|    if (offset_size) {
  ------------------
  |  Branch (973:9): [True: 6, False: 0]
  ------------------
  974|      6|        *offset_size = dn->dn_offset_size;
  975|      6|    }
  976|      6|    return DW_DLV_OK;
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
  977|      6|}
dwarf_dnames_offsets:
  994|      6|{
  995|      6|    if (!dn || dn->dn_magic != DWARF_DNAMES_MAGIC) {
  ------------------
  |  |   49|      6|#define DWARF_DNAMES_MAGIC  0xabcd
  ------------------
  |  Branch (995:9): [True: 0, False: 6]
  |  Branch (995:16): [True: 0, False: 6]
  ------------------
  996|      0|        _dwarf_error_string(NULL, error,DW_DLE_DBG_NULL,
  ------------------
  |  | 1126|      0|#define DW_DLE_DBG_NULL                         81
  ------------------
  997|      0|            "DW_DLE_DBG_NULL: A call to dwarf_dnames_offsets() "
  998|      0|            "has a NULL Dwarf_Dnames_Head or an improper one.");
  999|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1000|      0|    }
 1001|      6|    if (header_offset) {
  ------------------
  |  Branch (1001:9): [True: 6, False: 0]
  ------------------
 1002|      6|        *header_offset = dn->dn_section_offset;
 1003|      6|    }
 1004|      6|    if (cu_table_offset) {
  ------------------
  |  Branch (1004:9): [True: 6, False: 0]
  ------------------
 1005|      6|        *cu_table_offset = dn->dn_cu_list_offset;
 1006|      6|    }
 1007|      6|    if (tu_local_offset) {
  ------------------
  |  Branch (1007:9): [True: 6, False: 0]
  ------------------
 1008|      6|        *tu_local_offset = dn->dn_local_tu_list_offset;
 1009|      6|    }
 1010|      6|    if (foreign_tu_offset) {
  ------------------
  |  Branch (1010:9): [True: 6, False: 0]
  ------------------
 1011|      6|        *foreign_tu_offset = dn->dn_foreign_tu_list_offset;
 1012|      6|    }
 1013|      6|    if (bucket_offset) {
  ------------------
  |  Branch (1013:9): [True: 6, False: 0]
  ------------------
 1014|      6|        *bucket_offset = dn->dn_buckets_offset;
 1015|      6|    }
 1016|      6|    if (hashes_offset) {
  ------------------
  |  Branch (1016:9): [True: 6, False: 0]
  ------------------
 1017|      6|        *hashes_offset = dn->dn_hash_table_offset;
 1018|      6|    }
 1019|      6|    if (stringoffsets_offset) {
  ------------------
  |  Branch (1019:9): [True: 6, False: 0]
  ------------------
 1020|      6|        *stringoffsets_offset = dn->dn_string_offsets_offset;
 1021|      6|    }
 1022|      6|    if (entryoffsets_offset) {
  ------------------
  |  Branch (1022:9): [True: 6, False: 0]
  ------------------
 1023|      6|        *entryoffsets_offset = dn->dn_entry_offsets_offset;
 1024|      6|    }
 1025|      6|    if (abbrev_table_offset) {
  ------------------
  |  Branch (1025:9): [True: 6, False: 0]
  ------------------
 1026|      6|        *abbrev_table_offset = dn->dn_abbrevs_offset;
 1027|      6|    }
 1028|      6|    if (entry_pool_offset) {
  ------------------
  |  Branch (1028:9): [True: 6, False: 0]
  ------------------
 1029|      6|        *entry_pool_offset = dn->dn_entry_pool_offset;
 1030|      6|    }
 1031|      6|    return DW_DLV_OK;
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
 1032|      6|}
dwarf_dnames_cu_table:
 1045|      6|{
 1046|      6|    Dwarf_Debug    dbg             = 0;
 1047|      6|    Dwarf_Unsigned unit_count      = 0;
 1048|      6|    Dwarf_Unsigned total_count     = 0;
 1049|      6|    Dwarf_Unsigned unit_entry_size = 0;
 1050|      6|    Dwarf_Small  * unit_ptr        = 0;
 1051|      6|    Dwarf_Unsigned foreign_count   = 0;
 1052|      6|    Dwarf_Bool     offset_case     = TRUE;
  ------------------
  |  |   33|      6|#define TRUE 1
  ------------------
 1053|       |
 1054|      6|    if (!dn || dn->dn_magic != DWARF_DNAMES_MAGIC) {
  ------------------
  |  |   49|      6|#define DWARF_DNAMES_MAGIC  0xabcd
  ------------------
  |  Branch (1054:9): [True: 0, False: 6]
  |  Branch (1054:16): [True: 0, False: 6]
  ------------------
 1055|      0|        _dwarf_error_string(NULL, error,DW_DLE_DEBUG_NAMES_ERROR,
  ------------------
  |  | 1530|      0|#define DW_DLE_DEBUG_NAMES_ERROR               484
  ------------------
 1056|      0|            "DW_DLE_DEBUG_NAMES_ERROR: "
 1057|      0|            " Dwarf_Dnames_Head is NULL or invalid pointer"
 1058|      0|            "calling dwarf_dnames_cu_table()");
 1059|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1060|      0|    }
 1061|       |
 1062|      6|    dbg = dn->dn_dbg;
 1063|      6|    if (type[0] == 'c') {
  ------------------
  |  Branch (1063:9): [True: 6, False: 0]
  ------------------
 1064|      6|        unit_ptr = dn->dn_cu_list;
 1065|      6|        unit_entry_size = dn->dn_offset_size;
 1066|      6|        unit_count = dn->dn_comp_unit_count;
 1067|      6|        total_count = unit_count;
 1068|      6|        offset_case = TRUE;
  ------------------
  |  |   33|      6|#define TRUE 1
  ------------------
 1069|      6|    } else if (type[0] == 't') {
  ------------------
  |  Branch (1069:16): [True: 0, False: 0]
  ------------------
 1070|      0|        unit_count = dn->dn_local_type_unit_count;
 1071|      0|        foreign_count = dn->dn_foreign_type_unit_count;
 1072|      0|        total_count = unit_count + foreign_count;
 1073|      0|        if (index_number < dn->dn_local_type_unit_count) {
  ------------------
  |  Branch (1073:13): [True: 0, False: 0]
  ------------------
 1074|      0|            unit_ptr = dn->dn_local_tu_list;
 1075|      0|            unit_entry_size = dn->dn_offset_size;
 1076|      0|            offset_case = TRUE;
  ------------------
  |  |   33|      0|#define TRUE 1
  ------------------
 1077|      0|        } else {
 1078|      0|            unit_ptr = dn->dn_foreign_tu_list;
 1079|      0|            unit_entry_size = sizeof(Dwarf_Sig8);
 1080|      0|            offset_case = FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
 1081|      0|        }
 1082|      0|    } else {
 1083|      0|        _dwarf_error_string(dbg,error,DW_DLE_DEBUG_NAMES_ERROR,
  ------------------
  |  | 1530|      0|#define DW_DLE_DEBUG_NAMES_ERROR               484
  ------------------
 1084|      0|            "DW_DLE_DEBUG_NAMES_ERROR: "
 1085|      0|            "type string is not start with cu or tu"
 1086|      0|            "so invalid call to dwarf_dnames_cu_table()");
 1087|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1088|      0|    }
 1089|      6|    if (index_number >= total_count) {
  ------------------
  |  Branch (1089:9): [True: 0, False: 6]
  ------------------
 1090|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
 1091|      0|    }
 1092|      6|    if (offset_case) {
  ------------------
  |  Branch (1092:9): [True: 6, False: 0]
  ------------------
 1093|       |        /* CU or TU ref */
 1094|      6|        Dwarf_Unsigned offsetval = 0;
 1095|      6|        Dwarf_Small *ptr = unit_ptr +
 1096|      6|            (index_number) *unit_entry_size;
 1097|      6|        Dwarf_Small *endptr = dn->dn_indextable_data_end;
 1098|       |
 1099|      6|        READ_UNALIGNED_CK(dbg, offsetval, Dwarf_Unsigned,
  ------------------
  |  |  245|      6|    do  {                                        \
  |  |  246|      6|        desttype _ltmp = 0;                      \
  |  |  247|      6|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|      6|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 6]
  |  |  ------------------
  |  |  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|      6|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 0, False: 6]
  |  |  ------------------
  |  |  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|      6|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|      6|            (source), (unsigned long)(length)) ; \
  |  |  264|      6|        (dest) = _ltmp;                          \
  |  |  265|      6|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 6]
  |  |  ------------------
  ------------------
 1100|      6|            ptr, (unsigned long)unit_entry_size,
 1101|      6|            error,endptr);
 1102|      6|        if (offset) {
  ------------------
  |  Branch (1102:13): [True: 6, False: 0]
  ------------------
 1103|      6|            *offset = offsetval;
 1104|      6|        }
 1105|      6|        return DW_DLV_OK;
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
 1106|      6|    }
 1107|      0|    {
 1108|      0|        Dwarf_Small *ptr =  unit_ptr +
 1109|      0|            (index_number -unit_count) *unit_entry_size;
 1110|      0|        if (sig) {
  ------------------
  |  Branch (1110:13): [True: 0, False: 0]
  ------------------
 1111|      0|            memcpy(sig,ptr,sizeof(*sig));
 1112|      0|        }
 1113|      0|    }
 1114|      0|    return DW_DLV_OK;
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
 1115|      6|}
dwarf_dnames_bucket:
 1198|      6|{
 1199|      6|    struct Dwarf_DN_Bucket_s *cur = 0;
 1200|      6|    int res = 0;
 1201|       |
 1202|      6|    if (!dn || dn->dn_magic != DWARF_DNAMES_MAGIC) {
  ------------------
  |  |   49|      6|#define DWARF_DNAMES_MAGIC  0xabcd
  ------------------
  |  Branch (1202:9): [True: 0, False: 6]
  |  Branch (1202:16): [True: 0, False: 6]
  ------------------
 1203|      0|        _dwarf_error_string(NULL, error,DW_DLE_DBG_NULL,
  ------------------
  |  | 1126|      0|#define DW_DLE_DBG_NULL                         81
  ------------------
 1204|      0|            "DW_DLE_DBG_NULL: bad Head argument to "
 1205|      0|            "dwarf_dnames_bucket");
 1206|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1207|      0|    }
 1208|      6|    if (bucket_number >= dn->dn_bucket_count) {
  ------------------
  |  Branch (1208:9): [True: 0, False: 6]
  ------------------
 1209|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
 1210|      0|    }
 1211|      6|    res  = _dwarf_initialize_bucket_details(dn,error);
 1212|      6|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|      6|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (1212:9): [True: 0, False: 6]
  ------------------
 1213|      0|        return res;
 1214|      0|    }
 1215|      6|    if (!dn->dn_bucket_array) {
  ------------------
  |  Branch (1215:9): [True: 0, False: 6]
  ------------------
 1216|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
 1217|      0|    }
 1218|      6|    cur = dn->dn_bucket_array + bucket_number;
 1219|      6|    *name_index = cur->db_nameindex;
 1220|      6|    *collision_count = cur->db_collisioncount;
 1221|      6|    return DW_DLV_OK;
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
 1222|      6|}
dwarf_dnames_abbrevtable:
 1308|      6|{
 1309|      6|    struct Dwarf_D_Abbrev_s *ab      = 0;
 1310|      6|    Dwarf_Unsigned abnumber          = 0;
 1311|      6|    Dwarf_Unsigned abmax             = 0;
 1312|       |
 1313|      6|    if (!dn) {
  ------------------
  |  Branch (1313:9): [True: 0, False: 6]
  ------------------
 1314|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
 1315|      0|    }
 1316|      6|    if (!idxattr_array || !form_array) {
  ------------------
  |  Branch (1316:9): [True: 6, False: 0]
  |  Branch (1316:27): [True: 0, False: 0]
  ------------------
 1317|      6|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      6|#define DW_DLV_NO_ENTRY -1
  ------------------
 1318|      6|    }
 1319|      0|    if (index >= dn->dn_abbrev_instance_count) {
  ------------------
  |  Branch (1319:9): [True: 0, False: 0]
  ------------------
 1320|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
 1321|      0|    }
 1322|      0|    ab = dn->dn_abbrev_instances + index;
 1323|      0|    if (abbrev_offset) {
  ------------------
  |  Branch (1323:9): [True: 0, False: 0]
  ------------------
 1324|      0|        *abbrev_offset = ab->da_abbrev_offset;
 1325|      0|    }
 1326|      0|    if (abbrev_code) {
  ------------------
  |  Branch (1326:9): [True: 0, False: 0]
  ------------------
 1327|      0|        *abbrev_code = ab->da_abbrev_code;
 1328|      0|    }
 1329|      0|    if (abbrev_tag) {
  ------------------
  |  Branch (1329:9): [True: 0, False: 0]
  ------------------
 1330|      0|        *abbrev_tag  = ab->da_tag;
 1331|      0|    }
 1332|      0|    abmax       = ab->da_pairs_count;
 1333|      0|    if (attr_count) {
  ------------------
  |  Branch (1333:9): [True: 0, False: 0]
  ------------------
 1334|      0|        *attr_count = abmax;
 1335|      0|    }
 1336|      0|    if (array_size < abmax) {
  ------------------
  |  Branch (1336:9): [True: 0, False: 0]
  ------------------
 1337|      0|        abmax = array_size;
 1338|      0|    }
 1339|      0|    for ( ; abnumber < abmax; ++abnumber) {
  ------------------
  |  Branch (1339:13): [True: 0, False: 0]
  ------------------
 1340|      0|        idxattr_array[abnumber] = ab->da_idxattr[abnumber];
 1341|      0|        form_array[abnumber] = ab->da_form[abnumber];
 1342|      0|    }
 1343|      0|    return DW_DLV_OK;
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
 1344|      0|}
dwarf_dnames_name:
 1482|      6|{
 1483|      6|    Dwarf_Debug dbg                     = 0;
 1484|      6|    int res                             = 0;
 1485|      6|    Dwarf_Unsigned entrypooloffset      = 0;
 1486|      6|    Dwarf_Unsigned debugstroffset       = 0;
 1487|      6|    Dwarf_Small * strpointer            = 0;
 1488|      6|    struct Dwarf_D_Abbrev_s *abbrevdata = 0;
 1489|      6|    Dwarf_Unsigned code                 = 0;
 1490|       |
 1491|      6|    if (!dn || dn->dn_magic != DWARF_DNAMES_MAGIC) {
  ------------------
  |  |   49|      6|#define DWARF_DNAMES_MAGIC  0xabcd
  ------------------
  |  Branch (1491:9): [True: 0, False: 6]
  |  Branch (1491:16): [True: 0, False: 6]
  ------------------
 1492|      0|        _dwarf_error_string(NULL, error,DW_DLE_DBG_NULL,
  ------------------
  |  | 1126|      0|#define DW_DLE_DBG_NULL                         81
  ------------------
 1493|      0|            "DW_DLE_DBG_NULL: "
 1494|      0|            "a call to dwarf_dnames_name() "
 1495|      0|            "Passes in a NULL or uninitialized pointer");
 1496|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1497|      0|    }
 1498|      6|    dbg = dn->dn_dbg;
 1499|      6|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|      6|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|      6|#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|      6|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 0, False: 6]
  |  |  |  Branch (159:7): [True: 0, False: 6]
  |  |  |  Branch (159:15): [True: 0, False: 6]
  |  |  ------------------
  ------------------
 1500|      0|        _dwarf_error_string(NULL, error,DW_DLE_DBG_NULL,
  ------------------
  |  | 1126|      0|#define DW_DLE_DBG_NULL                         81
  ------------------
 1501|      0|            "DW_DLE_DBG_NULL: "
 1502|      0|            "a call to dwarf_dnames_name() "
 1503|      0|            "finds a NULL Dwarf_Debug in a Dwarf_Dnames_Head");
 1504|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1505|      0|    }
 1506|      6|    if (!name_index || name_index > dn->dn_name_count) {
  ------------------
  |  Branch (1506:9): [True: 0, False: 6]
  |  Branch (1506:24): [True: 0, False: 6]
  ------------------
 1507|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
 1508|      0|    }
 1509|      6|    res = get_bucket_number(dn,name_index,bucket_number);
 1510|      6|    if (res == DW_DLV_OK) {
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
  |  Branch (1510:9): [True: 6, False: 0]
  ------------------
 1511|      6|        res = get_hash_value_number(dn,name_index,hash_value,error);
 1512|      6|        if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|      6|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (1512:13): [True: 0, False: 6]
  ------------------
 1513|      0|            return res;
 1514|      0|        }
 1515|      6|    }
 1516|      6|    {
 1517|      6|        Dwarf_Small *ptr = dn->dn_string_offsets +
 1518|      6|            (name_index-1) * dn->dn_offset_size;
 1519|      6|        Dwarf_Small *endptr = dn->dn_abbrevs;
 1520|       |
 1521|      6|        READ_UNALIGNED_CK(dbg, debugstroffset, Dwarf_Unsigned,
  ------------------
  |  |  245|      6|    do  {                                        \
  |  |  246|      6|        desttype _ltmp = 0;                      \
  |  |  247|      6|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|      6|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 6]
  |  |  ------------------
  |  |  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|      6|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 0, False: 6]
  |  |  ------------------
  |  |  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|      6|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|      6|            (source), (unsigned long)(length)) ; \
  |  |  264|      6|        (dest) = _ltmp;                          \
  |  |  265|      6|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 6]
  |  |  ------------------
  ------------------
 1522|      6|            ptr, dn->dn_offset_size,
 1523|      6|            error,endptr);
 1524|      6|        if (offset_to_debug_str) {
  ------------------
  |  Branch (1524:13): [True: 6, False: 0]
  ------------------
 1525|      6|            *offset_to_debug_str = debugstroffset;
 1526|      6|        }
 1527|      6|    }
 1528|       |    /* Get str ptr from .debug_str */
 1529|      0|    {
 1530|      6|        Dwarf_Small *secdataptr = 0;
 1531|      6|        Dwarf_Unsigned secdatalen = 0;
 1532|      6|        Dwarf_Small *secend = 0;
 1533|      6|        int res_s = 0;
 1534|       |
 1535|      6|        secdataptr = (Dwarf_Small *)dbg->de_debug_str.dss_data;
 1536|      6|        secdatalen = dbg->de_debug_str.dss_size;
 1537|      6|        secend = secdataptr+secdatalen;
 1538|      6|        strpointer = secdataptr +debugstroffset;
 1539|      6|        res_s = _dwarf_check_string_valid(dbg,
 1540|      6|            secdataptr,strpointer,secend,
 1541|      6|            DW_DLE_FORM_STRING_BAD_STRING,error);
  ------------------
  |  | 1407|      6|#define DW_DLE_FORM_STRING_BAD_STRING          361
  ------------------
 1542|      6|        if (res_s != DW_DLV_OK) {
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
  |  Branch (1542:13): [True: 6, False: 0]
  ------------------
 1543|      6|            return res_s;
 1544|      6|        }
 1545|      0|        if (ptrtostr) {
  ------------------
  |  Branch (1545:13): [True: 0, False: 0]
  ------------------
 1546|      0|            *ptrtostr = (char *)strpointer;
 1547|      0|        }
 1548|      0|    }
 1549|       |
 1550|      0|    {
 1551|      0|        Dwarf_Small *ptr = dn->dn_entry_offsets +
 1552|      0|            (name_index-1) * dn->dn_offset_size;
 1553|      0|        Dwarf_Small *endptr = dn->dn_abbrevs;
 1554|       |        /*  offsets relative to the start of the
 1555|       |            entry_pool */
 1556|       |
 1557|      0|        READ_UNALIGNED_CK(dbg, entrypooloffset, Dwarf_Unsigned,
  ------------------
  |  |  245|      0|    do  {                                        \
  |  |  246|      0|        desttype _ltmp = 0;                      \
  |  |  247|      0|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|      0|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  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|      0|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  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|      0|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|      0|            (source), (unsigned long)(length)) ; \
  |  |  264|      0|        (dest) = _ltmp;                          \
  |  |  265|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1558|      0|            ptr, dn->dn_offset_size,
 1559|      0|            error,endptr);
 1560|      0|        if (entrypooloffset >= dn->dn_entry_pool_size) {
  ------------------
  |  Branch (1560:13): [True: 0, False: 0]
  ------------------
 1561|      0|            _dwarf_error_string(dbg, error,DW_DLE_DEBUG_NAMES_ERROR,
  ------------------
  |  | 1530|      0|#define DW_DLE_DEBUG_NAMES_ERROR               484
  ------------------
 1562|      0|                "DW_DLE_DEBUG_NAMES_ERROR: "
 1563|      0|                "The entrypool offset read is larger than"
 1564|      0|                "the entrypool size");
 1565|      0|            return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1566|      0|        }
 1567|      0|        if (offset_in_entrypool) {
  ------------------
  |  Branch (1567:13): [True: 0, False: 0]
  ------------------
 1568|      0|            *offset_in_entrypool = entrypooloffset;
 1569|      0|        }
 1570|      0|    }
 1571|       |    /*   Find abbrev code at the given entry offset */
 1572|      0|    res = _dwarf_read_abbrev_code_from_pool(dn,
 1573|      0|        entrypooloffset, &code,error);
 1574|      0|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
  |  Branch (1574:9): [True: 0, False: 0]
  ------------------
 1575|      0|        return res;
 1576|      0|    }
 1577|      0|    res = _dwarf_find_abbrev_for_code(dn,code,&abbrevdata,error);
 1578|      0|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (1578:9): [True: 0, False: 0]
  ------------------
 1579|      0|        return res;
 1580|      0|    }
 1581|      0|    if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (1581:9): [True: 0, False: 0]
  ------------------
 1582|      0|        return res;
 1583|      0|    }
 1584|       |
 1585|      0|    if (abbrev_code) {
  ------------------
  |  Branch (1585:9): [True: 0, False: 0]
  ------------------
 1586|      0|        *abbrev_code =  code;
 1587|      0|    }
 1588|      0|    if (code && abbrev_tag) {
  ------------------
  |  Branch (1588:9): [True: 0, False: 0]
  |  Branch (1588:17): [True: 0, False: 0]
  ------------------
 1589|      0|        *abbrev_tag =  (Dwarf_Half)abbrevdata->da_tag;
 1590|      0|    }
 1591|      0|    if (code) {
  ------------------
  |  Branch (1591:9): [True: 0, False: 0]
  ------------------
 1592|      0|        if (attr_count) {
  ------------------
  |  Branch (1592:13): [True: 0, False: 0]
  ------------------
 1593|      0|            *attr_count = abbrevdata->da_pairs_count;
 1594|      0|        }
 1595|      0|        res = _dwarf_fill_in_attr_form(dn,abbrevdata,idxattr_array,
 1596|      0|            form_array, array_size,error);
 1597|      0|        if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (1597:13): [True: 0, False: 0]
  ------------------
 1598|      0|            return res;
 1599|      0|        }
 1600|      0|    }
 1601|      0|    return DW_DLV_OK;
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
 1602|      0|}
dwarf_debugnames.c:read_a_name_table_header:
  363|     17|{
  364|     17|    Dwarf_Unsigned area_length = 0;
  365|     17|    Dwarf_Unsigned area_max_offset = 0;
  366|     17|    unsigned initial_length = 0; /*offset_size+local_ext */
  367|     17|    int offset_size = 0;
  368|     17|    int local_extension_size = 0;
  369|     17|    Dwarf_Small *end_dnames = 0; /* 1 past local table */
  370|     17|    Dwarf_Half version = 0;
  371|     17|    Dwarf_Half padding = 0;
  372|     17|    Dwarf_Unsigned comp_unit_count = 0;
  373|     17|    Dwarf_Unsigned local_type_unit_count = 0;
  374|     17|    Dwarf_Unsigned foreign_type_unit_count = 0;
  375|     17|    Dwarf_Unsigned bucket_count = 0;
  376|     17|    Dwarf_Unsigned name_count = 0;
  377|     17|    Dwarf_Unsigned abbrev_table_size = 0; /* bytes */
  378|     17|    Dwarf_Unsigned entry_pool_size = 0; /* bytes */
  379|     17|    Dwarf_Unsigned augmentation_string_size = 0; /* bytes */
  380|     17|    Dwarf_Unsigned usedspace = 0;
  381|     17|    Dwarf_Unsigned totaloffset = 0;
  382|     17|    int res = 0;
  383|     17|    const char *str_utf8 = 0; /* Augmentation string */
  384|     17|    Dwarf_Small *curptr = 0;
  385|     17|    Dwarf_Debug dbg = dn->dn_dbg;
  386|       |
  387|     17|    curptr = curptr_in;
  388|     17|    usedspace = 0;
  389|     17|    totaloffset = starting_offset;
  390|       |    /* 1 */
  391|     17|    READ_AREA_LENGTH_CK(dbg, area_length, Dwarf_Unsigned,
  ------------------
  |  |  314|     17|    do {                                                       \
  |  |  315|     17|        READ_UNALIGNED_CK(r_dbg,w_target,r_targtype,     \
  |  |  ------------------
  |  |  |  |  245|     17|    do  {                                        \
  |  |  |  |  246|     17|        desttype _ltmp = 0;                      \
  |  |  |  |  247|     17|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  |  |  248|     17|        if (readend < (source)) {                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (248:13): [True: 0, False: 17]
  |  |  |  |  ------------------
  |  |  |  |  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|     17|        if (readend > (endptr)) {                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (255:13): [True: 0, False: 17]
  |  |  |  |  ------------------
  |  |  |  |  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|     17|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  |  |  263|     17|            (source), (unsigned long)(length)) ; \
  |  |  |  |  264|     17|        (dest) = _ltmp;                          \
  |  |  |  |  265|     17|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (265:14): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  316|     17|            rw_src_data_p, ORIGINAL_DWARF_OFFSET_SIZE,         \
  |  |  317|     17|            w_error,r_endptr);                               \
  |  |  318|     17|        if ((w_target) == DISTINGUISHED_VALUE) {                \
  |  |  ------------------
  |  |  |  |  955|     17|#define DISTINGUISHED_VALUE  0xffffffff
  |  |  ------------------
  |  |  |  Branch (318:13): [True: 0, False: 17]
  |  |  ------------------
  |  |  319|      0|            /* dwarf3 64bit extension */                        \
  |  |  320|      0|            (w_length_size) = DISTINGUISHED_VALUE_OFFSET_SIZE;  \
  |  |  ------------------
  |  |  |  |  956|      0|#define DISTINGUISHED_VALUE_OFFSET_SIZE 8
  |  |  ------------------
  |  |  321|      0|            (rw_src_data_p) += ORIGINAL_DWARF_OFFSET_SIZE;      \
  |  |  ------------------
  |  |  |  |  952|      0|#define ORIGINAL_DWARF_OFFSET_SIZE  4
  |  |  ------------------
  |  |  322|      0|            (w_exten_size)  = ORIGINAL_DWARF_OFFSET_SIZE;       \
  |  |  ------------------
  |  |  |  |  952|      0|#define ORIGINAL_DWARF_OFFSET_SIZE  4
  |  |  ------------------
  |  |  323|      0|            READ_UNALIGNED_CK(r_dbg,w_target,r_targtype,  \
  |  |  ------------------
  |  |  |  |  245|      0|    do  {                                        \
  |  |  |  |  246|      0|        desttype _ltmp = 0;                      \
  |  |  |  |  247|      0|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  |  |  248|      0|        if (readend < (source)) {                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (248:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  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|      0|        if (readend > (endptr)) {                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (255:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  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|      0|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  |  |  263|      0|            (source), (unsigned long)(length)) ; \
  |  |  |  |  264|      0|        (dest) = _ltmp;                          \
  |  |  |  |  265|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (265:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  324|      0|                rw_src_data_p, DISTINGUISHED_VALUE_OFFSET_SIZE,\
  |  |  325|      0|                w_error,r_endptr);                         \
  |  |  326|      0|            if ((w_target) > (r_sectionlen)) {                 \
  |  |  ------------------
  |  |  |  Branch (326:17): [True: 0, False: 0]
  |  |  ------------------
  |  |  327|      0|                _dwarf_create_area_len_error((r_dbg),(w_error),\
  |  |  328|      0|                    (w_target),(r_sectionlen));                \
  |  |  329|      0|                return DW_DLV_ERROR;                           \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  330|      0|            }                                                  \
  |  |  331|      0|            (rw_src_data_p) += DISTINGUISHED_VALUE_OFFSET_SIZE;  \
  |  |  ------------------
  |  |  |  |  956|      0|#define DISTINGUISHED_VALUE_OFFSET_SIZE 8
  |  |  ------------------
  |  |  332|     17|        } else {                                               \
  |  |  333|     17|            if (!(w_target)  && (r_dbg)->de_big_endian_object) {\
  |  |  ------------------
  |  |  |  Branch (333:17): [True: 1, False: 16]
  |  |  |  Branch (333:33): [True: 0, False: 1]
  |  |  ------------------
  |  |  334|      0|                /* Might be IRIX: We have to distinguish between */\
  |  |  335|      0|                /* 32-bit DWARF format and IRIX 64-bit         \
  |  |  336|      0|                    DWARF format. */                           \
  |  |  337|      0|                if ((r_dbg)->de_length_size == 8) {            \
  |  |  ------------------
  |  |  |  Branch (337:21): [True: 0, False: 0]
  |  |  ------------------
  |  |  338|      0|                    /* IRIX 64 bit, big endian.  This test */  \
  |  |  339|      0|                    /* is not a truly precise test, a precise test*/ \
  |  |  340|      0|                    /* would check if the target was IRIX.  */ \
  |  |  341|      0|                    READ_UNALIGNED_CK(r_dbg, w_target ,      \
  |  |  ------------------
  |  |  |  |  245|      0|    do  {                                        \
  |  |  |  |  246|      0|        desttype _ltmp = 0;                      \
  |  |  |  |  247|      0|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  |  |  248|      0|        if (readend < (source)) {                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (248:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  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|      0|        if (readend > (endptr)) {                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (255:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  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|      0|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  |  |  263|      0|            (source), (unsigned long)(length)) ; \
  |  |  |  |  264|      0|        (dest) = _ltmp;                          \
  |  |  |  |  265|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (265:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  342|      0|                        r_targtype,                          \
  |  |  343|      0|                        rw_src_data_p,                       \
  |  |  344|      0|                        DISTINGUISHED_VALUE_OFFSET_SIZE,       \
  |  |  345|      0|                        (w_error),(r_endptr));                 \
  |  |  346|      0|                    if ((w_target) > (r_sectionlen)) {         \
  |  |  ------------------
  |  |  |  Branch (346:25): [True: 0, False: 0]
  |  |  ------------------
  |  |  347|      0|                        _dwarf_create_area_len_error((r_dbg),  \
  |  |  348|      0|                            (w_error),                         \
  |  |  349|      0|                            (w_target),(r_sectionlen));        \
  |  |  350|      0|                        return DW_DLV_ERROR;                   \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  351|      0|                    }                                          \
  |  |  352|      0|                    (w_length_size)  =                         \
  |  |  353|      0|                        DISTINGUISHED_VALUE_OFFSET_SIZE;       \
  |  |  ------------------
  |  |  |  |  956|      0|#define DISTINGUISHED_VALUE_OFFSET_SIZE 8
  |  |  ------------------
  |  |  354|      0|                    (rw_src_data_p) +=                         \
  |  |  355|      0|                        DISTINGUISHED_VALUE_OFFSET_SIZE;       \
  |  |  ------------------
  |  |  |  |  956|      0|#define DISTINGUISHED_VALUE_OFFSET_SIZE 8
  |  |  ------------------
  |  |  356|      0|                    (w_exten_size) = 0;                        \
  |  |  357|      0|                } else {                                       \
  |  |  358|      0|                    /* 32 bit, big endian */                   \
  |  |  359|      0|                    (w_length_size)  = ORIGINAL_DWARF_OFFSET_SIZE;\
  |  |  ------------------
  |  |  |  |  952|      0|#define ORIGINAL_DWARF_OFFSET_SIZE  4
  |  |  ------------------
  |  |  360|      0|                    (rw_src_data_p) += (w_length_size);        \
  |  |  361|      0|                    (w_exten_size) = 0;                        \
  |  |  362|      0|                }                                              \
  |  |  363|     17|            } else {                                           \
  |  |  364|     17|                if ((w_target) > (r_sectionlen)) {               \
  |  |  ------------------
  |  |  |  Branch (364:21): [True: 2, False: 15]
  |  |  ------------------
  |  |  365|      2|                    _dwarf_create_area_len_error((r_dbg),      \
  |  |  366|      2|                        (w_error),                             \
  |  |  367|      2|                        (w_target),(r_sectionlen));            \
  |  |  368|      2|                    return DW_DLV_ERROR;                       \
  |  |  ------------------
  |  |  |  |  123|      2|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  369|      2|                }                                              \
  |  |  370|     17|                /* Standard 32 bit dwarf2/dwarf3 */            \
  |  |  371|     17|                (w_exten_size)   = 0;                          \
  |  |  372|     15|                (w_length_size)  = ORIGINAL_DWARF_OFFSET_SIZE; \
  |  |  ------------------
  |  |  |  |  952|     15|#define ORIGINAL_DWARF_OFFSET_SIZE  4
  |  |  ------------------
  |  |  373|     15|                (rw_src_data_p) += (w_length_size);            \
  |  |  374|     15|            }                                                  \
  |  |  375|     17|        }                                                      \
  |  |  376|     17|    } while (0)
  |  |  ------------------
  |  |  |  Branch (376:14): [Folded, False: 15]
  |  |  ------------------
  ------------------
  392|     17|        curptr, offset_size,
  393|     17|        local_extension_size,error,
  394|     17|        remaining_space,end_section);
  395|     15|    initial_length =  offset_size+local_extension_size;
  396|       |
  397|       |    /* curptr now points past the length field */
  398|     15|    area_max_offset = area_length + initial_length;
  399|     15|    usedspace = initial_length;
  400|     15|    totaloffset += initial_length;
  401|     15|    dn->dn_offset_size = (Dwarf_Half)offset_size;
  402|       |    /* Two stage length test so overflow is caught. */
  403|     15|    if (area_length > remaining_space ||
  ------------------
  |  Branch (403:9): [True: 0, False: 15]
  ------------------
  404|     15|        (area_length +offset_size +local_extension_size) >
  ------------------
  |  Branch (404:9): [True: 0, False: 15]
  ------------------
  405|     15|        remaining_space) {
  406|      0|        _dwarf_error_string(dbg, error,
  407|      0|            DW_DLE_DEBUG_NAMES_HEADER_ERROR,
  ------------------
  |  | 1418|      0|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  ------------------
  408|      0|            "DW_DLE_DEBUG_NAMES_HEADER_ERROR: "
  409|      0|            "The index table runs off the end of the .debug_names "
  410|      0|            "section. Corrupt data.");
  411|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  412|      0|    }
  413|     15|    if (area_max_offset > remaining_space) {
  ------------------
  |  Branch (413:9): [True: 0, False: 15]
  ------------------
  414|      0|        _dwarf_error_string(dbg, error,
  415|      0|            DW_DLE_DEBUG_NAMES_HEADER_ERROR,
  ------------------
  |  | 1418|      0|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  ------------------
  416|      0|            "DW_DLE_DEBUG_NAMES_HEADER_ERROR: "
  417|      0|            "The index table runs off the end of the .debug_names "
  418|      0|            "section... Corrupt data.");
  419|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  420|      0|    }
  421|     15|    end_dnames = curptr + area_length;
  422|     15|    dn->dn_unit_length = area_length + local_extension_size;
  423|     15|    dn->dn_indextable_data_end = end_dnames;
  424|     15|    dn->dn_next_set_offset = area_length
  425|     15|        + initial_length +
  426|     15|        + starting_offset;
  427|       |
  428|       |    /* 2 */
  429|     15|    READ_UNALIGNED_CK(dbg, version, Dwarf_Half,
  ------------------
  |  |  245|     15|    do  {                                        \
  |  |  246|     15|        desttype _ltmp = 0;                      \
  |  |  247|     15|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|     15|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 15]
  |  |  ------------------
  |  |  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|     15|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 1, False: 14]
  |  |  ------------------
  |  |  256|      1|            _dwarf_error_string((dbg), (error),  \
  |  |  257|      1|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      1|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  258|      1|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  259|      1|                "Read would end past the end of section");\
  |  |  260|      1|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      1|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  261|      1|        }                                        \
  |  |  262|     15|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|     14|            (source), (unsigned long)(length)) ; \
  |  |  264|     14|        (dest) = _ltmp;                          \
  |  |  265|     14|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 14]
  |  |  ------------------
  ------------------
  430|     15|        curptr, DWARF_HALF_SIZE,
  431|     15|        error,end_dnames);
  432|     14|    curptr += DWARF_HALF_SIZE;
  ------------------
  |  |  132|     14|#define DWARF_HALF_SIZE  2
  ------------------
  433|     14|    usedspace += DWARF_HALF_SIZE;
  ------------------
  |  |  132|     14|#define DWARF_HALF_SIZE  2
  ------------------
  434|     14|    totaloffset += DWARF_HALF_SIZE;
  ------------------
  |  |  132|     14|#define DWARF_HALF_SIZE  2
  ------------------
  435|     14|    if (curptr >= end_dnames) {
  ------------------
  |  Branch (435:9): [True: 0, False: 14]
  ------------------
  436|      0|        _dwarf_error(dbg, error,DW_DLE_DEBUG_NAMES_HEADER_ERROR);
  ------------------
  |  | 1418|      0|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  ------------------
  437|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  438|      0|    }
  439|     14|    if (version != DWARF_DNAMES_VERSION5) {
  ------------------
  |  |   48|     14|#define DWARF_DNAMES_VERSION5 5
  ------------------
  |  Branch (439:9): [True: 0, False: 14]
  ------------------
  440|      0|        _dwarf_error(dbg, error, DW_DLE_VERSION_STAMP_ERROR);
  ------------------
  |  | 1093|      0|#define DW_DLE_VERSION_STAMP_ERROR              48
  ------------------
  441|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  442|      0|    }
  443|       |    /* 3 */
  444|     14|    READ_UNALIGNED_CK(dbg, padding, Dwarf_Half,
  ------------------
  |  |  245|     14|    do  {                                        \
  |  |  246|     14|        desttype _ltmp = 0;                      \
  |  |  247|     14|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|     14|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 14]
  |  |  ------------------
  |  |  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|     14|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 0, False: 14]
  |  |  ------------------
  |  |  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|     14|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|     14|            (source), (unsigned long)(length)) ; \
  |  |  264|     14|        (dest) = _ltmp;                          \
  |  |  265|     14|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 14]
  |  |  ------------------
  ------------------
  445|     14|        curptr, DWARF_HALF_SIZE,
  446|     14|        error,end_dnames);
  447|     14|    curptr += DWARF_HALF_SIZE;
  ------------------
  |  |  132|     14|#define DWARF_HALF_SIZE  2
  ------------------
  448|     14|    usedspace += DWARF_HALF_SIZE;
  ------------------
  |  |  132|     14|#define DWARF_HALF_SIZE  2
  ------------------
  449|     14|    totaloffset += DWARF_HALF_SIZE;
  ------------------
  |  |  132|     14|#define DWARF_HALF_SIZE  2
  ------------------
  450|     14|    if (curptr >= end_dnames) {
  ------------------
  |  Branch (450:9): [True: 0, False: 14]
  ------------------
  451|      0|        _dwarf_error(dbg, error,DW_DLE_DEBUG_NAMES_HEADER_ERROR);
  ------------------
  |  | 1418|      0|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  ------------------
  452|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  453|      0|    }
  454|     14|    if (padding) {
  ------------------
  |  Branch (454:9): [True: 0, False: 14]
  ------------------
  455|      0|        _dwarf_error(dbg, error,DW_DLE_DEBUG_NAMES_HEADER_ERROR);
  ------------------
  |  | 1418|      0|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  ------------------
  456|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  457|      0|    }
  458|       |    /* 4 */
  459|     14|    res = read_uword_val(dbg, &curptr,
  460|     14|        end_dnames, DW_DLE_DEBUG_NAMES_HEADER_ERROR,
  ------------------
  |  | 1418|     14|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  ------------------
  461|     14|        &comp_unit_count,area_max_offset,error);
  462|     14|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     14|#define DW_DLV_OK        0
  ------------------
  |  Branch (462:9): [True: 0, False: 14]
  ------------------
  463|      0|        return res;
  464|      0|    }
  465|     14|    if (comp_unit_count > dn->dn_section_size) {
  ------------------
  |  Branch (465:9): [True: 0, False: 14]
  ------------------
  466|      0|        _dwarf_error_string(dbg,error,
  467|      0|            DW_DLE_DEBUG_NAMES_ERROR,
  ------------------
  |  | 1530|      0|#define DW_DLE_DEBUG_NAMES_ERROR               484
  ------------------
  468|      0|            "DW_DLE_DEBUG_NAMES_ERROR comp_unit_count too large");
  469|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  470|      0|    }
  471|     14|    dn->dn_comp_unit_count = comp_unit_count;
  472|     14|    usedspace += SIZEOFT32;
  ------------------
  |  |   41|     14|#define SIZEOFT32 4
  ------------------
  473|     14|    totaloffset +=  SIZEOFT32;
  ------------------
  |  |   41|     14|#define SIZEOFT32 4
  ------------------
  474|       |    /* 5 */
  475|     14|    res = read_uword_val(dbg, &curptr,
  476|     14|        end_dnames, DW_DLE_DEBUG_NAMES_HEADER_ERROR,
  ------------------
  |  | 1418|     14|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  ------------------
  477|     14|        &local_type_unit_count,area_max_offset,error);
  478|     14|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     14|#define DW_DLV_OK        0
  ------------------
  |  Branch (478:9): [True: 0, False: 14]
  ------------------
  479|      0|        return res;
  480|      0|    }
  481|     14|    if (local_type_unit_count >  dn->dn_section_size) {
  ------------------
  |  Branch (481:9): [True: 0, False: 14]
  ------------------
  482|      0|        _dwarf_error_string(dbg,error,
  483|      0|            DW_DLE_DEBUG_NAMES_ERROR,
  ------------------
  |  | 1530|      0|#define DW_DLE_DEBUG_NAMES_ERROR               484
  ------------------
  484|      0|            "DW_DLE_DEBUG_NAMES_ERROR local_type_unit_count large");
  485|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  486|      0|    }
  487|     14|    dn->dn_local_type_unit_count = local_type_unit_count;
  488|     14|    usedspace += SIZEOFT32;
  ------------------
  |  |   41|     14|#define SIZEOFT32 4
  ------------------
  489|     14|    totaloffset +=  SIZEOFT32;
  ------------------
  |  |   41|     14|#define SIZEOFT32 4
  ------------------
  490|       |
  491|       |    /* 6 */
  492|     14|    res = read_uword_val(dbg, &curptr,
  493|     14|        end_dnames, DW_DLE_DEBUG_NAMES_HEADER_ERROR,
  ------------------
  |  | 1418|     14|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  ------------------
  494|     14|        &foreign_type_unit_count,area_max_offset,error);
  495|     14|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     14|#define DW_DLV_OK        0
  ------------------
  |  Branch (495:9): [True: 0, False: 14]
  ------------------
  496|      0|        return res;
  497|      0|    }
  498|     14|    if (foreign_type_unit_count >  dn->dn_section_size) {
  ------------------
  |  Branch (498:9): [True: 0, False: 14]
  ------------------
  499|      0|        _dwarf_error_string(dbg,error,
  500|      0|            DW_DLE_DEBUG_NAMES_ERROR,
  ------------------
  |  | 1530|      0|#define DW_DLE_DEBUG_NAMES_ERROR               484
  ------------------
  501|      0|            "DW_DLE_DEBUG_NAMES_ERROR: "
  502|      0|            "foreign_type_unit_count large");
  503|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  504|      0|    }
  505|     14|    dn->dn_foreign_type_unit_count = foreign_type_unit_count;
  506|     14|    usedspace += SIZEOFT32;
  ------------------
  |  |   41|     14|#define SIZEOFT32 4
  ------------------
  507|     14|    totaloffset += SIZEOFT32;
  ------------------
  |  |   41|     14|#define SIZEOFT32 4
  ------------------
  508|       |    /* 7 */
  509|     14|    res = read_uword_val(dbg, &curptr,
  510|     14|        end_dnames, DW_DLE_DEBUG_NAMES_HEADER_ERROR,
  ------------------
  |  | 1418|     14|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  ------------------
  511|     14|        &bucket_count,area_max_offset,error);
  512|     14|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     14|#define DW_DLV_OK        0
  ------------------
  |  Branch (512:9): [True: 0, False: 14]
  ------------------
  513|      0|        return res;
  514|      0|    }
  515|     14|    if (bucket_count > dn->dn_section_size) {
  ------------------
  |  Branch (515:9): [True: 0, False: 14]
  ------------------
  516|      0|        _dwarf_error_string(dbg,error,
  517|      0|            DW_DLE_DEBUG_NAMES_ERROR,
  ------------------
  |  | 1530|      0|#define DW_DLE_DEBUG_NAMES_ERROR               484
  ------------------
  518|      0|            "DW_DLE_DEBUG_NAMES_ERROR bucketcount too large");
  519|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  520|      0|    }
  521|     14|    dn->dn_bucket_count = bucket_count;
  522|     14|    usedspace += SIZEOFT32;
  ------------------
  |  |   41|     14|#define SIZEOFT32 4
  ------------------
  523|     14|    totaloffset += SIZEOFT32;
  ------------------
  |  |   41|     14|#define SIZEOFT32 4
  ------------------
  524|       |    /*  name_count gives the size of
  525|       |        the string-offsets and entry-offsets arrays,
  526|       |        and if hashes present, the size of the hashes
  527|       |        array. */
  528|       |    /* 8 */
  529|     14|    res = read_uword_val(dbg, &curptr,
  530|     14|        end_dnames, DW_DLE_DEBUG_NAMES_HEADER_ERROR,
  ------------------
  |  | 1418|     14|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  ------------------
  531|     14|        &name_count,area_max_offset,error);
  532|     14|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     14|#define DW_DLV_OK        0
  ------------------
  |  Branch (532:9): [True: 0, False: 14]
  ------------------
  533|      0|        return res;
  534|      0|    }
  535|     14|    dn->dn_name_count = name_count;
  536|     14|    if (name_count > dn->dn_section_size) {
  ------------------
  |  Branch (536:9): [True: 0, False: 14]
  ------------------
  537|      0|        _dwarf_error_string(dbg,error,
  538|      0|            DW_DLE_DEBUG_NAMES_ERROR,
  ------------------
  |  | 1530|      0|#define DW_DLE_DEBUG_NAMES_ERROR               484
  ------------------
  539|      0|            "DW_DLE_DEBUG_NAMES_ERROR name_count too large");
  540|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  541|      0|    }
  542|     14|    usedspace += SIZEOFT32;
  ------------------
  |  |   41|     14|#define SIZEOFT32 4
  ------------------
  543|     14|    totaloffset += SIZEOFT32;
  ------------------
  |  |   41|     14|#define SIZEOFT32 4
  ------------------
  544|       |
  545|       |    /*  abbrev_table */
  546|       |    /* 9 */
  547|     14|    res = read_uword_val(dbg, &curptr,
  548|     14|        end_dnames, DW_DLE_DEBUG_NAMES_HEADER_ERROR,
  ------------------
  |  | 1418|     14|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  ------------------
  549|     14|        &abbrev_table_size,area_max_offset,error);
  550|     14|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     14|#define DW_DLV_OK        0
  ------------------
  |  Branch (550:9): [True: 0, False: 14]
  ------------------
  551|      0|        return res;
  552|      0|    }
  553|     14|    if (abbrev_table_size > dn->dn_section_size) {
  ------------------
  |  Branch (553:9): [True: 0, False: 14]
  ------------------
  554|      0|        _dwarf_error_string(dbg,error,
  555|      0|            DW_DLE_DEBUG_NAMES_ERROR,
  ------------------
  |  | 1530|      0|#define DW_DLE_DEBUG_NAMES_ERROR               484
  ------------------
  556|      0|            "DW_DLE_DEBUG_NAMES_ERROR abbrev_table_size too large");
  557|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  558|      0|    }
  559|     14|    dn->dn_abbrev_table_size = abbrev_table_size;
  560|     14|    usedspace += SIZEOFT32;
  ------------------
  |  |   41|     14|#define SIZEOFT32 4
  ------------------
  561|     14|    totaloffset += SIZEOFT32;
  ------------------
  |  |   41|     14|#define SIZEOFT32 4
  ------------------
  562|       |
  563|       |    /* 10 */
  564|     14|    res = read_uword_val(dbg, &curptr,
  565|     14|        end_dnames, DW_DLE_DEBUG_NAMES_HEADER_ERROR,
  ------------------
  |  | 1418|     14|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  ------------------
  566|     14|        &augmentation_string_size,area_max_offset,error);
  567|     14|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     14|#define DW_DLV_OK        0
  ------------------
  |  Branch (567:9): [True: 0, False: 14]
  ------------------
  568|      0|        return res;
  569|      0|    }
  570|     14|    if (augmentation_string_size > dn->dn_section_size) {
  ------------------
  |  Branch (570:9): [True: 0, False: 14]
  ------------------
  571|      0|        _dwarf_error_string(dbg,error,
  572|      0|            DW_DLE_DEBUG_NAMES_ERROR,
  ------------------
  |  | 1530|      0|#define DW_DLE_DEBUG_NAMES_ERROR               484
  ------------------
  573|      0|            "DW_DLE_DEBUG_NAMES_ERROR augmentation string too long");
  574|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  575|      0|    }
  576|     14|    usedspace += SIZEOFT32;
  ------------------
  |  |   41|     14|#define SIZEOFT32 4
  ------------------
  577|     14|    totaloffset += SIZEOFT32;
  ------------------
  |  |   41|     14|#define SIZEOFT32 4
  ------------------
  578|       |
  579|     14|    str_utf8 = (const char *) curptr;
  580|     14|    totaloffset += augmentation_string_size;
  581|     14|    usedspace += augmentation_string_size;
  582|     14|    curptr += augmentation_string_size;
  583|     14|    dn->dn_augmentation_string_size = augmentation_string_size;
  584|     14|    if (curptr >= end_dnames) {
  ------------------
  |  Branch (584:9): [True: 0, False: 14]
  ------------------
  585|      0|        _dwarf_error(dbg, error,DW_DLE_DEBUG_NAMES_HEADER_ERROR);
  ------------------
  |  | 1418|      0|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  ------------------
  586|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  587|      0|    }
  588|       |
  589|     14|    dn->dn_version = version;
  590|     14|    dn->dn_abbrev_table_size = abbrev_table_size;
  591|     14|    if (augmentation_string_size) {
  ------------------
  |  Branch (591:9): [True: 5, False: 9]
  ------------------
  592|       |        /*  11. len: The string size includes zero or
  593|       |            more NUL bytes to be a multiple of
  594|       |            four bytes long. */
  595|      5|        Dwarf_Unsigned len = augmentation_string_size;
  596|      5|        const char *cp = 0;
  597|      5|        const char *cpend = 0;
  598|      5|        Dwarf_Unsigned finallen = 0;
  599|       |
  600|      5|        dn->dn_augmentation_string = calloc(1,
  601|      5|            augmentation_string_size + 1);
  602|       |        /* Ensures a final NUL byte */
  603|      5|        _dwarf_safe_strcpy(dn->dn_augmentation_string,
  604|      5|            len +1,str_utf8, len);
  605|       |        /* This validates a zero length string too. */
  606|       |        /* in LLVM0700 there is no NUL terminator there:
  607|       |            See DWARF5 page 144 and also ISSUE
  608|       |            200505.4 */
  609|      5|        cp = dn->dn_augmentation_string;
  610|      5|        cpend = cp + len;
  611|       |        /* It's null terminated now, so find the true length */
  612|      5|        for ( ; cp<cpend; ++cp) {
  ------------------
  |  Branch (612:17): [True: 5, False: 0]
  ------------------
  613|      5|            if (!*cp) {
  ------------------
  |  Branch (613:17): [True: 5, False: 0]
  ------------------
  614|      5|                break;
  615|      5|            }
  616|      0|            ++finallen;
  617|      0|        }
  618|      5|        if (len%4) {
  ------------------
  |  Branch (618:13): [True: 2, False: 3]
  ------------------
  619|      2|            dwarfstring m;
  620|       |
  621|      2|            dwarfstring_constructor(&m);
  622|      2|            dwarfstring_append_printf_u(&m,
  623|      2|                "DW_DLE_DEBUG_NAMES_PAD_NON_ZERO: "
  624|      2|                "The augmentation_string_size "
  625|      2|                " is %u, not a multiple of four",len);
  626|      2|            _dwarf_error_string(dbg, error,
  627|      2|                DW_DLE_DEBUG_NAMES_PAD_NON_ZERO,
  ------------------
  |  | 1420|      2|#define DW_DLE_DEBUG_NAMES_PAD_NON_ZERO        374
  ------------------
  628|      2|                dwarfstring_string(&m));
  629|      2|            dwarfstring_destructor(&m);
  630|      2|            return DW_DLV_ERROR;
  ------------------
  |  |  123|      2|#define DW_DLV_ERROR     1
  ------------------
  631|      2|        }
  632|      3|        if (finallen != len) {
  ------------------
  |  Branch (632:13): [True: 3, False: 0]
  ------------------
  633|      3|            cp = str_utf8 + finallen;
  634|      3|            cpend = str_utf8+len;
  635|       |            /*  Ensure that there is no corruption in
  636|       |                the padding. */
  637|     18|            for ( ; cp < cpend; ++cp) {
  ------------------
  |  Branch (637:21): [True: 18, False: 0]
  ------------------
  638|     18|                if (*cp) {
  ------------------
  |  Branch (638:21): [True: 3, False: 15]
  ------------------
  639|      3|                    _dwarf_error_string(dbg, error,
  640|      3|                        DW_DLE_DEBUG_NAMES_PAD_NON_ZERO,
  ------------------
  |  | 1420|      3|#define DW_DLE_DEBUG_NAMES_PAD_NON_ZERO        374
  ------------------
  641|      3|                        "DW_DLE_DEBUG_NAMES_PAD_NON_ZERO: "
  642|      3|                        "padding in augmentation string not zeros");
  643|      3|                    return DW_DLV_ERROR;
  ------------------
  |  |  123|      3|#define DW_DLV_ERROR     1
  ------------------
  644|      3|                }
  645|     18|            }
  646|      3|        }
  647|      3|    }
  648|       |
  649|       |    /*  Now we deal with the arrays following the header. */
  650|      9|    dn->dn_cu_list = curptr;
  651|      9|    dn->dn_cu_list_offset = usedspace;
  652|      9|    curptr +=  dn->dn_offset_size * comp_unit_count;
  653|      9|    usedspace += dn->dn_offset_size * comp_unit_count ;
  654|      9|    totaloffset += dn->dn_offset_size * comp_unit_count ;
  655|      9|    VALIDATEOFFSET(dn,totaloffset,"comp_unit array error");
  ------------------
  |  |  343|      9|    do {                                            \
  |  |  344|      9|        if ((used) >= (dnm)->dn_next_set_offset) {  \
  |  |  ------------------
  |  |  |  Branch (344:13): [True: 0, False: 9]
  |  |  ------------------
  |  |  345|      0|            _dwarf_error_string(dbg, error,         \
  |  |  346|      0|                DW_DLE_DEBUG_NAMES_HEADER_ERROR,    \
  |  |  ------------------
  |  |  |  | 1418|      0|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  |  |  ------------------
  |  |  347|      0|                "DW_DLE_DEBUG_NAMES_HEADER_ERROR: " \
  |  |  348|      0|                m);                                 \
  |  |  349|      0|            return DW_DLV_ERROR;                    \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  350|      0|        }                                           \
  |  |  351|      9|    } while(0)
  |  |  ------------------
  |  |  |  Branch (351:13): [Folded, False: 9]
  |  |  ------------------
  ------------------
  656|       |
  657|      9|    dn->dn_local_tu_list = curptr;
  658|      9|    dn->dn_local_tu_list_offset = usedspace;
  659|      9|    curptr +=  dn->dn_offset_size *local_type_unit_count;
  660|      9|    usedspace += dn->dn_offset_size* local_type_unit_count;
  661|      9|    totaloffset += dn->dn_offset_size* local_type_unit_count;
  662|      9|    VALIDATEOFFSET(dn,totaloffset,"local_type__unit array error");
  ------------------
  |  |  343|      9|    do {                                            \
  |  |  344|      9|        if ((used) >= (dnm)->dn_next_set_offset) {  \
  |  |  ------------------
  |  |  |  Branch (344:13): [True: 0, False: 9]
  |  |  ------------------
  |  |  345|      0|            _dwarf_error_string(dbg, error,         \
  |  |  346|      0|                DW_DLE_DEBUG_NAMES_HEADER_ERROR,    \
  |  |  ------------------
  |  |  |  | 1418|      0|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  |  |  ------------------
  |  |  347|      0|                "DW_DLE_DEBUG_NAMES_HEADER_ERROR: " \
  |  |  348|      0|                m);                                 \
  |  |  349|      0|            return DW_DLV_ERROR;                    \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  350|      0|        }                                           \
  |  |  351|      9|    } while(0)
  |  |  ------------------
  |  |  |  Branch (351:13): [Folded, False: 9]
  |  |  ------------------
  ------------------
  663|       |
  664|      9|    dn->dn_foreign_tu_list = curptr;
  665|      9|    dn->dn_foreign_tu_list_offset = usedspace;
  666|      9|    curptr += sizeof(Dwarf_Sig8)     * foreign_type_unit_count;
  667|      9|    usedspace += sizeof(Dwarf_Sig8)  * foreign_type_unit_count;
  668|      9|    totaloffset += sizeof(Dwarf_Sig8)* foreign_type_unit_count;
  669|      9|    VALIDATEOFFSET(dn,totaloffset,"foreign_type__unit array error");
  ------------------
  |  |  343|      9|    do {                                            \
  |  |  344|      9|        if ((used) >= (dnm)->dn_next_set_offset) {  \
  |  |  ------------------
  |  |  |  Branch (344:13): [True: 0, False: 9]
  |  |  ------------------
  |  |  345|      0|            _dwarf_error_string(dbg, error,         \
  |  |  346|      0|                DW_DLE_DEBUG_NAMES_HEADER_ERROR,    \
  |  |  ------------------
  |  |  |  | 1418|      0|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  |  |  ------------------
  |  |  347|      0|                "DW_DLE_DEBUG_NAMES_HEADER_ERROR: " \
  |  |  348|      0|                m);                                 \
  |  |  349|      0|            return DW_DLV_ERROR;                    \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  350|      0|        }                                           \
  |  |  351|      9|    } while(0)
  |  |  ------------------
  |  |  |  Branch (351:13): [Folded, False: 9]
  |  |  ------------------
  ------------------
  670|       |
  671|      9|    dn->dn_buckets_offset = usedspace;
  672|      9|    dn->dn_buckets = curptr;
  673|      9|    curptr +=  SIZEOFT32 * bucket_count ;
  ------------------
  |  |   41|      9|#define SIZEOFT32 4
  ------------------
  674|      9|    usedspace += SIZEOFT32 * bucket_count;
  ------------------
  |  |   41|      9|#define SIZEOFT32 4
  ------------------
  675|      9|    totaloffset += SIZEOFT32 * bucket_count;
  ------------------
  |  |   41|      9|#define SIZEOFT32 4
  ------------------
  676|      9|    VALIDATEOFFSET(dn,totaloffset," bucket array error");
  ------------------
  |  |  343|      9|    do {                                            \
  |  |  344|      9|        if ((used) >= (dnm)->dn_next_set_offset) {  \
  |  |  ------------------
  |  |  |  Branch (344:13): [True: 0, False: 9]
  |  |  ------------------
  |  |  345|      0|            _dwarf_error_string(dbg, error,         \
  |  |  346|      0|                DW_DLE_DEBUG_NAMES_HEADER_ERROR,    \
  |  |  ------------------
  |  |  |  | 1418|      0|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  |  |  ------------------
  |  |  347|      0|                "DW_DLE_DEBUG_NAMES_HEADER_ERROR: " \
  |  |  348|      0|                m);                                 \
  |  |  349|      0|            return DW_DLV_ERROR;                    \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  350|      0|        }                                           \
  |  |  351|      9|    } while(0)
  |  |  ------------------
  |  |  |  Branch (351:13): [Folded, False: 9]
  |  |  ------------------
  ------------------
  677|       |
  678|      9|    if (comp_unit_count == 1) {
  ------------------
  |  Branch (678:9): [True: 1, False: 8]
  ------------------
  679|      1|        Dwarf_Small *ptrx     = dn->dn_cu_list;
  680|      1|        Dwarf_Small *endptr   = dn->dn_foreign_tu_list;
  681|      1|        Dwarf_Unsigned unit_entry_size = dn->dn_offset_size;
  682|      1|        Dwarf_Unsigned offsetval = 0;
  683|       |
  684|      1|        READ_UNALIGNED_CK(dbg, offsetval, Dwarf_Unsigned,
  ------------------
  |  |  245|      1|    do  {                                        \
  |  |  246|      1|        desttype _ltmp = 0;                      \
  |  |  247|      1|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|      1|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 1]
  |  |  ------------------
  |  |  249|      0|            _dwarf_error_string((dbg), (error),  \
  |  |  250|      0|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      0|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  251|      0|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  252|      0|                "Read starts past the end of section");\
  |  |  253|      0|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  254|      0|        }                                        \
  |  |  255|      1|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 0, False: 1]
  |  |  ------------------
  |  |  256|      0|            _dwarf_error_string((dbg), (error),  \
  |  |  257|      0|                DW_DLE_READ_LITTLEENDIAN_ERROR,  \
  |  |  ------------------
  |  |  |  | 1377|      0|#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
  |  |  ------------------
  |  |  258|      0|                "DW_DLE_READ_LITTLEENDIAN_ERROR "\
  |  |  259|      0|                "Read would end past the end of section");\
  |  |  260|      0|            return DW_DLV_ERROR;                 \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  261|      0|        }                                        \
  |  |  262|      1|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|      1|            (source), (unsigned long)(length)) ; \
  |  |  264|      1|        (dest) = _ltmp;                          \
  |  |  265|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
  685|      1|            ptrx,(unsigned long) unit_entry_size,
  686|      1|            error,endptr);
  687|      1|        dn->dn_single_cu = TRUE;
  ------------------
  |  |   33|      1|#define TRUE 1
  ------------------
  688|      1|        dn->dn_single_cu_offset = offsetval;
  689|      1|    }
  690|      9|    dn->dn_hash_table = curptr;
  691|      9|    dn->dn_hash_table_offset = usedspace;
  692|      9|    if (bucket_count) {
  ------------------
  |  Branch (692:9): [True: 9, False: 0]
  ------------------
  693|      9|        curptr +=  SIZEOFT32 * name_count;
  ------------------
  |  |   41|      9|#define SIZEOFT32 4
  ------------------
  694|      9|        usedspace += SIZEOFT32 * name_count;
  ------------------
  |  |   41|      9|#define SIZEOFT32 4
  ------------------
  695|      9|        totaloffset += SIZEOFT32 * name_count;
  ------------------
  |  |   41|      9|#define SIZEOFT32 4
  ------------------
  696|      9|    }
  697|      9|    VALIDATEOFFSET(dn,totaloffset,"hashes array error");
  ------------------
  |  |  343|      9|    do {                                            \
  |  |  344|      9|        if ((used) >= (dnm)->dn_next_set_offset) {  \
  |  |  ------------------
  |  |  |  Branch (344:13): [True: 1, False: 8]
  |  |  ------------------
  |  |  345|      1|            _dwarf_error_string(dbg, error,         \
  |  |  346|      1|                DW_DLE_DEBUG_NAMES_HEADER_ERROR,    \
  |  |  ------------------
  |  |  |  | 1418|      1|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  |  |  ------------------
  |  |  347|      1|                "DW_DLE_DEBUG_NAMES_HEADER_ERROR: " \
  |  |  348|      1|                m);                                 \
  |  |  349|      1|            return DW_DLV_ERROR;                    \
  |  |  ------------------
  |  |  |  |  123|      1|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  350|      1|        }                                           \
  |  |  351|      9|    } while(0)
  |  |  ------------------
  |  |  |  Branch (351:13): [Folded, False: 8]
  |  |  ------------------
  ------------------
  698|       |
  699|      8|    dn->dn_string_offsets = curptr;
  700|      8|    dn->dn_string_offsets_offset = usedspace;
  701|      8|    curptr +=  dn->dn_offset_size * name_count;
  702|      8|    usedspace += dn->dn_offset_size * name_count;
  703|      8|    totaloffset += dn->dn_offset_size * name_count;
  704|      8|    VALIDATEOFFSET(dn,totaloffset,"string offsets array error");
  ------------------
  |  |  343|      8|    do {                                            \
  |  |  344|      8|        if ((used) >= (dnm)->dn_next_set_offset) {  \
  |  |  ------------------
  |  |  |  Branch (344:13): [True: 0, False: 8]
  |  |  ------------------
  |  |  345|      0|            _dwarf_error_string(dbg, error,         \
  |  |  346|      0|                DW_DLE_DEBUG_NAMES_HEADER_ERROR,    \
  |  |  ------------------
  |  |  |  | 1418|      0|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  |  |  ------------------
  |  |  347|      0|                "DW_DLE_DEBUG_NAMES_HEADER_ERROR: " \
  |  |  348|      0|                m);                                 \
  |  |  349|      0|            return DW_DLV_ERROR;                    \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  350|      0|        }                                           \
  |  |  351|      8|    } while(0)
  |  |  ------------------
  |  |  |  Branch (351:13): [Folded, False: 8]
  |  |  ------------------
  ------------------
  705|       |
  706|      8|    dn->dn_entry_offsets = curptr;
  707|      8|    dn->dn_entry_offsets_offset = usedspace;
  708|      8|    curptr +=  dn->dn_offset_size * name_count;
  709|      8|    usedspace += dn->dn_offset_size * name_count;
  710|      8|    totaloffset += dn->dn_offset_size * name_count;
  711|      8|    VALIDATEOFFSET(dn,totaloffset,"entry offsets array error");
  ------------------
  |  |  343|      8|    do {                                            \
  |  |  344|      8|        if ((used) >= (dnm)->dn_next_set_offset) {  \
  |  |  ------------------
  |  |  |  Branch (344:13): [True: 1, False: 7]
  |  |  ------------------
  |  |  345|      1|            _dwarf_error_string(dbg, error,         \
  |  |  346|      1|                DW_DLE_DEBUG_NAMES_HEADER_ERROR,    \
  |  |  ------------------
  |  |  |  | 1418|      1|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  |  |  ------------------
  |  |  347|      1|                "DW_DLE_DEBUG_NAMES_HEADER_ERROR: " \
  |  |  348|      1|                m);                                 \
  |  |  349|      1|            return DW_DLV_ERROR;                    \
  |  |  ------------------
  |  |  |  |  123|      1|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  350|      1|        }                                           \
  |  |  351|      8|    } while(0)
  |  |  ------------------
  |  |  |  Branch (351:13): [Folded, False: 7]
  |  |  ------------------
  ------------------
  712|       |
  713|      7|    dn->dn_abbrevs = curptr;
  714|      7|    dn->dn_abbrevs_offset = totaloffset;
  715|      7|    VALIDATEOFFSET(dn,totaloffset,"abbrev table error");
  ------------------
  |  |  343|      7|    do {                                            \
  |  |  344|      7|        if ((used) >= (dnm)->dn_next_set_offset) {  \
  |  |  ------------------
  |  |  |  Branch (344:13): [True: 0, False: 7]
  |  |  ------------------
  |  |  345|      0|            _dwarf_error_string(dbg, error,         \
  |  |  346|      0|                DW_DLE_DEBUG_NAMES_HEADER_ERROR,    \
  |  |  ------------------
  |  |  |  | 1418|      0|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  |  |  ------------------
  |  |  347|      0|                "DW_DLE_DEBUG_NAMES_HEADER_ERROR: " \
  |  |  348|      0|                m);                                 \
  |  |  349|      0|            return DW_DLV_ERROR;                    \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  350|      0|        }                                           \
  |  |  351|      7|    } while(0)
  |  |  ------------------
  |  |  |  Branch (351:13): [Folded, False: 7]
  |  |  ------------------
  ------------------
  716|      7|    curptr +=  dn->dn_abbrev_table_size;
  717|      7|    usedspace +=  dn->dn_abbrev_table_size;
  718|      7|    totaloffset +=  dn->dn_abbrev_table_size;
  719|      7|    VALIDATEOFFSET(dn,totaloffset,"abbrev table error");
  ------------------
  |  |  343|      7|    do {                                            \
  |  |  344|      7|        if ((used) >= (dnm)->dn_next_set_offset) {  \
  |  |  ------------------
  |  |  |  Branch (344:13): [True: 1, False: 6]
  |  |  ------------------
  |  |  345|      1|            _dwarf_error_string(dbg, error,         \
  |  |  346|      1|                DW_DLE_DEBUG_NAMES_HEADER_ERROR,    \
  |  |  ------------------
  |  |  |  | 1418|      1|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  |  |  ------------------
  |  |  347|      1|                "DW_DLE_DEBUG_NAMES_HEADER_ERROR: " \
  |  |  348|      1|                m);                                 \
  |  |  349|      1|            return DW_DLV_ERROR;                    \
  |  |  ------------------
  |  |  |  |  123|      1|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  350|      1|        }                                           \
  |  |  351|      7|    } while(0)
  |  |  ------------------
  |  |  |  Branch (351:13): [Folded, False: 6]
  |  |  ------------------
  ------------------
  720|       |
  721|      6|    dn->dn_entry_pool = curptr;
  722|      6|    dn->dn_entry_pool_offset = totaloffset;
  723|      6|    if (dn->dn_next_set_offset < totaloffset) {
  ------------------
  |  Branch (723:9): [True: 0, False: 6]
  ------------------
  724|      0|        _dwarf_error_string(dbg, error,
  725|      0|            DW_DLE_DEBUG_NAMES_HEADER_ERROR,
  ------------------
  |  | 1418|      0|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  ------------------
  726|      0|            "DW_DLE_DEBUG_NAMES_HEADER_ERROR: "
  727|      0|            "Abbrev total wrong, exceeds "
  728|      0|            "the room available.");
  729|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  730|      0|    }
  731|       |
  732|      6|    entry_pool_size = dn->dn_next_set_offset - totaloffset;
  733|      6|    dn->dn_entry_pool_size = entry_pool_size;
  734|      6|    curptr +=   entry_pool_size;
  735|      6|    usedspace += entry_pool_size;
  736|      6|    totaloffset += entry_pool_size;
  737|       |
  738|      6|    if (totaloffset != dn->dn_next_set_offset)   {
  ------------------
  |  Branch (738:9): [True: 0, False: 6]
  ------------------
  739|      0|        _dwarf_error_string(dbg, error,
  740|      0|            DW_DLE_DEBUG_NAMES_HEADER_ERROR,
  ------------------
  |  | 1418|      0|#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
  ------------------
  741|      0|            "DW_DLE_DEBUG_NAMES_HEADER_ERROR: "
  742|      0|            "Final total offset does not match base "
  743|      0|            "calculation. Logic error.");
  744|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  745|      0|    }
  746|       |
  747|      6|    *usedspace_out = usedspace;
  748|      6|    *next_offset = dn->dn_next_set_offset;
  749|      6|    res = fill_in_abbrevs_table(dn,error);
  750|      6|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
  |  Branch (750:9): [True: 0, False: 6]
  ------------------
  751|      0|        free(dn->dn_augmentation_string);
  752|      0|        dn->dn_augmentation_string = 0;
  753|      0|        return res;
  754|      0|    }
  755|      6|    return DW_DLV_OK;
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
  756|      6|}
dwarf_debugnames.c:read_uword_val:
  316|    104|{
  317|    104|    Dwarf_Unsigned val = 0;
  318|    104|    Dwarf_Small *ptr = *ptr_in;
  319|       |
  320|    104|    READ_UNALIGNED_CK(dbg, val, Dwarf_Unsigned,
  ------------------
  |  |  245|    104|    do  {                                        \
  |  |  246|    104|        desttype _ltmp = 0;                      \
  |  |  247|    104|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|    104|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 104]
  |  |  ------------------
  |  |  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|    104|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 0, False: 104]
  |  |  ------------------
  |  |  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|    104|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|    104|            (source), (unsigned long)(length)) ; \
  |  |  264|    104|        (dest) = _ltmp;                          \
  |  |  265|    104|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 104]
  |  |  ------------------
  ------------------
  321|    104|        ptr, DWARF_32BIT_SIZE,
  322|    104|        error,endptr);
  323|    104|    ptr += DWARF_32BIT_SIZE;
  ------------------
  |  |  133|    104|#define DWARF_32BIT_SIZE 4
  ------------------
  324|    104|    if (ptr >= endptr) {
  ------------------
  |  Branch (324:9): [True: 0, False: 104]
  ------------------
  325|      0|        _dwarf_error(dbg, error,errcode);
  326|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  327|      0|    }
  328|       |    /*  Some of the fields are not length fields, but
  329|       |        if non-zero the size will be longer than
  330|       |        the value, so we do the following
  331|       |        overall sanity check to avoid overflows. */
  332|    104|    if (val > area_length) {
  ------------------
  |  Branch (332:9): [True: 0, False: 104]
  ------------------
  333|      0|        _dwarf_error(dbg, error,errcode);
  334|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  335|      0|    }
  336|    104|    *val_out = val;
  337|    104|    *ptr_in = ptr;
  338|    104|    return DW_DLV_OK;
  ------------------
  |  |  122|    104|#define DW_DLV_OK        0
  ------------------
  339|    104|}
dwarf_debugnames.c:fill_in_abbrevs_table:
  154|      6|{
  155|      6|    Dwarf_Unsigned ablen =  dn->dn_abbrev_table_size;
  156|      6|    Dwarf_Small   *abdata = dn->dn_abbrevs;
  157|      6|    Dwarf_Small   *tabend = abdata + ablen;
  158|      6|    Dwarf_Small   *abcur = 0;
  159|      6|    Dwarf_Unsigned code = 0;
  160|      6|    Dwarf_Unsigned tag = 0;
  161|      6|    int            foundabend = FALSE;
  ------------------
  |  |   36|      6|#define FALSE 0
  ------------------
  162|      6|    Dwarf_Unsigned abcount = 0;
  163|      6|    struct Dwarf_D_Abbrev_s  *curdab = 0;
  164|      6|    struct Dwarf_D_Abbrev_s  *firstdab = 0;
  165|      6|    struct Dwarf_D_Abbrev_s **lastabp = &firstdab;
  166|      6|    Dwarf_Debug    dbg = dn->dn_dbg;
  167|       |
  168|     15|    for (abcur = abdata; abcur < tabend; ) {
  ------------------
  |  Branch (168:26): [True: 15, False: 0]
  ------------------
  169|     15|        Dwarf_Unsigned attr = 0;
  170|     15|        Dwarf_Unsigned form = 0;
  171|     15|        Dwarf_Small   *inner = 0;
  172|     15|        Dwarf_Unsigned inroffset = 0;
  173|     15|        int            res = 0;
  174|       |
  175|     15|        inroffset = abcur - abdata;
  176|     15|        res = read_uword_ab(&abcur,&code,dbg,error,tabend);
  177|     15|        if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     15|#define DW_DLV_OK        0
  ------------------
  |  Branch (177:13): [True: 0, False: 15]
  ------------------
  178|      0|            free_temp_abbrevs(firstdab);
  179|      0|            return res;
  180|      0|        }
  181|     15|        if (code == 0) {
  ------------------
  |  Branch (181:13): [True: 6, False: 9]
  ------------------
  182|      6|            foundabend = TRUE;
  ------------------
  |  |   33|      6|#define TRUE 1
  ------------------
  183|      6|            break;
  184|      6|        }
  185|       |
  186|      9|        res = read_uword_ab(&abcur,&tag,dbg,error,tabend);
  187|      9|        if (res != DW_DLV_OK) {
  ------------------
  |  |  122|      9|#define DW_DLV_OK        0
  ------------------
  |  Branch (187:13): [True: 0, False: 9]
  ------------------
  188|      0|            free_temp_abbrevs(firstdab);
  189|      0|            return res;
  190|      0|        }
  191|      9|        inner = abcur;
  192|      9|        curdab = (struct Dwarf_D_Abbrev_s *)calloc(1,
  193|      9|            sizeof(struct Dwarf_D_Abbrev_s));
  194|      9|        if (!curdab) {
  ------------------
  |  Branch (194:13): [True: 0, False: 9]
  ------------------
  195|      0|            free_temp_abbrevs(firstdab);
  196|      0|            firstdab = 0;
  197|      0|            _dwarf_error(dbg, error, DW_DLE_ALLOC_FAIL);
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  198|      0|            return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  199|      0|        }
  200|      9|        curdab->da_abbrev_offset = inroffset;
  201|      9|        curdab->da_abbrev_code = code;
  202|      9|        curdab->da_tag = tag;
  203|      9|        abcount++;
  204|     26|        for (;;) {
  205|     26|            res = read_uword_ab(&inner,&attr,dbg,error,tabend);
  206|     26|            if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     26|#define DW_DLV_OK        0
  ------------------
  |  Branch (206:17): [True: 0, False: 26]
  ------------------
  207|      0|                free_temp_abbrevs(curdab);
  208|      0|                free_temp_abbrevs(firstdab);
  209|      0|                firstdab = 0;
  210|      0|                return res;
  211|      0|            }
  212|     26|            res = read_uword_ab(&inner,&form,dbg,error,tabend);
  213|     26|            if (res != DW_DLV_OK) {
  ------------------
  |  |  122|     26|#define DW_DLV_OK        0
  ------------------
  |  Branch (213:17): [True: 0, False: 26]
  ------------------
  214|      0|                free_temp_abbrevs(curdab);
  215|      0|                free_temp_abbrevs(firstdab);
  216|      0|                firstdab = 0;
  217|      0|                return res;
  218|      0|            }
  219|     26|            if ( curdab->da_pairs_count ==
  ------------------
  |  Branch (219:18): [True: 0, False: 26]
  ------------------
  220|     26|                ABB_PAIRS_MAX) {
  ------------------
  |  |   30|     26|#define ABB_PAIRS_MAX 10
  ------------------
  221|      0|                free_temp_abbrevs(curdab);
  222|      0|                free_temp_abbrevs(firstdab);
  223|      0|                _dwarf_error_string(dbg,error,
  224|      0|                    DW_DLE_DEBUG_NAMES_ABBREV_CORRUPTION,
  ------------------
  |  | 1423|      0|#define DW_DLE_DEBUG_NAMES_ABBREV_CORRUPTION   377
  ------------------
  225|      0|                    "DW_DLE_DEBUG_NAMES_ABBREV_CORRUPTION: "
  226|      0|                    "Impossible: too many idxattr/form pairs"
  227|      0|                    "corrupt abbrevs");
  228|      0|                return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  229|      0|            }
  230|     26|            curdab->da_idxattr[curdab->da_pairs_count] =
  231|     26|                (Dwarf_Half)attr;
  232|     26|            curdab->da_form[curdab->da_pairs_count] =
  233|     26|                (Dwarf_Half)form;
  234|     26|            curdab->da_pairs_count++;
  235|     26|            if (!attr && !form) {
  ------------------
  |  Branch (235:17): [True: 10, False: 16]
  |  Branch (235:26): [True: 9, False: 1]
  ------------------
  236|       |                /*  We put the terminator into the pairs list.
  237|       |                    done for this pair set */
  238|      9|                break;
  239|      9|            }
  240|     26|        }
  241|       |
  242|       |        /* Building singly linked list.  without if stmt. */
  243|      9|        abcur = inner;
  244|      9|        *lastabp = curdab;
  245|      9|        lastabp = &curdab->da_next;
  246|      9|    }
  247|      6|    if (!foundabend) {
  ------------------
  |  Branch (247:9): [True: 0, False: 6]
  ------------------
  248|      0|        free_temp_abbrevs(firstdab);
  249|      0|        _dwarf_error_string(dbg, error,
  250|      0|            DW_DLE_DEBUG_NAMES_ABBREV_CORRUPTION,
  ------------------
  |  | 1423|      0|#define DW_DLE_DEBUG_NAMES_ABBREV_CORRUPTION   377
  ------------------
  251|      0|            "DW_DLE_DEBUG_NAMES_ABBREV_CORRUPTION: Never found"
  252|      0|            "abbrev final NUL byte");
  253|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  254|      0|    }
  255|      6|    if (abcur < tabend &&
  ------------------
  |  Branch (255:9): [True: 6, False: 0]
  ------------------
  256|      6|        dbg->de_harmless_errors_on) {
  ------------------
  |  Branch (256:9): [True: 0, False: 6]
  ------------------
  257|      0|        unsigned padcount = 0;
  258|       |
  259|      0|        for (; abcur < tabend; ++abcur) {
  ------------------
  |  Branch (259:16): [True: 0, False: 0]
  ------------------
  260|      0|            ++padcount;
  261|      0|            if (*abcur) {
  ------------------
  |  Branch (261:17): [True: 0, False: 0]
  ------------------
  262|      0|                dwarfstring  m;
  263|       |
  264|      0|                dwarfstring_constructor(&m);
  265|      0|                dwarfstring_append_printf_u(&m,
  266|      0|                    "WARNING NON NULL debug_names "
  267|      0|                    "abbreviation pad. "
  268|      0|                    "padcount %u at ",padcount);
  269|      0|                dwarfstring_append_printf_u(&m,
  270|      0|                    ".debug_names sec_offset 0x%lx",
  271|      0|                    (uintptr_t)(abcur - dn->dn_section_data));
  272|      0|                dwarf_insert_harmless_error(dbg,
  273|      0|                    dwarfstring_string(&m));
  274|      0|                dwarfstring_destructor(&m);
  275|      0|            }
  276|      0|        }
  277|      0|    }
  278|      6|    {
  279|      6|        Dwarf_Unsigned ct = 0;
  280|      6|        struct Dwarf_D_Abbrev_s *tmpa = 0;
  281|       |
  282|      6|        dn->dn_abbrev_instances =
  283|      6|            (struct Dwarf_D_Abbrev_s *)calloc(
  284|      6|            abcount,sizeof(struct Dwarf_D_Abbrev_s));
  285|      6|        if (!dn->dn_abbrev_instances) {
  ------------------
  |  Branch (285:13): [True: 0, False: 6]
  ------------------
  286|      0|            free_temp_abbrevs(firstdab);
  287|      0|            _dwarf_error(dbg, error, DW_DLE_ALLOC_FAIL);
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  288|      0|            return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  289|      0|        }
  290|      6|        dn->dn_abbrev_instance_count = abcount;
  291|      6|        tmpa = firstdab;
  292|     15|        for (ct = 0; ct < abcount; ++ct) {
  ------------------
  |  Branch (292:22): [True: 9, False: 6]
  ------------------
  293|      9|            struct Dwarf_D_Abbrev_s *tmpb =tmpa->da_next;
  294|       |            /*  da_next no longer means anything */
  295|      9|            dn->dn_abbrev_instances[ct] = *tmpa;
  296|      9|            dn->dn_abbrev_instances[ct].da_next = 0;
  297|      9|            free(tmpa);
  298|      9|            tmpa = tmpb;
  299|      9|        }
  300|      6|        tmpa = 0;
  301|      6|        firstdab = 0;
  302|       |        /*  Now the list has turned into an
  303|       |            array. We can ignore
  304|       |            the list aspect. */
  305|      6|    }
  306|      6|    return DW_DLV_OK;
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
  307|      6|}
dwarf_debugnames.c:read_uword_ab:
  124|     76|{
  125|     76|    Dwarf_Small *inptr = *lp;
  126|     76|    Dwarf_Unsigned out = 0;
  127|       |
  128|       |    /* The macro updates inptr */
  129|     76|    DECODE_LEB128_UWORD_CK(inptr,
  ------------------
  |  |   70|     76|    do {                                                    \
  |  |   71|     76|        Dwarf_Unsigned lu_leblen = 0;                       \
  |  |   72|     76|        Dwarf_Unsigned lu_local = 0;                        \
  |  |   73|     76|        int lu_res = 0;                                     \
  |  |   74|     76|        lu_res = dwarf_decode_leb128((char *)(ptr),&lu_leblen,\
  |  |   75|     76|            &lu_local,(char *)(endptr));                    \
  |  |   76|     76|        if (lu_res == DW_DLV_ERROR) {                       \
  |  |  ------------------
  |  |  |  |  123|     76|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |  |  Branch (76:13): [True: 0, False: 76]
  |  |  ------------------
  |  |   77|      0|            _dwarf_error_string((dbg), (errptr),            \
  |  |   78|      0|                DW_DLE_LEB_IMPROPER,                        \
  |  |  ------------------
  |  |  |  | 1375|      0|#define DW_DLE_LEB_IMPROPER                    329
  |  |  ------------------
  |  |   79|      0|                "DW_DLE_LEB_IMPROPER: decode uleb"          \
  |  |   80|      0|                " runs past allowed area.c");                 \
  |  |   81|      0|            return DW_DLV_ERROR;                            \
  |  |  ------------------
  |  |  |  |  123|      0|#define DW_DLV_ERROR     1
  |  |  ------------------
  |  |   82|      0|        }                                                   \
  |  |   83|     76|        (value) = lu_local;                                 \
  |  |   84|     76|        (ptr) += lu_leblen;                                 \
  |  |   85|     76|    } while (0)
  |  |  ------------------
  |  |  |  Branch (85:14): [Folded, False: 76]
  |  |  ------------------
  ------------------
  130|     76|        out, dbg,err,lpend);
  131|     76|    *lp = inptr;
  132|     76|    *out_p = out;
  133|     76|    return DW_DLV_OK;
  ------------------
  |  |  122|     76|#define DW_DLV_OK        0
  ------------------
  134|     76|}
dwarf_debugnames.c:_dwarf_internal_dwarf_dealloc_dnames:
  874|     17|{
  875|     17|    if (!dn || dn->dn_magic != DWARF_DNAMES_MAGIC) {
  ------------------
  |  |   49|     17|#define DWARF_DNAMES_MAGIC  0xabcd
  ------------------
  |  Branch (875:9): [True: 0, False: 17]
  |  Branch (875:16): [True: 0, False: 17]
  ------------------
  876|      0|        return;
  877|      0|    }
  878|     17|    free(dn->dn_augmentation_string);
  879|     17|    dn->dn_augmentation_string = 0;
  880|     17|    free(dn->dn_bucket_array);
  881|     17|    dn->dn_bucket_array = 0;
  882|     17|    free(dn->dn_abbrev_instances);
  883|     17|    dn->dn_abbrev_instances = 0;
  884|     17|    dn->dn_abbrev_instance_count = 0;
  885|     17|    dn->dn_magic = 0;
  886|     17|}
dwarf_debugnames.c:_dwarf_initialize_bucket_details:
 1125|      6|{
 1126|      6|    Dwarf_Debug dbg = 0;
 1127|      6|    Dwarf_Unsigned i = 0;
 1128|      6|    struct Dwarf_DN_Bucket_s *curbucket = 0;
 1129|       |
 1130|      6|    dbg = dn->dn_dbg;
 1131|      6|    if (dn->dn_bucket_array) {
  ------------------
  |  Branch (1131:9): [True: 0, False: 6]
  ------------------
 1132|      0|        return DW_DLV_OK;
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
 1133|      0|    }
 1134|      6|    if (!dn->dn_bucket_count) {
  ------------------
  |  Branch (1134:9): [True: 0, False: 6]
  ------------------
 1135|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
 1136|      0|    }
 1137|      6|    dn->dn_bucket_array = (struct Dwarf_DN_Bucket_s*)
 1138|      6|        calloc(dn->dn_bucket_count,sizeof(struct Dwarf_DN_Bucket_s));
 1139|      6|    if (!dn->dn_bucket_array) {
  ------------------
  |  Branch (1139:9): [True: 0, False: 6]
  ------------------
 1140|      0|        _dwarf_error_string(dbg,error,DW_DLE_ALLOC_FAIL,
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1141|      0|            "DW_DLE_ALLOC_FAIL: "
 1142|      0|            ".debug_names bucket array could not be allocated");
 1143|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1144|      0|    }
 1145|       |
 1146|      6|    curbucket = dn->dn_bucket_array ;
 1147|   327k|    for (i = 0 ; i < dn->dn_bucket_count; ++i) {
  ------------------
  |  Branch (1147:18): [True: 327k, False: 6]
  ------------------
 1148|   327k|        Dwarf_Unsigned offsetval = 0;
 1149|   327k|        Dwarf_Small *ptr = dn->dn_buckets +
 1150|   327k|            i * DWARF_32BIT_SIZE;
  ------------------
  |  |  133|   327k|#define DWARF_32BIT_SIZE 4
  ------------------
 1151|   327k|        Dwarf_Small *endptr = dn->dn_buckets+
 1152|   327k|            dn->dn_bucket_count*DWARF_32BIT_SIZE;
  ------------------
  |  |  133|   327k|#define DWARF_32BIT_SIZE 4
  ------------------
 1153|       |
 1154|   327k|        READ_UNALIGNED_CK(dbg, offsetval, Dwarf_Unsigned,
  ------------------
  |  |  245|   327k|    do  {                                        \
  |  |  246|   327k|        desttype _ltmp = 0;                      \
  |  |  247|   327k|        Dwarf_Byte_Ptr readend = (source)+(length); \
  |  |  248|   327k|        if (readend < (source)) {                \
  |  |  ------------------
  |  |  |  Branch (248:13): [True: 0, False: 327k]
  |  |  ------------------
  |  |  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|   327k|        if (readend > (endptr)) {                \
  |  |  ------------------
  |  |  |  Branch (255:13): [True: 0, False: 327k]
  |  |  ------------------
  |  |  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|   327k|        (dbg)->de_copy_word((char *)(&_ltmp),      \
  |  |  263|   327k|            (source), (unsigned long)(length)) ; \
  |  |  264|   327k|        (dest) = _ltmp;                          \
  |  |  265|   327k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (265:14): [Folded, False: 327k]
  |  |  ------------------
  ------------------
 1155|   327k|            ptr, DWARF_32BIT_SIZE,
 1156|   327k|            error,endptr);
 1157|   327k|        curbucket = dn->dn_bucket_array +i;
 1158|   327k|        curbucket->db_nameindex = offsetval;
 1159|   327k|    }
 1160|   207k|    for (i = 0; i < dn->dn_bucket_count; ) {
  ------------------
  |  Branch (1160:17): [True: 207k, False: 0]
  ------------------
 1161|   207k|        Dwarf_Unsigned j = 0;
 1162|       |
 1163|   207k|        curbucket = dn->dn_bucket_array+i;
 1164|   207k|        if (!curbucket->db_nameindex) {
  ------------------
  |  Branch (1164:13): [True: 0, False: 207k]
  ------------------
 1165|      0|            ++i;
 1166|      0|            continue;
 1167|      0|        }
 1168|   327k|        for (j = i+1; j < dn->dn_bucket_count; ++j) {
  ------------------
  |  Branch (1168:23): [True: 327k, False: 6]
  ------------------
 1169|   327k|            struct Dwarf_DN_Bucket_s *partial =
 1170|   327k|                dn->dn_bucket_array+j;
 1171|       |
 1172|   327k|            if (partial->db_nameindex) {
  ------------------
  |  Branch (1172:17): [True: 207k, False: 120k]
  ------------------
 1173|   207k|                curbucket->db_collisioncount =
 1174|   207k|                    partial->db_nameindex - curbucket->db_nameindex;
 1175|   207k|                    i = j;
 1176|   207k|                    break;
 1177|   207k|            }
 1178|   327k|        }
 1179|   207k|        if (j >= dn->dn_bucket_count) {
  ------------------
  |  Branch (1179:13): [True: 6, False: 207k]
  ------------------
 1180|       |            /* Ran off end */
 1181|      6|            curbucket->db_collisioncount =
 1182|      6|                dn->dn_name_count - curbucket->db_nameindex;
 1183|      6|            if (!curbucket->db_collisioncount) {
  ------------------
  |  Branch (1183:17): [True: 0, False: 6]
  ------------------
 1184|      0|                curbucket->db_collisioncount = 1;
 1185|      0|            }
 1186|      6|            break;
 1187|      6|        }
 1188|   207k|    }
 1189|      6|    return DW_DLV_OK;
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
 1190|      6|}
dwarf_debugnames.c:get_bucket_number:
 1257|      6|{
 1258|      6|    Dwarf_Unsigned i = 0;
 1259|       |
 1260|      6|    if (!dn->dn_bucket_count) {
  ------------------
  |  Branch (1260:9): [True: 0, False: 6]
  ------------------
 1261|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
 1262|      0|    }
 1263|      6|    if (!dn->dn_bucket_array) {
  ------------------
  |  Branch (1263:9): [True: 0, False: 6]
  ------------------
 1264|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
 1265|      0|    }
 1266|       |    /*  Binary search would be better FIXME */
 1267|      6|    for (i = 0; i < dn->dn_bucket_count; ++i) {
  ------------------
  |  Branch (1267:17): [True: 6, False: 0]
  ------------------
 1268|      6|        Dwarf_Unsigned bindx = 0;
 1269|      6|        Dwarf_Unsigned ccount = 0;
 1270|      6|        Dwarf_Unsigned lastbindx = 0;
 1271|      6|        struct Dwarf_DN_Bucket_s *cur = dn->dn_bucket_array +i;
 1272|       |
 1273|      6|        bindx = cur->db_nameindex;
 1274|      6|        ccount = cur->db_collisioncount;
 1275|      6|        lastbindx = ccount + bindx -1;
 1276|      6|        if (name_index > lastbindx) {
  ------------------
  |  Branch (1276:13): [True: 0, False: 6]
  ------------------
 1277|      0|            continue;
 1278|      0|        }
 1279|      6|        if (!bindx ) {
  ------------------
  |  Branch (1279:13): [True: 0, False: 6]
  ------------------
 1280|       |            /* empty bucket */
 1281|      0|            continue;
 1282|      0|        }
 1283|      6|        if (bindx == name_index) {
  ------------------
  |  Branch (1283:13): [True: 0, False: 6]
  ------------------
 1284|      0|            *bucket_num = i;
 1285|      0|            return DW_DLV_OK;
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
 1286|      0|        }
 1287|      6|        if (name_index <= lastbindx) {
  ------------------
  |  Branch (1287:13): [True: 6, False: 0]
  ------------------
 1288|      6|            *bucket_num = i;
 1289|      6|            return DW_DLV_OK;
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
 1290|      6|        }
 1291|      6|    }
 1292|       |    /*  ? is it an error? */
 1293|      0|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
 1294|      6|}
dwarf_debugnames.c:get_hash_value_number:
 1228|      6|{
 1229|      6|    Dwarf_Unsigned hash_val   = 0;
 1230|      6|    int res                   = 0;
 1231|      6|    Dwarf_Small * hashesentry = 0;
 1232|      6|    Dwarf_Small *end          = 0;
 1233|       |
 1234|      6|    if (!dn->dn_bucket_count) {
  ------------------
  |  Branch (1234:9): [True: 0, False: 6]
  ------------------
 1235|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |  121|      0|#define DW_DLV_NO_ENTRY -1
  ------------------
 1236|      0|    }
 1237|      6|    hashesentry = dn->dn_hash_table + (name_index-1)*DWARF_32BIT_SIZE;
  ------------------
  |  |  133|      6|#define DWARF_32BIT_SIZE 4
  ------------------
 1238|      6|    end = dn->dn_hash_table + DWARF_32BIT_SIZE*(dn->dn_name_count+1);
  ------------------
  |  |  133|      6|#define DWARF_32BIT_SIZE 4
  ------------------
 1239|      6|    res = read_uword_val(dn->dn_dbg,
 1240|      6|        &hashesentry,
 1241|      6|        end,
 1242|      6|        DW_DLE_DEBUG_NAMES_OFF_END,
  ------------------
  |  | 1421|      6|#define DW_DLE_DEBUG_NAMES_OFF_END             375
  ------------------
 1243|      6|        &hash_val,
 1244|      6|        0xffffffff, /* hashes fit in 32 bits */
 1245|      6|        error);
 1246|      6|    if (res != DW_DLV_OK) {
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
  |  Branch (1246:9): [True: 0, False: 6]
  ------------------
 1247|      0|        return res;
 1248|      0|    }
 1249|      6|    *hash_value = hash_val;
 1250|      6|    return DW_DLV_OK;
  ------------------
  |  |  122|      6|#define DW_DLV_OK        0
  ------------------
 1251|      6|}

_dwarf_load_elf_symtab_symbols:
  992|     48|{
  993|     48|    int res = 0;
  994|     48|    struct generic_symentry *gsym = 0;
  995|     48|    Dwarf_Unsigned count = 0;
  996|     48|    Dwarf_Unsigned secnum = ep->f_symtab_sect_index;
  997|     48|    struct generic_shdr * psh = 0;
  998|       |
  999|     48|    if (!secnum) {
  ------------------
  |  Branch (999:9): [True: 39, False: 9]
  ------------------
 1000|     39|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|     39|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1001|     39|    }
 1002|      9|    psh = ep->f_shdr + secnum;
 1003|      9|    if (psh->gh_size > ep->f_filesize) {
  ------------------
  |  Branch (1003:9): [True: 0, False: 9]
  ------------------
 1004|      0|        *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      0|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1005|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1006|      0|    }
 1007|      9|    res = _dwarf_generic_elf_load_symbols(ep,
 1008|      9|        secnum,
 1009|      9|        psh,
 1010|      9|        &gsym,
 1011|      9|        &count,errcode);
 1012|      9|    if (res == DW_DLV_OK) {
  ------------------
  |  |   59|      9|#define DW_DLV_OK         0
  ------------------
  |  Branch (1012:9): [True: 3, False: 6]
  ------------------
 1013|      3|        ep->f_symtab = gsym;
 1014|      3|        ep->f_loc_symtab.g_count = count;
 1015|      6|    } else {
 1016|      6|    }
 1017|      9|    return res;
 1018|      9|}
_dwarf_load_elf_symstr:
 1199|     55|{
 1200|     55|    struct generic_shdr *strpsh = 0;
 1201|     55|    int res = 0;
 1202|     55|    Dwarf_Unsigned strsectindex  =0;
 1203|     55|    Dwarf_Unsigned strsectlength = 0;
 1204|     55|    Dwarf_Unsigned flags = 0;
 1205|       |
 1206|     55|    if (!ep->f_symtab_sect_strings_sect_index) {
  ------------------
  |  Branch (1206:9): [True: 39, False: 16]
  ------------------
 1207|     39|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|     39|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1208|     39|    }
 1209|     16|    strsectindex = ep->f_symtab_sect_strings_sect_index;
 1210|     16|    strsectlength = ep->f_symtab_sect_strings_max;
 1211|     16|    strpsh = ep->f_shdr + strsectindex;
 1212|     16|    if (strsectindex == ep->f_elf_shstrings_index) {
  ------------------
  |  Branch (1212:9): [True: 8, False: 8]
  ------------------
 1213|       |        /*  content loaded already by
 1214|       |            _dwarf_elf_load_sectstrings() as
 1215|       |            they are the same section number. */
 1216|      8|        ep->f_symtab_sect_strings_sect_index = strpsh->gh_secnum;
 1217|      8|        ep->f_symtab_sect_strings_max = ep->f_elf_shstrings_max;
 1218|      8|        ep->f_symtab_sect_strings = strpsh->gh_content;
 1219|      8|        return DW_DLV_OK;
  ------------------
  |  |   59|      8|#define DW_DLV_OK         0
  ------------------
 1220|      8|    }
 1221|       |    /*  Alloc an extra byte as a guaranteed NUL byte
 1222|       |        at the end of the strings in case the section
 1223|       |        is corrupted and lacks a NUL at end. */
 1224|      8|    if (strsectlength > ep->f_filesize ||
  ------------------
  |  Branch (1224:9): [True: 0, False: 8]
  ------------------
 1225|      8|        strpsh->gh_offset >ep->f_filesize ||
  ------------------
  |  Branch (1225:9): [True: 2, False: 6]
  ------------------
 1226|      6|        (strsectlength + strpsh->gh_offset) >
  ------------------
  |  Branch (1226:9): [True: 5, False: 1]
  ------------------
 1227|      7|            ep->f_filesize) {
 1228|      7|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|      7|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1229|      7|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      7|#define DW_DLV_ERROR      1
  ------------------
 1230|      7|    }
 1231|      1|    flags = strpsh->gh_flags;
 1232|      1|    ep->f_symtab_sect_strings = calloc(1,strsectlength+1);
 1233|      1|    if (!ep->f_symtab_sect_strings) {
  ------------------
  |  Branch (1233:9): [True: 0, False: 1]
  ------------------
 1234|      0|        ep->f_symtab_sect_strings = 0;
 1235|      0|        ep->f_symtab_sect_strings_max = 0;
 1236|      0|        ep->f_symtab_sect_strings_sect_index = 0;
 1237|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1238|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1239|      0|    }
 1240|      1|    strpsh->gh_load_type = Dwarf_Alloc_Malloc;
 1241|      1|    res = RRMOA(ep->f_fd,ep->f_symtab_sect_strings,
  ------------------
  |  |   65|      1|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|      1|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1242|      1|        strpsh->gh_offset,
 1243|      1|        strsectlength,
 1244|      1|        ep->f_filesize,errcode);
 1245|      1|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|      1|#define DW_DLV_OK         0
  ------------------
  |  Branch (1245:9): [True: 0, False: 1]
  ------------------
 1246|      0|        free(ep->f_symtab_sect_strings);
 1247|      0|        ep->f_symtab_sect_strings = 0;
 1248|      0|        return res;
 1249|      0|    }
 1250|      1|    strpsh->gh_content = ep->f_symtab_sect_strings;
 1251|      1|    strpsh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|      1|#define TRUE 1
  ------------------
 1252|      1|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  293|      1|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (1252:9): [True: 0, False: 1]
  ------------------
 1253|       |#if defined(HAVE_ZLIB) && defined(HAVE_ZSTD)
 1254|       |        /* decompress and set new section size */
 1255|       |        *errcode = 0;
 1256|       |        _dwarf_do_decompress_elf(ep,strpsh,errcode);
 1257|       |        if (*errcode) {
 1258|       |            /*  gh_content will cause the free */
 1259|       |            ep->f_symtab_sect_strings = 0;
 1260|       |            return DW_DLV_ERROR;
 1261|       |        }
 1262|       |        ep->f_symtab_sect_strings = strpsh->gh_content;
 1263|       |#else /* COMPRESSED TEST */
 1264|       |        /*  gh_content will cause the free */
 1265|      0|        ep->f_symtab_sect_strings = 0;
 1266|      0|        *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      0|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
 1267|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1268|      0|#endif /* COMPRESSED TEST */
 1269|      0|    }
 1270|      1|    return DW_DLV_OK;
  ------------------
  |  |   59|      1|#define DW_DLV_OK         0
  ------------------
 1271|      1|}
_dwarf_load_elf_relx:
 1762|  37.8k|{
 1763|  37.8k|    struct generic_shdr *gshdr = 0;
 1764|  37.8k|    Dwarf_Unsigned seccount = 0;
 1765|  37.8k|    unsigned offsetsize = 0;
 1766|  37.8k|    struct generic_rela *grp = 0;
 1767|  37.8k|    Dwarf_Unsigned count_read = 0;
 1768|  37.8k|    int res = 0;
 1769|  37.8k|    unsigned oksec = 0;
 1770|  37.8k|    enum RelocOffsetSize localoffsize = RelocOffset32;
 1771|       |
 1772|       |    /*  ASSERT: Caller guarantees localr is
 1773|       |        a valid RelocRela  */
 1774|  37.8k|    if (!ep) {
  ------------------
  |  Branch (1774:9): [True: 0, False: 37.8k]
  ------------------
 1775|      0|        *errcode = DW_DLE_INTERNAL_NULL_POINTER;
  ------------------
  |  | 1482|      0|#define DW_DLE_INTERNAL_NULL_POINTER           436
  ------------------
 1776|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1777|      0|    }
 1778|  37.8k|    offsetsize = ep->f_offsetsize;
 1779|  37.8k|    seccount = ep->f_loc_shdr.g_count;
 1780|  37.8k|    if (secnum >= seccount) {
  ------------------
  |  Branch (1780:9): [True: 0, False: 37.8k]
  ------------------
 1781|      0|        *errcode = DW_DLE_ELF_SECTION_ERROR;
  ------------------
  |  | 1492|      0|#define DW_DLE_ELF_SECTION_ERROR               446
  ------------------
 1782|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1783|      0|    }
 1784|  37.8k|    gshdr = ep->f_shdr +secnum;
 1785|  37.8k|    if (is_empty_section(gshdr->gh_type)) {
  ------------------
  |  Branch (1785:9): [True: 37.4k, False: 447]
  ------------------
 1786|       |
 1787|  37.4k|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|  37.4k|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1788|  37.4k|    }
 1789|       |
 1790|    447|    res = this_rel_is_a_section_dwarf_related(ep,gshdr,
 1791|    447|        &oksec,errcode);
 1792|    447|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|    447|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1792:9): [True: 1, False: 446]
  ------------------
 1793|      1|        return res;
 1794|      1|    }
 1795|    446|    if (!oksec) {
  ------------------
  |  Branch (1795:9): [True: 335, False: 111]
  ------------------
 1796|    335|        return DW_DLV_OK;
  ------------------
  |  |   59|    335|#define DW_DLV_OK         0
  ------------------
 1797|    335|    }
 1798|       |    /*  We will actually read these relocations. */
 1799|    111|    if (offsetsize == 64) {
  ------------------
  |  Branch (1799:9): [True: 99, False: 12]
  ------------------
 1800|     99|        localoffsize = RelocOffset64;
 1801|     99|    } else if (offsetsize == 32) {
  ------------------
  |  Branch (1801:16): [True: 12, False: 0]
  ------------------
 1802|     12|        localoffsize = RelocOffset32;
 1803|     12|    } else {
 1804|      0|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|      0|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
 1805|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1806|      0|    }
 1807|       |    /*  ASSERT: localoffsize is now a valid enum value,
 1808|       |        one of the two defined. */
 1809|    111|    res = _dwarf_elf_load_a_relx_batch(ep,
 1810|    111|        gshdr,&grp,&count_read,localr,localoffsize,errcode);
 1811|    111|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|    111|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1811:9): [True: 3, False: 108]
  ------------------
 1812|      3|        return res;
 1813|      3|    }
 1814|    108|    if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |   58|    108|#define DW_DLV_NO_ENTRY  -1
  ------------------
  |  Branch (1814:9): [True: 0, False: 108]
  ------------------
 1815|      0|        return res;
 1816|      0|    }
 1817|    108|    gshdr->gh_rels = grp;
 1818|    108|    gshdr->gh_relcount = count_read;
 1819|    108|    return DW_DLV_OK;
  ------------------
  |  |   59|    108|#define DW_DLV_OK         0
  ------------------
 1820|    108|}
_dwarf_load_elf_header:
 1959|     74|{
 1960|     74|    unsigned offsetsize = ep->f_offsetsize;
 1961|     74|    int res = 0;
 1962|       |
 1963|     74|    if (offsetsize == 32) {
  ------------------
  |  Branch (1963:9): [True: 48, False: 26]
  ------------------
 1964|     48|        res = elf_load_elf_header32(ep,errcode);
 1965|     48|    } else if (offsetsize == 64) {
  ------------------
  |  Branch (1965:16): [True: 26, False: 0]
  ------------------
 1966|     26|        if (sizeof(Dwarf_Unsigned) < 8) {
  ------------------
  |  Branch (1966:13): [Folded, False: 26]
  ------------------
 1967|      0|            *errcode =  DW_DLE_INTEGER_TOO_SMALL;
  ------------------
  |  | 1485|      0|#define DW_DLE_INTEGER_TOO_SMALL               439
  ------------------
 1968|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1969|      0|        }
 1970|     26|        res = elf_load_elf_header64(ep,errcode);
 1971|     26|    } else {
 1972|      0|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|      0|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
 1973|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1974|      0|    }
 1975|     74|    return res;
 1976|     74|}
_dwarf_load_elf_sectheaders:
 2345|     74|{
 2346|     74|    int res = 0;
 2347|       |
 2348|     74|    if (ep->f_offsetsize == 32) {
  ------------------
  |  Branch (2348:9): [True: 48, False: 26]
  ------------------
 2349|     48|        res  = elf_load_sectheaders32(ep,ep->f_ehdr->ge_shoff,
 2350|     48|            ep->f_ehdr->ge_shentsize,
 2351|     48|            ep->f_ehdr->ge_shnum,errcode);
 2352|     48|    } else  if (ep->f_offsetsize == 64) {
  ------------------
  |  Branch (2352:17): [True: 26, False: 0]
  ------------------
 2353|     26|        res  = elf_load_sectheaders64(ep,ep->f_ehdr->ge_shoff,
 2354|     26|            ep->f_ehdr->ge_shentsize,
 2355|     26|            ep->f_ehdr->ge_shnum,errcode);
 2356|     26|    } else {
 2357|      0|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|      0|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
 2358|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2359|      0|    }
 2360|     74|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     74|#define DW_DLV_OK         0
  ------------------
  |  Branch (2360:9): [True: 8, False: 66]
  ------------------
 2361|      8|        return res;
 2362|      8|    }
 2363|     66|    res  = _dwarf_elf_load_sectstrings(ep,
 2364|     66|        ep->f_ehdr->ge_shstrndx,errcode);
 2365|     66|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     66|#define DW_DLV_OK         0
  ------------------
  |  Branch (2365:9): [True: 3, False: 63]
  ------------------
 2366|      3|        return res;
 2367|      3|    }
 2368|     63|    res  = _dwarf_elf_load_sect_namestrings(ep,errcode);
 2369|     63|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     63|#define DW_DLV_OK         0
  ------------------
  |  Branch (2369:9): [True: 0, False: 63]
  ------------------
 2370|      0|        return res;
 2371|      0|    }
 2372|     63|    res  = _dwarf_elf_find_sym_sections(ep,errcode);
 2373|     63|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     63|#define DW_DLV_OK         0
  ------------------
  |  Branch (2373:9): [True: 0, False: 63]
  ------------------
 2374|      0|        return res;
 2375|      0|    }
 2376|     63|    res = _dwarf_elf_setup_all_section_groups(ep,errcode);
 2377|     63|    return res;
 2378|     63|}
dwarf_elf_load_headers.c:_dwarf_generic_elf_load_symbols:
  954|      9|{
  955|      9|    int res = 0;
  956|      9|    struct generic_symentry *gsym = 0;
  957|      9|    Dwarf_Unsigned count = 0;
  958|       |
  959|      9|    if (!secnum) {
  ------------------
  |  Branch (959:9): [True: 0, False: 9]
  ------------------
  960|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  961|      0|    }
  962|      9|    if (psh->gh_size > ep->f_filesize) {
  ------------------
  |  Branch (962:9): [True: 0, False: 9]
  ------------------
  963|      0|        *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      0|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
  964|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  965|      0|    }
  966|      9|    if (ep->f_offsetsize == 32) {
  ------------------
  |  Branch (966:9): [True: 8, False: 1]
  ------------------
  967|      8|        res = _dwarf_generic_elf_load_symbols32(ep,
  968|      8|            &gsym,psh,
  969|      8|            &count,errcode);
  970|      8|    } else if (ep->f_offsetsize == 64) {
  ------------------
  |  Branch (970:16): [True: 1, False: 0]
  ------------------
  971|      1|        res = _dwarf_generic_elf_load_symbols64(ep,
  972|      1|            &gsym,psh,
  973|      1|            &count,errcode);
  974|      1|    } else {
  975|      0|        *errcode = DW_DLE_OFFSET_SIZE;
  ------------------
  |  | 1461|      0|#define DW_DLE_OFFSET_SIZE                     415
  ------------------
  976|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  977|      0|    }
  978|      9|    if (res == DW_DLV_OK) {
  ------------------
  |  |   59|      9|#define DW_DLV_OK         0
  ------------------
  |  Branch (978:9): [True: 3, False: 6]
  ------------------
  979|      3|        *gsym_out = gsym;
  980|      3|        *count_out = count;
  981|      6|    } else {
  982|      6|        free(psh->gh_content);
  983|      6|        psh->gh_content = 0;
  984|      6|        psh->gh_was_alloc = FALSE;
  ------------------
  |  |   36|      6|#define FALSE 0
  ------------------
  985|      6|    }
  986|      9|    return res;
  987|      9|}
dwarf_elf_load_headers.c:_dwarf_generic_elf_load_symbols32:
  748|      8|{
  749|      8|    Dwarf_Unsigned  ecount = 0;
  750|      8|    Dwarf_Unsigned  size2 = 0;
  751|      8|    Dwarf_Unsigned  offset =0;
  752|      8|    Dwarf_Unsigned  size =0;
  753|      8|    Dwarf_Unsigned  i = 0;
  754|      8|    dw_elf32_sym   *psym = 0;
  755|      8|    struct generic_symentry * gsym = 0;
  756|      8|    struct generic_symentry * orig_gsym = 0;
  757|      8|    Dwarf_Unsigned flags = 0;
  758|      8|    Dwarf_Small   *content = 0;
  759|      8|    int            res = 0;
  760|       |
  761|      8|    flags = psh->gh_flags;
  762|      8|    size = psh->gh_size;
  763|      8|    offset = psh->gh_offset;
  764|       |
  765|      8|    content = calloc(1,size);
  766|      8|    if (!content) {
  ------------------
  |  Branch (766:9): [True: 0, False: 8]
  ------------------
  767|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  768|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  769|      0|    }
  770|      8|    res = RRMOA(ep->f_fd,content,offset,size,
  ------------------
  |  |   65|      8|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|      8|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  771|      8|        ep->f_filesize,errcode);
  772|      8|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|      8|#define DW_DLV_OK         0
  ------------------
  |  Branch (772:9): [True: 6, False: 2]
  ------------------
  773|      6|        free(content);
  774|      6|        return res;
  775|      6|    }
  776|      2|    psh->gh_content = (char *)content;
  777|      2|    psh->gh_load_type = Dwarf_Alloc_Malloc;
  778|      2|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  293|      2|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (778:9): [True: 0, False: 2]
  ------------------
  779|       |#if defined(HAVE_ZLIB) && defined(HAVE_ZSTD)
  780|       |        *errcode = 0;
  781|       |        _dwarf_do_decompress_elf(ep,psh,errcode);
  782|       |        /* decompress and set new section size */
  783|       |        if (*errcode) {
  784|       |            free(psh->gh_content);
  785|       |            psh->gh_content = 0;
  786|       |            return DW_DLV_ERROR;
  787|       |        }
  788|       |#else /* COMPRESSED TEST */
  789|      0|        free(psh->gh_content);
  790|      0|        *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      0|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
  791|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  792|      0|#endif /* COMPRESSED TEST */
  793|      0|    }
  794|      2|    size = psh->gh_size;
  795|      2|    ecount = (long)(size/sizeof(dw_elf32_sym));
  796|      2|    size2 = ecount * sizeof(dw_elf32_sym);
  797|      2|    if (size != size2) {
  ------------------
  |  Branch (797:9): [True: 0, False: 2]
  ------------------
  798|      0|        free(psh->gh_content);
  799|      0|        psh->gh_content = 0;
  800|      0|        *errcode = DW_DLE_SYMBOL_SECTION_SIZE_ERROR;
  ------------------
  |  | 1536|      0|#define DW_DLE_SYMBOL_SECTION_SIZE_ERROR       490
  ------------------
  801|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  802|      0|    }
  803|      2|    if (size >= ep->f_filesize ) {
  ------------------
  |  Branch (803:9): [True: 0, False: 2]
  ------------------
  804|      0|        free(psh->gh_content);
  805|      0|        psh->gh_content = 0;
  806|      0|        *errcode = DW_DLE_SYMBOL_SECTION_SIZE_ERROR;
  ------------------
  |  | 1536|      0|#define DW_DLE_SYMBOL_SECTION_SIZE_ERROR       490
  ------------------
  807|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  808|      0|    }
  809|      2|    psym = (dw_elf32_sym *)psh->gh_content;
  810|      2|    gsym = calloc(ecount,sizeof(struct generic_symentry));
  811|      2|    if (!gsym) {
  ------------------
  |  Branch (811:9): [True: 0, False: 2]
  ------------------
  812|      0|        free(psh->gh_content);
  813|      0|        psh->gh_content = 0;
  814|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  815|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  816|      0|    }
  817|      2|    orig_gsym = gsym;
  818|  24.5k|    for ( i = 0; i < ecount; ++i,++psym,++gsym) {
  ------------------
  |  Branch (818:18): [True: 24.5k, False: 2]
  ------------------
  819|  24.5k|        Dwarf_Unsigned bind = 0;
  820|  24.5k|        Dwarf_Unsigned type = 0;
  821|       |
  822|  24.5k|        ASNAR(ep->f_copy_word,gsym->gs_name,psym->st_name);
  ------------------
  |  |   53|  24.5k|    do {                                        \
  |  |   54|  24.5k|        (t) = 0;                                \
  |  |   55|  24.5k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  24.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 24.5k]
  |  |  ------------------
  ------------------
  823|  24.5k|        ASNAR(ep->f_copy_word,gsym->gs_value,psym->st_value);
  ------------------
  |  |   53|  24.5k|    do {                                        \
  |  |   54|  24.5k|        (t) = 0;                                \
  |  |   55|  24.5k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  24.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 24.5k]
  |  |  ------------------
  ------------------
  824|  24.5k|        ASNAR(ep->f_copy_word,gsym->gs_size,psym->st_size);
  ------------------
  |  |   53|  24.5k|    do {                                        \
  |  |   54|  24.5k|        (t) = 0;                                \
  |  |   55|  24.5k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  24.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 24.5k]
  |  |  ------------------
  ------------------
  825|  24.5k|        ASNAR(ep->f_copy_word,gsym->gs_info,psym->st_info);
  ------------------
  |  |   53|  24.5k|    do {                                        \
  |  |   54|  24.5k|        (t) = 0;                                \
  |  |   55|  24.5k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  24.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 24.5k]
  |  |  ------------------
  ------------------
  826|  24.5k|        ASNAR(ep->f_copy_word,gsym->gs_other,psym->st_other);
  ------------------
  |  |   53|  24.5k|    do {                                        \
  |  |   54|  24.5k|        (t) = 0;                                \
  |  |   55|  24.5k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  24.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 24.5k]
  |  |  ------------------
  ------------------
  827|  24.5k|        ASNAR(ep->f_copy_word,gsym->gs_shndx,psym->st_shndx);
  ------------------
  |  |   53|  24.5k|    do {                                        \
  |  |   54|  24.5k|        (t) = 0;                                \
  |  |   55|  24.5k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  24.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 24.5k]
  |  |  ------------------
  ------------------
  828|  24.5k|        bind = gsym->gs_info >> 4;
  829|  24.5k|        type = gsym->gs_info & 0xf;
  830|  24.5k|        gsym->gs_bind = bind;
  831|  24.5k|        gsym->gs_type = type;
  832|  24.5k|    }
  833|      2|    psh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|      2|#define TRUE 1
  ------------------
  834|      2|    psh->gh_load_type = Dwarf_Alloc_Malloc;
  835|      2|    *count_out = ecount;
  836|      2|    *gsym_out = orig_gsym;
  837|      2|    return DW_DLV_OK;
  ------------------
  |  |   59|      2|#define DW_DLV_OK         0
  ------------------
  838|      2|}
dwarf_elf_load_headers.c:_dwarf_generic_elf_load_symbols64:
  846|      1|{
  847|      1|    Dwarf_Unsigned ecount = 0;
  848|      1|    Dwarf_Unsigned size = 0;
  849|      1|    Dwarf_Unsigned offset = 0;
  850|      1|    Dwarf_Unsigned size2 = 0;
  851|      1|    Dwarf_Unsigned i = 0;
  852|      1|    dw_elf64_sym  *psym = 0;
  853|      1|    struct generic_symentry * gsym = 0;
  854|      1|    struct generic_symentry * orig_gsym = 0;
  855|      1|    int            res = 0;
  856|      1|    Dwarf_Unsigned flags = 0;
  857|      1|    char *         content = 0;
  858|       |
  859|      1|    flags = psh->gh_flags;
  860|      1|    size = psh->gh_size;
  861|      1|    offset = psh->gh_offset;
  862|      1|    content = calloc(1,size);
  863|      1|    if (!content) {
  ------------------
  |  Branch (863:9): [True: 0, False: 1]
  ------------------
  864|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  865|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  866|      0|    }
  867|      1|    res = RRMOA(ep->f_fd,content,offset,size,
  ------------------
  |  |   65|      1|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|      1|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  868|      1|        ep->f_filesize,errcode);
  869|      1|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|      1|#define DW_DLV_OK         0
  ------------------
  |  Branch (869:9): [True: 0, False: 1]
  ------------------
  870|      0|        free(content);
  871|      0|        return res;
  872|      0|    }
  873|      1|    psh->gh_content = content;
  874|      1|    psh->gh_load_type = Dwarf_Alloc_Malloc;
  875|      1|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  293|      1|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (875:9): [True: 0, False: 1]
  ------------------
  876|       |#if defined(HAVE_ZLIB) && defined(HAVE_ZSTD)
  877|       |        *errcode = 0;
  878|       |        _dwarf_do_decompress_elf(ep,psh,errcode);
  879|       |        /* decompress and set new section size */
  880|       |
  881|       |        if (*errcode) {
  882|       |            free(psh->gh_content);
  883|       |            psh->gh_content = 0;
  884|       |            return DW_DLV_ERROR;
  885|       |        }
  886|       |#else /* COMPRESSED TEST */
  887|      0|        free(psh->gh_content);
  888|      0|        psh->gh_content = 0;
  889|      0|        *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      0|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
  890|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  891|      0|#endif /* COMPRESSED TEST */
  892|      0|    }
  893|      1|    size = psh->gh_size;
  894|      1|    ecount = (long)(size/sizeof(dw_elf64_sym));
  895|      1|    size2 = ecount * sizeof(dw_elf64_sym);
  896|      1|    if (size != size2) {
  ------------------
  |  Branch (896:9): [True: 0, False: 1]
  ------------------
  897|      0|        free(psh->gh_content);
  898|      0|        psh->gh_content = 0;
  899|      0|        *errcode = DW_DLE_SYMBOL_SECTION_SIZE_ERROR;
  ------------------
  |  | 1536|      0|#define DW_DLE_SYMBOL_SECTION_SIZE_ERROR       490
  ------------------
  900|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  901|      0|    }
  902|      1|    if (size >= ep->f_filesize ) {
  ------------------
  |  Branch (902:9): [True: 0, False: 1]
  ------------------
  903|      0|        free(psh->gh_content);
  904|      0|        psh->gh_content = 0;
  905|      0|        *errcode = DW_DLE_SYMBOL_SECTION_SIZE_ERROR;
  ------------------
  |  | 1536|      0|#define DW_DLE_SYMBOL_SECTION_SIZE_ERROR       490
  ------------------
  906|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  907|      0|    }
  908|      1|    psym = (dw_elf64_sym *)psh->gh_content;
  909|      1|    gsym = calloc(ecount,sizeof(struct generic_symentry));
  910|      1|    if (!gsym) {
  ------------------
  |  Branch (910:9): [True: 0, False: 1]
  ------------------
  911|      0|        free(psh->gh_content);
  912|      0|        psh->gh_content = 0;
  913|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  914|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  915|      0|    }
  916|      1|    res = RRMOA(ep->f_fd,psym,offset,size,
  ------------------
  |  |   65|      1|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|      1|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  917|      1|        ep->f_filesize,errcode);
  918|      1|    if (res!= DW_DLV_OK) {
  ------------------
  |  |   59|      1|#define DW_DLV_OK         0
  ------------------
  |  Branch (918:9): [True: 0, False: 1]
  ------------------
  919|      0|        free(gsym);
  920|      0|        free(psh->gh_content);
  921|      0|        psh->gh_content = 0;
  922|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  923|      0|        return res;
  924|      0|    }
  925|      1|    orig_gsym = gsym;
  926|     69|    for ( i = 0; i < ecount; ++i,++psym,++gsym) {
  ------------------
  |  Branch (926:18): [True: 68, False: 1]
  ------------------
  927|     68|        Dwarf_Unsigned bind = 0;
  928|     68|        Dwarf_Unsigned type = 0;
  929|       |
  930|     68|        ASNAR(ep->f_copy_word,gsym->gs_name,psym->st_name);
  ------------------
  |  |   53|     68|    do {                                        \
  |  |   54|     68|        (t) = 0;                                \
  |  |   55|     68|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     68|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 68]
  |  |  ------------------
  ------------------
  931|     68|        ASNAR(ep->f_copy_word,gsym->gs_value,psym->st_value);
  ------------------
  |  |   53|     68|    do {                                        \
  |  |   54|     68|        (t) = 0;                                \
  |  |   55|     68|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     68|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 68]
  |  |  ------------------
  ------------------
  932|     68|        ASNAR(ep->f_copy_word,gsym->gs_size,psym->st_size);
  ------------------
  |  |   53|     68|    do {                                        \
  |  |   54|     68|        (t) = 0;                                \
  |  |   55|     68|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     68|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 68]
  |  |  ------------------
  ------------------
  933|     68|        ASNAR(ep->f_copy_word,gsym->gs_info,psym->st_info);
  ------------------
  |  |   53|     68|    do {                                        \
  |  |   54|     68|        (t) = 0;                                \
  |  |   55|     68|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     68|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 68]
  |  |  ------------------
  ------------------
  934|     68|        ASNAR(ep->f_copy_word,gsym->gs_other,psym->st_other);
  ------------------
  |  |   53|     68|    do {                                        \
  |  |   54|     68|        (t) = 0;                                \
  |  |   55|     68|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     68|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 68]
  |  |  ------------------
  ------------------
  935|     68|        ASNAR(ep->f_copy_word,gsym->gs_shndx,psym->st_shndx);
  ------------------
  |  |   53|     68|    do {                                        \
  |  |   54|     68|        (t) = 0;                                \
  |  |   55|     68|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     68|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 68]
  |  |  ------------------
  ------------------
  936|     68|        bind = gsym->gs_info >> 4;
  937|     68|        type = gsym->gs_info & 0xf;
  938|     68|        gsym->gs_bind = bind;
  939|     68|        gsym->gs_type = type;
  940|     68|    }
  941|      1|    psh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|      1|#define TRUE 1
  ------------------
  942|      1|    *count_out = ecount;
  943|      1|    *gsym_out = orig_gsym;
  944|      1|    return DW_DLV_OK;
  ------------------
  |  |   59|      1|#define DW_DLV_OK         0
  ------------------
  945|      1|}
dwarf_elf_load_headers.c:is_empty_section:
  352|   527k|{
  353|   527k|    if (type == SHT_NOBITS) {
  ------------------
  |  |   87|   527k|#define SHT_NOBITS 8
  ------------------
  |  Branch (353:9): [True: 410, False: 527k]
  ------------------
  354|    410|        return TRUE;
  ------------------
  |  |   33|    410|#define TRUE 1
  ------------------
  355|    410|    }
  356|   527k|    if (type == SHT_NULL) {
  ------------------
  |  |   44|   527k|#define SHT_NULL 0
  ------------------
  |  Branch (356:9): [True: 518k, False: 8.57k]
  ------------------
  357|   518k|        return TRUE;
  ------------------
  |  |   33|   518k|#define TRUE 1
  ------------------
  358|   518k|    }
  359|  8.57k|    return FALSE;
  ------------------
  |  |   36|  8.57k|#define FALSE 0
  ------------------
  360|   527k|}
dwarf_elf_load_headers.c:this_rel_is_a_section_dwarf_related:
 1730|    447|{
 1731|    447|    Dwarf_Unsigned oksecnum = 0;
 1732|    447|    struct generic_shdr *gstarg = 0;
 1733|       |
 1734|    447|    if (gshdr->gh_type != SHT_RELA &&
  ------------------
  |  |   56|    894|#define SHT_RELA 4
  ------------------
  |  Branch (1734:9): [True: 115, False: 332]
  ------------------
 1735|    115|        gshdr->gh_type != SHT_REL)  {
  ------------------
  |  |   59|    115|#define SHT_REL 9
  ------------------
  |  Branch (1735:9): [True: 103, False: 12]
  ------------------
 1736|    103|        *oksecnum_out = 0;
 1737|    103|        return DW_DLV_OK;
  ------------------
  |  |   59|    103|#define DW_DLV_OK         0
  ------------------
 1738|    103|    }
 1739|    344|    oksecnum = gshdr->gh_reloc_target_secnum;
 1740|    344|    if (oksecnum >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (1740:9): [True: 1, False: 343]
  ------------------
 1741|      1|        *oksecnum_out = 0;
 1742|      1|        *errcode = DW_DLE_ELF_SECTION_ERROR;
  ------------------
  |  | 1492|      1|#define DW_DLE_ELF_SECTION_ERROR               446
  ------------------
 1743|      1|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
 1744|      1|    }
 1745|    343|    gstarg = ep->f_shdr+oksecnum;
 1746|    343|    if (!gstarg->gh_is_dwarf) {
  ------------------
  |  Branch (1746:9): [True: 232, False: 111]
  ------------------
 1747|    232|        *oksecnum_out = 0; /* no reloc needed. */
 1748|    232|        return DW_DLV_OK;
  ------------------
  |  |   59|    232|#define DW_DLV_OK         0
  ------------------
 1749|    232|    }
 1750|    111|    *oksecnum_out = (unsigned)oksecnum;
 1751|    111|    return DW_DLV_OK;
  ------------------
  |  |   59|    111|#define DW_DLV_OK         0
  ------------------
 1752|    343|}
dwarf_elf_load_headers.c:_dwarf_elf_load_a_relx_batch:
 1579|    111|{
 1580|    111|    Dwarf_Unsigned count = 0;
 1581|    111|    Dwarf_Unsigned size = 0;
 1582|    111|    Dwarf_Unsigned flags = 0;
 1583|    111|    Dwarf_Unsigned size2 = 0;
 1584|    111|    Dwarf_Unsigned sizeg = 0;
 1585|    111|    Dwarf_Unsigned offset = 0;
 1586|    111|    int            res = 0;
 1587|    111|    Dwarf_Unsigned object_reclen = 0;
 1588|    111|    struct generic_rela *grel = 0;
 1589|    111|    char *         relp = 0;
 1590|    111|    int            local_alloc = FALSE;
  ------------------
  |  |   36|    111|#define FALSE 0
  ------------------
 1591|       |
 1592|       |    /*  ASSERT: Caller guarantees localoffsetsize
 1593|       |        is a valid 4 or 8. */
 1594|       |    /*  ASSERT: Caller guarantees localrela is one
 1595|       |        of the 2 valid values 1 or 2 */
 1596|       |
 1597|    111|    flags = gsh->gh_flags;
 1598|    111|    offset = gsh->gh_offset;
 1599|    111|    size = gsh->gh_size;
 1600|    111|    if (size == 0) {
  ------------------
  |  Branch (1600:9): [True: 0, False: 111]
  ------------------
 1601|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1602|      0|    }
 1603|    111|    relp = (char *)gsh->gh_content;
 1604|    111|    if (!relp) {
  ------------------
  |  Branch (1604:9): [True: 110, False: 1]
  ------------------
 1605|    110|        relp = (char *)malloc(size);
 1606|    110|        local_alloc = TRUE;
  ------------------
  |  |   33|    110|#define TRUE 1
  ------------------
 1607|    110|    }
 1608|    111|    if (!relp) {
  ------------------
  |  Branch (1608:9): [True: 0, False: 111]
  ------------------
 1609|      0|        *errcode = DW_DLE_REL_ALLOC;
  ------------------
  |  | 1178|      0|#define DW_DLE_REL_ALLOC                       133
  ------------------
 1610|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1611|      0|    }
 1612|    111|    if ((offset > ep->f_filesize)||
  ------------------
  |  Branch (1612:9): [True: 1, False: 110]
  ------------------
 1613|    110|        (size > ep->f_filesize) ||
  ------------------
  |  Branch (1613:9): [True: 0, False: 110]
  ------------------
 1614|    110|        ((size +offset) > ep->f_filesize)) {
  ------------------
  |  Branch (1614:9): [True: 0, False: 110]
  ------------------
 1615|      1|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|      1|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1616|      1|        if (local_alloc) {
  ------------------
  |  Branch (1616:13): [True: 1, False: 0]
  ------------------
 1617|      1|            free(relp);
 1618|      1|        }
 1619|      1|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
 1620|      1|    }
 1621|    110|    res = RRMOA(ep->f_fd,relp,offset,size,
  ------------------
  |  |   65|    110|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    110|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1622|    110|        ep->f_filesize,errcode);
 1623|    110|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    110|#define DW_DLV_OK         0
  ------------------
  |  Branch (1623:9): [True: 0, False: 110]
  ------------------
 1624|      0|        free(relp);
 1625|      0|        free(grel);
 1626|      0|        return res;
 1627|      0|    }
 1628|    110|    if (local_alloc) {
  ------------------
  |  Branch (1628:9): [True: 109, False: 1]
  ------------------
 1629|    109|        gsh->gh_content = relp;
 1630|    109|        gsh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|    109|#define TRUE 1
  ------------------
 1631|    109|        gsh->gh_load_type = Dwarf_Alloc_Malloc;
 1632|    109|    }
 1633|    110|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  293|    110|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (1633:9): [True: 1, False: 109]
  ------------------
 1634|       |#if defined(HAVE_ZLIB) && defined(HAVE_ZSTD)
 1635|       |        *errcode = 0;
 1636|       |        _dwarf_do_decompress_elf(ep,gsh,errcode);
 1637|       |        /* decompress and set new section size */
 1638|       |        if (*errcode) {
 1639|       |            return DW_DLV_ERROR;
 1640|       |        }
 1641|       |#else /* COMPRESSED TEST */
 1642|      1|        *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      1|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
 1643|      1|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
 1644|      1|#endif /* COMPRESSED TEST */
 1645|      1|    }
 1646|    109|    size = gsh->gh_size;
 1647|    109|    if (localoffsize == RelocOffset32) {
  ------------------
  |  Branch (1647:9): [True: 11, False: 98]
  ------------------
 1648|     11|        if (localrela ==  RelocIsRela) {
  ------------------
  |  Branch (1648:13): [True: 10, False: 1]
  ------------------
 1649|     10|            object_reclen = sizeof(dw_elf32_rela);
 1650|     10|            count = (long)(size/object_reclen);
 1651|     10|            size2 = count * object_reclen;
 1652|     10|            if (size != size2) {
  ------------------
  |  Branch (1652:17): [True: 0, False: 10]
  ------------------
 1653|      0|                *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      0|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1654|      0|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1655|      0|            }
 1656|     10|        } else {
 1657|      1|            object_reclen = sizeof(dw_elf32_rel);
 1658|      1|            count = (long)(size/object_reclen);
 1659|      1|            size2 = count * object_reclen;
 1660|      1|            if (size != size2) {
  ------------------
  |  Branch (1660:17): [True: 1, False: 0]
  ------------------
 1661|      1|                *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      1|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1662|      1|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
 1663|      1|            }
 1664|      1|        }
 1665|     98|    } else {
 1666|     98|        if (localrela ==  RelocIsRela) {
  ------------------
  |  Branch (1666:13): [True: 94, False: 4]
  ------------------
 1667|     94|            object_reclen = sizeof(dw_elf64_rela);
 1668|     94|            count = (long)(size/object_reclen);
 1669|     94|            size2 = count * object_reclen;
 1670|     94|            if (size != size2) {
  ------------------
  |  Branch (1670:17): [True: 0, False: 94]
  ------------------
 1671|      0|                *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      0|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1672|      0|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1673|      0|            }
 1674|     94|        } else {
 1675|      4|            object_reclen = sizeof(dw_elf64_rel);
 1676|      4|            count = (long)(size/object_reclen);
 1677|      4|            size2 = count * object_reclen;
 1678|      4|            if (size != size2) {
  ------------------
  |  Branch (1678:17): [True: 0, False: 4]
  ------------------
 1679|      0|                *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      0|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1680|      0|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1681|      0|            }
 1682|      4|        }
 1683|     98|    }
 1684|       |
 1685|    108|    sizeg = count*sizeof(struct generic_rela);
 1686|    108|    grel = (struct generic_rela *)malloc(sizeg);
 1687|    108|    if (!grel) {
  ------------------
  |  Branch (1687:9): [True: 0, False: 108]
  ------------------
 1688|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1689|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1690|      0|    }
 1691|    108|    if (localoffsize == RelocOffset32) {
  ------------------
  |  Branch (1691:9): [True: 10, False: 98]
  ------------------
 1692|     10|        if (localrela ==  RelocIsRela) {
  ------------------
  |  Branch (1692:13): [True: 10, False: 0]
  ------------------
 1693|     10|            res = generic_rel_from_rela32(ep,gsh,
 1694|     10|                (dw_elf32_rela *)gsh->gh_content,grel,errcode);
 1695|     10|        } else {
 1696|      0|            res = generic_rel_from_rel32(ep,gsh,
 1697|      0|                (dw_elf32_rel *)gsh->gh_content,grel,errcode);
 1698|      0|        }
 1699|     98|    } else {
 1700|     98|        if (localrela ==  RelocIsRela) {
  ------------------
  |  Branch (1700:13): [True: 94, False: 4]
  ------------------
 1701|     94|            res = generic_rel_from_rela64(ep,gsh,
 1702|     94|                (dw_elf64_rela *)gsh->gh_content,grel,errcode);
 1703|     94|        } else {
 1704|      4|            res = generic_rel_from_rel64(ep,gsh,
 1705|      4|                (dw_elf64_rel *)gsh->gh_content,grel,errcode);
 1706|      4|        }
 1707|     98|    }
 1708|    108|    if (res == DW_DLV_OK) {
  ------------------
  |  |   59|    108|#define DW_DLV_OK         0
  ------------------
  |  Branch (1708:9): [True: 108, False: 0]
  ------------------
 1709|    108|        gsh->gh_relcount = count;
 1710|    108|        gsh->gh_rels = grel;
 1711|    108|        *count_out = count;
 1712|    108|        *grel_out = grel;
 1713|    108|        return res;
 1714|    108|    }
 1715|       |    /* Some sort of issue */
 1716|      0|    count_out = 0;
 1717|      0|    free(grel);
 1718|      0|    return res;
 1719|    108|}
dwarf_elf_load_headers.c:generic_rel_from_rela32:
 1027|     10|{
 1028|     10|    Dwarf_Unsigned ecount = 0;
 1029|     10|    Dwarf_Unsigned size = gsh->gh_size;
 1030|     10|    Dwarf_Unsigned size2 = 0;
 1031|     10|    Dwarf_Unsigned i = 0;
 1032|       |
 1033|     10|    ecount = size/sizeof(dw_elf32_rela);
 1034|     10|    size2 = ecount * sizeof(dw_elf32_rela);
 1035|     10|    if (size >= ep->f_filesize) {
  ------------------
  |  Branch (1035:9): [True: 0, False: 10]
  ------------------
 1036|      0|        *errcode = DW_DLE_RELOCATION_SECTION_SIZE_ERROR;
  ------------------
  |  | 1535|      0|#define DW_DLE_RELOCATION_SECTION_SIZE_ERROR   489
  ------------------
 1037|      0|        return  DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1038|      0|    }
 1039|     10|    if (size != size2) {
  ------------------
  |  Branch (1039:9): [True: 0, False: 10]
  ------------------
 1040|      0|        *errcode = DW_DLE_RELOCATION_SECTION_SIZE_ERROR;
  ------------------
  |  | 1535|      0|#define DW_DLE_RELOCATION_SECTION_SIZE_ERROR   489
  ------------------
 1041|      0|        return  DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1042|      0|    }
 1043|  6.16k|    for ( i = 0; i < ecount; ++i,++relp,++grel) {
  ------------------
  |  Branch (1043:18): [True: 6.15k, False: 10]
  ------------------
 1044|  6.15k|        ASNAR(ep->f_copy_word,grel->gr_offset,relp->r_offset);
  ------------------
  |  |   53|  6.15k|    do {                                        \
  |  |   54|  6.15k|        (t) = 0;                                \
  |  |   55|  6.15k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  6.15k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 6.15k]
  |  |  ------------------
  ------------------
 1045|  6.15k|        ASNAR(ep->f_copy_word,grel->gr_info,relp->r_info);
  ------------------
  |  |   53|  6.15k|    do {                                        \
  |  |   54|  6.15k|        (t) = 0;                                \
  |  |   55|  6.15k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  6.15k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 6.15k]
  |  |  ------------------
  ------------------
 1046|       |        /* addend signed */
 1047|  6.15k|        ASNAR(ep->f_copy_word,grel->gr_addend,relp->r_addend);
  ------------------
  |  |   53|  6.15k|    do {                                        \
  |  |   54|  6.15k|        (t) = 0;                                \
  |  |   55|  6.15k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  6.15k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 6.15k]
  |  |  ------------------
  ------------------
 1048|  6.15k|        SIGN_EXTEND(grel->gr_addend,sizeof(relp->r_addend));
  ------------------
  |  |  102|  6.15k|    do {                                                          \
  |  |  103|  6.15k|        if (*(Dwarf_Sbyte *)((char *)&(dest)+ ((length)-1)) < 0) { \
  |  |  ------------------
  |  |  |  Branch (103:13): [True: 14, False: 6.14k]
  |  |  ------------------
  |  |  104|     14|            memcpy((char *)&(dest)+(length),                      \
  |  |  105|     14|                "\xff\xff\xff\xff\xff\xff\xff\xff",               \
  |  |  106|     14|                sizeof(dest) - (length));                         \
  |  |  107|     14|        }                                                         \
  |  |  108|  6.15k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (108:14): [Folded, False: 6.15k]
  |  |  ------------------
  ------------------
 1049|  6.15k|        grel->gr_sym  = grel->gr_info>>8; /* ELF32_R_SYM */
 1050|  6.15k|        grel->gr_type = grel->gr_info & 0xff;
 1051|  6.15k|        grel->gr_is_rela = TRUE;
  ------------------
  |  |   33|  6.15k|#define TRUE 1
  ------------------
 1052|  6.15k|    }
 1053|     10|    return DW_DLV_OK;
  ------------------
  |  |   59|     10|#define DW_DLV_OK         0
  ------------------
 1054|     10|}
dwarf_elf_load_headers.c:generic_rel_from_rela64:
 1062|     94|{
 1063|     94|    Dwarf_Unsigned ecount = 0;
 1064|     94|    Dwarf_Unsigned size = gsh->gh_size;
 1065|     94|    Dwarf_Unsigned size2 = 0;
 1066|     94|    Dwarf_Unsigned i = 0;
 1067|     94|    int objlittleendian = (ep->f_endian == DW_END_little);
  ------------------
  |  | 1115|     94|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1068|     94|    int ismips64 = (ep->f_machine == EM_MIPS);
  ------------------
  |  |  209|     94|#define EM_MIPS          8
  ------------------
 1069|     94|    int issparcv9 = (ep->f_machine == EM_SPARCV9);
  ------------------
  |  |  263|     94|#define EM_SPARCV9       43
  ------------------
 1070|       |
 1071|     94|    ecount = size/sizeof(dw_elf64_rela);
 1072|     94|    size2 = ecount * sizeof(dw_elf64_rela);
 1073|     94|    if (size >= ep->f_filesize) {
  ------------------
  |  Branch (1073:9): [True: 0, False: 94]
  ------------------
 1074|      0|        *errcode = DW_DLE_RELOCATION_SECTION_SIZE_ERROR;
  ------------------
  |  | 1535|      0|#define DW_DLE_RELOCATION_SECTION_SIZE_ERROR   489
  ------------------
 1075|      0|        return  DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1076|      0|    }
 1077|     94|    if (size != size2) {
  ------------------
  |  Branch (1077:9): [True: 0, False: 94]
  ------------------
 1078|      0|        *errcode = DW_DLE_RELOCATION_SECTION_SIZE_ERROR;
  ------------------
  |  | 1535|      0|#define DW_DLE_RELOCATION_SECTION_SIZE_ERROR   489
  ------------------
 1079|      0|        return  DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1080|      0|    }
 1081|  68.7k|    for ( i = 0; i < ecount; ++i,++relp,++grel) {
  ------------------
  |  Branch (1081:18): [True: 68.6k, False: 94]
  ------------------
 1082|  68.6k|        ASNAR(ep->f_copy_word,grel->gr_offset,relp->r_offset);
  ------------------
  |  |   53|  68.6k|    do {                                        \
  |  |   54|  68.6k|        (t) = 0;                                \
  |  |   55|  68.6k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  68.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 68.6k]
  |  |  ------------------
  ------------------
 1083|  68.6k|        ASNAR(ep->f_copy_word,grel->gr_info,relp->r_info);
  ------------------
  |  |   53|  68.6k|    do {                                        \
  |  |   54|  68.6k|        (t) = 0;                                \
  |  |   55|  68.6k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  68.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 68.6k]
  |  |  ------------------
  ------------------
 1084|  68.6k|        ASNAR(ep->f_copy_word,grel->gr_addend,relp->r_addend);
  ------------------
  |  |   53|  68.6k|    do {                                        \
  |  |   54|  68.6k|        (t) = 0;                                \
  |  |   55|  68.6k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  68.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 68.6k]
  |  |  ------------------
  ------------------
 1085|  68.6k|        SIGN_EXTEND(grel->gr_addend,sizeof(relp->r_addend));
  ------------------
  |  |  102|  68.6k|    do {                                                          \
  |  |  103|  68.6k|        if (*(Dwarf_Sbyte *)((char *)&(dest)+ ((length)-1)) < 0) { \
  |  |  ------------------
  |  |  |  Branch (103:13): [True: 40.4k, False: 28.2k]
  |  |  ------------------
  |  |  104|  40.4k|            memcpy((char *)&(dest)+(length),                      \
  |  |  105|  40.4k|                "\xff\xff\xff\xff\xff\xff\xff\xff",               \
  |  |  106|  40.4k|                sizeof(dest) - (length));                         \
  |  |  107|  40.4k|        }                                                         \
  |  |  108|  68.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (108:14): [Folded, False: 68.6k]
  |  |  ------------------
  ------------------
 1086|  68.6k|        if (ismips64 && objlittleendian ) {
  ------------------
  |  Branch (1086:13): [True: 0, False: 68.6k]
  |  Branch (1086:25): [True: 0, False: 0]
  ------------------
 1087|      0|            char realsym[4];
 1088|       |
 1089|      0|            memcpy(realsym,&relp->r_info,sizeof(realsym));
 1090|      0|            ASNAR(ep->f_copy_word,grel->gr_sym,realsym);
  ------------------
  |  |   53|      0|    do {                                        \
  |  |   54|      0|        (t) = 0;                                \
  |  |   55|      0|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1091|      0|            grel->gr_type  = relp->r_info[7];
 1092|      0|            grel->gr_type2 = relp->r_info[6];
 1093|      0|            grel->gr_type3 = relp->r_info[5];
 1094|  68.6k|        } else if (issparcv9) {
  ------------------
  |  Branch (1094:20): [True: 0, False: 68.6k]
  ------------------
 1095|       |            /*  Always Big Endian?  */
 1096|      0|            char realsym[4];
 1097|       |
 1098|      0|            memcpy(realsym,&relp->r_info,sizeof(realsym));
 1099|      0|            ASNAR(ep->f_copy_word,grel->gr_sym,realsym);
  ------------------
  |  |   53|      0|    do {                                        \
  |  |   54|      0|        (t) = 0;                                \
  |  |   55|      0|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1100|      0|            grel->gr_type  = relp->r_info[7];
 1101|  68.6k|        } else {
 1102|  68.6k|            grel->gr_sym  = grel->gr_info >> 32;
 1103|  68.6k|            grel->gr_type = grel->gr_info & 0xffffffff;
 1104|  68.6k|        }
 1105|  68.6k|        grel->gr_is_rela = TRUE;
  ------------------
  |  |   33|  68.6k|#define TRUE 1
  ------------------
 1106|  68.6k|    }
 1107|     94|    return DW_DLV_OK;
  ------------------
  |  |   59|     94|#define DW_DLV_OK         0
  ------------------
 1108|     94|}
dwarf_elf_load_headers.c:generic_rel_from_rel64:
 1149|      4|{
 1150|      4|    Dwarf_Unsigned ecount = 0;
 1151|      4|    Dwarf_Unsigned size = gsh->gh_size;
 1152|      4|    Dwarf_Unsigned size2 = 0;
 1153|      4|    Dwarf_Unsigned i = 0;
 1154|      4|    int objlittleendian = (ep->f_endian == DW_END_little);
  ------------------
  |  | 1115|      4|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1155|      4|    int ismips64 = (ep->f_machine == EM_MIPS);
  ------------------
  |  |  209|      4|#define EM_MIPS          8
  ------------------
 1156|      4|    int issparcv9 = (ep->f_machine == EM_SPARCV9);
  ------------------
  |  |  263|      4|#define EM_SPARCV9       43
  ------------------
 1157|       |
 1158|      4|    ecount = size/sizeof(dw_elf64_rel);
 1159|      4|    size2 = ecount * sizeof(dw_elf64_rel);
 1160|      4|    if (size >= ep->f_filesize) {
  ------------------
  |  Branch (1160:9): [True: 0, False: 4]
  ------------------
 1161|      0|        *errcode = DW_DLE_RELOCATION_SECTION_SIZE_ERROR;
  ------------------
  |  | 1535|      0|#define DW_DLE_RELOCATION_SECTION_SIZE_ERROR   489
  ------------------
 1162|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1163|      0|    }
 1164|      4|    if (size != size2) {
  ------------------
  |  Branch (1164:9): [True: 0, False: 4]
  ------------------
 1165|      0|        *errcode = DW_DLE_RELOCATION_SECTION_SIZE_ERROR;
  ------------------
  |  | 1535|      0|#define DW_DLE_RELOCATION_SECTION_SIZE_ERROR   489
  ------------------
 1166|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1167|      0|    }
 1168|  13.2k|    for ( i = 0; i < ecount; ++i,++relp,++grel) {
  ------------------
  |  Branch (1168:18): [True: 13.2k, False: 4]
  ------------------
 1169|  13.2k|        ASNAR(ep->f_copy_word,grel->gr_offset,relp->r_offset);
  ------------------
  |  |   53|  13.2k|    do {                                        \
  |  |   54|  13.2k|        (t) = 0;                                \
  |  |   55|  13.2k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  13.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 13.2k]
  |  |  ------------------
  ------------------
 1170|  13.2k|        ASNAR(ep->f_copy_word,grel->gr_info,relp->r_info);
  ------------------
  |  |   53|  13.2k|    do {                                        \
  |  |   54|  13.2k|        (t) = 0;                                \
  |  |   55|  13.2k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  13.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 13.2k]
  |  |  ------------------
  ------------------
 1171|  13.2k|        grel->gr_addend  = 0; /* Unused for plain .rel */
 1172|  13.2k|        if (ismips64 && objlittleendian ) {
  ------------------
  |  Branch (1172:13): [True: 0, False: 13.2k]
  |  Branch (1172:25): [True: 0, False: 0]
  ------------------
 1173|      0|            char realsym[4];
 1174|       |
 1175|      0|            memcpy(realsym,&relp->r_info,sizeof(realsym));
 1176|      0|            ASNAR(ep->f_copy_word,grel->gr_sym,realsym);
  ------------------
  |  |   53|      0|    do {                                        \
  |  |   54|      0|        (t) = 0;                                \
  |  |   55|      0|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1177|      0|            grel->gr_type  = relp->r_info[7];
 1178|      0|            grel->gr_type2 = relp->r_info[6];
 1179|      0|            grel->gr_type3 = relp->r_info[5];
 1180|  13.2k|        } else if (issparcv9) {
  ------------------
  |  Branch (1180:20): [True: 0, False: 13.2k]
  ------------------
 1181|       |            /*  Always Big Endian?  */
 1182|      0|            char realsym[4];
 1183|       |
 1184|      0|            memcpy(realsym,&relp->r_info,sizeof(realsym));
 1185|      0|            ASNAR(ep->f_copy_word,grel->gr_sym,realsym);
  ------------------
  |  |   53|      0|    do {                                        \
  |  |   54|      0|        (t) = 0;                                \
  |  |   55|      0|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1186|      0|            grel->gr_type  = relp->r_info[7];
 1187|  13.2k|        } else {
 1188|  13.2k|            grel->gr_sym  = grel->gr_info >>32;
 1189|  13.2k|            grel->gr_type = grel->gr_info & 0xffffffff;
 1190|  13.2k|        }
 1191|  13.2k|        grel->gr_is_rela = FALSE;
  ------------------
  |  |   36|  13.2k|#define FALSE 0
  ------------------
 1192|  13.2k|    }
 1193|      4|    return DW_DLV_OK;
  ------------------
  |  |   59|      4|#define DW_DLV_OK         0
  ------------------
 1194|      4|}
dwarf_elf_load_headers.c:elf_load_elf_header32:
 1900|     48|{
 1901|     48|    int res = 0;
 1902|     48|    dw_elf32_ehdr ehdr32;
 1903|     48|    struct generic_ehdr *ehdr = 0;
 1904|       |
 1905|     48|    ehdr32 = eh32_zero;
 1906|     48|    res = RRMOA(ep->f_fd,&ehdr32,0,sizeof(ehdr32),
  ------------------
  |  |   65|     48|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     48|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1907|     48|        ep->f_filesize,errcode);
 1908|     48|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     48|#define DW_DLV_OK         0
  ------------------
  |  Branch (1908:9): [True: 0, False: 48]
  ------------------
 1909|      0|        return res;
 1910|      0|    }
 1911|     48|    ehdr = (struct generic_ehdr *)calloc(1,
 1912|     48|        sizeof(struct generic_ehdr));
 1913|     48|    if (!ehdr) {
  ------------------
  |  Branch (1913:9): [True: 0, False: 48]
  ------------------
 1914|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1915|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1916|      0|    }
 1917|     48|    res  = generic_ehdr_from_32(ep,ehdr,&ehdr32,errcode);
 1918|     48|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     48|#define DW_DLV_OK         0
  ------------------
  |  Branch (1918:9): [True: 0, False: 48]
  ------------------
 1919|      0|        free(ehdr);
 1920|      0|        return res;
 1921|      0|    }
 1922|     48|    ep->f_machine = (unsigned)ehdr->ge_machine;
 1923|     48|    ep->f_flags = ehdr->ge_flags;
 1924|     48|    return res;
 1925|     48|}
dwarf_elf_load_headers.c:generic_ehdr_from_32:
  366|     48|{
  367|     48|    int i = 0;
  368|       |
  369|    816|    for (i = 0; i < EI_NIDENT; ++i) {
  ------------------
  |  |  926|    816|#define EI_NIDENT 16
  ------------------
  |  Branch (369:17): [True: 768, False: 48]
  ------------------
  370|    768|        ehdr->ge_ident[i] = e->e_ident[i];
  371|    768|    }
  372|     48|    ASNAR(ep->f_copy_word,ehdr->ge_type,e->e_type);
  ------------------
  |  |   53|     48|    do {                                        \
  |  |   54|     48|        (t) = 0;                                \
  |  |   55|     48|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     48|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 48]
  |  |  ------------------
  ------------------
  373|     48|    ASNAR(ep->f_copy_word,ehdr->ge_machine,e->e_machine);
  ------------------
  |  |   53|     48|    do {                                        \
  |  |   54|     48|        (t) = 0;                                \
  |  |   55|     48|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     48|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 48]
  |  |  ------------------
  ------------------
  374|     48|    ASNAR(ep->f_copy_word,ehdr->ge_version,e->e_version);
  ------------------
  |  |   53|     48|    do {                                        \
  |  |   54|     48|        (t) = 0;                                \
  |  |   55|     48|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     48|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 48]
  |  |  ------------------
  ------------------
  375|     48|    ASNAR(ep->f_copy_word,ehdr->ge_entry,e->e_entry);
  ------------------
  |  |   53|     48|    do {                                        \
  |  |   54|     48|        (t) = 0;                                \
  |  |   55|     48|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     48|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 48]
  |  |  ------------------
  ------------------
  376|     48|    ASNAR(ep->f_copy_word,ehdr->ge_phoff,e->e_phoff);
  ------------------
  |  |   53|     48|    do {                                        \
  |  |   54|     48|        (t) = 0;                                \
  |  |   55|     48|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     48|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 48]
  |  |  ------------------
  ------------------
  377|     48|    ASNAR(ep->f_copy_word,ehdr->ge_shoff,e->e_shoff);
  ------------------
  |  |   53|     48|    do {                                        \
  |  |   54|     48|        (t) = 0;                                \
  |  |   55|     48|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     48|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 48]
  |  |  ------------------
  ------------------
  378|     48|    ASNAR(ep->f_copy_word,ehdr->ge_flags,e->e_flags);
  ------------------
  |  |   53|     48|    do {                                        \
  |  |   54|     48|        (t) = 0;                                \
  |  |   55|     48|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     48|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 48]
  |  |  ------------------
  ------------------
  379|     48|    ASNAR(ep->f_copy_word,ehdr->ge_ehsize,e->e_ehsize);
  ------------------
  |  |   53|     48|    do {                                        \
  |  |   54|     48|        (t) = 0;                                \
  |  |   55|     48|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     48|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 48]
  |  |  ------------------
  ------------------
  380|     48|    ASNAR(ep->f_copy_word,ehdr->ge_phentsize,e->e_phentsize);
  ------------------
  |  |   53|     48|    do {                                        \
  |  |   54|     48|        (t) = 0;                                \
  |  |   55|     48|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     48|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 48]
  |  |  ------------------
  ------------------
  381|     48|    ASNAR(ep->f_copy_word,ehdr->ge_phnum,e->e_phnum);
  ------------------
  |  |   53|     48|    do {                                        \
  |  |   54|     48|        (t) = 0;                                \
  |  |   55|     48|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     48|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 48]
  |  |  ------------------
  ------------------
  382|     48|    ASNAR(ep->f_copy_word,ehdr->ge_shentsize,e->e_shentsize);
  ------------------
  |  |   53|     48|    do {                                        \
  |  |   54|     48|        (t) = 0;                                \
  |  |   55|     48|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     48|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 48]
  |  |  ------------------
  ------------------
  383|     48|    ASNAR(ep->f_copy_word,ehdr->ge_shnum,e->e_shnum);
  ------------------
  |  |   53|     48|    do {                                        \
  |  |   54|     48|        (t) = 0;                                \
  |  |   55|     48|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     48|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 48]
  |  |  ------------------
  ------------------
  384|     48|    ASNAR(ep->f_copy_word,ehdr->ge_shstrndx,e->e_shstrndx);
  ------------------
  |  |   53|     48|    do {                                        \
  |  |   54|     48|        (t) = 0;                                \
  |  |   55|     48|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     48|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 48]
  |  |  ------------------
  ------------------
  385|     48|    if (!ehdr->ge_shoff) {
  ------------------
  |  Branch (385:9): [True: 0, False: 48]
  ------------------
  386|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  387|      0|    }
  388|     48|    if (ehdr->ge_shoff < sizeof(dw_elf32_ehdr)) {
  ------------------
  |  Branch (388:9): [True: 0, False: 48]
  ------------------
  389|       |        /* offset is inside the header! */
  390|      0|        *errcode = DW_DLE_TOO_FEW_SECTIONS;
  ------------------
  |  | 1540|      0|#define DW_DLE_TOO_FEW_SECTIONS                494
  ------------------
  391|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  392|      0|    }
  393|     48|    if (ehdr->ge_shstrndx == SHN_XINDEX) {
  ------------------
  |  |  307|     48|#define SHN_XINDEX 0xffff
  ------------------
  |  Branch (393:9): [True: 0, False: 48]
  ------------------
  394|      0|        ehdr->ge_strndx_extended = TRUE;
  ------------------
  |  |   33|      0|#define TRUE 1
  ------------------
  395|     48|    } else {
  396|     48|        ehdr->ge_strndx_in_strndx = TRUE;
  ------------------
  |  |   33|     48|#define TRUE 1
  ------------------
  397|     48|        if (ehdr->ge_shstrndx < 1) {
  ------------------
  |  Branch (397:13): [True: 0, False: 48]
  ------------------
  398|      0|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|      0|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
  399|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  400|      0|        }
  401|     48|    }
  402|       |    /*  If !ge_strndx_extended && !ehdr->ge_shnum
  403|       |        this is a very unusual case.  */
  404|     48|    if (!ehdr->ge_shnum) {
  ------------------
  |  Branch (404:9): [True: 4, False: 44]
  ------------------
  405|      4|        ehdr->ge_shnum_extended = TRUE;
  ------------------
  |  |   33|      4|#define TRUE 1
  ------------------
  406|     44|    } else {
  407|     44|        ehdr->ge_shnum_in_shnum = TRUE;
  ------------------
  |  |   33|     44|#define TRUE 1
  ------------------
  408|     44|        if (!ehdr->ge_shnum) {
  ------------------
  |  Branch (408:13): [True: 0, False: 44]
  ------------------
  409|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  410|      0|        }
  411|     44|        if (ehdr->ge_shnum < 3) {
  ------------------
  |  Branch (411:13): [True: 0, False: 44]
  ------------------
  412|      0|            *errcode = DW_DLE_TOO_FEW_SECTIONS;
  ------------------
  |  | 1540|      0|#define DW_DLE_TOO_FEW_SECTIONS                494
  ------------------
  413|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  414|      0|        }
  415|     44|    }
  416|     48|    if (ehdr->ge_shnum_in_shnum &&
  ------------------
  |  Branch (416:9): [True: 44, False: 4]
  ------------------
  417|     44|        ehdr->ge_strndx_in_strndx &&
  ------------------
  |  Branch (417:9): [True: 44, False: 0]
  ------------------
  418|     44|        (ehdr->ge_shstrndx >= ehdr->ge_shnum)) {
  ------------------
  |  Branch (418:9): [True: 0, False: 44]
  ------------------
  419|      0|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|      0|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
  420|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  421|      0|    }
  422|       |
  423|     48|    ep->f_machine = (unsigned int)ehdr->ge_machine;
  424|     48|    ep->f_ftype = (unsigned int)ehdr->ge_type;
  425|     48|    ep->f_ehdr = ehdr;
  426|     48|    ep->f_loc_ehdr.g_name = "Elf File Header";
  427|     48|    ep->f_loc_ehdr.g_offset = 0;
  428|     48|    ep->f_loc_ehdr.g_count = 1;
  429|     48|    ep->f_loc_ehdr.g_entrysize = sizeof(dw_elf32_ehdr);
  430|     48|    ep->f_loc_ehdr.g_totalsize = sizeof(dw_elf32_ehdr);
  431|     48|    return DW_DLV_OK;
  ------------------
  |  |   59|     48|#define DW_DLV_OK         0
  ------------------
  432|     48|}
dwarf_elf_load_headers.c:elf_load_elf_header64:
 1929|     26|{
 1930|     26|    int res = 0;
 1931|     26|    dw_elf64_ehdr ehdr64;
 1932|     26|    struct generic_ehdr *ehdr = 0;
 1933|       |
 1934|     26|    ehdr64 = eh64_zero;
 1935|     26|    res = RRMOA(ep->f_fd,&ehdr64,0,sizeof(ehdr64),
  ------------------
  |  |   65|     26|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     26|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1936|     26|        ep->f_filesize,errcode);
 1937|     26|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     26|#define DW_DLV_OK         0
  ------------------
  |  Branch (1937:9): [True: 0, False: 26]
  ------------------
 1938|      0|        return res;
 1939|      0|    }
 1940|     26|    ehdr = (struct generic_ehdr *)calloc(1,
 1941|     26|        sizeof(struct generic_ehdr));
 1942|     26|    if (!ehdr) {
  ------------------
  |  Branch (1942:9): [True: 0, False: 26]
  ------------------
 1943|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1944|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1945|      0|    }
 1946|     26|    res  = generic_ehdr_from_64(ep,ehdr,&ehdr64,errcode);
 1947|     26|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     26|#define DW_DLV_OK         0
  ------------------
  |  Branch (1947:9): [True: 0, False: 26]
  ------------------
 1948|      0|        free(ehdr);
 1949|      0|        return res;
 1950|      0|    }
 1951|     26|    ep->f_machine = (unsigned)ehdr->ge_machine;
 1952|     26|    ep->f_flags = ehdr->ge_flags;
 1953|     26|    return res;
 1954|     26|}
dwarf_elf_load_headers.c:generic_ehdr_from_64:
  438|     26|{
  439|     26|    int i = 0;
  440|       |
  441|    442|    for (i = 0; i < EI_NIDENT; ++i) {
  ------------------
  |  |  926|    442|#define EI_NIDENT 16
  ------------------
  |  Branch (441:17): [True: 416, False: 26]
  ------------------
  442|    416|        ehdr->ge_ident[i] = e->e_ident[i];
  443|    416|    }
  444|     26|    ASNAR(ep->f_copy_word,ehdr->ge_type,e->e_type);
  ------------------
  |  |   53|     26|    do {                                        \
  |  |   54|     26|        (t) = 0;                                \
  |  |   55|     26|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     26|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  445|     26|    ASNAR(ep->f_copy_word,ehdr->ge_machine,e->e_machine);
  ------------------
  |  |   53|     26|    do {                                        \
  |  |   54|     26|        (t) = 0;                                \
  |  |   55|     26|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     26|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  446|     26|    ASNAR(ep->f_copy_word,ehdr->ge_version,e->e_version);
  ------------------
  |  |   53|     26|    do {                                        \
  |  |   54|     26|        (t) = 0;                                \
  |  |   55|     26|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     26|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  447|     26|    ASNAR(ep->f_copy_word,ehdr->ge_entry,e->e_entry);
  ------------------
  |  |   53|     26|    do {                                        \
  |  |   54|     26|        (t) = 0;                                \
  |  |   55|     26|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     26|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  448|     26|    ASNAR(ep->f_copy_word,ehdr->ge_phoff,e->e_phoff);
  ------------------
  |  |   53|     26|    do {                                        \
  |  |   54|     26|        (t) = 0;                                \
  |  |   55|     26|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     26|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  449|     26|    ASNAR(ep->f_copy_word,ehdr->ge_shoff,e->e_shoff);
  ------------------
  |  |   53|     26|    do {                                        \
  |  |   54|     26|        (t) = 0;                                \
  |  |   55|     26|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     26|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  450|     26|    ASNAR(ep->f_copy_word,ehdr->ge_flags,e->e_flags);
  ------------------
  |  |   53|     26|    do {                                        \
  |  |   54|     26|        (t) = 0;                                \
  |  |   55|     26|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     26|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  451|     26|    ASNAR(ep->f_copy_word,ehdr->ge_ehsize,e->e_ehsize);
  ------------------
  |  |   53|     26|    do {                                        \
  |  |   54|     26|        (t) = 0;                                \
  |  |   55|     26|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     26|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  452|     26|    ASNAR(ep->f_copy_word,ehdr->ge_phentsize,e->e_phentsize);
  ------------------
  |  |   53|     26|    do {                                        \
  |  |   54|     26|        (t) = 0;                                \
  |  |   55|     26|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     26|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  453|     26|    ASNAR(ep->f_copy_word,ehdr->ge_phnum,e->e_phnum);
  ------------------
  |  |   53|     26|    do {                                        \
  |  |   54|     26|        (t) = 0;                                \
  |  |   55|     26|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     26|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  454|     26|    ASNAR(ep->f_copy_word,ehdr->ge_shentsize,e->e_shentsize);
  ------------------
  |  |   53|     26|    do {                                        \
  |  |   54|     26|        (t) = 0;                                \
  |  |   55|     26|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     26|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  455|     26|    ASNAR(ep->f_copy_word,ehdr->ge_shnum,e->e_shnum);
  ------------------
  |  |   53|     26|    do {                                        \
  |  |   54|     26|        (t) = 0;                                \
  |  |   55|     26|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     26|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  456|     26|    ASNAR(ep->f_copy_word,ehdr->ge_shstrndx,e->e_shstrndx);
  ------------------
  |  |   53|     26|    do {                                        \
  |  |   54|     26|        (t) = 0;                                \
  |  |   55|     26|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|     26|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  457|     26|    if (!ehdr->ge_shoff) {
  ------------------
  |  Branch (457:9): [True: 0, False: 26]
  ------------------
  458|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  459|      0|    }
  460|     26|    if (ehdr->ge_shoff < sizeof(dw_elf64_ehdr)) {
  ------------------
  |  Branch (460:9): [True: 0, False: 26]
  ------------------
  461|       |        /* zero or offset is inside the header! */
  462|      0|        *errcode = DW_DLE_TOO_FEW_SECTIONS;
  ------------------
  |  | 1540|      0|#define DW_DLE_TOO_FEW_SECTIONS                494
  ------------------
  463|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  464|      0|    }
  465|     26|    if (ehdr->ge_shstrndx == SHN_XINDEX) {
  ------------------
  |  |  307|     26|#define SHN_XINDEX 0xffff
  ------------------
  |  Branch (465:9): [True: 0, False: 26]
  ------------------
  466|      0|        ehdr->ge_strndx_extended = TRUE;
  ------------------
  |  |   33|      0|#define TRUE 1
  ------------------
  467|     26|    } else {
  468|     26|        ehdr->ge_strndx_in_strndx = TRUE;
  ------------------
  |  |   33|     26|#define TRUE 1
  ------------------
  469|     26|        if (ehdr->ge_shstrndx < 1) {
  ------------------
  |  Branch (469:13): [True: 0, False: 26]
  ------------------
  470|      0|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|      0|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
  471|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  472|      0|        }
  473|     26|    }
  474|     26|    if (!ehdr->ge_shnum) {
  ------------------
  |  Branch (474:9): [True: 2, False: 24]
  ------------------
  475|      2|        ehdr->ge_shnum_extended = TRUE;
  ------------------
  |  |   33|      2|#define TRUE 1
  ------------------
  476|     24|    } else {
  477|     24|        ehdr->ge_shnum_in_shnum = TRUE;
  ------------------
  |  |   33|     24|#define TRUE 1
  ------------------
  478|     24|        if (!ehdr->ge_shnum) {
  ------------------
  |  Branch (478:13): [True: 0, False: 24]
  ------------------
  479|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  480|      0|        }
  481|     24|        if (ehdr->ge_shnum < 3) {
  ------------------
  |  Branch (481:13): [True: 0, False: 24]
  ------------------
  482|      0|            *errcode = DW_DLE_TOO_FEW_SECTIONS;
  ------------------
  |  | 1540|      0|#define DW_DLE_TOO_FEW_SECTIONS                494
  ------------------
  483|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  484|      0|        }
  485|     24|    }
  486|     26|    if (ehdr->ge_shnum_in_shnum &&
  ------------------
  |  Branch (486:9): [True: 24, False: 2]
  ------------------
  487|     24|        ehdr->ge_strndx_in_strndx &&
  ------------------
  |  Branch (487:9): [True: 24, False: 0]
  ------------------
  488|     24|        (ehdr->ge_shstrndx >= ehdr->ge_shnum)) {
  ------------------
  |  Branch (488:9): [True: 0, False: 24]
  ------------------
  489|      0|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|      0|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
  490|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  491|      0|    }
  492|     26|    ep->f_machine = (unsigned int)ehdr->ge_machine;
  493|     26|    ep->f_ftype = (unsigned int)ehdr->ge_type;
  494|     26|    ep->f_ehdr = ehdr;
  495|     26|    ep->f_loc_ehdr.g_name = "Elf File Header";
  496|     26|    ep->f_loc_ehdr.g_offset = 0;
  497|     26|    ep->f_loc_ehdr.g_count = 1;
  498|     26|    ep->f_loc_ehdr.g_entrysize = sizeof(dw_elf64_ehdr);
  499|     26|    ep->f_loc_ehdr.g_totalsize = sizeof(dw_elf64_ehdr);
  500|     26|    return DW_DLV_OK;
  ------------------
  |  |   59|     26|#define DW_DLV_OK         0
  ------------------
  501|     26|}
dwarf_elf_load_headers.c:elf_load_sectheaders32:
 1416|     48|{
 1417|     48|    Dwarf_Unsigned generic_count = 0;
 1418|     48|    Dwarf_Unsigned shdr_count = 0;
 1419|     48|    Dwarf_Bool have_shdr_count = FALSE;
  ------------------
  |  |   36|     48|#define FALSE 0
  ------------------
 1420|     48|    Dwarf_Unsigned shstrndx_number = 0;
 1421|     48|    Dwarf_Bool have_shstrndx_number = FALSE;
  ------------------
  |  |   36|     48|#define FALSE 0
  ------------------
 1422|     48|    struct generic_ehdr *ehp = 0;
 1423|     48|    int res = 0;
 1424|       |
 1425|     48|    if (entsize < sizeof(dw_elf32_shdr)) {
  ------------------
  |  Branch (1425:9): [True: 0, False: 48]
  ------------------
 1426|      0|        *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      0|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1427|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1428|      0|    }
 1429|     48|    ehp = ep->f_ehdr;
 1430|     48|    if (!ehp->ge_shnum_in_shnum || !ehp->ge_strndx_in_strndx) {
  ------------------
  |  Branch (1430:9): [True: 4, False: 44]
  |  Branch (1430:36): [True: 0, False: 44]
  ------------------
 1431|      4|        res = get_counts_from_sec32_zero(ep,offset,
 1432|      4|            &have_shdr_count,&shdr_count,
 1433|      4|            &have_shstrndx_number,&shstrndx_number,
 1434|      4|            errcode);
 1435|      4|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|      4|#define DW_DLV_OK         0
  ------------------
  |  Branch (1435:13): [True: 0, False: 4]
  ------------------
 1436|      0|            return res;
 1437|      0|        }
 1438|      4|        if (have_shdr_count) {
  ------------------
  |  Branch (1438:13): [True: 4, False: 0]
  ------------------
 1439|      4|            count = shdr_count;
 1440|      4|        }
 1441|      4|    }
 1442|     48|    if (count == 0) {
  ------------------
  |  Branch (1442:9): [True: 0, False: 48]
  ------------------
 1443|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1444|      0|    }
 1445|     48|    if ((offset > ep->f_filesize)||
  ------------------
  |  Branch (1445:9): [True: 0, False: 48]
  ------------------
 1446|     48|        (entsize > 200)||
  ------------------
  |  Branch (1446:9): [True: 0, False: 48]
  ------------------
 1447|     48|        (count > ep->f_filesize) ||
  ------------------
  |  Branch (1447:9): [True: 0, False: 48]
  ------------------
 1448|     48|        ((count *entsize +offset) > ep->f_filesize)) {
  ------------------
  |  Branch (1448:9): [True: 4, False: 44]
  ------------------
 1449|      4|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|      4|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1450|      4|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
 1451|      4|    }
 1452|     44|    res = generic_shdr_from_shdr32(ep,&generic_count,
 1453|     44|        offset,entsize,count,errcode);
 1454|     44|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     44|#define DW_DLV_OK         0
  ------------------
  |  Branch (1454:9): [True: 0, False: 44]
  ------------------
 1455|      0|        return res;
 1456|      0|    }
 1457|     44|    if (generic_count != count) {
  ------------------
  |  Branch (1457:9): [True: 0, False: 44]
  ------------------
 1458|      0|        *errcode = DW_DLE_ELF_SECTION_COUNT_MISMATCH;
  ------------------
  |  | 1488|      0|#define DW_DLE_ELF_SECTION_COUNT_MISMATCH      442
  ------------------
 1459|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1460|      0|    }
 1461|     44|    return DW_DLV_OK;
  ------------------
  |  |   59|     44|#define DW_DLV_OK         0
  ------------------
 1462|     44|}
dwarf_elf_load_headers.c:get_counts_from_sec32_zero:
 1369|      4|{
 1370|      4|    dw_elf32_shdr       shd32;
 1371|      4|    struct generic_shdr shdg;
 1372|      4|    int res = 0;
 1373|      4|    Dwarf_Unsigned size = sizeof(shd32);
 1374|      4|    struct generic_ehdr * geh  = ep->f_ehdr;
 1375|       |
 1376|      4|    shd32 =  shd32zero;
 1377|      4|    shdg  = shdgzero;
 1378|      4|    res = RRMOA(ep->f_fd,&shd32,offset,size,
  ------------------
  |  |   65|      4|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|      4|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1379|      4|        ep->f_filesize,errcode);
 1380|      4|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|      4|#define DW_DLV_OK         0
  ------------------
  |  Branch (1380:9): [True: 0, False: 4]
  ------------------
 1381|      0|        return res;
 1382|      0|    }
 1383|      4|    copysection32(ep,&shdg,&shd32);
 1384|      4|    if (geh->ge_shnum_extended) {
  ------------------
  |  Branch (1384:9): [True: 4, False: 0]
  ------------------
 1385|      4|        geh->ge_shnum = shdg.gh_size;
 1386|      4|        geh->ge_shnum_in_shnum = TRUE;
  ------------------
  |  |   33|      4|#define TRUE 1
  ------------------
 1387|      4|        if (geh->ge_shnum  < 3) {
  ------------------
  |  Branch (1387:13): [True: 0, False: 4]
  ------------------
 1388|      0|            *errcode = DW_DLE_TOO_FEW_SECTIONS;
  ------------------
  |  | 1540|      0|#define DW_DLE_TOO_FEW_SECTIONS                494
  ------------------
 1389|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1390|      0|        }
 1391|      4|    }
 1392|      4|    *have_shdr_count = TRUE;
  ------------------
  |  |   33|      4|#define TRUE 1
  ------------------
 1393|      4|    *shdr_count = geh->ge_shnum;
 1394|      4|    if (geh->ge_strndx_extended) {
  ------------------
  |  Branch (1394:9): [True: 0, False: 4]
  ------------------
 1395|      0|        geh->ge_shstrndx = shdg.gh_link;
 1396|      0|        geh->ge_strndx_in_strndx = TRUE;
  ------------------
  |  |   33|      0|#define TRUE 1
  ------------------
 1397|      0|    }
 1398|      4|    if (geh->ge_shnum_in_shnum &&
  ------------------
  |  Branch (1398:9): [True: 4, False: 0]
  ------------------
 1399|      4|        geh->ge_strndx_in_strndx&&
  ------------------
  |  Branch (1399:9): [True: 4, False: 0]
  ------------------
 1400|      4|        (geh->ge_shstrndx >= geh->ge_shnum)) {
  ------------------
  |  Branch (1400:9): [True: 0, False: 4]
  ------------------
 1401|      0|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|      0|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
 1402|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1403|      0|    }
 1404|      4|    *have_shstrndx_number = TRUE;
  ------------------
  |  |   33|      4|#define TRUE 1
  ------------------
 1405|      4|    *shstrndx_number = geh->ge_shstrndx;
 1406|      4|    return DW_DLV_OK;
  ------------------
  |  |   59|      4|#define DW_DLV_OK         0
  ------------------
 1407|      4|}
dwarf_elf_load_headers.c:copysection32:
  508|   119k|{
  509|   119k|    ASNAR(ep->f_copy_word,gshdr->gh_name,psh->sh_name);
  ------------------
  |  |   53|   119k|    do {                                        \
  |  |   54|   119k|        (t) = 0;                                \
  |  |   55|   119k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   119k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 119k]
  |  |  ------------------
  ------------------
  510|   119k|    ASNAR(ep->f_copy_word,gshdr->gh_type,psh->sh_type);
  ------------------
  |  |   53|   119k|    do {                                        \
  |  |   54|   119k|        (t) = 0;                                \
  |  |   55|   119k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   119k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 119k]
  |  |  ------------------
  ------------------
  511|   119k|    ASNAR(ep->f_copy_word,gshdr->gh_flags,psh->sh_flags);
  ------------------
  |  |   53|   119k|    do {                                        \
  |  |   54|   119k|        (t) = 0;                                \
  |  |   55|   119k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   119k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 119k]
  |  |  ------------------
  ------------------
  512|   119k|    ASNAR(ep->f_copy_word,gshdr->gh_addr,psh->sh_addr);
  ------------------
  |  |   53|   119k|    do {                                        \
  |  |   54|   119k|        (t) = 0;                                \
  |  |   55|   119k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   119k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 119k]
  |  |  ------------------
  ------------------
  513|   119k|    ASNAR(ep->f_copy_word,gshdr->gh_offset,psh->sh_offset);
  ------------------
  |  |   53|   119k|    do {                                        \
  |  |   54|   119k|        (t) = 0;                                \
  |  |   55|   119k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   119k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 119k]
  |  |  ------------------
  ------------------
  514|   119k|    ASNAR(ep->f_copy_word,gshdr->gh_size,psh->sh_size);
  ------------------
  |  |   53|   119k|    do {                                        \
  |  |   54|   119k|        (t) = 0;                                \
  |  |   55|   119k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   119k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 119k]
  |  |  ------------------
  ------------------
  515|   119k|    ASNAR(ep->f_copy_word,gshdr->gh_link,psh->sh_link);
  ------------------
  |  |   53|   119k|    do {                                        \
  |  |   54|   119k|        (t) = 0;                                \
  |  |   55|   119k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   119k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 119k]
  |  |  ------------------
  ------------------
  516|   119k|    ASNAR(ep->f_copy_word,gshdr->gh_info,psh->sh_info);
  ------------------
  |  |   53|   119k|    do {                                        \
  |  |   54|   119k|        (t) = 0;                                \
  |  |   55|   119k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   119k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 119k]
  |  |  ------------------
  ------------------
  517|   119k|    ASNAR(ep->f_copy_word,gshdr->gh_addralign,psh->sh_addralign);
  ------------------
  |  |   53|   119k|    do {                                        \
  |  |   54|   119k|        (t) = 0;                                \
  |  |   55|   119k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   119k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 119k]
  |  |  ------------------
  ------------------
  518|   119k|    ASNAR(ep->f_copy_word,gshdr->gh_entsize,psh->sh_entsize);
  ------------------
  |  |   53|   119k|    do {                                        \
  |  |   54|   119k|        (t) = 0;                                \
  |  |   55|   119k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|   119k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 119k]
  |  |  ------------------
  ------------------
  519|   119k|}
dwarf_elf_load_headers.c:generic_shdr_from_shdr32:
  528|     44|{
  529|     44|    dw_elf32_shdr          *psh =0;
  530|     44|    dw_elf32_shdr          *orig_psh =0;
  531|     44|    struct generic_ehdr *ehdr = ep->f_ehdr;
  532|     44|    struct generic_shdr *gshdr =0;
  533|     44|    struct generic_shdr *orig_gshdr =0;
  534|     44|    Dwarf_Unsigned i = 0;
  535|     44|    int res = 0;
  536|       |
  537|     44|    *count_out = 0;
  538|     44|    psh = (dw_elf32_shdr *)calloc(count , entsize);
  539|     44|    if (!psh) {
  ------------------
  |  Branch (539:9): [True: 0, False: 44]
  ------------------
  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|     44|    gshdr = (struct generic_shdr *)calloc(count,sizeof(*gshdr));
  544|     44|    if (!gshdr) {
  ------------------
  |  Branch (544:9): [True: 0, False: 44]
  ------------------
  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|     44|    orig_psh = psh;
  551|     44|    orig_gshdr = gshdr;
  552|     44|    res = RRMOA(ep->f_fd,psh,offset,count*entsize,
  ------------------
  |  |   65|     44|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     44|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  553|     44|        ep->f_filesize,errcode);
  554|     44|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     44|#define DW_DLV_OK         0
  ------------------
  |  Branch (554:9): [True: 0, False: 44]
  ------------------
  555|      0|        free(orig_psh);
  556|      0|        free(orig_gshdr);
  557|      0|        return res;
  558|      0|    }
  559|   120k|    for (i = 0; i < count;
  ------------------
  |  Branch (559:17): [True: 119k, False: 44]
  ------------------
  560|   119k|        ++i,  psh++,gshdr++) {
  561|   119k|        int isempty     = FALSE;
  ------------------
  |  |   36|   119k|#define FALSE 0
  ------------------
  562|   119k|        int bitsoncount = 0;
  563|       |
  564|   119k|        gshdr->gh_secnum = i;
  565|   119k|        copysection32(ep,gshdr,psh);
  566|   119k|        if (gshdr->gh_size >= ep->f_filesize &&
  ------------------
  |  Branch (566:13): [True: 3, False: 119k]
  ------------------
  567|      3|            gshdr->gh_type != SHT_NOBITS) {
  ------------------
  |  |   87|      3|#define SHT_NOBITS 8
  ------------------
  |  Branch (567:13): [True: 0, False: 3]
  ------------------
  568|      0|            free(orig_psh);
  569|      0|            free(orig_gshdr);
  570|      0|            *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      0|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
  571|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  572|      0|        }
  573|   119k|        isempty = is_empty_section(gshdr->gh_type);
  574|   119k|        if (i == 0) {
  ------------------
  |  Branch (574:13): [True: 44, False: 119k]
  ------------------
  575|     44|            Dwarf_Unsigned shnum = 0;
  576|     44|            Dwarf_Unsigned shstrx = 0;
  577|       |
  578|       |            /*  Catch errors asap */
  579|     44|            if (!ehdr->ge_shnum_extended) {
  ------------------
  |  Branch (579:17): [True: 44, False: 0]
  ------------------
  580|     44|                shnum = gshdr->gh_size;
  581|     44|            }
  582|     44|            if (!ehdr->ge_strndx_extended) {
  ------------------
  |  Branch (582:17): [True: 44, False: 0]
  ------------------
  583|     44|                shstrx = gshdr->gh_link;
  584|     44|            }
  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|     44|            if (!isempty || gshdr->gh_name || gshdr->gh_flags ||
  ------------------
  |  Branch (590:17): [True: 0, False: 44]
  |  Branch (590:29): [True: 0, False: 44]
  |  Branch (590:47): [True: 0, False: 44]
  ------------------
  591|     44|                shnum || shstrx ||
  ------------------
  |  Branch (591:17): [True: 0, False: 44]
  |  Branch (591:26): [True: 0, False: 44]
  ------------------
  592|     44|                gshdr->gh_addr ||
  ------------------
  |  Branch (592:17): [True: 0, False: 44]
  ------------------
  593|     44|                gshdr->gh_info) {
  ------------------
  |  Branch (593:17): [True: 0, False: 44]
  ------------------
  594|      0|                free(orig_psh);
  595|      0|                free(orig_gshdr);
  596|      0|                *errcode = DW_DLE_IMPROPER_SECTION_ZERO;
  ------------------
  |  | 1543|      0|#define DW_DLE_IMPROPER_SECTION_ZERO           497
  ------------------
  597|      0|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  598|      0|            }
  599|     44|        }
  600|   119k|        bitsoncount = getbitsoncount(gshdr->gh_flags);
  601|   119k|        if (bitsoncount > 8) {
  ------------------
  |  Branch (601:13): [True: 0, False: 119k]
  ------------------
  602|      0|            free(orig_psh);
  603|      0|            free(orig_gshdr);
  604|      0|            *errcode = DW_DLE_BAD_SECTION_FLAGS;
  ------------------
  |  | 1542|      0|#define DW_DLE_BAD_SECTION_FLAGS               496
  ------------------
  605|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  606|      0|        }
  607|       |
  608|   119k|        if (gshdr->gh_type == SHT_REL || gshdr->gh_type == SHT_RELA){
  ------------------
  |  |   59|   239k|#define SHT_REL 9
  ------------------
                      if (gshdr->gh_type == SHT_REL || gshdr->gh_type == SHT_RELA){
  ------------------
  |  |   56|   119k|#define SHT_RELA 4
  ------------------
  |  Branch (608:13): [True: 4, False: 119k]
  |  Branch (608:42): [True: 12, False: 119k]
  ------------------
  609|     16|            gshdr->gh_reloc_target_secnum = gshdr->gh_info;
  610|     16|        }
  611|   119k|    }
  612|     44|    free(orig_psh);
  613|     44|    *count_out = count;
  614|     44|    ep->f_shdr = orig_gshdr;
  615|     44|    ep->f_loc_shdr.g_name = "Section Header";
  616|     44|    ep->f_loc_shdr.g_count = count;
  617|     44|    ep->f_loc_shdr.g_offset = offset;
  618|     44|    ep->f_loc_shdr.g_entrysize = sizeof(dw_elf32_shdr);
  619|     44|    ep->f_loc_shdr.g_totalsize = sizeof(dw_elf32_shdr)*count;
  620|     44|    return DW_DLV_OK;
  ------------------
  |  |   59|     44|#define DW_DLV_OK         0
  ------------------
  621|     44|}
dwarf_elf_load_headers.c:getbitsoncount:
  152|   123k|{
  153|   123k|    int           bitscount = 0;
  154|   123k|    Dwarf_Unsigned v = v_in;
  155|       |
  156|   135k|    while (v) {
  ------------------
  |  Branch (156:12): [True: 12.2k, False: 123k]
  ------------------
  157|  12.2k|        unsigned int nibble = v & 0xf;
  158|  12.2k|        bitscount += nibblecounts[nibble];
  159|  12.2k|        v >>= 4;
  160|  12.2k|    }
  161|   123k|    return bitscount;
  162|   123k|}
dwarf_elf_load_headers.c:elf_load_sectheaders64:
 1521|     26|{
 1522|     26|    Dwarf_Unsigned generic_count = 0;
 1523|     26|    Dwarf_Unsigned shdr_count = 0;
 1524|     26|    Dwarf_Bool have_shdr_count = FALSE;
  ------------------
  |  |   36|     26|#define FALSE 0
  ------------------
 1525|     26|    Dwarf_Unsigned shstrndx_number = 0;
 1526|     26|    Dwarf_Bool have_shstrndx_number = FALSE;
  ------------------
  |  |   36|     26|#define FALSE 0
  ------------------
 1527|     26|    struct generic_ehdr *ehp = 0;
 1528|     26|    int res = 0;
 1529|       |
 1530|     26|    ehp = ep->f_ehdr;
 1531|     26|    if (!ehp->ge_shnum_in_shnum || !ehp->ge_strndx_in_strndx ) {
  ------------------
  |  Branch (1531:9): [True: 2, False: 24]
  |  Branch (1531:36): [True: 0, False: 24]
  ------------------
 1532|      2|        res = get_counts_from_sec64_zero(ep,offset,
 1533|      2|            &have_shdr_count,&shdr_count,
 1534|      2|            &have_shstrndx_number,&shstrndx_number,
 1535|      2|            errcode);
 1536|      2|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|      2|#define DW_DLV_OK         0
  ------------------
  |  Branch (1536:13): [True: 0, False: 2]
  ------------------
 1537|      0|            return res;
 1538|      0|        }
 1539|      2|        if (have_shdr_count) {
  ------------------
  |  Branch (1539:13): [True: 2, False: 0]
  ------------------
 1540|      2|            count = shdr_count;
 1541|      2|        }
 1542|      2|    }
 1543|     26|    if (count == 0) {
  ------------------
  |  Branch (1543:9): [True: 0, False: 26]
  ------------------
 1544|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
 1545|      0|    }
 1546|     26|    if (entsize < sizeof(dw_elf64_shdr)) {
  ------------------
  |  Branch (1546:9): [True: 0, False: 26]
  ------------------
 1547|      0|        *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      0|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
 1548|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1549|      0|    }
 1550|     26|    if ((offset > ep->f_filesize)||
  ------------------
  |  Branch (1550:9): [True: 1, False: 25]
  ------------------
 1551|     25|        (entsize > 200)||
  ------------------
  |  Branch (1551:9): [True: 0, False: 25]
  ------------------
 1552|     25|        (count > ep->f_filesize) ||
  ------------------
  |  Branch (1552:9): [True: 0, False: 25]
  ------------------
 1553|     25|        ((count *entsize +offset) > ep->f_filesize)) {
  ------------------
  |  Branch (1553:9): [True: 2, False: 23]
  ------------------
 1554|      3|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|      3|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1555|      3|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
 1556|      3|    }
 1557|       |
 1558|     23|    res = generic_shdr_from_shdr64(ep,&generic_count,
 1559|     23|        offset,entsize,count,errcode);
 1560|     23|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     23|#define DW_DLV_OK         0
  ------------------
  |  Branch (1560:9): [True: 1, False: 22]
  ------------------
 1561|      1|        return res;
 1562|      1|    }
 1563|     22|    if (generic_count != count) {
  ------------------
  |  Branch (1563:9): [True: 0, False: 22]
  ------------------
 1564|      0|        *errcode = DW_DLE_ELF_SECTION_COUNT_MISMATCH;
  ------------------
  |  | 1488|      0|#define DW_DLE_ELF_SECTION_COUNT_MISMATCH      442
  ------------------
 1565|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1566|      0|    }
 1567|     22|    return DW_DLV_OK;
  ------------------
  |  |   59|     22|#define DW_DLV_OK         0
  ------------------
 1568|     22|}
dwarf_elf_load_headers.c:get_counts_from_sec64_zero:
 1475|      2|{
 1476|      2|    dw_elf64_shdr       shd64;
 1477|      2|    struct generic_shdr shdg;
 1478|      2|    int res = 0;
 1479|      2|    Dwarf_Unsigned size = sizeof(shd64);
 1480|      2|    struct generic_ehdr * geh  = ep->f_ehdr;
 1481|       |
 1482|      2|    shd64 =  shd64zero;
 1483|      2|    shdg  = shdgzero;
 1484|      2|    res = RRMOA(ep->f_fd,&shd64,offset,size,
  ------------------
  |  |   65|      2|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|      2|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1485|      2|        ep->f_filesize,errcode);
 1486|      2|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|      2|#define DW_DLV_OK         0
  ------------------
  |  Branch (1486:9): [True: 0, False: 2]
  ------------------
 1487|      0|        return res;
 1488|      0|    }
 1489|      2|    copysection64(ep,&shdg,&shd64);
 1490|      2|    if (geh->ge_shnum_extended) {
  ------------------
  |  Branch (1490:9): [True: 2, False: 0]
  ------------------
 1491|      2|        geh->ge_shnum = shdg.gh_size;
 1492|      2|        geh->ge_shnum_in_shnum = TRUE;
  ------------------
  |  |   33|      2|#define TRUE 1
  ------------------
 1493|      2|        if (geh->ge_shnum  < 3) {
  ------------------
  |  Branch (1493:13): [True: 0, False: 2]
  ------------------
 1494|      0|            *errcode = DW_DLE_TOO_FEW_SECTIONS;
  ------------------
  |  | 1540|      0|#define DW_DLE_TOO_FEW_SECTIONS                494
  ------------------
 1495|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1496|      0|        }
 1497|      2|    }
 1498|      2|    *have_shdr_count = TRUE;
  ------------------
  |  |   33|      2|#define TRUE 1
  ------------------
 1499|      2|    *shdr_count = geh->ge_shnum;
 1500|      2|    if (geh->ge_strndx_extended) {
  ------------------
  |  Branch (1500:9): [True: 0, False: 2]
  ------------------
 1501|      0|        geh->ge_shstrndx = shdg.gh_link;
 1502|      0|        geh->ge_strndx_in_strndx = TRUE;
  ------------------
  |  |   33|      0|#define TRUE 1
  ------------------
 1503|      0|    }
 1504|      2|    if (geh->ge_shnum_in_shnum    &&
  ------------------
  |  Branch (1504:9): [True: 2, False: 0]
  ------------------
 1505|      2|        geh->ge_strndx_in_strndx &&
  ------------------
  |  Branch (1505:9): [True: 2, False: 0]
  ------------------
 1506|      2|        (geh->ge_shstrndx >= geh->ge_shnum)) {
  ------------------
  |  Branch (1506:9): [True: 0, False: 2]
  ------------------
 1507|      0|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|      0|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
 1508|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1509|      0|    }
 1510|       |
 1511|      2|    *have_shstrndx_number = TRUE;
  ------------------
  |  |   33|      2|#define TRUE 1
  ------------------
 1512|      2|    *shstrndx_number = geh->ge_shstrndx;
 1513|      2|    return DW_DLV_OK;
  ------------------
  |  |   59|      2|#define DW_DLV_OK         0
  ------------------
 1514|      2|}
dwarf_elf_load_headers.c:copysection64:
  628|  3.09k|{
  629|  3.09k|    ASNAR(ep->f_copy_word,gshdr->gh_name,psh->sh_name);
  ------------------
  |  |   53|  3.09k|    do {                                        \
  |  |   54|  3.09k|        (t) = 0;                                \
  |  |   55|  3.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.09k]
  |  |  ------------------
  ------------------
  630|  3.09k|    ASNAR(ep->f_copy_word,gshdr->gh_type,psh->sh_type);
  ------------------
  |  |   53|  3.09k|    do {                                        \
  |  |   54|  3.09k|        (t) = 0;                                \
  |  |   55|  3.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.09k]
  |  |  ------------------
  ------------------
  631|  3.09k|    ASNAR(ep->f_copy_word,gshdr->gh_flags,psh->sh_flags);
  ------------------
  |  |   53|  3.09k|    do {                                        \
  |  |   54|  3.09k|        (t) = 0;                                \
  |  |   55|  3.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.09k]
  |  |  ------------------
  ------------------
  632|  3.09k|    ASNAR(ep->f_copy_word,gshdr->gh_addr,psh->sh_addr);
  ------------------
  |  |   53|  3.09k|    do {                                        \
  |  |   54|  3.09k|        (t) = 0;                                \
  |  |   55|  3.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.09k]
  |  |  ------------------
  ------------------
  633|  3.09k|    ASNAR(ep->f_copy_word,gshdr->gh_offset,psh->sh_offset);
  ------------------
  |  |   53|  3.09k|    do {                                        \
  |  |   54|  3.09k|        (t) = 0;                                \
  |  |   55|  3.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.09k]
  |  |  ------------------
  ------------------
  634|  3.09k|    ASNAR(ep->f_copy_word,gshdr->gh_size,psh->sh_size);
  ------------------
  |  |   53|  3.09k|    do {                                        \
  |  |   54|  3.09k|        (t) = 0;                                \
  |  |   55|  3.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.09k]
  |  |  ------------------
  ------------------
  635|  3.09k|    ASNAR(ep->f_copy_word,gshdr->gh_link,psh->sh_link);
  ------------------
  |  |   53|  3.09k|    do {                                        \
  |  |   54|  3.09k|        (t) = 0;                                \
  |  |   55|  3.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.09k]
  |  |  ------------------
  ------------------
  636|  3.09k|    ASNAR(ep->f_copy_word,gshdr->gh_info,psh->sh_info);
  ------------------
  |  |   53|  3.09k|    do {                                        \
  |  |   54|  3.09k|        (t) = 0;                                \
  |  |   55|  3.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.09k]
  |  |  ------------------
  ------------------
  637|  3.09k|    ASNAR(ep->f_copy_word,gshdr->gh_addralign,psh->sh_addralign);
  ------------------
  |  |   53|  3.09k|    do {                                        \
  |  |   54|  3.09k|        (t) = 0;                                \
  |  |   55|  3.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.09k]
  |  |  ------------------
  ------------------
  638|  3.09k|    ASNAR(ep->f_copy_word,gshdr->gh_entsize,psh->sh_entsize);
  ------------------
  |  |   53|  3.09k|    do {                                        \
  |  |   54|  3.09k|        (t) = 0;                                \
  |  |   55|  3.09k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  3.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 3.09k]
  |  |  ------------------
  ------------------
  639|  3.09k|}
dwarf_elf_load_headers.c:generic_shdr_from_shdr64:
  648|     23|{
  649|     23|    dw_elf64_shdr          *psh =0;
  650|     23|    dw_elf64_shdr          *orig_psh =0;
  651|     23|    struct generic_shdr *gshdr =0;
  652|     23|    struct generic_shdr *orig_gshdr =0;
  653|     23|    struct generic_ehdr *ehdr = ep->f_ehdr;
  654|     23|    Dwarf_Unsigned i = 0;
  655|     23|    int res = 0;
  656|       |
  657|     23|    *count_out = 0;
  658|     23|    psh = (dw_elf64_shdr *)calloc(count , entsize);
  659|     23|    if (!psh) {
  ------------------
  |  Branch (659:9): [True: 0, False: 23]
  ------------------
  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|     23|    gshdr = (struct generic_shdr *)calloc(count,sizeof(*gshdr));
  664|     23|    if (gshdr == 0) {
  ------------------
  |  Branch (664:9): [True: 0, False: 23]
  ------------------
  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|     23|    orig_psh = psh;
  670|     23|    orig_gshdr = gshdr;
  671|     23|    res = RRMOA(ep->f_fd,psh,offset,count*entsize,
  ------------------
  |  |   65|     23|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     23|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  672|     23|        ep->f_filesize,errcode);
  673|     23|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     23|#define DW_DLV_OK         0
  ------------------
  |  Branch (673:9): [True: 0, False: 23]
  ------------------
  674|      0|        free(orig_psh);
  675|      0|        free(orig_gshdr);
  676|      0|        return res;
  677|      0|    }
  678|  3.11k|    for ( i = 0; i < count;
  ------------------
  |  Branch (678:18): [True: 3.09k, False: 22]
  ------------------
  679|  3.09k|        ++i,  psh++,gshdr++) {
  680|  3.09k|        int bitsoncount = 0;
  681|  3.09k|        int isempty = FALSE;
  ------------------
  |  |   36|  3.09k|#define FALSE 0
  ------------------
  682|       |
  683|  3.09k|        gshdr->gh_secnum = i;
  684|  3.09k|        copysection64(ep,gshdr,psh);
  685|  3.09k|        if (gshdr->gh_size >= ep->f_filesize &&
  ------------------
  |  Branch (685:13): [True: 6, False: 3.08k]
  ------------------
  686|      6|            gshdr->gh_type != SHT_NOBITS) {
  ------------------
  |  |   87|      6|#define SHT_NOBITS 8
  ------------------
  |  Branch (686:13): [True: 0, False: 6]
  ------------------
  687|      0|            free(orig_psh);
  688|      0|            free(orig_gshdr);
  689|      0|            *errcode = DW_DLE_SECTION_SIZE_ERROR;
  ------------------
  |  | 1481|      0|#define DW_DLE_SECTION_SIZE_ERROR              435
  ------------------
  690|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  691|      0|        }
  692|  3.09k|        isempty = is_empty_section(gshdr->gh_type);
  693|  3.09k|        if (i == 0) {
  ------------------
  |  Branch (693:13): [True: 23, False: 3.06k]
  ------------------
  694|     23|            Dwarf_Unsigned shnum = 0;
  695|     23|            Dwarf_Unsigned shstrx = 0;
  696|       |
  697|       |            /*  Catch errors asap */
  698|     23|            if (!ehdr->ge_shnum_extended) {
  ------------------
  |  Branch (698:17): [True: 23, False: 0]
  ------------------
  699|     23|                shnum = gshdr->gh_size;
  700|     23|            }
  701|     23|            if (!ehdr->ge_strndx_extended) {
  ------------------
  |  Branch (701:17): [True: 23, False: 0]
  ------------------
  702|     23|                shstrx = gshdr->gh_link;
  703|     23|            }
  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|     23|            if (!isempty || gshdr->gh_name || gshdr->gh_flags ||
  ------------------
  |  Branch (708:17): [True: 0, False: 23]
  |  Branch (708:29): [True: 0, False: 23]
  |  Branch (708:47): [True: 0, False: 23]
  ------------------
  709|     23|                shnum || shstrx ||
  ------------------
  |  Branch (709:17): [True: 0, False: 23]
  |  Branch (709:26): [True: 0, False: 23]
  ------------------
  710|     23|                gshdr->gh_addr ||
  ------------------
  |  Branch (710:17): [True: 0, False: 23]
  ------------------
  711|     23|                gshdr->gh_info) {
  ------------------
  |  Branch (711:17): [True: 0, False: 23]
  ------------------
  712|      0|                free(orig_psh);
  713|      0|                free(orig_gshdr);
  714|      0|                *errcode = DW_DLE_IMPROPER_SECTION_ZERO;
  ------------------
  |  | 1543|      0|#define DW_DLE_IMPROPER_SECTION_ZERO           497
  ------------------
  715|      0|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  716|      0|            }
  717|     23|        }
  718|  3.09k|        bitsoncount = getbitsoncount(gshdr->gh_flags);
  719|  3.09k|        if (bitsoncount > 8) {
  ------------------
  |  Branch (719:13): [True: 1, False: 3.09k]
  ------------------
  720|      1|            free(orig_psh);
  721|      1|            free(orig_gshdr);
  722|      1|            *errcode = DW_DLE_BAD_SECTION_FLAGS;
  ------------------
  |  | 1542|      1|#define DW_DLE_BAD_SECTION_FLAGS               496
  ------------------
  723|      1|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
  724|      1|        }
  725|       |
  726|  3.09k|        if (gshdr->gh_type == SHT_REL ||
  ------------------
  |  |   59|  6.18k|#define SHT_REL 9
  ------------------
  |  Branch (726:13): [True: 10, False: 3.08k]
  ------------------
  727|  3.08k|            gshdr->gh_type == SHT_RELA){
  ------------------
  |  |   56|  3.08k|#define SHT_RELA 4
  ------------------
  |  Branch (727:13): [True: 706, False: 2.37k]
  ------------------
  728|    716|            gshdr->gh_reloc_target_secnum = gshdr->gh_info;
  729|    716|        }
  730|  3.09k|    }
  731|     22|    free(orig_psh);
  732|     22|    *count_out = count;
  733|     22|    ep->f_shdr = orig_gshdr;
  734|     22|    ep->f_loc_shdr.g_name = "Section Header";
  735|     22|    ep->f_loc_shdr.g_count = count;
  736|     22|    ep->f_loc_shdr.g_offset = offset;
  737|     22|    ep->f_loc_shdr.g_entrysize = sizeof(dw_elf64_shdr);
  738|     22|    ep->f_loc_shdr.g_totalsize = sizeof(dw_elf64_shdr)*count;
  739|     22|    return DW_DLV_OK;
  ------------------
  |  |   59|     22|#define DW_DLV_OK         0
  ------------------
  740|     23|}
dwarf_elf_load_headers.c:_dwarf_elf_load_sectstrings:
 1282|     66|{
 1283|     66|    int res = 0;
 1284|     66|    struct generic_shdr *psh = 0;
 1285|     66|    Dwarf_Unsigned secoffset = 0;
 1286|     66|    Dwarf_Unsigned flags =  0;
 1287|       |
 1288|     66|    if (stringsection >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (1288:9): [True: 0, False: 66]
  ------------------
 1289|      0|        *errcode = DW_DLE_SECTION_INDEX_BAD;
  ------------------
  |  | 1484|      0|#define DW_DLE_SECTION_INDEX_BAD               438
  ------------------
 1290|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1291|      0|    }
 1292|     66|    psh = ep->f_shdr+stringsection;
 1293|     66|    flags = psh->gh_flags;
 1294|       |
 1295|     66|    secoffset = psh->gh_offset;
 1296|     66|    if (is_empty_section(psh->gh_type)) {
  ------------------
  |  Branch (1296:9): [True: 0, False: 66]
  ------------------
 1297|      0|        *errcode = DW_DLE_ELF_STRING_SECTION_MISSING;
  ------------------
  |  | 1489|      0|#define DW_DLE_ELF_STRING_SECTION_MISSING      443
  ------------------
 1298|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1299|      0|    }
 1300|     66|    if (secoffset >= ep->f_filesize ||
  ------------------
  |  Branch (1300:9): [True: 0, False: 66]
  ------------------
 1301|     66|        psh->gh_size > ep->f_filesize ||
  ------------------
  |  Branch (1301:9): [True: 0, False: 66]
  ------------------
 1302|     66|        (secoffset + psh->gh_size) > ep->f_filesize) {
  ------------------
  |  Branch (1302:9): [True: 3, False: 63]
  ------------------
 1303|      3|        *errcode = DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE;
  ------------------
  |  | 1516|      3|#define DW_DLE_SECTION_SIZE_OR_OFFSET_LARGE    470
  ------------------
 1304|      3|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
 1305|      3|    }
 1306|     63|    if (psh->gh_content) {
  ------------------
  |  Branch (1306:9): [True: 0, False: 63]
  ------------------
 1307|      0|        *errcode = DW_DLE_ELF_STRING_SECTION_ERROR;
  ------------------
  |  | 1493|      0|#define DW_DLE_ELF_STRING_SECTION_ERROR        447
  ------------------
 1308|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1309|      0|    }
 1310|       |    /* An extra zero byte so always null-terminated */
 1311|     63|    psh->gh_content = (char *)calloc(1,psh->gh_size+1);
 1312|     63|    if (!psh->gh_content) {
  ------------------
  |  Branch (1312:9): [True: 0, False: 63]
  ------------------
 1313|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1314|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1315|      0|    }
 1316|     63|    res = RRMOA(ep->f_fd,psh->gh_content,secoffset,
  ------------------
  |  |   65|     63|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     63|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 1317|     63|        psh->gh_size,
 1318|     63|        ep->f_filesize,errcode);
 1319|     63|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     63|#define DW_DLV_OK         0
  ------------------
  |  Branch (1319:9): [True: 0, False: 63]
  ------------------
 1320|      0|        free(ep->f_elf_shstrings_data);
 1321|      0|        ep->f_elf_shstrings_data = 0;
 1322|      0|    }
 1323|     63|    psh->gh_load_type = Dwarf_Alloc_Malloc;
 1324|     63|    psh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|     63|#define TRUE 1
  ------------------
 1325|     63|    ep->f_elf_shstrings_index = stringsection;
 1326|     63|    ep->f_elf_shstrings_max = psh->gh_size;
 1327|     63|    ep->f_elf_shstrings_length = psh->gh_size;
 1328|     63|    ep->f_elf_shstrings_data = psh->gh_content;
 1329|     63|    if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  293|     63|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (1329:9): [True: 0, False: 63]
  ------------------
 1330|       |#if defined(HAVE_ZLIB) && defined(HAVE_ZSTD)
 1331|       |        *errcode = 0;
 1332|       |        _dwarf_do_decompress_elf(ep,psh,errcode);
 1333|       |        /* decompress and set new section size */
 1334|       |        if (*errcode) {
 1335|       |            return DW_DLV_ERROR;
 1336|       |        }
 1337|       |        ep->f_elf_shstrings_max = psh->gh_size;
 1338|       |        ep->f_elf_shstrings_length = psh->gh_size;
 1339|       |        ep->f_elf_shstrings_data = psh->gh_content;
 1340|       |#else /* COMPRESSED TEST */
 1341|       |        /* We cannot decompress, so we really have nothing. */
 1342|      0|        free(psh->gh_content);
 1343|      0|        psh->gh_content = 0;
 1344|      0|        ep->f_elf_shstrings_max = 0;
 1345|      0|        ep->f_elf_shstrings_length = 0;
 1346|      0|        ep->f_elf_shstrings_data = 0;
 1347|      0|        psh->gh_was_alloc = FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
 1348|      0|        *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      0|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
 1349|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1350|      0|#endif /* COMPRESSED TEST */
 1351|      0|    }
 1352|     63|    return DW_DLV_OK;
  ------------------
  |  |   59|     63|#define DW_DLV_OK         0
  ------------------
 1353|     63|}
dwarf_elf_load_headers.c:_dwarf_elf_load_sect_namestrings:
 1853|     63|{
 1854|     63|    struct generic_shdr *gshdr = 0;
 1855|     63|    Dwarf_Unsigned generic_count = 0;
 1856|     63|    Dwarf_Unsigned i = 1;
 1857|     63|    const char *stringsecbase = 0;
 1858|       |
 1859|     63|    stringsecbase = ep->f_elf_shstrings_data;
 1860|     63|    gshdr = ep->f_shdr;
 1861|     63|    generic_count = ep->f_loc_shdr.g_count;
 1862|       |    /*  Here we ensure gh_namestring set to something with
 1863|       |        null termination */
 1864|   123k|    for (i = 0; i < generic_count; i++, ++gshdr) {
  ------------------
  |  Branch (1864:17): [True: 123k, False: 63]
  ------------------
 1865|   123k|        const char *namestr =
 1866|   123k|            "<No valid Elf section strings exist>";
 1867|   123k|        int res = 0;
 1868|       |
 1869|   123k|        if (!ep->f_ehdr->ge_shstrndx || !stringsecbase) {
  ------------------
  |  Branch (1869:13): [True: 0, False: 123k]
  |  Branch (1869:41): [True: 0, False: 123k]
  ------------------
 1870|      0|            gshdr->gh_namestring = namestr;
 1871|      0|            continue;
 1872|      0|        }
 1873|   123k|        namestr = "<Invalid sh_name value. Corrupt Elf.>";
 1874|   123k|        res = validate_section_name_string(ep->f_elf_shstrings_length,
 1875|   123k|            gshdr->gh_name, stringsecbase,
 1876|   123k|            errcode);
 1877|   123k|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|   123k|#define DW_DLV_OK         0
  ------------------
  |  Branch (1877:13): [True: 0, False: 123k]
  ------------------
 1878|      0|            gshdr->gh_namestring = namestr;
 1879|      0|            if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1879:17): [True: 0, False: 0]
  ------------------
 1880|      0|                return res;
 1881|      0|            }
 1882|       |            /* no entry, missing strings. */
 1883|      0|            *errcode = DW_DLE_NO_SECT_STRINGS;
  ------------------
  |  | 1539|      0|#define DW_DLE_NO_SECT_STRINGS                 493
  ------------------
 1884|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1885|   123k|        } else {
 1886|   123k|            gshdr->gh_namestring = stringsecbase + gshdr->gh_name;
 1887|   123k|        }
 1888|   123k|    }
 1889|     63|    return DW_DLV_OK;
  ------------------
  |  |   59|     63|#define DW_DLV_OK         0
  ------------------
 1890|     63|}
dwarf_elf_load_headers.c:validate_section_name_string:
 1827|   123k|{
 1828|   123k|    const char *endpoint = strings_start + section_length;
 1829|   123k|    const char *cur = 0;
 1830|       |
 1831|   123k|    if (section_length <= string_loc_index) {
  ------------------
  |  Branch (1831:9): [True: 0, False: 123k]
  ------------------
 1832|      0|        *errcode = DW_DLE_SECTION_STRING_OFFSET_BAD;
  ------------------
  |  | 1483|      0|#define DW_DLE_SECTION_STRING_OFFSET_BAD       437
  ------------------
 1833|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1834|      0|    }
 1835|   123k|    cur = string_loc_index+strings_start;
 1836|  7.35M|    for ( ; cur < endpoint;++cur) {
  ------------------
  |  Branch (1836:13): [True: 7.35M, False: 0]
  ------------------
 1837|  7.35M|        if (!*cur) {
  ------------------
  |  Branch (1837:13): [True: 123k, False: 7.22M]
  ------------------
 1838|   123k|            return DW_DLV_OK;
  ------------------
  |  |   59|   123k|#define DW_DLV_OK         0
  ------------------
 1839|   123k|        }
 1840|  7.35M|    }
 1841|      0|    *errcode = DW_DLE_SECTION_STRING_OFFSET_BAD;
  ------------------
  |  | 1483|      0|#define DW_DLE_SECTION_STRING_OFFSET_BAD       437
  ------------------
 1842|      0|    return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1843|   123k|}
dwarf_elf_load_headers.c:_dwarf_elf_find_sym_sections:
 2303|     63|{
 2304|     63|    struct generic_shdr* psh = 0;
 2305|     63|    Dwarf_Unsigned i = 0;
 2306|     63|    Dwarf_Unsigned count = 0;
 2307|     63|    int res = 0;
 2308|       |
 2309|     63|    count = ep->f_loc_shdr.g_count;
 2310|     63|    psh = ep->f_shdr;
 2311|   123k|    for (i = 0; i < count; ++psh,++i) {
  ------------------
  |  Branch (2311:17): [True: 123k, False: 63]
  ------------------
 2312|   123k|        const char *name = psh->gh_namestring;
 2313|   123k|        if (is_empty_section(psh->gh_type)) {
  ------------------
  |  Branch (2313:13): [True: 120k, False: 2.45k]
  ------------------
 2314|       |            /*  No data here. */
 2315|   120k|            continue;
 2316|   120k|        }
 2317|  2.45k|        if (!strcmp(name,".dynsym")) {
  ------------------
  |  Branch (2317:13): [True: 0, False: 2.45k]
  ------------------
 2318|      0|            ep->f_dynsym_sect_index = i;
 2319|      0|            ep->f_loc_dynsym.g_offset = psh->gh_offset;
 2320|  2.45k|        } else if (!strcmp(name,".dynstr")) {
  ------------------
  |  Branch (2320:20): [True: 0, False: 2.45k]
  ------------------
 2321|      0|            ep->f_dynsym_sect_strings_sect_index = i;
 2322|      0|            ep->f_dynsym_sect_strings_max = psh->gh_size;
 2323|  2.45k|        } else if (!strcmp(name,".symtab")) {
  ------------------
  |  Branch (2323:20): [True: 18, False: 2.43k]
  ------------------
 2324|     18|            ep->f_symtab_sect_index = i;
 2325|     18|            ep->f_loc_symtab.g_offset = psh->gh_offset;
 2326|  2.43k|        } else if (!strcmp(name,".strtab")) {
  ------------------
  |  Branch (2326:20): [True: 25, False: 2.40k]
  ------------------
 2327|     25|            ep->f_symtab_sect_strings_sect_index = i;
 2328|     25|            ep->f_symtab_sect_strings_max = psh->gh_size;
 2329|  2.40k|        } else if (!strcmp(name,".dynamic")) {
  ------------------
  |  Branch (2329:20): [True: 0, False: 2.40k]
  ------------------
 2330|      0|            ep->f_dynamic_sect_index = i;
 2331|      0|            ep->f_loc_dynamic.g_offset = psh->gh_offset;
 2332|      0|        }
 2333|  2.45k|    }
 2334|     63|    res = validate_links(ep,ep->f_symtab_sect_index,
 2335|     63|        ep->f_symtab_sect_strings_sect_index,errcode);
 2336|     63|    if (res!= DW_DLV_OK) {
  ------------------
  |  |   59|     63|#define DW_DLV_OK         0
  ------------------
  |  Branch (2336:9): [True: 0, False: 63]
  ------------------
 2337|      0|        return res;
 2338|      0|    }
 2339|     63|    return DW_DLV_OK;
  ------------------
  |  |   59|     63|#define DW_DLV_OK         0
  ------------------
 2340|     63|}
dwarf_elf_load_headers.c:validate_links:
 1984|     63|{
 1985|     63|    struct generic_shdr* pshk = 0;
 1986|       |
 1987|     63|    if (!knownsect) {
  ------------------
  |  Branch (1987:9): [True: 53, False: 10]
  ------------------
 1988|     53|        return DW_DLV_OK;
  ------------------
  |  |   59|     53|#define DW_DLV_OK         0
  ------------------
 1989|     53|    }
 1990|     10|    if (!string_sect) {
  ------------------
  |  Branch (1990:9): [True: 0, False: 10]
  ------------------
 1991|      0|        *errcode = DW_DLE_ELF_STRING_SECTION_ERROR;
  ------------------
  |  | 1493|      0|#define DW_DLE_ELF_STRING_SECTION_ERROR        447
  ------------------
 1992|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1993|      0|    }
 1994|     10|    pshk = ep->f_shdr + knownsect;
 1995|     10|    if (string_sect != pshk->gh_link) {
  ------------------
  |  Branch (1995:9): [True: 0, False: 10]
  ------------------
 1996|      0|        *errcode = DW_DLE_ELF_SECTION_LINK_ERROR;
  ------------------
  |  | 1486|      0|#define DW_DLE_ELF_SECTION_LINK_ERROR          440
  ------------------
 1997|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1998|      0|    }
 1999|     10|    return DW_DLV_OK;
  ------------------
  |  |   59|     10|#define DW_DLV_OK         0
  ------------------
 2000|     10|}
dwarf_elf_load_headers.c:_dwarf_elf_setup_all_section_groups:
 2224|     63|{
 2225|     63|    struct generic_shdr* psh = 0;
 2226|     63|    Dwarf_Unsigned i = 0;
 2227|     63|    Dwarf_Unsigned count = 0;
 2228|     63|    int res = 0;
 2229|       |
 2230|     63|    count = ep->f_loc_shdr.g_count;
 2231|     63|    psh = ep->f_shdr;
 2232|       |
 2233|       |    /* Does step A and step B */
 2234|   122k|    for (i = 0; i < count; ++psh,++i) {
  ------------------
  |  Branch (2234:17): [True: 121k, False: 55]
  ------------------
 2235|   121k|        const char *name = psh->gh_namestring;
 2236|       |
 2237|   121k|        if (is_empty_section(psh->gh_type)) {
  ------------------
  |  Branch (2237:13): [True: 120k, False: 1.61k]
  ------------------
 2238|       |            /*  No data here. */
 2239|   120k|            continue;
 2240|   120k|        }
 2241|  1.61k|        if (elf_sht_groupsec(psh->gh_type,name)) {
  ------------------
  |  Branch (2241:13): [True: 257, False: 1.36k]
  ------------------
 2242|    257|            ep->f_shf_group_flag_section_count++;
 2243|  1.36k|        } else {
 2244|  1.36k|            continue;
 2245|  1.36k|        }
 2246|       |        /* Looks like a section group. Do Step A. */
 2247|    257|        res  =read_gs_section_group(ep,psh,errcode);
 2248|    257|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    257|#define DW_DLV_OK         0
  ------------------
  |  Branch (2248:13): [True: 8, False: 249]
  ------------------
 2249|      8|            return res;
 2250|      8|        }
 2251|    257|    }
 2252|       |    /*  Any sections not marked above or here are in
 2253|       |        grep DW_GROUPNUMBER_BASE (1).
 2254|       |        Section C. */
 2255|     55|    psh = ep->f_shdr;
 2256|   121k|    for (i = 0; i < count; ++psh,++i) {
  ------------------
  |  Branch (2256:17): [True: 121k, False: 55]
  ------------------
 2257|   121k|        const char *name = psh->gh_namestring;
 2258|   121k|        int is_rel = FALSE;
  ------------------
  |  |   36|   121k|#define FALSE 0
  ------------------
 2259|   121k|        int is_rela = FALSE;
  ------------------
  |  |   36|   121k|#define FALSE 0
  ------------------
 2260|       |
 2261|   121k|        if (is_empty_section(psh->gh_type)) {
  ------------------
  |  Branch (2261:13): [True: 120k, False: 1.53k]
  ------------------
 2262|       |            /*  No data here. */
 2263|   120k|            continue;
 2264|   120k|        }
 2265|  1.53k|        if (elf_sht_groupsec(psh->gh_type,name)) {
  ------------------
  |  Branch (2265:13): [True: 227, False: 1.30k]
  ------------------
 2266|    227|            continue;
 2267|    227|        }
 2268|       |        /* Not a section group */
 2269|  1.30k|        if (string_endswith(name,".dwo")) {
  ------------------
  |  Branch (2269:13): [True: 18, False: 1.28k]
  ------------------
 2270|     18|            if (psh->gh_section_group_number) {
  ------------------
  |  Branch (2270:17): [True: 0, False: 18]
  ------------------
 2271|       |                /* multi-assignment to groups. Oops. */
 2272|      0|                *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      0|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2273|      0|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2274|      0|            }
 2275|     18|            psh->gh_is_dwarf = TRUE;
  ------------------
  |  |   33|     18|#define TRUE 1
  ------------------
 2276|     18|            psh->gh_section_group_number = DW_GROUPNUMBER_DWO;
  ------------------
  |  |  128|     18|#define DW_GROUPNUMBER_DWO  2
  ------------------
 2277|     18|            ep->f_dwo_group_section_count++;
 2278|  1.28k|        } else if (_dwarf_load_elf_section_is_dwarf(name,
  ------------------
  |  Branch (2278:20): [True: 469, False: 820]
  ------------------
 2279|  1.28k|            psh->gh_type,
 2280|  1.28k|            &is_rela,&is_rel)) {
 2281|    469|            if (!psh->gh_section_group_number) {
  ------------------
  |  Branch (2281:17): [True: 436, False: 33]
  ------------------
 2282|    436|                psh->gh_section_group_number = DW_GROUPNUMBER_BASE;
  ------------------
  |  |  127|    436|#define DW_GROUPNUMBER_BASE 1
  ------------------
 2283|    436|            }
 2284|    469|            psh->gh_is_dwarf = TRUE;
  ------------------
  |  |   33|    469|#define TRUE 1
  ------------------
 2285|    820|        } else {
 2286|       |            /* Do nothing. */
 2287|    820|        }
 2288|  1.30k|    }
 2289|     55|    if (ep->f_sht_group_type_section_count) {
  ------------------
  |  Branch (2289:9): [True: 4, False: 51]
  ------------------
 2290|       |        /*  Not ARM. Done. */
 2291|      4|    }
 2292|     55|    if (!ep->f_shf_group_flag_section_count) {
  ------------------
  |  Branch (2292:9): [True: 51, False: 4]
  ------------------
 2293|       |        /*  Nothing more to do. */
 2294|     51|        return DW_DLV_OK;
  ------------------
  |  |   59|     51|#define DW_DLV_OK         0
  ------------------
 2295|     51|    }
 2296|      4|    return DW_DLV_OK;
  ------------------
  |  |   59|      4|#define DW_DLV_OK         0
  ------------------
 2297|     55|}
dwarf_elf_load_headers.c:elf_sht_groupsec:
 2024|  3.15k|{
 2025|       |    /*  ARM compilers name SHT group "__ARM_grp<long name here>"
 2026|       |        not .group */
 2027|  3.15k|    if ((type == SHT_GROUP) || (!strcmp(sname,".group"))){
  ------------------
  |  |   99|  3.15k|#define SHT_GROUP  17
  ------------------
  |  Branch (2027:9): [True: 483, False: 2.66k]
  |  Branch (2027:32): [True: 1, False: 2.66k]
  ------------------
 2028|    484|        return TRUE;
  ------------------
  |  |   33|    484|#define TRUE 1
  ------------------
 2029|    484|    }
 2030|  2.66k|    return FALSE;
  ------------------
  |  |   36|  2.66k|#define FALSE 0
  ------------------
 2031|  3.15k|}
dwarf_elf_load_headers.c:read_gs_section_group:
 2043|    257|{
 2044|    257|    Dwarf_Unsigned i = 0;
 2045|    257|    int res = 0;
 2046|       |
 2047|    257|    if (!psh->gh_sht_group_array) {
  ------------------
  |  Branch (2047:9): [True: 257, False: 0]
  ------------------
 2048|    257|        Dwarf_Unsigned seclen = psh->gh_size;
 2049|    257|        char *data = 0;
 2050|    257|        char *dp = 0;
 2051|    257|        Dwarf_Unsigned flags = psh->gh_flags;
 2052|    257|        Dwarf_Unsigned* grouparray = 0;
 2053|    257|        char dblock[4];
 2054|    257|        Dwarf_Unsigned va = 0;
 2055|    257|        Dwarf_Unsigned count = 0;
 2056|    257|        Dwarf_Unsigned groupmallocsize = 0;
 2057|    257|        int foundone = 0;
 2058|       |
 2059|    257|        if (seclen >= ep->f_filesize) {
  ------------------
  |  Branch (2059:13): [True: 0, False: 257]
  ------------------
 2060|      0|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      0|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2061|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2062|      0|        }
 2063|    257|        if (seclen < DWARF_32BIT_SIZE) {
  ------------------
  |  |  133|    257|#define DWARF_32BIT_SIZE 4
  ------------------
  |  Branch (2063:13): [True: 1, False: 256]
  ------------------
 2064|      1|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      1|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2065|      1|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
 2066|      1|        }
 2067|    256|        if (psh->gh_content) {
  ------------------
  |  Branch (2067:13): [True: 4, False: 252]
  ------------------
 2068|       |            /* Should NOT be set earlier! */
 2069|      4|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      4|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2070|      4|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      4|#define DW_DLV_ERROR      1
  ------------------
 2071|      4|        }
 2072|    252|        data = malloc(seclen);
 2073|    252|        if (!data) {
  ------------------
  |  Branch (2073:13): [True: 0, False: 252]
  ------------------
 2074|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 2075|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2076|      0|        }
 2077|    252|        dp = data;
 2078|    252|        if (psh->gh_entsize != DWARF_32BIT_SIZE) {
  ------------------
  |  |  133|    252|#define DWARF_32BIT_SIZE 4
  ------------------
  |  Branch (2078:13): [True: 0, False: 252]
  ------------------
 2079|      0|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      0|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2080|      0|            free(data);
 2081|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2082|      0|        }
 2083|    252|        if (!psh->gh_entsize) {
  ------------------
  |  Branch (2083:13): [True: 0, False: 252]
  ------------------
 2084|      0|            free(data);
 2085|      0|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      0|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2086|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2087|      0|        }
 2088|    252|        count = seclen/psh->gh_entsize;
 2089|    252|        if (count >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (2089:13): [True: 0, False: 252]
  ------------------
 2090|       |            /* Impossible */
 2091|      0|            free(data);
 2092|      0|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      0|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2093|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2094|      0|        }
 2095|    252|        res = RRMOA(ep->f_fd,data,psh->gh_offset,seclen,
  ------------------
  |  |   65|    252|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|    252|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
 2096|    252|            ep->f_filesize,errcode);
 2097|    252|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    252|#define DW_DLV_OK         0
  ------------------
  |  Branch (2097:13): [True: 0, False: 252]
  ------------------
 2098|      0|            free(data);
 2099|      0|            return res;
 2100|      0|        }
 2101|    252|        psh->gh_content = data;
 2102|    252|        psh->gh_was_alloc = TRUE;
  ------------------
  |  |   33|    252|#define TRUE 1
  ------------------
 2103|    252|        psh->gh_load_type = Dwarf_Alloc_Malloc;
 2104|    252|        if (flags & SHF_COMPRESSED) {
  ------------------
  |  |  293|    252|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (2104:13): [True: 0, False: 252]
  ------------------
 2105|       |#if defined(HAVE_ZLIB) && defined(HAVE_ZSTD)
 2106|       |            *errcode = 0;
 2107|       |            _dwarf_do_decompress_elf(ep,psh,errcode);
 2108|       |            /* decompress and set new section size */
 2109|       |            if (*errcode) {
 2110|       |                return DW_DLV_ERROR;
 2111|       |            }
 2112|       |#else /* COMPRESSED TEST */
 2113|      0|            *errcode = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      0|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
 2114|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2115|      0|#endif /* COMPRESSED TEST */
 2116|      0|        }
 2117|       |        /*  Adding 1 is silly but possibly avoids a warning
 2118|       |            from a particular compiler. */
 2119|    252|        groupmallocsize =  (1+count) * sizeof(Dwarf_Unsigned);
 2120|    252|        if (groupmallocsize >= ep->f_filesize) {
  ------------------
  |  Branch (2120:13): [True: 0, False: 252]
  ------------------
 2121|      0|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      0|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2122|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2123|      0|        }
 2124|    252|        grouparray = malloc(groupmallocsize);
 2125|    252|        if (!grouparray) {
  ------------------
  |  Branch (2125:13): [True: 0, False: 252]
  ------------------
 2126|      0|            *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 2127|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2128|      0|        }
 2129|       |
 2130|    252|        memcpy(dblock,dp,DWARF_32BIT_SIZE);
  ------------------
  |  |  133|    252|#define DWARF_32BIT_SIZE 4
  ------------------
 2131|    252|        ASNAR(memcpy,va,dblock);
  ------------------
  |  |   53|    252|    do {                                        \
  |  |   54|    252|        (t) = 0;                                \
  |  |   55|    252|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|    252|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 252]
  |  |  ------------------
  ------------------
 2132|       |        /* There is ambiguity on the endianness of this stuff. */
 2133|    252|        if (va != 1 && va != 0x1000000) {
  ------------------
  |  Branch (2133:13): [True: 252, False: 0]
  |  Branch (2133:24): [True: 1, False: 251]
  ------------------
 2134|       |            /*  Could be corrupted elf object. */
 2135|      1|            *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      1|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2136|      1|            free(grouparray);
 2137|      1|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
 2138|      1|        }
 2139|    251|        grouparray[0] = 1;
 2140|       |        /*  A .group section will have 0 to G sections
 2141|       |            listed. Ignore the initial 'version' value
 2142|       |            of 1 in [0] */
 2143|    251|        dp = dp + DWARF_32BIT_SIZE;
  ------------------
  |  |  133|    251|#define DWARF_32BIT_SIZE 4
  ------------------
 2144|  2.26k|        for ( i = 1; i < count; ++i,dp += DWARF_32BIT_SIZE) {
  ------------------
  |  |  133|  2.01k|#define DWARF_32BIT_SIZE 4
  ------------------
  |  Branch (2144:22): [True: 2.01k, False: 249]
  ------------------
 2145|  2.01k|            Dwarf_Unsigned gseca = 0;
 2146|  2.01k|            Dwarf_Unsigned gsecb = 0;
 2147|  2.01k|            struct generic_shdr* targpsh = 0;
 2148|       |
 2149|  2.01k|            memcpy(dblock,dp,DWARF_32BIT_SIZE);
  ------------------
  |  |  133|  2.01k|#define DWARF_32BIT_SIZE 4
  ------------------
 2150|  2.01k|            ASNAR(memcpy,gseca,dblock);
  ------------------
  |  |   53|  2.01k|    do {                                        \
  |  |   54|  2.01k|        (t) = 0;                                \
  |  |   55|  2.01k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.01k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.01k]
  |  |  ------------------
  ------------------
 2151|       |            /*  Loading gseca and gsecb with different endianness.
 2152|       |                Only one of them can be of any use. */
 2153|  2.01k|            ASNAR(_dwarf_memcpy_swap_bytes,gsecb,dblock);
  ------------------
  |  |   53|  2.01k|    do {                                        \
  |  |   54|  2.01k|        (t) = 0;                                \
  |  |   55|  2.01k|        (func)(&(t),&(s)[0],sizeof(s));           \
  |  |   56|  2.01k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (56:14): [Folded, False: 2.01k]
  |  |  ------------------
  ------------------
 2154|  2.01k|            if (!gseca) {
  ------------------
  |  Branch (2154:17): [True: 0, False: 2.01k]
  ------------------
 2155|       |                /*  zero! Oops. No point in looking at gsecb */
 2156|      0|                free(grouparray);
 2157|      0|                *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      0|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2158|      0|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2159|      0|            }
 2160|  2.01k|            if (gseca >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (2160:17): [True: 1.26k, False: 754]
  ------------------
 2161|       |                /*  Might be confused endianness by
 2162|       |                    the compiler generating the SHT_GROUP.
 2163|       |                    This is pretty horrible. */
 2164|  1.26k|                if (gsecb >= ep->f_loc_shdr.g_count) {
  ------------------
  |  Branch (2164:21): [True: 0, False: 1.26k]
  ------------------
 2165|      0|                    *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      0|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2166|      0|                    free(data);
 2167|      0|                    free(grouparray);
 2168|      0|                    return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 2169|      0|                }
 2170|       |                /*  Looks as though gsecb is the correct
 2171|       |                    interpretation.  Yes, ugly. */
 2172|  1.26k|                gseca = gsecb;
 2173|  1.26k|            }
 2174|  2.01k|            grouparray[i] = gseca;
 2175|  2.01k|            targpsh = ep->f_shdr + gseca;
 2176|  2.01k|            if (_dwarf_ignorethissection(targpsh->gh_namestring)){
  ------------------
  |  Branch (2176:17): [True: 1.63k, False: 384]
  ------------------
 2177|  1.63k|                continue;
 2178|  1.63k|            }
 2179|    384|            if (targpsh->gh_section_group_number) {
  ------------------
  |  Branch (2179:17): [True: 2, False: 382]
  ------------------
 2180|       |                /* multi-assignment to groups. Oops. */
 2181|      2|                free(grouparray);
 2182|      2|                *errcode = DW_DLE_ELF_SECTION_GROUP_ERROR;
  ------------------
  |  | 1487|      2|#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
  ------------------
 2183|      2|                return DW_DLV_ERROR;
  ------------------
  |  |   60|      2|#define DW_DLV_ERROR      1
  ------------------
 2184|      2|            }
 2185|    382|            targpsh->gh_section_group_number =
 2186|    382|                ep->f_sg_next_group_number;
 2187|    382|            foundone = 1;
 2188|    382|        }
 2189|    249|        if (foundone) {
  ------------------
  |  Branch (2189:13): [True: 56, False: 193]
  ------------------
 2190|     56|            ++ep->f_sg_next_group_number;
 2191|     56|            ++ep->f_sht_group_type_section_count;
 2192|     56|        }
 2193|    249|        psh->gh_sht_group_array = grouparray;
 2194|    249|        psh->gh_sht_group_array_count = count;
 2195|    249|    }
 2196|    249|    return DW_DLV_OK;
  ------------------
  |  |   59|    249|#define DW_DLV_OK         0
  ------------------
 2197|    257|}
dwarf_elf_load_headers.c:string_endswith:
 2004|  1.30k|{
 2005|  1.30k|    size_t len = strlen(n);
 2006|  1.30k|    size_t qlen = strlen(q);
 2007|  1.30k|    const char *startpt = 0;
 2008|       |
 2009|  1.30k|    if ( len < qlen) {
  ------------------
  |  Branch (2009:10): [True: 122, False: 1.18k]
  ------------------
 2010|    122|        return FALSE;
  ------------------
  |  |   36|    122|#define FALSE 0
  ------------------
 2011|    122|    }
 2012|  1.18k|    startpt = n + (len-qlen);
 2013|  1.18k|    if (strcmp(startpt,q)) {
  ------------------
  |  Branch (2013:9): [True: 1.16k, False: 18]
  ------------------
 2014|  1.16k|        return FALSE;
  ------------------
  |  |   36|  1.16k|#define FALSE 0
  ------------------
 2015|  1.16k|    }
 2016|     18|    return TRUE;
  ------------------
  |  |   33|     18|#define TRUE 1
  ------------------
 2017|  1.18k|}
dwarf_elf_load_headers.c:_dwarf_load_elf_section_is_dwarf:
  310|  1.28k|{
  311|  1.28k|    *is_rel = FALSE;
  ------------------
  |  |   36|  1.28k|#define FALSE 0
  ------------------
  312|  1.28k|    *is_rela = FALSE;
  ------------------
  |  |   36|  1.28k|#define FALSE 0
  ------------------
  313|  1.28k|    if (_dwarf_ignorethissection(sname)) {
  ------------------
  |  Branch (313:9): [True: 631, False: 658]
  ------------------
  314|    631|        return FALSE;
  ------------------
  |  |   36|    631|#define FALSE 0
  ------------------
  315|    631|    }
  316|    658|    if (sectype == SHT_REL) {
  ------------------
  |  |   59|    658|#define SHT_REL 9
  ------------------
  |  Branch (316:9): [True: 10, False: 648]
  ------------------
  317|     10|        return TRUE;
  ------------------
  |  |   33|     10|#define TRUE 1
  ------------------
  318|     10|    }
  319|    648|    if (sectype == SHT_RELA) {
  ------------------
  |  |   56|    648|#define SHT_RELA 4
  ------------------
  |  Branch (319:9): [True: 96, False: 552]
  ------------------
  320|     96|        *is_rela = TRUE;
  ------------------
  |  |   33|     96|#define TRUE 1
  ------------------
  321|     96|        return TRUE;
  ------------------
  |  |   33|     96|#define TRUE 1
  ------------------
  322|     96|    }
  323|    552|    if (!strncmp(sname,".rel",4)) {
  ------------------
  |  Branch (323:9): [True: 97, False: 455]
  ------------------
  324|     97|        if (!strncmp(sname,".rela.",6)) {
  ------------------
  |  Branch (324:13): [True: 3, False: 94]
  ------------------
  325|      3|            *is_rela = TRUE;
  ------------------
  |  |   33|      3|#define TRUE 1
  ------------------
  326|      3|            return TRUE;
  ------------------
  |  |   33|      3|#define TRUE 1
  ------------------
  327|      3|        }
  328|     94|        if (!strncmp(sname,".rel.",5)) {
  ------------------
  |  Branch (328:13): [True: 94, False: 0]
  ------------------
  329|     94|            *is_rela = TRUE;
  ------------------
  |  |   33|     94|#define TRUE 1
  ------------------
  330|     94|            return TRUE;
  ------------------
  |  |   33|     94|#define TRUE 1
  ------------------
  331|     94|        }
  332|       |        /*  Else something is goofy/Impossible */
  333|      0|        return FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  334|     94|    }
  335|    455|    if (!strncmp(sname,".debug_",7)) {
  ------------------
  |  Branch (335:9): [True: 262, False: 193]
  ------------------
  336|    262|        return TRUE;
  ------------------
  |  |   33|    262|#define TRUE 1
  ------------------
  337|    262|    }
  338|    193|    if (!strncmp(sname,".zdebug_",8)) {
  ------------------
  |  Branch (338:9): [True: 0, False: 193]
  ------------------
  339|      0|        return TRUE;
  ------------------
  |  |   33|      0|#define TRUE 1
  ------------------
  340|      0|    }
  341|    193|    if (!strcmp(sname,".eh_frame")) {
  ------------------
  |  Branch (341:9): [True: 4, False: 189]
  ------------------
  342|      4|        return TRUE;
  ------------------
  |  |   33|      4|#define TRUE 1
  ------------------
  343|      4|    }
  344|    189|    if (!strncmp(sname,".gdb_index",10)) {
  ------------------
  |  Branch (344:9): [True: 0, False: 189]
  ------------------
  345|      0|        return TRUE;
  ------------------
  |  |   33|      0|#define TRUE 1
  ------------------
  346|      0|    }
  347|    189|    return FALSE;
  ------------------
  |  |   36|    189|#define FALSE 0
  ------------------
  348|    189|}

_dwarf_elf_nlsetup:
  915|     74|{
  916|     74|    Dwarf_Obj_Access_Interface_a *binary_interface = 0;
  917|     74|    dwarf_elf_object_access_internals_t *intfc = 0;
  918|     74|    int res = DW_DLV_OK;
  ------------------
  |  |   59|     74|#define DW_DLV_OK         0
  ------------------
  919|     74|    int localerrnum = 0;
  920|       |
  921|     74|    res = _dwarf_elf_object_access_init(
  922|     74|        fd,
  923|     74|        ftype,endian,offsetsize,filesize,
  924|     74|        &binary_interface,
  925|     74|        &localerrnum);
  926|     74|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     74|#define DW_DLV_OK         0
  ------------------
  |  Branch (926:9): [True: 36, False: 38]
  ------------------
  927|     36|        if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |   58|     36|#define DW_DLV_NO_ENTRY  -1
  ------------------
  |  Branch (927:13): [True: 0, False: 36]
  ------------------
  928|      0|            return res;
  929|      0|        }
  930|     36|        _dwarf_error(NULL, error, localerrnum);
  931|     36|        return DW_DLV_ERROR;
  ------------------
  |  |   60|     36|#define DW_DLV_ERROR      1
  ------------------
  932|     36|    }
  933|       |    /*  allocates and initializes Dwarf_Debug,
  934|       |        generic code */
  935|     38|    res = dwarf_object_init_b(binary_interface, errhand, errarg,
  936|     38|        groupnumber, dbg, error);
  937|     38|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|     38|#define DW_DLV_OK         0
  ------------------
  |  Branch (937:9): [True: 26, False: 12]
  ------------------
  938|     26|        _dwarf_destruct_elf_nlaccess(binary_interface);
  939|     26|        return res;
  940|     26|    }
  941|     12|    intfc = binary_interface->ai_object;
  942|     12|    intfc->f_path = strdup(true_path);
  943|     12|    (*dbg)->de_obj_machine = intfc->f_machine;
  944|     12|    (*dbg)->de_obj_type = intfc->f_ftype; /* ET_REL etc */
  945|     12|    (*dbg)->de_obj_flags = intfc->f_flags;
  946|     12|    return res;
  947|     38|}
dwarf_elfread.c:_dwarf_destruct_elf_nlaccess:
  820|     74|{
  821|     74|    struct Dwarf_Obj_Access_Interface_a_s *aip =
  822|     74|        (struct Dwarf_Obj_Access_Interface_a_s *)obj;
  823|     74|    dwarf_elf_object_access_internals_t *ep = 0;
  824|     74|    struct generic_shdr *shp = 0;
  825|     74|    Dwarf_Unsigned shcount = 0;
  826|     74|    Dwarf_Unsigned i = 0;
  827|       |
  828|     74|    ep = (dwarf_elf_object_access_internals_t *)aip->ai_object;
  829|     74|    free(ep->f_ehdr);
  830|     74|    ep->f_ehdr = 0;
  831|     74|    shp = ep->f_shdr;
  832|     74|    shcount = ep->f_loc_shdr.g_count;
  833|   123k|    for (i = 0; i < shcount; ++i,++shp) {
  ------------------
  |  Branch (833:17): [True: 123k, False: 74]
  ------------------
  834|   123k|        enum Dwarf_Sec_Alloc_Pref alloc = shp->gh_load_type;
  835|   123k|        free(shp->gh_rels);
  836|   123k|        shp->gh_rels = 0;
  837|   123k|        switch(alloc) {
  838|    442|        case Dwarf_Alloc_Malloc:
  ------------------
  |  Branch (838:9): [True: 442, False: 122k]
  ------------------
  839|    442|            if (shp->gh_was_alloc) {
  ------------------
  |  Branch (839:17): [True: 442, False: 0]
  ------------------
  840|    442|                free(shp->gh_content);
  841|    442|            }
  842|    442|            break;
  843|      0|#ifdef HAVE_FULL_MMAP
  844|      0|        case Dwarf_Alloc_Mmap: {
  ------------------
  |  Branch (844:9): [True: 0, False: 123k]
  ------------------
  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|   122k|        default: break;
  ------------------
  |  Branch (855:9): [True: 122k, False: 442]
  ------------------
  856|       |            /*  something disastrously wrong. No free/mmap */
  857|   123k|        } /* end switch on alloc */
  858|   123k|        shp->gh_content = 0;
  859|   123k|        shp->gh_mmap_realarea = (char *)-1;
  860|   123k|        shp->gh_computed_mmaplen = 0;
  861|   123k|        free(shp->gh_sht_group_array);
  862|   123k|        shp->gh_sht_group_array = 0;
  863|   123k|        shp->gh_sht_group_array_count = 0;
  864|   123k|    }
  865|     74|    ep->f_loc_shdr.g_count = 0;
  866|     74|    free(ep->f_phdr);
  867|     74|    ep->f_phdr = 0;
  868|       |
  869|       |    /*  Whether elf shstrings and symtab strings
  870|       |        share the same section or not, we do
  871|       |        not need to free these. Section frees
  872|       |        of gh_content already did it. */
  873|     74|    ep->f_elf_shstrings_data = 0;
  874|     74|    ep->f_elf_shstrings_length = 0;
  875|     74|    ep->f_elf_shstrings_max = 0;
  876|     74|    ep->f_elf_shstrings_index = 0;
  877|     74|    ep->f_symtab_sect_strings = 0;
  878|     74|    ep->f_symtab_sect_strings_max = 0;
  879|     74|    ep->f_symtab_sect_strings_sect_index = 0;
  880|       |
  881|     74|    free(ep->f_dynsym_sect_strings);
  882|     74|    ep->f_dynsym_sect_strings = 0;
  883|     74|    free(ep->f_dynamic);
  884|     74|    ep->f_dynamic = 0;
  885|     74|    free(ep->f_symtab);
  886|     74|    ep->f_symtab = 0;
  887|     74|    free(ep->f_dynsym);
  888|     74|    ep->f_dynsym = 0;
  889|     74|    free(ep->f_shdr);
  890|     74|    ep->f_shdr = 0;
  891|       |    /* if TRUE close f_fd on destruct.*/
  892|     74|    if (ep->f_destruct_close_fd) {
  ------------------
  |  Branch (892:9): [True: 0, False: 74]
  ------------------
  893|      0|        _dwarf_closer(ep->f_fd);
  894|      0|    }
  895|     74|    ep->f_ident[0] = 'X';
  896|     74|    free(ep->f_path);
  897|     74|    ep->f_path = 0;
  898|     74|    free(ep);
  899|     74|    ep = 0;
  900|     74|    free(aip);
  901|     74|    aip = 0;
  902|     74|}
dwarf_elfread.c:_dwarf_elf_object_access_init:
 1113|     74|{
 1114|       |
 1115|     74|    int res = 0;
 1116|     74|    dwarf_elf_object_access_internals_t *internals = 0;
 1117|     74|    Dwarf_Obj_Access_Interface_a *intfc = 0;
 1118|       |
 1119|     74|    internals = malloc(sizeof(dwarf_elf_object_access_internals_t));
 1120|     74|    if (!internals) {
  ------------------
  |  Branch (1120:9): [True: 0, False: 74]
  ------------------
 1121|      0|        *localerrnum = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1122|       |        /* Impossible case, we hope. Give up. */
 1123|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1124|      0|    }
 1125|     74|    memset(internals,0,sizeof(*internals));
 1126|     74|    res = _dwarf_elf_object_access_internals_init(internals,
 1127|     74|        fd,
 1128|     74|        ftype, endian, offsetsize, filesize,
 1129|     74|        localerrnum);
 1130|     74|    if (res != DW_DLV_OK){
  ------------------
  |  |   59|     74|#define DW_DLV_OK         0
  ------------------
  |  Branch (1130:9): [True: 36, False: 38]
  ------------------
 1131|     36|        return res;
 1132|     36|    }
 1133|       |
 1134|     38|    intfc = malloc(sizeof(Dwarf_Obj_Access_Interface_a));
 1135|     38|    if (!intfc) {
  ------------------
  |  Branch (1135:9): [True: 0, False: 38]
  ------------------
 1136|       |        /* Impossible case, we hope. Give up. */
 1137|      0|        free(internals);
 1138|      0|        *localerrnum = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
 1139|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
 1140|      0|    }
 1141|     38|    memset(intfc,0,sizeof(*intfc));
 1142|       |
 1143|       |    /* Initialize the interface struct */
 1144|     38|    intfc->ai_object = internals;
 1145|     38|    intfc->ai_methods = &elf_nlmethods;
 1146|     38|    *binary_interface = intfc;
 1147|     38|    return DW_DLV_OK;
  ------------------
  |  |   59|     38|#define DW_DLV_OK         0
  ------------------
 1148|     38|}
dwarf_elfread.c:_dwarf_elf_object_access_internals_init:
  979|     74|{
  980|     74|    dwarf_elf_object_access_internals_t * intfc = internals;
  981|     74|    Dwarf_Unsigned i  = 0;
  982|     74|    struct Dwarf_Obj_Access_Interface_a_s *localdoas;
  983|     74|    int res = 0;
  984|       |
  985|       |    /*  Must malloc as _dwarf_destruct_elf_access()
  986|       |        forces that due to other uses. */
  987|     74|    localdoas = (struct Dwarf_Obj_Access_Interface_a_s *)
  988|     74|        malloc(sizeof(struct Dwarf_Obj_Access_Interface_a_s));
  989|     74|    if (!localdoas) {
  ------------------
  |  Branch (989:9): [True: 0, False: 74]
  ------------------
  990|      0|        free(internals);
  991|      0|        *errcode = DW_DLE_ALLOC_FAIL;
  ------------------
  |  | 1107|      0|#define DW_DLE_ALLOC_FAIL                       62
  ------------------
  992|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  993|      0|    }
  994|     74|    memset(localdoas,0,sizeof(struct Dwarf_Obj_Access_Interface_a_s));
  995|       |    /*  E is used with libelf. F with this elf reader. */
  996|     74|    intfc->f_ident[0]    = 'F';
  997|     74|    intfc->f_ident[1]    = '1';
  998|     74|    intfc->f_fd          = fd;
  999|     74|    intfc->f_is_64bit    = ((offsetsize==64)?TRUE:FALSE);
  ------------------
  |  |   33|     26|#define TRUE 1
  ------------------
                  intfc->f_is_64bit    = ((offsetsize==64)?TRUE:FALSE);
  ------------------
  |  |   36|     48|#define FALSE 0
  ------------------
  |  Branch (999:29): [True: 26, False: 48]
  ------------------
 1000|     74|    intfc->f_offsetsize  = (Dwarf_Small)offsetsize;
 1001|     74|    intfc->f_pointersize = (Dwarf_Small)offsetsize;
 1002|     74|    intfc->f_filesize    = filesize;
 1003|     74|    intfc->f_ftype       = ftype;
 1004|     74|    intfc->f_destruct_close_fd = FALSE;
  ------------------
  |  |   36|     74|#define FALSE 0
  ------------------
 1005|       |
 1006|       |#ifdef WORDS_BIGENDIAN
 1007|       |    if (endian == DW_END_little ) {
 1008|       |        intfc->f_copy_word = _dwarf_memcpy_swap_bytes;
 1009|       |        intfc->f_endian = DW_END_little;
 1010|       |    } else {
 1011|       |        intfc->f_copy_word = _dwarf_memcpy_noswap_bytes;
 1012|       |        intfc->f_endian = DW_END_big;
 1013|       |    }
 1014|       |#else  /* LITTLE ENDIAN */
 1015|     74|    if (endian == DW_END_little ) {
  ------------------
  |  | 1115|     74|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
  |  Branch (1015:9): [True: 48, False: 26]
  ------------------
 1016|     48|        intfc->f_copy_word = _dwarf_memcpy_noswap_bytes;
 1017|     48|        intfc->f_endian = DW_END_little;
  ------------------
  |  | 1115|     48|#define DW_END_little                   0x02 /* DWARF3f */
  ------------------
 1018|     48|    } else {
 1019|     26|        intfc->f_copy_word = _dwarf_memcpy_swap_bytes;
 1020|     26|        intfc->f_endian = DW_END_big;
  ------------------
  |  | 1114|     26|#define DW_END_big                      0x01 /* DWARF3f */
  ------------------
 1021|     26|    }
 1022|     74|#endif /* LITTLE- BIG-ENDIAN */
 1023|       |    /*  The following sets f_machine. */
 1024|     74|    res = _dwarf_load_elf_header(intfc,errcode);
 1025|     74|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     74|#define DW_DLV_OK         0
  ------------------
  |  Branch (1025:9): [True: 0, False: 74]
  ------------------
 1026|      0|        localdoas->ai_object = intfc;
 1027|      0|        localdoas->ai_methods = 0;
 1028|      0|        _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1029|      0|        localdoas = 0;
 1030|      0|        return res;
 1031|      0|    }
 1032|       |    /* Not loading progheaders */
 1033|     74|    res = _dwarf_load_elf_sectheaders(intfc,errcode);
 1034|     74|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     74|#define DW_DLV_OK         0
  ------------------
  |  Branch (1034:9): [True: 19, False: 55]
  ------------------
 1035|     19|        localdoas->ai_object = intfc;
 1036|     19|        localdoas->ai_methods = 0;
 1037|     19|        _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1038|     19|        localdoas = 0;
 1039|     19|        return res;
 1040|       |
 1041|     19|    }
 1042|       |    /* We are not looking at symbol strings for now. */
 1043|     55|    res = _dwarf_load_elf_symstr(intfc,errcode);
 1044|     55|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|     55|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1044:9): [True: 7, False: 48]
  ------------------
 1045|      7|        localdoas->ai_object = intfc;
 1046|      7|        localdoas->ai_methods = 0;
 1047|      7|        _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1048|      7|        localdoas = 0;
 1049|      7|        return res;
 1050|      7|    }
 1051|     48|    res  = _dwarf_load_elf_symtab_symbols(intfc,errcode);
 1052|     48|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|     48|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1052:9): [True: 6, False: 42]
  ------------------
 1053|      6|        localdoas->ai_object = intfc;
 1054|      6|        localdoas->ai_methods = 0;
 1055|      6|        _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1056|      6|        localdoas = 0;
 1057|      6|        return res;
 1058|      6|    }
 1059|   121k|    for ( i = 1; i < intfc->f_loc_shdr.g_count; ++i) {
  ------------------
  |  Branch (1059:18): [True: 121k, False: 38]
  ------------------
 1060|   121k|        struct generic_shdr *shp = 0;
 1061|   121k|        Dwarf_Unsigned section_type = 0;
 1062|   121k|        enum RelocRela localrel = RelocIsRela;
 1063|       |
 1064|   121k|        shp = intfc->f_shdr +i;
 1065|   121k|        section_type = shp->gh_type;
 1066|       |        /*  An empty namestring is a suggestion
 1067|       |            of corrupt Elf, and useless PE/Mach-o
 1068|       |            10 May 2026. */
 1069|   121k|        if (!shp->gh_namestring || !shp->gh_namestring[0]) {
  ------------------
  |  Branch (1069:13): [True: 0, False: 121k]
  |  Branch (1069:36): [True: 154, False: 121k]
  ------------------
 1070|       |            /*  A serious error which we ignore here
 1071|       |                as it will be caught elsewhere
 1072|       |                if necessary. */
 1073|    154|            continue;
 1074|   121k|        } else if (section_type == SHT_REL) {
  ------------------
  |  |   59|   121k|#define SHT_REL 9
  ------------------
  |  Branch (1074:20): [True: 12, False: 121k]
  ------------------
 1075|     12|            localrel = RelocIsRel;
 1076|   121k|        } else if (section_type == SHT_RELA) {
  ------------------
  |  |   56|   121k|#define SHT_RELA 4
  ------------------
  |  Branch (1076:20): [True: 332, False: 120k]
  ------------------
 1077|    332|            localrel = RelocIsRela;
 1078|   120k|        } else if (!strncmp(".rel.",shp->gh_namestring,5)) {
  ------------------
  |  Branch (1078:20): [True: 37.4k, False: 83.3k]
  ------------------
 1079|  37.4k|            localrel = RelocIsRel;
 1080|  83.3k|        } else if (!strncmp(".rela.",shp->gh_namestring,6)) {
  ------------------
  |  Branch (1080:20): [True: 68, False: 83.3k]
  ------------------
 1081|     68|            localrel = RelocIsRela;
 1082|  83.3k|        } else {
 1083|  83.3k|            continue;
 1084|  83.3k|        }
 1085|       |        /*  ASSERT: local rel is either RelocIsRel or
 1086|       |            RelocIsRela. Never any other value. */
 1087|       |        /*  Possibly we should check if the target section
 1088|       |            is one we care about before loading rela
 1089|       |            FIXME */
 1090|  37.8k|        res = _dwarf_load_elf_relx(intfc,i,localrel,errcode);
 1091|  37.8k|        if (res == DW_DLV_ERROR) {
  ------------------
  |  |   60|  37.8k|#define DW_DLV_ERROR      1
  ------------------
  |  Branch (1091:13): [True: 4, False: 37.8k]
  ------------------
 1092|      4|            localdoas->ai_object = intfc;
 1093|      4|            localdoas->ai_methods = 0;
 1094|      4|            _dwarf_destruct_elf_nlaccess((void *)localdoas);
 1095|      4|            localdoas = 0;
 1096|      4|            return res;
 1097|      4|        }
 1098|  37.8k|    }
 1099|     38|    free(localdoas);
 1100|     38|    localdoas = 0;
 1101|     38|    return DW_DLV_OK;
  ------------------
  |  |   59|     38|#define DW_DLV_OK         0
  ------------------
 1102|     42|}
dwarf_elfread.c:elf_get_nolibelf_section_info:
  185|   214k|{
  186|   214k|    dwarf_elf_object_access_internals_t *elf =
  187|   214k|        (dwarf_elf_object_access_internals_t*)(obj);
  188|       |
  189|   214k|    (void)error;
  190|   214k|    if (section_index < elf->f_loc_shdr.g_count) {
  ------------------
  |  Branch (190:9): [True: 214k, False: 0]
  ------------------
  191|   214k|        struct generic_shdr *sp = 0;
  192|       |
  193|   214k|        sp = elf->f_shdr + section_index;
  194|   214k|        return_section->as_addr      = sp->gh_addr;
  195|   214k|        return_section->as_type      = sp->gh_type;
  196|   214k|        return_section->as_size      = sp->gh_size;
  197|   214k|        return_section->as_name      = sp->gh_namestring;
  198|   214k|        return_section->as_link      = sp->gh_link;
  199|   214k|        return_section->as_info      = sp->gh_info;
  200|   214k|        return_section->as_flags     = sp->gh_flags;
  201|   214k|        return_section->as_entrysize = sp->gh_entsize;
  202|   214k|        return_section->as_offset    = sp->gh_offset;
  203|   214k|        return DW_DLV_OK;
  ------------------
  |  |   59|   214k|#define DW_DLV_OK         0
  ------------------
  204|   214k|    }
  205|      0|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  206|   214k|}
dwarf_elfread.c:elf_get_nolibelf_byte_order:
  147|     38|{
  148|     38|    dwarf_elf_object_access_internals_t *elf =
  149|     38|        (dwarf_elf_object_access_internals_t*)(obj);
  150|     38|    return (Dwarf_Small)elf->f_endian;
  151|     38|}
dwarf_elfread.c:elf_get_nolibelf_length_size:
  154|     38|{
  155|     38|    dwarf_elf_object_access_internals_t *elf =
  156|     38|        (dwarf_elf_object_access_internals_t*)(obj);
  157|     38|    return elf->f_offsetsize/8;
  158|     38|}
dwarf_elfread.c:elf_get_nolibelf_pointer_size:
  161|     38|{
  162|     38|    dwarf_elf_object_access_internals_t *elf =
  163|     38|        (dwarf_elf_object_access_internals_t*)(obj);
  164|     38|    return elf->f_pointersize/8;
  165|     38|}
dwarf_elfread.c:elf_get_nolibelf_file_size:
  168|     38|{
  169|     38|    dwarf_elf_object_access_internals_t *elf =
  170|     38|        (dwarf_elf_object_access_internals_t*)(obj);
  171|     38|    return elf->f_filesize;
  172|     38|}
dwarf_elfread.c:elf_get_nolibelf_section_count:
  175|     38|{
  176|     38|    dwarf_elf_object_access_internals_t *elf =
  177|     38|        (dwarf_elf_object_access_internals_t*)(obj);
  178|     38|    return elf->f_loc_shdr.g_count;
  179|     38|}
dwarf_elfread.c:elf_load_nolibelf_section:
  250|    202|{
  251|       |    /*  Linux kernel read size limit 0x7ffff000,
  252|       |        Without any good reason, limit our reads
  253|       |        to a bit less. */
  254|    202|    const Dwarf_Unsigned read_size_limit = 0x7ff00000;
  255|    202|    Dwarf_Unsigned read_offset = 0;
  256|    202|    Dwarf_Unsigned read_size = 0;
  257|    202|    Dwarf_Unsigned remaining_bytes = 0;
  258|    202|    Dwarf_Small *  read_target = 0;
  259|    202|    dwarf_elf_object_access_internals_t *elf =
  260|    202|        (dwarf_elf_object_access_internals_t*)(obj);
  261|    202|    struct generic_shdr *sp = 0;
  262|    202|    int decompressme = FALSE;
  ------------------
  |  |   36|    202|#define FALSE 0
  ------------------
  263|    202|    int res = 0;
  264|       |
  265|    202|    res = elf_load_find_sec_ptr(obj,section_index,&sp,
  266|    202|        &decompressme,errorc);
  267|    202|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    202|#define DW_DLV_OK         0
  ------------------
  |  Branch (267:9): [True: 0, False: 202]
  ------------------
  268|      0|        return res;
  269|      0|    }
  270|    202|    if (sp->gh_content) {
  ------------------
  |  Branch (270:9): [True: 185, False: 17]
  ------------------
  271|    185|        *return_data = (Dwarf_Small *)sp->gh_content;
  272|    185|        return DW_DLV_OK;
  ------------------
  |  |   59|    185|#define DW_DLV_OK         0
  ------------------
  273|    185|    }
  274|       |    /*  Guarding against bad values and
  275|       |        against overflow */
  276|     17|    if (sp->gh_size > elf->f_filesize ||
  ------------------
  |  Branch (276:9): [True: 1, False: 16]
  ------------------
  277|     16|        sp->gh_offset > elf->f_filesize ||
  ------------------
  |  Branch (277:9): [True: 0, False: 16]
  ------------------
  278|     16|        (sp->gh_size + sp->gh_offset) >
  ------------------
  |  Branch (278:9): [True: 2, False: 14]
  ------------------
  279|     16|            elf->f_filesize) {
  280|      3|        *errorc = DW_DLE_ELF_SECTION_ERROR;
  ------------------
  |  | 1492|      3|#define DW_DLE_ELF_SECTION_ERROR               446
  ------------------
  281|      3|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      3|#define DW_DLV_ERROR      1
  ------------------
  282|      3|    }
  283|       |
  284|     14|    sp->gh_load_type = Dwarf_Alloc_Malloc;
  285|     14|    sp->gh_content = malloc((size_t)sp->gh_size);
  286|     14|    if (!sp->gh_content) {
  ------------------
  |  Branch (286:9): [True: 0, False: 14]
  ------------------
  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|     14|    remaining_bytes = sp->gh_size;
  293|     14|    read_size = remaining_bytes;
  294|     14|    read_offset = sp->gh_offset;
  295|     14|    read_target = (Dwarf_Small*)sp->gh_content;
  296|     28|    for ( ; remaining_bytes > 0; read_size = remaining_bytes ) {
  ------------------
  |  Branch (296:13): [True: 14, False: 14]
  ------------------
  297|     14|        if (read_size > read_size_limit) {
  ------------------
  |  Branch (297:13): [True: 0, False: 14]
  ------------------
  298|      0|            read_size = read_size_limit;
  299|      0|        }
  300|     14|        res = RRMOA(elf->f_fd,
  ------------------
  |  |   65|     14|#define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(\
  |  |   66|     14|    (f),(char *)(buf),(loc),(siz),(fsiz),(errc));
  ------------------
  301|     14|            (void *)read_target, read_offset,
  302|     14|            read_size,
  303|     14|            elf->f_filesize, errorc);
  304|     14|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|     14|#define DW_DLV_OK         0
  ------------------
  |  Branch (304:13): [True: 0, False: 14]
  ------------------
  305|      0|            free(sp->gh_content);
  306|      0|            sp->gh_content = 0;
  307|      0|            return res;
  308|      0|        }
  309|     14|        remaining_bytes -= read_size;
  310|     14|        read_offset += read_size;
  311|     14|        read_target += read_size;
  312|     14|    }
  313|     14|    sp->gh_was_alloc = TRUE;
  ------------------
  |  |   33|     14|#define TRUE 1
  ------------------
  314|     14|    sp->gh_load_type = Dwarf_Alloc_Malloc;
  315|       |
  316|     14|    if (decompressme) {
  ------------------
  |  Branch (316:9): [True: 0, False: 14]
  ------------------
  317|      0|        Dwarf_Unsigned flags = sp->gh_flags;
  318|      0|        if (flags& SHF_COMPRESSED) {
  ------------------
  |  |  293|      0|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (318:13): [True: 0, 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|      0|            *errorc = DW_DLE_ZLIB_ZSTD_MISSING;
  ------------------
  |  | 1562|      0|#define DW_DLE_ZLIB_ZSTD_MISSING               516
  ------------------
  330|      0|            return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  331|      0|#endif /* COMPRESSED TEST */
  332|      0|        }
  333|      0|    }
  334|     14|    *return_data = (Dwarf_Small *)sp->gh_content;
  335|     14|    return DW_DLV_OK;
  ------------------
  |  |   59|     14|#define DW_DLV_OK         0
  ------------------
  336|     14|}
dwarf_elfread.c:elf_load_find_sec_ptr:
  212|    412|{
  213|    412|    dwarf_elf_object_access_internals_t *elf =
  214|    412|        (dwarf_elf_object_access_internals_t*)(obj);
  215|       |
  216|    412|    (void)errorc;
  217|    412|    if (0 < section_index &&
  ------------------
  |  Branch (217:9): [True: 404, False: 8]
  ------------------
  218|    404|        section_index < elf->f_loc_shdr.g_count) {
  ------------------
  |  Branch (218:9): [True: 404, False: 0]
  ------------------
  219|    404|        struct generic_shdr *sp =
  220|    404|            elf->f_shdr + section_index;
  221|       |
  222|    404|        if (!sp->gh_size) {
  ------------------
  |  Branch (222:13): [True: 0, False: 404]
  ------------------
  223|      0|            return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  224|      0|        }
  225|    404|        *sp_inout = sp;
  226|    404|        if (sp->gh_flags & SHF_COMPRESSED) {
  ------------------
  |  |  293|    404|#define SHF_COMPRESSED (1 << 11)
  ------------------
  |  Branch (226:13): [True: 2, False: 402]
  ------------------
  227|      2|            switch(sp->gh_type) {
  228|      0|            case SHT_STRTAB:
  ------------------
  |  |   53|      0|#define SHT_STRTAB 3
  ------------------
  |  Branch (228:13): [True: 0, False: 2]
  ------------------
  229|      0|            case SHT_SYMTAB:
  ------------------
  |  |   50|      0|#define SHT_SYMTAB 2
  ------------------
  |  Branch (229:13): [True: 0, False: 2]
  ------------------
  230|      0|            case SHT_REL:
  ------------------
  |  |   59|      0|#define SHT_REL 9
  ------------------
  |  Branch (230:13): [True: 0, False: 2]
  ------------------
  231|      0|            case SHT_RELA:
  ------------------
  |  |   56|      0|#define SHT_RELA 4
  ------------------
  |  Branch (231:13): [True: 0, False: 2]
  ------------------
  232|      0|                *decompressme = TRUE;
  ------------------
  |  |   33|      0|#define TRUE 1
  ------------------
  233|      0|                break;
  234|      2|            case SHT_NOBITS:
  ------------------
  |  |   87|      2|#define SHT_NOBITS 8
  ------------------
  |  Branch (234:13): [True: 2, False: 0]
  ------------------
  235|      2|            default:
  ------------------
  |  Branch (235:13): [True: 0, False: 2]
  ------------------
  236|      2|                break;
  237|      2|            }
  238|      2|        }
  239|    404|        return DW_DLV_OK;
  ------------------
  |  |   59|    404|#define DW_DLV_OK         0
  ------------------
  240|    404|    }
  241|      8|    return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      8|#define DW_DLV_NO_ENTRY  -1
  ------------------
  242|    412|}
dwarf_elfread.c:elf_relocations_nolibelf:
  762|      1|{
  763|      1|    int res = DW_DLV_ERROR;
  ------------------
  |  |   60|      1|#define DW_DLV_ERROR      1
  ------------------
  764|      1|    dwarf_elf_object_access_internals_t*obj = 0;
  765|      1|    struct Dwarf_Section_s * relocatablesec = 0;
  766|      1|    Dwarf_Unsigned section_with_reloc_records = 0;
  767|       |
  768|      1|    if (section_index == 0) {
  ------------------
  |  Branch (768:9): [True: 0, False: 1]
  ------------------
  769|      0|        return DW_DLV_NO_ENTRY;
  ------------------
  |  |   58|      0|#define DW_DLV_NO_ENTRY  -1
  ------------------
  770|      0|    }
  771|      1|    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|      1|    res = find_section_to_relocate(dbg, section_index,
  778|      1|        &relocatablesec, errorc);
  779|      1|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|      1|#define DW_DLV_OK         0
  ------------------
  |  Branch (779:9): [True: 0, False: 1]
  ------------------
  780|      0|        return res;
  781|      0|    }
  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|      1|    section_with_reloc_records = relocatablesec->dss_reloc_index;
  793|      1|    if (!section_with_reloc_records) {
  ------------------
  |  Branch (793:9): [True: 0, False: 1]
  ------------------
  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|      1|    if (!obj->f_symtab || !obj->f_symtab_sect_strings) {
  ------------------
  |  Branch (800:9): [True: 0, False: 1]
  |  Branch (800:27): [True: 0, False: 1]
  ------------------
  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|      1|    if (obj->f_symtab_sect_index != relocatablesec->dss_reloc_link) {
  ------------------
  |  Branch (804:9): [True: 0, False: 1]
  ------------------
  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|      1|    res = apply_rela_entries(dbg,
  813|      1|        section_with_reloc_records,
  814|      1|        obj, relocatablesec,errorc);
  815|      1|    return res;
  816|      1|}
dwarf_elfread.c:find_section_to_relocate:
  560|      1|{
  561|      1|    MATCH_REL_SEC(section_index,dbg->de_debug_info,relocatablesec);
  ------------------
  |  |  551|      1|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      1|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 1]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  562|      1|    MATCH_REL_SEC(section_index,dbg->de_debug_abbrev,relocatablesec);
  ------------------
  |  |  551|      1|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      1|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 1]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  563|      1|    MATCH_REL_SEC(section_index,dbg->de_debug_line,relocatablesec);
  ------------------
  |  |  551|      1|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      1|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 1]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  564|      1|    MATCH_REL_SEC(section_index,dbg->de_debug_loc,relocatablesec);
  ------------------
  |  |  551|      1|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      1|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 1]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  565|      1|    MATCH_REL_SEC(section_index,dbg->de_debug_aranges,relocatablesec);
  ------------------
  |  |  551|      1|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      1|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 1]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  566|      1|    MATCH_REL_SEC(section_index,dbg->de_debug_macinfo,relocatablesec);
  ------------------
  |  |  551|      1|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      1|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 1]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  567|      1|    MATCH_REL_SEC(section_index,dbg->de_debug_pubnames,
  ------------------
  |  |  551|      1|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      1|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 1]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  568|      1|        relocatablesec);
  569|      1|    MATCH_REL_SEC(section_index,dbg->de_debug_names,
  ------------------
  |  |  551|      1|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      1|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 1, False: 0]
  |  |  ------------------
  |  |  553|      1|    *(r_) = &(s_);            \
  |  |  554|      1|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      1|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      1|}
  ------------------
  570|      1|        relocatablesec);
  571|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_ranges,relocatablesec);
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  572|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_frame,
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  573|      0|        relocatablesec);
  574|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_frame_eh_gnu,
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  575|      0|        relocatablesec);
  576|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_pubtypes,
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  577|      0|        relocatablesec);
  578|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_funcnames,
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  579|      0|        relocatablesec);
  580|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_typenames,
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  581|      0|        relocatablesec);
  582|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_varnames,
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  583|      0|        relocatablesec);
  584|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_weaknames,
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  585|      0|        relocatablesec);
  586|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_types,relocatablesec);
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  587|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_macro,relocatablesec);
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  588|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_rnglists,
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  589|      0|        relocatablesec);
  590|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_loclists,
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  591|      0|        relocatablesec);
  592|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_aranges,
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  593|      0|        relocatablesec);
  594|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_sup,
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  595|      0|        relocatablesec);
  596|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_str_offsets,
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  597|      0|        relocatablesec);
  598|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_addr,relocatablesec);
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  599|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_gnu_pubnames,
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  600|      0|        relocatablesec);
  601|      0|    MATCH_REL_SEC(section_index,dbg->de_debug_gnu_pubtypes,
  ------------------
  |  |  551|      0|#define MATCH_REL_SEC(i_,s_,r_)  \
  |  |  552|      0|if ((i_) == (s_).dss_index) { \
  |  |  ------------------
  |  |  |  Branch (552:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  553|      0|    *(r_) = &(s_);            \
  |  |  554|      0|    return DW_DLV_OK;    \
  |  |  ------------------
  |  |  |  |   59|      0|#define DW_DLV_OK         0
  |  |  ------------------
  |  |  555|      0|}
  ------------------
  602|      0|        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|      0|    *errorc = DW_DLE_RELOC_SECTION_MISMATCH;
  ------------------
  |  | 1259|      0|#define DW_DLE_RELOC_SECTION_MISMATCH          214
  ------------------
  610|      0|    return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  611|      0|}
dwarf_elfread.c:apply_rela_entries:
  710|      1|{
  711|      1|    int return_res = DW_DLV_OK;
  ------------------
  |  |   59|      1|#define DW_DLV_OK         0
  ------------------
  712|      1|    struct generic_shdr * rels_shp = 0;
  713|      1|    Dwarf_Unsigned relcount;
  714|      1|    Dwarf_Unsigned i = 0;
  715|       |
  716|      1|    if (r_section_index >= obj->f_loc_shdr.g_count) {
  ------------------
  |  Branch (716:9): [True: 0, False: 1]
  ------------------
  717|      0|        *errorc = DW_DLE_SECTION_INDEX_BAD;
  ------------------
  |  | 1484|      0|#define DW_DLE_SECTION_INDEX_BAD               438
  ------------------
  718|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  719|      0|    }
  720|      1|    rels_shp = obj->f_shdr + r_section_index;
  721|      1|    relcount = rels_shp->gh_relcount;
  722|      1|    if (obj->f_ehdr->ge_type != ET_REL) {
  ------------------
  |  |  157|      1|#define ET_REL           1
  ------------------
  |  Branch (722:9): [True: 0, False: 1]
  ------------------
  723|       |        /* No relocations to do */
  724|      0|        return DW_DLV_OK;
  ------------------
  |  |   59|      0|#define DW_DLV_OK         0
  ------------------
  725|      0|    }
  726|      1|    if (!relcount) {
  ------------------
  |  Branch (726:9): [True: 1, False: 0]
  ------------------
  727|       |        /*  Nothing to do. */
  728|      1|        return DW_DLV_OK;
  ------------------
  |  |   59|      1|#define DW_DLV_OK         0
  ------------------
  729|      1|    }
  730|      0|    if (!rels_shp->gh_rels) {
  ------------------
  |  Branch (730:9): [True: 0, False: 0]
  ------------------
  731|       |        /*  something wrong. */
  732|      0|        *errorc = DW_DLE_RELOCS_ERROR;
  ------------------
  |  | 1326|      0|#define DW_DLE_RELOCS_ERROR                    280
  ------------------
  733|      0|        return DW_DLV_ERROR;
  ------------------
  |  |   60|      0|#define DW_DLV_ERROR      1
  ------------------
  734|      0|    }
  735|      0|    for (i = 0; i < relcount; i++) {
  ------------------
  |  Branch (735:17): [True: 0, False: 0]
  ------------------
  736|      0|        int res = update_entry(dbg,obj,
  737|      0|            rels_shp->gh_rels+i,
  738|      0|            relocatablesec->dss_data,
  739|      0|            relocatablesec->dss_size,
  740|      0|            errorc);
  741|      0|        if (res != DW_DLV_OK) {
  ------------------
  |  |   59|      0|#define DW_DLV_OK         0
  ------------------
  |  Branch (741:13): [True: 0, False: 0]
  ------------------
  742|       |            /* We try to keep going, not stop. */
  743|      0|            return_res = res;
  744|      0|        }
  745|      0|    }
  746|      0|    return return_res;
  747|      0|}
dwarf_elfread.c:elf_load_nolibelf_section_a:
  453|    210|{
  454|    210|    int res  = 0;
  455|    210|    enum Dwarf_Sec_Alloc_Pref alloc_type_in = *dw_alloc_type;
  456|    210|    struct generic_shdr *sp = 0;
  457|    210|    int decompressme = FALSE;
  ------------------
  |  |   36|    210|#define FALSE 0
  ------------------
  458|       |
  459|    210|    res = elf_load_find_sec_ptr(obj,dw_section_index,&sp,
  460|    210|        &decompressme,errc);
  461|    210|    if (res != DW_DLV_OK) {
  ------------------
  |  |   59|    210|#define DW_DLV_OK         0
  ------------------
  |  Branch (461:9): [True: 8, False: 202]
  ------------------
  462|      8|        return res;
  463|      8|    }
  464|    202|    if (alloc_type_in == Dwarf_Alloc_Malloc ||
  ------------------
  |  Branch (464:9): [True: 202, False: 0]
  ------------------
  465|    202|        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|    202|        res = elf_load_nolibelf_section(obj,dw_section_index,
  469|    202|            return_data_ptr,errc);
  470|    202|        *return_mmap_base_ptr = 0;
  471|    202|        *return_mmap_offset = 0;
  472|    202|        *return_mmap_len = 0;
  473|    202|        *dw_alloc_type = Dwarf_Alloc_Malloc;
  474|       |        /* *return_data_len =  not set */
  475|    202|        return res;
  476|    202|    }
  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|    161|{
  112|    161|    _dwarf_error_string(dbg,error,errval,0);
  113|    161|}
_dwarf_error_string:
  120|    218|{
  121|    218|    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|    218|    if (error) {
  ------------------
  |  Branch (126:9): [True: 218, False: 0]
  ------------------
  127|       |        /*  If dbg is NULL, use the alternate error struct. However,
  128|       |            this will overwrite the earlier error. */
  129|    218|        if (dbg) {
  ------------------
  |  Branch (129:13): [True: 52, False: 166]
  ------------------
  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|     52|            errptr =
  135|     52|                (Dwarf_Error) _dwarf_get_alloc(dbg->de_errors_dbg,
  136|     52|                    DW_DLA_ERROR, 1);
  ------------------
  |  |  995|     52|#define DW_DLA_ERROR           0x0e  /* Dwarf_Error */
  ------------------
  137|     52|            if (!errptr) {
  ------------------
  |  Branch (137:17): [True: 0, False: 52]
  ------------------
  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|     52|            } else {
  141|     52|                errptr->er_static_alloc = DE_STANDARD;
  ------------------
  |  |   45|     52|#define DE_STANDARD 0 /* Normal alloc attached to dbg. */
  ------------------
  142|     52|            }
  143|    166|        } else {
  144|       |            /*  We have no dbg to work with. dwarf_init
  145|       |                failed. We hack
  146|       |                up a special area. */
  147|    166|            errptr = _dwarf_special_no_dbg_error_malloc();
  148|    166|            if (!errptr) {
  ------------------
  |  Branch (148:17): [True: 0, False: 166]
  ------------------
  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|    166|            } else {
  160|    166|                errptr->er_static_alloc = DE_MALLOC;
  ------------------
  |  |   47|    166|#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|    166|                _dwarf_add_to_static_err_list(errptr);
  170|    166|            }
  171|    166|        }
  172|       |
  173|    218|        errptr->er_errval = errval;
  174|    218|        if (msg && errptr->er_static_alloc != DE_STATIC) {
  ------------------
  |  |   46|     57|#define DE_STATIC 1   /* Using global static var */
  ------------------
  |  Branch (174:13): [True: 57, False: 161]
  |  Branch (174:20): [True: 57, False: 0]
  ------------------
  175|     57|            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|     57|            em = (dwarfstring *)calloc(1,sizeof(dwarfstring));
  183|     57|            if (em) {
  ------------------
  |  Branch (183:17): [True: 57, False: 0]
  ------------------
  184|     57|                dwarfstring_constructor(em);
  185|     57|                dwarfstring_append(em,msg);
  186|     57|                errptr->er_msg = (void*)em;
  187|     57|            }
  188|     57|        }
  189|    218|        *error = errptr;
  190|    218|        return;
  191|    218|    }
  192|       |
  193|      0|    if (dbg  && dbg->de_errhand != NULL) {
  ------------------
  |  Branch (193:9): [True: 0, False: 0]
  |  Branch (193:17): [True: 0, False: 0]
  ------------------
  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|      0|    fflush(stderr);
  205|      0|    fprintf(stderr,
  206|      0|        "\nlibdwarf is unable to record error %s "
  207|      0|        "No error argument or handler available\n",
  208|      0|        dwarf_errmsg_by_number(errval));
  209|       |    fflush(stderr);
  210|      0|    return;
  211|      0|}
dwarf_errno:
  215|     34|{
  216|     34|    if (!error) {
  ------------------
  |  Branch (216:9): [True: 0, False: 34]
  ------------------
  217|      0|        return (0);
  218|      0|    }
  219|     34|    return (error->er_errval);
  220|     34|}
dwarf_errmsg_by_number:
  224|     22|{
  225|     22|    if (errornum > DW_DLE_LAST) {
  ------------------
  |  | 1565|     22|#define DW_DLE_LAST        516
  ------------------
  |  Branch (225:9): [True: 0, False: 22]
  ------------------
  226|      0|        return "Dwarf_Error value out of range";
  227|      0|    }
  228|     22|    return ((char *) &_dwarf_errmsgs[errornum][0]);
  229|     22|}
dwarf_errmsg:
  235|     34|{
  236|     34|    if (!error) {
  ------------------
  |  Branch (236:9): [True: 0, False: 34]
  ------------------
  237|      0|        return "Dwarf_Error is NULL";
  238|      0|    }
  239|     34|    if (error->er_msg) {
  ------------------
  |  Branch (239:9): [True: 12, False: 22]
  ------------------
  240|     12|        return dwarfstring_string(error->er_msg);
  241|     12|    }
  242|     22|    return  dwarf_errmsg_by_number(error->er_errval);
  243|     34|}

dwarf_init_b:
  453|    225|{
  454|    225|    unsigned ftype = 0;
  455|    225|    unsigned endian = 0;
  456|    225|    unsigned offsetsize = 0;
  457|    225|    unsigned universalnumber = 0;
  458|    225|    Dwarf_Unsigned   filesize = 0;
  459|    225|    int res = 0;
  460|    225|    int errcode = 0;
  461|       |
  462|    225|    if (!ret_dbg) {
  ------------------
  |  Branch (462:9): [True: 0, False: 225]
  ------------------
  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|    225|    *ret_dbg = 0;
  468|       |
  469|    225|    res = _dwarf_object_detector_fd_a(fd,
  470|    225|        &ftype,
  471|    225|        &endian,&offsetsize,0,
  472|    225|        &filesize,&errcode);
  473|    225|    if (res == DW_DLV_NO_ENTRY) {
  ------------------
  |  |  121|    225|#define DW_DLV_NO_ENTRY -1
  ------------------
  |  Branch (473:9): [True: 6, False: 219]
  ------------------
  474|      6|        return res;
  475|      6|    }
  476|    219|    if (res == DW_DLV_ERROR) {
  ------------------
  |  |  123|    219|#define DW_DLV_ERROR     1
  ------------------
  |  Branch (476:9): [True: 0, False: 219]
  ------------------
  477|       |        /* This macro does a return. */
  478|      0|        DWARF_DBG_ERROR(NULL, DW_DLE_FILE_WRONG_TYPE, DW_DLV_ERROR);
  ------------------
  |  |   43|      0|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
  479|      0|    }
  480|    219|    switch(ftype) {
  481|     74|    case DW_FTYPE_ELF: {
  ------------------
  |  |  114|     74|#define DW_FTYPE_ELF        1  /* Unix/Linux/etc */
  ------------------
  |  Branch (481:5): [True: 74, False: 145]
  ------------------
  482|     74|        int res2 = 0;
  483|       |
  484|     74|        res2 = _dwarf_elf_nlsetup(fd,"",
  485|     74|            ftype,endian,offsetsize,filesize,
  486|     74|            group_number,errhand,errarg,ret_dbg,error);
  487|     74|        if (res2 != DW_DLV_OK) {
  ------------------
  |  |  122|     74|#define DW_DLV_OK        0
  ------------------
  |  Branch (487:13): [True: 62, False: 12]
  ------------------
  488|     62|            return res2;
  489|     62|        }
  490|     12|        set_global_paths_init(*ret_dbg,error);
  491|     12|        return res2;
  492|     74|        }
  493|     17|    case DW_FTYPE_APPLEUNIVERSAL:
  ------------------
  |  |  118|     17|#define DW_FTYPE_APPLEUNIVERSAL    5
  ------------------
  |  Branch (493:5): [True: 17, False: 202]
  ------------------
  494|     99|    case DW_FTYPE_MACH_O: {
  ------------------
  |  |  115|     99|#define DW_FTYPE_MACH_O     2  /* Macos. */
  ------------------
  |  Branch (494:5): [True: 82, False: 137]
  ------------------
  495|     99|        int resm = 0;
  496|       |
  497|     99|        resm = _dwarf_macho_setup(fd,"",
  498|     99|            universalnumber,
  499|     99|            ftype,endian,offsetsize,filesize,
  500|     99|            group_number,errhand,errarg,ret_dbg,error);
  501|     99|        if (resm != DW_DLV_OK) {
  ------------------
  |  |  122|     99|#define DW_DLV_OK        0
  ------------------
  |  Branch (501:13): [True: 89, False: 10]
  ------------------
  502|     89|            return resm;
  503|     89|        }
  504|     10|        set_global_paths_init(*ret_dbg,error);
  505|     10|        return resm;
  506|     99|        }
  507|       |
  508|     46|    case DW_FTYPE_PE: {
  ------------------
  |  |  116|     46|#define DW_FTYPE_PE         3  /* Windows */
  ------------------
  |  Branch (508:5): [True: 46, False: 173]
  ------------------
  509|     46|        int resp = 0;
  510|       |
  511|     46|        resp = _dwarf_pe_setup(fd,
  512|     46|            "",
  513|     46|            ftype,endian,offsetsize,filesize,
  514|     46|            group_number,errhand,errarg,ret_dbg,error);
  515|     46|        if (resp != DW_DLV_OK) {
  ------------------
  |  |  122|     46|#define DW_DLV_OK        0
  ------------------
  |  Branch (515:13): [True: 45, False: 1]
  ------------------
  516|     45|            return resp;
  517|     45|        }
  518|      1|        set_global_paths_init(*ret_dbg,error);
  519|      1|        return resp;
  520|     46|        }
  521|      0|    default: break;
  ------------------
  |  Branch (521:5): [True: 0, False: 219]
  ------------------
  522|    219|    }
  523|    219|    DWARF_DBG_ERROR(NULL, DW_DLE_FILE_WRONG_TYPE, DW_DLV_ERROR);
  ------------------
  |  |   43|      0|    _dwarf_error((dbg), error, (errval)); return(retval);
  ------------------
  524|       |    /* Macro above returns. cannot reach here. */
  525|      0|}
dwarf_finish:
  537|    225|{
  538|       |#ifdef LIBDWARF_MALLOC
  539|       |    _libdwarf_finish();
  540|       |#endif
  541|    225|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|    225|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|     23|#define DBG_IS_VALID 0xebfdebfd
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   33|    202|#define TRUE 1
  |  |  ------------------
  |  |                   ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |   36|     23|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 202, False: 23]
  |  |  |  Branch (159:7): [True: 202, False: 23]
  |  |  |  Branch (159:15): [True: 0, False: 23]
  |  |  ------------------
  ------------------
  542|    202|        _dwarf_free_static_errlist();
  543|    202|        return DW_DLV_OK;
  ------------------
  |  |  122|    202|#define DW_DLV_OK        0
  ------------------
  544|    202|    }
  545|     23|    if (dbg->de_obj_file) {
  ------------------
  |  Branch (545:9): [True: 23, 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|     23|        char otype  = *(char *)(dbg->de_obj_file->ai_object);
  550|       |
  551|     23|        switch(otype) {
  552|      0|        case 'E': /* libelf. Impossible for years now. */
  ------------------
  |  Branch (552:9): [True: 0, False: 23]
  ------------------
  553|      0|            break;
  554|     12|        case 'F':
  ------------------
  |  Branch (554:9): [True: 12, False: 11]
  ------------------
  555|       |            /* Non-libelf elf access */
  556|     22|        case 'M':
  ------------------
  |  Branch (556:9): [True: 10, False: 13]
  ------------------
  557|     23|        case 'P':
  ------------------
  |  Branch (557:9): [True: 1, False: 22]
  ------------------
  558|       |            /* These take care of data alloc/mmap
  559|       |                by object type. */
  560|     23|            dbg->de_obj_file->ai_methods->om_finish(dbg->de_obj_file);
  561|     23|        default:
  ------------------
  |  Branch (561:9): [True: 0, False: 23]
  ------------------
  562|       |            /*  Do nothing. A serious internal error */
  563|     23|            break;
  564|     23|        }
  565|     23|    }
  566|     23|    if (dbg->de_owns_fd) {
  ------------------
  |  Branch (566:9): [True: 0, False: 23]
  ------------------
  567|      0|        _dwarf_closer(dbg->de_fd);
  568|      0|        dbg->de_owns_fd = FALSE;
  ------------------
  |  |   36|      0|#define FALSE 0
  ------------------
  569|      0|    }
  570|     23|    free((void *)dbg->de_path);
  571|     23|    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|     23|    return dwarf_object_finish(dbg);
  582|     23|}
dwarf_generic_init.c:set_global_paths_init:
  132|     23|{
  133|     23|    int res = 0;
  134|       |
  135|     23|    res = dwarf_add_debuglink_global_path(dbg,
  136|     23|        "/usr/lib/debug",error);
  137|     23|    return res;
  138|     23|}

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

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

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

dwarf_decode_leb128:
  147|     76|{
  148|     76|    unsigned long  byte        = 0;
  149|     76|    Dwarf_Unsigned word_number = 0;
  150|     76|    Dwarf_Unsigned number      = 0;
  151|     76|    unsigned long  shift       = 0; /* at least 32 bits, even Win32 */
  152|       |    /*  The byte_length value will be a small non-negative integer. */
  153|     76|    unsigned int   byte_length       = 0;
  154|       |
  155|     76|    if (leb128 >=endptr) {
  ------------------
  |  Branch (155:9): [True: 0, False: 76]
  ------------------
  156|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  157|      0|    }
  158|       |    /*  The following unrolls-the-loop for the first two bytes and
  159|       |        unpacks into 32 bits to make this as fast as possible.
  160|       |        word_number is assumed big enough that the shift has a defined
  161|       |        result. */
  162|     76|    byte = *(unsigned char *)leb128;
  163|     76|    if ((byte & 0x80) == 0) {
  ------------------
  |  Branch (163:9): [True: 72, False: 4]
  ------------------
  164|     72|        if (leb128_length) {
  ------------------
  |  Branch (164:13): [True: 72, False: 0]
  ------------------
  165|     72|            *leb128_length = 1;
  166|     72|        }
  167|     72|        if (outval) {
  ------------------
  |  Branch (167:13): [True: 72, False: 0]
  ------------------
  168|     72|            *outval = byte;
  169|     72|        }
  170|     72|        return DW_DLV_OK;
  ------------------
  |  |  122|     72|#define DW_DLV_OK        0
  ------------------
  171|     72|    } else {
  172|      4|        unsigned long byte2        = 0;
  173|      4|        if ((leb128+1) >=endptr) {
  ------------------
  |  Branch (173:13): [True: 0, False: 4]
  ------------------
  174|      0|            return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  175|      0|        }
  176|      4|        byte2 =  *(unsigned char *)(leb128 + 1);
  177|      4|        if ((byte2 & 0x80) == 0) {
  ------------------
  |  Branch (177:13): [True: 3, False: 1]
  ------------------
  178|      3|            if (leb128_length) {
  ------------------
  |  Branch (178:17): [True: 3, False: 0]
  ------------------
  179|      3|                *leb128_length = 2;
  180|      3|            }
  181|      3|            word_number =  byte & 0x7f;
  182|      3|            word_number |= (byte2 & 0x7f) << 7;
  183|      3|            if (outval) {
  ------------------
  |  Branch (183:17): [True: 3, False: 0]
  ------------------
  184|      3|                *outval = word_number;
  185|      3|            }
  186|      3|            return DW_DLV_OK;
  ------------------
  |  |  122|      3|#define DW_DLV_OK        0
  ------------------
  187|      3|        }
  188|       |        /* Gets messy to hand-inline more byte checking. */
  189|      4|    }
  190|       |
  191|       |    /*  The rest handles long numbers. Because the 'number'
  192|       |        may be larger than the default int/unsigned,
  193|       |        we must cast the 'byte' before
  194|       |        the shift for the shift to have a defined result. */
  195|      1|    number = 0;
  196|      1|    shift = 0;
  197|      1|    byte_length = 1;
  198|      3|    for (;;) {
  199|      3|        unsigned int b = byte & 0x7f;
  200|      3|        if (shift >= (sizeof(number)*BITSPERBYTE)) {
  ------------------
  |  |   83|      3|#define BITSPERBYTE 8
  ------------------
  |  Branch (200:13): [True: 0, False: 3]
  ------------------
  201|       |            /*  Shift is large. Maybe corrupt value,
  202|       |                maybe some padding high-end byte zeroes
  203|       |                that we can ignore. */
  204|      0|            if (!b) {
  ------------------
  |  Branch (204:17): [True: 0, False: 0]
  ------------------
  205|      0|                if (byte_length >= BYTESLEBMAX) {
  ------------------
  |  |   82|      0|#define BYTESLEBMAX 24
  ------------------
  |  Branch (205:21): [True: 0, False: 0]
  ------------------
  206|       |                    /*  Erroneous input.  */
  207|      0|                    if (leb128_length) {
  ------------------
  |  Branch (207:25): [True: 0, False: 0]
  ------------------
  208|      0|                        *leb128_length = BYTESLEBMAX;
  ------------------
  |  |   82|      0|#define BYTESLEBMAX 24
  ------------------
  209|      0|                    }
  210|      0|                    return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  211|      0|                }
  212|      0|                ++leb128;
  213|       |                /*  shift cannot overflow as
  214|       |                    BYTESLEBMAX is not a large value */
  215|      0|                shift += 7;
  216|      0|                if (leb128 >=endptr ) {
  ------------------
  |  Branch (216:21): [True: 0, False: 0]
  ------------------
  217|      0|                    if (leb128 == endptr && !byte) {
  ------------------
  |  Branch (217:25): [True: 0, False: 0]
  |  Branch (217:45): [True: 0, False: 0]
  ------------------
  218|       |                        /* Meaning zero bits a padding byte */
  219|      0|                        if (leb128_length) {
  ------------------
  |  Branch (219:29): [True: 0, False: 0]
  ------------------
  220|      0|                            *leb128_length = byte_length;
  221|      0|                        }
  222|      0|                        if (outval) {
  ------------------
  |  Branch (222:29): [True: 0, False: 0]
  ------------------
  223|      0|                            *outval = number;
  224|      0|                        }
  225|      0|                        return DW_DLV_OK;
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
  226|      0|                    }
  227|      0|                    return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  228|      0|                }
  229|      0|                ++byte_length;
  230|      0|                byte = *(unsigned char *)leb128;
  231|      0|                continue;
  232|      0|            }
  233|       |            /*  Too big, corrupt data given the non-zero
  234|       |                byte content */
  235|      0|            return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  236|      0|        }
  237|      3|        number |= ((Dwarf_Unsigned)b << shift);
  238|      3|        if ((byte & 0x80) == 0) {
  ------------------
  |  Branch (238:13): [True: 1, False: 2]
  ------------------
  239|      1|            if (leb128_length) {
  ------------------
  |  Branch (239:17): [True: 1, False: 0]
  ------------------
  240|      1|                *leb128_length = byte_length;
  241|      1|            }
  242|      1|            if (outval) {
  ------------------
  |  Branch (242:17): [True: 1, False: 0]
  ------------------
  243|      1|                *outval = number;
  244|      1|            }
  245|      1|            return DW_DLV_OK;
  ------------------
  |  |  122|      1|#define DW_DLV_OK        0
  ------------------
  246|      1|        }
  247|      2|        shift += 7;
  248|      2|        byte_length++;
  249|      2|        if (byte_length > BYTESLEBMAX) {
  ------------------
  |  |   82|      2|#define BYTESLEBMAX 24
  ------------------
  |  Branch (249:13): [True: 0, False: 2]
  ------------------
  250|       |            /*  Erroneous input.  */
  251|      0|            if (leb128_length) {
  ------------------
  |  Branch (251:17): [True: 0, False: 0]
  ------------------
  252|      0|                *leb128_length = BYTESLEBMAX;
  ------------------
  |  |   82|      0|#define BYTESLEBMAX 24
  ------------------
  253|      0|            }
  254|      0|            break;
  255|      0|        }
  256|      2|        ++leb128;
  257|      2|        if (leb128 >= endptr) {
  ------------------
  |  Branch (257:13): [True: 0, False: 2]
  ------------------
  258|      0|            return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  259|      0|        }
  260|      2|        byte = *(unsigned char *)leb128;
  261|      2|    }
  262|      0|    return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  263|      1|}

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

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

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

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

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

_dwarf_dealloc_rnglists_context:
  720|     87|{
  721|     87|    Dwarf_Unsigned i = 0;
  722|     87|    Dwarf_Rnglists_Context * rngcon = 0;
  723|       |
  724|     87|    if (IS_INVALID_DBG(dbg)) {
  ------------------
  |  |  159|     87|    ((!(d) || ((d)->de_magic != DBG_IS_VALID))?TRUE:FALSE)
  |  |  ------------------
  |  |  |  |  596|     87|#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|     87|#define FALSE 0
  |  |  ------------------
  |  |  |  Branch (159:5): [True: 0, False: 87]
  |  |  |  Branch (159:7): [True: 0, False: 87]
  |  |  |  Branch (159:15): [True: 0, False: 87]
  |  |  ------------------
  ------------------
  725|      0|        return;
  726|      0|    }
  727|     87|    if (!dbg->de_rnglists_context) {
  ------------------
  |  Branch (727:9): [True: 87, False: 0]
  ------------------
  728|     87|        return;
  729|     87|    }
  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|  18.1k|{
  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|  18.1k|    Dwarf_Unsigned computed = x * y;
  138|  18.1k|    Dwarf_Unsigned bigger = 0;
  139|       |
  140|  18.1k|    *result = computed;
  141|  18.1k|    if (!x || !y) {
  ------------------
  |  Branch (141:9): [True: 0, False: 18.1k]
  |  Branch (141:15): [True: 0, False: 18.1k]
  ------------------
  142|      0|        return DW_DLV_OK;
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
  143|      0|    }
  144|  18.1k|    bigger = (x > y)?x:y;
  ------------------
  |  Branch (144:14): [True: 17.1k, False: 1.00k]
  ------------------
  145|  18.1k|    if (computed < bigger)  {
  ------------------
  |  Branch (145:9): [True: 0, False: 18.1k]
  ------------------
  146|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  147|      0|    }
  148|  18.1k|    return DW_DLV_OK;
  ------------------
  |  |  122|  18.1k|#define DW_DLV_OK        0
  ------------------
  149|  18.1k|}
_dwarf_uint64_add:
  158|  29.4k|{
  159|  29.4k|    Dwarf_Unsigned computed = dw_lhs + dw_rhs;
  160|  29.4k|    Dwarf_Unsigned bigger = 0;
  161|       |
  162|  29.4k|    if (!dw_lhs || !dw_rhs) {
  ------------------
  |  Branch (162:9): [True: 13.7k, False: 15.6k]
  |  Branch (162:20): [True: 2.06k, False: 13.6k]
  ------------------
  163|  15.8k|        *result = computed;
  164|  15.8k|        return DW_DLV_OK;
  ------------------
  |  |  122|  15.8k|#define DW_DLV_OK        0
  ------------------
  165|  15.8k|    }
  166|  13.6k|    bigger = (dw_lhs > dw_rhs)?dw_lhs:dw_rhs;
  ------------------
  |  Branch (166:14): [True: 7.04k, False: 6.58k]
  ------------------
  167|  13.6k|    if (computed && computed < bigger)  {
  ------------------
  |  Branch (167:9): [True: 13.6k, False: 0]
  |  Branch (167:21): [True: 0, False: 13.6k]
  ------------------
  168|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
  169|      0|    }
  170|  13.6k|    *result = computed;
  171|  13.6k|    return DW_DLV_OK;
  ------------------
  |  |  122|  13.6k|#define DW_DLV_OK        0
  ------------------
  172|  13.6k|}

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

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

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

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

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

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

_dwarf_create_area_len_error:
  341|      2|{
  342|      2|    dwarfstring m;
  343|       |
  344|      2|    dwarfstring_constructor(&m);
  345|      2|    dwarfstring_append_printf_u(&m,
  346|      2|        "DW_DLE_HEADER_LEN_BIGGER_THAN_SECSIZE: "
  347|      2|        " The header length of 0x%x is larger",
  348|      2|        targ);
  349|      2|    dwarfstring_append_printf_u(&m," than the "
  350|      2|        "section length of 0x%x.",sectionlen);
  351|      2|    _dwarf_error_string(dbg,
  352|      2|        error,DW_DLE_HEADER_LEN_BIGGER_THAN_SECSIZE,
  ------------------
  |  | 1388|      2|#define DW_DLE_HEADER_LEN_BIGGER_THAN_SECSIZE  342
  ------------------
  353|      2|        dwarfstring_string(&m));
  354|      2|    dwarfstring_destructor(&m);
  355|      2|}
_dwarf_check_string_valid:
 1145|      6|{
 1146|      6|    Dwarf_Small *start = areaptr;
 1147|      6|    Dwarf_Small *p = strptr;
 1148|      6|    Dwarf_Small *end = areaendptr;
 1149|       |
 1150|      6|    if (p < start) {
  ------------------
  |  Branch (1150:9): [True: 0, False: 6]
  ------------------
 1151|      0|        _dwarf_error(dbg,error,suggested_error);
 1152|      0|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1153|      0|    }
 1154|      6|    if (p >= end) {
  ------------------
  |  Branch (1154:9): [True: 6, False: 0]
  ------------------
 1155|      6|        _dwarf_error(dbg,error,suggested_error);
 1156|      6|        return DW_DLV_ERROR;
  ------------------
  |  |  123|      6|#define DW_DLV_ERROR     1
  ------------------
 1157|      6|    }
 1158|      0|    if (dbg->de_assume_string_in_bounds) {
  ------------------
  |  Branch (1158:9): [True: 0, False: 0]
  ------------------
 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|      0|    while (p < end) {
  ------------------
  |  Branch (1163:12): [True: 0, False: 0]
  ------------------
 1164|      0|        if (*p == 0) {
  ------------------
  |  Branch (1164:13): [True: 0, False: 0]
  ------------------
 1165|      0|            return DW_DLV_OK;
  ------------------
  |  |  122|      0|#define DW_DLV_OK        0
  ------------------
 1166|      0|        }
 1167|      0|        ++p;
 1168|      0|    }
 1169|      0|    _dwarf_error(dbg,error,DW_DLE_STRING_NOT_TERMINATED);
  ------------------
  |  | 1349|      0|#define DW_DLE_STRING_NOT_TERMINATED           303
  ------------------
 1170|      0|    return DW_DLV_ERROR;
  ------------------
  |  |  123|      0|#define DW_DLV_ERROR     1
  ------------------
 1171|      0|}

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

