Age | Commit message (Collapse) | Author | Files | Lines |
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
PR 28718
* debug.c (debug_write_type): Allow for malicious recursion via
indirect debug types.
|
|
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.
|
|
Typo fix, obviously should be m1->variants != NULL, not
m1->variants == NULL.
PR 28250
* debug.c (debug_class_type_samep): Correct m1->variants test.
|
|
* 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.
|
|
|
|
PR 25840
* debug.c (debug_class_type_samep): Don't segfault on NULL type.
|
|
|
|
PR 24938
* debug.c (debug_write_type): Call empty_type for NULL type here..
(debug_write_type): ..rather than in just one case here.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* debug.c (debug_type_samep): Add missing break statement.
|
|
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.
|
|
* 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.
|
|
|
|
|
|
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.
|
|
|
|
|
|
* 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.
|
|
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.
|
|
|
|
|
|
comparisons of bfd_boolean vars with TRUE/FALSE. Formatting.
|
|
|
|
* debug.c: Likewise.
* ieee.c: Likewise.
* nlmconv.c: Likewise.
* prdbg.c: Likewise.
* stabs.c: Likewise.
* wrstabs.c: Likewise.
|
|
* debug.h: Likewise.
* dlltool.c: Likewise.
* dllwrap.c: Likewise.
* emul_aix.c: Likewise.
* emul_vanilla.c: Likewise.
|
|
|
|
|
|
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.
|
|
|