Age | Commit message (Collapse) | Author | Files | Lines |
|
* dwarf.c (process_debug_info): Call free_abrev_list on
return paths.
|
|
PR 30791
* dwarf.c (free_debug_information): Free range_versions.
|
|
PR 30791
* dwarf.h (debug_info): Add range_versions field.
* dwarf.c (read_and_display_attr_value): When recording a range arribute also ecord the dwarf version number.
(is_range_list_for_this_section): New function.
(display_debug_ranges): Only show debug ranges whose version is suitable for the secction being displayed.
|
|
Fuzzers have found that objdump -W takes a really long time if
the entry count uleb is ridiculously large, and format attributes
don't consume data (which doesn't make sense for a table of names).
* dwarf.c (display_formatted_table): Sanity check count of
table entries.
|
|
* dwarf.c (display_debug_frames <DW_CFA_restore_state>): Do free
invalid remember_state.
|
|
This one was caused by me unnecessarily promoting an "int adv" to
"int64_t adv". The expression overflowing was 4259 + 9223372036854775807
with the left number being unsigned int.
* dwarf.h (DWARF2_Internal_LineInfo): Replace unsigned short
with uint16_t and unsigned char with uint8_t. Make li_line_base
an int8_t.
* dwarf.c (display_debug_lines_raw): Revert "adv" back to an int.
|
|
PR 30355
* dwarf.c (read_and_display_attr_value): Correctly handle DW_loclistx attributes that index a version 5 .debug_loclists section.
|
|
PR 30361
* dwarf.c (fetch_indexed_string): Sanity check string index.
|
|
PR 30327
* dwarf.c (read_and_display_attr_value): Warn if the number of views is greater than the number of locations.
|
|
corrupt DWARF file.
PR 30313
* dwarf.c (display_debug_lines_decoded): Check for an overlarge number of files or directories.
|
|
PR 30312
* dwarf.c (prealloc_cu_tu_list): Always allocate at least one entry.
|
|
We may have added some abbrevs to the list before hitting an error.
Free the list elements too. free_abbrev_list returns list->next so we
need to init it earlier to avoid an uninitialised memory access.
* dwarf.c (process_abbrev_set): Call free_abbrev_list on errors.
Set list->next earlier.
|
|
PR 30284
* dwarf.c (read_and_display_attr_value): Detect and ignore negative base values.
|
|
DWARF file.
PR 30227
* dwarf.c (process_cu_tu_index): Prevent excessive memory allocation when nused is large and ncols is zero.
|
|
PR 30216
* dwarf.c (display_debug_lines_decoded): Reduce space for filenames.
* testsuite/binutils-all/dw5.W: Adjust expected output.
* testsuite/binutils-all/objdump.WL: Adjust expected output.
|
|
The newer update-copyright.py fixes file encoding too, removing cr/lf
on binutils/bfdtest2.c and ld/testsuite/ld-cygwin/exe-export.exp, and
embedded cr in binutils/testsuite/binutils-all/ar.exp string match.
|
|
This fixes a couple of places in display_debug_lines_decoded that were
off by one in checking DWARF5 .debug_line directory indices. It also
displays the DWARF5 entry 0 for the program current directory rather
than "." as is done for pre-DWARF5. I decided against displaying
DW_AT_comp_dir for pre-DWARF5 since I figure it is better for readelf
to minimally interpret debug info.
binutils/
PR 29948
* dwarf.c (display_debug_lines_decoded): Display the given
directory entry 0 for DWARF5. Properly check directory index
against number of entries in the table. Revert to using
unsigned int for n_directories and associated variables.
Correct warning messages.
gas/
* testsuite/gas/elf/dwarf-5-loc0.d: Update.
|
|
PR 29893
PR 29908
* dwarf.c (display_debug_addr): Combine dwarf5 unit_length checks.
Delete dead code.
|
|
PR 29914
* dwarf.c (fetch_indexed_value): Fail if the section is not big
enough to contain a header size field.
(display_debug_addr): Fail if the computed address size is too big
or too small.
|
|
|
|
PR 29908
* dwarf.c (display_debug_addr): Check for corrupt header lengths.
|
|
* dwarf.c (struct Frame_Chunk): Make col_offset an int64_t.
Adjust all places allocating col_offset and col_type to use
the size of the array element rather than the size of a type.
(frame_display_row): Adjust printing of col_offset.
(display_debug_frames): Factor out multiplication by
code_factor and data_factor. Avoid signed overflow. Use
64-bit variables.
|
|
PR 29893
* dwarf.c (display_debug_addr): Sanity check dwarf5 unit_length
field. Don't read past end.
|
|
Plus segvs if the C-library doesn't handle printf %s of NULL.
PR 29872
* dwarf.c (null_name): New function.
(process_debug_info): Use it here..
(display_debug_lines_raw): ..and here..
(display_debug_lines_decoded): ..and here. xcalloc directory_table.
Simplify xcalloc of file_table.
|
|
DWARF5 directory and file table allow more opportunity for fuzzers
to break things. There are likely other places in dwarf.c that should
be fixed too.
PR 29870
* dwarf.c (display_debug_lines_decoded): Handle NULL file_table
name entry.
|
|
The previous warnings about holes in .debug_loclists sections don't
take into account the headers of each CU and could include the locviews
if they precede the loclist.
The following warning can be triggered between two CU.
... <previous CU views> ...
0000001d <End of list>
0000002a v000000000000000 v000000000000000 location view pair
0000002c v000000000000000 v000000000000000 location view pair
readelf: Warning: There is a hole [0x1e - 0x2e] in .debug_loclists section.
0000002e v000000000000000 v000000000000000 views at 0000002a for:
...
But [0x1e - 0x2a] corresponds to the CU header and [0x2a - 0x2e] are
the locviews. Thus there is no hole here.
binutils/ChangeLog:
* dwarf.c (display_debug_loc): Adjust holes detections for
headers and locviews.
|
|
The aim here is to improve readelf handling of large 64-bit object
files on LLP64 hosts (Windows) where long is only 32 bits. The patch
changes more than just file offsets. Addresses and sizes are also
changed to avoid "long". Most places get to use uint64_t even where
size_t may be more appropriate, because that allows some overflow
checks to be implemented easily (*alloc changes).
* dwarf.c (cmalloc, xcmalloc, xcrealloc, xcalloc2): Make nmemb
parameter uint64_t.
* dwarf.h: Update prototypes.
(struct dwarf_section): Make num_relocs uint64_t.
* elfcomm.c (setup_archive): Update error format.
* elfcomm.h (struct archive_info): Make sym_size, longnames_size,
nested_member_origin, next_arhdr_offset uint64_t.
* readelf.c (struct filedata): Make archive_file_offset,
archive_file_size, string_table_length, dynamic_addr,
dynamic_nent, dynamic_strings_length, num_dynamic_syms,
dynamic_syminfo_offset uint64_t.
(many functions): Replace uses of "unsigned long" with
"uint64_t" or "size_t".
|
|
PR 29799
* dwarf.c (display_gdb_index): Typo fix.
|
|
Ref: https://gcc.gnu.org/wiki/DebugFissionDWP?action=recall&rev=3
Fuzzers have found a weakness in the code stashing pool section
entries. With random nonsensical values in the index entries (rather
than each index pointing to its own set distinct from other sets),
it's possible to overflow the space allocated, losing the NULL
terminator. Without a terminator, find_section_in_set can run off the
end of the shndx_pool buffer. Fix this by scanning the pool directly.
binutils/
* dwarf.c (add_shndx_to_cu_tu_entry): Delete range check.
(end_cu_tu_entry): Likewise.
(process_cu_tu_index): Fill shndx_pool by directly scanning
pool, rather than indirectly from index entries.
|
|
This commit assigns DWARF register numbers to vector registers (v0-v31:
96..127) to implement RISC-V DWARF Specification version 1.0-rc4
(now in the frozen state):
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/releases/tag/v1.0-rc4
binutils/ChangeLog:
* dwarf.c (dwarf_regnames_riscv): Assign DWARF register numbers
96..127 to vector registers v0-v31.
gas/ChangeLog:
* config/tc-riscv.c (tc_riscv_regname_to_dw2regnum): Support
vector registers.
* testsuite/gas/riscv/dw-regnums.s: Add vector registers to the
DWARF register number test.
* testsuite/gas/riscv/dw-regnums.d: Likewise.
|
|
|
|
PR 29523
* dwarf.c (display_debug_lines_decoded): Correctly handle DWARF-5
directory and filename tables.
|
|
2022-08-16 Alan Modra <amodra@gmail.com>
Cunlong Li <shenxiaogll@163.com>
PR 29362
* dwarf.c (free_debug_information): New function, extracted..
(free_debug_memory): ..from here.
(process_debug_info): Use it when before clearing out unit
debug_information. Clear all fields.
* objcopy.c (delete_symbol_htabs): New function.
(main): Call it via xatexit.
(copy_archive): Free "dir".
* objdump.c (free_debug_section): Free reloc_info.
|
|
This changes readelf output a little, removing the 0x prefix on hex
output when the value is 0, except in cases where a fixed field
width is shown. %#010x is not a good replacement for 0x%08x.
|
|
This replaces dwarf_vma, dwarf_size_type and dwarf_signed_vma with
uint64_t and int64_t everywhere. The patch also gets rid of
DWARF_VMA_FMT since we can't use that with uint64_t, and all of the
configure support for deciding the flavour of HOST_WIDEST_INT.
dwarf_vmatoa also disappears, replacing most uses with one of
PRIx64, PRId64 or PRIu64. Printing of size_t and ptrdiff_t values
now use %z and %t rather than by casting to unsigned long. Also,
most warning messages that used 0x%lx or similar now use %#lx and a
few that didn't print the 0x hex prefix now also use %#. The patch
doesn't change normal readelf output, except in odd cases where values
previously might have been truncated.
|
|
Replacing bfd_size_type with dwarf_size_type or uint64_t is mostly
cosmetic. The point of the change is to avoid use of a BFD type
in readelf, where we'd like to keep as independent of BFD as
possible. Also, the patch is a step towards using standard types.
|
|
Fixes a segfault found by the fuzzers.
* dwarf.c (fetch_indexed_value): Return -1 on error.
(read_and_display_attr_value): Don't display string when
fetch_indexed_value returns an error. Sanity check loc_offsets
index.
|
|
As before: Old enough glibc has an (unguarded) declaration of index()
in string.h, which triggers a "shadows a global declaration" warning.
|
|
PR 29390
binutils/
* dwarf.c (is_aarch64, DW_CFA_GNU_window_save_name): New.
(display_debug_frames): Use them.
(init_dwarf_regnames_aarch64): Set is_aarch64.
(init_dwarf_regnames_by_elf_machine_code): Clear is_aarch64.
(init_dwarf_regnames_by_bfd_arch_and_mach): Likewise.
gas/
* testsuite/gas/aarch64/pac_ab_key.d: Adjust expected output.
* testsuite/gas/aarch64/pac_negate_ra_state.d: Likewise.
|
|
Commit 244e19c79111 changed a number of variables in display_gdb_index
to count entries rather than words.
PR 29337
* dwarf.c (display_gdb_index): Correct use of cu_list_elements.
|
|
The PR29370 testcase is a fuzzed object file with multiple
.trace_abbrev sections. Multiple .trace_abbrev or .debug_abbrev
sections are not a violation of the DWARF standard. The DWARF5
standard even gives an example of multiple .debug_abbrev sections
contained in groups. Caching and lookup of processed abbrevs thus
needs to be done by section and offset rather than base and offset.
(Why base anyway?) Or, since section contents are kept, by a pointer
into the contents.
PR 29370
* dwarf.c (struct abbrev_list): Replace abbrev_base and
abbrev_offset with raw field.
(find_abbrev_list_by_abbrev_offset): Delete.
(find_abbrev_list_by_raw_abbrev): New function.
(process_abbrev_set): Set list->raw and list->next.
(find_and_process_abbrev_set): Replace abbrev list lookup with
new function. Don't set list abbrev_base, abbrev_offset or next.
|
|
I'm inclined to think that abbrev caching is counter-productive. The
time taken to search the list of abbrevs converted to internal form is
non-zero, and it's easy to decode the raw abbrevs. It's especially
silly to cache empty lists of decoded abbrevs (happens with zero
padding in .debug_abbrev), or abbrevs as they are displayed when there
is no further use of those abbrevs. This patch stops caching in those
cases.
* dwarf.c (record_abbrev_list_for_cu): Add free_list param.
Put abbrevs on abbrev_lists here.
(new_abbrev_list): Delete function.
(process_abbrev_set): Return newly allocated list. Move
abbrev base, offset and size checking to..
(find_and_process_abbrev_set): ..here, new function. Handle
lookup of cached abbrevs here, and calculate start and end
for process_abbrev_set. Return free_list if newly alloc'd.
(process_debug_info): Consolidate cached list lookup, new list
alloc and processing into find_and_process_abbrev_set call.
Free list when not cached.
(display_debug_abbrev): Similarly.
|
|
* dwarf.c: Leading and trailing whitespace fixes.
(free_abbrev_list): New function.
(free_all_abbrevs): Use the above. Free cu_abbrev_map here too.
(process_abbrev_set): Print actual section name on error.
(get_type_abbrev_from_form): Add overflow check.
(free_debug_memory): Don't free cu_abbrev_map here..
(process_debug_info): ..or here. Warn on another case of not
finding a neeeded abbrev.
|
|
DW_AT_rank is a dwarf-5 feature.
|
|
Adding support for location and range lists for split-dwarf and dwarf-5.
Following issues are taken care.
1. Display of the index values for DW_FORM_loclistx and DW_FORM_rnglistx.
2. Display of .debug_loclists.dwo and .debug_rnglists.dwo sections.
* dwarf.c(read_and_display_attr_value): Handle DW_FORM_loclistx
and DW_FORM_rnglistx for .dwo files.
(process_debug_info): Load .debug_loclists.dwo and
.debug_rnglists.dwo if exists.
(load_separate_debug_files): Load .debug_loclists and
.debug_rnglists if exists.
Include 2 entries in debug_displays table.
* dwarf.h (enum dwarf_section_display_enum): Include 2 entries.
|
|
* dwarf.c(process_debug_info): Include DW_TAG_skeleton_unit.
(display_debug_str_offsets): While dumping .debug_str_offsets.dwo,
pass proper str_offsets_base to fetch_indexed_string().
(load_separate_debug_files): Skip DWO ID dump for dwarf-5.
|
|
|
|
* dwarf.c (dwarf_select_sections_by_name): If the entry's value is
zero then clear the corresponding variable.
(dwarf_select_sections_by_letters): Likewise.
* testsuite/binutils-all/debuginfo.exp: Expect -WE and -wE
debuginfod tests to fail.
|
|
DW_FORM_rnglistx. Correct the display of .debug.loclists sections.
PR 29267
* dwarf.c (display_debug_rnglists): New function, broken out of..
(display_debug_ranges): ... here.
(read_and_display_attr_value): Correct calculation of index
displayed for DW_FORM_loclistx and DW_FORM_rnglistx.
* testsuite/binutils-all/x86-64/pr26808.dump: Update expected
output.
|
|
corrupt DWARF data.
PR 29289
* dwarf.c (display_debug_names): Replace assert with a warning
message.
|