aboutsummaryrefslogtreecommitdiff
path: root/binutils/debug.c
AgeCommit message (Collapse)AuthorFilesLines
2024-01-04Update year range in copyright notice of binutils filesAlan Modra1-1/+1
Adds two new external authors to etc/update-copyright.py to cover bfd/ax_tls.m4, and adds gprofng to dirs handled automatically, then updates copyright messages as follows: 1) Update cgen/utils.scm emitted copyrights. 2) Run "etc/update-copyright.py --this-year" with an extra external author I haven't committed, 'Kalray SA.', to cover gas testsuite files (which should have their copyright message removed). 3) Build with --enable-maintainer-mode --enable-cgen-maint=yes. 4) Check out */po/*.pot which we don't update frequently.
2023-05-10Re: stack overflow in debug_write_typeAlan Modra1-1/+2
Apparently u.kindirect->slot can point at a NULL. * debug.c (debug_write_type): Don't segfault on NULL indirect.
2023-05-09stack overflow in debug_write_typeAlan Modra1-1/+6
Another fuzzer attack. This one was a "set" with elements using an indirect type pointing back at the set. The existing recursion check only prevented simple recursion. * debug.c (struct debug_type_s): Add mark. (debug_write_type): Set mark and check before recursing into indirect types.
2023-04-04Use bfd_alloc memory for read_debugging_info storageAlan Modra1-79/+71
Trying to free malloc'd memory used by the stabs and coff debug info parsers is complicated, and traversing the trees generated requires a lot of code. It's better to bfd_alloc the memory which allows it all to be freed without fuss when the bfd is closed. In the process of doing this I reverted most of commit a6336913332. Some of the stabs handling code grows arrays of pointers with realloc, to deal with arbitrary numbers of fields, function args, etc. The code still does that but copies over to bfd_alloc memory when finished. The alternative is to parse twice, once to size, then again to populate the arrays. I think that complication is unwarranted. Note that there is a greater than zero chance this patch breaks something, eg. that I missed an attempt to free obj_alloc memory. Also it seems there are no tests in the binutils testsuite aimed at exercising objdump --debugging. * budbg.h (finish_stab, parse_stab): Update prototypes * debug.c: Include bucomm.h. (struct debug_handle): Add "abfd" field. (debug_init): Add "abfd" param. bfd_alloc handle. (debug_xalloc, debug_xzalloc): New functions. Use throughout in place of xmalloc and memset. (debug_start_source): Remove "name_used" param. * debug.h (debug_init, debug_start_source): Update prototypes. (debug_xalloc, debug_xzalloc): Declare. * objcopy.c (copy_object): Don't free dhandle. * objdump.c (dump_bfd): Likewise. * rdcoff.c (coff_get_slot): Add dhandle arg. debug_xzalloc memory in place of xcalloc. Update callers. (parse_coff_struct_type): Don't leak on error return. Copy fields over to debug_xalloc memory. (parse_coff_enum_type): Copy names and vals over the debug_xalloc memory. * rddbg.c (read_debugging_info): Adjust debug_init call. Don't free dhandle. (read_section_stabs_debugging_info): Don't free shandle. Adjust parse_stab call. Call finish_stab on error return. (read_symbol_stabs_debugging_info): Similarly. * stabs.c (savestring): Delete unnecessary forward declaration. Add dhandle param. debug_xalloc memory. Update callers. (start_stab): Delete unnecessary casts. (finish_stab): Add "emit" param. Free file_types, so_string, and stabs handle. (parse_stab): Delete string_used param. Revert code dealing with string_used. Copy so_string passed to debug_set_filename and stored as main_filename to debug_xalloc memory. Similarly for string passed to debug_start_source and push_bincl. Copy args to debug_xalloc memory. Don't leak args. (parse_stab_enum_type): Copy names and values to debug_xalloc memory. Don't free name. (parse_stab_struct_type): Don't free fields. (parse_stab_baseclasses): Delete unnecessary cast. (parse_stab_struct_fields): Return debug_xalloc fields. (parse_stab_cpp_abbrev): Use debug_xalloc for _vb$ type name. (parse_stab_one_struct_field): Don't free name. (parse_stab_members): Copy variants and methods to debug_xalloc memory. Don't free name or argtypes. (parse_stab_argtypes): Use debug_xalloc memory for physname and args. (push_bincl): Add dhandle param. Use debug_xalloc memory. (stab_record_variable): Use debug_xalloc memory. (stab_emit_pending_vars): Don't free var list. (stab_find_slot): Add dhandle param. Use debug_xzalloc memory. Update all callers. (stab_find_tagged_type): Don't free name. Use debug_xzalloc. (stab_demangle_qualified): Don't free name. (stab_demangle_template): Don't free s1. (stab_demangle_args): Tidy pvarargs refs. Copy *pargs on success to debug_xalloc memory, free on failure. (stab_demangle_fund_type): Don't free name. (stab_demangle_v3_arglist): Copy args to debug_xalloc memory. Don't free dt.
2023-04-03rddbg.c stabs FIXMEsAlan Modra1-1/+2
This should sort out some very old FIXMEs in code handling stabs debug info. Necessary if we are to fuss over freeing up memory before objdump and objcopy exit. It is of course better from a user viewpoint to *not* free memory, which takes some time, and leave that to process exit. The only reason to do so is that having many memory leaks in binutils/ code tends to hide leaks in bfd/ or opcodes/, which we should care about. * budbg.h (parse_stab): Update prototype. * debug.h (debug_start_source): Update prototype. * debug.c (debug_start_source): Add name_used. Set if stashed. * rddbg.c (read_symbol_stabs_debugging_info): Always malloc stab string passed to parse_stab. Free stab string when unreferenced. (read_section_stabs_debugging_info): Likewise, and strings section contents. * stabs.c (parse_stab): Add string_used param. Set if string stashed. Pass to debug_start_source. Realloc file_types array rather that using malloc. Clarify comment about debug_make_indirect_type.
2023-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
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.
2022-01-07Revert previous delta to debug.c. Replace with patch to reject indirect ↵Pavel Mayorov1-19/+14
types that point to indirect types. PR 28718 * dwarf.c: Revert previous delta. (debug_get_real_type): Reject indirect types that point to indirect types. (debug_get_type_name, debug_get_type_size, debug_write_type): Likewise.
2022-01-06Fix a stack exhaustion bug parsing malicious STABS format debug information.Nick Clifton1-2/+16
PR 28718 * debug.c (debug_write_type): Allow for malicious recursion via indirect debug types.
2022-01-02Update year range in copyright notice of binutils filesAlan Modra1-1/+1
The result of running etc/update-copyright.py --this-year, fixing all the files whose mode is changed by the script, plus a build with --enable-maintainer-mode --enable-cgen-maint=yes, then checking out */po/*.pot which we don't update frequently. The copy of cgen was with commit d1dd5fcc38ead reverted as that commit breaks building of bfp opcodes files.
2021-09-01PR28250, Null pointer dereference in debug_class_type_samepAlan Modra1-1/+1
Typo fix, obviously should be m1->variants != NULL, not m1->variants == NULL. PR 28250 * debug.c (debug_class_type_samep): Correct m1->variants test.
2021-03-31Use bool in binutilsAlan Modra1-194/+194
* sysdep.h (POISON_BFD_BOOLEAN): Define. * addr2line.c, * ar.c, * arsup.c, * bfdtest2.c, * binemul.c, * binemul.h, * bucomm.c, * bucomm.h, * budbg.h, * coffgrok.c, * debug.c, * debug.h, * dlltool.c, * dwarf.c, * dwarf.h, * elfedit.c, * emul_aix.c, * mclex.c, * nm.c, * objcopy.c, * objdump.c, * od-macho.c, * prdbg.c, * rdcoff.c, * rddbg.c, * readelf.c, * rename.c, * stabs.c, * strings.c, * windint.h, * windmc.c, * windmc.h, * windres.c, * winduni.c, * wrstabs.c: Replace bfd_boolean with bool, FALSE with false, and TRUE with true throughout.
2021-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2020-04-17PR25840, Null pointer dereference in objdumpAlan Modra1-0/+2
PR 25840 * debug.c (debug_class_type_samep): Don't segfault on NULL type.
2020-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2019-08-26PR24938, Null Pointer Dereference in debug.c:debug_write_typeAlan Modra1-2/+3
PR 24938 * debug.c (debug_write_type): Call empty_type for NULL type here.. (debug_write_type): ..rather than in just one case here.
2019-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2018-01-03Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2017-01-02Update year range in copyright notice of all files.Alan Modra1-1/+1
2016-01-01Copyright update for binutilsAlan Modra1-1/+1
2015-01-02ChangeLog rotatation and copyright year updateAlan Modra1-1/+1
2014-03-05Update copyright yearsAlan Modra1-1/+1
2013-10-09 PR binutils/16023Nick Clifton1-2/+2
* debug.c (debug_type_samep): Add missing break statement.
2011-02-28ChangeLog binutils/Kai Tietz1-3/+2
2011-02-28 Kai Tietz <kai.tietz@onevision.com> * debug.c (debug_start_source): Use filename_(n)cmp. * ieee.c (ieee_finish_compilation_unit): Likewise. (ieee_lineno): Likewise. * nlmconv.c (main): Likewise. * objcopy.c (strip_main): Likewise. (copy_main): Likewise. * objdump.c (show_line): Likewise. (dump_reloc_set): Likewise. * srconv.c (main): Likewise. * wrstabs.c (stab_lineno): Likewise. ChangeLog gas/ 2011-02-28 Kai Tietz <kai.tietz@onevision.com> * depend.c (register_dependency): Use filename_(n)cmp. * dwarf2dbg.c (get_filenum): Likewise. * ecoff.c (add_file): Likewise. (ecoff_generate_asm_lineno): Likewise. * input-scrub.c (new_logical_line_flags): Likewise. * listing.c (file_info): Likewise. (listing_newline): Likewise. * remap.c (remap_debug_filename): Likewise. * stabs.c (generate_asm_file): Likewise. (stabs_generate_asm_lineno): Likewise.
2009-09-10 Updated soruces in binutils/* to compile cleanly with -Wc++-compat.Nick Clifton1-92/+92
* binutils/addr2line.c (slurp_symtab): Fix casts. Introduce variable minisyms to avoid aliasing varning. * binutils/ar.c: Add casts. (normalize): Use name del instead of delete. (display_target_list,display_info_table): Change loop counter variable a to int. * binutils/bucomm.c: Add casts. * binutils/debug.c: Update function to use new names. (struct debug_baseclass): Rename member from virtual to is_virtual. (struct debug_type_s,struct debug_field_s,struct debug_baseclass_s,struct debug_method_s,struct debug_method_variant_s,struct debug_type_s): Rename struct from avoid name collision. * /binutils/debug.h: Use new struct names. * binutils/dwarf.c: Add casts. (free_debug_memory): Change loop counter variable a to int. * binutils/ieee.c: Add casts. (enum ieee_var_kind): Move to top level. (ieee_class_baseclass): Rename parameter virtual to is_virtual. (ieee_class_method_var): Rename variable virtual to is_virtual. * binutils/nm.c: Add casts. * binutils/objcopy.c: Add casts. (copy_archive): Rename variable delete to del. * binutils/objdump.c: Add casts. (dump_dwarf_section): Change loop counter variable i to int. * binutils/prdbg.c: Add casts. (pr_class_baseclass,tg_class_baseclass): Rename parameters virtual to is_virtual. * binutils/readelf.c: Add casts. (struct ia64_unw_table_entry,struct hppa_unw_table_entry): Move to top level. * binutils/size.c: Add casts. * binutils/stabs.c (parse_stab_type, parse_stab_range_type) (parse_stab_cpp_abbrev): Rename parameter from typename to type_name. (parse_stab_baseclasses): Rename variable virtual to is_virtual. * binutils/strings.c: Add casts. * binutils/wrstabs.c (stab_class_baseclass): Rename parameter virtual to is_virtual.
2009-09-02update copyright datesAlan Modra1-1/+1
2007-07-05Change sources over to using GPLv3Nick Clifton1-1/+2
2007-04-26bfd/Alan Modra1-4/+2
Many files: Include sysdep.h before bfd.h. * Makefile.am: Run "make dep-am". * Makefile.in: Regenerate. binutils/ * bucumm.h: Split off host dependencies to.. * sysdep.h: ..here. Many files: Include sysdep.h. Remove duplicate headers and reorder. * Makefile.am: Run "make dep-am". * Makefile.in: Regenerate. ld/ Many files: Include sysdep.h first. Remove duplicate headers. * Makefile.am: Run "make dep-am". * Makefile.in: Regenerate. opcodes/ * Makefile.am: Run "make dep-am". * Makefile.in: Regenerate. * ns32k-dis.c: Include sysdep.h first.
2005-05-08Update FSF addressNick Clifton1-2/+2
2005-03-03update copyright datesAlan Modra1-1/+2
2003-10-27 * ChangeLog: Fix typos.Kazu Hirata1-1/+1
* ChangeLog-9197: Likewise. * ChangeLog-9899: Likewise. * NEWS: Likewise. * ar.c: Fix comment typos. * arsup.c: Likewise. * coffgrok.c: Likewise. * debug.c: Likewise. * debug.h: Likewise. * dlltool.c: Likewise. * ieee.c: Likewise. * nm.c: Likewise. * objdump.c: Likewise. * prdbg.c: Likewise. * readelf.c: Likewise. * resrc.c: Likewise. * sysinfo.y: Likewise. * windres.c: Likewise.
2003-09-14 * addr2line.c: Convert to ISO C90 prototypes, change PTR, removeAndreas Jaeger1-347/+164
unneeded (void *) casts. * ar.c: Likewise. * arlex.l: Likewise. * arparse.y: Likewise. * arsup.c: Likewise. * binemul.c: Likewise. * binemul.h: Likewise. * bucomm.c: Likewise. * bucomm.h: Likewise. * budbg.h: Likewise. * budemang.c: Likewise. * budemang.h: Likewise. * coffdump.c: Likewise. * coffgrok.c: Likewise. * cxxfilt.c: Likewise. * debug.c: Likewise. * debug.h: Likewise. * deflex.l: Likewise. * dlltool.c: Likewise. * dlltool.h: Likewise. * dllwrap.c: Likewise. * emul_aix.c: Likewise. * filemode.c: Likewise. * ieee.c: Likewise. * nlmconv.c: Likewise. * nlmconv.h: Likewise. * nlmheader.y: Likewise. * nm.c: Likewise. * prdbg.c: Likewise. * rclex.l: Likewise. * rcparse.y: Likewise. * rdcoff.c: Likewise. * rddbg.c: Likewise. * rename.c: Likewise. * resbin.c: Likewise. * rescoff.c: Likewise. * resrc.c: Likewise. * size.c: Likewise. * srconv.c: Likewise. * stabs.c: Likewise. * strings.c: Likewise. * sysdump.c: Likewise. * sysinfo.y: Likewise. * syslex.l: Likewise. * unwind-ia64.c: Likewise. * unwind-ia64.h: Likewise. * version.c: Likewise. * windres.c: Likewise. * windres.h: Likewise. * winduni.c: Likewise. * wrstabs.c: Likewise.
2003-05-12Extend test for circualr debug references.Nick Clifton1-1/+1
2003-02-13Handle global register vairables.Nick Clifton1-18/+17
2002-11-30s/boolean/bfd_boolean/ s/true/TRUE/ s/false/FALSE/. SimplifyAlan Modra1-198/+199
comparisons of bfd_boolean vars with TRUE/FALSE. Formatting.
2002-05-27Fix transaltion problems.Nick Clifton1-2/+2
2002-05-26 * arsup.c: Remove ARGSUSED.Kazu Hirata1-12/+0
* debug.c: Likewise. * ieee.c: Likewise. * nlmconv.c: Likewise. * prdbg.c: Likewise. * stabs.c: Likewise. * wrstabs.c: Likewise.
2002-05-20 * debug.c: Fix formatting.Kazu Hirata1-5/+5
* debug.h: Likewise. * dlltool.c: Likewise. * dllwrap.c: Likewise. * emul_aix.c: Likewise. * emul_vanilla.c: Likewise.
2001-03-13Fix typos in ChangeLogs and update copyright noticesNick Clifton1-1/+1
2000-01-14Correct function return types for new and fussy gcc.Alan Modra1-2/+2
1999-07-11 * Many files: Changes to avoid gcc warnings: Add ATTRIBUTE_UNUSEDIan Lance Taylor1-26/+25
as appropriate. Add variable initializations. Add casts. * objdump.c (disassemble_bytes): Change j to bfd_vma. * readelf.c (process_syminfo): Change i to unsigned int. (display_debug_info): Change abbrev_number to unsigned long. (process_mips_specific): Change fcnt to size_t.
1999-05-0319990502 sourceware importbinu_ss_19990502Richard Henderson1-0/+3568