X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fdwarf2read.c;h=9aa33bfec8f67265282ba668cacdccf0a70a80ed;hb=6eee24ce30f8e95335c2ad8586f9a64398eb2cd4;hp=7004299a914665f1f2e9c39e235a80f3f1a3c44f;hpb=4dd1b46077b2ae7331f274f7888733de5166445c;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 7004299a91..9aa33bfec8 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -1,6 +1,6 @@ /* DWARF 2 debugging format support for GDB. - Copyright (C) 1994-2018 Free Software Foundation, Inc. + Copyright (C) 1994-2019 Free Software Foundation, Inc. Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology, Inc. with support from Florida State University (under contract @@ -536,28 +536,30 @@ struct dwarf2_cu std::vector rust_unions; /* Mark used when releasing cached dies. */ - unsigned int mark : 1; + bool mark : 1; /* This CU references .debug_loc. See the symtab->locations_valid field. This test is imperfect as there may exist optimized debug code not using any location list and still facing inlining issues if handled as unoptimized code. For a future better test see GCC PR other/32998. */ - unsigned int has_loclist : 1; + bool has_loclist : 1; - /* These cache the results for producer_is_* fields. CHECKED_PRODUCER is set + /* These cache the results for producer_is_* fields. CHECKED_PRODUCER is true if all the producer_is_* fields are valid. This information is cached because profiling CU expansion showed excessive time spent in producer_is_gxx_lt_4_6. */ - unsigned int checked_producer : 1; - unsigned int producer_is_gxx_lt_4_6 : 1; - unsigned int producer_is_gcc_lt_4_3 : 1; - unsigned int producer_is_icc_lt_14 : 1; - - /* When set, the file that we're processing is known to have + bool checked_producer : 1; + bool producer_is_gxx_lt_4_6 : 1; + bool producer_is_gcc_lt_4_3 : 1; + bool producer_is_icc : 1; + bool producer_is_icc_lt_14 : 1; + bool producer_is_codewarrior : 1; + + /* When true, the file that we're processing is known to have debugging info for C++ namespaces. GCC 3.3.x did not produce this information, but later versions do. */ - unsigned int processing_has_namespace_info : 1; + bool processing_has_namespace_info : 1; struct partial_die_info *find_partial_die (sect_offset sect_off); }; @@ -5497,7 +5499,6 @@ read_debug_names_from_section (struct objfile *objfile, const gdb_byte *abbrev_table_start = addr; for (;;) { - unsigned int bytes_read; const ULONGEST index_num = read_unsigned_leb128 (abfd, addr, &bytes_read); addr += bytes_read; if (index_num == 0) @@ -6188,7 +6189,13 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner) dwarf2_read_section (obj, section); - return {section->buffer, section->size}; + /* dwarf2_section_info::size is a bfd_size_type, while + gdb::array_view works with size_t. On 32-bit hosts, with + --enable-64-bit-bfd, bfd_size_type is a 64-bit type, while size_t + is 32-bit. So we need an explicit narrowing conversion here. + This is fine, because it's impossible to allocate or mmap an + array/buffer larger than what size_t can represent. */ + return gdb::make_array_view (section->buffer, section->size); } /* Lookup the index cache for the contents of the index associated to @@ -6292,9 +6299,7 @@ dwarf2_build_psymtabs (struct objfile *objfile) struct dwarf2_per_objfile *dwarf2_per_objfile = get_dwarf2_per_objfile (objfile); - if (objfile->global_psymbols.capacity () == 0 - && objfile->static_psymbols.capacity () == 0) - init_psymbol_list (objfile, 1024); + init_psymbol_list (objfile, 1024); TRY { @@ -6585,13 +6590,7 @@ dwarf2_create_include_psymtab (const char *name, struct partial_symtab *pst, subpst->dependencies[0] = pst; subpst->number_of_dependencies = 1; - subpst->globals_offset = 0; - subpst->n_global_syms = 0; - subpst->statics_offset = 0; - subpst->n_static_syms = 0; - subpst->compunit_symtab = NULL; subpst->read_symtab = pst->read_symtab; - subpst->readin = 0; /* No private part is necessary for include psymtabs. This property can be used to differentiate between such include psymtabs and @@ -7928,9 +7927,7 @@ create_partial_symtab (struct dwarf2_per_cu_data *per_cu, const char *name) struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile; struct partial_symtab *pst; - pst = start_psymtab_common (objfile, name, 0, - objfile->global_psymbols, - objfile->static_psymbols); + pst = start_psymtab_common (objfile, name, 0); pst->psymtabs_addrmap_supported = 1; @@ -8079,18 +8076,14 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader, dwarf2_build_include_psymtabs (cu, comp_unit_die, pst); if (dwarf_read_debug) - { - struct gdbarch *gdbarch = get_objfile_arch (objfile); - - fprintf_unfiltered (gdb_stdlog, - "Psymtab for %s unit @%s: %s - %s" - ", %d global, %d static syms\n", - per_cu->is_debug_types ? "type" : "comp", - sect_offset_str (per_cu->sect_off), - paddress (gdbarch, pst->text_low (objfile)), - paddress (gdbarch, pst->text_high (objfile)), - pst->n_global_syms, pst->n_static_syms); - } + fprintf_unfiltered (gdb_stdlog, + "Psymtab for %s unit @%s: %s - %s" + ", %d global, %d static syms\n", + per_cu->is_debug_types ? "type" : "comp", + sect_offset_str (per_cu->sect_off), + paddress (gdbarch, pst->text_low (objfile)), + paddress (gdbarch, pst->text_high (objfile)), + pst->n_global_syms, pst->n_static_syms); } /* Subroutine of dwarf2_build_psymtabs_hard to simplify it. @@ -8893,7 +8886,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) built_actual_name != NULL, VAR_DOMAIN, LOC_BLOCK, SECT_OFF_TEXT (objfile), - &objfile->global_psymbols, + psymbol_placement::GLOBAL, addr, cu->language, objfile); } @@ -8903,7 +8896,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) built_actual_name != NULL, VAR_DOMAIN, LOC_BLOCK, SECT_OFF_TEXT (objfile), - &objfile->static_psymbols, + psymbol_placement::STATIC, addr, cu->language, objfile); } @@ -8911,17 +8904,12 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) set_objfile_main_name (objfile, actual_name, cu->language); break; case DW_TAG_constant: - { - std::vector *list; - - if (pdi->is_external) - list = &objfile->global_psymbols; - else - list = &objfile->static_psymbols; - add_psymbol_to_list (actual_name, strlen (actual_name), - built_actual_name != NULL, VAR_DOMAIN, LOC_STATIC, - -1, list, 0, cu->language, objfile); - } + add_psymbol_to_list (actual_name, strlen (actual_name), + built_actual_name != NULL, VAR_DOMAIN, LOC_STATIC, + -1, (pdi->is_external + ? psymbol_placement::GLOBAL + : psymbol_placement::STATIC), + 0, cu->language, objfile); break; case DW_TAG_variable: if (pdi->d.locdesc) @@ -8956,7 +8944,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) built_actual_name != NULL, VAR_DOMAIN, LOC_STATIC, SECT_OFF_TEXT (objfile), - &objfile->global_psymbols, + psymbol_placement::GLOBAL, addr, cu->language, objfile); } else @@ -8975,7 +8963,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) built_actual_name != NULL, VAR_DOMAIN, LOC_STATIC, SECT_OFF_TEXT (objfile), - &objfile->static_psymbols, + psymbol_placement::STATIC, has_loc ? addr : 0, cu->language, objfile); } @@ -8986,7 +8974,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) add_psymbol_to_list (actual_name, strlen (actual_name), built_actual_name != NULL, VAR_DOMAIN, LOC_TYPEDEF, -1, - &objfile->static_psymbols, + psymbol_placement::STATIC, 0, cu->language, objfile); break; case DW_TAG_imported_declaration: @@ -8994,14 +8982,14 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) add_psymbol_to_list (actual_name, strlen (actual_name), built_actual_name != NULL, VAR_DOMAIN, LOC_TYPEDEF, -1, - &objfile->global_psymbols, + psymbol_placement::GLOBAL, 0, cu->language, objfile); break; case DW_TAG_module: add_psymbol_to_list (actual_name, strlen (actual_name), built_actual_name != NULL, MODULE_DOMAIN, LOC_TYPEDEF, -1, - &objfile->global_psymbols, + psymbol_placement::GLOBAL, 0, cu->language, objfile); break; case DW_TAG_class_type: @@ -9026,8 +9014,8 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) built_actual_name != NULL, STRUCT_DOMAIN, LOC_TYPEDEF, -1, cu->language == language_cplus - ? &objfile->global_psymbols - : &objfile->static_psymbols, + ? psymbol_placement::GLOBAL + : psymbol_placement::STATIC, 0, cu->language, objfile); break; @@ -9036,8 +9024,8 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) built_actual_name != NULL, VAR_DOMAIN, LOC_CONST, -1, cu->language == language_cplus - ? &objfile->global_psymbols - : &objfile->static_psymbols, + ? psymbol_placement::GLOBAL + : psymbol_placement::STATIC, 0, cu->language, objfile); break; default: @@ -9112,18 +9100,21 @@ add_partial_subprogram (struct partial_die_info *pdi, struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile; struct gdbarch *gdbarch = get_objfile_arch (objfile); CORE_ADDR baseaddr; - CORE_ADDR highpc; - CORE_ADDR lowpc; + CORE_ADDR this_highpc; + CORE_ADDR this_lowpc; baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); - lowpc = (gdbarch_adjust_dwarf2_addr (gdbarch, - pdi->lowpc + baseaddr) - - baseaddr); - highpc = (gdbarch_adjust_dwarf2_addr (gdbarch, - pdi->highpc + baseaddr) - - baseaddr); - addrmap_set_empty (objfile->psymtabs_addrmap, lowpc, highpc - 1, + this_lowpc + = (gdbarch_adjust_dwarf2_addr (gdbarch, + pdi->lowpc + baseaddr) + - baseaddr); + this_highpc + = (gdbarch_adjust_dwarf2_addr (gdbarch, + pdi->highpc + baseaddr) + - baseaddr); + addrmap_set_empty (objfile->psymtabs_addrmap, + this_lowpc, this_highpc - 1, cu->per_cu->v.psymtab); } } @@ -10211,7 +10202,7 @@ get_compunit_symtab (struct dwarf2_per_cu_data *per_cu) included by PER_CU. */ static void -recursively_compute_inclusions (VEC (compunit_symtab_ptr) **result, +recursively_compute_inclusions (std::vector *result, htab_t all_children, htab_t all_type_symtabs, struct dwarf2_per_cu_data *per_cu, struct compunit_symtab *immediate_parent) @@ -10241,14 +10232,14 @@ recursively_compute_inclusions (VEC (compunit_symtab_ptr) **result, if (*slot == NULL) { *slot = cust; - VEC_safe_push (compunit_symtab_ptr, *result, cust); + result->push_back (cust); if (cust->user == NULL) cust->user = immediate_parent; } } else { - VEC_safe_push (compunit_symtab_ptr, *result, cust); + result->push_back (cust); if (cust->user == NULL) cust->user = immediate_parent; } @@ -10275,8 +10266,7 @@ compute_compunit_symtab_includes (struct dwarf2_per_cu_data *per_cu) { int ix, len; struct dwarf2_per_cu_data *per_cu_iter; - struct compunit_symtab *compunit_symtab_iter; - VEC (compunit_symtab_ptr) *result_symtabs = NULL; + std::vector result_symtabs; htab_t all_children, all_type_symtabs; struct compunit_symtab *cust = get_compunit_symtab (per_cu); @@ -10300,18 +10290,14 @@ compute_compunit_symtab_includes (struct dwarf2_per_cu_data *per_cu) } /* Now we have a transitive closure of all the included symtabs. */ - len = VEC_length (compunit_symtab_ptr, result_symtabs); + len = result_symtabs.size (); cust->includes = XOBNEWVEC (&per_cu->dwarf2_per_objfile->objfile->objfile_obstack, struct compunit_symtab *, len + 1); - for (ix = 0; - VEC_iterate (compunit_symtab_ptr, result_symtabs, ix, - compunit_symtab_iter); - ++ix) - cust->includes[ix] = compunit_symtab_iter; + memcpy (cust->includes, result_symtabs.data (), + len * sizeof (compunit_symtab *)); cust->includes[len] = NULL; - VEC_free (compunit_symtab_ptr, result_symtabs); htab_delete (all_children); htab_delete (all_type_symtabs); } @@ -10647,21 +10633,21 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) case DW_TAG_common_inclusion: break; case DW_TAG_namespace: - cu->processing_has_namespace_info = 1; + cu->processing_has_namespace_info = true; read_namespace (die, cu); break; case DW_TAG_module: - cu->processing_has_namespace_info = 1; + cu->processing_has_namespace_info = true; read_module (die, cu); break; case DW_TAG_imported_declaration: - cu->processing_has_namespace_info = 1; + cu->processing_has_namespace_info = true; if (read_namespace_alias (die, cu)) break; /* The declaration is not a global namespace alias. */ /* Fall through. */ case DW_TAG_imported_module: - cu->processing_has_namespace_info = 1; + cu->processing_has_namespace_info = true; if (die->child != NULL && (die->tag == DW_TAG_imported_declaration || cu->language != language_fortran)) complaint (_("Tag '%s' has unexpected children"), @@ -11360,7 +11346,7 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) types, but gives them a size of zero. Starting with version 14, ICC is compatible with GCC. */ -static int +static bool producer_is_icc_lt_14 (struct dwarf2_cu *cu) { if (!cu->checked_producer) @@ -11369,11 +11355,24 @@ producer_is_icc_lt_14 (struct dwarf2_cu *cu) return cu->producer_is_icc_lt_14; } +/* ICC generates a DW_AT_type for C void functions. This was observed on + ICC 14.0.5.212, and appears to be against the DWARF spec (V5 3.3.2) + which says that void functions should not have a DW_AT_type. */ + +static bool +producer_is_icc (struct dwarf2_cu *cu) +{ + if (!cu->checked_producer) + check_producer (cu); + + return cu->producer_is_icc; +} + /* Check for possibly missing DW_AT_comp_dir with relative .debug_line directory paths. GCC SVN r127613 (new option -fdebug-prefix-map) fixed this, it was first present in GCC release 4.3.0. */ -static int +static bool producer_is_gcc_lt_4_3 (struct dwarf2_cu *cu) { if (!cu->checked_producer) @@ -12197,6 +12196,7 @@ create_dwp_hash_table (struct dwarf2_per_objfile *dwarf2_per_objfile, { const gdb_byte *ids_ptr = htab->unit_table + sizeof (uint32_t) * nr_slots; int *ids = htab->section_pool.v2.section_ids; + size_t sizeof_ids = sizeof (htab->section_pool.v2.section_ids); /* Reverse map for error checking. */ int ids_seen[DW_SECT_MAX + 1]; int i; @@ -12213,8 +12213,8 @@ create_dwp_hash_table (struct dwarf2_per_objfile *dwarf2_per_objfile, " in section table [in module %s]"), dwp_file->name); } - memset (ids, 255, (DW_SECT_MAX + 1) * sizeof (int32_t)); - memset (ids_seen, 255, (DW_SECT_MAX + 1) * sizeof (int32_t)); + memset (ids, 255, sizeof_ids); + memset (ids_seen, 255, sizeof (ids_seen)); for (i = 0; i < nr_columns; ++i) { int id = read_4_bytes (dbfd, ids_ptr + i * sizeof (uint32_t)); @@ -13835,7 +13835,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) though they don't appear in this symtab directly, other parts of gdb assume that symbols do, and this is reasonably true. */ - for (struct symbol *sym : template_args) + for (symbol *sym : template_args) symbol_set_symtab (sym, symbol_symtab (templ_func)); } @@ -14902,21 +14902,26 @@ check_producer (struct dwarf2_cu *cu) cu->producer_is_gcc_lt_4_3 = major < 4 || (major == 4 && minor < 3); } else if (producer_is_icc (cu->producer, &major, &minor)) - cu->producer_is_icc_lt_14 = major < 14; + { + cu->producer_is_icc = true; + cu->producer_is_icc_lt_14 = major < 14; + } + else if (startswith (cu->producer, "CodeWarrior S12/L-ISA")) + cu->producer_is_codewarrior = true; else { /* For other non-GCC compilers, expect their behavior is DWARF version compliant. */ } - cu->checked_producer = 1; + cu->checked_producer = true; } /* Check for GCC PR debug/45124 fix which is not present in any G++ version up to 4.5.any while it is present already in G++ 4.6.0 - the PR has been fixed during 4.6.0 experimental. */ -static int +static bool producer_is_gxx_lt_4_6 (struct dwarf2_cu *cu) { if (!cu->checked_producer) @@ -14925,6 +14930,19 @@ producer_is_gxx_lt_4_6 (struct dwarf2_cu *cu) return cu->producer_is_gxx_lt_4_6; } + +/* Codewarrior (at least as of version 5.0.40) generates dwarf line information + with incorrect is_stmt attributes. */ + +static bool +producer_is_codewarrior (struct dwarf2_cu *cu) +{ + if (!cu->checked_producer) + check_producer (cu); + + return cu->producer_is_codewarrior; +} + /* Return the default accessibility type if it is not overriden by DW_AT_accessibility. */ @@ -17484,6 +17502,26 @@ dwarf2_init_float_type (struct objfile *objfile, int bits, const char *name, return type; } +/* Allocate an integer type of size BITS and name NAME. */ + +static struct type * +dwarf2_init_integer_type (struct dwarf2_cu *cu, struct objfile *objfile, + int bits, int unsigned_p, const char *name) +{ + struct type *type; + + /* Versions of Intel's C Compiler generate an integer type called "void" + instead of using DW_TAG_unspecified_type. This has been seen on + at least versions 14, 17, and 18. */ + if (bits == 0 && producer_is_icc (cu) && name != nullptr + && strcmp (name, "void") == 0) + type = objfile_type (objfile)->builtin_void; + else + type = init_integer_type (objfile, bits, unsigned_p, name); + + return type; +} + /* Find a representation of a given base type and install it in the TYPE field of the die. */ @@ -17533,7 +17571,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) type = dwarf2_init_float_type (objfile, bits, name, name); break; case DW_ATE_signed: - type = init_integer_type (objfile, bits, 0, name); + type = dwarf2_init_integer_type (cu, objfile, bits, 0, name); break; case DW_ATE_unsigned: if (cu->language == language_fortran @@ -17541,7 +17579,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) && startswith (name, "character(")) type = init_character_type (objfile, bits, 1, name); else - type = init_integer_type (objfile, bits, 1, name); + type = dwarf2_init_integer_type (cu, objfile, bits, 1, name); break; case DW_ATE_signed_char: if (cu->language == language_ada || cu->language == language_m2 @@ -17549,7 +17587,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) || cu->language == language_fortran) type = init_character_type (objfile, bits, 0, name); else - type = init_integer_type (objfile, bits, 0, name); + type = dwarf2_init_integer_type (cu, objfile, bits, 0, name); break; case DW_ATE_unsigned_char: if (cu->language == language_ada || cu->language == language_m2 @@ -17558,7 +17596,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) || cu->language == language_rust) type = init_character_type (objfile, bits, 1, name); else - type = init_integer_type (objfile, bits, 1, name); + type = dwarf2_init_integer_type (cu, objfile, bits, 1, name); break; case DW_ATE_UTF: { @@ -17572,7 +17610,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) { complaint (_("unsupported DW_ATE_UTF bit size: '%d'"), bits); - type = init_integer_type (objfile, bits, 1, name); + type = dwarf2_init_integer_type (cu, objfile, bits, 1, name); } return set_die_type (die, type, cu); } @@ -18395,7 +18433,7 @@ load_partial_dies (const struct die_reader_specs *reader, if (building_psymtab && pdi.name != NULL) add_psymbol_to_list (pdi.name, strlen (pdi.name), 0, VAR_DOMAIN, LOC_TYPEDEF, -1, - &objfile->static_psymbols, + psymbol_placement::STATIC, 0, cu->language, objfile); info_ptr = locate_pdi_sibling (reader, &pdi, info_ptr); continue; @@ -18430,8 +18468,8 @@ load_partial_dies (const struct die_reader_specs *reader, add_psymbol_to_list (pdi.name, strlen (pdi.name), 0, VAR_DOMAIN, LOC_CONST, -1, cu->language == language_cplus - ? &objfile->global_psymbols - : &objfile->static_psymbols, + ? psymbol_placement::GLOBAL + : psymbol_placement::STATIC, 0, cu->language, objfile); info_ptr = locate_pdi_sibling (reader, &pdi, info_ptr); @@ -20339,21 +20377,21 @@ dwarf_decode_line_header (sect_offset sect_off, struct dwarf2_cu *cu) /* Read directory table. */ read_formatted_entries (dwarf2_per_objfile, abfd, &line_ptr, lh.get (), &cu->header, - [] (struct line_header *lh, const char *name, + [] (struct line_header *header, const char *name, dir_index d_index, unsigned int mod_time, unsigned int length) { - lh->add_include_dir (name); + header->add_include_dir (name); }); /* Read file name table. */ read_formatted_entries (dwarf2_per_objfile, abfd, &line_ptr, lh.get (), &cu->header, - [] (struct line_header *lh, const char *name, + [] (struct line_header *header, const char *name, dir_index d_index, unsigned int mod_time, unsigned int length) { - lh->add_file_name (name, d_index, mod_time, length); + header->add_file_name (name, d_index, mod_time, length); }); } else @@ -20789,7 +20827,7 @@ lnp_state_machine::record_line (bool end_sequence) else if (m_op_index == 0 || end_sequence) { fe->included_p = 1; - if (m_record_lines_p && m_is_stmt) + if (m_record_lines_p && (producer_is_codewarrior (m_cu) || m_is_stmt)) { if (m_last_subfile != m_cu->builder->get_current_subfile () || end_sequence) @@ -21218,7 +21256,7 @@ dwarf2_start_symtab (struct dwarf2_cu *cu, cu->builder->record_debugformat ("DWARF 2"); cu->builder->record_producer (cu->producer); - cu->processing_has_namespace_info = 0; + cu->processing_has_namespace_info = false; return cu->builder->get_compunit_symtab (); } @@ -21285,7 +21323,7 @@ var_decode_location (struct attribute *attr, struct symbol *sym, dwarf2_symbol_mark_computed (attr, sym, cu, 0); if (SYMBOL_COMPUTED_OPS (sym)->location_has_loclist) - cu->has_loclist = 1; + cu->has_loclist = true; } /* Given a pointer to a DWARF information entry, figure out if we need @@ -25067,7 +25105,6 @@ dwarf2_find_containing_comp_unit (sect_offset sect_off, { struct dwarf2_per_cu_data *this_cu; int low, high; - const sect_offset *cu_off; low = 0; high = dwarf2_per_objfile->all_comp_units.size () - 1; @@ -25077,17 +25114,16 @@ dwarf2_find_containing_comp_unit (sect_offset sect_off, int mid = low + (high - low) / 2; mid_cu = dwarf2_per_objfile->all_comp_units[mid]; - cu_off = &mid_cu->sect_off; if (mid_cu->is_dwz > offset_in_dwz - || (mid_cu->is_dwz == offset_in_dwz && *cu_off >= sect_off)) + || (mid_cu->is_dwz == offset_in_dwz + && mid_cu->sect_off + mid_cu->length >= sect_off)) high = mid; else low = mid + 1; } gdb_assert (low == high); this_cu = dwarf2_per_objfile->all_comp_units[low]; - cu_off = &this_cu->sect_off; - if (this_cu->is_dwz != offset_in_dwz || *cu_off > sect_off) + if (this_cu->is_dwz != offset_in_dwz || this_cu->sect_off > sect_off) { if (low == 0 || this_cu->is_dwz != offset_in_dwz) error (_("Dwarf Error: could not find partial DIE containing " @@ -25114,13 +25150,15 @@ dwarf2_find_containing_comp_unit (sect_offset sect_off, dwarf2_cu::dwarf2_cu (struct dwarf2_per_cu_data *per_cu_) : per_cu (per_cu_), - mark (0), - has_loclist (0), - checked_producer (0), - producer_is_gxx_lt_4_6 (0), - producer_is_gcc_lt_4_3 (0), - producer_is_icc_lt_14 (0), - processing_has_namespace_info (0) + mark (false), + has_loclist (false), + checked_producer (false), + producer_is_gxx_lt_4_6 (false), + producer_is_gcc_lt_4_3 (false), + producer_is_icc (false), + producer_is_icc_lt_14 (false), + producer_is_codewarrior (false), + processing_has_namespace_info (false) { per_cu->cu = this; } @@ -25453,7 +25491,7 @@ dwarf2_mark_helper (void **slot, void *data) if (per_cu->cu->mark) return 1; - per_cu->cu->mark = 1; + per_cu->cu->mark = true; if (per_cu->cu->dependencies != NULL) htab_traverse (per_cu->cu->dependencies, dwarf2_mark_helper, NULL); @@ -25469,7 +25507,7 @@ dwarf2_mark (struct dwarf2_cu *cu) { if (cu->mark) return; - cu->mark = 1; + cu->mark = true; if (cu->dependencies != NULL) htab_traverse (cu->dependencies, dwarf2_mark_helper, NULL); } @@ -25479,7 +25517,7 @@ dwarf2_clear_marks (struct dwarf2_per_cu_data *per_cu) { while (per_cu) { - per_cu->cu->mark = 0; + per_cu->cu->mark = false; per_cu = per_cu->cu->read_in_chain; } }