Add casts to memory allocation related calls

Most allocation functions (if not all) return a void* pointing to the
allocated memory.  In C++, we need to add an explicit cast when
assigning the result to a pointer to another type (which is the case
more often than not).

The content of this patch is taken from Pedro's branch, from commit
"(mostly) auto-generated patch to insert casts needed for C++".  I
validated that the changes make sense and manually reflowed the code to
make it respect the coding style.  I also found multiple places where I
could use XNEW/XNEWVEC/XRESIZEVEC/etc.

Thanks a lot to whoever did that automated script to insert casts, doing
it completely by hand would have taken a ridiculous amount of time.

Only files built on x86 with --enable-targets=all are modified.  This
means that all other -nat.c files are untouched and will have to be
dealt with later by using appropiate compilers.  Or maybe we can try to
build them with a regular g++ just to know where to add casts, I don't
know.

I built-tested this with --enable-targets=all and reg-tested.

Here's the changelog entry, which was not too bad to make despite the
size, thanks to David Malcom's script.  I fixed some bits by hand, but
there might be some wrong parts left (hopefully not).

gdb/ChangeLog:

	* aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Add cast
	to allocation result assignment.
	* ada-exp.y (write_object_renaming): Likewise.
	(write_ambiguous_var): Likewise.
	(ada_nget_field_index): Likewise.
	(write_var_or_type): Likewise.
	* ada-lang.c (ada_decode_symbol): Likewise.
	(ada_value_assign): Likewise.
	(value_pointer): Likewise.
	(cache_symbol): Likewise.
	(add_nonlocal_symbols): Likewise.
	(ada_name_for_lookup): Likewise.
	(symbol_completion_add): Likewise.
	(ada_to_fixed_type_1): Likewise.
	(ada_get_next_arg): Likewise.
	(defns_collected): Likewise.
	* ada-lex.l (processId): Likewise.
	(processString): Likewise.
	* ada-tasks.c (read_known_tasks_array): Likewise.
	(read_known_tasks_list): Likewise.
	* ada-typeprint.c (decoded_type_name): Likewise.
	* addrmap.c (addrmap_mutable_create_fixed): Likewise.
	* amd64-tdep.c (amd64_push_arguments): Likewise.
	(amd64_displaced_step_copy_insn): Likewise.
	(amd64_classify_insn_at): Likewise.
	(amd64_relocate_instruction): Likewise.
	* amd64obsd-tdep.c (amd64obsd_sigtramp_p): Likewise.
	* arch-utils.c (simple_displaced_step_copy_insn): Likewise.
	(initialize_current_architecture): Likewise.
	* arm-linux-tdep.c (arm_stap_parse_special_token): Likewise.
	* arm-symbian-tdep.c (arm_symbian_osabi_sniffer): Likewise.
	* arm-tdep.c (arm_exidx_new_objfile): Likewise.
	(arm_push_dummy_call): Likewise.
	(extend_buffer_earlier): Likewise.
	(arm_adjust_breakpoint_address): Likewise.
	(arm_skip_stub): Likewise.
	* auto-load.c (filename_is_in_pattern): Likewise.
	(maybe_add_script_file): Likewise.
	(maybe_add_script_text): Likewise.
	(auto_load_objfile_script_1): Likewise.
	* auxv.c (ld_so_xfer_auxv): Likewise.
	* ax-general.c (new_agent_expr): Likewise.
	(grow_expr): Likewise.
	(ax_reg_mask): Likewise.
	* bcache.c (bcache_full): Likewise.
	* breakpoint.c (program_breakpoint_here_p): Likewise.
	* btrace.c (parse_xml_raw): Likewise.
	* build-id.c (build_id_to_debug_bfd): Likewise.
	* buildsym.c (end_symtab_with_blockvector): Likewise.
	* c-exp.y (string_exp): Likewise.
	(qualified_name): Likewise.
	(write_destructor_name): Likewise.
	(operator_stoken): Likewise.
	(parse_number): Likewise.
	(scan_macro_expansion): Likewise.
	(yylex): Likewise.
	(c_print_token): Likewise.
	* c-lang.c (c_get_string): Likewise.
	(emit_numeric_character): Likewise.
	* charset.c (wchar_iterate): Likewise.
	* cli/cli-cmds.c (complete_command): Likewise.
	(make_command): Likewise.
	* cli/cli-dump.c (restore_section_callback): Likewise.
	(restore_binary_file): Likewise.
	* cli/cli-interp.c (cli_interpreter_exec): Likewise.
	* cli/cli-script.c (execute_control_command): Likewise.
	* cli/cli-setshow.c (do_set_command): Likewise.
	* coff-pe-read.c (add_pe_forwarded_sym): Likewise.
	(read_pe_exported_syms): Likewise.
	* coffread.c (coff_read_struct_type): Likewise.
	(coff_read_enum_type): Likewise.
	* common/btrace-common.c (btrace_data_append): Likewise.
	* common/buffer.c (buffer_grow): Likewise.
	* common/filestuff.c (gdb_fopen_cloexec): Likewise.
	* common/format.c (parse_format_string): Likewise.
	* common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise.
	* common/xml-utils.c (xml_escape_text): Likewise.
	* compile/compile-object-load.c (copy_sections): Likewise.
	(compile_object_load): Likewise.
	* compile/compile-object-run.c (compile_object_run): Likewise.
	* completer.c (filename_completer): Likewise.
	* corefile.c (read_memory_typed_address): Likewise.
	(write_memory_unsigned_integer): Likewise.
	(write_memory_signed_integer): Likewise.
	(complete_set_gnutarget): Likewise.
	* corelow.c (get_core_register_section): Likewise.
	* cp-name-parser.y (d_grab): Likewise.
	(allocate_info): Likewise.
	(cp_new_demangle_parse_info): Likewise.
	* cp-namespace.c (cp_scan_for_anonymous_namespaces): Likewise.
	(cp_lookup_symbol_in_namespace): Likewise.
	(lookup_namespace_scope): Likewise.
	(find_symbol_in_baseclass): Likewise.
	(cp_lookup_nested_symbol): Likewise.
	(cp_lookup_transparent_type_loop): Likewise.
	* cp-support.c (copy_string_to_obstack): Likewise.
	(make_symbol_overload_list): Likewise.
	(make_symbol_overload_list_namespace): Likewise.
	(make_symbol_overload_list_adl_namespace): Likewise.
	(first_component_command): Likewise.
	* cp-valprint.c (cp_print_value): Likewise.
	* ctf.c (ctf_xfer_partial): Likewise.
	* d-exp.y (StringExp): Likewise.
	* d-namespace.c (d_lookup_symbol_in_module): Likewise.
	(lookup_module_scope): Likewise.
	(find_symbol_in_baseclass): Likewise.
	(d_lookup_nested_symbol): Likewise.
	* dbxread.c (find_stab_function_addr): Likewise.
	(read_dbx_symtab): Likewise.
	(dbx_end_psymtab): Likewise.
	(cp_set_block_scope): Likewise.
	* dcache.c (dcache_alloc): Likewise.
	* demangle.c (_initialize_demangler): Likewise.
	* dicos-tdep.c (dicos_load_module_p): Likewise.
	* dictionary.c (dict_create_hashed_expandable): Likewise.
	(dict_create_linear_expandable): Likewise.
	(expand_hashtable): Likewise.
	(add_symbol_linear_expandable): Likewise.
	* dwarf2-frame.c (add_cie): Likewise.
	(add_fde): Likewise.
	(dwarf2_build_frame_info): Likewise.
	* dwarf2expr.c (dwarf_expr_grow_stack): Likewise.
	(dwarf_expr_fetch_address): Likewise.
	(add_piece): Likewise.
	(execute_stack_op): Likewise.
	* dwarf2loc.c (chain_candidate): Likewise.
	(dwarf_entry_parameter_to_value): Likewise.
	(read_pieced_value): Likewise.
	(write_pieced_value): Likewise.
	* dwarf2read.c (dwarf2_read_section): Likewise.
	(add_type_unit): Likewise.
	(read_comp_units_from_section): Likewise.
	(fixup_go_packaging): Likewise.
	(dwarf2_compute_name): Likewise.
	(dwarf2_physname): Likewise.
	(create_dwo_unit_in_dwp_v1): Likewise.
	(create_dwo_unit_in_dwp_v2): Likewise.
	(read_func_scope): Likewise.
	(read_call_site_scope): Likewise.
	(dwarf2_attach_fields_to_type): Likewise.
	(process_structure_scope): Likewise.
	(mark_common_block_symbol_computed): Likewise.
	(read_common_block): Likewise.
	(abbrev_table_read_table): Likewise.
	(guess_partial_die_structure_name): Likewise.
	(fixup_partial_die): Likewise.
	(add_file_name): Likewise.
	(dwarf2_const_value_data): Likewise.
	(dwarf2_const_value_attr): Likewise.
	(build_error_marker_type): Likewise.
	(guess_full_die_structure_name): Likewise.
	(anonymous_struct_prefix): Likewise.
	(typename_concat): Likewise.
	(dwarf2_canonicalize_name): Likewise.
	(dwarf2_name): Likewise.
	(write_constant_as_bytes): Likewise.
	(dwarf2_fetch_constant_bytes): Likewise.
	(copy_string): Likewise.
	(parse_macro_definition): Likewise.
	* elfread.c (elf_symfile_segments): Likewise.
	(elf_rel_plt_read): Likewise.
	(elf_gnu_ifunc_resolve_by_cache): Likewise.
	(elf_gnu_ifunc_resolve_by_got): Likewise.
	(elf_read_minimal_symbols): Likewise.
	(elf_gnu_ifunc_record_cache): Likewise.
	* event-top.c (top_level_prompt): Likewise.
	(command_line_handler): Likewise.
	* exec.c (resize_section_table): Likewise.
	* expprint.c (print_subexp_standard): Likewise.
	* fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise.
	* findcmd.c (parse_find_args): Likewise.
	* findvar.c (address_from_register): Likewise.
	* frame.c (get_prev_frame_always): Likewise.
	* gdb_bfd.c (gdb_bfd_ref): Likewise.
	(get_section_descriptor): Likewise.
	* gdb_obstack.c (obconcat): Likewise.
	(obstack_strdup): Likewise.
	* gdbtypes.c (lookup_function_type_with_arguments): Likewise.
	(create_set_type): Likewise.
	(lookup_unsigned_typename): Likewise.
	(lookup_signed_typename): Likewise.
	(resolve_dynamic_union): Likewise.
	(resolve_dynamic_struct): Likewise.
	(add_dyn_prop): Likewise.
	(copy_dynamic_prop_list): Likewise.
	(arch_flags_type): Likewise.
	(append_composite_type_field_raw): Likewise.
	* gdbtypes.h (INIT_FUNC_SPECIFIC): Likewise.
	* gnu-v3-abi.c (gnuv3_rtti_type): Likewise.
	* go-exp.y (string_exp): Likewise.
	* go-lang.c (go_demangle): Likewise.
	* guile/guile.c (compute_scheme_string): Likewise.
	* guile/scm-cmd.c (gdbscm_parse_command_name): Likewise.
	(gdbscm_canonicalize_command_name): Likewise.
	* guile/scm-ports.c (ioscm_init_stdio_buffers): Likewise.
	(ioscm_init_memory_port): Likewise.
	(ioscm_reinit_memory_port): Likewise.
	* guile/scm-utils.c (gdbscm_gc_xstrdup): Likewise.
	(gdbscm_gc_dup_argv): Likewise.
	* h8300-tdep.c (h8300_push_dummy_call): Likewise.
	* hppa-tdep.c (internalize_unwinds): Likewise.
	(read_unwind_info): Likewise.
	* i386-cygwin-tdep.c (core_process_module_section): Likewise.
	(windows_core_xfer_shared_libraries): Likewise.
	* i386-tdep.c (i386_displaced_step_copy_insn): Likewise.
	(i386_stap_parse_special_token_triplet): Likewise.
	(i386_stap_parse_special_token_three_arg_disp): Likewise.
	* i386obsd-tdep.c (i386obsd_sigtramp_p): Likewise.
	* inf-child.c (inf_child_fileio_readlink): Likewise.
	* inf-ptrace.c (inf_ptrace_fetch_register): Likewise.
	(inf_ptrace_store_register): Likewise.
	* infrun.c (follow_exec): Likewise.
	(displaced_step_prepare_throw): Likewise.
	(save_stop_context): Likewise.
	(save_infcall_suspend_state): Likewise.
	* jit.c (jit_read_descriptor): Likewise.
	(jit_read_code_entry): Likewise.
	(jit_symtab_line_mapping_add_impl): Likewise.
	(finalize_symtab): Likewise.
	(jit_unwind_reg_get_impl): Likewise.
	* jv-exp.y (QualifiedName): Likewise.
	* jv-lang.c (get_java_utf8_name): Likewise.
	(type_from_class): Likewise.
	(java_demangle_type_signature): Likewise.
	(java_class_name_from_physname): Likewise.
	* jv-typeprint.c (java_type_print_base): Likewise.
	* jv-valprint.c (java_value_print): Likewise.
	* language.c (add_language): Likewise.
	* linespec.c (add_sal_to_sals_basic): Likewise.
	(add_sal_to_sals): Likewise.
	(decode_objc): Likewise.
	(find_linespec_symbols): Likewise.
	* linux-fork.c (fork_save_infrun_state): Likewise.
	* linux-nat.c (linux_nat_detach): Likewise.
	(linux_nat_fileio_readlink): Likewise.
	* linux-record.c (record_linux_sockaddr): Likewise.
	(record_linux_msghdr): Likewise.
	(Do): Likewise.
	* linux-tdep.c (linux_core_info_proc_mappings): Likewise.
	(linux_collect_regset_section_cb): Likewise.
	(linux_get_siginfo_data): Likewise.
	* linux-thread-db.c (try_thread_db_load_from_pdir_1): Likewise.
	(try_thread_db_load_from_dir): Likewise.
	(thread_db_load_search): Likewise.
	(info_auto_load_libthread_db): Likewise.
	* m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise.
	(m32c_m16c_pointer_to_address): Likewise.
	* m68hc11-tdep.c (m68hc11_pseudo_register_write): Likewise.
	* m68k-tdep.c (m68k_get_longjmp_target): Likewise.
	* machoread.c (macho_check_dsym): Likewise.
	* macroexp.c (resize_buffer): Likewise.
	(gather_arguments): Likewise.
	(maybe_expand): Likewise.
	* macrotab.c (new_macro_key): Likewise.
	(new_source_file): Likewise.
	(new_macro_definition): Likewise.
	* mdebugread.c (parse_symbol): Likewise.
	(parse_type): Likewise.
	(parse_partial_symbols): Likewise.
	(psymtab_to_symtab_1): Likewise.
	* mem-break.c (default_memory_insert_breakpoint): Likewise.
	* mi/mi-cmd-break.c (mi_argv_to_format): Likewise.
	* mi/mi-main.c (mi_cmd_data_read_memory): Likewise.
	(mi_cmd_data_read_memory_bytes): Likewise.
	(mi_cmd_data_write_memory_bytes): Likewise.
	(mi_cmd_trace_frame_collected): Likewise.
	* mi/mi-parse.c (mi_parse_argv): Likewise.
	(mi_parse): Likewise.
	* minidebug.c (lzma_open): Likewise.
	(lzma_pread): Likewise.
	* mips-tdep.c (mips_read_fp_register_single): Likewise.
	(mips_print_fp_register): Likewise.
	* mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise.
	* mipsread.c (read_alphacoff_dynamic_symtab): Likewise.
	* mt-tdep.c (mt_register_name): Likewise.
	(mt_registers_info): Likewise.
	(mt_push_dummy_call): Likewise.
	* namespace.c (add_using_directive): Likewise.
	* nat/linux-btrace.c (perf_event_read): Likewise.
	(linux_enable_bts): Likewise.
	* nat/linux-osdata.c (linux_common_core_of_thread): Likewise.
	* nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Likewise.
	* nto-tdep.c (nto_find_and_open_solib): Likewise.
	(nto_parse_redirection): Likewise.
	* objc-lang.c (objc_demangle): Likewise.
	(find_methods): Likewise.
	* objfiles.c (get_objfile_bfd_data): Likewise.
	(set_objfile_main_name): Likewise.
	(allocate_objfile): Likewise.
	(objfile_relocate): Likewise.
	(update_section_map): Likewise.
	* osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise.
	* p-exp.y (exp): Likewise.
	(yylex): Likewise.
	* p-valprint.c (pascal_object_print_value): Likewise.
	* parse.c (initialize_expout): Likewise.
	(mark_completion_tag): Likewise.
	(copy_name): Likewise.
	(parse_float): Likewise.
	(type_stack_reserve): Likewise.
	* ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise.
	(ppu2spu_prev_register): Likewise.
	* ppc-ravenscar-thread.c (supply_register_at_address): Likewise.
	* printcmd.c (printf_wide_c_string): Likewise.
	(printf_pointer): Likewise.
	* probe.c (parse_probes): Likewise.
	* python/py-cmd.c (gdbpy_parse_command_name): Likewise.
	(cmdpy_init): Likewise.
	* python/py-gdb-readline.c (gdbpy_readline_wrapper): Likewise.
	* python/py-symtab.c (set_sal): Likewise.
	* python/py-unwind.c (pyuw_sniffer): Likewise.
	* python/python.c (python_interactive_command): Likewise.
	(compute_python_string): Likewise.
	* ravenscar-thread.c (get_running_thread_id): Likewise.
	* record-full.c (record_full_exec_insn): Likewise.
	(record_full_core_open_1): Likewise.
	* regcache.c (regcache_raw_read_signed): Likewise.
	(regcache_raw_read_unsigned): Likewise.
	(regcache_cooked_read_signed): Likewise.
	(regcache_cooked_read_unsigned): Likewise.
	* remote-fileio.c (remote_fileio_func_open): Likewise.
	(remote_fileio_func_rename): Likewise.
	(remote_fileio_func_unlink): Likewise.
	(remote_fileio_func_stat): Likewise.
	(remote_fileio_func_system): Likewise.
	* remote-mips.c (mips_xfer_memory): Likewise.
	(mips_load_srec): Likewise.
	(pmon_end_download): Likewise.
	* remote.c (new_remote_state): Likewise.
	(map_regcache_remote_table): Likewise.
	(remote_register_number_and_offset): Likewise.
	(init_remote_state): Likewise.
	(get_memory_packet_size): Likewise.
	(remote_pass_signals): Likewise.
	(remote_program_signals): Likewise.
	(remote_start_remote): Likewise.
	(remote_check_symbols): Likewise.
	(remote_query_supported): Likewise.
	(extended_remote_attach): Likewise.
	(process_g_packet): Likewise.
	(store_registers_using_G): Likewise.
	(putpkt_binary): Likewise.
	(read_frame): Likewise.
	(compare_sections_command): Likewise.
	(remote_hostio_pread): Likewise.
	(remote_hostio_readlink): Likewise.
	(remote_file_put): Likewise.
	(remote_file_get): Likewise.
	(remote_pid_to_exec_file): Likewise.
	(_initialize_remote): Likewise.
	* rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise.
	(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
	* rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise.
	(bfd_uses_spe_extensions): Likewise.
	* s390-linux-tdep.c (s390_displaced_step_copy_insn): Likewise.
	* score-tdep.c (score7_malloc_and_get_memblock): Likewise.
	* solib-dsbt.c (decode_loadmap): Likewise.
	(fetch_loadmap): Likewise.
	(scan_dyntag): Likewise.
	(enable_break): Likewise.
	(dsbt_relocate_main_executable): Likewise.
	* solib-frv.c (fetch_loadmap): Likewise.
	(enable_break2): Likewise.
	(frv_relocate_main_executable): Likewise.
	* solib-spu.c (spu_relocate_main_executable): Likewise.
	(spu_bfd_open): Likewise.
	* solib-svr4.c (lm_info_read): Likewise.
	(read_program_header): Likewise.
	(find_program_interpreter): Likewise.
	(scan_dyntag): Likewise.
	(elf_locate_base): Likewise.
	(open_symbol_file_object): Likewise.
	(read_program_headers_from_bfd): Likewise.
	(svr4_relocate_main_executable): Likewise.
	* solib-target.c (solib_target_relocate_section_addresses): Likewise.
	* solib.c (solib_find_1): Likewise.
	(exec_file_find): Likewise.
	(solib_find): Likewise.
	* source.c (openp): Likewise.
	(print_source_lines_base): Likewise.
	(forward_search_command): Likewise.
	* sparc-ravenscar-thread.c (supply_register_at_address): Likewise.
	* spu-tdep.c (spu2ppu_prev_register): Likewise.
	(spu_get_overlay_table): Likewise.
	* stabsread.c (patch_block_stabs): Likewise.
	(define_symbol): Likewise.
	(again:): Likewise.
	(read_member_functions): Likewise.
	(read_one_struct_field): Likewise.
	(read_enum_type): Likewise.
	(common_block_start): Likewise.
	* stack.c (read_frame_arg): Likewise.
	(backtrace_command): Likewise.
	* stap-probe.c (stap_parse_register_operand): Likewise.
	* symfile.c (syms_from_objfile_1): Likewise.
	(find_separate_debug_file): Likewise.
	(load_command): Likewise.
	(load_progress): Likewise.
	(load_section_callback): Likewise.
	(reread_symbols): Likewise.
	(add_filename_language): Likewise.
	(allocate_compunit_symtab): Likewise.
	(read_target_long_array): Likewise.
	(simple_read_overlay_table): Likewise.
	* symtab.c (symbol_set_names): Likewise.
	(resize_symbol_cache): Likewise.
	(rbreak_command): Likewise.
	(completion_list_add_name): Likewise.
	(completion_list_objc_symbol): Likewise.
	(add_filename_to_list): Likewise.
	* target-descriptions.c (maint_print_c_tdesc_cmd): Likewise.
	* target-memory.c (target_write_memory_blocks): Likewise.
	* target.c (target_read_string): Likewise.
	(read_whatever_is_readable): Likewise.
	(target_read_alloc_1): Likewise.
	(simple_search_memory): Likewise.
	(target_fileio_read_alloc_1): Likewise.
	* tilegx-tdep.c (tilegx_push_dummy_call): Likewise.
	* top.c (command_line_input): Likewise.
	* tracefile-tfile.c (tfile_fetch_registers): Likewise.
	* tracefile.c (tracefile_fetch_registers): Likewise.
	* tracepoint.c (add_memrange): Likewise.
	(init_collection_list): Likewise.
	(add_aexpr): Likewise.
	(trace_dump_actions): Likewise.
	(parse_trace_status): Likewise.
	(parse_tracepoint_definition): Likewise.
	(parse_tsv_definition): Likewise.
	(parse_static_tracepoint_marker_definition): Likewise.
	* tui/tui-file.c (tui_sfileopen): Likewise.
	(tui_file_adjust_strbuf): Likewise.
	* tui/tui-io.c (tui_expand_tabs): Likewise.
	* tui/tui-source.c (tui_set_source_content): Likewise.
	* typeprint.c (find_global_typedef): Likewise.
	* ui-file.c (do_ui_file_xstrdup): Likewise.
	(ui_file_obsavestring): Likewise.
	(mem_file_write): Likewise.
	* utils.c (make_hex_string): Likewise.
	(get_regcomp_error): Likewise.
	(puts_filtered_tabular): Likewise.
	(gdb_realpath_keepfile): Likewise.
	(ldirname): Likewise.
	(gdb_bfd_errmsg): Likewise.
	(substitute_path_component): Likewise.
	* valops.c (search_struct_method): Likewise.
	(find_oload_champ_namespace_loop): Likewise.
	* valprint.c (print_decimal_chars): Likewise.
	(read_string): Likewise.
	(generic_emit_char): Likewise.
	* varobj.c (varobj_delete): Likewise.
	(varobj_value_get_print_value): Likewise.
	* vaxobsd-tdep.c (vaxobsd_sigtramp_sniffer): Likewise.
	* windows-tdep.c (display_one_tib): Likewise.
	* xcoffread.c (read_xcoff_symtab): Likewise.
	(process_xcoff_symbol): Likewise.
	(swap_sym): Likewise.
	(scan_xcoff_symtab): Likewise.
	(xcoff_initial_scan): Likewise.
	* xml-support.c (gdb_xml_end_element): Likewise.
	(xml_process_xincludes): Likewise.
	(xml_fetch_content_from_file): Likewise.
	* xml-syscall.c (xml_list_of_syscalls): Likewise.
	* xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise.

gdb/gdbserver/ChangeLog:

	* ax.c (gdb_parse_agent_expr): Add cast to allocation result
	assignment.
	(gdb_unparse_agent_expr): Likewise.
	* hostio.c (require_data): Likewise.
	(handle_pread): Likewise.
	* linux-low.c (disable_regset): Likewise.
	(fetch_register): Likewise.
	(store_register): Likewise.
	(get_dynamic): Likewise.
	(linux_qxfer_libraries_svr4): Likewise.
	* mem-break.c (delete_fast_tracepoint_jump): Likewise.
	(set_fast_tracepoint_jump): Likewise.
	(uninsert_fast_tracepoint_jumps_at): Likewise.
	(reinsert_fast_tracepoint_jumps_at): Likewise.
	(validate_inserted_breakpoint): Likewise.
	(clone_agent_expr): Likewise.
	* regcache.c (init_register_cache): Likewise.
	* remote-utils.c (putpkt_binary_1): Likewise.
	(decode_M_packet): Likewise.
	(decode_X_packet): Likewise.
	(look_up_one_symbol): Likewise.
	(relocate_instruction): Likewise.
	(monitor_output): Likewise.
	* server.c (handle_search_memory): Likewise.
	(handle_qxfer_exec_file): Likewise.
	(handle_qxfer_libraries): Likewise.
	(handle_qxfer): Likewise.
	(handle_query): Likewise.
	(handle_v_cont): Likewise.
	(handle_v_run): Likewise.
	(captured_main): Likewise.
	* target.c (write_inferior_memory): Likewise.
	* thread-db.c (try_thread_db_load_from_dir): Likewise.
	* tracepoint.c (init_trace_buffer): Likewise.
	(add_tracepoint_action): Likewise.
	(add_traceframe): Likewise.
	(add_traceframe_block): Likewise.
	(cmd_qtdpsrc): Likewise.
	(cmd_qtdv): Likewise.
	(cmd_qtstatus): Likewise.
	(response_source): Likewise.
	(response_tsv): Likewise.
	(cmd_qtnotes): Likewise.
	(gdb_collect): Likewise.
	(initialize_tracepoint): Likewise.
This commit is contained in:
Simon Marchi 2015-09-25 14:08:06 -04:00
parent 8e394ffc7a
commit 224c3ddb89
192 changed files with 1411 additions and 796 deletions

View file

@ -1,3 +1,469 @@
2015-09-25 Simon Marchi <simon.marchi@ericsson.com>
* aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Add cast
to allocation result assignment.
* ada-exp.y (write_object_renaming): Likewise.
(write_ambiguous_var): Likewise.
(ada_nget_field_index): Likewise.
(write_var_or_type): Likewise.
* ada-lang.c (ada_decode_symbol): Likewise.
(ada_value_assign): Likewise.
(value_pointer): Likewise.
(cache_symbol): Likewise.
(add_nonlocal_symbols): Likewise.
(ada_name_for_lookup): Likewise.
(symbol_completion_add): Likewise.
(ada_to_fixed_type_1): Likewise.
(ada_get_next_arg): Likewise.
(defns_collected): Likewise.
* ada-lex.l (processId): Likewise.
(processString): Likewise.
* ada-tasks.c (read_known_tasks_array): Likewise.
(read_known_tasks_list): Likewise.
* ada-typeprint.c (decoded_type_name): Likewise.
* addrmap.c (addrmap_mutable_create_fixed): Likewise.
* amd64-tdep.c (amd64_push_arguments): Likewise.
(amd64_displaced_step_copy_insn): Likewise.
(amd64_classify_insn_at): Likewise.
(amd64_relocate_instruction): Likewise.
* amd64obsd-tdep.c (amd64obsd_sigtramp_p): Likewise.
* arch-utils.c (simple_displaced_step_copy_insn): Likewise.
(initialize_current_architecture): Likewise.
* arm-linux-tdep.c (arm_stap_parse_special_token): Likewise.
* arm-symbian-tdep.c (arm_symbian_osabi_sniffer): Likewise.
* arm-tdep.c (arm_exidx_new_objfile): Likewise.
(arm_push_dummy_call): Likewise.
(extend_buffer_earlier): Likewise.
(arm_adjust_breakpoint_address): Likewise.
(arm_skip_stub): Likewise.
* auto-load.c (filename_is_in_pattern): Likewise.
(maybe_add_script_file): Likewise.
(maybe_add_script_text): Likewise.
(auto_load_objfile_script_1): Likewise.
* auxv.c (ld_so_xfer_auxv): Likewise.
* ax-general.c (new_agent_expr): Likewise.
(grow_expr): Likewise.
(ax_reg_mask): Likewise.
* bcache.c (bcache_full): Likewise.
* breakpoint.c (program_breakpoint_here_p): Likewise.
* btrace.c (parse_xml_raw): Likewise.
* build-id.c (build_id_to_debug_bfd): Likewise.
* buildsym.c (end_symtab_with_blockvector): Likewise.
* c-exp.y (string_exp): Likewise.
(qualified_name): Likewise.
(write_destructor_name): Likewise.
(operator_stoken): Likewise.
(parse_number): Likewise.
(scan_macro_expansion): Likewise.
(yylex): Likewise.
(c_print_token): Likewise.
* c-lang.c (c_get_string): Likewise.
(emit_numeric_character): Likewise.
* charset.c (wchar_iterate): Likewise.
* cli/cli-cmds.c (complete_command): Likewise.
(make_command): Likewise.
* cli/cli-dump.c (restore_section_callback): Likewise.
(restore_binary_file): Likewise.
* cli/cli-interp.c (cli_interpreter_exec): Likewise.
* cli/cli-script.c (execute_control_command): Likewise.
* cli/cli-setshow.c (do_set_command): Likewise.
* coff-pe-read.c (add_pe_forwarded_sym): Likewise.
(read_pe_exported_syms): Likewise.
* coffread.c (coff_read_struct_type): Likewise.
(coff_read_enum_type): Likewise.
* common/btrace-common.c (btrace_data_append): Likewise.
* common/buffer.c (buffer_grow): Likewise.
* common/filestuff.c (gdb_fopen_cloexec): Likewise.
* common/format.c (parse_format_string): Likewise.
* common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise.
* common/xml-utils.c (xml_escape_text): Likewise.
* compile/compile-object-load.c (copy_sections): Likewise.
(compile_object_load): Likewise.
* compile/compile-object-run.c (compile_object_run): Likewise.
* completer.c (filename_completer): Likewise.
* corefile.c (read_memory_typed_address): Likewise.
(write_memory_unsigned_integer): Likewise.
(write_memory_signed_integer): Likewise.
(complete_set_gnutarget): Likewise.
* corelow.c (get_core_register_section): Likewise.
* cp-name-parser.y (d_grab): Likewise.
(allocate_info): Likewise.
(cp_new_demangle_parse_info): Likewise.
* cp-namespace.c (cp_scan_for_anonymous_namespaces): Likewise.
(cp_lookup_symbol_in_namespace): Likewise.
(lookup_namespace_scope): Likewise.
(find_symbol_in_baseclass): Likewise.
(cp_lookup_nested_symbol): Likewise.
(cp_lookup_transparent_type_loop): Likewise.
* cp-support.c (copy_string_to_obstack): Likewise.
(make_symbol_overload_list): Likewise.
(make_symbol_overload_list_namespace): Likewise.
(make_symbol_overload_list_adl_namespace): Likewise.
(first_component_command): Likewise.
* cp-valprint.c (cp_print_value): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* d-exp.y (StringExp): Likewise.
* d-namespace.c (d_lookup_symbol_in_module): Likewise.
(lookup_module_scope): Likewise.
(find_symbol_in_baseclass): Likewise.
(d_lookup_nested_symbol): Likewise.
* dbxread.c (find_stab_function_addr): Likewise.
(read_dbx_symtab): Likewise.
(dbx_end_psymtab): Likewise.
(cp_set_block_scope): Likewise.
* dcache.c (dcache_alloc): Likewise.
* demangle.c (_initialize_demangler): Likewise.
* dicos-tdep.c (dicos_load_module_p): Likewise.
* dictionary.c (dict_create_hashed_expandable): Likewise.
(dict_create_linear_expandable): Likewise.
(expand_hashtable): Likewise.
(add_symbol_linear_expandable): Likewise.
* dwarf2-frame.c (add_cie): Likewise.
(add_fde): Likewise.
(dwarf2_build_frame_info): Likewise.
* dwarf2expr.c (dwarf_expr_grow_stack): Likewise.
(dwarf_expr_fetch_address): Likewise.
(add_piece): Likewise.
(execute_stack_op): Likewise.
* dwarf2loc.c (chain_candidate): Likewise.
(dwarf_entry_parameter_to_value): Likewise.
(read_pieced_value): Likewise.
(write_pieced_value): Likewise.
* dwarf2read.c (dwarf2_read_section): Likewise.
(add_type_unit): Likewise.
(read_comp_units_from_section): Likewise.
(fixup_go_packaging): Likewise.
(dwarf2_compute_name): Likewise.
(dwarf2_physname): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(read_func_scope): Likewise.
(read_call_site_scope): Likewise.
(dwarf2_attach_fields_to_type): Likewise.
(process_structure_scope): Likewise.
(mark_common_block_symbol_computed): Likewise.
(read_common_block): Likewise.
(abbrev_table_read_table): Likewise.
(guess_partial_die_structure_name): Likewise.
(fixup_partial_die): Likewise.
(add_file_name): Likewise.
(dwarf2_const_value_data): Likewise.
(dwarf2_const_value_attr): Likewise.
(build_error_marker_type): Likewise.
(guess_full_die_structure_name): Likewise.
(anonymous_struct_prefix): Likewise.
(typename_concat): Likewise.
(dwarf2_canonicalize_name): Likewise.
(dwarf2_name): Likewise.
(write_constant_as_bytes): Likewise.
(dwarf2_fetch_constant_bytes): Likewise.
(copy_string): Likewise.
(parse_macro_definition): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
(elf_rel_plt_read): Likewise.
(elf_gnu_ifunc_resolve_by_cache): Likewise.
(elf_gnu_ifunc_resolve_by_got): Likewise.
(elf_read_minimal_symbols): Likewise.
(elf_gnu_ifunc_record_cache): Likewise.
* event-top.c (top_level_prompt): Likewise.
(command_line_handler): Likewise.
* exec.c (resize_section_table): Likewise.
* expprint.c (print_subexp_standard): Likewise.
* fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise.
* findcmd.c (parse_find_args): Likewise.
* findvar.c (address_from_register): Likewise.
* frame.c (get_prev_frame_always): Likewise.
* gdb_bfd.c (gdb_bfd_ref): Likewise.
(get_section_descriptor): Likewise.
* gdb_obstack.c (obconcat): Likewise.
(obstack_strdup): Likewise.
* gdbtypes.c (lookup_function_type_with_arguments): Likewise.
(create_set_type): Likewise.
(lookup_unsigned_typename): Likewise.
(lookup_signed_typename): Likewise.
(resolve_dynamic_union): Likewise.
(resolve_dynamic_struct): Likewise.
(add_dyn_prop): Likewise.
(copy_dynamic_prop_list): Likewise.
(arch_flags_type): Likewise.
(append_composite_type_field_raw): Likewise.
* gdbtypes.h (INIT_FUNC_SPECIFIC): Likewise.
* gnu-v3-abi.c (gnuv3_rtti_type): Likewise.
* go-exp.y (string_exp): Likewise.
* go-lang.c (go_demangle): Likewise.
* guile/guile.c (compute_scheme_string): Likewise.
* guile/scm-cmd.c (gdbscm_parse_command_name): Likewise.
(gdbscm_canonicalize_command_name): Likewise.
* guile/scm-ports.c (ioscm_init_stdio_buffers): Likewise.
(ioscm_init_memory_port): Likewise.
(ioscm_reinit_memory_port): Likewise.
* guile/scm-utils.c (gdbscm_gc_xstrdup): Likewise.
(gdbscm_gc_dup_argv): Likewise.
* h8300-tdep.c (h8300_push_dummy_call): Likewise.
* hppa-tdep.c (internalize_unwinds): Likewise.
(read_unwind_info): Likewise.
* i386-cygwin-tdep.c (core_process_module_section): Likewise.
(windows_core_xfer_shared_libraries): Likewise.
* i386-tdep.c (i386_displaced_step_copy_insn): Likewise.
(i386_stap_parse_special_token_triplet): Likewise.
(i386_stap_parse_special_token_three_arg_disp): Likewise.
* i386obsd-tdep.c (i386obsd_sigtramp_p): Likewise.
* inf-child.c (inf_child_fileio_readlink): Likewise.
* inf-ptrace.c (inf_ptrace_fetch_register): Likewise.
(inf_ptrace_store_register): Likewise.
* infrun.c (follow_exec): Likewise.
(displaced_step_prepare_throw): Likewise.
(save_stop_context): Likewise.
(save_infcall_suspend_state): Likewise.
* jit.c (jit_read_descriptor): Likewise.
(jit_read_code_entry): Likewise.
(jit_symtab_line_mapping_add_impl): Likewise.
(finalize_symtab): Likewise.
(jit_unwind_reg_get_impl): Likewise.
* jv-exp.y (QualifiedName): Likewise.
* jv-lang.c (get_java_utf8_name): Likewise.
(type_from_class): Likewise.
(java_demangle_type_signature): Likewise.
(java_class_name_from_physname): Likewise.
* jv-typeprint.c (java_type_print_base): Likewise.
* jv-valprint.c (java_value_print): Likewise.
* language.c (add_language): Likewise.
* linespec.c (add_sal_to_sals_basic): Likewise.
(add_sal_to_sals): Likewise.
(decode_objc): Likewise.
(find_linespec_symbols): Likewise.
* linux-fork.c (fork_save_infrun_state): Likewise.
* linux-nat.c (linux_nat_detach): Likewise.
(linux_nat_fileio_readlink): Likewise.
* linux-record.c (record_linux_sockaddr): Likewise.
(record_linux_msghdr): Likewise.
(Do): Likewise.
* linux-tdep.c (linux_core_info_proc_mappings): Likewise.
(linux_collect_regset_section_cb): Likewise.
(linux_get_siginfo_data): Likewise.
* linux-thread-db.c (try_thread_db_load_from_pdir_1): Likewise.
(try_thread_db_load_from_dir): Likewise.
(thread_db_load_search): Likewise.
(info_auto_load_libthread_db): Likewise.
* m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise.
(m32c_m16c_pointer_to_address): Likewise.
* m68hc11-tdep.c (m68hc11_pseudo_register_write): Likewise.
* m68k-tdep.c (m68k_get_longjmp_target): Likewise.
* machoread.c (macho_check_dsym): Likewise.
* macroexp.c (resize_buffer): Likewise.
(gather_arguments): Likewise.
(maybe_expand): Likewise.
* macrotab.c (new_macro_key): Likewise.
(new_source_file): Likewise.
(new_macro_definition): Likewise.
* mdebugread.c (parse_symbol): Likewise.
(parse_type): Likewise.
(parse_partial_symbols): Likewise.
(psymtab_to_symtab_1): Likewise.
* mem-break.c (default_memory_insert_breakpoint): Likewise.
* mi/mi-cmd-break.c (mi_argv_to_format): Likewise.
* mi/mi-main.c (mi_cmd_data_read_memory): Likewise.
(mi_cmd_data_read_memory_bytes): Likewise.
(mi_cmd_data_write_memory_bytes): Likewise.
(mi_cmd_trace_frame_collected): Likewise.
* mi/mi-parse.c (mi_parse_argv): Likewise.
(mi_parse): Likewise.
* minidebug.c (lzma_open): Likewise.
(lzma_pread): Likewise.
* mips-tdep.c (mips_read_fp_register_single): Likewise.
(mips_print_fp_register): Likewise.
* mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise.
* mipsread.c (read_alphacoff_dynamic_symtab): Likewise.
* mt-tdep.c (mt_register_name): Likewise.
(mt_registers_info): Likewise.
(mt_push_dummy_call): Likewise.
* namespace.c (add_using_directive): Likewise.
* nat/linux-btrace.c (perf_event_read): Likewise.
(linux_enable_bts): Likewise.
* nat/linux-osdata.c (linux_common_core_of_thread): Likewise.
* nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Likewise.
* nto-tdep.c (nto_find_and_open_solib): Likewise.
(nto_parse_redirection): Likewise.
* objc-lang.c (objc_demangle): Likewise.
(find_methods): Likewise.
* objfiles.c (get_objfile_bfd_data): Likewise.
(set_objfile_main_name): Likewise.
(allocate_objfile): Likewise.
(objfile_relocate): Likewise.
(update_section_map): Likewise.
* osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise.
* p-exp.y (exp): Likewise.
(yylex): Likewise.
* p-valprint.c (pascal_object_print_value): Likewise.
* parse.c (initialize_expout): Likewise.
(mark_completion_tag): Likewise.
(copy_name): Likewise.
(parse_float): Likewise.
(type_stack_reserve): Likewise.
* ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise.
(ppu2spu_prev_register): Likewise.
* ppc-ravenscar-thread.c (supply_register_at_address): Likewise.
* printcmd.c (printf_wide_c_string): Likewise.
(printf_pointer): Likewise.
* probe.c (parse_probes): Likewise.
* python/py-cmd.c (gdbpy_parse_command_name): Likewise.
(cmdpy_init): Likewise.
* python/py-gdb-readline.c (gdbpy_readline_wrapper): Likewise.
* python/py-symtab.c (set_sal): Likewise.
* python/py-unwind.c (pyuw_sniffer): Likewise.
* python/python.c (python_interactive_command): Likewise.
(compute_python_string): Likewise.
* ravenscar-thread.c (get_running_thread_id): Likewise.
* record-full.c (record_full_exec_insn): Likewise.
(record_full_core_open_1): Likewise.
* regcache.c (regcache_raw_read_signed): Likewise.
(regcache_raw_read_unsigned): Likewise.
(regcache_cooked_read_signed): Likewise.
(regcache_cooked_read_unsigned): Likewise.
* remote-fileio.c (remote_fileio_func_open): Likewise.
(remote_fileio_func_rename): Likewise.
(remote_fileio_func_unlink): Likewise.
(remote_fileio_func_stat): Likewise.
(remote_fileio_func_system): Likewise.
* remote-mips.c (mips_xfer_memory): Likewise.
(mips_load_srec): Likewise.
(pmon_end_download): Likewise.
* remote.c (new_remote_state): Likewise.
(map_regcache_remote_table): Likewise.
(remote_register_number_and_offset): Likewise.
(init_remote_state): Likewise.
(get_memory_packet_size): Likewise.
(remote_pass_signals): Likewise.
(remote_program_signals): Likewise.
(remote_start_remote): Likewise.
(remote_check_symbols): Likewise.
(remote_query_supported): Likewise.
(extended_remote_attach): Likewise.
(process_g_packet): Likewise.
(store_registers_using_G): Likewise.
(putpkt_binary): Likewise.
(read_frame): Likewise.
(compare_sections_command): Likewise.
(remote_hostio_pread): Likewise.
(remote_hostio_readlink): Likewise.
(remote_file_put): Likewise.
(remote_file_get): Likewise.
(remote_pid_to_exec_file): Likewise.
(_initialize_remote): Likewise.
* rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise.
(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
* rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise.
(bfd_uses_spe_extensions): Likewise.
* s390-linux-tdep.c (s390_displaced_step_copy_insn): Likewise.
* score-tdep.c (score7_malloc_and_get_memblock): Likewise.
* solib-dsbt.c (decode_loadmap): Likewise.
(fetch_loadmap): Likewise.
(scan_dyntag): Likewise.
(enable_break): Likewise.
(dsbt_relocate_main_executable): Likewise.
* solib-frv.c (fetch_loadmap): Likewise.
(enable_break2): Likewise.
(frv_relocate_main_executable): Likewise.
* solib-spu.c (spu_relocate_main_executable): Likewise.
(spu_bfd_open): Likewise.
* solib-svr4.c (lm_info_read): Likewise.
(read_program_header): Likewise.
(find_program_interpreter): Likewise.
(scan_dyntag): Likewise.
(elf_locate_base): Likewise.
(open_symbol_file_object): Likewise.
(read_program_headers_from_bfd): Likewise.
(svr4_relocate_main_executable): Likewise.
* solib-target.c (solib_target_relocate_section_addresses): Likewise.
* solib.c (solib_find_1): Likewise.
(exec_file_find): Likewise.
(solib_find): Likewise.
* source.c (openp): Likewise.
(print_source_lines_base): Likewise.
(forward_search_command): Likewise.
* sparc-ravenscar-thread.c (supply_register_at_address): Likewise.
* spu-tdep.c (spu2ppu_prev_register): Likewise.
(spu_get_overlay_table): Likewise.
* stabsread.c (patch_block_stabs): Likewise.
(define_symbol): Likewise.
(again:): Likewise.
(read_member_functions): Likewise.
(read_one_struct_field): Likewise.
(read_enum_type): Likewise.
(common_block_start): Likewise.
* stack.c (read_frame_arg): Likewise.
(backtrace_command): Likewise.
* stap-probe.c (stap_parse_register_operand): Likewise.
* symfile.c (syms_from_objfile_1): Likewise.
(find_separate_debug_file): Likewise.
(load_command): Likewise.
(load_progress): Likewise.
(load_section_callback): Likewise.
(reread_symbols): Likewise.
(add_filename_language): Likewise.
(allocate_compunit_symtab): Likewise.
(read_target_long_array): Likewise.
(simple_read_overlay_table): Likewise.
* symtab.c (symbol_set_names): Likewise.
(resize_symbol_cache): Likewise.
(rbreak_command): Likewise.
(completion_list_add_name): Likewise.
(completion_list_objc_symbol): Likewise.
(add_filename_to_list): Likewise.
* target-descriptions.c (maint_print_c_tdesc_cmd): Likewise.
* target-memory.c (target_write_memory_blocks): Likewise.
* target.c (target_read_string): Likewise.
(read_whatever_is_readable): Likewise.
(target_read_alloc_1): Likewise.
(simple_search_memory): Likewise.
(target_fileio_read_alloc_1): Likewise.
* tilegx-tdep.c (tilegx_push_dummy_call): Likewise.
* top.c (command_line_input): Likewise.
* tracefile-tfile.c (tfile_fetch_registers): Likewise.
* tracefile.c (tracefile_fetch_registers): Likewise.
* tracepoint.c (add_memrange): Likewise.
(init_collection_list): Likewise.
(add_aexpr): Likewise.
(trace_dump_actions): Likewise.
(parse_trace_status): Likewise.
(parse_tracepoint_definition): Likewise.
(parse_tsv_definition): Likewise.
(parse_static_tracepoint_marker_definition): Likewise.
* tui/tui-file.c (tui_sfileopen): Likewise.
(tui_file_adjust_strbuf): Likewise.
* tui/tui-io.c (tui_expand_tabs): Likewise.
* tui/tui-source.c (tui_set_source_content): Likewise.
* typeprint.c (find_global_typedef): Likewise.
* ui-file.c (do_ui_file_xstrdup): Likewise.
(ui_file_obsavestring): Likewise.
(mem_file_write): Likewise.
* utils.c (make_hex_string): Likewise.
(get_regcomp_error): Likewise.
(puts_filtered_tabular): Likewise.
(gdb_realpath_keepfile): Likewise.
(ldirname): Likewise.
(gdb_bfd_errmsg): Likewise.
(substitute_path_component): Likewise.
* valops.c (search_struct_method): Likewise.
(find_oload_champ_namespace_loop): Likewise.
* valprint.c (print_decimal_chars): Likewise.
(read_string): Likewise.
(generic_emit_char): Likewise.
* varobj.c (varobj_delete): Likewise.
(varobj_value_get_print_value): Likewise.
* vaxobsd-tdep.c (vaxobsd_sigtramp_sniffer): Likewise.
* windows-tdep.c (display_one_tib): Likewise.
* xcoffread.c (read_xcoff_symtab): Likewise.
(process_xcoff_symbol): Likewise.
(swap_sym): Likewise.
(scan_xcoff_symtab): Likewise.
(xcoff_initial_scan): Likewise.
* xml-support.c (gdb_xml_end_element): Likewise.
(xml_process_xincludes): Likewise.
(xml_fetch_content_from_file): Likewise.
* xml-syscall.c (xml_list_of_syscalls): Likewise.
* xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise.
2015-09-23 James Bowman <james.bowman@ftdichip.com>
* ft32-tdep.c (ft32_register_type): Return gdbarch_tdep (gdbarch)->pc_type

View file

@ -279,7 +279,7 @@ aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
return 0;
len = tmp - start;
regname = alloca (len + 2);
regname = (char *) alloca (len + 2);
strncpy (regname, start, len);
regname[len] = '\0';

View file

@ -876,7 +876,8 @@ write_object_renaming (struct parser_state *par_state,
if (orig_left_context == NULL)
orig_left_context = get_selected_block (NULL);
name = obstack_copy0 (&temp_parse_space, renamed_entity, renamed_entity_len);
name = (char *) obstack_copy0 (&temp_parse_space, renamed_entity,
renamed_entity_len);
ada_lookup_encoded_symbol (name, orig_left_context, VAR_DOMAIN, &sym_info);
if (sym_info.symbol == NULL)
error (_("Could not find renamed variable: %s"), ada_decode (name));
@ -945,8 +946,8 @@ write_object_renaming (struct parser_state *par_state,
if (end == NULL)
end = renaming_expr + strlen (renaming_expr);
index_name =
obstack_copy0 (&temp_parse_space, renaming_expr,
index_name
= (char *) obstack_copy0 (&temp_parse_space, renaming_expr,
end - renaming_expr);
renaming_expr = end;
@ -989,7 +990,7 @@ write_object_renaming (struct parser_state *par_state,
if (end == NULL)
end = renaming_expr + strlen (renaming_expr);
field_name.length = end - renaming_expr;
buf = malloc (end - renaming_expr + 1);
buf = (char *) malloc (end - renaming_expr + 1);
field_name.ptr = buf;
strncpy (buf, renaming_expr, end - renaming_expr);
buf[end - renaming_expr] = '\000';
@ -1167,7 +1168,8 @@ write_ambiguous_var (struct parser_state *par_state,
memset (sym, 0, sizeof (struct symbol));
SYMBOL_DOMAIN (sym) = UNDEF_DOMAIN;
SYMBOL_LINKAGE_NAME (sym) = obstack_copy0 (&temp_parse_space, name, len);
SYMBOL_LINKAGE_NAME (sym)
= (const char *) obstack_copy0 (&temp_parse_space, name, len);
SYMBOL_LANGUAGE (sym) = language_ada;
write_exp_elt_opcode (par_state, OP_VAR_VALUE);
@ -1184,7 +1186,7 @@ static int
ada_nget_field_index (const struct type *type, const char *field_name0,
int field_name_len, int maybe_missing)
{
char *field_name = alloca ((field_name_len + 1) * sizeof (char));
char *field_name = (char *) alloca ((field_name_len + 1) * sizeof (char));
strncpy (field_name, field_name0, field_name_len);
field_name[field_name_len] = '\0';
@ -1265,7 +1267,8 @@ write_var_or_type (struct parser_state *par_state,
encoded_name = ada_encode (name0.ptr);
name_len = strlen (encoded_name);
encoded_name = obstack_copy0 (&temp_parse_space, encoded_name, name_len);
encoded_name
= (char *) obstack_copy0 (&temp_parse_space, encoded_name, name_len);
for (depth = 0; depth < MAX_RENAMING_CHAIN_LENGTH; depth += 1)
{
int tail_index;
@ -1318,9 +1321,9 @@ write_var_or_type (struct parser_state *par_state,
case ADA_EXCEPTION_RENAMING:
case ADA_SUBPROGRAM_RENAMING:
{
int alloc_len = renaming_len + name_len - tail_index + 1;
char *new_name
= obstack_alloc (&temp_parse_space,
renaming_len + name_len - tail_index + 1);
= (char *) obstack_alloc (&temp_parse_space, alloc_len);
strncpy (new_name, renaming, renaming_len);
strcpy (new_name + renaming_len, encoded_name + tail_index);
encoded_name = new_name;

View file

@ -1424,7 +1424,8 @@ ada_decode_symbol (const struct general_symbol_info *arg)
gsymbol->ada_mangled = 1;
if (obstack != NULL)
*resultp = obstack_copy0 (obstack, decoded, strlen (decoded));
*resultp
= (const char *) obstack_copy0 (obstack, decoded, strlen (decoded));
else
{
/* Sometimes, we can't find a corresponding objfile, in
@ -2657,7 +2658,7 @@ ada_value_assign (struct value *toval, struct value *fromval)
int len = (value_bitpos (toval)
+ bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
int from_size;
gdb_byte *buffer = alloca (len);
gdb_byte *buffer = (gdb_byte *) alloca (len);
struct value *val;
CORE_ADDR to_addr = value_address (toval);
@ -4401,7 +4402,7 @@ value_pointer (struct value *value, struct type *type)
{
struct gdbarch *gdbarch = get_type_arch (type);
unsigned len = TYPE_LENGTH (type);
gdb_byte *buf = alloca (len);
gdb_byte *buf = (gdb_byte *) alloca (len);
CORE_ADDR addr;
addr = value_address (value);
@ -4596,7 +4597,8 @@ cache_symbol (const char *name, domain_enum domain, struct symbol *sym,
sizeof (*e));
e->next = sym_cache->root[h];
sym_cache->root[h] = e;
e->name = copy = obstack_alloc (&sym_cache->cache_space, strlen (name) + 1);
e->name = copy
= (char *) obstack_alloc (&sym_cache->cache_space, strlen (name) + 1);
strcpy (copy, name);
e->sym = sym;
e->domain = domain;
@ -4767,7 +4769,7 @@ static struct block_symbol *
defns_collected (struct obstack *obstackp, int finish)
{
if (finish)
return obstack_finish (obstackp);
return (struct block_symbol *) obstack_finish (obstackp);
else
return (struct block_symbol *) obstack_base (obstackp);
}
@ -5535,7 +5537,7 @@ add_nonlocal_symbols (struct obstack *obstackp, const char *name,
{
ALL_OBJFILES (objfile)
{
char *name1 = alloca (strlen (name) + sizeof ("_ada_"));
char *name1 = (char *) alloca (strlen (name) + sizeof ("_ada_"));
strcpy (name1, "_ada_");
strcpy (name1 + sizeof ("_ada_") - 1, name);
data.objfile = objfile;
@ -5728,7 +5730,7 @@ ada_name_for_lookup (const char *name)
if (name[0] == '<' && name[nlen - 1] == '>')
{
canon = xmalloc (nlen - 1);
canon = (char *) xmalloc (nlen - 1);
memcpy (canon, name + 1, nlen - 2);
canon[nlen - 2] = '\0';
}
@ -6329,19 +6331,19 @@ symbol_completion_add (VEC(char_ptr) **sv,
if (word == orig_text)
{
completion = xmalloc (strlen (match) + 5);
completion = (char *) xmalloc (strlen (match) + 5);
strcpy (completion, match);
}
else if (word > orig_text)
{
/* Return some portion of sym_name. */
completion = xmalloc (strlen (match) + 5);
completion = (char *) xmalloc (strlen (match) + 5);
strcpy (completion, match + (word - orig_text));
}
else
{
/* Return some of ORIG_TEXT plus sym_name. */
completion = xmalloc (strlen (match) + (orig_text - word) + 5);
completion = (char *) xmalloc (strlen (match) + (orig_text - word) + 5);
strncpy (completion, word, orig_text - word);
completion[orig_text - word] = '\0';
strcat (completion, match);
@ -8869,7 +8871,8 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr,
else if (ada_type_name (fixed_record_type) != NULL)
{
const char *name = ada_type_name (fixed_record_type);
char *xvz_name = alloca (strlen (name) + 7 /* "___XVZ\0" */);
char *xvz_name
= (char *) alloca (strlen (name) + 7 /* "___XVZ\0" */);
int xvz_found = 0;
LONGEST size;
@ -12688,7 +12691,7 @@ ada_get_next_arg (char **argsp)
/* Make a copy of the current argument and return it. */
result = xmalloc (end - args + 1);
result = (char *) xmalloc (end - args + 1);
strncpy (result, args, end - args);
result[end - args] = '\0';

View file

@ -428,7 +428,7 @@ processReal (struct parser_state *par_state, const char *num0)
static struct stoken
processId (const char *name0, int len)
{
char *name = obstack_alloc (&temp_parse_space, len + 11);
char *name = (char *) obstack_alloc (&temp_parse_space, len + 11);
int i0, i;
struct stoken result;
@ -499,7 +499,7 @@ processString (const char *text, int len)
const char *lim = text + len;
struct stoken result;
q = obstack_alloc (&temp_parse_space, len);
q = (char *) obstack_alloc (&temp_parse_space, len);
result.ptr = q;
p = text;
while (p < lim)

View file

@ -784,7 +784,7 @@ read_known_tasks_array (struct ada_tasks_inferior_data *data)
{
const int target_ptr_byte = TYPE_LENGTH (data->known_tasks_element);
const int known_tasks_size = target_ptr_byte * data->known_tasks_length;
gdb_byte *known_tasks = alloca (known_tasks_size);
gdb_byte *known_tasks = (gdb_byte *) alloca (known_tasks_size);
int i;
/* Build a new list by reading the ATCBs from the Known_Tasks array
@ -810,7 +810,7 @@ static int
read_known_tasks_list (struct ada_tasks_inferior_data *data)
{
const int target_ptr_byte = TYPE_LENGTH (data->known_tasks_element);
gdb_byte *known_tasks = alloca (target_ptr_byte);
gdb_byte *known_tasks = (gdb_byte *) alloca (target_ptr_byte);
CORE_ADDR task_id;
const struct ada_tasks_pspace_data *pspace_data
= get_ada_tasks_pspace_data (current_program_space);

View file

@ -64,7 +64,7 @@ decoded_type_name (struct type *type)
if (name_buffer == NULL || name_buffer_len <= strlen (raw_name))
{
name_buffer_len = 16 + 2 * strlen (raw_name);
name_buffer = xrealloc (name_buffer, name_buffer_len);
name_buffer = (char *) xrealloc (name_buffer, name_buffer_len);
}
strcpy (name_buffer, raw_name);

View file

@ -427,6 +427,7 @@ addrmap_mutable_create_fixed (struct addrmap *self, struct obstack *obstack)
struct addrmap_mutable *mutable_obj = (struct addrmap_mutable *) self;
struct addrmap_fixed *fixed;
size_t num_transitions;
size_t alloc_len;
/* Count the number of transitions in the tree. */
num_transitions = 0;
@ -436,10 +437,9 @@ addrmap_mutable_create_fixed (struct addrmap *self, struct obstack *obstack)
maps have, but mutable maps do not.) */
num_transitions++;
fixed = obstack_alloc (obstack,
(sizeof (*fixed)
+ (num_transitions
* sizeof (fixed->transitions[0]))));
alloc_len = sizeof (*fixed)
+ (num_transitions * sizeof (fixed->transitions[0]));
fixed = (struct addrmap_fixed *) obstack_alloc (obstack, alloc_len);
fixed->addrmap.funcs = &addrmap_fixed_funcs;
fixed->num_transitions = 1;
fixed->transitions[0].addr = 0;

View file

@ -850,7 +850,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
AMD64_XMM0_REGNUM + 4, AMD64_XMM0_REGNUM + 5,
AMD64_XMM0_REGNUM + 6, AMD64_XMM0_REGNUM + 7,
};
struct value **stack_args = alloca (nargs * sizeof (struct value *));
struct value **stack_args = XALLOCAVEC (struct value *, nargs);
int num_stack_args = 0;
int num_elements = 0;
int element = 0;
@ -1351,8 +1351,9 @@ amd64_displaced_step_copy_insn (struct gdbarch *gdbarch,
/* Extra space for sentinels so fixup_{riprel,displaced_copy} don't have to
continually watch for running off the end of the buffer. */
int fixup_sentinel_space = len;
struct displaced_step_closure *dsc =
xmalloc (sizeof (*dsc) + len + fixup_sentinel_space);
struct displaced_step_closure *dsc
= ((struct displaced_step_closure *)
xmalloc (sizeof (*dsc) + len + fixup_sentinel_space));
gdb_byte *buf = &dsc->insn_buf[0];
struct amd64_insn *details = &dsc->insn_details;
@ -1514,7 +1515,7 @@ amd64_classify_insn_at (struct gdbarch *gdbarch, CORE_ADDR addr,
int len, classification;
len = gdbarch_max_insn_length (gdbarch);
buf = alloca (len);
buf = (gdb_byte *) alloca (len);
read_code (addr, buf, len);
amd64_get_insn_details (buf, &details);
@ -1711,7 +1712,7 @@ amd64_relocate_instruction (struct gdbarch *gdbarch,
int len = gdbarch_max_insn_length (gdbarch);
/* Extra space for sentinels. */
int fixup_sentinel_space = len;
gdb_byte *buf = xmalloc (len + fixup_sentinel_space);
gdb_byte *buf = (gdb_byte *) xmalloc (len + fixup_sentinel_space);
struct amd64_insn insn_details;
int offset = 0;
LONGEST rel32, newrel;

View file

@ -114,7 +114,7 @@ amd64obsd_sigtramp_p (struct frame_info *this_frame)
return 0;
/* If we can't read the instructions at START_PC, return zero. */
buf = alloca ((sizeof sigreturn) + 1);
buf = (gdb_byte *) alloca ((sizeof sigreturn) + 1);
if (!safe_frame_unwind_memory (this_frame, start_pc + 6, buf, buflen))
return 0;

View file

@ -44,7 +44,7 @@ simple_displaced_step_copy_insn (struct gdbarch *gdbarch,
struct regcache *regs)
{
size_t len = gdbarch_max_insn_length (gdbarch);
gdb_byte *buf = xmalloc (len);
gdb_byte *buf = (gdb_byte *) xmalloc (len);
read_memory (from, buf, len);
write_memory (to, buf, len);
@ -684,7 +684,7 @@ initialize_current_architecture (void)
/* Append ``auto''. */
int nr;
for (nr = 0; arches[nr] != NULL; nr++);
arches = xrealloc (arches, sizeof (char*) * (nr + 2));
arches = XRESIZEVEC (const char *, arches, nr + 2);
arches[nr + 0] = "auto";
arches[nr + 1] = NULL;
add_setshow_enum_cmd ("architecture", class_support,

View file

@ -1179,7 +1179,7 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
return 0;
len = tmp - start;
regname = alloca (len + 2);
regname = (char *) alloca (len + 2);
offset = 0;
if (isdigit (*start))

View file

@ -108,7 +108,7 @@ arm_symbian_osabi_sniffer (bfd *abfd)
if (phdrs_size == -1)
return GDB_OSABI_UNKNOWN;
phdrs = alloca (phdrs_size);
phdrs = (Elf_Internal_Phdr *) alloca (phdrs_size);
num_phdrs = bfd_get_elf_phdrs (abfd, phdrs);
if (num_phdrs == -1)
return GDB_OSABI_UNKNOWN;

View file

@ -2230,7 +2230,7 @@ arm_exidx_new_objfile (struct objfile *objfile)
{
exidx_vma = bfd_section_vma (objfile->obfd, exidx);
exidx_size = bfd_get_section_size (exidx);
exidx_data = xmalloc (exidx_size);
exidx_data = (gdb_byte *) xmalloc (exidx_size);
make_cleanup (xfree, exidx_data);
if (!bfd_get_section_contents (objfile->obfd, exidx,
@ -2246,7 +2246,7 @@ arm_exidx_new_objfile (struct objfile *objfile)
{
extab_vma = bfd_section_vma (objfile->obfd, extab);
extab_size = bfd_get_section_size (extab);
extab_data = xmalloc (extab_size);
extab_data = (gdb_byte *) xmalloc (extab_size);
make_cleanup (xfree, extab_data);
if (!bfd_get_section_contents (objfile->obfd, extab,
@ -2383,7 +2383,8 @@ arm_exidx_new_objfile (struct objfile *objfile)
extab section starting at ADDR. */
if (n_bytes || n_words)
{
gdb_byte *p = entry = obstack_alloc (&objfile->objfile_obstack,
gdb_byte *p = entry
= (gdb_byte *) obstack_alloc (&objfile->objfile_obstack,
n_bytes + n_words * 4 + 1);
while (n_bytes--)
@ -3883,7 +3884,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
CORE_ADDR regval = extract_unsigned_integer (val, len, byte_order);
if (arm_pc_is_thumb (gdbarch, regval))
{
bfd_byte *copy = alloca (len);
bfd_byte *copy = (bfd_byte *) alloca (len);
store_unsigned_integer (copy, len, byte_order,
MAKE_THUMB_ADDR (regval));
val = copy;
@ -5325,7 +5326,7 @@ extend_buffer_earlier (gdb_byte *buf, CORE_ADDR endaddr,
gdb_byte *new_buf;
int bytes_to_read = new_len - old_len;
new_buf = xmalloc (new_len);
new_buf = (gdb_byte *) xmalloc (new_len);
memcpy (new_buf + bytes_to_read, buf, old_len);
xfree (buf);
if (target_read_memory (endaddr - new_len, new_buf, bytes_to_read) != 0)
@ -5391,7 +5392,7 @@ arm_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
/* No room for an IT instruction. */
return bpaddr;
buf = xmalloc (buf_len);
buf = (gdb_byte *) xmalloc (buf_len);
if (target_read_memory (bpaddr - buf_len, buf, buf_len) != 0)
return bpaddr;
any = 0;
@ -9353,7 +9354,7 @@ arm_skip_stub (struct frame_info *frame, CORE_ADDR pc)
else
target_len -= strlen ("_from_arm");
target_name = alloca (target_len + 1);
target_name = (char *) alloca (target_len + 1);
memcpy (target_name, name + 2, target_len);
target_name[target_len] = '\0';

View file

@ -408,9 +408,9 @@ filename_is_in_pattern (const char *filename, const char *pattern)
{
char *filename_copy, *pattern_copy;
filename_copy = alloca (strlen (filename) + 1);
filename_copy = (char *) alloca (strlen (filename) + 1);
strcpy (filename_copy, filename);
pattern_copy = alloca (strlen (pattern) + 1);
pattern_copy = (char *) alloca (strlen (pattern) + 1);
strcpy (pattern_copy, pattern);
return filename_is_in_pattern_1 (filename_copy, pattern_copy);
@ -693,9 +693,10 @@ maybe_add_script_file (struct auto_load_pspace_info *pspace_info, int loaded,
char *p;
/* Allocate all space in one chunk so it's easier to free. */
*slot = xmalloc (sizeof (**slot)
*slot = ((struct loaded_script *)
xmalloc (sizeof (**slot)
+ strlen (name) + 1
+ (full_path != NULL ? (strlen (full_path) + 1) : 0));
+ (full_path != NULL ? (strlen (full_path) + 1) : 0)));
p = ((char*) *slot) + sizeof (**slot);
strcpy (p, name);
(*slot)->name = p;
@ -740,7 +741,8 @@ maybe_add_script_text (struct auto_load_pspace_info *pspace_info,
char *p;
/* Allocate all space in one chunk so it's easier to free. */
*slot = xmalloc (sizeof (**slot) + strlen (name) + 1);
*slot = ((struct loaded_script *)
xmalloc (sizeof (**slot) + strlen (name) + 1));
p = ((char*) *slot) + sizeof (**slot);
strcpy (p, name);
(*slot)->name = p;
@ -787,7 +789,7 @@ auto_load_objfile_script_1 (struct objfile *objfile, const char *realname,
const char *suffix = ext_lang_auto_load_suffix (language);
len = strlen (realname);
filename = xmalloc (len + strlen (suffix) + 1);
filename = (char *) xmalloc (len + strlen (suffix) + 1);
memcpy (filename, realname, len);
strcpy (filename + len, suffix);
@ -818,7 +820,7 @@ auto_load_objfile_script_1 (struct objfile *objfile, const char *realname,
for (ix = 0; VEC_iterate (char_ptr, vec, ix, dir); ++ix)
{
debugfile = xmalloc (strlen (dir) + strlen (filename) + 1);
debugfile = (char *) xmalloc (strlen (dir) + strlen (filename) + 1);
strcpy (debugfile, dir);
/* FILENAME is absolute, so we don't need a "/" here. */

View file

@ -90,7 +90,7 @@ ld_so_xfer_auxv (gdb_byte *readbuf,
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
size_t ptr_size = TYPE_LENGTH (ptr_type);
size_t auxv_pair_size = 2 * ptr_size;
gdb_byte *ptr_buf = alloca (ptr_size);
gdb_byte *ptr_buf = (gdb_byte *) alloca (ptr_size);
LONGEST retval;
size_t block;

View file

@ -46,15 +46,14 @@ new_agent_expr (struct gdbarch *gdbarch, CORE_ADDR scope)
x->len = 0;
x->size = 1; /* Change this to a larger value once
reallocation code is tested. */
x->buf = xmalloc (x->size);
x->buf = (unsigned char *) xmalloc (x->size);
x->gdbarch = gdbarch;
x->scope = scope;
/* Bit vector for registers used. */
x->reg_mask_len = 1;
x->reg_mask = xmalloc (x->reg_mask_len * sizeof (x->reg_mask[0]));
memset (x->reg_mask, 0, x->reg_mask_len * sizeof (x->reg_mask[0]));
x->reg_mask = XCNEWVEC (unsigned char, x->reg_mask_len);
x->tracing = 0;
x->trace_string = 0;
@ -94,7 +93,7 @@ grow_expr (struct agent_expr *x, int n)
x->size *= 2;
if (x->size < x->len + n)
x->size = x->len + n + 10;
x->buf = xrealloc (x->buf, x->size);
x->buf = (unsigned char *) xrealloc (x->buf, x->size);
}
}
@ -458,9 +457,9 @@ ax_reg_mask (struct agent_expr *ax, int reg)
/* It's not appropriate to double here. This isn't a
string buffer. */
int new_len = byte + 1;
unsigned char *new_reg_mask = xrealloc (ax->reg_mask,
new_len
* sizeof (ax->reg_mask[0]));
unsigned char *new_reg_mask
= XRESIZEVEC (unsigned char, ax->reg_mask, new_len);
memset (new_reg_mask + ax->reg_mask_len, 0,
(new_len - ax->reg_mask_len) * sizeof (ax->reg_mask[0]));
ax->reg_mask_len = new_len;

View file

@ -265,7 +265,8 @@ bcache_full (const void *addr, int length, struct bcache *bcache, int *added)
/* The user's string isn't in the list. Insert it after *ps. */
{
struct bstring *newobj
= obstack_alloc (&bcache->cache, BSTRING_SIZE (length));
= (struct bstring *) obstack_alloc (&bcache->cache,
BSTRING_SIZE (length));
memcpy (&newobj->d.data, addr, length);
newobj->length = length;

View file

@ -8982,7 +8982,7 @@ program_breakpoint_here_p (struct gdbarch *gdbarch, CORE_ADDR address)
if (bpoint == NULL)
return 0;
target_mem = alloca (len);
target_mem = (gdb_byte *) alloca (len);
/* Enable the automatic memory restoration from breakpoints while
we read the memory. Otherwise we could say about our temporary

View file

@ -1441,7 +1441,7 @@ parse_xml_raw (struct gdb_xml_parser *parser, const char *body_text,
size = len / 2;
bin = data = xmalloc (size);
bin = data = (gdb_byte *) xmalloc (size);
cleanup = make_cleanup (xfree, data);
/* We use hex encoding - see common/rsp-low.h. */

View file

@ -75,10 +75,13 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
struct cleanup *back_to;
int ix;
bfd *abfd = NULL;
int alloc_len;
/* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
link = alloca (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
alloc_len = (strlen (debug_file_directory)
+ (sizeof "/.build-id/" - 1) + 1
+ 2 * build_id_len + (sizeof ".debug" - 1) + 1);
link = (char *) alloca (alloc_len);
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
cause "/.build-id/..." lookups. */

View file

@ -1429,7 +1429,7 @@ end_symtab_with_blockvector (struct block *static_block,
{
/* Reallocate the dirname on the symbol obstack. */
COMPUNIT_DIRNAME (cu)
= obstack_copy0 (&objfile->objfile_obstack,
= (const char *) obstack_copy0 (&objfile->objfile_obstack,
buildsym_compunit->comp_dir,
strlen (buildsym_compunit->comp_dir));
}

View file

@ -839,7 +839,7 @@ string_exp:
vec->type = $1.type;
vec->length = $1.length;
vec->ptr = malloc ($1.length + 1);
vec->ptr = (char *) malloc ($1.length + 1);
memcpy (vec->ptr, $1.ptr, $1.length + 1);
}
@ -849,10 +849,10 @@ string_exp:
for convenience. */
char *p;
++$$.len;
$$.tokens = realloc ($$.tokens,
$$.len * sizeof (struct typed_stoken));
$$.tokens = XRESIZEVEC (struct typed_stoken,
$$.tokens, $$.len);
p = malloc ($2.length + 1);
p = (char *) malloc ($2.length + 1);
memcpy (p, $2.ptr, $2.length + 1);
$$.tokens[$$.len - 1].type = $2.type;
@ -1006,7 +1006,7 @@ qualified_name: TYPENAME COLONCOLON name
if (!type_aggregate_p (type))
error (_("`%s' is not defined as an aggregate type."),
TYPE_SAFE_NAME (type));
buf = alloca ($4.length + 2);
buf = (char *) alloca ($4.length + 2);
tmp_token.ptr = buf;
tmp_token.length = $4.length + 1;
buf[0] = '~';
@ -1664,7 +1664,7 @@ name_not_typename : NAME
static void
write_destructor_name (struct parser_state *par_state, struct stoken token)
{
char *copy = alloca (token.length + 1);
char *copy = (char *) alloca (token.length + 1);
copy[0] = '~';
memcpy (&copy[1], token.ptr, token.length);
@ -1686,7 +1686,7 @@ operator_stoken (const char *op)
char *buf;
st.length = strlen (operator_string) + strlen (op);
buf = malloc (st.length + 1);
buf = (char *) malloc (st.length + 1);
strcpy (buf, operator_string);
strcat (buf, op);
st.ptr = buf;
@ -1771,7 +1771,7 @@ parse_number (struct parser_state *par_state,
struct type *unsigned_type;
char *p;
p = alloca (len);
p = (char *) alloca (len);
memcpy (p, buf, len);
if (parsed_float)
@ -2399,7 +2399,8 @@ scan_macro_expansion (char *expansion)
/* Copy to the obstack, and then free the intermediate
expansion. */
copy = obstack_copy0 (&expansion_obstack, expansion, strlen (expansion));
copy = (char *) obstack_copy0 (&expansion_obstack, expansion,
strlen (expansion));
xfree (expansion);
/* Save the old lexptr value, so we can return to it when we're done
@ -3196,7 +3197,8 @@ yylex (void)
the FIFO, and delete the other constituent tokens. */
if (checkpoint > 0)
{
current.value.sval.ptr = obstack_copy0 (&expansion_obstack,
current.value.sval.ptr
= (const char *) obstack_copy0 (&expansion_obstack,
current.value.sval.ptr,
current.value.sval.length);
@ -3278,7 +3280,7 @@ c_print_token (FILE *file, int type, YYSTYPE value)
case CHAR:
case STRING:
{
char *copy = alloca (value.tsval.length + 1);
char *copy = (char *) alloca (value.tsval.length + 1);
memcpy (copy, value.tsval.ptr, value.tsval.length);
copy[value.tsval.length] = '\0';

View file

@ -302,7 +302,7 @@ c_get_string (struct value *value, gdb_byte **buffer,
/* I is now either a user-defined length, the number of non-null
characters, or FETCHLIMIT. */
*length = i * width;
*buffer = xmalloc (*length);
*buffer = (gdb_byte *) xmalloc (*length);
memcpy (*buffer, contents, *length);
err = 0;
}
@ -412,7 +412,7 @@ emit_numeric_character (struct type *type, unsigned long value,
{
gdb_byte *buffer;
buffer = alloca (TYPE_LENGTH (type));
buffer = (gdb_byte *) alloca (TYPE_LENGTH (type));
pack_long (buffer, type, value);
obstack_grow (output, buffer, TYPE_LENGTH (type));
}

View file

@ -687,8 +687,7 @@ wchar_iterate (struct wchar_iterator *iter,
if (out_request > iter->out_size)
{
iter->out_size = out_request;
iter->out = xrealloc (iter->out,
out_request * sizeof (gdb_wchar_t));
iter->out = XRESIZEVEC (gdb_wchar_t, iter->out, out_request);
}
continue;

View file

@ -277,7 +277,7 @@ complete_command (char *arg, int from_tty)
point--;
}
arg_prefix = alloca (point - arg + 1);
arg_prefix = (char *) alloca (point - arg + 1);
memcpy (arg_prefix, arg, point - arg);
arg_prefix[point - arg] = 0;
@ -1295,7 +1295,7 @@ make_command (char *arg, int from_tty)
p = "make";
else
{
p = xmalloc (sizeof ("make ") + strlen (arg));
p = (char *) xmalloc (sizeof ("make ") + strlen (arg));
strcpy (p, "make ");
strcpy (p + sizeof ("make ") - 1, arg);
}

View file

@ -482,7 +482,7 @@ restore_section_callback (bfd *ibfd, asection *isec, void *args)
sec_load_count -= sec_end - data->load_end;
/* Get the data. */
buf = xmalloc (size);
buf = (gdb_byte *) xmalloc (size);
old_chain = make_cleanup (xfree, buf);
if (!bfd_get_section_contents (ibfd, isec, buf, 0, size))
error (_("Failed to read bfd file %s: '%s'."), bfd_get_filename (ibfd),
@ -553,7 +553,7 @@ restore_binary_file (const char *filename, struct callback_data *data)
perror_with_name (filename);
/* Now allocate a buffer and read the file contents. */
buf = xmalloc (len);
buf = (gdb_byte *) xmalloc (len);
make_cleanup (xfree, buf);
if (fread (buf, 1, len, file) != len)
perror_with_name (filename);

View file

@ -174,7 +174,8 @@ cli_interpreter_exec (void *data, const char *command_str)
/* FIXME: cagney/2003-02-01: Need to const char *propogate
safe_execute_command. */
char *str = strcpy (alloca (strlen (command_str) + 1), command_str);
char *str = (char *) alloca (strlen (command_str) + 1);
strcpy (str, command_str);
/* gdb_stdout could change between the time cli_uiout was
initialized and now. Since we're probably using a different

View file

@ -484,7 +484,7 @@ execute_control_command (struct command_line *cmd)
case while_control:
{
int len = strlen (cmd->line) + 7;
char *buffer = alloca (len);
char *buffer = (char *) alloca (len);
xsnprintf (buffer, len, "while %s", cmd->line);
print_command_trace (buffer);
@ -553,7 +553,7 @@ execute_control_command (struct command_line *cmd)
case if_control:
{
int len = strlen (cmd->line) + 4;
char *buffer = alloca (len);
char *buffer = (char *) alloca (len);
xsnprintf (buffer, len, "if %s", cmd->line);
print_command_trace (buffer);

View file

@ -373,7 +373,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
for (i = 0; c->enums[i]; i++)
msg_len += strlen (c->enums[i]) + 2;
msg = xmalloc (msg_len);
msg = (char *) xmalloc (msg_len);
*msg = '\0';
make_cleanup (xfree, msg);

View file

@ -211,7 +211,7 @@ add_pe_forwarded_sym (const char *sym_name, const char *forward_dll_name,
int forward_dll_name_len = strlen (forward_dll_name);
int forward_func_name_len = strlen (forward_func_name);
int forward_len = forward_dll_name_len + forward_func_name_len + 2;
char *forward_qualified_name = alloca (forward_len);
char *forward_qualified_name = (char *) alloca (forward_len);
short section;
xsnprintf (forward_qualified_name, forward_len, "%s!%s", forward_dll_name,
@ -492,8 +492,8 @@ read_pe_exported_syms (struct objfile *objfile)
{
char *name;
section_data = xrealloc (section_data, (otherix + 1)
* sizeof (struct read_pe_section_data));
section_data = XRESIZEVEC (struct read_pe_section_data, section_data,
otherix + 1);
name = xstrdup (sec_name);
section_data[otherix].section_name = name;
make_cleanup (xfree, name);
@ -575,7 +575,7 @@ read_pe_exported_syms (struct objfile *objfile)
{
int len = (int) (sep - forward_name);
forward_dll_name = alloca (len + 1);
forward_dll_name = (char *) alloca (len + 1);
strncpy (forward_dll_name, forward_name, len);
forward_dll_name[len] = '\0';
forward_func_name = ++sep;

View file

@ -2104,7 +2104,8 @@ coff_read_struct_type (int index, int length, int lastsym,
list = newobj;
/* Save the data. */
list->field.name = obstack_copy0 (&objfile->objfile_obstack,
list->field.name
= (const char *) obstack_copy0 (&objfile->objfile_obstack,
name, strlen (name));
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type,
&sub_aux, objfile);
@ -2121,7 +2122,8 @@ coff_read_struct_type (int index, int length, int lastsym,
list = newobj;
/* Save the data. */
list->field.name = obstack_copy0 (&objfile->objfile_obstack,
list->field.name
= (const char *) obstack_copy0 (&objfile->objfile_obstack,
name, strlen (name));
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type,
&sub_aux, objfile);
@ -2192,9 +2194,9 @@ coff_read_enum_type (int index, int length, int lastsym,
case C_MOE:
sym = allocate_symbol (objfile);
SYMBOL_SET_LINKAGE_NAME (sym,
obstack_copy0 (&objfile->objfile_obstack,
name, strlen (name)));
name = (char *) obstack_copy0 (&objfile->objfile_obstack, name,
strlen (name));
SYMBOL_SET_LINKAGE_NAME (sym, name);
SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_VALUE (sym) = ms->c_value;

View file

@ -161,7 +161,7 @@ btrace_data_append (struct btrace_data *dst,
size_t size;
size = src->variant.pt.size + dst->variant.pt.size;
data = xmalloc (size);
data = (gdb_byte *) xmalloc (size);
memcpy (data, dst->variant.pt.data, dst->variant.pt.size);
memcpy (data + dst->variant.pt.size, src->variant.pt.data,

View file

@ -37,7 +37,7 @@ buffer_grow (struct buffer *buffer, const char *data, size_t size)
while (buffer->used_size + size > new_buffer_size)
new_buffer_size *= 2;
new_buffer = xrealloc (buffer->buffer, new_buffer_size);
new_buffer = (char *) xrealloc (buffer->buffer, new_buffer_size);
memcpy (new_buffer + buffer->used_size, data, size);
buffer->buffer = new_buffer;
buffer->buffer_size = new_buffer_size;

View file

@ -316,7 +316,7 @@ gdb_fopen_cloexec (const char *filename, const char *opentype)
{
char *copy;
copy = alloca (strlen (opentype) + 2);
copy = (char *) alloca (strlen (opentype) + 2);
strcpy (copy, opentype);
/* This is a glibc extension but we try it unconditionally on
this path. */

View file

@ -99,7 +99,7 @@ parse_format_string (const char **arg)
/* Need extra space for the '\0's. Doubling the size is sufficient. */
current_substring = xmalloc (strlen (string) * 2 + 1000);
current_substring = (char *) xmalloc (strlen (string) * 2 + 1000);
max_pieces = strlen (string) + 2;

View file

@ -60,7 +60,7 @@ delim_string_to_char_ptr_vec_append (VEC (char_ptr) **vecp,
next_field++;
}
this_field = xmalloc (this_len + 1);
this_field = (char *) xmalloc (this_len + 1);
memcpy (this_field, str, this_len);
this_field[this_len] = '\0';
VEC_safe_push (char_ptr, *vecp, this_field);

View file

@ -49,7 +49,7 @@ xml_escape_text (const char *text)
}
/* Expand the result. */
result = xmalloc (i + special + 1);
result = (char *) xmalloc (i + special + 1);
for (i = 0, special = 0; text[i] != '\0'; i++)
switch (text[i])
{

View file

@ -386,7 +386,7 @@ copy_sections (bfd *abfd, asection *sect, void *data)
link_order.size = bfd_get_section_size (sect);
link_order.u.indirect.section = sect;
sect_data = xmalloc (bfd_get_section_size (sect));
sect_data = (bfd_byte *) xmalloc (bfd_get_section_size (sect));
make_cleanup (xfree, sect_data);
sect_data_got = bfd_get_relocated_section_contents (abfd, &link_info,
@ -718,7 +718,8 @@ compile_object_load (const char *object_file, const char *source_file,
/* The memory may be later needed
by bfd_generic_get_relocated_section_contents
called from default_symfile_relocate. */
symbol_table = obstack_alloc (&objfile->objfile_obstack, storage_needed);
symbol_table = (asymbol **) obstack_alloc (&objfile->objfile_obstack,
storage_needed);
number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
if (number_of_symbols < 0)
error (_("Cannot parse symbols of compiled module \"%s\": %s"),

View file

@ -125,7 +125,8 @@ compile_object_run (struct compile_module *module)
CORE_ADDR regs_addr = module->regs_addr;
struct objfile *objfile = module->objfile;
data = xmalloc (sizeof (*data) + strlen (objfile_name_s));
data = (struct do_module_cleanup *) xmalloc (sizeof (*data)
+ strlen (objfile_name_s));
data->executedp = &executed;
data->source_file = xstrdup (module->source_file);
strcpy (data->objfile_name_string, objfile_name_s);

View file

@ -165,14 +165,14 @@ filename_completer (struct cmd_list_element *ignore,
else if (word > text)
{
/* Return some portion of p. */
q = xmalloc (strlen (p) + 5);
q = (char *) xmalloc (strlen (p) + 5);
strcpy (q, p + (word - text));
xfree (p);
}
else
{
/* Return some of TEXT plus p. */
q = xmalloc (strlen (p) + (text - word) + 5);
q = (char *) xmalloc (strlen (p) + (text - word) + 5);
strncpy (q, word, text - word);
q[text - word] = '\0';
strcat (q, p);

View file

@ -376,7 +376,7 @@ read_memory_string (CORE_ADDR memaddr, char *buffer, int max_len)
CORE_ADDR
read_memory_typed_address (CORE_ADDR addr, struct type *type)
{
gdb_byte *buf = alloca (TYPE_LENGTH (type));
gdb_byte *buf = (gdb_byte *) alloca (TYPE_LENGTH (type));
read_memory (addr, buf, TYPE_LENGTH (type));
return extract_typed_address (buf, type);
@ -412,7 +412,7 @@ write_memory_unsigned_integer (CORE_ADDR addr, int len,
enum bfd_endian byte_order,
ULONGEST value)
{
gdb_byte *buf = alloca (len);
gdb_byte *buf = (gdb_byte *) alloca (len);
store_unsigned_integer (buf, len, byte_order, value);
write_memory (addr, buf, len);
@ -425,7 +425,7 @@ write_memory_signed_integer (CORE_ADDR addr, int len,
enum bfd_endian byte_order,
LONGEST value)
{
gdb_byte *buf = alloca (len);
gdb_byte *buf = (gdb_byte *) alloca (len);
store_signed_integer (buf, len, byte_order, value);
write_memory (addr, buf, len);
@ -480,7 +480,7 @@ complete_set_gnutarget (struct cmd_list_element *cmd,
for (last = 0; bfd_targets[last] != NULL; ++last)
;
bfd_targets = xrealloc (bfd_targets, (last + 2) * sizeof (const char **));
bfd_targets = XRESIZEVEC (const char *, bfd_targets, last + 2);
bfd_targets[last] = "auto";
bfd_targets[last + 1] = NULL;
}

View file

@ -547,7 +547,7 @@ get_core_register_section (struct regcache *regcache,
section_name);
}
contents = alloca (size);
contents = (char *) alloca (size);
if (! bfd_get_section_contents (core_bfd, section, contents,
(file_ptr) 0, size))
{

View file

@ -69,7 +69,7 @@ d_grab (void)
{
if (demangle_info->next == NULL)
{
more = malloc (sizeof (struct demangle_info));
more = XNEW (struct demangle_info);
more->next = NULL;
demangle_info->next = more;
}
@ -1977,7 +1977,7 @@ yyerror (char *msg)
static struct demangle_info *
allocate_info (void)
{
struct demangle_info *info = malloc (sizeof (struct demangle_info));
struct demangle_info *info = XNEW (struct demangle_info);
info->next = NULL;
info->used = 0;
@ -2007,7 +2007,7 @@ cp_new_demangle_parse_info (void)
{
struct demangle_parse_info *info;
info = malloc (sizeof (struct demangle_parse_info));
info = XNEW (struct demangle_parse_info);
info->info = NULL;
info->tree = NULL;
obstack_init (&info->obstack);

View file

@ -79,8 +79,8 @@ cp_scan_for_anonymous_namespaces (const struct symbol *const symbol,
? 0 : previous_component - 2);
int src_len = next_component;
char *dest = alloca (dest_len + 1);
char *src = alloca (src_len + 1);
char *dest = (char *) alloca (dest_len + 1);
char *src = (char *) alloca (src_len + 1);
memcpy (dest, name, dest_len);
memcpy (src, name, src_len);
@ -308,8 +308,8 @@ cp_lookup_symbol_in_namespace (const char *the_namespace, const char *name,
if (the_namespace[0] != '\0')
{
concatenated_name = alloca (strlen (the_namespace) + 2
+ strlen (name) + 1);
concatenated_name
= (char *) alloca (strlen (the_namespace) + 2 + strlen (name) + 1);
strcpy (concatenated_name, the_namespace);
strcat (concatenated_name, "::");
strcat (concatenated_name, name);
@ -740,7 +740,7 @@ lookup_namespace_scope (const struct language_defn *langdef,
if (scope_len == 0 && strchr (name, ':') == NULL)
return cp_lookup_bare_symbol (langdef, name, block, domain, 1);
the_namespace = alloca (scope_len + 1);
the_namespace = (char *) alloca (scope_len + 1);
strncpy (the_namespace, scope, scope_len);
the_namespace[scope_len] = '\0';
return cp_lookup_symbol_in_namespace (the_namespace, name,
@ -846,7 +846,7 @@ find_symbol_in_baseclass (struct type *parent_type, const char *name,
continue;
len = strlen (base_name) + 2 + strlen (name) + 1;
concatenated_name = xrealloc (concatenated_name, len);
concatenated_name = (char *) xrealloc (concatenated_name, len);
xsnprintf (concatenated_name, len, "%s::%s", base_name, name);
sym = cp_lookup_nested_symbol_1 (base_type, name, concatenated_name,
@ -977,7 +977,7 @@ cp_lookup_nested_symbol (struct type *parent_type,
int is_in_anonymous;
size = strlen (parent_name) + 2 + strlen (nested_name) + 1;
concatenated_name = alloca (size);
concatenated_name = (char *) alloca (size);
xsnprintf (concatenated_name, size, "%s::%s",
parent_name, nested_name);
is_in_anonymous = cp_is_in_anonymous (concatenated_name);
@ -1076,7 +1076,7 @@ cp_lookup_transparent_type_loop (const char *name,
return retval;
}
full_name = alloca (scope_length + 2 + strlen (name) + 1);
full_name = (char *) alloca (scope_length + 2 + strlen (name) + 1);
strncpy (full_name, scope, scope_length);
strncpy (full_name + scope_length, "::", 2);
strcpy (full_name + scope_length + 2, name);

View file

@ -92,7 +92,7 @@ copy_string_to_obstack (struct obstack *obstack, const char *string,
long *len)
{
*len = strlen (string);
return obstack_copy (obstack, string, *len);
return (char *) obstack_copy (obstack, string, *len);
}
/* A cleanup wrapper for cp_demangled_name_parse_free. */
@ -1204,7 +1204,7 @@ make_symbol_overload_list (const char *func_name,
else
{
char *concatenated_name
= alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
= (char *) alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
strcpy (concatenated_name, the_namespace);
strcat (concatenated_name, "::");
strcat (concatenated_name, func_name);
@ -1246,7 +1246,7 @@ make_symbol_overload_list_namespace (const char *func_name,
else
{
char *concatenated_name
= alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
= (char *) alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
strcpy (concatenated_name, the_namespace);
strcat (concatenated_name, "::");
@ -1297,7 +1297,7 @@ make_symbol_overload_list_adl_namespace (struct type *type,
if (prefix_len != 0)
{
the_namespace = alloca (prefix_len + 1);
the_namespace = (char *) alloca (prefix_len + 1);
strncpy (the_namespace, type_name, prefix_len);
the_namespace[prefix_len] = '\0';
@ -1646,7 +1646,7 @@ first_component_command (char *arg, int from_tty)
return;
len = cp_find_first_component (arg);
prefix = alloca (len + 1);
prefix = (char *) alloca (len + 1);
memcpy (prefix, arg, len);
prefix[len] = '\0';

View file

@ -535,7 +535,7 @@ cp_print_value (struct type *type, struct type *real_type,
gdb_byte *buf;
struct cleanup *back_to;
buf = xmalloc (TYPE_LENGTH (baseclass));
buf = (gdb_byte *) xmalloc (TYPE_LENGTH (baseclass));
back_to = make_cleanup (xfree, buf);
if (target_read_memory (address + boffset, buf,

View file

@ -1338,7 +1338,7 @@ ctf_xfer_partial (struct target_ops *ops, enum target_object object,
gdb_byte *contents;
int k;
contents = xmalloc (mlen);
contents = (gdb_byte *) xmalloc (mlen);
for (k = 0; k < mlen; k++)
{

View file

@ -640,7 +640,7 @@ StringExp:
vec->type = $1.type;
vec->length = $1.length;
vec->ptr = malloc ($1.length + 1);
vec->ptr = (char *) malloc ($1.length + 1);
memcpy (vec->ptr, $1.ptr, $1.length + 1);
}
| StringExp STRING_LITERAL
@ -648,10 +648,10 @@ StringExp:
for convenience. */
char *p;
++$$.len;
$$.tokens = realloc ($$.tokens,
$$.len * sizeof (struct typed_stoken));
$$.tokens
= XRESIZEVEC (struct typed_stoken, $$.tokens, $$.len);
p = malloc ($2.length + 1);
p = (char *) malloc ($2.length + 1);
memcpy (p, $2.ptr, $2.length + 1);
$$.tokens[$$.len - 1].type = $2.type;

View file

@ -166,8 +166,8 @@ d_lookup_symbol_in_module (const char *module, const char *name,
if (module[0] != '\0')
{
concatenated_name = alloca (strlen (module)
+ strlen (name) + 2);
concatenated_name
= (char *) alloca (strlen (module) + strlen (name) + 2);
strcpy (concatenated_name, module);
strcat (concatenated_name, ".");
strcat (concatenated_name, name);
@ -219,7 +219,7 @@ lookup_module_scope (const char *name, const struct block *block,
/* Okay, we didn't find a match in our children, so look for the
name in the current module. */
module = alloca (scope_len + 1);
module = (char *) alloca (scope_len + 1);
strncpy (module, scope, scope_len);
module[scope_len] = '\0';
return d_lookup_symbol_in_module (module, name,
@ -261,7 +261,7 @@ find_symbol_in_baseclass (struct type *parent_type, const char *name,
things like typedefs in the class. First search in this symtab,
what we want is possibly there. */
len = strlen (base_name) + strlen (name) + 2;
concatenated_name = xrealloc (concatenated_name, len);
concatenated_name = (char *) xrealloc (concatenated_name, len);
xsnprintf (concatenated_name, len, "%s.%s", base_name, name);
sym = lookup_symbol_in_static_block (concatenated_name, block,
VAR_DOMAIN);
@ -327,7 +327,7 @@ d_lookup_nested_symbol (struct type *parent_type,
module search is already not D compliant and more assumptions
could make it too magic. */
size = strlen (parent_name) + strlen (nested_name) + 2;
concatenated_name = alloca (size);
concatenated_name = (char *) alloca (size);
xsnprintf (concatenated_name, size, "%s.%s",
parent_name, nested_name);

View file

@ -1125,7 +1125,7 @@ find_stab_function_addr (char *namestring, const char *filename,
if (p == NULL)
p = namestring;
n = p - namestring;
p = alloca (n + 2);
p = (char *) alloca (n + 2);
strncpy (p, namestring, n);
p[n] = 0;
@ -1663,7 +1663,7 @@ read_dbx_symtab (struct objfile *objfile)
sym_name = NULL; /* pacify "gcc -Werror" */
if (psymtab_language == language_cplus)
{
char *new_name, *name = xmalloc (p - namestring + 1);
char *new_name, *name = (char *) xmalloc (p - namestring + 1);
memcpy (name, namestring, p - namestring);
name[p - namestring] = '\0';
@ -1671,7 +1671,7 @@ read_dbx_symtab (struct objfile *objfile)
if (new_name != NULL)
{
sym_len = strlen (new_name);
sym_name = obstack_copy0 (&objfile->objfile_obstack,
sym_name = (char *) obstack_copy0 (&objfile->objfile_obstack,
new_name, sym_len);
xfree (new_name);
}
@ -1836,7 +1836,7 @@ read_dbx_symtab (struct objfile *objfile)
if (! pst)
{
int name_len = p - namestring;
char *name = xmalloc (name_len + 1);
char *name = (char *) xmalloc (name_len + 1);
memcpy (name, namestring, name_len);
name[name_len] = '\0';
@ -1905,7 +1905,7 @@ read_dbx_symtab (struct objfile *objfile)
if (! pst)
{
int name_len = p - namestring;
char *name = xmalloc (name_len + 1);
char *name = (char *) xmalloc (name_len + 1);
memcpy (name, namestring, name_len);
name[name_len] = '\0';
@ -2229,7 +2229,7 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
if (p == NULL)
p = last_function_name;
n = p - last_function_name;
p = alloca (n + 2);
p = (char *) alloca (n + 2);
strncpy (p, last_function_name, n);
p[n] = 0;
@ -2646,7 +2646,7 @@ cp_set_block_scope (const struct symbol *symbol,
unsigned int prefix_len = cp_entire_prefix_len (name);
block_set_scope (block,
obstack_copy0 (obstack, name, prefix_len),
(const char *) obstack_copy0 (obstack, name, prefix_len),
obstack);
}
}

View file

@ -370,8 +370,9 @@ dcache_alloc (DCACHE *dcache, CORE_ADDR addr)
if (db)
remove_block (&dcache->freelist, db);
else
db = xmalloc (offsetof (struct dcache_block, data) +
dcache->line_size);
db = ((struct dcache_block *)
xmalloc (offsetof (struct dcache_block, data)
+ dcache->line_size));
dcache->size++;
}

View file

@ -240,7 +240,7 @@ _initialize_demangler (void)
libiberty_demanglers[ndems].demangling_style != unknown_demangling;
ndems++)
;
demangling_style_names = xcalloc (ndems + 1, sizeof (char *));
demangling_style_names = XCNEWVEC (const char *, ndems + 1);
for (i = 0;
libiberty_demanglers[i].demangling_style != unknown_demangling;
i++)

View file

@ -90,7 +90,7 @@ dicos_load_module_p (bfd *abfd, int header_size)
{
long i, symcount;
symbol_table = xmalloc (storage_needed);
symbol_table = (asymbol **) xmalloc (storage_needed);
symcount = bfd_canonicalize_symtab (abfd, symbol_table);
if (symcount < 0)

View file

@ -403,8 +403,8 @@ dict_create_hashed_expandable (void)
DICT_VECTOR (retval) = &dict_hashed_expandable_vector;
DICT_HASHED_NBUCKETS (retval) = DICT_EXPANDABLE_INITIAL_CAPACITY;
DICT_HASHED_BUCKETS (retval) = xcalloc (DICT_EXPANDABLE_INITIAL_CAPACITY,
sizeof (struct symbol *));
DICT_HASHED_BUCKETS (retval) = XCNEWVEC (struct symbol *,
DICT_EXPANDABLE_INITIAL_CAPACITY);
DICT_HASHED_EXPANDABLE_NSYMS (retval) = 0;
return retval;
@ -467,11 +467,9 @@ dict_create_linear_expandable (void)
DICT_VECTOR (retval) = &dict_linear_expandable_vector;
DICT_LINEAR_NSYMS (retval) = 0;
DICT_LINEAR_EXPANDABLE_CAPACITY (retval)
= DICT_EXPANDABLE_INITIAL_CAPACITY;
DICT_LINEAR_EXPANDABLE_CAPACITY (retval) = DICT_EXPANDABLE_INITIAL_CAPACITY;
DICT_LINEAR_SYMS (retval)
= xmalloc (DICT_LINEAR_EXPANDABLE_CAPACITY (retval)
* sizeof (struct symbol *));
= XNEWVEC (struct symbol *, DICT_LINEAR_EXPANDABLE_CAPACITY (retval));
return retval;
}
@ -752,9 +750,8 @@ expand_hashtable (struct dictionary *dict)
{
int old_nbuckets = DICT_HASHED_NBUCKETS (dict);
struct symbol **old_buckets = DICT_HASHED_BUCKETS (dict);
int new_nbuckets = 2*old_nbuckets + 1;
struct symbol **new_buckets = xcalloc (new_nbuckets,
sizeof (struct symbol *));
int new_nbuckets = 2 * old_nbuckets + 1;
struct symbol **new_buckets = XCNEWVEC (struct symbol *, new_nbuckets);
int i;
DICT_HASHED_NBUCKETS (dict) = new_nbuckets;
@ -940,9 +937,8 @@ add_symbol_linear_expandable (struct dictionary *dict,
{
DICT_LINEAR_EXPANDABLE_CAPACITY (dict) *= 2;
DICT_LINEAR_SYMS (dict)
= xrealloc (DICT_LINEAR_SYMS (dict),
DICT_LINEAR_EXPANDABLE_CAPACITY (dict)
* sizeof (struct symbol *));
= XRESIZEVEC (struct symbol *, DICT_LINEAR_SYMS (dict),
DICT_LINEAR_EXPANDABLE_CAPACITY (dict));
}
DICT_LINEAR_SYM (dict, nsyms - 1) = sym;

View file

@ -1736,8 +1736,8 @@ add_cie (struct dwarf2_cie_table *cie_table, struct dwarf2_cie *cie)
gdb_assert (n < 1
|| cie_table->entries[n - 1]->cie_pointer < cie->cie_pointer);
cie_table->entries =
xrealloc (cie_table->entries, (n + 1) * sizeof (cie_table->entries[0]));
cie_table->entries
= XRESIZEVEC (struct dwarf2_cie *, cie_table->entries, n + 1);
cie_table->entries[n] = cie;
cie_table->num_entries = n + 1;
}
@ -1811,9 +1811,8 @@ add_fde (struct dwarf2_fde_table *fde_table, struct dwarf2_fde *fde)
return;
fde_table->num_entries += 1;
fde_table->entries =
xrealloc (fde_table->entries,
fde_table->num_entries * sizeof (fde_table->entries[0]));
fde_table->entries = XRESIZEVEC (struct dwarf2_fde *, fde_table->entries,
fde_table->num_entries);
fde_table->entries[fde_table->num_entries - 1] = fde;
}
@ -2371,9 +2370,9 @@ dwarf2_build_frame_info (struct objfile *objfile)
}
else
{
fde_table.entries = xrealloc (fde_table.entries,
fde_table.num_entries *
sizeof (fde_table.entries[0]));
fde_table.entries
= XRESIZEVEC (struct dwarf2_fde *, fde_table.entries,
fde_table.num_entries);
}
}
fde_table.num_entries = num_old_fde_entries;
@ -2454,7 +2453,8 @@ dwarf2_build_frame_info (struct objfile *objfile)
++fde_table2->num_entries;
fde_prev = fde;
}
fde_table2->entries = obstack_finish (&objfile->objfile_obstack);
fde_table2->entries
= (struct dwarf2_fde **) obstack_finish (&objfile->objfile_obstack);
/* Discard the original fde_table. */
xfree (fde_table.entries);

View file

@ -140,8 +140,7 @@ dwarf_expr_grow_stack (struct dwarf_expr_context *ctx, size_t need)
{
size_t newlen = ctx->stack_len + need + 10;
ctx->stack = xrealloc (ctx->stack,
newlen * sizeof (struct dwarf_stack_value));
ctx->stack = XRESIZEVEC (struct dwarf_stack_value, ctx->stack, newlen);
ctx->stack_allocated = newlen;
}
}
@ -270,7 +269,7 @@ dwarf_expr_fetch_address (struct dwarf_expr_context *ctx, int n)
for those architectures which require it. */
if (gdbarch_integer_to_address_p (ctx->gdbarch))
{
gdb_byte *buf = alloca (ctx->addr_size);
gdb_byte *buf = (gdb_byte *) alloca (ctx->addr_size);
struct type *int_type = get_unsigned_type (ctx->gdbarch,
value_type (result_val));
@ -309,9 +308,8 @@ add_piece (struct dwarf_expr_context *ctx, ULONGEST size, ULONGEST offset)
ctx->num_pieces++;
ctx->pieces = xrealloc (ctx->pieces,
(ctx->num_pieces
* sizeof (struct dwarf_expr_piece)));
ctx->pieces
= XRESIZEVEC (struct dwarf_expr_piece, ctx->pieces, ctx->num_pieces);
p = &ctx->pieces[ctx->num_pieces - 1];
p->location = ctx->location;
@ -1025,7 +1023,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
case DW_OP_GNU_deref_type:
{
int addr_size = (op == DW_OP_deref ? ctx->addr_size : *op_ptr++);
gdb_byte *buf = alloca (addr_size);
gdb_byte *buf = (gdb_byte *) alloca (addr_size);
CORE_ADDR addr = dwarf_expr_fetch_address (ctx, 0);
struct type *type;
@ -1051,7 +1049,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
ULONGEST result =
extract_unsigned_integer (buf, addr_size, byte_order);
buf = alloca (TYPE_LENGTH (type));
buf = (gdb_byte *) alloca (TYPE_LENGTH (type));
store_unsigned_integer (buf, TYPE_LENGTH (type),
byte_order, result);
}

View file

@ -823,8 +823,9 @@ chain_candidate (struct gdbarch *gdbarch, struct call_site_chain **resultp,
{
/* Create the initial chain containing all the passed PCs. */
result = xmalloc (sizeof (*result) + sizeof (*result->call_site)
* (length - 1));
result = ((struct call_site_chain *)
xmalloc (sizeof (*result)
+ sizeof (*result->call_site) * (length - 1)));
result->length = length;
result->callers = result->callees = length;
if (!VEC_empty (call_sitep, chain))
@ -1232,7 +1233,7 @@ dwarf_entry_parameter_to_value (struct call_site_parameter *parameter,
/* DW_AT_GNU_call_site_value is a DWARF expression, not a DWARF
location. Postprocessing of DWARF_VALUE_MEMORY would lose the type from
DWARF block. */
data = alloca (size + 1);
data = (gdb_byte *) alloca (size + 1);
memcpy (data, data_src, size);
data[size] = DW_OP_stack_value;
@ -1744,7 +1745,7 @@ read_pieced_value (struct value *v)
if (buffer_size < this_size)
{
buffer_size = this_size;
buffer = xrealloc (buffer, buffer_size);
buffer = (gdb_byte *) xrealloc (buffer, buffer_size);
}
intermediate_buffer = buffer;
@ -1935,7 +1936,7 @@ write_pieced_value (struct value *to, struct value *from)
if (buffer_size < this_size)
{
buffer_size = this_size;
buffer = xrealloc (buffer, buffer_size);
buffer = (gdb_byte *) xrealloc (buffer, buffer_size);
}
source_buffer = buffer;
need_bitwise = 1;

View file

@ -2324,7 +2324,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
return;
}
buf = obstack_alloc (&objfile->objfile_obstack, info->size);
buf = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, info->size);
info->buffer = buf;
/* When debugging .o files, we may need to apply relocations; see
@ -4806,9 +4806,9 @@ add_type_unit (ULONGEST sig, void **slot)
dwarf2_per_objfile->n_allocated_type_units = 1;
dwarf2_per_objfile->n_allocated_type_units *= 2;
dwarf2_per_objfile->all_type_units
= xrealloc (dwarf2_per_objfile->all_type_units,
dwarf2_per_objfile->n_allocated_type_units
* sizeof (struct signatured_type *));
= XRESIZEVEC (struct signatured_type *,
dwarf2_per_objfile->all_type_units,
dwarf2_per_objfile->n_allocated_type_units);
++dwarf2_per_objfile->tu_stats.nr_all_type_units_reallocs;
}
dwarf2_per_objfile->n_type_units = n_type_units;
@ -6571,9 +6571,8 @@ read_comp_units_from_section (struct objfile *objfile,
if (*n_comp_units == *n_allocated)
{
*n_allocated *= 2;
*all_comp_units = xrealloc (*all_comp_units,
*n_allocated
* sizeof (struct dwarf2_per_cu_data *));
*all_comp_units = XRESIZEVEC (struct dwarf2_per_cu_data *,
*all_comp_units, *n_allocated);
}
(*all_comp_units)[*n_comp_units] = this_cu;
++*n_comp_units;
@ -7829,7 +7828,7 @@ fixup_go_packaging (struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->objfile;
const char *saved_package_name
= obstack_copy0 (&objfile->per_bfd->storage_obstack,
= (const char *) obstack_copy0 (&objfile->per_bfd->storage_obstack,
package_name,
strlen (package_name));
struct type *type = init_type (TYPE_CODE_MODULE, 0, 0,
@ -8649,9 +8648,10 @@ dwarf2_compute_name (const char *name,
INTERMEDIATE_NAME is already canonical, then we need to
copy it to the appropriate obstack. */
if (canonical_name == NULL || canonical_name == intermediate_name)
name = obstack_copy0 (&objfile->per_bfd->storage_obstack,
name = ((const char *)
obstack_copy0 (&objfile->per_bfd->storage_obstack,
intermediate_name,
strlen (intermediate_name));
strlen (intermediate_name)));
else
name = canonical_name;
@ -8777,8 +8777,9 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
retval = canon;
if (need_copy)
retval = obstack_copy0 (&objfile->per_bfd->storage_obstack,
retval, strlen (retval));
retval = ((const char *)
obstack_copy0 (&objfile->per_bfd->storage_obstack,
retval, strlen (retval)));
do_cleanups (back_to);
return retval;
@ -10105,7 +10106,8 @@ create_dwo_unit_in_dwp_v1 (struct dwp_file *dwp_file,
virtual_dwo_name);
}
dwo_file = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct dwo_file);
dwo_file->dwo_name = obstack_copy0 (&objfile->objfile_obstack,
dwo_file->dwo_name
= (const char *) obstack_copy0 (&objfile->objfile_obstack,
virtual_dwo_name,
strlen (virtual_dwo_name));
dwo_file->comp_dir = comp_dir;
@ -10306,7 +10308,8 @@ create_dwo_unit_in_dwp_v2 (struct dwp_file *dwp_file,
virtual_dwo_name);
}
dwo_file = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct dwo_file);
dwo_file->dwo_name = obstack_copy0 (&objfile->objfile_obstack,
dwo_file->dwo_name
= (const char *) obstack_copy0 (&objfile->objfile_obstack,
virtual_dwo_name,
strlen (virtual_dwo_name));
dwo_file->comp_dir = comp_dir;
@ -11393,8 +11396,8 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
attr = dwarf2_attr (die, DW_AT_static_link, cu);
if (attr)
{
newobj->static_link = obstack_alloc (&objfile->objfile_obstack,
sizeof (*newobj->static_link));
newobj->static_link
= XOBNEW (&objfile->objfile_obstack, struct dynamic_prop);
attr_to_dynamic_prop (attr, die, cu, newobj->static_link);
}
@ -11615,10 +11618,11 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
nparams++;
}
call_site = obstack_alloc (&objfile->objfile_obstack,
(sizeof (*call_site)
+ (sizeof (*call_site->parameter)
* (nparams - 1))));
call_site
= ((struct call_site *)
obstack_alloc (&objfile->objfile_obstack,
sizeof (*call_site)
+ (sizeof (*call_site->parameter) * (nparams - 1))));
*slot = call_site;
memset (call_site, 0, sizeof (*call_site) - sizeof (*call_site->parameter));
call_site->pc = pc;
@ -12692,7 +12696,7 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type,
unsigned char *pointer;
ALLOCATE_CPLUS_STRUCT_TYPE (type);
pointer = TYPE_ALLOC (type, num_bytes);
pointer = (unsigned char *) TYPE_ALLOC (type, num_bytes);
TYPE_FIELD_VIRTUAL_BITS (type) = pointer;
B_CLRALL (TYPE_FIELD_VIRTUAL_BITS (type), fip->nbaseclasses);
TYPE_N_BASECLASSES (type) = fip->nbaseclasses;
@ -13383,7 +13387,8 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
ALLOCATE_CPLUS_STRUCT_TYPE (type);
TYPE_TYPEDEF_FIELD_ARRAY (type)
= TYPE_ALLOC (type, sizeof (TYPE_TYPEDEF_FIELD (type, 0)) * i);
= ((struct typedef_field *)
TYPE_ALLOC (type, sizeof (TYPE_TYPEDEF_FIELD (type, 0)) * i));
TYPE_TYPEDEF_FIELD_COUNT (type) = i;
/* Reverse the list order to keep the debug info elements order. */
@ -13904,7 +13909,7 @@ mark_common_block_symbol_computed (struct symbol *sym,
else
baton->size += DW_BLOCK (member_loc)->size;
ptr = obstack_alloc (&objfile->objfile_obstack, baton->size);
ptr = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, baton->size);
baton->data = ptr;
*ptr++ = DW_OP_call4;
@ -13980,7 +13985,9 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
size = (sizeof (struct common_block)
+ (n_entries - 1) * sizeof (struct symbol *));
common_block = obstack_alloc (&objfile->objfile_obstack, size);
common_block
= (struct common_block *) obstack_alloc (&objfile->objfile_obstack,
size);
memset (common_block->contents, 0, n_entries * sizeof (struct symbol *));
common_block->n_entries = 0;
@ -15360,8 +15367,7 @@ abbrev_table_read_table (struct dwarf2_section_info *section,
{
allocated_attrs += ATTR_ALLOC_CHUNK;
cur_attrs
= xrealloc (cur_attrs, (allocated_attrs
* sizeof (struct attr_abbrev)));
= XRESIZEVEC (struct attr_abbrev, cur_attrs, allocated_attrs);
}
cur_attrs[cur_abbrev->num_attrs].name
@ -16098,9 +16104,10 @@ guess_partial_die_structure_name (struct partial_die_info *struct_pdi,
if (actual_class_name != NULL)
{
struct_pdi->name
= obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
= ((const char *)
obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
actual_class_name,
strlen (actual_class_name));
strlen (actual_class_name)));
xfree (actual_class_name);
}
break;
@ -16185,8 +16192,9 @@ fixup_partial_die (struct partial_die_info *part_die,
base = demangled;
part_die->name
= obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
base, strlen (base));
= ((const char *)
obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
base, strlen (base)));
xfree (demangled);
}
}
@ -17233,9 +17241,8 @@ add_file_name (struct line_header *lh,
else if (lh->num_file_names >= lh->file_names_size)
{
lh->file_names_size *= 2;
lh->file_names = xrealloc (lh->file_names,
(lh->file_names_size
* sizeof (*lh->file_names)));
lh->file_names
= XRESIZEVEC (struct file_entry, lh->file_names, lh->file_names_size);
}
fe = &lh->file_names[lh->num_file_names++];
@ -18703,7 +18710,7 @@ dwarf2_const_value_data (const struct attribute *attr, struct obstack *obstack,
*value = l;
else
{
gdb_byte *bytes = obstack_alloc (obstack, bits / 8);
gdb_byte *bytes = (gdb_byte *) obstack_alloc (obstack, bits / 8);
store_unsigned_integer (bytes, bits / 8, byte_order, l);
return bytes;
}
@ -18753,7 +18760,7 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
gdb_assert ((*baton)->per_cu);
(*baton)->size = 2 + cu_header->addr_size;
data = obstack_alloc (obstack, (*baton)->size);
data = (gdb_byte *) obstack_alloc (obstack, (*baton)->size);
(*baton)->data = data;
data[0] = DW_OP_addr;
@ -18947,7 +18954,7 @@ build_error_marker_type (struct dwarf2_cu *cu, struct die_info *die)
objfile_name (objfile),
cu->header.offset.sect_off,
die->offset.sect_off);
saved = obstack_copy0 (&objfile->objfile_obstack,
saved = (char *) obstack_copy0 (&objfile->objfile_obstack,
message, strlen (message));
xfree (message);
@ -19187,10 +19194,9 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu)
if (actual_name_len > die_name_len + 2
&& actual_name[actual_name_len
- die_name_len - 1] == ':')
name =
obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
actual_name,
actual_name_len - die_name_len - 2);
name = (char *) obstack_copy0 (
&cu->objfile->per_bfd->storage_obstack,
actual_name, actual_name_len - die_name_len - 2);
}
}
xfree (actual_name);
@ -19233,8 +19239,9 @@ anonymous_struct_prefix (struct die_info *die, struct dwarf2_cu *cu)
if (base == NULL || base == DW_STRING (attr) || base[-1] != ':')
return "";
return obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
DW_STRING (attr), &base[-1] - DW_STRING (attr));
return (char *) obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
DW_STRING (attr),
&base[-1] - DW_STRING (attr));
}
/* Return the name of the namespace/class that DIE is defined within,
@ -19448,7 +19455,8 @@ typename_concat (struct obstack *obs, const char *prefix, const char *suffix,
if (obs == NULL)
{
char *retval
= xmalloc (strlen (prefix) + MAX_SEP_LEN + strlen (suffix) + 1);
= ((char *)
xmalloc (strlen (prefix) + MAX_SEP_LEN + strlen (suffix) + 1));
strcpy (retval, lead);
strcat (retval, prefix);
@ -19484,7 +19492,8 @@ dwarf2_canonicalize_name (const char *name, struct dwarf2_cu *cu,
if (canon_name != NULL)
{
if (strcmp (canon_name, name) != 0)
name = obstack_copy0 (obstack, canon_name, strlen (canon_name));
name = (const char *) obstack_copy0 (obstack, canon_name,
strlen (canon_name));
xfree (canon_name);
}
}
@ -19593,8 +19602,9 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
/* FIXME: we already did this for the partial symbol... */
DW_STRING (attr)
= obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
demangled, strlen (demangled));
= ((const char *)
obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
demangled, strlen (demangled)));
DW_STRING_IS_CANONICAL (attr) = 1;
xfree (demangled);
@ -20122,7 +20132,7 @@ write_constant_as_bytes (struct obstack *obstack,
gdb_byte *result;
*len = TYPE_LENGTH (type);
result = obstack_alloc (obstack, *len);
result = (gdb_byte *) obstack_alloc (obstack, *len);
store_unsigned_integer (result, *len, byte_order, value);
return result;
@ -20181,7 +20191,7 @@ dwarf2_fetch_constant_bytes (sect_offset offset,
gdb_byte *tem;
*len = cu->header.addr_size;
tem = obstack_alloc (obstack, *len);
tem = (gdb_byte *) obstack_alloc (obstack, *len);
store_unsigned_integer (tem, *len, byte_order, DW_ADDR (attr));
result = tem;
}
@ -20911,7 +20921,7 @@ macro_start_file (int file, int line,
static char *
copy_string (const char *buf, int len)
{
char *s = xmalloc (len + 1);
char *s = (char *) xmalloc (len + 1);
memcpy (s, buf, len);
s[len] = '\0';
@ -21022,7 +21032,7 @@ parse_macro_definition (struct macro_source_file *file, int line,
if (argc >= argv_size)
{
argv_size *= 2;
argv = xrealloc (argv, argv_size * sizeof (*argv));
argv = XRESIZEVEC (char *, argv, argv_size);
}
argv[argc++] = copy_string (arg_start, p - arg_start);

View file

@ -89,7 +89,7 @@ elf_symfile_segments (bfd *abfd)
if (phdrs_size == -1)
return NULL;
phdrs = alloca (phdrs_size);
phdrs = (Elf_Internal_Phdr *) alloca (phdrs_size);
num_phdrs = bfd_get_elf_phdrs (abfd, phdrs);
if (num_phdrs == -1)
return NULL;
@ -603,7 +603,7 @@ elf_rel_plt_read (struct objfile *objfile, asymbol **dyn_symbol_table)
if (string_buffer_size < name_len + got_suffix_len + 1)
{
string_buffer_size = 2 * (name_len + got_suffix_len);
string_buffer = xrealloc (string_buffer, string_buffer_size);
string_buffer = (char *) xrealloc (string_buffer, string_buffer_size);
}
memcpy (string_buffer, name, name_len);
memcpy (&string_buffer[name_len], SYMBOL_GOT_PLT_SUFFIX,
@ -702,7 +702,8 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr)
obstack_grow (&objfile->objfile_obstack, &entry_local,
offsetof (struct elf_gnu_ifunc_cache, name));
obstack_grow_str0 (&objfile->objfile_obstack, name);
entry_p = obstack_finish (&objfile->objfile_obstack);
entry_p
= (struct elf_gnu_ifunc_cache *) obstack_finish (&objfile->objfile_obstack);
slot = htab_find_slot (htab, entry_p, INSERT);
if (*slot != NULL)
@ -750,7 +751,8 @@ elf_gnu_ifunc_resolve_by_cache (const char *name, CORE_ADDR *addr_p)
if (htab == NULL)
continue;
entry_p = alloca (sizeof (*entry_p) + strlen (name));
entry_p = ((struct elf_gnu_ifunc_cache *)
alloca (sizeof (*entry_p) + strlen (name)));
strcpy (entry_p->name, name);
slot = htab_find_slot (htab, entry_p, NO_INSERT);
@ -782,7 +784,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
struct objfile *objfile;
const size_t got_suffix_len = strlen (SYMBOL_GOT_PLT_SUFFIX);
name_got_plt = alloca (strlen (name) + got_suffix_len + 1);
name_got_plt = (char *) alloca (strlen (name) + got_suffix_len + 1);
sprintf (name_got_plt, "%s" SYMBOL_GOT_PLT_SUFFIX, name);
ALL_PSPACE_OBJFILES (current_program_space, objfile)
@ -793,7 +795,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
size_t ptr_size = TYPE_LENGTH (ptr_type);
CORE_ADDR pointer_address, addr;
asection *plt;
gdb_byte *buf = alloca (ptr_size);
gdb_byte *buf = (gdb_byte *) alloca (ptr_size);
struct bound_minimal_symbol msym;
msym = lookup_minimal_symbol (name_got_plt, NULL, objfile);
@ -1058,7 +1060,7 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags,
/* Memory gets permanently referenced from ABFD after
bfd_canonicalize_symtab so it must not get freed before ABFD gets. */
symbol_table = bfd_alloc (abfd, storage_needed);
symbol_table = (asymbol **) bfd_alloc (abfd, storage_needed);
symcount = bfd_canonicalize_symtab (objfile->obfd, symbol_table);
if (symcount < 0)
@ -1082,7 +1084,7 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags,
done by _bfd_elf_get_synthetic_symtab which is all a bfd
implementation detail, though. */
dyn_symbol_table = bfd_alloc (abfd, storage_needed);
dyn_symbol_table = (asymbol **) bfd_alloc (abfd, storage_needed);
dynsymcount = bfd_canonicalize_dynamic_symtab (objfile->obfd,
dyn_symbol_table);

View file

@ -397,7 +397,7 @@ top_level_prompt (void)
}
prompt_length = strlen (prefix) + strlen (prompt) + strlen (suffix);
composed_prompt = xmalloc (prompt_length + 1);
composed_prompt = (char *) xmalloc (prompt_length + 1);
strcpy (composed_prompt, prefix);
strcat (composed_prompt, prompt);
@ -681,7 +681,8 @@ command_line_handler (char *rl)
{
if (linelength > saved_command_line_size)
{
saved_command_line = xrealloc (saved_command_line, linelength);
saved_command_line
= (char *) xrealloc (saved_command_line, linelength);
saved_command_line_size = linelength;
}
strcpy (saved_command_line, linebuffer);

View file

@ -453,8 +453,8 @@ resize_section_table (struct target_section_table *table, int adjustment)
if (new_count)
{
table->sections = xrealloc (table->sections,
sizeof (struct target_section) * new_count);
table->sections = XRESIZEVEC (struct target_section, table->sections,
new_count);
table->sections_end = table->sections + new_count;
}
else

View file

@ -240,7 +240,7 @@ print_subexp_standard (struct expression *exp, int *pos,
{
char *s, *nextS;
s = alloca (strlen (selector) + 1);
s = (char *) alloca (strlen (selector) + 1);
strcpy (s, selector);
for (tem = 0; tem < nargs; tem++)
{
@ -280,7 +280,7 @@ print_subexp_standard (struct expression *exp, int *pos,
a simple string, revert back to array printing. Note that
the last expression element is an explicit null terminator
byte, which doesn't get printed. */
tempstr = alloca (nargs);
tempstr = (char *) alloca (nargs);
pc += 4;
while (tem < nargs)
{

View file

@ -68,7 +68,7 @@ fbsd_collect_regset_section_cb (const char *sect_name, int size,
gdb_assert (regset->collect_regset);
buf = xmalloc (size);
buf = (char *) xmalloc (size);
regset->collect_regset (regset, data->regcache, -1, buf, size);
/* PRSTATUS still needs to be treated specially. */

View file

@ -75,7 +75,7 @@ parse_find_args (char *args, ULONGEST *max_countp,
if (args == NULL)
error (_("Missing search parameters."));
pattern_buf = xmalloc (pattern_buf_size);
pattern_buf = (gdb_byte *) xmalloc (pattern_buf_size);
pattern_buf_end = pattern_buf;
old_cleanups = make_cleanup (free_current_contents, &pattern_buf);
@ -184,7 +184,7 @@ parse_find_args (char *args, ULONGEST *max_countp,
size_t current_offset = pattern_buf_end - pattern_buf;
pattern_buf_size = pattern_buf_size_need * 2;
pattern_buf = xrealloc (pattern_buf, pattern_buf_size);
pattern_buf = (gdb_byte *) xrealloc (pattern_buf, pattern_buf_size);
pattern_buf_end = pattern_buf + current_offset;
}

View file

@ -939,7 +939,7 @@ address_from_register (int regnum, struct frame_info *frame)
pointer types. Avoid constructing a value object in those cases. */
if (gdbarch_convert_register_p (gdbarch, regnum, type))
{
gdb_byte *buf = alloca (TYPE_LENGTH (type));
gdb_byte *buf = (gdb_byte *) alloca (TYPE_LENGTH (type));
int optim, unavail, ok;
ok = gdbarch_register_to_value (gdbarch, frame, regnum, type,

View file

@ -1985,7 +1985,7 @@ get_prev_frame_always (struct frame_info *this_frame)
pointer to the frame, this allows the STOP_STRING on the
frame to be of type 'const char *'. */
size = strlen (ex.message) + 1;
stop_string = frame_obstack_zalloc (size);
stop_string = (char *) frame_obstack_zalloc (size);
memcpy (stop_string, ex.message, size);
this_frame->stop_string = stop_string;
}

View file

@ -523,7 +523,8 @@ gdb_bfd_ref (struct bfd *abfd)
/* Ask BFD to decompress sections in bfd_get_full_section_contents. */
abfd->flags |= BFD_DECOMPRESS;
gdata = bfd_zalloc (abfd, sizeof (struct gdb_bfd_data));
gdata
= (struct gdb_bfd_data *) bfd_zalloc (abfd, sizeof (struct gdb_bfd_data));
gdata->refc = 1;
gdata->mtime = bfd_get_mtime (abfd);
gdata->size = bfd_get_size (abfd);
@ -630,7 +631,8 @@ get_section_descriptor (asection *section)
if (result == NULL)
{
result = bfd_zalloc (section->owner, sizeof (*result));
result = ((struct gdb_bfd_section_data *)
bfd_zalloc (section->owner, sizeof (*result)));
bfd_set_section_userdata (section->owner, section, result);
}

View file

@ -43,7 +43,7 @@ obconcat (struct obstack *obstackp, ...)
va_end (ap);
obstack_1grow (obstackp, 0);
return obstack_finish (obstackp);
return (char *) obstack_finish (obstackp);
}
/* See gdb_obstack.h. */
@ -51,7 +51,7 @@ obconcat (struct obstack *obstackp, ...)
char *
obstack_strdup (struct obstack *obstackp, const char *string)
{
char *obstring = obstack_alloc (obstackp, strlen (string) + 1);
char *obstring = (char *) obstack_alloc (obstackp, strlen (string) + 1);
strcpy (obstring, string);
return obstring;
}

View file

@ -1,3 +1,51 @@
2015-09-25 Simon Marchi <simon.marchi@ericsson.com>
* ax.c (gdb_parse_agent_expr): Add cast to allocation result
assignment.
(gdb_unparse_agent_expr): Likewise.
* hostio.c (require_data): Likewise.
(handle_pread): Likewise.
* linux-low.c (disable_regset): Likewise.
(fetch_register): Likewise.
(store_register): Likewise.
(get_dynamic): Likewise.
(linux_qxfer_libraries_svr4): Likewise.
* mem-break.c (delete_fast_tracepoint_jump): Likewise.
(set_fast_tracepoint_jump): Likewise.
(uninsert_fast_tracepoint_jumps_at): Likewise.
(reinsert_fast_tracepoint_jumps_at): Likewise.
(validate_inserted_breakpoint): Likewise.
(clone_agent_expr): Likewise.
* regcache.c (init_register_cache): Likewise.
* remote-utils.c (putpkt_binary_1): Likewise.
(decode_M_packet): Likewise.
(decode_X_packet): Likewise.
(look_up_one_symbol): Likewise.
(relocate_instruction): Likewise.
(monitor_output): Likewise.
* server.c (handle_search_memory): Likewise.
(handle_qxfer_exec_file): Likewise.
(handle_qxfer_libraries): Likewise.
(handle_qxfer): Likewise.
(handle_query): Likewise.
(handle_v_cont): Likewise.
(handle_v_run): Likewise.
(captured_main): Likewise.
* target.c (write_inferior_memory): Likewise.
* thread-db.c (try_thread_db_load_from_dir): Likewise.
* tracepoint.c (init_trace_buffer): Likewise.
(add_tracepoint_action): Likewise.
(add_traceframe): Likewise.
(add_traceframe_block): Likewise.
(cmd_qtdpsrc): Likewise.
(cmd_qtdv): Likewise.
(cmd_qtstatus): Likewise.
(response_source): Likewise.
(response_tsv): Likewise.
(cmd_qtnotes): Likewise.
(gdb_collect): Likewise.
(initialize_tracepoint): Likewise.
2015-09-21 Pierre Langlois <pierre.langlois@arm.com>
* linux-aarch64-low-.c: Include ax.h and tracepoint.h.

View file

@ -106,7 +106,7 @@ gdb_parse_agent_expr (char **actparm)
++act; /* skip a comma */
aexpr = XNEW (struct agent_expr);
aexpr->length = xlen;
aexpr->bytes = xmalloc (xlen);
aexpr->bytes = (unsigned char *) xmalloc (xlen);
hex2bin (act, aexpr->bytes, xlen);
*actparm = act + (xlen * 2);
return aexpr;
@ -131,7 +131,7 @@ gdb_unparse_agent_expr (struct agent_expr *aexpr)
{
char *rslt;
rslt = xmalloc (2 * aexpr->length + 1);
rslt = (char *) xmalloc (2 * aexpr->length + 1);
bin2hex (aexpr->bytes, rslt, aexpr->length);
return rslt;
}

View file

@ -126,7 +126,7 @@ require_data (char *p, int p_len, char **data, int *data_len)
{
int input_index, output_index, escaped;
*data = xmalloc (p_len);
*data = (char *) xmalloc (p_len);
output_index = 0;
escaped = 0;
@ -371,7 +371,7 @@ handle_pread (char *own_buf, int *new_packet_len)
if (len > max_reply_size)
len = max_reply_size;
data = xmalloc (len);
data = (char *) xmalloc (len);
#ifdef HAVE_PREAD
ret = pread (fd, data, len, offset);
#else

View file

@ -4896,7 +4896,7 @@ disable_regset (struct regsets_info *info, struct regset_info *regset)
dr_offset = regset - info->regsets;
if (info->disabled_regsets == NULL)
info->disabled_regsets = xcalloc (1, info->num_regsets);
info->disabled_regsets = (char *) xcalloc (1, info->num_regsets);
info->disabled_regsets[dr_offset] = 1;
}
@ -5119,7 +5119,7 @@ fetch_register (const struct usrregs_info *usrregs,
size = ((register_size (regcache->tdesc, regno)
+ sizeof (PTRACE_XFER_TYPE) - 1)
& -sizeof (PTRACE_XFER_TYPE));
buf = alloca (size);
buf = (char *) alloca (size);
pid = lwpid_of (current_thread);
for (i = 0; i < size; i += sizeof (PTRACE_XFER_TYPE))
@ -5163,7 +5163,7 @@ store_register (const struct usrregs_info *usrregs,
size = ((register_size (regcache->tdesc, regno)
+ sizeof (PTRACE_XFER_TYPE) - 1)
& -sizeof (PTRACE_XFER_TYPE));
buf = alloca (size);
buf = (char *) alloca (size);
memset (buf, 0, size);
if (the_low_target.collect_ptrace_register)
@ -6324,7 +6324,7 @@ get_dynamic (const int pid, const int is_elf64)
return 0;
gdb_assert (num_phdr < 100); /* Basic sanity check. */
phdr_buf = alloca (num_phdr * phdr_size);
phdr_buf = (unsigned char *) alloca (num_phdr * phdr_size);
if (linux_read_memory (phdr_memaddr, phdr_buf, num_phdr * phdr_size))
return 0;
@ -6653,7 +6653,7 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf,
}
}
document = xmalloc (allocated);
document = (char *) xmalloc (allocated);
strcpy (document, "<library-list-svr4 version=\"1.0\"");
p = document + strlen (document);
@ -6714,7 +6714,7 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf,
/* Expand to guarantee sufficient storage. */
uintptr_t document_len = p - document;
document = xrealloc (document, 2 * allocated);
document = (char *) xrealloc (document, 2 * allocated);
allocated *= 2;
p = document + document_len;
}

View file

@ -527,7 +527,7 @@ delete_fast_tracepoint_jump (struct fast_tracepoint_jump *todel)
pass the current shadow contents, because
write_inferior_memory updates any shadow memory with
what we pass here, and we want that to be a nop. */
buf = alloca (bp->length);
buf = (unsigned char *) alloca (bp->length);
memcpy (buf, fast_tracepoint_jump_shadow (bp), bp->length);
ret = write_inferior_memory (bp->pc, buf, bp->length);
if (ret != 0)
@ -585,12 +585,12 @@ set_fast_tracepoint_jump (CORE_ADDR where,
/* We don't, so create a new object. Double the length, because the
flexible array member holds both the jump insn, and the
shadow. */
jp = xcalloc (1, sizeof (*jp) + (length * 2));
jp = (struct fast_tracepoint_jump *) xcalloc (1, sizeof (*jp) + (length * 2));
jp->pc = where;
jp->length = length;
memcpy (fast_tracepoint_jump_insn (jp), insn, length);
jp->refcount = 1;
buf = alloca (length);
buf = (unsigned char *) alloca (length);
/* Note that there can be trap breakpoints inserted in the same
address range. To access the original memory contents, we use
@ -670,7 +670,7 @@ uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc)
pass the current shadow contents, because
write_inferior_memory updates any shadow memory with what we
pass here, and we want that to be a nop. */
buf = alloca (jp->length);
buf = (unsigned char *) alloca (jp->length);
memcpy (buf, fast_tracepoint_jump_shadow (jp), jp->length);
err = write_inferior_memory (jp->pc, buf, jp->length);
if (err != 0)
@ -717,7 +717,7 @@ reinsert_fast_tracepoint_jumps_at (CORE_ADDR where)
to pass the current shadow contents, because
write_inferior_memory updates any shadow memory with what we pass
here, and we want that to be a nop. */
buf = alloca (jp->length);
buf = (unsigned char *) alloca (jp->length);
memcpy (buf, fast_tracepoint_jump_shadow (jp), jp->length);
err = write_inferior_memory (where, buf, jp->length);
if (err != 0)
@ -1669,7 +1669,7 @@ validate_inserted_breakpoint (struct raw_breakpoint *bp)
gdb_assert (bp->inserted);
gdb_assert (bp->raw_type == raw_bkpt_type_sw);
buf = alloca (breakpoint_len);
buf = (unsigned char *) alloca (breakpoint_len);
err = (*the_target->read_memory) (bp->pc, buf, breakpoint_len);
if (err || memcmp (buf, breakpoint_data, breakpoint_len) != 0)
{
@ -1939,7 +1939,7 @@ clone_agent_expr (const struct agent_expr *src_ax)
ax = XCNEW (struct agent_expr);
ax->length = src_ax->length;
ax->bytes = xcalloc (ax->length, 1);
ax->bytes = (unsigned char *) xcalloc (ax->length, 1);
memcpy (ax->bytes, src_ax->bytes, ax->length);
return ax;
}

View file

@ -131,9 +131,11 @@ init_register_cache (struct regcache *regcache,
fetches. This way they'll read as zero instead of
garbage. */
regcache->tdesc = tdesc;
regcache->registers = xcalloc (1, tdesc->registers_size);
regcache->registers
= (unsigned char *) xcalloc (1, tdesc->registers_size);
regcache->registers_owned = 1;
regcache->register_status = xcalloc (1, tdesc->num_registers);
regcache->register_status
= (unsigned char *) xcalloc (1, tdesc->num_registers);
gdb_assert (REG_UNAVAILABLE == 0);
#else
gdb_assert_not_reached ("can't allocate memory from the heap");

View file

@ -622,7 +622,7 @@ putpkt_binary_1 (char *buf, int cnt, int is_notif)
char *p;
int cc;
buf2 = xmalloc (strlen ("$") + cnt + strlen ("#nn") + 1);
buf2 = (char *) xmalloc (strlen ("$") + cnt + strlen ("#nn") + 1);
/* Copy the packet into buffer BUF2, encapsulating it
and giving it a checksum. */
@ -1325,7 +1325,7 @@ decode_M_packet (char *from, CORE_ADDR *mem_addr_ptr, unsigned int *len_ptr,
}
if (*to_p == NULL)
*to_p = xmalloc (*len_ptr);
*to_p = (unsigned char *) xmalloc (*len_ptr);
hex2bin (&from[i++], *to_p, *len_ptr);
}
@ -1351,7 +1351,7 @@ decode_X_packet (char *from, int packet_len, CORE_ADDR *mem_addr_ptr,
}
if (*to_p == NULL)
*to_p = xmalloc (*len_ptr);
*to_p = (unsigned char *) xmalloc (*len_ptr);
if (remote_unescape_input ((const gdb_byte *) &from[i], packet_len - i,
*to_p, *len_ptr) != *len_ptr)
@ -1478,7 +1478,7 @@ look_up_one_symbol (const char *name, CORE_ADDR *addrp, int may_ask_gdb)
unsigned int mem_len;
decode_m_packet (&own_buf[1], &mem_addr, &mem_len);
mem_buf = xmalloc (mem_len);
mem_buf = (unsigned char *) xmalloc (mem_len);
if (read_inferior_memory (mem_addr, mem_buf, mem_len) == 0)
bin2hex (mem_buf, own_buf, mem_len);
else
@ -1562,7 +1562,7 @@ relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc)
if (own_buf[0] == 'm')
{
decode_m_packet (&own_buf[1], &mem_addr, &mem_len);
mem_buf = xmalloc (mem_len);
mem_buf = (unsigned char *) xmalloc (mem_len);
if (read_inferior_memory (mem_addr, mem_buf, mem_len) == 0)
bin2hex (mem_buf, own_buf, mem_len);
else
@ -1617,7 +1617,7 @@ void
monitor_output (const char *msg)
{
int len = strlen (msg);
char *buf = xmalloc (len * 2 + 2);
char *buf = (char *) xmalloc (len * 2 + 2);
buf[0] = 'O';
bin2hex ((const gdb_byte *) msg, buf + 1, len);

View file

@ -959,7 +959,7 @@ handle_search_memory (char *own_buf, int packet_len)
CORE_ADDR found_addr;
int cmd_name_len = sizeof ("qSearch:memory:") - 1;
pattern = malloc (packet_len);
pattern = (gdb_byte *) malloc (packet_len);
if (pattern == NULL)
{
error ("Unable to allocate memory to perform the search");
@ -983,7 +983,7 @@ handle_search_memory (char *own_buf, int packet_len)
if (search_space_len < search_buf_size)
search_buf_size = search_space_len;
search_buf = malloc (search_buf_size);
search_buf = (gdb_byte *) malloc (search_buf_size);
if (search_buf == NULL)
{
free (pattern);
@ -1211,7 +1211,7 @@ handle_qxfer_exec_file (const char *const_annex,
}
else
{
char *annex = alloca (strlen (const_annex) + 1);
char *annex = (char *) alloca (strlen (const_annex) + 1);
strcpy (annex, const_annex);
annex = unpack_varlen_hex (annex, &pid);
@ -1334,7 +1334,7 @@ handle_qxfer_libraries (const char *annex,
for_each_inferior_with_data (&all_dlls, accumulate_file_name_length,
&total_len);
document = malloc (total_len);
document = (char *) malloc (total_len);
if (document == NULL)
return -1;
@ -1795,7 +1795,7 @@ handle_qxfer (char *own_buf, int packet_len, int *new_packet_len_p)
more. */
if (len > PBUFSIZ - 2)
len = PBUFSIZ - 2;
data = malloc (len + 1);
data = (unsigned char *) malloc (len + 1);
if (data == NULL)
{
write_enn (own_buf);
@ -1829,7 +1829,7 @@ handle_qxfer (char *own_buf, int packet_len, int *new_packet_len_p)
unsigned char *data;
strcpy (own_buf, "E00");
data = malloc (packet_len - (offset - own_buf));
data = (unsigned char *) malloc (packet_len - (offset - own_buf));
if (data == NULL)
{
write_enn (own_buf);
@ -2071,7 +2071,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
p = strtok (NULL, ";"))
{
count++;
qsupported = xrealloc (qsupported, count * sizeof (char *));
qsupported = XRESIZEVEC (char *, qsupported, count);
qsupported[count - 1] = xstrdup (p);
}
@ -2334,7 +2334,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
/* Handle "monitor" commands. */
if (startswith (own_buf, "qRcmd,"))
{
char *mon = malloc (PBUFSIZ);
char *mon = (char *) malloc (PBUFSIZ);
int len = strlen (own_buf + 6);
if (mon == NULL)
@ -2523,7 +2523,7 @@ handle_v_cont (char *own_buf)
p = strchr (p, ';');
}
resume_info = malloc (n * sizeof (resume_info[0]));
resume_info = (struct thread_resume *) malloc (n * sizeof (resume_info[0]));
if (resume_info == NULL)
goto err;
@ -2718,7 +2718,7 @@ handle_v_run (char *own_buf)
new_argc++;
}
new_argv = calloc (new_argc + 2, sizeof (char *));
new_argv = (char **) calloc (new_argc + 2, sizeof (char *));
if (new_argv == NULL)
{
write_enn (own_buf);
@ -2737,7 +2737,7 @@ handle_v_run (char *own_buf)
else
{
/* FIXME: Fail request if out of memory instead of dying. */
new_argv[i] = xmalloc (1 + (next_p - p) / 2);
new_argv[i] = (char *) xmalloc (1 + (next_p - p) / 2);
hex2bin (p, (gdb_byte *) new_argv[i], (next_p - p) / 2);
new_argv[i][(next_p - p) / 2] = '\0';
}
@ -3524,15 +3524,15 @@ captured_main (int argc, char *argv[])
initialize_tracepoint ();
initialize_notif ();
own_buf = xmalloc (PBUFSIZ + 1);
mem_buf = xmalloc (PBUFSIZ);
own_buf = (char *) xmalloc (PBUFSIZ + 1);
mem_buf = (unsigned char *) xmalloc (PBUFSIZ);
if (pid == 0 && *next_arg != NULL)
{
int i, n;
n = argc - (next_arg - argv);
program_argv = xmalloc (sizeof (char *) * (n + 1));
program_argv = XNEWVEC (char *, n + 1);
for (i = 0; i < n; i++)
program_argv[i] = xstrdup (next_arg[i]);
program_argv[i] = NULL;

View file

@ -75,7 +75,7 @@ write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
if (buffer != NULL)
free (buffer);
buffer = xmalloc (len);
buffer = (unsigned char *) xmalloc (len);
memcpy (buffer, myaddr, len);
check_mem_write (memaddr, buffer, myaddr, len);
res = (*the_target->write_memory) (memaddr, buffer, len);

View file

@ -749,7 +749,7 @@ try_thread_db_load_from_dir (const char *dir, size_t dir_len)
if (dir_len + 1 + strlen (LIBTHREAD_DB_SO) + 1 > sizeof (path))
{
char *cp = xmalloc (dir_len + 1);
char *cp = (char *) xmalloc (dir_len + 1);
memcpy (cp, dir, dir_len);
cp[dir_len] = '\0';

View file

@ -1497,7 +1497,7 @@ init_trace_buffer (LONGEST bufsize)
marker. */
alloc_size = (bufsize < TRACEFRAME_EOB_MARKER_SIZE
? TRACEFRAME_EOB_MARKER_SIZE : bufsize);
trace_buffer_lo = xrealloc (trace_buffer_lo, alloc_size);
trace_buffer_lo = (unsigned char *) xrealloc (trace_buffer_lo, alloc_size);
trace_buffer_hi = trace_buffer_lo + trace_buffer_size;
@ -2024,13 +2024,11 @@ add_tracepoint_action (struct tracepoint *tpoint, char *packet)
tpoint->num_step_actions++;
tpoint->step_actions
= xrealloc (tpoint->step_actions,
(sizeof (*tpoint->step_actions)
* tpoint->num_step_actions));
= XRESIZEVEC (struct tracepoint_action *, tpoint->step_actions,
tpoint->num_step_actions);
tpoint->step_actions_str
= xrealloc (tpoint->step_actions_str,
(sizeof (*tpoint->step_actions_str)
* tpoint->num_step_actions));
= XRESIZEVEC (char *, tpoint->step_actions_str,
tpoint->num_step_actions);
tpoint->step_actions[tpoint->num_step_actions - 1] = action;
tpoint->step_actions_str[tpoint->num_step_actions - 1]
= savestring (act_start, act - act_start);
@ -2039,11 +2037,10 @@ add_tracepoint_action (struct tracepoint *tpoint, char *packet)
{
tpoint->numactions++;
tpoint->actions
= xrealloc (tpoint->actions,
sizeof (*tpoint->actions) * tpoint->numactions);
= XRESIZEVEC (struct tracepoint_action *, tpoint->actions,
tpoint->numactions);
tpoint->actions_str
= xrealloc (tpoint->actions_str,
sizeof (*tpoint->actions_str) * tpoint->numactions);
= XRESIZEVEC (char *, tpoint->actions_str, tpoint->numactions);
tpoint->actions[tpoint->numactions - 1] = action;
tpoint->actions_str[tpoint->numactions - 1]
= savestring (act_start, act - act_start);
@ -2201,7 +2198,8 @@ add_traceframe (struct tracepoint *tpoint)
{
struct traceframe *tframe;
tframe = trace_buffer_alloc (sizeof (struct traceframe));
tframe
= (struct traceframe *) trace_buffer_alloc (sizeof (struct traceframe));
if (tframe == NULL)
return NULL;
@ -2223,7 +2221,7 @@ add_traceframe_block (struct traceframe *tframe,
if (!tframe)
return NULL;
block = trace_buffer_alloc (amt);
block = (unsigned char *) trace_buffer_alloc (amt);
if (!block)
return NULL;
@ -2685,7 +2683,7 @@ cmd_qtdpsrc (char *own_buf)
saved = packet;
packet = strchr (packet, ':');
srctype = xmalloc (packet - saved + 1);
srctype = (char *) xmalloc (packet - saved + 1);
memcpy (srctype, saved, packet - saved);
srctype[packet - saved] = '\0';
++packet;
@ -2693,7 +2691,7 @@ cmd_qtdpsrc (char *own_buf)
++packet; /* skip a colon */
packet = unpack_varlen_hex (packet, &slen);
++packet; /* skip a colon */
src = xmalloc (slen + 1);
src = (char *) xmalloc (slen + 1);
nbytes = hex2bin (packet, (gdb_byte *) src, strlen (packet) / 2);
src[nbytes] = '\0';
@ -2735,7 +2733,7 @@ cmd_qtdv (char *own_buf)
++packet; /* skip a colon */
nbytes = strlen (packet) / 2;
varname = xmalloc (nbytes + 1);
varname = (char *) xmalloc (nbytes + 1);
nbytes = hex2bin (packet, (gdb_byte *) varname, nbytes);
varname[nbytes] = '\0';
@ -3659,7 +3657,8 @@ cmd_qtstatus (char *packet)
result_name = stop_reason_rsp + strlen ("terror:");
hexstr_len = strlen (result_name) * 2;
p = stop_reason_rsp = alloca (strlen ("terror:") + hexstr_len + 1);
p = stop_reason_rsp
= (char *) alloca (strlen ("terror:") + hexstr_len + 1);
strcpy (p, "terror:");
p += strlen (p);
bin2hex ((gdb_byte *) result_name, p, strlen (result_name));
@ -3668,7 +3667,7 @@ cmd_qtstatus (char *packet)
/* If this was a forced stop, include any stop note that was supplied. */
if (strcmp (stop_reason_rsp, "tstop") == 0)
{
stop_reason_rsp = alloca (strlen ("tstop:") + strlen (buf3) + 1);
stop_reason_rsp = (char *) alloca (strlen ("tstop:") + strlen (buf3) + 1);
strcpy (stop_reason_rsp, "tstop:");
strcat (stop_reason_rsp, buf3);
}
@ -3780,7 +3779,7 @@ response_source (char *packet,
int len;
len = strlen (src->str);
buf = alloca (len * 2 + 1);
buf = (char *) alloca (len * 2 + 1);
bin2hex ((gdb_byte *) src->str, buf, len);
sprintf (packet, "Z%x:%s:%s:%x:%x:%s",
@ -3869,7 +3868,7 @@ response_tsv (char *packet, struct trace_state_variable *tsv)
if (tsv->name)
{
namelen = strlen (tsv->name);
buf = alloca (namelen * 2 + 1);
buf = (char *) alloca (namelen * 2 + 1);
bin2hex ((gdb_byte *) tsv->name, buf, namelen);
}
@ -4110,7 +4109,7 @@ cmd_qtnotes (char *own_buf)
saved = packet;
packet = strchr (packet, ';');
nbytes = (packet - saved) / 2;
user = xmalloc (nbytes + 1);
user = (char *) xmalloc (nbytes + 1);
nbytes = hex2bin (saved, (gdb_byte *) user, nbytes);
user[nbytes] = '\0';
++packet; /* skip the semicolon */
@ -4124,7 +4123,7 @@ cmd_qtnotes (char *own_buf)
saved = packet;
packet = strchr (packet, ';');
nbytes = (packet - saved) / 2;
notes = xmalloc (nbytes + 1);
notes = (char *) xmalloc (nbytes + 1);
nbytes = hex2bin (saved, (gdb_byte *) notes, nbytes);
notes[nbytes] = '\0';
++packet; /* skip the semicolon */
@ -4138,7 +4137,7 @@ cmd_qtnotes (char *own_buf)
saved = packet;
packet = strchr (packet, ';');
nbytes = (packet - saved) / 2;
stopnote = xmalloc (nbytes + 1);
stopnote = (char *) xmalloc (nbytes + 1);
nbytes = hex2bin (saved, (gdb_byte *) stopnote, nbytes);
stopnote[nbytes] = '\0';
++packet; /* skip the semicolon */
@ -5800,7 +5799,7 @@ gdb_collect (struct tracepoint *tpoint, unsigned char *regs)
ctx.regcache_initted = 0;
/* Wrap the regblock in a register cache (in the stack, we don't
want to malloc here). */
ctx.regspace = alloca (ipa_tdesc->registers_size);
ctx.regspace = (unsigned char *) alloca (ipa_tdesc->registers_size);
if (ctx.regspace == NULL)
{
trace_debug ("Trace buffer block allocation failed, skipping");
@ -7365,7 +7364,7 @@ initialize_tracepoint (void)
if (pagesize == -1)
perror_with_name ("sysconf");
gdb_tp_heap_buffer = xmalloc (5 * 1024 * 1024);
gdb_tp_heap_buffer = (char *) xmalloc (5 * 1024 * 1024);
#define SCRATCH_BUFFER_NPAGES 20
@ -7373,7 +7372,9 @@ initialize_tracepoint (void)
address (close to the main executable's code). */
for (addr = pagesize; addr != 0; addr += pagesize)
{
gdb_jump_pad_buffer = mmap ((void *) addr, pagesize * SCRATCH_BUFFER_NPAGES,
gdb_jump_pad_buffer
= (char *) mmap ((void *) addr,
pagesize * SCRATCH_BUFFER_NPAGES,
PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED,
-1, 0);
@ -7393,7 +7394,7 @@ initialize_tracepoint (void)
buffer setup, but it can be mysterious, so create a channel to
report back on what went wrong, using a fixed size since we may
not be able to allocate space later when the problem occurs. */
gdb_trampoline_buffer_error = xmalloc (IPA_BUFSIZ);
gdb_trampoline_buffer_error = (char *) xmalloc (IPA_BUFSIZ);
strcpy (gdb_trampoline_buffer_error, "No errors reported");

View file

@ -525,7 +525,8 @@ lookup_function_type_with_arguments (struct type *type,
}
TYPE_NFIELDS (fn) = nparams;
TYPE_FIELDS (fn) = TYPE_ZALLOC (fn, nparams * sizeof (struct field));
TYPE_FIELDS (fn)
= (struct field *) TYPE_ZALLOC (fn, nparams * sizeof (struct field));
for (i = 0; i < nparams; ++i)
TYPE_FIELD_TYPE (fn, i) = param_types[i];
@ -1191,7 +1192,8 @@ create_set_type (struct type *result_type, struct type *domain_type)
TYPE_CODE (result_type) = TYPE_CODE_SET;
TYPE_NFIELDS (result_type) = 1;
TYPE_FIELDS (result_type) = TYPE_ZALLOC (result_type, sizeof (struct field));
TYPE_FIELDS (result_type)
= (struct field *) TYPE_ZALLOC (result_type, sizeof (struct field));
if (!TYPE_STUB (domain_type))
{
@ -1433,7 +1435,7 @@ struct type *
lookup_unsigned_typename (const struct language_defn *language,
struct gdbarch *gdbarch, const char *name)
{
char *uns = alloca (strlen (name) + 10);
char *uns = (char *) alloca (strlen (name) + 10);
strcpy (uns, "unsigned ");
strcpy (uns + 9, name);
@ -1445,7 +1447,7 @@ lookup_signed_typename (const struct language_defn *language,
struct gdbarch *gdbarch, const char *name)
{
struct type *t;
char *uns = alloca (strlen (name) + 8);
char *uns = (char *) alloca (strlen (name) + 8);
strcpy (uns, "signed ");
strcpy (uns + 7, name);
@ -1969,8 +1971,9 @@ resolve_dynamic_union (struct type *type,
resolved_type = copy_type (type);
TYPE_FIELDS (resolved_type)
= TYPE_ALLOC (resolved_type,
TYPE_NFIELDS (resolved_type) * sizeof (struct field));
= (struct field *) TYPE_ALLOC (resolved_type,
TYPE_NFIELDS (resolved_type)
* sizeof (struct field));
memcpy (TYPE_FIELDS (resolved_type),
TYPE_FIELDS (type),
TYPE_NFIELDS (resolved_type) * sizeof (struct field));
@ -2009,8 +2012,9 @@ resolve_dynamic_struct (struct type *type,
resolved_type = copy_type (type);
TYPE_FIELDS (resolved_type)
= TYPE_ALLOC (resolved_type,
TYPE_NFIELDS (resolved_type) * sizeof (struct field));
= (struct field *) TYPE_ALLOC (resolved_type,
TYPE_NFIELDS (resolved_type)
* sizeof (struct field));
memcpy (TYPE_FIELDS (resolved_type),
TYPE_FIELDS (type),
TYPE_NFIELDS (resolved_type) * sizeof (struct field));
@ -2187,8 +2191,7 @@ add_dyn_prop (enum dynamic_prop_node_kind prop_kind, struct dynamic_prop prop,
gdb_assert (TYPE_OBJFILE_OWNED (type));
temp = obstack_alloc (&objfile->objfile_obstack,
sizeof (struct dynamic_prop_list));
temp = XOBNEW (&objfile->objfile_obstack, struct dynamic_prop_list);
temp->prop_kind = prop_kind;
temp->prop = prop;
temp->next = TYPE_DYN_PROP_LIST (type);
@ -4344,8 +4347,9 @@ copy_dynamic_prop_list (struct obstack *objfile_obstack,
{
struct dynamic_prop_list *node_copy;
node_copy = obstack_copy (objfile_obstack, *node_ptr,
sizeof (struct dynamic_prop_list));
node_copy = ((struct dynamic_prop_list *)
obstack_copy (objfile_obstack, *node_ptr,
sizeof (struct dynamic_prop_list)));
node_copy->prop = (*node_ptr)->prop;
*node_ptr = node_copy;
@ -4658,7 +4662,8 @@ arch_flags_type (struct gdbarch *gdbarch, char *name, int length)
type = arch_type (gdbarch, TYPE_CODE_FLAGS, length, name);
TYPE_UNSIGNED (type) = 1;
TYPE_NFIELDS (type) = nfields;
TYPE_FIELDS (type) = TYPE_ZALLOC (type, nfields * sizeof (struct field));
TYPE_FIELDS (type)
= (struct field *) TYPE_ZALLOC (type, nfields * sizeof (struct field));
return type;
}
@ -4711,8 +4716,8 @@ append_composite_type_field_raw (struct type *t, char *name,
struct field *f;
TYPE_NFIELDS (t) = TYPE_NFIELDS (t) + 1;
TYPE_FIELDS (t) = xrealloc (TYPE_FIELDS (t),
sizeof (struct field) * TYPE_NFIELDS (t));
TYPE_FIELDS (t) = XRESIZEVEC (struct field, TYPE_FIELDS (t),
TYPE_NFIELDS (t));
f = &(TYPE_FIELDS (t)[TYPE_NFIELDS (t) - 1]);
memset (f, 0, sizeof f[0]);
FIELD_TYPE (f[0]) = field;

View file

@ -1210,8 +1210,8 @@ extern void allocate_gnat_aux_type (struct type *);
#define INIT_FUNC_SPECIFIC(type) \
(TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FUNC, \
TYPE_MAIN_TYPE (type)->type_specific.func_stuff \
= TYPE_ZALLOC (type, \
TYPE_MAIN_TYPE (type)->type_specific.func_stuff = (struct func_type *) \
TYPE_ZALLOC (type, \
sizeof (*TYPE_MAIN_TYPE (type)->type_specific.func_stuff)))
#define TYPE_INSTANCE_FLAGS(thistype) (thistype)->instance_flags

View file

@ -345,7 +345,7 @@ gnuv3_rtti_type (struct value *value,
{
char *copy;
copy = alloca (atsign - class_name + 1);
copy = (char *) alloca (atsign - class_name + 1);
memcpy (copy, class_name, atsign - class_name);
copy[atsign - class_name] = '\0';
class_name = copy;

View file

@ -535,7 +535,7 @@ string_exp:
vec->type = $1.type;
vec->length = $1.length;
vec->ptr = malloc ($1.length + 1);
vec->ptr = (char *) malloc ($1.length + 1);
memcpy (vec->ptr, $1.ptr, $1.length + 1);
}
@ -545,10 +545,10 @@ string_exp:
for convenience. */
char *p;
++$$.len;
$$.tokens = realloc ($$.tokens,
$$.len * sizeof (struct typed_stoken));
$$.tokens = XRESIZEVEC (struct typed_stoken,
$$.tokens, $$.len);
p = malloc ($3.length + 1);
p = (char *) malloc ($3.length + 1);
memcpy (p, $3.ptr, $3.length + 1);
$$.tokens[$$.len - 1].type = $3.type;

View file

@ -379,7 +379,7 @@ go_demangle (const char *mangled_name, int options)
}
obstack_grow_str0 (&tempbuf, "");
result = xstrdup (obstack_finish (&tempbuf));
result = xstrdup ((const char *) obstack_finish (&tempbuf));
obstack_free (&tempbuf, NULL);
xfree (name_buf);
return result;

View file

@ -241,7 +241,7 @@ compute_scheme_string (struct command_line *l)
for (iter = l; iter; iter = iter->next)
size += strlen (iter->line) + 1;
script = xmalloc (size + 1);
script = (char *) xmalloc (size + 1);
here = 0;
for (iter = l; iter; iter = iter->next)
{

View file

@ -506,7 +506,7 @@ gdbscm_parse_command_name (const char *name,
|| name[i - 1] == '_');
--i)
;
result = xmalloc (lastchar - i + 2);
result = (char *) xmalloc (lastchar - i + 2);
memcpy (result, &name[i], lastchar - i + 1);
result[lastchar - i + 1] = '\0';
@ -519,7 +519,7 @@ gdbscm_parse_command_name (const char *name,
return result;
}
prefix_text = xmalloc (i + 2);
prefix_text = (char *) xmalloc (i + 2);
memcpy (prefix_text, name, i + 1);
prefix_text[i + 1] = '\0';
@ -601,7 +601,8 @@ char *
gdbscm_canonicalize_command_name (const char *name, int want_trailing_space)
{
int i, out, seen_word;
char *result = scm_gc_malloc_pointerless (strlen (name) + 2, FUNC_NAME);
char *result
= (char *) scm_gc_malloc_pointerless (strlen (name) + 2, FUNC_NAME);
i = out = seen_word = 0;
while (name[i])

View file

@ -326,7 +326,8 @@ ioscm_init_stdio_buffers (SCM port, long mode_bits)
if (!writing && size > 0)
{
pt->read_buf = scm_gc_malloc_pointerless (size, "port buffer");
pt->read_buf
= (unsigned char *) scm_gc_malloc_pointerless (size, "port buffer");
pt->read_pos = pt->read_end = pt->read_buf;
pt->read_buf_size = size;
}
@ -338,7 +339,8 @@ ioscm_init_stdio_buffers (SCM port, long mode_bits)
if (writing && size > 0)
{
pt->write_buf = scm_gc_malloc_pointerless (size, "port buffer");
pt->write_buf
= (unsigned char *) scm_gc_malloc_pointerless (size, "port buffer");
pt->write_pos = pt->write_buf;
pt->write_buf_size = size;
}
@ -1011,8 +1013,8 @@ ioscm_init_memory_port (SCM port, CORE_ADDR start, CORE_ADDR end)
pt->write_buf_size = iomem->write_buf_size;
if (buffered)
{
pt->read_buf = xmalloc (pt->read_buf_size);
pt->write_buf = xmalloc (pt->write_buf_size);
pt->read_buf = (unsigned char *) xmalloc (pt->read_buf_size);
pt->write_buf = (unsigned char *) xmalloc (pt->write_buf_size);
}
else
{
@ -1076,7 +1078,7 @@ ioscm_reinit_memory_port (SCM port, size_t read_buf_size,
iomem->read_buf_size = read_buf_size;
pt->read_buf_size = read_buf_size;
xfree (pt->read_buf);
pt->read_buf = xmalloc (pt->read_buf_size);
pt->read_buf = (unsigned char *) xmalloc (pt->read_buf_size);
pt->read_pos = pt->read_end = pt->read_buf;
}
@ -1085,7 +1087,7 @@ ioscm_reinit_memory_port (SCM port, size_t read_buf_size,
iomem->write_buf_size = write_buf_size;
pt->write_buf_size = write_buf_size;
xfree (pt->write_buf);
pt->write_buf = xmalloc (pt->write_buf_size);
pt->write_buf = (unsigned char *) xmalloc (pt->write_buf_size);
pt->write_pos = pt->write_buf;
pt->write_end = pt->write_buf + pt->write_buf_size;
}

View file

@ -587,7 +587,8 @@ char *
gdbscm_gc_xstrdup (const char *str)
{
size_t len = strlen (str);
char *result = scm_gc_malloc_pointerless (len + 1, "gdbscm_gc_xstrdup");
char *result
= (char *) scm_gc_malloc_pointerless (len + 1, "gdbscm_gc_xstrdup");
strcpy (result, str);
return result;
@ -607,8 +608,9 @@ gdbscm_gc_dup_argv (char **argv)
/* Allocating "pointerless" works because the pointers are all
self-contained within the object. */
result = scm_gc_malloc_pointerless (((len + 1) * sizeof (char *))
+ string_space, "parameter enum list");
result = (char **) scm_gc_malloc_pointerless (((len + 1) * sizeof (char *))
+ string_space,
"parameter enum list");
p = (char *) &result[len + 1];
for (i = 0; i < len; ++i)

View file

@ -671,7 +671,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Pad the argument appropriately. */
int padded_len = align_up (len, wordsize);
gdb_byte *padded = xmalloc (padded_len);
gdb_byte *padded = (gdb_byte *) xmalloc (padded_len);
back_to = make_cleanup (xfree, padded);
memset (padded, 0, padded_len);

View file

@ -261,7 +261,7 @@ internalize_unwinds (struct objfile *objfile, struct unwind_table_entry *table,
struct gdbarch *gdbarch = get_objfile_arch (objfile);
unsigned long tmp;
unsigned i;
char *buf = alloca (size);
char *buf = (char *) alloca (size);
CORE_ADDR low_text_segment_address;
/* For ELF targets, then unwinds are supposed to
@ -434,7 +434,7 @@ read_unwind_info (struct objfile *objfile)
if (stub_unwind_size > 0)
{
unsigned int i;
char *buf = alloca (stub_unwind_size);
char *buf = (char *) alloca (stub_unwind_size);
/* Read in the stub unwind entries. */
bfd_get_section_contents (objfile->obfd, stub_unwind_sec, buf,

View file

@ -110,7 +110,7 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj)
if (!startswith (sect->name, ".module"))
return;
buf = xmalloc (bfd_get_section_size (sect) + 1);
buf = (gdb_byte *) xmalloc (bfd_get_section_size (sect) + 1);
if (!buf)
{
printf_unfiltered ("memory allocation failed for %s\n", sect->name);
@ -163,7 +163,7 @@ windows_core_xfer_shared_libraries (struct gdbarch *gdbarch,
&data);
obstack_grow_str0 (&obstack, "</library-list>\n");
buf = obstack_finish (&obstack);
buf = (const char *) obstack_finish (&obstack);
len_avail = strlen (buf);
if (offset >= len_avail)
return 0;

View file

@ -777,7 +777,7 @@ i386_displaced_step_copy_insn (struct gdbarch *gdbarch,
struct regcache *regs)
{
size_t len = gdbarch_max_insn_length (gdbarch);
gdb_byte *buf = xmalloc (len);
gdb_byte *buf = (gdb_byte *) xmalloc (len);
read_memory (from, buf, len);
@ -4051,7 +4051,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
return 0;
len = s - start - 1;
regname = alloca (len + 1);
regname = (char *) alloca (len + 1);
strncpy (regname, start, len);
regname[len] = '\0';
@ -4161,7 +4161,7 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
return 0;
len_base = s - start;
base = alloca (len_base + 1);
base = (char *) alloca (len_base + 1);
strncpy (base, start, len_base);
base[len_base] = '\0';
@ -4176,7 +4176,7 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
++s;
len_index = s - start;
index = alloca (len_index + 1);
index = (char *) alloca (len_index + 1);
strncpy (index, start, len_index);
index[len_index] = '\0';

View file

@ -92,7 +92,7 @@ i386obsd_sigtramp_p (struct frame_info *this_frame)
return 0;
/* Allocate buffer. */
buf = alloca (buflen);
buf = (gdb_byte *) alloca (buflen);
/* Loop over all offsets. */
for (offset = i386obsd_sigreturn_offset; *offset != -1; offset++)

View file

@ -352,7 +352,7 @@ inf_child_fileio_readlink (struct target_ops *self,
return NULL;
}
ret = xmalloc (len + 1);
ret = (char *) xmalloc (len + 1);
memcpy (ret, buf, len);
ret[len] = '\0';
return ret;

View file

@ -728,7 +728,7 @@ inf_ptrace_fetch_register (struct regcache *regcache, int regnum)
size = register_size (gdbarch, regnum);
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
buf = alloca (size);
buf = (long int *) alloca (size);
/* Read the register contents from the inferior a chunk at a time. */
for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
@ -786,7 +786,7 @@ inf_ptrace_store_register (const struct regcache *regcache, int regnum)
size = register_size (gdbarch, regnum);
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
buf = alloca (size);
buf = (long int *) alloca (size);
/* Write the register contents into the inferior a chunk at a time. */
regcache_raw_collect (regcache, regnum, buf);

View file

@ -1178,7 +1178,7 @@ follow_exec (ptid_t ptid, char *execd_pathname)
{
char *name = exec_file_find (execd_pathname, NULL);
execd_pathname = alloca (strlen (name) + 1);
execd_pathname = (char *) alloca (strlen (name) + 1);
strcpy (execd_pathname, name);
xfree (name);
}
@ -1789,7 +1789,7 @@ displaced_step_prepare_throw (ptid_t ptid)
len = gdbarch_max_insn_length (gdbarch);
/* Save the original contents of the copy area. */
displaced->step_saved_copy = xmalloc (len);
displaced->step_saved_copy = (gdb_byte *) xmalloc (len);
ignore_cleanups = make_cleanup (free_current_contents,
&displaced->step_saved_copy);
status = target_read_memory (copy, displaced->step_saved_copy, len);
@ -7916,7 +7916,7 @@ struct stop_context
static struct stop_context *
save_stop_context (void)
{
struct stop_context *sc = xmalloc (sizeof (struct stop_context));
struct stop_context *sc = XNEW (struct stop_context);
sc->stop_id = get_stop_id ();
sc->ptid = inferior_ptid;
@ -8658,7 +8658,7 @@ save_infcall_suspend_state (void)
size_t len = TYPE_LENGTH (type);
struct cleanup *back_to;
siginfo_data = xmalloc (len);
siginfo_data = (gdb_byte *) xmalloc (len);
back_to = make_cleanup (xfree, siginfo_data);
if (target_read (&current_target, TARGET_OBJECT_SIGNAL_INFO, NULL,

View file

@ -364,7 +364,7 @@ jit_read_descriptor (struct gdbarch *gdbarch,
ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
ptr_size = TYPE_LENGTH (ptr_type);
desc_size = 8 + 2 * ptr_size; /* Two 32-bit ints and two pointers. */
desc_buf = alloca (desc_size);
desc_buf = (gdb_byte *) alloca (desc_size);
/* Read the descriptor. */
err = target_read_memory (MSYMBOL_VALUE_ADDRESS (ps_data->objfile,
@ -412,7 +412,7 @@ jit_read_code_entry (struct gdbarch *gdbarch,
off = (off + (align_bytes - 1)) & ~(align_bytes - 1);
entry_size = off + 8; /* Three pointers and one 64-bit int. */
entry_buf = alloca (entry_size);
entry_buf = (gdb_byte *) alloca (entry_size);
/* Read the entry. */
err = target_read_memory (code_addr, entry_buf, entry_size);
@ -603,12 +603,14 @@ jit_symtab_line_mapping_add_impl (struct gdb_symbol_callbacks *cb,
struct gdb_line_mapping *map)
{
int i;
int alloc_len;
if (nlines < 1)
return;
stab->linetable = xmalloc (sizeof (struct linetable)
+ (nlines - 1) * sizeof (struct linetable_entry));
alloc_len = sizeof (struct linetable)
+ (nlines - 1) * sizeof (struct linetable_entry);
stab->linetable = (struct linetable *) xmalloc (alloc_len);
stab->linetable->nitems = nlines;
for (i = 0; i < nlines; i++)
{
@ -658,14 +660,15 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
* sizeof (struct linetable_entry)
+ sizeof (struct linetable));
SYMTAB_LINETABLE (COMPUNIT_FILETABS (cust))
= obstack_alloc (&objfile->objfile_obstack, size);
= (struct linetable *) obstack_alloc (&objfile->objfile_obstack, size);
memcpy (SYMTAB_LINETABLE (COMPUNIT_FILETABS (cust)), stab->linetable,
size);
}
blockvector_size = (sizeof (struct blockvector)
+ (actual_nblocks - 1) * sizeof (struct block *));
bv = obstack_alloc (&objfile->objfile_obstack, blockvector_size);
bv = (struct blockvector *) obstack_alloc (&objfile->objfile_obstack,
blockvector_size);
COMPUNIT_BLOCKVECTOR (cust) = bv;
/* (begin, end) will contain the PC range this entire blockvector
@ -702,7 +705,8 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
SYMBOL_TYPE (block_name) = lookup_function_type (block_type);
SYMBOL_BLOCK_VALUE (block_name) = new_block;
block_name->ginfo.name = obstack_copy0 (&objfile->objfile_obstack,
block_name->ginfo.name
= (const char *) obstack_copy0 (&objfile->objfile_obstack,
gdb_block_iter->name,
strlen (gdb_block_iter->name));
@ -1134,7 +1138,8 @@ jit_unwind_reg_get_impl (struct gdb_unwind_callbacks *cb, int regnum)
gdb_reg = gdbarch_dwarf2_reg_to_regnum (frame_arch, regnum);
size = register_size (frame_arch, gdb_reg);
value = xmalloc (sizeof (struct gdb_reg_value) + size - 1);
value = ((struct gdb_reg_value *)
xmalloc (sizeof (struct gdb_reg_value) + size - 1));
value->defined = deprecated_frame_register_read (priv->this_frame, gdb_reg,
value->value);
value->size = size;

View file

@ -355,7 +355,7 @@ QualifiedName:
{
char *buf;
buf = malloc ($$.length + 1);
buf = (char *) malloc ($$.length + 1);
make_cleanup (free, buf);
sprintf (buf, "%.*s.%.*s",
$1.length, $1.ptr, $3.length, $3.ptr);

View file

@ -224,7 +224,7 @@ get_java_utf8_name (struct obstack *obstack, struct value *name)
temp = value_struct_elt (&temp, NULL, "length", NULL, "structure");
name_length = (int) value_as_long (temp);
data_addr = value_address (temp) + TYPE_LENGTH (value_type (temp));
chrs = obstack_alloc (obstack, name_length + 1);
chrs = (char *) obstack_alloc (obstack, name_length + 1);
chrs[name_length] = '\0';
read_memory (data_addr, (gdb_byte *) chrs, name_length);
return chrs;
@ -314,7 +314,7 @@ type_from_class (struct gdbarch *gdbarch, struct value *clas)
int namelen = java_demangled_signature_length (signature);
if (namelen > strlen (name))
name = obstack_alloc (&objfile->objfile_obstack, namelen + 1);
name = (char *) obstack_alloc (&objfile->objfile_obstack, namelen + 1);
java_demangled_signature_copy (name, signature);
name[namelen] = '\0';
temp = clas;
@ -806,7 +806,7 @@ char *
java_demangle_type_signature (const char *signature)
{
int length = java_demangled_signature_length (signature);
char *result = xmalloc (length + 1);
char *result = (char *) xmalloc (length + 1);
java_demangled_signature_copy (result, signature);
result[length] = '\0';
@ -1059,7 +1059,7 @@ java_class_name_from_physname (const char *physname)
end = java_find_last_component (demangled_name);
if (end != NULL)
{
ret = xmalloc (end - demangled_name + 1);
ret = (char *) xmalloc (end - demangled_name + 1);
memcpy (ret, demangled_name, end - demangled_name);
ret[end - demangled_name] = '\0';
}

Some files were not shown because too many files have changed in this diff Show more