From: Roland McGrath Date: Sat, 1 Aug 2009 23:14:35 +0000 (-0700) Subject: Merge commit 'elfutils-0.142' into dwarf X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=649731d033695427d73b3dc80b021514ccdc06b9;p=thirdparty%2Felfutils.git Merge commit 'elfutils-0.142' into dwarf Conflicts: libdw/ChangeLog libdw/Makefile.am src/ChangeLog tests/ChangeLog tests/Makefile.am --- 649731d033695427d73b3dc80b021514ccdc06b9 diff --cc libdw/ChangeLog index deb3817b6,76663eebf..c56381183 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@@ -1,148 -1,112 +1,255 @@@ +2009-07-08 Roland McGrath + + * c++/dwarf-knowledge.cc (expected_value_space): + DW_AT_data_member_location can be constant or location. + * c++/values.cc (what_space): Treat only data[48] as *ptr when those + are expected. No other data forms can be *ptr. + + * c++/output-shape.cc: New file. + * Makefile.am (libdwpp_a_SOURCES): Add it. + * c++/dwarf_output: Call add_shape method there. + +2009-07-06 Roland McGrath + + * c++/dwarf_tracker (tracker): Break out private class into ... + (dwarf_path_finder): ... here. + +2009-07-03 Roland McGrath + + * c++/dwarf: Give line info stubby to_string methods. + * c++/dwarf_data: Likewise. + * c++/edit-values.cc: Likewise. + + * c++/dwarf: Fix location_attr iterators. + * c++/values.cc: Likewise. + + * Makefile.am (AM_CXXFLAGS): New variable (from ../src/Makefile.am). + + * c++/dwarf: Fix range_list canonicalizing comparisons. + + * c++/dwarf_edit: Fix copy construction using a ref-maker. + * c++/dwarf_data: Updates. + * c++/subr.hh: Updates. + * c++/dwarf_ref_maker: New file. + * Makefile.am (pkginclude_HEADERS): Add it. + +2009-07-02 Roland McGrath + + * c++/dwarf: Get rid of VS::unit_reference. + * c++/dwarf-knowledge.cc: Likewise. + * c++/dwarf_comparator: Likewise. + * c++/dwarf_data: Likewise. + * libdw/c++/values.cc: Likewise. + * c++/data-values.hh: Likewise. + + * c++/dwarf_output: Rewrite. + * c++/subr.hh: New helpers for dwarf_output/dwarf_data. + + * c++/dwarf_edit: Much guts moved to ... + * c++/dwarf_data: ... here, new file. + * c++/known.cc: Update specializations. + + * libdw/c++/edit-values.cc (what_space): Moved to ... + * c++/data-values.hh: ... here, new file. + + * Makefile.am (noinst_HEADERS): Add it. + + * c++/output-values.cc: New file. + * Makefile.am (libdwpp_a_SOURCES): Add it. + Makefile.am (pkginclude_HEADERS): Add dwarf_data, dwarf_output. + + * c++/dwarf: Use to_string function overload, not to_string method. + * c++/values.cc: Define to_string specializations. + +2009-07-01 Roland McGrath + + * c++/dwarf_tracker: Major revamp for efficiency and to handle + circular reference chains. + * c++/dwarf_comparator: Tracker interface changes. + +2009-06-19 Roland McGrath + + * c++/dwarf_comparator: New file. + * c++/dwarf_tracker: New file. + * Makefile.am (pkginclude_HEADERS): Add them. + + * c++/dwarf_edit: Miscellaneous fixes. + Support dwarf_enum, to_string for attributes. + * c++/known.cc: Support dwarf_edit::dwarf_enum. + * c++/edit-values.cc: Support to_string for attributes. + * c++/values.cc: Rejiggered accordingly. + + * c++/dwarf-knowledge.cc (expected_value_space): Expect unit_reference + only for DW_TAG_imported_unit. + + * c++/dwarf: Miscellaneous fixes. + +2009-04-02 Roland McGrath + + * Makefile.am (noinst_HEADERS): Add known-dwarf.h and + c++/dwarf-knowledge.cc here. + +2009-03-29 Roland McGrath + + * c++/exception.cc: New file. + * Makefile.am (libdwpp_a_SOURCES): Add it. + +2009-03-25 Roland McGrath + + * c++/dwarf, c++/values.cc: Proper dwarf_constant support. + * c++/dwarf_edit, c++/edit-values.cc: Likewise. + * c++/known.cc: New file. + * Makefile.am (libdwpp_a_SOURCES): Add it. + +2009-03-24 Petr Machata + + * c++/dwarf (dwarf::debug_info_entry::raw_attributes): + Fix iteration over attributes. + +2009-03-24 Roland McGrath + + * Makefile.am (libdwpp_a_SOURCES): New variable. + (lib_LIBRARIES): Add libdwpp.a to it. + +2009-02-26 Roland McGrath + + * c++/dwarf (dwarf::attr_value): Add _m_tag private member. + (dwarf::attr_value, dwarf::attribute): Update initializers. + (dwarf::raw_attributes::const_iterator): Update caller. + * c++/values.cc (attr_value::what_space): Use it. + +2009-02-01 Roland McGrath + + * c++/edit-values.cc: New file. + +2009-01-28 Roland McGrath + + * c++/dwarf: Add line table support. + * c++/values.cc: New file. + * c++/line_info.cc: New file. + * c++/subr.hh: New file. + * Makefile.am (pkginclude_HEADERS): Add it. + +2009-01-26 Roland McGrath + + * c++/dwarf (dwarf_output): Renamed to dwarf_edit and moved to ... + * c++/dwarf_edit: ... here. New file. + * Makefile.am (pkginclude_HEADERS): Add it. + +2009-01-10 Roland McGrath + + * c++/dwarf: New file. + * Makefile.am (pkginclude_HEADERS): Add it. + + 2009-07-22 Roland McGrath + + * dwarf_frame_cfa.c: Change calling convention. + * libdw.h: Update decl. + + * dwarf_frame_register.c: Change calling/return-value convention for + value-only results and undefined/same_value. + * libdw.h: Update decl. + + * dwarf_getlocation.c (__libdw_intern_expression): Take new bool + argument, append DW_OP_stack_value if set. Don't take NOPS argument, + return that value instead. + (getlocation): Update caller. + * dwarf_frame_cfa.c: Likewise. + * libdwP.h: Update decl. + + 2009-07-21 Roland McGrath + + * dwarf_getsrc_file.c: Ignore a CU that just has no DW_AT_stmt_list. + Fix loop iteration after skipping a bogus or useless CU. + + * dwarf_entry_breakpoints.c: Handle 0 dwarf_errno () as harmless + absence, not DWARF_E_NO_DEBUG_LINE. + + 2009-07-20 Roland McGrath + + * dwarf_getlocation.c (__libdw_intern_expression): + Handle DW_OP_stack_value. + + 2009-07-16 Roland McGrath + + * dwarf_formudata.c (__libdw_formptr): Handle DW_FORM_sec_offset, + reject others when CU's version > 3. + + * dwarf_formflag.c: Handle DW_FORM_flag_present. + + * dwarf.h: Add DW_OP_{implicit,stack}_value from DWARF 4 draft. + Also DW_TAG_type_unit and DW_TAG_rvalue_reference_type. + Also DW_AT_signature, DW_AT_main_subprogram, DW_AT_data_bit_offset, + and DW_AT_const_expr. + Also DW_FORM_sec_offset, DW_FORM_exprloc, DW_FORM_flag_present, + and DW_FORM_ref_sig8. + + 2009-07-15 Roland McGrath + + * dwarf_getlocation.c: Grok DW_OP_form_tls_address, + DW_OP_GNU_push_tls_address, and DW_OP_bit_piece. + + 2009-07-13 Roland McGrath + + * dwarf_getlocation.c: Grok DW_OP_call_frame_cfa. + 2009-07-08 Roland McGrath + * libdw.map (ELFUTILS_0.142): Add dwfl_module_dwarf_cfi, + dwfl_module_eh_cfi. + + * libdwP.h (struct Dwarf): Add member `cfi'. + * dwarf_end.c (dwarf_end): Call __libdw_destroy_frame_cache on it. + * dwarf_getcfi.c: New file. + * dwarf_getcfi_elf.c: New file. + * dwarf_cfi_end.c: New file. + * dwarf_cfi_addrframe.c: New file. + * dwarf_frame_cfa.c: New file. + * dwarf_frame_register.c: New file. + * dwarf_frame_return_address_register.c: New file. + * Makefile.am (libdw_a_SOURCES): Add them. + * unwind.h: Declare those functions. + * libdw.map (ELFUTILS_0.142): Export them. + + * dwarf_getlocation.c (__libdw_intern_expression): New function, + broken out of ... + (getlocation): ... here, call it. + * libdwP.h: Declare it. + + * cie.c: New file. + * fde.c: New file. + * frame-cache.c: New file. + * cfi.c: New file. + * cfi.h: New file. + * encoded-value.h: New file. + * Makefile.am (libdw_a_SOURCES, noinst_HEADERS): Add them. + * libdwP.h: Add DWARF_E_INVALID_CFI to errors enum. + * dwarf_error.c (errmsgs): Add element for it. + + * dwarf_next_cfi.c: New file. + * Makefile.am (libdw_a_SOURCES): Add it. + * libdw.h (Dwarf_CIE, Dwarf_FDE, Dwarf_CIE_Entry): New types. + Declare dwarf_next_cfi. + * libdw.map (ELFUTILS_0.142): New set, inherits from ELFUTILS_0.136. + Add dwarf_next_cfi. + + * memory-access.h [! ALLOW_UNALIGNED] + (read_2ubyte_unaligned): Renamed to ... + (read_2ubyte_unaligned_1): ... this. Take bool rather than Dwarf *. + (read_2ubyte_unaligned): Define as macro passing dbg->other_byte_order. + (read_2sbyte_unaligned): Likewise. + (read_4ubyte_unaligned): Likewise. + (read_4sbyte_unaligned): Likewise. + (read_8ubyte_unaligned): Likewise. + (read_8sbyte_unaligned): Likewise. + + * libdwP.h (IDX_eh_frame): Remove it. + * dwarf_begin_elf.c (dwarf_scnnames): Remove its element. + + 2009-07-08 Roland McGrath + + * libdwP.h (struct Dwarf_Line_s): Reorder members to pack better. + * dwarf_getlocation.c (check_constant_offset): New function. (dwarf_getlocation, dwarf_getlocation_addr): Call it to handle DW_AT_data_member_location of data[48] as constant offset. diff --cc libdw/Makefile.am index baaa19054,4d041cf73..b7624f657 --- a/libdw/Makefile.am +++ b/libdw/Makefile.am @@@ -89,19 -83,13 +89,24 @@@ libdw_a_SOURCES = dwarf_begin.c dwarf_b dwarf_func_inline.c dwarf_getsrc_file.c \ libdw_findcu.c libdw_form.c libdw_alloc.c memory-access.c \ libdw_visit_scopes.c \ - dwarf_entry_breakpoints.c + dwarf_entry_breakpoints.c \ + dwarf_next_cfi.c \ + cie.c fde.c cfi.c frame-cache.c \ + dwarf_frame_info.c dwarf_frame_cfa.c dwarf_frame_register.c \ + dwarf_cfi_addrframe.c \ + dwarf_getcfi.c dwarf_getcfi_elf.c dwarf_cfi_end.c +# XXX need to figure out C++ dso crapola +lib_LIBRARIES += libdwpp.a +libdwpp_a_SOURCES = c++/values.cc \ + c++/exception.cc \ + c++/known.cc \ + c++/line_info.cc \ + c++/edit-values.cc \ + c++/output-values.cc c++/output-shape.cc +noinst_HEADERS = c++/dwarf-knowledge.cc \ + c++/data-values.hh + if MAINTAINER_MODE BUILT_SOURCES = $(srcdir)/known-dwarf.h MAINTAINERCLEANFILES = $(srcdir)/known-dwarf.h @@@ -151,7 -139,8 +156,9 @@@ endi libdw_a_LIBADD = $(addprefix ../libdwfl/,$(shell $(AR) t ../libdwfl/libdwfl.a)) - noinst_HEADERS += libdwP.h memory-access.h dwarf_abbrev_hash.h known-dwarf.h + noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h \ - cfi.h encoded-value.h ++ cfi.h encoded-value.h \ ++ known-dwarf.h EXTRA_DIST = libdw.map diff --cc src/ChangeLog index 58198a8b0,7e0b25b71..ce81b25e4 --- a/src/ChangeLog +++ b/src/ChangeLog @@@ -1,208 -1,27 +1,232 @@@ +2009-07-06 Roland McGrath + + * dwarfcmp.cc (test_writer): Make it an int. + (parse_opt): Make -T increment it. + (main): Test only dwarf_output for -T, only dwarf_edit for -TT, + both only for -TTT. + +2009-07-03 Roland McGrath + + * Makefile.am (AM_CXXFLAGS): Drop -Wno-unused-parameter. + + * dwarfcmp.cc (open_file): Exit 77 for no DWARF under -T. + +2009-07-02 Roland McGrath + + * dwarflint-hl.cc (operator<<): dwarf::VS_unit_reference is gone. + + * dwarfcmp.cc (main): Update -T constructors using tracker. + Instantiate and test dwarf_output for -T too. + +2009-07-01 Roland McGrath + + * dwarfcmp.cc (talker): Update constructor parameters. + +2009-06-19 Roland McGrath + + * dwarfcmp.cc: Revamp using dwarf_comparator. + + * dwarflint-expected-at.cc: Include first. + * dwarflint-expected.hh (expected_map::expectation_map): + Use dwarf::tags. + (to_string): Function removed. + * dwarflint-hl.cc (recursively_validate): Don't use it. + + * dwarflint.c (abbrev_table_load): No-op control flow fiddle + silences gcc-4.4 -O3 warning. + +2009-04-02 Roland McGrath + + * Makefile.am (noinst_HEADERS): Add dwarfstrings.h here. + (dwarflint_SOURCES): Add dwarflint-expected.hh and dwarflint.h here. + (noinst_HEADERS): Add expr_opcodes.h too. + +2009-03-24 Roland McGrath + + * Makefile.am (libdwplusplus_SOURCES): Variable removed. + (dwarfcmp_SOURCES, dwarflint_SOURCES): Don't use it. + (libdwpp): New variable. + (dwarfcmp_LDADD, dwarflint_LDADD): Use it. + +2009-03-05 Petr Machata + + * dwarflint.c: Add --nohl command line switch. + +2009-01-28 Petr Machata + + * dwarflint.c: Coding style cleanups. + (found_hole): Tolerate zero-padding to given alignment. + +2009-01-27 Petr Machata + + * dwarflint.c: Implement validation of .debug_ranges and + references from .debug_info to .debug_ranges. + +2009-01-27 Petr Machata + + * dwarflint.c: Check that the base address selection entry + actually changes base address. + +2009-01-27 Petr Machata + + * dwarflint.c: Match the way dwarflint reports offsets with the + way elfutils does it. + +2009-01-26 Petr Machata + + * dwarflint.c (check_aranges_structural): Check that each CU is + referenced from one aranges section only. + (check_pub_structural): Likewise for pubnames and pubtypes. + (read_ctx_read_uleb128): Allow ten-byte ULEB128. + +2009-01-23 Petr Machata + + * dwarflint.c (check_debug_info_structural): Check that all CUs + have the same address size. + +2009-01-17 Roland McGrath + + * expr_opcodes.h: Fix DW_OP_deref entry. + Add DW_OP_GNU_push_tls_address, DW_OP_GNU_uninit. + +2009-01-17 Petr Machata + + * dwarflint.c: Better location handling: references now carry + along where did they originate (i.e. which section, offset, etc.), + all messages are location-aware. + (struct where): New structure that captures location inside the + Dwarf file. Can be chained to achieve chains of "caused by this + reference" messages ala GCC. + +2009-01-15 Petr Machata + + * dwarflint.c: Implement validation of .debug_loc and references + from .debug_info to .debug_loc. + +2009-01-14 Petr Machata + + * dwarfstrings.h (dwarf_locexpr_opcode_string): New. + +2009-01-14 Petr Machata + + * dwarflint.c: Validation .debug_pubtypes. + +2009-01-13 Petr Machata + + * dwarflint.c: Adjust check_pubnames_structural to be able to + validate also .debug_pubtypes. + +2009-01-13 Petr Machata + + * dwarflint.c: Rewrite message macros to functions. This makes it + possible to rewrite several other macros to functions. + +2009-01-12 Petr Machata + + * dwarflint.c: Implement validation of .debug_pubnames. + +2009-01-12 Petr Machata + + * dwarflint.c: Check padding between sections in .debug_aranges. + +2009-01-12 Petr Machata + + * dwarflint.c: For DIE references, remember both referrer and + referree. Add a new data structure ref_record to support that. + Add new message category, mc_die_rel_ref. Rename other DIE + relationship categories to mc_die_rel_* pattern. + +2009-01-12 Petr Machata + + * dwarflint.c: Changes in data structures for recording DIEs and CUs. + +2009-01-12 Petr Machata + + * dwarflint.c: Implement validation of .debug_aranges. + +2009-01-11 Petr Machata + + * dwarflint.c (process_file): Handle absence of .debug_info, + .debug_abbrev and .debug_str gracefully. + +2009-01-11 Petr Machata + + * dwarflint.c: A couple small fixes across the code. + (check_debug_info_structural): Return bool. + (check_cu_structural): Likewise. + (check_addr_record_addr): Likewise. + (check_die_references): Likewise. + +2009-01-10 Roland McGrath + + * dwarfcmp.cc (test_writer): New variable. + (options, parse_opt): Grok -T/--test-writer to set it. + (main): When set, exercise dwarf_output constructors and comparators. + + * dwarflint.c (options, parse_opt): Replace --no-debug with + -i/--ignore-missing, to match dwarfcmp. + +2009-01-10 Petr Machata + + * dwarflint.c: Implement --no-debug: silently accept file, if its + debug info is not available. + +2009-01-10 Roland McGrath + + * dwarfcmp.cc: New file. + * Makefile.am (bin_PROGRAMS): Add dwarfcmp. + (dwarfcmp_SOURCES): New variable. + (dwarfcmp_no_Wformat, dwarfcmp_LDADD): New variables. + +2009-01-10 Petr Machata + + * dwarflint.c: Implement fine-grained message selection. Each + message has a category, which is bitwise OR of category options. + There are acceptance and rejection criteria for warnings and + errors, which can be tuned using command-line options (currently + --strict and --gnu). + Use dwarfstrings.h in two messages. + +2009-01-10 Petr Machata + + * readelf.c: Extract functions that format dwarf enums into a file + of its own, so it can be shared with dwarflint. + * dwarfstrings.h: That file. + +2009-01-09 Petr Machata + + * dwarflint.c: Sort the abbrev tables and look up abbreviations + with bisect search. + +2009-01-09 Petr Machata + + * dwarflint.c: Checking for zero padding and unreferenced bytes. + CU size and padding at the end of CU are now checked. + + 2009-07-26 Mark Wielaard + + * elflint.c (check_note_data): Recognize NT_GNU_GOLD_VERSION. + + 2009-07-25 Mark Wielaard + + * Makefile.am (addr2line_LDADD): Add $(libelf). + + 2009-07-24 Roland McGrath + + * readelf.c (print_block): New function. + (print_ops): Use it. + (attr_callback): Use it for DW_FORM_block* forms. + + 2009-07-20 Mark Wielaard + + * readelf.c (print_ops): Add handling of DW_OP_implicit_value + and DW_OP_stack_value. + + 2009-07-14 Ulrich Drepper + + * elflint.c (check_elf_header): Allow Linux ABI. + (check_symtab): Handle STB_GNU_UNIQUE. + 2009-07-08 Mark Wielaard * readelf.c (attr_callback): Handle DW_Form constants for diff --cc src/readelf.c index e1cf8d2c5,b0f8fb02d..961decaf0 --- a/src/readelf.c +++ b/src/readelf.c @@@ -3138,7 -3137,607 +3138,23 @@@ format_dwarf_addr (Dwfl_Module *dwflmod return result; } -static const char * -dwarf_tag_string (unsigned int tag) -{ - static const char *const known_tags[] = - { - [DW_TAG_array_type] = "array_type", - [DW_TAG_class_type] = "class_type", - [DW_TAG_entry_point] = "entry_point", - [DW_TAG_enumeration_type] = "enumeration_type", - [DW_TAG_formal_parameter] = "formal_parameter", - [DW_TAG_imported_declaration] = "imported_declaration", - [DW_TAG_label] = "label", - [DW_TAG_lexical_block] = "lexical_block", - [DW_TAG_member] = "member", - [DW_TAG_pointer_type] = "pointer_type", - [DW_TAG_reference_type] = "reference_type", - [DW_TAG_compile_unit] = "compile_unit", - [DW_TAG_string_type] = "string_type", - [DW_TAG_structure_type] = "structure_type", - [DW_TAG_subroutine_type] = "subroutine_type", - [DW_TAG_typedef] = "typedef", - [DW_TAG_union_type] = "union_type", - [DW_TAG_unspecified_parameters] = "unspecified_parameters", - [DW_TAG_variant] = "variant", - [DW_TAG_common_block] = "common_block", - [DW_TAG_common_inclusion] = "common_inclusion", - [DW_TAG_inheritance] = "inheritance", - [DW_TAG_inlined_subroutine] = "inlined_subroutine", - [DW_TAG_module] = "module", - [DW_TAG_ptr_to_member_type] = "ptr_to_member_type", - [DW_TAG_set_type] = "set_type", - [DW_TAG_subrange_type] = "subrange_type", - [DW_TAG_with_stmt] = "with_stmt", - [DW_TAG_access_declaration] = "access_declaration", - [DW_TAG_base_type] = "base_type", - [DW_TAG_catch_block] = "catch_block", - [DW_TAG_const_type] = "const_type", - [DW_TAG_constant] = "constant", - [DW_TAG_enumerator] = "enumerator", - [DW_TAG_file_type] = "file_type", - [DW_TAG_friend] = "friend", - [DW_TAG_namelist] = "namelist", - [DW_TAG_namelist_item] = "namelist_item", - [DW_TAG_packed_type] = "packed_type", - [DW_TAG_subprogram] = "subprogram", - [DW_TAG_template_type_parameter] = "template_type_parameter", - [DW_TAG_template_value_parameter] = "template_value_parameter", - [DW_TAG_thrown_type] = "thrown_type", - [DW_TAG_try_block] = "try_block", - [DW_TAG_variant_part] = "variant_part", - [DW_TAG_variable] = "variable", - [DW_TAG_volatile_type] = "volatile_type", - [DW_TAG_dwarf_procedure] = "dwarf_procedure", - [DW_TAG_restrict_type] = "restrict_type", - [DW_TAG_interface_type] = "interface_type", - [DW_TAG_namespace] = "namespace", - [DW_TAG_imported_module] = "imported_module", - [DW_TAG_unspecified_type] = "unspecified_type", - [DW_TAG_partial_unit] = "partial_unit", - [DW_TAG_imported_unit] = "imported_unit", - [DW_TAG_mutable_type] = "mutable_type", - [DW_TAG_condition] = "condition", - [DW_TAG_shared_type] = "shared_type", - }; - const unsigned int nknown_tags = (sizeof (known_tags) - / sizeof (known_tags[0])); - static char buf[40]; - const char *result = NULL; - - if (likely (tag < nknown_tags)) - result = known_tags[tag]; - - if (unlikely (result == NULL)) - /* There are a few known extensions. */ - switch (tag) - { - case DW_TAG_MIPS_loop: - result = "MIPS_loop"; - break; - - case DW_TAG_format_label: - result = "format_label"; - break; - - case DW_TAG_function_template: - result = "function_template"; - break; - - case DW_TAG_class_template: - result = "class_template"; - break; - - default: - if (tag < DW_TAG_lo_user) - snprintf (buf, sizeof buf, gettext ("unknown tag %hx"), tag); - else - snprintf (buf, sizeof buf, gettext ("unknown user tag %hx"), tag); - result = buf; - break; - } - - return result; -} - - -static const char * -dwarf_attr_string (unsigned int attrnum) -{ - static const char *const known_attrs[] = - { - [DW_AT_sibling] = "sibling", - [DW_AT_location] = "location", - [DW_AT_name] = "name", - [DW_AT_ordering] = "ordering", - [DW_AT_subscr_data] = "subscr_data", - [DW_AT_byte_size] = "byte_size", - [DW_AT_bit_offset] = "bit_offset", - [DW_AT_bit_size] = "bit_size", - [DW_AT_element_list] = "element_list", - [DW_AT_stmt_list] = "stmt_list", - [DW_AT_low_pc] = "low_pc", - [DW_AT_high_pc] = "high_pc", - [DW_AT_language] = "language", - [DW_AT_member] = "member", - [DW_AT_discr] = "discr", - [DW_AT_discr_value] = "discr_value", - [DW_AT_visibility] = "visibility", - [DW_AT_import] = "import", - [DW_AT_string_length] = "string_length", - [DW_AT_common_reference] = "common_reference", - [DW_AT_comp_dir] = "comp_dir", - [DW_AT_const_value] = "const_value", - [DW_AT_containing_type] = "containing_type", - [DW_AT_default_value] = "default_value", - [DW_AT_inline] = "inline", - [DW_AT_is_optional] = "is_optional", - [DW_AT_lower_bound] = "lower_bound", - [DW_AT_producer] = "producer", - [DW_AT_prototyped] = "prototyped", - [DW_AT_return_addr] = "return_addr", - [DW_AT_start_scope] = "start_scope", - [DW_AT_bit_stride] = "bit_stride", - [DW_AT_upper_bound] = "upper_bound", - [DW_AT_abstract_origin] = "abstract_origin", - [DW_AT_accessibility] = "accessibility", - [DW_AT_address_class] = "address_class", - [DW_AT_artificial] = "artificial", - [DW_AT_base_types] = "base_types", - [DW_AT_calling_convention] = "calling_convention", - [DW_AT_count] = "count", - [DW_AT_data_member_location] = "data_member_location", - [DW_AT_decl_column] = "decl_column", - [DW_AT_decl_file] = "decl_file", - [DW_AT_decl_line] = "decl_line", - [DW_AT_declaration] = "declaration", - [DW_AT_discr_list] = "discr_list", - [DW_AT_encoding] = "encoding", - [DW_AT_external] = "external", - [DW_AT_frame_base] = "frame_base", - [DW_AT_friend] = "friend", - [DW_AT_identifier_case] = "identifier_case", - [DW_AT_macro_info] = "macro_info", - [DW_AT_namelist_item] = "namelist_item", - [DW_AT_priority] = "priority", - [DW_AT_segment] = "segment", - [DW_AT_specification] = "specification", - [DW_AT_static_link] = "static_link", - [DW_AT_type] = "type", - [DW_AT_use_location] = "use_location", - [DW_AT_variable_parameter] = "variable_parameter", - [DW_AT_virtuality] = "virtuality", - [DW_AT_vtable_elem_location] = "vtable_elem_location", - [DW_AT_allocated] = "allocated", - [DW_AT_associated] = "associated", - [DW_AT_data_location] = "data_location", - [DW_AT_byte_stride] = "byte_stride", - [DW_AT_entry_pc] = "entry_pc", - [DW_AT_use_UTF8] = "use_UTF8", - [DW_AT_extension] = "extension", - [DW_AT_ranges] = "ranges", - [DW_AT_trampoline] = "trampoline", - [DW_AT_call_column] = "call_column", - [DW_AT_call_file] = "call_file", - [DW_AT_call_line] = "call_line", - [DW_AT_description] = "description", - [DW_AT_binary_scale] = "binary_scale", - [DW_AT_decimal_scale] = "decimal_scale", - [DW_AT_small] = "small", - [DW_AT_decimal_sign] = "decimal_sign", - [DW_AT_digit_count] = "digit_count", - [DW_AT_picture_string] = "picture_string", - [DW_AT_mutable] = "mutable", - [DW_AT_threads_scaled] = "threads_scaled", - [DW_AT_explicit] = "explicit", - [DW_AT_object_pointer] = "object_pointer", - [DW_AT_endianity] = "endianity", - [DW_AT_elemental] = "elemental", - [DW_AT_pure] = "pure", - [DW_AT_recursive] = "recursive", - }; - const unsigned int nknown_attrs = (sizeof (known_attrs) - / sizeof (known_attrs[0])); - static char buf[40]; - const char *result = NULL; - - if (likely (attrnum < nknown_attrs)) - result = known_attrs[attrnum]; - - if (unlikely (result == NULL)) - /* There are a few known extensions. */ - switch (attrnum) - { - case DW_AT_MIPS_fde: - result = "MIPS_fde"; - break; - - case DW_AT_MIPS_loop_begin: - result = "MIPS_loop_begin"; - break; - - case DW_AT_MIPS_tail_loop_begin: - result = "MIPS_tail_loop_begin"; - break; - - case DW_AT_MIPS_epilog_begin: - result = "MIPS_epilog_begin"; - break; - - case DW_AT_MIPS_loop_unroll_factor: - result = "MIPS_loop_unroll_factor"; - break; - - case DW_AT_MIPS_software_pipeline_depth: - result = "MIPS_software_pipeline_depth"; - break; - - case DW_AT_MIPS_linkage_name: - result = "MIPS_linkage_name"; - break; - - case DW_AT_MIPS_stride: - result = "MIPS_stride"; - break; - - case DW_AT_MIPS_abstract_name: - result = "MIPS_abstract_name"; - break; - - case DW_AT_MIPS_clone_origin: - result = "MIPS_clone_origin"; - break; - - case DW_AT_MIPS_has_inlines: - result = "MIPS_has_inlines"; - break; - - case DW_AT_MIPS_stride_byte: - result = "MIPS_stride_byte"; - break; - - case DW_AT_MIPS_stride_elem: - result = "MIPS_stride_elem"; - break; - - case DW_AT_MIPS_ptr_dopetype: - result = "MIPS_ptr_dopetype"; - break; - - case DW_AT_MIPS_allocatable_dopetype: - result = "MIPS_allocatable_dopetype"; - break; - - case DW_AT_MIPS_assumed_shape_dopetype: - result = "MIPS_assumed_shape_dopetype"; - break; - - case DW_AT_MIPS_assumed_size: - result = "MIPS_assumed_size"; - break; - - case DW_AT_sf_names: - result = "sf_names"; - break; - - case DW_AT_src_info: - result = "src_info"; - break; - - case DW_AT_mac_info: - result = "mac_info"; - break; - - case DW_AT_src_coords: - result = "src_coords"; - break; - - case DW_AT_body_begin: - result = "body_begin"; - break; - - case DW_AT_body_end: - result = "body_end"; - break; - - default: - if (attrnum < DW_AT_lo_user) - snprintf (buf, sizeof buf, gettext ("unknown attribute %hx"), - attrnum); - else - snprintf (buf, sizeof buf, gettext ("unknown user attribute %hx"), - attrnum); - result = buf; - break; - } - - return result; -} - - -static const char * -dwarf_form_string (unsigned int form) -{ - static const char *const known_forms[] = - { - [DW_FORM_addr] = "addr", - [DW_FORM_block2] = "block2", - [DW_FORM_block4] = "block4", - [DW_FORM_data2] = "data2", - [DW_FORM_data4] = "data4", - [DW_FORM_data8] = "data8", - [DW_FORM_string] = "string", - [DW_FORM_block] = "block", - [DW_FORM_block1] = "block1", - [DW_FORM_data1] = "data1", - [DW_FORM_flag] = "flag", - [DW_FORM_sdata] = "sdata", - [DW_FORM_strp] = "strp", - [DW_FORM_udata] = "udata", - [DW_FORM_ref_addr] = "ref_addr", - [DW_FORM_ref1] = "ref1", - [DW_FORM_ref2] = "ref2", - [DW_FORM_ref4] = "ref4", - [DW_FORM_ref8] = "ref8", - [DW_FORM_ref_udata] = "ref_udata", - [DW_FORM_indirect] = "indirect" - }; - const unsigned int nknown_forms = (sizeof (known_forms) - / sizeof (known_forms[0])); - static char buf[40]; - const char *result = NULL; - - if (likely (form < nknown_forms)) - result = known_forms[form]; - - if (unlikely (result == NULL)) - snprintf (buf, sizeof buf, gettext ("unknown form %" PRIx64), - (uint64_t) form); - - return result; -} - - -static const char * -dwarf_lang_string (unsigned int lang) -{ - static const char *const known[] = - { - [DW_LANG_C89] = "ISO C89", - [DW_LANG_C] = "C", - [DW_LANG_Ada83] = "Ada83", - [DW_LANG_C_plus_plus] = "C++", - [DW_LANG_Cobol74] = "Cobol74", - [DW_LANG_Cobol85] = "Cobol85", - [DW_LANG_Fortran77] = "Fortran77", - [DW_LANG_Fortran90] = "Fortran90", - [DW_LANG_Pascal83] = "Pascal83", - [DW_LANG_Modula2] = "Modula2", - [DW_LANG_Java] = "Java", - [DW_LANG_C99] = "ISO C99", - [DW_LANG_Ada95] = "Ada95", - [DW_LANG_Fortran95] = "Fortran95", - [DW_LANG_PL1] = "PL1", - [DW_LANG_Objc] = "Objective C", - [DW_LANG_ObjC_plus_plus] = "Objective C++", - [DW_LANG_UPC] = "UPC", - [DW_LANG_D] = "D", - }; - - if (likely (lang < sizeof (known) / sizeof (known[0]))) - return known[lang]; - else if (lang == DW_LANG_Mips_Assembler) - /* This language tag is used for assembler in general. */ - return "Assembler"; - - if (lang >= DW_LANG_lo_user && lang <= DW_LANG_hi_user) - { - static char buf[30]; - snprintf (buf, sizeof (buf), "lo_user+%u", lang - DW_LANG_lo_user); - return buf; - } - - return "???"; -} - - -static const char * -dwarf_inline_string (unsigned int code) -{ - static const char *const known[] = - { - [DW_INL_not_inlined] = "not_inlined", - [DW_INL_inlined] = "inlined", - [DW_INL_declared_not_inlined] = "declared_not_inlined", - [DW_INL_declared_inlined] = "declared_inlined" - }; - - if (likely (code < sizeof (known) / sizeof (known[0]))) - return known[code]; - - return "???"; -} - - -static const char * -dwarf_encoding_string (unsigned int code) -{ - static const char *const known[] = - { - [DW_ATE_void] = "void", - [DW_ATE_address] = "address", - [DW_ATE_boolean] = "boolean", - [DW_ATE_complex_float] = "complex_float", - [DW_ATE_float] = "float", - [DW_ATE_signed] = "signed", - [DW_ATE_signed_char] = "signed_char", - [DW_ATE_unsigned] = "unsigned", - [DW_ATE_unsigned_char] = "unsigned_char", - [DW_ATE_imaginary_float] = "imaginary_float", - [DW_ATE_packed_decimal] = "packed_decimal", - [DW_ATE_numeric_string] = "numeric_string", - [DW_ATE_edited] = "edited", - [DW_ATE_signed_fixed] = "signed_fixed", - [DW_ATE_unsigned_fixed] = "unsigned_fixed", - [DW_ATE_decimal_float] = "decimal_float", - }; - - if (likely (code < sizeof (known) / sizeof (known[0]))) - return known[code]; - - if (code >= DW_ATE_lo_user && code <= DW_ATE_hi_user) - { - static char buf[30]; - snprintf (buf, sizeof (buf), "lo_user+%u", code - DW_ATE_lo_user); - return buf; - } - - return "???"; -} - - -static const char * -dwarf_access_string (unsigned int code) -{ - static const char *const known[] = - { - [DW_ACCESS_public] = "public", - [DW_ACCESS_protected] = "protected", - [DW_ACCESS_private] = "private" - }; - - if (likely (code < sizeof (known) / sizeof (known[0]))) - return known[code]; - - return "???"; -} - - -static const char * -dwarf_visibility_string (unsigned int code) -{ - static const char *const known[] = - { - [DW_VIS_local] = "local", - [DW_VIS_exported] = "exported", - [DW_VIS_qualified] = "qualified" - }; - - if (likely (code < sizeof (known) / sizeof (known[0]))) - return known[code]; - - return "???"; -} - - -static const char * -dwarf_virtuality_string (unsigned int code) -{ - static const char *const known[] = - { - [DW_VIRTUALITY_none] = "none", - [DW_VIRTUALITY_virtual] = "virtual", - [DW_VIRTUALITY_pure_virtual] = "pure_virtual" - }; - - if (likely (code < sizeof (known) / sizeof (known[0]))) - return known[code]; - - return "???"; -} - - -static const char * -dwarf_identifier_case_string (unsigned int code) -{ - static const char *const known[] = - { - [DW_ID_case_sensitive] = "sensitive", - [DW_ID_up_case] = "up_case", - [DW_ID_down_case] = "down_case", - [DW_ID_case_insensitive] = "insensitive" - }; - - if (likely (code < sizeof (known) / sizeof (known[0]))) - return known[code]; - - return "???"; -} - - -static const char * -dwarf_calling_convention_string (unsigned int code) -{ - static const char *const known[] = - { - [DW_CC_normal] = "normal", - [DW_CC_program] = "program", - [DW_CC_nocall] = "nocall", - }; - - if (likely (code < sizeof (known) / sizeof (known[0]))) - return known[code]; - - if (code >= DW_CC_lo_user && code <= DW_CC_hi_user) - { - static char buf[30]; - snprintf (buf, sizeof (buf), "lo_user+%u", code - DW_CC_lo_user); - return buf; - } - - return "???"; -} - - -static const char * -dwarf_ordering_string (unsigned int code) -{ - static const char *const known[] = - { - [DW_ORD_row_major] = "row_major", - [DW_ORD_col_major] = "col_major" - }; - - if (likely (code < sizeof (known) / sizeof (known[0]))) - return known[code]; - - return "???"; -} - - -static const char * -dwarf_discr_list_string (unsigned int code) -{ - static const char *const known[] = - { - [DW_DSC_label] = "label", - [DW_DSC_range] = "range" - }; - - if (likely (code < sizeof (known) / sizeof (known[0]))) - return known[code]; - - return "???"; -} - + static void + print_block (size_t n, const void *block) + { + if (n == 0) + puts (_("empty block")); + else + { + printf (_("%zu byte block:"), n); + const unsigned char *data = block; + do + printf (" %02x", *data++); + while (--n > 0); + putchar ('\n'); + } + } + static void print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest, unsigned int addrsize, Dwarf_Word len, const unsigned char *data) diff --cc tests/ChangeLog index 3865aa13f,87654d605..ad091cc5a --- a/tests/ChangeLog +++ b/tests/ChangeLog @@@ -1,74 -1,13 +1,84 @@@ +2009-07-03 Roland McGrath + + * print-die.hh: Grok --sort-attrs option to canonicalize order. + Fix ref assignment to produce consistent numbering. + * run-dwarf_edit.sh: Update expected output. + * run-dwarf-attributes.sh: Likewise. + + * Makefile.am (AM_CXXFLAGS): New variable (from ../src/Makefile.am). + + * print-die.hh: Grok --edit/--output options to print a copied object. + +2009-07-02 Roland McGrath + + * run-dwarf_edit.sh: New file. + * dwarf_edit.cc: New file. + * Makefile.am (noinst_PROGRAMS, TESTS, EXTRA_DIST): Add them. + (dwarf_edit_SOURCES, dwarf_edit_LDADD): New variables. + + * dwarf-print.cc (print_die): Templatify and move ... + * print-die.hh: ... here, new file. + * Makefile.am (noinst_HEADERS): New variable, add it. + +2009-07-01 Roland McGrath + + * run-dwarfcmp-self.sh: Run on dwarflint too. + Fiddle failure output. + +2009-06-15 Roland McGrath + + * dwarf-print.cc: Include . + +2009-03-25 Petr Machata + + * dwarf-attributes.cc: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (dwarf_attributes_SOURCES, dwarf_attributes_LDADD): New variables. + +2009-03-25 Roland McGrath + + * dwarf-print.cc (print_die, process_file): Take LIMIT argument. + Punt recursion at that depth. + (main): Grok first argument --depth=N to set it. + +2009-03-24 Roland McGrath + + * dwarf-print.cc: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (dwarf_print_SOURCES, dwarf_print_LDADD): New variables. + +2009-01-10 Roland McGrath + + * run-dwarfcmp-self.sh: Also run with -T. + + * run-dwarflint-self.sh: --no-debug -> -i + + * run-dwarfcmp-self.sh: Run both with and without -q. + +2009-01-10 Petr Machata + + * run-dwarflint-self.sh: Pass new option --no-debug to dwarflint. + +2009-01-10 Roland McGrath + + * run-dwarflint-self.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST) Add it. + +2009-01-05 Roland McGrath + + * run-dwarfcmp-self.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST) Add it. + + 2009-07-22 Roland McGrath + + * addrcfi.c: Update dwarf_frame_{cfa,register} calling convention. + + 2009-07-08 Roland McGrath + + * addrcfi.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (addrcfi_LDADD): New variable. + 2009-05-07 Petr Machata * testfile51.bz2: New data file. diff --cc tests/Makefile.am index 98fa96e97,54d2c61ad..b0da862c0 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@@ -64,9 -60,7 +64,8 @@@ noinst_PROGRAMS = arextract arsymtest n find-prologues funcretval allregs rdwrmmap \ dwfl-bug-addr-overflow arls dwfl-bug-fd-leak \ dwfl-addr-sect dwfl-bug-report early-offscn \ - dwfl-bug-getmodules dwarf-getmacros dwarf-print \ - dwarf_edit - # get-ciefde - dwfl-bug-getmodules dwarf-getmacros addrcfi ++ dwfl-bug-getmodules dwarf-getmacros addrcfi \ ++ dwarf-print dwarf_edit asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \ asm-tst6 asm-tst7 asm-tst8 asm-tst9