aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog466
-rw-r--r--gdb/aarch64-linux-tdep.c2
-rw-r--r--gdb/ada-exp.y23
-rw-r--r--gdb/ada-lang.c27
-rw-r--r--gdb/ada-lex.l4
-rw-r--r--gdb/ada-tasks.c4
-rw-r--r--gdb/ada-typeprint.c2
-rw-r--r--gdb/addrmap.c8
-rw-r--r--gdb/amd64-tdep.c11
-rw-r--r--gdb/amd64obsd-tdep.c2
-rw-r--r--gdb/arch-utils.c4
-rw-r--r--gdb/arm-linux-tdep.c2
-rw-r--r--gdb/arm-symbian-tdep.c2
-rw-r--r--gdb/arm-tdep.c17
-rw-r--r--gdb/auto-load.c18
-rw-r--r--gdb/auxv.c2
-rw-r--r--gdb/ax-general.c13
-rw-r--r--gdb/bcache.c3
-rw-r--r--gdb/breakpoint.c2
-rw-r--r--gdb/btrace.c2
-rw-r--r--gdb/build-id.c7
-rw-r--r--gdb/buildsym.c6
-rw-r--r--gdb/c-exp.y28
-rw-r--r--gdb/c-lang.c4
-rw-r--r--gdb/charset.c3
-rw-r--r--gdb/cli/cli-cmds.c4
-rw-r--r--gdb/cli/cli-dump.c4
-rw-r--r--gdb/cli/cli-interp.c3
-rw-r--r--gdb/cli/cli-script.c4
-rw-r--r--gdb/cli/cli-setshow.c2
-rw-r--r--gdb/coff-pe-read.c8
-rw-r--r--gdb/coffread.c12
-rw-r--r--gdb/common/btrace-common.c2
-rw-r--r--gdb/common/buffer.c2
-rw-r--r--gdb/common/filestuff.c2
-rw-r--r--gdb/common/format.c2
-rw-r--r--gdb/common/gdb_vecs.c2
-rw-r--r--gdb/common/xml-utils.c2
-rw-r--r--gdb/compile/compile-object-load.c5
-rw-r--r--gdb/compile/compile-object-run.c3
-rw-r--r--gdb/completer.c4
-rw-r--r--gdb/corefile.c8
-rw-r--r--gdb/corelow.c2
-rw-r--r--gdb/cp-name-parser.y6
-rw-r--r--gdb/cp-namespace.c16
-rw-r--r--gdb/cp-support.c10
-rw-r--r--gdb/cp-valprint.c2
-rw-r--r--gdb/ctf.c2
-rw-r--r--gdb/d-exp.y8
-rw-r--r--gdb/d-namespace.c10
-rw-r--r--gdb/dbxread.c16
-rw-r--r--gdb/dcache.c5
-rw-r--r--gdb/demangle.c2
-rw-r--r--gdb/dicos-tdep.c2
-rw-r--r--gdb/dictionary.c20
-rw-r--r--gdb/dwarf2-frame.c18
-rw-r--r--gdb/dwarf2expr.c14
-rw-r--r--gdb/dwarf2loc.c11
-rw-r--r--gdb/dwarf2read.c128
-rw-r--r--gdb/elfread.c18
-rw-r--r--gdb/event-top.c5
-rw-r--r--gdb/exec.c4
-rw-r--r--gdb/expprint.c4
-rw-r--r--gdb/fbsd-tdep.c2
-rw-r--r--gdb/findcmd.c4
-rw-r--r--gdb/findvar.c2
-rw-r--r--gdb/frame.c2
-rw-r--r--gdb/gdb_bfd.c6
-rw-r--r--gdb/gdb_obstack.c4
-rw-r--r--gdb/gdbserver/ChangeLog48
-rw-r--r--gdb/gdbserver/ax.c4
-rw-r--r--gdb/gdbserver/hostio.c4
-rw-r--r--gdb/gdbserver/linux-low.c12
-rw-r--r--gdb/gdbserver/mem-break.c14
-rw-r--r--gdb/gdbserver/regcache.c6
-rw-r--r--gdb/gdbserver/remote-utils.c12
-rw-r--r--gdb/gdbserver/server.c28
-rw-r--r--gdb/gdbserver/target.c2
-rw-r--r--gdb/gdbserver/thread-db.c2
-rw-r--r--gdb/gdbserver/tracepoint.c61
-rw-r--r--gdb/gdbtypes.c35
-rw-r--r--gdb/gdbtypes.h6
-rw-r--r--gdb/gnu-v3-abi.c2
-rw-r--r--gdb/go-exp.y8
-rw-r--r--gdb/go-lang.c2
-rw-r--r--gdb/guile/guile.c2
-rw-r--r--gdb/guile/scm-cmd.c7
-rw-r--r--gdb/guile/scm-ports.c14
-rw-r--r--gdb/guile/scm-utils.c8
-rw-r--r--gdb/h8300-tdep.c2
-rw-r--r--gdb/hppa-tdep.c4
-rw-r--r--gdb/i386-cygwin-tdep.c4
-rw-r--r--gdb/i386-tdep.c8
-rw-r--r--gdb/i386obsd-tdep.c2
-rw-r--r--gdb/inf-child.c2
-rw-r--r--gdb/inf-ptrace.c4
-rw-r--r--gdb/infrun.c8
-rw-r--r--gdb/jit.c25
-rw-r--r--gdb/jv-exp.y2
-rw-r--r--gdb/jv-lang.c8
-rw-r--r--gdb/jv-typeprint.c2
-rw-r--r--gdb/jv-valprint.c3
-rw-r--r--gdb/language.c5
-rw-r--r--gdb/linespec.c13
-rw-r--r--gdb/linux-fork.c3
-rw-r--r--gdb/linux-nat.c4
-rw-r--r--gdb/linux-record.c26
-rw-r--r--gdb/linux-tdep.c6
-rw-r--r--gdb/linux-thread-db.c13
-rw-r--r--gdb/m32c-tdep.c4
-rw-r--r--gdb/m68hc11-tdep.c4
-rw-r--r--gdb/m68k-tdep.c2
-rw-r--r--gdb/machoread.c2
-rw-r--r--gdb/macroexp.c9
-rw-r--r--gdb/macrotab.c10
-rw-r--r--gdb/mdebugread.c31
-rw-r--r--gdb/mem-break.c2
-rw-r--r--gdb/mi/mi-cmd-break.c2
-rw-r--r--gdb/mi/mi-main.c17
-rw-r--r--gdb/mi/mi-parse.c10
-rw-r--r--gdb/minidebug.c6
-rw-r--r--gdb/mips-tdep.c7
-rw-r--r--gdb/mipsnbsd-tdep.c2
-rw-r--r--gdb/mipsread.c8
-rw-r--r--gdb/mt-tdep.c8
-rw-r--r--gdb/namespace.c22
-rw-r--r--gdb/nat/linux-btrace.c5
-rw-r--r--gdb/nat/linux-osdata.c2
-rw-r--r--gdb/nat/linux-ptrace.c3
-rw-r--r--gdb/nto-tdep.c6
-rw-r--r--gdb/objc-lang.c4
-rw-r--r--gdb/objfiles.c19
-rw-r--r--gdb/osabi.c2
-rw-r--r--gdb/p-exp.y8
-rw-r--r--gdb/p-valprint.c2
-rw-r--r--gdb/parse.c15
-rw-r--r--gdb/ppc-linux-tdep.c4
-rw-r--r--gdb/ppc-ravenscar-thread.c2
-rw-r--r--gdb/printcmd.c4
-rw-r--r--gdb/probe.c5
-rw-r--r--gdb/python/py-cmd.c6
-rw-r--r--gdb/python/py-gdb-readline.c4
-rw-r--r--gdb/python/py-symtab.c5
-rw-r--r--gdb/python/py-unwind.c6
-rw-r--r--gdb/python/python.c4
-rw-r--r--gdb/ravenscar-thread.c2
-rw-r--r--gdb/record-full.c4
-rw-r--r--gdb/regcache.c8
-rw-r--r--gdb/remote-fileio.c12
-rw-r--r--gdb/remote-mips.c7
-rw-r--r--gdb/remote.c47
-rw-r--r--gdb/rs6000-aix-tdep.c4
-rw-r--r--gdb/rs6000-tdep.c4
-rw-r--r--gdb/s390-linux-tdep.c2
-rw-r--r--gdb/score-tdep.c2
-rw-r--r--gdb/solib-dsbt.c14
-rw-r--r--gdb/solib-frv.c10
-rw-r--r--gdb/solib-spu.c7
-rw-r--r--gdb/solib-svr4.c20
-rw-r--r--gdb/solib-target.c4
-rw-r--r--gdb/solib.c9
-rw-r--r--gdb/source.c16
-rw-r--r--gdb/sparc-ravenscar-thread.c2
-rw-r--r--gdb/spu-tdep.c4
-rw-r--r--gdb/stabsread.c37
-rw-r--r--gdb/stack.c6
-rw-r--r--gdb/stap-probe.c2
-rw-r--r--gdb/symfile.c43
-rw-r--r--gdb/symtab.c51
-rw-r--r--gdb/target-descriptions.c2
-rw-r--r--gdb/target-memory.c2
-rw-r--r--gdb/target.c18
-rw-r--r--gdb/tilegx-tdep.c2
-rw-r--r--gdb/top.c8
-rw-r--r--gdb/tracefile-tfile.c2
-rw-r--r--gdb/tracefile.c2
-rw-r--r--gdb/tracepoint.c36
-rw-r--r--gdb/tui/tui-file.c7
-rw-r--r--gdb/tui/tui-io.c2
-rw-r--r--gdb/tui/tui-source.c2
-rw-r--r--gdb/typeprint.c5
-rw-r--r--gdb/ui-file.c11
-rw-r--r--gdb/utils.c15
-rw-r--r--gdb/valops.c4
-rw-r--r--gdb/valprint.c6
-rw-r--r--gdb/varobj.c4
-rw-r--r--gdb/vaxobsd-tdep.c2
-rw-r--r--gdb/windows-tdep.c2
-rw-r--r--gdb/xcoffread.c19
-rw-r--r--gdb/xml-support.c8
-rw-r--r--gdb/xml-syscall.c2
-rw-r--r--gdb/xstormy16-tdep.c2
192 files changed, 1411 insertions, 796 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 38a49e0..fb66ae8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 07ee1ea..aaf6608 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -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';
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 1c45bcb..e64463e 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -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,9 +946,9 @@ 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,
- end - renaming_expr);
+ index_name
+ = (char *) obstack_copy0 (&temp_parse_space, renaming_expr,
+ end - renaming_expr);
renaming_expr = end;
ada_lookup_encoded_symbol (index_name, NULL, VAR_DOMAIN,
@@ -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;
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 8089a32..0b463e2 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -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';
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index 1a93a5c..97f9b2d 100644
--- a/gdb/ada-lex.l
+++ b/gdb/ada-lex.l
@@ -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)
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index c97057e..fbe67aa 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -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);
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 1fb0f0e..11fdc70 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -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);
diff --git a/gdb/addrmap.c b/gdb/addrmap.c
index a124aea..a526167 100644
--- a/gdb/addrmap.c
+++ b/gdb/addrmap.c
@@ -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;
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index a672cde..a2179ce 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -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;
diff --git a/gdb/amd64obsd-tdep.c b/gdb/amd64obsd-tdep.c
index d6c7e90..46bf7c5 100644
--- a/gdb/amd64obsd-tdep.c
+++ b/gdb/amd64obsd-tdep.c
@@ -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;
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 7df5570..bb93fbe 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -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,
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index bc2cec4..46d59ba 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -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))
diff --git a/gdb/arm-symbian-tdep.c b/gdb/arm-symbian-tdep.c
index 02811ed..5a94293 100644
--- a/gdb/arm-symbian-tdep.c
+++ b/gdb/arm-symbian-tdep.c
@@ -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;
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index bcee29c..cb47fa76 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -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,8 +2383,9 @@ 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,
- n_bytes + n_words * 4 + 1);
+ gdb_byte *p = entry
+ = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack,
+ n_bytes + n_words * 4 + 1);
while (n_bytes--)
*p++ = (gdb_byte) ((word >> (8 * n_bytes)) & 0xff);
@@ -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';
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 7da288f..119c673 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -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)
- + strlen (name) + 1
- + (full_path != NULL ? (strlen (full_path) + 1) : 0));
+ *slot = ((struct loaded_script *)
+ xmalloc (sizeof (**slot)
+ + strlen (name) + 1
+ + (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. */
diff --git a/gdb/auxv.c b/gdb/auxv.c
index fff34ff..f99da36 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -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;
diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index 8dbe572..49afee6 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -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;
diff --git a/gdb/bcache.c b/gdb/bcache.c
index f3abc12..6db56d2 100644
--- a/gdb/bcache.c
+++ b/gdb/bcache.c
@@ -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;
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 520793a..c09d56a 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -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
diff --git a/gdb/btrace.c b/gdb/btrace.c
index e205ea8..4292dc7 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -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. */
diff --git a/gdb/build-id.c b/gdb/build-id.c
index c89cd55..c7c718c 100644
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -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
- + 2 * build_id_len + (sizeof ".debug" - 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. */
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 54c1d03..5f463ac 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -1429,9 +1429,9 @@ end_symtab_with_blockvector (struct block *static_block,
{
/* Reallocate the dirname on the symbol obstack. */
COMPUNIT_DIRNAME (cu)
- = obstack_copy0 (&objfile->objfile_obstack,
- buildsym_compunit->comp_dir,
- strlen (buildsym_compunit->comp_dir));
+ = (const char *) obstack_copy0 (&objfile->objfile_obstack,
+ buildsym_compunit->comp_dir,
+ strlen (buildsym_compunit->comp_dir));
}
/* Save the debug format string (if any) in the symtab. */
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 351505e..e37a0b1 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -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,9 +3197,10 @@ 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,
- current.value.sval.length);
+ current.value.sval.ptr
+ = (const char *) obstack_copy0 (&expansion_obstack,
+ current.value.sval.ptr,
+ current.value.sval.length);
VEC_replace (token_and_value, token_fifo, 0, &current);
if (checkpoint > 1)
@@ -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';
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index f38af47..6731b43 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -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));
}
diff --git a/gdb/charset.c b/gdb/charset.c
index 669d689..afd9220 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -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;
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index aa9a9a5..424bf5e 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -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);
}
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 2449dc5..aabe3e3 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -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);
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index 174a10b..7df7c14 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -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
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 1717240..624a493 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -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);
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 64f09f2..9439f48fb 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -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);
diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c
index 2154c35..2d780b9 100644
--- a/gdb/coff-pe-read.c
+++ b/gdb/coff-pe-read.c
@@ -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;
diff --git a/gdb/coffread.c b/gdb/coffread.c
index a5033d1..9d20eebdc 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -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;
diff --git a/gdb/common/btrace-common.c b/gdb/common/btrace-common.c
index 9d6c4a7..7d65ab2 100644
--- a/gdb/common/btrace-common.c
+++ b/gdb/common/btrace-common.c
@@ -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,
diff --git a/gdb/common/buffer.c b/gdb/common/buffer.c
index ca1636d..684fb6e 100644
--- a/gdb/common/buffer.c
+++ b/gdb/common/buffer.c
@@ -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;
diff --git a/gdb/common/filestuff.c b/gdb/common/filestuff.c
index c829a89..4348527 100644
--- a/gdb/common/filestuff.c
+++ b/gdb/common/filestuff.c
@@ -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. */
diff --git a/gdb/common/format.c b/gdb/common/format.c
index 1602e53..52c6b81 100644
--- a/gdb/common/format.c
+++ b/gdb/common/format.c
@@ -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;
diff --git a/gdb/common/gdb_vecs.c b/gdb/common/gdb_vecs.c
index 84424f8..63766db 100644
--- a/gdb/common/gdb_vecs.c
+++ b/gdb/common/gdb_vecs.c
@@ -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);
diff --git a/gdb/common/xml-utils.c b/gdb/common/xml-utils.c
index e928afb..00e0356 100644
--- a/gdb/common/xml-utils.c
+++ b/gdb/common/xml-utils.c
@@ -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])
{
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index 73868c2..ea1a19a 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -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"),
diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c
index 6a39d13..6bc96b9 100644
--- a/gdb/compile/compile-object-run.c
+++ b/gdb/compile/compile-object-run.c
@@ -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);
diff --git a/gdb/completer.c b/gdb/completer.c
index 821f882..f13289a 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -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);
diff --git a/gdb/corefile.c b/gdb/corefile.c
index eba36d6..31301cf 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -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;
}
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 9218003..5462e02 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -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))
{
diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y
index 0657a52..cbbb0e8 100644
--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -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);
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index b8b19ed..acd4845 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -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);
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index d3e26ad..0e3c948 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -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';
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 0c32f04..a3e9426 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -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,
diff --git a/gdb/ctf.c b/gdb/ctf.c
index 6e7c616..6c1aede 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -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++)
{
diff --git a/gdb/d-exp.y b/gdb/d-exp.y
index dd87d8a..30ff480 100644
--- a/gdb/d-exp.y
+++ b/gdb/d-exp.y
@@ -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;
diff --git a/gdb/d-namespace.c b/gdb/d-namespace.c
index bed8d5b..e142e11 100644
--- a/gdb/d-namespace.c
+++ b/gdb/d-namespace.c
@@ -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);
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index dd81ec8..1f003b2 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -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,8 +1671,8 @@ read_dbx_symtab (struct objfile *objfile)
if (new_name != NULL)
{
sym_len = strlen (new_name);
- sym_name = obstack_copy0 (&objfile->objfile_obstack,
- new_name, sym_len);
+ sym_name = (char *) obstack_copy0 (&objfile->objfile_obstack,
+ new_name, sym_len);
xfree (new_name);
}
xfree (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);
}
}
diff --git a/gdb/dcache.c b/gdb/dcache.c
index f1cabb0..6b65401 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -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++;
}
diff --git a/gdb/demangle.c b/gdb/demangle.c
index c0027be..ded4a25 100644
--- a/gdb/demangle.c
+++ b/gdb/demangle.c
@@ -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++)
diff --git a/gdb/dicos-tdep.c b/gdb/dicos-tdep.c
index 633cd8d..82c6c11 100644
--- a/gdb/dicos-tdep.c
+++ b/gdb/dicos-tdep.c
@@ -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)
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
index 1829b12..68f4f7d 100644
--- a/gdb/dictionary.c
+++ b/gdb/dictionary.c
@@ -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;
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index f9afe0b..0613d06 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -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);
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index 09b56b6..819a5f1 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -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);
}
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index dd8dd0b..c2c0c59 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -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;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 90e581a..4aa2f6d 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -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,9 +7828,9 @@ fixup_go_packaging (struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->objfile;
const char *saved_package_name
- = obstack_copy0 (&objfile->per_bfd->storage_obstack,
- package_name,
- strlen (package_name));
+ = (const char *) obstack_copy0 (&objfile->per_bfd->storage_obstack,
+ package_name,
+ strlen (package_name));
struct type *type = init_type (TYPE_CODE_MODULE, 0, 0,
saved_package_name, objfile);
struct symbol *sym;
@@ -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,
- intermediate_name,
- strlen (intermediate_name));
+ name = ((const char *)
+ obstack_copy0 (&objfile->per_bfd->storage_obstack,
+ 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,9 +10106,10 @@ 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,
- virtual_dwo_name,
- strlen (virtual_dwo_name));
+ dwo_file->dwo_name
+ = (const char *) obstack_copy0 (&objfile->objfile_obstack,
+ virtual_dwo_name,
+ strlen (virtual_dwo_name));
dwo_file->comp_dir = comp_dir;
dwo_file->sections.abbrev = sections.abbrev;
dwo_file->sections.line = sections.line;
@@ -10306,9 +10308,10 @@ 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,
- virtual_dwo_name,
- strlen (virtual_dwo_name));
+ dwo_file->dwo_name
+ = (const char *) obstack_copy0 (&objfile->objfile_obstack,
+ virtual_dwo_name,
+ strlen (virtual_dwo_name));
dwo_file->comp_dir = comp_dir;
dwo_file->sections.abbrev =
create_dwp_v2_section (&dwp_file->sections.abbrev,
@@ -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,
- actual_class_name,
- strlen (actual_class_name));
+ = ((const char *)
+ obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
+ 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,8 +18954,8 @@ 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,
- message, strlen (message));
+ saved = (char *) obstack_copy0 (&objfile->objfile_obstack,
+ message, strlen (message));
xfree (message);
return init_type (TYPE_CODE_ERROR, 0, 0, saved, objfile);
@@ -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);
diff --git a/gdb/elfread.c b/gdb/elfread.c
index fa900a0..a018cdd 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -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);
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 84650ca..3f98c05 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -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);
diff --git a/gdb/exec.c b/gdb/exec.c
index 8ddb3df..3089bb4 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -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
diff --git a/gdb/expprint.c b/gdb/expprint.c
index b098c4b..41de190 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -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)
{
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index 9609cd8..3231022 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -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. */
diff --git a/gdb/findcmd.c b/gdb/findcmd.c
index 99cecb3..f3e2305 100644
--- a/gdb/findcmd.c
+++ b/gdb/findcmd.c
@@ -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;
}
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 11325cf..0f46e53 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -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,
diff --git a/gdb/frame.c b/gdb/frame.c
index 745e007..8b804cd 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -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;
}
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index 64712da..af5560d 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -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);
}
diff --git a/gdb/gdb_obstack.c b/gdb/gdb_obstack.c
index d8d03df..5545242 100644
--- a/gdb/gdb_obstack.c
+++ b/gdb/gdb_obstack.c
@@ -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;
}
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index d09c454..d6ce174 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -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.
diff --git a/gdb/gdbserver/ax.c b/gdb/gdbserver/ax.c
index 3d0d93d..4c9dadc 100644
--- a/gdb/gdbserver/ax.c
+++ b/gdb/gdbserver/ax.c
@@ -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;
}
diff --git a/gdb/gdbserver/hostio.c b/gdb/gdbserver/hostio.c
index a631d9e..48fa6f3 100644
--- a/gdb/gdbserver/hostio.c
+++ b/gdb/gdbserver/hostio.c
@@ -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
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index f5b64ab..12a2332 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -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;
}
diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c
index 9356741..f077497 100644
--- a/gdb/gdbserver/mem-break.c
+++ b/gdb/gdbserver/mem-break.c
@@ -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;
}
diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c
index 59bdc53..f79063c 100644
--- a/gdb/gdbserver/regcache.c
+++ b/gdb/gdbserver/regcache.c
@@ -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");
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 7cf66cc..e366091 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -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);
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 827316f..53763e5 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -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;
diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c
index 17ff7a6..301f90e 100644
--- a/gdb/gdbserver/target.c
+++ b/gdb/gdbserver/target.c
@@ -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);
diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
index cd07c52..f5fdf10 100644
--- a/gdb/gdbserver/thread-db.c
+++ b/gdb/gdbserver/thread-db.c
@@ -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';
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 6b50f26..1b3a5d0 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -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,10 +7372,12 @@ 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,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED,
- -1, 0);
+ 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);
if (gdb_jump_pad_buffer != MAP_FAILED)
break;
}
@@ -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");
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 12ff014..063dcf2 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -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;
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index f270855..29eec99 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1210,9 +1210,9 @@ 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, \
- sizeof (*TYPE_MAIN_TYPE (type)->type_specific.func_stuff)))
+ 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
#define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 3b6cc77..b493112 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -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;
diff --git a/gdb/go-exp.y b/gdb/go-exp.y
index 4e017fe..c2ae28d 100644
--- a/gdb/go-exp.y
+++ b/gdb/go-exp.y
@@ -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;
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index b72c857..509704c 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -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;
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index 2eb6dc6..109c1b0 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -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)
{
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index e782648..900d7b0 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -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])
diff --git a/gdb/guile/scm-ports.c b/gdb/guile/scm-ports.c
index e406ae1..280e6d4 100644
--- a/gdb/guile/scm-ports.c
+++ b/gdb/guile/scm-ports.c
@@ -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;
}
diff --git a/gdb/guile/scm-utils.c b/gdb/guile/scm-utils.c
index b0873f3..da45a05 100644
--- a/gdb/guile/scm-utils.c
+++ b/gdb/guile/scm-utils.c
@@ -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)
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 4887902..a8cfc52 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -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);
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 01a7c80..cf894ee 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -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,
diff --git a/gdb/i386-cygwin-tdep.c b/gdb/i386-cygwin-tdep.c
index 79ff478..cb70258 100644
--- a/gdb/i386-cygwin-tdep.c
+++ b/gdb/i386-cygwin-tdep.c
@@ -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;
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 9d52d4a..d4df18e 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -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';
diff --git a/gdb/i386obsd-tdep.c b/gdb/i386obsd-tdep.c
index eae445c..f344a97 100644
--- a/gdb/i386obsd-tdep.c
+++ b/gdb/i386obsd-tdep.c
@@ -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++)
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index ada570d..3566331 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -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;
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 569a6dd..c98de4a 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -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);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 701ea37..ec88621 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -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,
diff --git a/gdb/jit.c b/gdb/jit.c
index 10da21d..6302052 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -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,9 +705,10 @@ 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,
- gdb_block_iter->name,
- strlen (gdb_block_iter->name));
+ block_name->ginfo.name
+ = (const char *) obstack_copy0 (&objfile->objfile_obstack,
+ gdb_block_iter->name,
+ strlen (gdb_block_iter->name));
BLOCK_FUNCTION (new_block) = block_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;
diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y
index 60b7d2e..8edd94e 100644
--- a/gdb/jv-exp.y
+++ b/gdb/jv-exp.y
@@ -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);
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index 73df044..43e2c6b 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -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';
}
diff --git a/gdb/jv-typeprint.c b/gdb/jv-typeprint.c
index 3ea81c3..441f313 100644
--- a/gdb/jv-typeprint.c
+++ b/gdb/jv-typeprint.c
@@ -233,7 +233,7 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
p = strrchr (real_physname, ')');
gdb_assert (p != NULL);
++p; /* Keep the trailing ')'. */
- physname = alloca (p - real_physname + 1);
+ physname = (char *) alloca (p - real_physname + 1);
memcpy (physname, real_physname, p - real_physname);
physname[p - real_physname] = '\0';
diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c
index 9fc8f50..a8547a5 100644
--- a/gdb/jv-valprint.c
+++ b/gdb/jv-valprint.c
@@ -99,7 +99,8 @@ java_value_print (struct value *val, struct ui_file *stream,
{
gdb_byte *buf;
- buf = alloca (gdbarch_ptr_bit (gdbarch) / HOST_CHAR_BIT);
+ buf = ((gdb_byte *)
+ alloca (gdbarch_ptr_bit (gdbarch) / HOST_CHAR_BIT));
fputs_filtered (", ", stream);
wrap_here (n_spaces (2));
diff --git a/gdb/language.c b/gdb/language.c
index 121e8ad..b6fe77e 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -568,8 +568,9 @@ add_language (const struct language_defn *lang)
/* Build the language names array, to be used as enumeration in the
set language" enum command. */
- language_names = xrealloc (language_names,
- (languages_size + 1) * sizeof (const char *));
+ language_names = XRESIZEVEC (const char *, language_names,
+ languages_size + 1);
+
for (i = 0; i < languages_size; ++i)
language_names[i] = languages[i]->la_name;
language_names[i] = NULL;
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 7a595ed..a61b08a 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -810,7 +810,7 @@ add_sal_to_sals_basic (struct symtabs_and_lines *sals,
struct symtab_and_line *sal)
{
++sals->nelts;
- sals->sals = xrealloc (sals->sals, sals->nelts * sizeof (sals->sals[0]));
+ sals->sals = XRESIZEVEC (struct symtab_and_line, sals->sals, sals->nelts);
sals->sals[sals->nelts - 1] = *sal;
}
@@ -833,9 +833,8 @@ add_sal_to_sals (struct linespec_state *self,
{
struct linespec_canonical_name *canonical;
- self->canonical_names = xrealloc (self->canonical_names,
- (sals->nelts
- * sizeof (*self->canonical_names)));
+ self->canonical_names = XRESIZEVEC (struct linespec_canonical_name,
+ self->canonical_names, sals->nelts);
canonical = &self->canonical_names[sals->nelts - 1];
if (!literal_canonical && sal->symtab)
{
@@ -2758,7 +2757,7 @@ decode_objc (struct linespec_state *self, linespec_p ls, const char *arg)
{
char *saved_arg;
- saved_arg = alloca (new_argptr - arg + 1);
+ saved_arg = (char *) alloca (new_argptr - arg + 1);
memcpy (saved_arg, arg, new_argptr - arg);
saved_arg[new_argptr - arg] = '\0';
@@ -3290,14 +3289,14 @@ find_linespec_symbols (struct linespec_state *state,
/* LOOKUP_NAME points to the class name.
LAST points to the method name. */
- klass = xmalloc ((last - lookup_name + 1) * sizeof (char));
+ klass = XNEWVEC (char, last - lookup_name + 1);
make_cleanup (xfree, klass);
strncpy (klass, lookup_name, last - lookup_name);
klass[last - lookup_name] = '\0';
/* Skip past the scope operator. */
last += strlen (scope_op);
- method = xmalloc ((strlen (last) + 1) * sizeof (char));
+ method = XNEWVEC (char, strlen (last) + 1);
make_cleanup (xfree, method);
strcpy (method, last);
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index dbaa36e..fdea247 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -297,8 +297,7 @@ fork_save_infrun_state (struct fork_info *fp, int clobber_regs)
fp->maxfd = tmp;
}
/* Allocate array of file positions. */
- fp->filepos = xrealloc (fp->filepos,
- (fp->maxfd + 1) * sizeof (*fp->filepos));
+ fp->filepos = XRESIZEVEC (off_t, fp->filepos, fp->maxfd + 1);
/* Initialize to -1 (invalid). */
for (tmp = 0; tmp <= fp->maxfd; tmp++)
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 6b01a51..c6dbc01 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1540,7 +1540,7 @@ linux_nat_detach (struct target_ops *ops, const char *args, int from_tty)
/* Put the signal number in ARGS so that inf_ptrace_detach will
pass it along with PTRACE_DETACH. */
- tem = alloca (8);
+ tem = (char *) alloca (8);
xsnprintf (tem, 8, "%d", (int) WSTOPSIG (status));
args = tem;
if (debug_linux_nat)
@@ -4940,7 +4940,7 @@ linux_nat_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;
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index 559d5f1..5873365 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -98,7 +98,7 @@ record_linux_sockaddr (struct regcache *regcache,
if (!addr)
return 0;
- a = alloca (tdep->size_int);
+ a = (gdb_byte *) alloca (tdep->size_int);
if (record_full_arch_list_add_mem ((CORE_ADDR) len, tdep->size_int))
return -1;
@@ -140,7 +140,7 @@ record_linux_msghdr (struct regcache *regcache,
if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tdep->size_msghdr))
return -1;
- a = alloca (tdep->size_msghdr);
+ a = (gdb_byte *) alloca (tdep->size_msghdr);
if (target_read_memory ((CORE_ADDR) addr, a, tdep->size_msghdr))
{
if (record_debug)
@@ -172,7 +172,7 @@ record_linux_msghdr (struct regcache *regcache,
ULONGEST i;
ULONGEST len = extract_unsigned_integer (a, tdep->size_size_t,
byte_order);
- gdb_byte *iov = alloca (tdep->size_iovec);
+ gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
for (i = 0; i < len; i++)
{
@@ -805,7 +805,7 @@ Do you want to stop the program?"),
if (tmpulongest)
{
ULONGEST optvalp;
- gdb_byte *optlenp = alloca (tdep->size_int);
+ gdb_byte *optlenp = (gdb_byte *) alloca (tdep->size_int);
if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
tdep->size_int))
@@ -847,7 +847,7 @@ Do you want to stop the program?"),
&tmpulongest);
if (tmpulongest)
{
- gdb_byte *a = alloca (tdep->size_ulong * 2);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
ULONGEST len;
tmpulongest += tdep->size_ulong;
@@ -875,7 +875,7 @@ Do you want to stop the program?"),
case RECORD_SYS_SOCKETPAIR:
{
- gdb_byte *a = alloca (tdep->size_ulong);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
@@ -909,7 +909,7 @@ Do you want to stop the program?"),
&tmpulongest);
if (tmpulongest)
{
- gdb_byte *a = alloca (tdep->size_ulong * 2);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
ULONGEST len;
tmpulongest += tdep->size_ulong * 4;
@@ -936,7 +936,7 @@ Do you want to stop the program?"),
&tmpulongest);
if (tmpulongest)
{
- gdb_byte *a = alloca (tdep->size_ulong * 2);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
tmpulongest += tdep->size_ulong;
if (target_read_memory ((CORE_ADDR) tmpulongest, a,
@@ -968,8 +968,8 @@ Do you want to stop the program?"),
break;
case RECORD_SYS_GETSOCKOPT:
{
- gdb_byte *a = alloca (tdep->size_ulong * 2);
- gdb_byte *av = alloca (tdep->size_int);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
+ gdb_byte *av = (gdb_byte *) alloca (tdep->size_int);
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
@@ -1030,7 +1030,7 @@ Do you want to stop the program?"),
break;
case RECORD_SYS_RECVMSG:
{
- gdb_byte *a = alloca (tdep->size_ulong);
+ gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
@@ -1386,7 +1386,7 @@ Do you want to stop the program?"),
regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
if (vec)
{
- gdb_byte *iov = alloca (tdep->size_iovec);
+ gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
@@ -1889,7 +1889,7 @@ Do you want to stop the program?"),
gdb_byte *iocbp;
regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
- iocbp = alloca (nr * tdep->size_pointer);
+ iocbp = (gdb_byte *) alloca (nr * tdep->size_pointer);
if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
nr * tdep->size_pointer))
{
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index ff3ada7..86d9eef 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -997,7 +997,7 @@ linux_core_info_proc_mappings (struct gdbarch *gdbarch, const char *args)
if (note_size < 2 * addr_size)
error (_("malformed core note - too short for header"));
- contents = xmalloc (note_size);
+ contents = (unsigned char *) xmalloc (note_size);
cleanup = make_cleanup (xfree, contents);
if (!bfd_get_section_contents (core_bfd, section, contents, 0, note_size))
error (_("could not get core note contents"));
@@ -1562,7 +1562,7 @@ linux_collect_regset_section_cb (const char *sect_name, int size,
gdb_assert (regset && 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. */
@@ -1630,7 +1630,7 @@ linux_get_siginfo_data (struct gdbarch *gdbarch, LONGEST *size)
siginfo_type = gdbarch_get_siginfo_type (gdbarch);
- buf = xmalloc (TYPE_LENGTH (siginfo_type));
+ buf = (gdb_byte *) xmalloc (TYPE_LENGTH (siginfo_type));
cleanups = make_cleanup (xfree, buf);
bytes_read = target_read (&current_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index b5719eb..91bd0dc 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -873,6 +873,7 @@ try_thread_db_load_from_pdir_1 (struct objfile *obj, const char *subdir)
char *path, *cp;
int result;
const char *obj_name = objfile_name (obj);
+ int alloc_len;
if (obj_name[0] != '/')
{
@@ -881,8 +882,10 @@ try_thread_db_load_from_pdir_1 (struct objfile *obj, const char *subdir)
return 0;
}
- path = xmalloc (strlen (obj_name) + (subdir ? strlen (subdir) + 1 : 0)
- + 1 + strlen (LIBTHREAD_DB_SO) + 1);
+ alloc_len = (strlen (obj_name)
+ + (subdir ? strlen (subdir) + 1 : 0)
+ + 1 + strlen (LIBTHREAD_DB_SO) + 1);
+ path = (char *) xmalloc (alloc_len);
cleanup = make_cleanup (xfree, path);
strcpy (path, obj_name);
@@ -959,7 +962,7 @@ try_thread_db_load_from_dir (const char *dir, size_t dir_len)
if (!auto_load_thread_db)
return 0;
- path = xmalloc (dir_len + 1 + strlen (LIBTHREAD_DB_SO) + 1);
+ path = (char *) xmalloc (dir_len + 1 + strlen (LIBTHREAD_DB_SO) + 1);
cleanup = make_cleanup (xfree, path);
memcpy (path, dir, dir_len);
@@ -1004,7 +1007,7 @@ thread_db_load_search (void)
if (this_dir[pdir_len] == '/')
{
- subdir = xmalloc (strlen (this_dir));
+ subdir = (char *) xmalloc (strlen (this_dir));
make_cleanup (xfree, subdir);
strcpy (subdir, this_dir + pdir_len + 1);
}
@@ -2059,7 +2062,7 @@ info_auto_load_libthread_db (char *args, int from_tty)
ui_out_table_header (uiout, pids_len, ui_left, "PIDs", "Pids");
ui_out_table_body (uiout);
- pids = xmalloc (max_pids_len + 1);
+ pids = (char *) xmalloc (max_pids_len + 1);
make_cleanup (xfree, pids);
/* Note I is incremented inside the cycle, not at its end. */
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index 3be7405..3b7a585 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -2467,7 +2467,7 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch,
paddress (gdbarch, addr));
func_name = MSYMBOL_LINKAGE_NAME (func_msym.minsym);
- tramp_name = xmalloc (strlen (func_name) + 5);
+ tramp_name = (char *) xmalloc (strlen (func_name) + 5);
strcpy (tramp_name, func_name);
strcat (tramp_name, ".plt");
@@ -2554,7 +2554,7 @@ m32c_m16c_pointer_to_address (struct gdbarch *gdbarch,
Since the trampoline contains a jump instruction, we
could also just extract the jump's target address. I
don't see much advantage one way or the other. */
- char *func_name = xmalloc (len - 4 + 1);
+ char *func_name = (char *) xmalloc (len - 4 + 1);
memcpy (func_name, ptr_msym_name, len - 4);
func_name[len - 4] = '\0';
func_msym
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 69ed9dc..df7cd0c 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -337,7 +337,7 @@ m68hc11_pseudo_register_write (struct gdbarch *gdbarch,
if (regno == M68HC12_HARD_PC_REGNUM)
{
const int regsize = 4;
- gdb_byte *tmp = alloca (regsize);
+ gdb_byte *tmp = (gdb_byte *) alloca (regsize);
CORE_ADDR pc;
memcpy (tmp, buf, regsize);
@@ -362,7 +362,7 @@ m68hc11_pseudo_register_write (struct gdbarch *gdbarch,
if (soft_regs[regno].name)
{
const int regsize = 2;
- gdb_byte *tmp = alloca (regsize);
+ gdb_byte *tmp = (gdb_byte *) alloca (regsize);
memcpy (tmp, buf, regsize);
target_write_memory (soft_regs[regno].addr, tmp, regsize);
}
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index f833741..285a831 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -1028,7 +1028,7 @@ m68k_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
return 0;
}
- buf = alloca (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
+ buf = (gdb_byte *) alloca (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
sp = get_frame_register_unsigned (frame, gdbarch_sp_regnum (gdbarch));
if (target_read_memory (sp + SP_ARG0, /* Offset of first arg on stack. */
diff --git a/gdb/machoread.c b/gdb/machoread.c
index 675155e..b7510fd 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -783,7 +783,7 @@ macho_check_dsym (struct objfile *objfile, char **filenamep)
size_t dsym_len = strlen (DSYM_SUFFIX);
const char *base_name = lbasename (objfile_name (objfile));
size_t base_len = strlen (base_name);
- char *dsym_filename = alloca (name_len + dsym_len + base_len + 1);
+ char *dsym_filename = (char *) alloca (name_len + dsym_len + base_len + 1);
bfd *dsym_bfd;
bfd_mach_o_load_command *main_uuid;
bfd_mach_o_load_command *dsym_uuid;
diff --git a/gdb/macroexp.c b/gdb/macroexp.c
index e6c9c86..bbd81e7 100644
--- a/gdb/macroexp.c
+++ b/gdb/macroexp.c
@@ -146,7 +146,7 @@ resize_buffer (struct macro_buffer *b, int n)
while (b->size <= n)
b->size *= 2;
- b->text = xrealloc (b->text, b->size);
+ b->text = (char *) xrealloc (b->text, b->size);
}
@@ -825,7 +825,7 @@ gather_arguments (const char *name, struct macro_buffer *src,
if (args_len >= args_size)
{
args_size *= 2;
- args = xrealloc (args, sizeof (*args) * args_size);
+ args = XRESIZEVEC (struct macro_buffer, args, args_size);
}
/* Initialize the next argument. */
@@ -858,7 +858,8 @@ gather_arguments (const char *name, struct macro_buffer *src,
if (args_len >= args_size)
{
args_size++;
- args = xrealloc (args, sizeof (*args) * args_size);
+ args = XRESIZEVEC (struct macro_buffer, args,
+ args_size);
}
arg = &args[args_len++];
set_token (arg, src->text, src->text);
@@ -1330,7 +1331,7 @@ maybe_expand (struct macro_buffer *dest,
{
/* Make a null-terminated copy of it, since that's what our
lookup function expects. */
- char *id = xmalloc (src_first->len + 1);
+ char *id = (char *) xmalloc (src_first->len + 1);
struct cleanup *back_to = make_cleanup (xfree, id);
memcpy (id, src_first->text, src_first->len);
diff --git a/gdb/macrotab.c b/gdb/macrotab.c
index 30c020b..9245c7c 100644
--- a/gdb/macrotab.c
+++ b/gdb/macrotab.c
@@ -352,7 +352,7 @@ new_macro_key (struct macro_table *t,
struct macro_source_file *file,
int line)
{
- struct macro_key *k = macro_alloc (sizeof (*k), t);
+ struct macro_key *k = (struct macro_key *) macro_alloc (sizeof (*k), t);
memset (k, 0, sizeof (*k));
k->table = t;
@@ -385,7 +385,8 @@ new_source_file (struct macro_table *t,
const char *filename)
{
/* Get space for the source file structure itself. */
- struct macro_source_file *f = macro_alloc (sizeof (*f), t);
+ struct macro_source_file *f
+ = (struct macro_source_file *) macro_alloc (sizeof (*f), t);
memset (f, 0, sizeof (*f));
f->table = t;
@@ -553,7 +554,8 @@ new_macro_definition (struct macro_table *t,
int argc, const char **argv,
const char *replacement)
{
- struct macro_definition *d = macro_alloc (sizeof (*d), t);
+ struct macro_definition *d
+ = (struct macro_definition *) macro_alloc (sizeof (*d), t);
memset (d, 0, sizeof (*d));
d->table = t;
@@ -568,7 +570,7 @@ new_macro_definition (struct macro_table *t,
int cached_argv_size = argc * sizeof (*cached_argv);
/* Bcache all the arguments. */
- cached_argv = alloca (cached_argv_size);
+ cached_argv = (const char **) alloca (cached_argv_size);
for (i = 0; i < argc; i++)
cached_argv[i] = macro_bcache_str (t, argv[i]);
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index f8338f4..7a81592 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -1050,8 +1050,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
enum_sym = allocate_symbol (mdebugread_objfile);
SYMBOL_SET_LINKAGE_NAME
(enum_sym,
- obstack_copy0 (&mdebugread_objfile->objfile_obstack,
- f->name, strlen (f->name)));
+ (char *) obstack_copy0 (&mdebugread_objfile->objfile_obstack,
+ f->name, strlen (f->name)));
SYMBOL_ACLASS_INDEX (enum_sym) = LOC_CONST;
SYMBOL_TYPE (enum_sym) = t;
SYMBOL_DOMAIN (enum_sym) = VAR_DOMAIN;
@@ -1696,8 +1696,9 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
else if (TYPE_TAG_NAME (tp) == NULL
|| strcmp (TYPE_TAG_NAME (tp), name) != 0)
TYPE_TAG_NAME (tp)
- = obstack_copy0 (&mdebugread_objfile->objfile_obstack,
- name, strlen (name));
+ = ((const char *)
+ obstack_copy0 (&mdebugread_objfile->objfile_obstack,
+ name, strlen (name)));
}
}
@@ -1733,8 +1734,9 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
if (TYPE_NAME (tp) == NULL
|| strcmp (TYPE_NAME (tp), name) != 0)
TYPE_NAME (tp)
- = obstack_copy0 (&mdebugread_objfile->objfile_obstack,
- name, strlen (name));
+ = ((const char *)
+ obstack_copy0 (&mdebugread_objfile->objfile_obstack,
+ name, strlen (name)));
}
}
if (t->bt == btTypedef)
@@ -2826,10 +2828,11 @@ parse_partial_symbols (struct objfile *objfile)
/* Concatinate stabstring2 with stabstring1. */
if (stabstring
&& stabstring != debug_info->ss + fh->issBase + sh.iss)
- stabstring = xrealloc (stabstring, len + len2 + 1);
+ stabstring
+ = (char *) xrealloc (stabstring, len + len2 + 1);
else
{
- stabstring = xmalloc (len + len2 + 1);
+ stabstring = (char *) xmalloc (len + len2 + 1);
strcpy (stabstring, stabstring1);
}
strcpy (stabstring + len, stabstring2);
@@ -3249,7 +3252,7 @@ parse_partial_symbols (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';
@@ -3273,7 +3276,7 @@ parse_partial_symbols (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';
@@ -4278,10 +4281,10 @@ psymtab_to_symtab_1 (struct objfile *objfile,
if (size > 1)
--size;
SYMTAB_LINETABLE (COMPUNIT_FILETABS (cust))
- = obstack_copy (&mdebugread_objfile->objfile_obstack,
- lines,
- (sizeof (struct linetable)
- + size * sizeof (lines->item)));
+ = ((struct linetable *)
+ obstack_copy (&mdebugread_objfile->objfile_obstack,
+ lines, (sizeof (struct linetable)
+ + size * sizeof (lines->item))));
xfree (lines);
/* .. and our share of externals.
diff --git a/gdb/mem-break.c b/gdb/mem-break.c
index 0fb53cf..3fbc33b 100644
--- a/gdb/mem-break.c
+++ b/gdb/mem-break.c
@@ -53,7 +53,7 @@ default_memory_insert_breakpoint (struct gdbarch *gdbarch,
/* Save the memory contents in the shadow_contents buffer and then
write the breakpoint instruction. */
- readbuf = alloca (bplen);
+ readbuf = (gdb_byte *) alloca (bplen);
val = target_read_memory (addr, readbuf, bplen);
if (val == 0)
{
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index 74929ed..4b6b19d 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -156,7 +156,7 @@ mi_argv_to_format (char **argv, int argc)
}
obstack_1grow (&obstack, '\0');
- ret = xstrdup (obstack_finish (&obstack));
+ ret = xstrdup ((const char *) obstack_finish (&obstack));
obstack_free (&obstack, NULL);
return ret;
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 907ed69..8712a7f 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1493,7 +1493,7 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
/* Create a buffer and read it in. */
total_bytes = word_size * nr_rows * nr_cols;
- mbuf = xcalloc (total_bytes, 1);
+ mbuf = XCNEWVEC (gdb_byte, total_bytes);
make_cleanup (xfree, mbuf);
/* Dispatch memory reads to the topmost target, not the flattened
@@ -1645,14 +1645,15 @@ mi_cmd_data_read_memory_bytes (char *command, char **argv, int argc)
struct cleanup *t = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
char *data, *p;
int i;
+ int alloc_len;
ui_out_field_core_addr (uiout, "begin", gdbarch, read_result->begin);
ui_out_field_core_addr (uiout, "offset", gdbarch, read_result->begin
- addr);
ui_out_field_core_addr (uiout, "end", gdbarch, read_result->end);
- data = xmalloc (
- (read_result->end - read_result->begin) * 2 * unit_size + 1);
+ alloc_len = (read_result->end - read_result->begin) * 2 * unit_size + 1;
+ data = (char *) xmalloc (alloc_len);
for (i = 0, p = data;
i < ((read_result->end - read_result->begin) * unit_size);
@@ -1790,7 +1791,7 @@ mi_cmd_data_write_memory_bytes (char *command, char **argv, int argc)
else
count_units = len_units;
- databuf = xmalloc (len_bytes * sizeof (gdb_byte));
+ databuf = XNEWVEC (gdb_byte, len_bytes);
back_to = make_cleanup (xfree, databuf);
for (i = 0; i < len_bytes; ++i)
@@ -1805,7 +1806,7 @@ mi_cmd_data_write_memory_bytes (char *command, char **argv, int argc)
{
/* Pattern is made of less units than count:
repeat pattern to fill memory. */
- data = xmalloc (count_units * unit_size);
+ data = (gdb_byte *) xmalloc (count_units * unit_size);
make_cleanup (xfree, data);
/* Number of times the pattern is entirely repeated. */
@@ -2902,7 +2903,7 @@ mi_cmd_trace_frame_collected (char *command, char **argv, int argc)
if (tsv != NULL)
{
- tsvname = xrealloc (tsvname, strlen (tsv->name) + 2);
+ tsvname = (char *) xrealloc (tsvname, strlen (tsv->name) + 2);
tsvname[0] = '$';
strcpy (tsvname + 1, tsv->name);
ui_out_field_string (uiout, "name", tsvname);
@@ -2946,7 +2947,7 @@ mi_cmd_trace_frame_collected (char *command, char **argv, int argc)
ui_out_field_core_addr (uiout, "address", gdbarch, r->start);
ui_out_field_int (uiout, "length", r->length);
- data = xmalloc (r->length);
+ data = (gdb_byte *) xmalloc (r->length);
make_cleanup (xfree, data);
if (memory_contents)
@@ -2956,7 +2957,7 @@ mi_cmd_trace_frame_collected (char *command, char **argv, int argc)
int m;
char *data_str, *p;
- data_str = xmalloc (r->length * 2 + 1);
+ data_str = (char *) xmalloc (r->length * 2 + 1);
make_cleanup (xfree, data_str);
for (m = 0, p = data_str; m < r->length; ++m, p += 2)
diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c
index 1e11c59..92efe26 100644
--- a/gdb/mi/mi-parse.c
+++ b/gdb/mi/mi-parse.c
@@ -165,7 +165,7 @@ mi_parse_argv (const char *args, struct mi_parse *parse)
return;
}
/* Create the buffer and copy characters in. */
- arg = xmalloc ((len + 1) * sizeof (char));
+ arg = XNEWVEC (char, len + 1);
chp = start;
len = 0;
while (*chp != '\0' && *chp != '"')
@@ -195,14 +195,14 @@ mi_parse_argv (const char *args, struct mi_parse *parse)
chp++;
}
len = chp - start;
- arg = xmalloc ((len + 1) * sizeof (char));
+ arg = XNEWVEC (char, len + 1);
strncpy (arg, start, len);
arg[len] = '\0';
break;
}
}
/* Append arg to argv. */
- argv = xrealloc (argv, (argc + 2) * sizeof (char *));
+ argv = XRESIZEVEC (char *, argv, argc + 2);
argv[argc++] = arg;
argv[argc] = NULL;
}
@@ -254,7 +254,7 @@ mi_parse (const char *cmd, char **token)
/* Find/skip any token and then extract it. */
for (chp = cmd; *chp >= '0' && *chp <= '9'; chp++)
;
- *token = xmalloc (chp - cmd + 1);
+ *token = (char *) xmalloc (chp - cmd + 1);
memcpy (*token, cmd, (chp - cmd));
(*token)[chp - cmd] = '\0';
@@ -276,7 +276,7 @@ mi_parse (const char *cmd, char **token)
for (; *chp && !isspace (*chp); chp++)
;
- parse->command = xmalloc (chp - tmp + 1);
+ parse->command = (char *) xmalloc (chp - tmp + 1);
memcpy (parse->command, tmp, chp - tmp);
parse->command[chp - tmp] = '\0';
}
diff --git a/gdb/minidebug.c b/gdb/minidebug.c
index 17c12f9..8610a15 100644
--- a/gdb/minidebug.c
+++ b/gdb/minidebug.c
@@ -101,7 +101,7 @@ lzma_open (struct bfd *nbfd, void *open_closure)
}
offset -= options.backward_size;
- indexdata = xmalloc (options.backward_size);
+ indexdata = (gdb_byte *) xmalloc (options.backward_size);
index = NULL;
pos = 0;
if (bfd_seek (section->owner, offset, SEEK_SET) != 0
@@ -155,7 +155,7 @@ lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes,
if (lzma_index_iter_locate (&iter, offset))
break;
- compressed = xmalloc (iter.block.total_size);
+ compressed = (gdb_byte *) xmalloc (iter.block.total_size);
block_offset = section->filepos + iter.block.compressed_file_offset;
if (bfd_seek (section->owner, block_offset, SEEK_SET) != 0
|| bfd_bread (compressed, iter.block.total_size, section->owner)
@@ -165,7 +165,7 @@ lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes,
break;
}
- uncompressed = xmalloc (iter.block.uncompressed_size);
+ uncompressed = (gdb_byte *) xmalloc (iter.block.uncompressed_size);
memset (&block, 0, sizeof (block));
block.filters = filters;
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 89ccea8..c0f84ee 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -6205,7 +6205,7 @@ mips_read_fp_register_single (struct frame_info *frame, int regno,
{
struct gdbarch *gdbarch = get_frame_arch (frame);
int raw_size = register_size (gdbarch, regno);
- gdb_byte *raw_buffer = alloca (raw_size);
+ gdb_byte *raw_buffer = (gdb_byte *) alloca (raw_size);
if (!deprecated_frame_register_read (frame, regno, raw_buffer))
error (_("can't read register %d (%s)"),
@@ -6281,8 +6281,9 @@ mips_print_fp_register (struct ui_file *file, struct frame_info *frame,
double doub, flt1; /* Doubles extracted from raw hex data. */
int inv1, inv2;
- raw_buffer = alloca (2 * register_size (gdbarch,
- mips_regnum (gdbarch)->fp0));
+ raw_buffer
+ = ((gdb_byte *)
+ alloca (2 * register_size (gdbarch, mips_regnum (gdbarch)->fp0)));
fprintf_filtered (file, "%s:", gdbarch_register_name (gdbarch, regnum));
fprintf_filtered (file, "%*s",
diff --git a/gdb/mipsnbsd-tdep.c b/gdb/mipsnbsd-tdep.c
index d15c88c..7cb83c0 100644
--- a/gdb/mipsnbsd-tdep.c
+++ b/gdb/mipsnbsd-tdep.c
@@ -263,7 +263,7 @@ mipsnbsd_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
CORE_ADDR jb_addr;
gdb_byte *buf;
- buf = alloca (NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch));
+ buf = (gdb_byte *) alloca (NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch));
jb_addr = get_frame_register_unsigned (frame, MIPS_A0_REGNUM);
diff --git a/gdb/mipsread.c b/gdb/mipsread.c
index 37f5b7a..0710dea 100644
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -215,13 +215,13 @@ read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets,
str_secsize = bfd_get_section_size (si.str_sect);
dyninfo_secsize = bfd_get_section_size (si.dyninfo_sect);
got_secsize = bfd_get_section_size (si.got_sect);
- sym_secptr = xmalloc (sym_secsize);
+ sym_secptr = (char *) xmalloc (sym_secsize);
cleanups = make_cleanup (xfree, sym_secptr);
- str_secptr = xmalloc (str_secsize);
+ str_secptr = (char *) xmalloc (str_secsize);
make_cleanup (xfree, str_secptr);
- dyninfo_secptr = xmalloc (dyninfo_secsize);
+ dyninfo_secptr = (char *) xmalloc (dyninfo_secsize);
make_cleanup (xfree, dyninfo_secptr);
- got_secptr = xmalloc (got_secsize);
+ got_secptr = (char *) xmalloc (got_secsize);
make_cleanup (xfree, got_secptr);
if (!bfd_get_section_contents (abfd, si.sym_sect, sym_secptr,
diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c
index ddc9522..21d081d 100644
--- a/gdb/mt-tdep.c
+++ b/gdb/mt-tdep.c
@@ -200,7 +200,7 @@ mt_register_name (struct gdbarch *gdbarch, int regnum)
array_names[regnum] = stub;
return stub;
}
- name = xmalloc (30);
+ name = (char *) xmalloc (30);
sprintf (name, "copro_%d_%d_%s", dim_1, dim_2, stub);
array_names[regnum] = name;
return name;
@@ -680,7 +680,7 @@ mt_registers_info (struct gdbarch *gdbarch,
regsize = register_size (gdbarch, regnum);
- buff = alloca (regsize);
+ buff = (unsigned char *) alloca (regsize);
bytes = XALLOCAVEC (unsigned int, regsize);
deprecated_frame_register_read (frame, regnum, buff);
@@ -707,7 +707,7 @@ mt_registers_info (struct gdbarch *gdbarch,
gdb_byte *buf;
struct value_print_options opts;
- buf = alloca (register_size (gdbarch, MT_COPRO_REGNUM));
+ buf = (gdb_byte *) alloca (register_size (gdbarch, MT_COPRO_REGNUM));
deprecated_frame_register_read (frame, MT_COPRO_REGNUM, buf);
/* And print. */
regnum = MT_COPRO_PSEUDOREG_REGNUM;
@@ -849,7 +849,7 @@ mt_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Right-justify the value in an aligned-length buffer. */
typelen = TYPE_LENGTH (value_type (args[j]));
slacklen = (wordsize - (typelen % wordsize)) % wordsize;
- val = xmalloc (typelen + slacklen);
+ val = (gdb_byte *) xmalloc (typelen + slacklen);
back_to = make_cleanup (xfree, val);
memcpy (val, contents, typelen);
memset (val + typelen, 0, slacklen);
diff --git a/gdb/namespace.c b/gdb/namespace.c
index fdbe51b..91cf5a2 100644
--- a/gdb/namespace.c
+++ b/gdb/namespace.c
@@ -45,6 +45,7 @@ add_using_directive (struct using_direct **using_directives,
{
struct using_direct *current;
struct using_direct *newobj;
+ int alloc_len;
/* Has it already been added? */
@@ -81,15 +82,18 @@ add_using_directive (struct using_direct **using_directives,
return;
}
- newobj = obstack_alloc (obstack, (sizeof (*newobj)
- + (VEC_length (const_char_ptr, excludes)
- * sizeof (*newobj->excludes))));
+ alloc_len = (sizeof(*newobj)
+ + (VEC_length (const_char_ptr, excludes)
+ * sizeof(*newobj->excludes)));
+ newobj = (struct using_direct *) obstack_alloc (obstack, alloc_len);
memset (newobj, 0, sizeof (*newobj));
if (copy_names)
{
- newobj->import_src = obstack_copy0 (obstack, src, strlen (src));
- newobj->import_dest = obstack_copy0 (obstack, dest, strlen (dest));
+ newobj->import_src
+ = (const char *) obstack_copy0 (obstack, src, strlen (src));
+ newobj->import_dest
+ = (const char *) obstack_copy0 (obstack, dest, strlen (dest));
}
else
{
@@ -98,13 +102,15 @@ add_using_directive (struct using_direct **using_directives,
}
if (alias != NULL && copy_names)
- newobj->alias = obstack_copy0 (obstack, alias, strlen (alias));
+ newobj->alias
+ = (const char *) obstack_copy0 (obstack, alias, strlen (alias));
else
newobj->alias = alias;
if (declaration != NULL && copy_names)
- newobj->declaration = obstack_copy0 (obstack,
- declaration, strlen (declaration));
+ newobj->declaration
+ = (const char *) obstack_copy0 (obstack, declaration,
+ strlen (declaration));
else
newobj->declaration = declaration;
diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index 08478d8..3173146 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -132,7 +132,7 @@ perf_event_read (const struct perf_event_buffer *pev, __u64 data_head,
start = begin + data_tail % buffer_size;
stop = begin + data_head % buffer_size;
- buffer = xmalloc (size);
+ buffer = (gdb_byte *) xmalloc (size);
if (start < stop)
memcpy (buffer, start, stop - start);
@@ -729,7 +729,8 @@ linux_enable_bts (ptid_t ptid, const struct btrace_config_bts *conf)
continue;
/* The number of pages we request needs to be a power of two. */
- header = mmap (NULL, length, PROT_READ, MAP_SHARED, bts->file, 0);
+ header = ((struct perf_event_mmap_page *)
+ mmap (NULL, length, PROT_READ, MAP_SHARED, bts->file, 0));
if (header != MAP_FAILED)
break;
}
diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c
index 03e4a86..56a8fe6 100644
--- a/gdb/nat/linux-osdata.c
+++ b/gdb/nat/linux-osdata.c
@@ -78,7 +78,7 @@ linux_common_core_of_thread (ptid_t ptid)
for (;;)
{
int n;
- content = xrealloc (content, content_read + 1024);
+ content = (char *) xrealloc (content, content_read + 1024);
n = fread (content + content_read, 1, 1024, f);
content_read += n;
if (n < 1024)
diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
index 4222df5..97331a4 100644
--- a/gdb/nat/linux-ptrace.c
+++ b/gdb/nat/linux-ptrace.c
@@ -101,7 +101,8 @@ linux_ptrace_test_ret_to_nx (void)
long l;
int status, kill_status;
- return_address = mmap (NULL, 2, PROT_READ | PROT_WRITE,
+ return_address
+ = (gdb_byte *) mmap (NULL, 2, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (return_address == MAP_FAILED)
{
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index ba3c845..81ee7fb 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -118,11 +118,11 @@ nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname)
arch_len = (strlen (nto_root) + strlen (arch) + strlen (endian) + 2
+ strlen (solib));
- arch_path = alloca (arch_len);
+ arch_path = (char *) alloca (arch_len);
xsnprintf (arch_path, arch_len, "%s/%s%s", nto_root, arch, endian);
len = strlen (PATH_FMT) + strlen (arch_path) * 5 + 1;
- buf = alloca (len);
+ buf = (char *) alloca (len);
xsnprintf (buf, len, PATH_FMT, arch_path, arch_path, arch_path, arch_path,
arch_path);
@@ -194,7 +194,7 @@ nto_parse_redirection (char *pargv[], const char **pin, const char **pout,
out = "";
err = "";
- argv = xcalloc (n + 1, sizeof argv[0]);
+ argv = XCNEWVEC (char *, n + 1);
argc = n;
for (i = 0, n = 0; n < argc; n++)
{
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 44dfed7..227ecc0 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -226,7 +226,7 @@ objc_demangle (const char *mangled, int options)
(mangled[1] == 'i' || mangled[1] == 'c') &&
mangled[2] == '_')
{
- cp = demangled = xmalloc(strlen(mangled) + 2);
+ cp = demangled = (char *) xmalloc (strlen (mangled) + 2);
if (mangled[1] == 'i')
*cp++ = '-'; /* for instance method */
@@ -1006,7 +1006,7 @@ find_methods (char type, const char *theclass, const char *category,
while ((strlen (symname) + 1) >= tmplen)
{
tmplen = (tmplen == 0) ? 1024 : tmplen * 2;
- tmp = xrealloc (tmp, tmplen);
+ tmp = (char *) xrealloc (tmp, tmplen);
}
strcpy (tmp, symname);
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index f6be91e..fc692d1 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -136,7 +136,9 @@ get_objfile_bfd_data (struct objfile *objfile, struct bfd *abfd)
enough that this seems reasonable. */
if (abfd != NULL && !gdb_bfd_requires_relocations (abfd))
{
- storage = bfd_zalloc (abfd, sizeof (struct objfile_per_bfd_storage));
+ storage
+ = ((struct objfile_per_bfd_storage *)
+ bfd_zalloc (abfd, sizeof (struct objfile_per_bfd_storage)));
set_bfd_data (abfd, objfiles_bfd_data, storage);
}
else
@@ -195,7 +197,8 @@ set_objfile_main_name (struct objfile *objfile,
if (objfile->per_bfd->name_of_main == NULL
|| strcmp (objfile->per_bfd->name_of_main, name) != 0)
objfile->per_bfd->name_of_main
- = obstack_copy0 (&objfile->per_bfd->storage_obstack, name, strlen (name));
+ = (const char *) obstack_copy0 (&objfile->per_bfd->storage_obstack, name,
+ strlen (name));
objfile->per_bfd->language_of_main = lang;
}
@@ -392,9 +395,10 @@ allocate_objfile (bfd *abfd, const char *name, int flags)
expanded_name = xstrdup (name);
else
expanded_name = gdb_abspath (name);
- objfile->original_name = obstack_copy0 (&objfile->objfile_obstack,
- expanded_name,
- strlen (expanded_name));
+ objfile->original_name
+ = (char *) obstack_copy0 (&objfile->objfile_obstack,
+ expanded_name,
+ strlen (expanded_name));
xfree (expanded_name);
/* Update the per-objfile information that comes from the bfd, ensuring
@@ -951,7 +955,8 @@ objfile_relocate (struct objfile *objfile,
gdb_assert (debug_objfile->num_sections
== gdb_bfd_count_sections (debug_objfile->obfd));
new_debug_offsets =
- xmalloc (SIZEOF_N_SECTION_OFFSETS (debug_objfile->num_sections));
+ ((struct section_offsets *)
+ xmalloc (SIZEOF_N_SECTION_OFFSETS (debug_objfile->num_sections)));
make_cleanup (xfree, new_debug_offsets);
relative_addr_info_to_section_offsets (new_debug_offsets,
debug_objfile->num_sections,
@@ -1399,7 +1404,7 @@ update_section_map (struct program_space *pspace,
if (map_size < alloc_size)
/* Some sections were eliminated. Trim excess space. */
- map = xrealloc (map, map_size * sizeof (*map));
+ map = XRESIZEVEC (struct obj_section *, map, map_size);
else
gdb_assert (alloc_size == map_size);
diff --git a/gdb/osabi.c b/gdb/osabi.c
index 6a269a8..eb5a750 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -458,7 +458,7 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
compressed section. But, since note sections are not compressed,
deferring the reading until we recognize the section avoids any
error. */
- note = alloca (sectsize);
+ note = (char *) alloca (sectsize);
/* .note.ABI-tag notes, used by GNU/Linux and FreeBSD. */
if (strcmp (name, ".note.ABI-tag") == 0)
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index c255a57..b4f0834 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -364,7 +364,7 @@ exp : exp '['
struct stoken stringsval;
char *buf;
- buf = alloca (strlen (arrayname) + 1);
+ buf = (char *) alloca (strlen (arrayname) + 1);
stringsval.ptr = buf;
stringsval.length = strlen (arrayname);
strcpy (buf, arrayname);
@@ -1530,7 +1530,7 @@ yylex (void)
so in expression to enter hexadecimal values
we still need to use C syntax with 0xff */
write_dollar_variable (pstate, yylval.sval);
- tmp = alloca (namelen + 1);
+ tmp = (char *) alloca (namelen + 1);
memcpy (tmp, tokstart, namelen);
tmp[namelen] = '\0';
intvar = lookup_only_internalvar (tmp + 1);
@@ -1676,7 +1676,9 @@ yylex (void)
struct symbol *cur_sym;
/* As big as the whole rest of the expression, which is
at least big enough. */
- char *ncopy = alloca (strlen (tmp)+strlen (namestart)+3);
+ char *ncopy
+ = (char *) alloca (strlen (tmp) + strlen (namestart)
+ + 3);
char *tmp1;
tmp1 = ncopy;
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 0ceddd1..4e1c812 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -768,7 +768,7 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
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);
base_valaddr = buf;
diff --git a/gdb/parse.c b/gdb/parse.c
index acd48a5..fcd51f9 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -189,8 +189,9 @@ initialize_expout (struct parser_state *ps, size_t initial_size,
{
ps->expout_size = initial_size;
ps->expout_ptr = 0;
- ps->expout = xmalloc (sizeof (struct expression)
- + EXP_ELEM_TO_BYTES (ps->expout_size));
+ ps->expout
+ = (struct expression *) xmalloc (sizeof (struct expression)
+ + EXP_ELEM_TO_BYTES (ps->expout_size));
ps->expout->language_defn = lang;
ps->expout->gdbarch = gdbarch;
}
@@ -585,7 +586,7 @@ mark_completion_tag (enum type_code tag, const char *ptr, int length)
|| tag == TYPE_CODE_STRUCT
|| tag == TYPE_CODE_ENUM);
expout_tag_completion_type = tag;
- expout_completion_name = xmalloc (length + 1);
+ expout_completion_name = (char *) xmalloc (length + 1);
memcpy (expout_completion_name, ptr, length);
expout_completion_name[length] = '\0';
}
@@ -795,7 +796,7 @@ copy_name (struct stoken token)
if (namecopy_size < token.length + 1)
{
namecopy_size = token.length + 1;
- namecopy = xrealloc (namecopy, token.length + 1);
+ namecopy = (char *) xrealloc (namecopy, token.length + 1);
}
memcpy (namecopy, token.ptr, token.length);
@@ -1373,7 +1374,7 @@ parse_float (const char *p, int len, DOUBLEST *d, const char **suffix)
char *copy;
int n, num;
- copy = xmalloc (len + 1);
+ copy = (char *) xmalloc (len + 1);
memcpy (copy, p, len);
copy[len] = 0;
@@ -1439,8 +1440,8 @@ type_stack_reserve (struct type_stack *stack, int howmuch)
stack->size *= 2;
if (stack->size < howmuch)
stack->size = howmuch;
- stack->elements = xrealloc (stack->elements,
- stack->size * sizeof (union type_stack_elt));
+ stack->elements = XRESIZEVEC (union type_stack_elt, stack->elements,
+ stack->size);
}
}
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 56d9994..610e44f 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1079,7 +1079,7 @@ ppc_stap_parse_special_token (struct gdbarch *gdbarch,
}
len = s - p->arg;
- regname = alloca (len + 2);
+ regname = (char *) alloca (len + 2);
regname[0] = 'r';
strncpy (regname + 1, p->arg, len);
@@ -1277,7 +1277,7 @@ ppu2spu_prev_register (struct frame_info *this_frame,
struct gdbarch *gdbarch = get_regcache_arch (cache->regcache);
gdb_byte *buf;
- buf = alloca (register_size (gdbarch, regnum));
+ buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
if (regnum < gdbarch_num_regs (gdbarch))
regcache_raw_read (cache->regcache, regnum, buf);
diff --git a/gdb/ppc-ravenscar-thread.c b/gdb/ppc-ravenscar-thread.c
index 7a1b8a5..e27d125 100644
--- a/gdb/ppc-ravenscar-thread.c
+++ b/gdb/ppc-ravenscar-thread.c
@@ -123,7 +123,7 @@ supply_register_at_address (struct regcache *regcache, int regnum,
int buf_size = register_size (gdbarch, regnum);
gdb_byte *buf;
- buf = alloca (buf_size);
+ buf = (gdb_byte *) alloca (buf_size);
read_memory (register_addr, buf, buf_size);
regcache_raw_supply (regcache, regnum, buf);
}
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 823f27b..5dddf4e 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -2064,7 +2064,7 @@ printf_wide_c_string (struct ui_file *stream, const char *format,
struct type *wctype = lookup_typename (current_language, gdbarch,
"wchar_t", NULL, 0);
int wcwidth = TYPE_LENGTH (wctype);
- gdb_byte *buf = alloca (wcwidth);
+ gdb_byte *buf = (gdb_byte *) alloca (wcwidth);
struct obstack output;
struct cleanup *inner_cleanup;
@@ -2203,7 +2203,7 @@ printf_pointer (struct ui_file *stream, const char *format,
long val = value_as_long (value);
#endif
- fmt = alloca (strlen (format) + 5);
+ fmt = (char *) alloca (strlen (format) + 5);
/* Copy up to the leading %. */
p = format;
diff --git a/gdb/probe.c b/gdb/probe.c
index a3cfefe..5e95178 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -146,9 +146,8 @@ parse_probes (const struct event_location *location,
continue;
++result.nelts;
- result.sals = xrealloc (result.sals,
- result.nelts
- * sizeof (struct symtab_and_line));
+ result.sals = XRESIZEVEC (struct symtab_and_line, result.sals,
+ result.nelts);
sal = &result.sals[result.nelts - 1];
init_sal (sal);
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index b11fc32..303aecb 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -452,7 +452,7 @@ gdbpy_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';
@@ -465,7 +465,7 @@ gdbpy_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';
@@ -574,7 +574,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
int i, out;
/* Make a normalized form of the command name. */
- pfx_name = xmalloc (strlen (name) + 2);
+ pfx_name = (char *) xmalloc (strlen (name) + 2);
i = 0;
out = 0;
diff --git a/gdb/python/py-gdb-readline.c b/gdb/python/py-gdb-readline.c
index 0cf4dfd..df14e28 100644
--- a/gdb/python/py-gdb-readline.c
+++ b/gdb/python/py-gdb-readline.c
@@ -63,7 +63,7 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
/* Detect EOF (Ctrl-D). */
if (p == NULL)
{
- q = PyMem_Malloc (1);
+ q = (char *) PyMem_Malloc (1);
if (q != NULL)
q[0] = '\0';
return q;
@@ -72,7 +72,7 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
n = strlen (p);
/* Copy the line to Python and return. */
- q = PyMem_Malloc (n + 2);
+ q = (char *) PyMem_Malloc (n + 2);
if (q != NULL)
{
strncpy (q, p, n);
diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c
index 7c428a4..f0ae036 100644
--- a/gdb/python/py-symtab.c
+++ b/gdb/python/py-symtab.c
@@ -370,8 +370,9 @@ set_sal (sal_object *sal_obj, struct symtab_and_line sal)
Py_INCREF (Py_None);
}
- sal_obj->sal = xmemdup (&sal, sizeof (struct symtab_and_line),
- sizeof (struct symtab_and_line));
+ sal_obj->sal = ((struct symtab_and_line *)
+ xmemdup (&sal, sizeof (struct symtab_and_line),
+ sizeof (struct symtab_and_line)));
sal_obj->symtab = symtab_obj;
sal_obj->prev = NULL;
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index 18f8f4d..523cb76 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -572,8 +572,10 @@ pyuw_sniffer (const struct frame_unwind *self, struct frame_info *this_frame,
saved_reg *reg;
int i;
- cached_frame = xmalloc (sizeof (*cached_frame) +
- reg_count * sizeof (cached_frame->reg[0]));
+ cached_frame
+ = ((cached_frame_info *)
+ xmalloc (sizeof (*cached_frame)
+ + reg_count * sizeof (cached_frame->reg[0])));
cached_frame->gdbarch = gdbarch;
cached_frame->frame_id = unwind_info->frame_id;
cached_frame->reg_count = reg_count;
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 3a33c75..2031c0c 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -341,7 +341,7 @@ python_interactive_command (char *arg, int from_tty)
if (arg && *arg)
{
int len = strlen (arg);
- char *script = xmalloc (len + 2);
+ char *script = (char *) xmalloc (len + 2);
strcpy (script, arg);
script[len] = '\n';
@@ -428,7 +428,7 @@ compute_python_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)
{
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index fe36c96..4adf9e3 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -167,7 +167,7 @@ get_running_thread_id (void)
object_addr = BMSYMBOL_VALUE_ADDRESS (object_msym);
object_size = TYPE_LENGTH (builtin_type_void_data_ptr);
buf_size = object_size;
- buf = alloca (buf_size);
+ buf = (gdb_byte *) alloca (buf_size);
read_memory (object_addr, buf, buf_size);
return extract_typed_address (buf, builtin_type_void_data_ptr);
}
diff --git a/gdb/record-full.c b/gdb/record-full.c
index cb05437..e2a36cf 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -725,7 +725,7 @@ record_full_exec_insn (struct regcache *regcache,
/* Nothing to do if the entry is flagged not_accessible. */
if (!entry->u.mem.mem_entry_not_accessible)
{
- gdb_byte *mem = alloca (entry->u.mem.len);
+ gdb_byte *mem = (gdb_byte *) alloca (entry->u.mem.len);
if (record_debug > 1)
fprintf_unfiltered (gdb_stdlog,
@@ -800,7 +800,7 @@ record_full_core_open_1 (const char *name, int from_tty)
/* Get record_full_core_regbuf. */
target_fetch_registers (regcache, -1);
- record_full_core_regbuf = xmalloc (MAX_REGISTER_SIZE * regnum);
+ record_full_core_regbuf = (gdb_byte *) xmalloc (MAX_REGISTER_SIZE * regnum);
for (i = 0; i < regnum; i ++)
regcache_raw_collect (regcache, i,
record_full_core_regbuf + MAX_REGISTER_SIZE * i);
diff --git a/gdb/regcache.c b/gdb/regcache.c
index f1e03d3..c78c142 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -675,7 +675,7 @@ regcache_raw_read_signed (struct regcache *regcache, int regnum, LONGEST *val)
gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
- buf = alloca (regcache->descr->sizeof_register[regnum]);
+ buf = (gdb_byte *) alloca (regcache->descr->sizeof_register[regnum]);
status = regcache_raw_read (regcache, regnum, buf);
if (status == REG_VALID)
*val = extract_signed_integer
@@ -695,7 +695,7 @@ regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
- buf = alloca (regcache->descr->sizeof_register[regnum]);
+ buf = (gdb_byte *) alloca (regcache->descr->sizeof_register[regnum]);
status = regcache_raw_read (regcache, regnum, buf);
if (status == REG_VALID)
*val = extract_unsigned_integer
@@ -822,7 +822,7 @@ regcache_cooked_read_signed (struct regcache *regcache, int regnum,
gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
- buf = alloca (regcache->descr->sizeof_register[regnum]);
+ buf = (gdb_byte *) alloca (regcache->descr->sizeof_register[regnum]);
status = regcache_cooked_read (regcache, regnum, buf);
if (status == REG_VALID)
*val = extract_signed_integer
@@ -842,7 +842,7 @@ regcache_cooked_read_unsigned (struct regcache *regcache, int regnum,
gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
- buf = alloca (regcache->descr->sizeof_register[regnum]);
+ buf = (gdb_byte *) alloca (regcache->descr->sizeof_register[regnum]);
status = regcache_cooked_read (regcache, regnum, buf);
if (status == REG_VALID)
*val = extract_unsigned_integer
diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index a6bb34d..d84b3ff 100644
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -450,7 +450,7 @@ remote_fileio_func_open (char *buf)
mode = remote_fileio_mode_to_host (num, 1);
/* Request pathname. */
- pathname = alloca (length);
+ pathname = (char *) alloca (length);
if (target_read_memory (ptrval, (gdb_byte *) pathname, length) != 0)
{
remote_fileio_ioerror ();
@@ -794,7 +794,7 @@ remote_fileio_func_rename (char *buf)
}
/* Request oldpath using 'm' packet */
- oldpath = alloca (old_len);
+ oldpath = (char *) alloca (old_len);
if (target_read_memory (old_ptr, (gdb_byte *) oldpath, old_len) != 0)
{
remote_fileio_ioerror ();
@@ -802,7 +802,7 @@ remote_fileio_func_rename (char *buf)
}
/* Request newpath using 'm' packet */
- newpath = alloca (new_len);
+ newpath = (char *) alloca (new_len);
if (target_read_memory (new_ptr, (gdb_byte *) newpath, new_len) != 0)
{
remote_fileio_ioerror ();
@@ -880,7 +880,7 @@ remote_fileio_func_unlink (char *buf)
return;
}
/* Request pathname using 'm' packet */
- pathname = alloca (length);
+ pathname = (char *) alloca (length);
if (target_read_memory (ptrval, (gdb_byte *) pathname, length) != 0)
{
remote_fileio_ioerror ();
@@ -930,7 +930,7 @@ remote_fileio_func_stat (char *buf)
statptr = (CORE_ADDR) lnum;
/* Request pathname using 'm' packet */
- pathname = alloca (namelength);
+ pathname = (char *) alloca (namelength);
if (target_read_memory (nameptr, (gdb_byte *) pathname, namelength) != 0)
{
remote_fileio_ioerror ();
@@ -1131,7 +1131,7 @@ remote_fileio_func_system (char *buf)
if (length)
{
/* Request commandline using 'm' packet */
- cmdline = alloca (length);
+ cmdline = (char *) alloca (length);
if (target_read_memory (ptrval, (gdb_byte *) cmdline, length) != 0)
{
remote_fileio_ioerror ();
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 0846d84..e519b22 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -2160,7 +2160,7 @@ mips_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
/* Round ending address up; get number of longwords that makes. */
count = (((memaddr + len) - addr) + 3) / 4;
/* Allocate buffer of that many longwords. */
- buffer = alloca (count * 4);
+ buffer = (gdb_byte *) alloca (count * 4);
if (writebuf != NULL)
{
@@ -2814,7 +2814,7 @@ mips_load_srec (const char *args)
struct cleanup *cleanup;
static int hashmark = 1;
- buffer = alloca (srec_frame * 2 + 256);
+ buffer = (bfd_byte *) alloca (srec_frame * 2 + 256);
abfd = gdb_bfd_open (args, NULL, -1);
if (!abfd)
@@ -3322,7 +3322,8 @@ pmon_end_download (int final, int bintotal)
mips_send_command ("initEther\r", -1);
/* Send the load command. */
- cmd = xmalloc (strlen (load_cmd_prefix) + strlen (tftp_name) + 2);
+ cmd = (char *) xmalloc (strlen (load_cmd_prefix)
+ + strlen (tftp_name) + 2);
strcpy (cmd, load_cmd_prefix);
strcat (cmd, tftp_name);
strcat (cmd, "\r");
diff --git a/gdb/remote.c b/gdb/remote.c
index b9dc4af..11be6bb 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -470,7 +470,7 @@ new_remote_state (void)
/* The default buffer size is unimportant; it will be expanded
whenever a larger buffer is needed. */
result->buf_size = 400;
- result->buf = xmalloc (result->buf_size);
+ result->buf = (char *) xmalloc (result->buf_size);
result->remote_traceframe_number = -1;
result->last_sent_signal = GDB_SIGNAL_0;
result->fs_pid = -1;
@@ -728,8 +728,7 @@ map_regcache_remote_table (struct gdbarch *gdbarch, struct packet_reg *regs)
with a remote protocol number, in order of ascending protocol
number. */
- remote_regs = alloca (gdbarch_num_regs (gdbarch)
- * sizeof (struct packet_reg *));
+ remote_regs = XALLOCAVEC (struct packet_reg *, gdbarch_num_regs (gdbarch));
for (num_remote_regs = 0, regnum = 0;
regnum < gdbarch_num_regs (gdbarch);
regnum++)
@@ -765,7 +764,7 @@ remote_register_number_and_offset (struct gdbarch *gdbarch, int regnum,
gdb_assert (regnum < gdbarch_num_regs (gdbarch));
- regs = xcalloc (gdbarch_num_regs (gdbarch), sizeof (struct packet_reg));
+ regs = XCNEWVEC (struct packet_reg, gdbarch_num_regs (gdbarch));
old_chain = make_cleanup (xfree, regs);
sizeof_g_packet = map_regcache_remote_table (gdbarch, regs);
@@ -822,7 +821,7 @@ init_remote_state (struct gdbarch *gdbarch)
if (rs->buf_size < rsa->remote_packet_size)
{
rs->buf_size = 2 * rsa->remote_packet_size;
- rs->buf = xrealloc (rs->buf, rs->buf_size);
+ rs->buf = (char *) xrealloc (rs->buf, rs->buf_size);
}
return rsa;
@@ -1039,7 +1038,7 @@ get_memory_packet_size (struct memory_packet_config *config)
if (rs->buf_size < what_they_get + 1)
{
rs->buf_size = 2 * what_they_get;
- rs->buf = xrealloc (rs->buf, 2 * what_they_get);
+ rs->buf = (char *) xrealloc (rs->buf, 2 * what_they_get);
}
return what_they_get;
@@ -1938,7 +1937,7 @@ remote_pass_signals (struct target_ops *self,
if (pass_signals[i])
count++;
}
- pass_packet = xmalloc (count * 3 + strlen ("QPassSignals:") + 1);
+ pass_packet = (char *) xmalloc (count * 3 + strlen ("QPassSignals:") + 1);
strcpy (pass_packet, "QPassSignals:");
p = pass_packet + strlen (pass_packet);
for (i = 0; i < numsigs; i++)
@@ -1989,7 +1988,7 @@ remote_program_signals (struct target_ops *self,
if (signals[i])
count++;
}
- packet = xmalloc (count * 3 + strlen ("QProgramSignals:") + 1);
+ packet = (char *) xmalloc (count * 3 + strlen ("QProgramSignals:") + 1);
strcpy (packet, "QProgramSignals:");
p = packet + strlen (packet);
for (i = 0; i < numsigs; i++)
@@ -3882,7 +3881,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
else
{
/* Save the reply for later. */
- wait_status = alloca (strlen (rs->buf) + 1);
+ wait_status = (char *) alloca (strlen (rs->buf) + 1);
strcpy (wait_status, rs->buf);
}
@@ -4126,7 +4125,7 @@ remote_check_symbols (void)
/* Allocate a message buffer. We can't reuse the input buffer in RS,
because we need both at the same time. */
- msg = xmalloc (get_remote_packet_size ());
+ msg = (char *) xmalloc (get_remote_packet_size ());
old_chain = make_cleanup (xfree, msg);
/* Invite target to request symbol lookups. */
@@ -4580,7 +4579,7 @@ remote_query_supported (void)
if (rs->buf_size < rs->explicit_packet_size)
{
rs->buf_size = rs->explicit_packet_size;
- rs->buf = xrealloc (rs->buf, rs->buf_size);
+ rs->buf = (char *) xrealloc (rs->buf, rs->buf_size);
}
/* Handle the defaults for unmentioned features. */
@@ -4969,7 +4968,7 @@ extended_remote_attach (struct target_ops *target, const char *args,
if (!non_stop)
{
/* Save the reply for later. */
- wait_status = alloca (strlen (rs->buf) + 1);
+ wait_status = (char *) alloca (strlen (rs->buf) + 1);
strcpy (wait_status, rs->buf);
}
else if (strcmp (rs->buf, "OK") != 0)
@@ -6877,7 +6876,7 @@ process_g_packet (struct regcache *regcache)
}
}
- regs = alloca (rsa->sizeof_g_packet);
+ regs = (char *) alloca (rsa->sizeof_g_packet);
/* Unimplemented registers read as all bits zero. */
memset (regs, 0, rsa->sizeof_g_packet);
@@ -7085,7 +7084,7 @@ store_registers_using_G (const struct regcache *regcache)
{
int i;
- regs = alloca (rsa->sizeof_g_packet);
+ regs = (gdb_byte *) alloca (rsa->sizeof_g_packet);
memset (regs, 0, rsa->sizeof_g_packet);
for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
{
@@ -7939,7 +7938,7 @@ putpkt_binary (const char *buf, int cnt)
struct remote_state *rs = get_remote_state ();
int i;
unsigned char csum = 0;
- char *buf2 = xmalloc (cnt + 6);
+ char *buf2 = (char *) xmalloc (cnt + 6);
struct cleanup *old_chain = make_cleanup (xfree, buf2);
int ch;
@@ -8280,7 +8279,7 @@ read_frame (char **buf_p,
{
/* Make some more room in the buffer. */
*sizeof_buf += repeat;
- *buf_p = xrealloc (*buf_p, *sizeof_buf);
+ *buf_p = (char *) xrealloc (*buf_p, *sizeof_buf);
buf = *buf_p;
}
@@ -8298,7 +8297,7 @@ read_frame (char **buf_p,
{
/* Make some more room in the buffer. */
*sizeof_buf *= 2;
- *buf_p = xrealloc (*buf_p, *sizeof_buf);
+ *buf_p = (char *) xrealloc (*buf_p, *sizeof_buf);
buf = *buf_p;
}
@@ -9463,7 +9462,7 @@ compare_sections_command (char *args, int from_tty)
matched = 1; /* Do this section. */
lma = s->lma;
- sectdata = xmalloc (size);
+ sectdata = (gdb_byte *) xmalloc (size);
old_chain = make_cleanup (xfree, sectdata);
bfd_get_section_contents (exec_bfd, s, sectdata, 0, size);
@@ -10849,7 +10848,7 @@ remote_hostio_pread (struct target_ops *self,
cache->fd = fd;
cache->offset = offset;
cache->bufsize = get_remote_packet_size ();
- cache->buf = xrealloc (cache->buf, cache->bufsize);
+ cache->buf = (gdb_byte *) xrealloc (cache->buf, cache->bufsize);
ret = remote_hostio_pread_vFile (self, cache->fd, cache->buf, cache->bufsize,
cache->offset, remote_errno);
@@ -10935,7 +10934,7 @@ remote_hostio_readlink (struct target_ops *self,
if (len < 0)
return NULL;
- ret = xmalloc (len + 1);
+ ret = (char *) xmalloc (len + 1);
read_len = remote_unescape_input ((gdb_byte *) attachment, attachment_len,
(gdb_byte *) ret, len);
@@ -11158,7 +11157,7 @@ remote_file_put (const char *local_file, const char *remote_file, int from_tty)
/* Send up to this many bytes at once. They won't all fit in the
remote packet limit, so we'll transfer slightly fewer. */
io_size = get_remote_packet_size ();
- buffer = xmalloc (io_size);
+ buffer = (gdb_byte *) xmalloc (io_size);
make_cleanup (xfree, buffer);
close_cleanup = make_cleanup (remote_hostio_close_cleanup, &fd);
@@ -11248,7 +11247,7 @@ remote_file_get (const char *remote_file, const char *local_file, int from_tty)
/* Send up to this many bytes at once. They won't all fit in the
remote packet limit, so we'll transfer slightly fewer. */
io_size = get_remote_packet_size ();
- buffer = xmalloc (io_size);
+ buffer = (gdb_byte *) xmalloc (io_size);
make_cleanup (xfree, buffer);
close_cleanup = make_cleanup (remote_hostio_close_cleanup, &fd);
@@ -12656,7 +12655,7 @@ remote_pid_to_exec_file (struct target_ops *self, int pid)
{
const int annex_size = 9;
- annex = alloca (annex_size);
+ annex = (char *) alloca (annex_size);
xsnprintf (annex, annex_size, "%x", pid);
}
@@ -13575,6 +13574,6 @@ stepping is supported by the target. The default is on."),
any_thread_ptid = ptid_build (42000, 0, 1);
target_buf_size = 2048;
- target_buf = xmalloc (target_buf_size);
+ target_buf = (char *) xmalloc (target_buf_size);
}
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index ca262e9..2e57b84 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -983,7 +983,7 @@ rs6000_aix_ld_info_to_xml (struct gdbarch *gdbarch, const gdb_byte *ldi_buf,
obstack_grow_str0 (&obstack, "</library-list-aix>\n");
- buf = obstack_finish (&obstack);
+ buf = (const char *) obstack_finish (&obstack);
len_avail = strlen (buf);
if (offset >= len_avail)
len= 0;
@@ -1018,7 +1018,7 @@ rs6000_aix_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
bfd_errmsg (bfd_get_error ()));
ldinfo_size = bfd_get_section_size (ldinfo_sec);
- ldinfo_buf = xmalloc (ldinfo_size);
+ ldinfo_buf = (gdb_byte *) xmalloc (ldinfo_size);
cleanup = make_cleanup (xfree, ldinfo_buf);
if (! bfd_get_section_contents (core_bfd, ldinfo_sec,
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 785f451..14f121a 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -992,7 +992,7 @@ ppc_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);
struct cleanup *old_chain = make_cleanup (xfree, buf);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int insn;
@@ -3613,7 +3613,7 @@ bfd_uses_spe_extensions (bfd *abfd)
return 0;
size = bfd_get_section_size (sect);
- contents = xmalloc (size);
+ contents = (gdb_byte *) xmalloc (size);
if (!bfd_get_section_contents (abfd, sect, contents, 0, size))
{
xfree (contents);
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 1e20c92..8d277ac 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -1600,7 +1600,7 @@ s390_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);
struct cleanup *old_chain = make_cleanup (xfree, buf);
read_memory (from, buf, len);
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index ef9336e..09df712 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -825,7 +825,7 @@ score7_malloc_and_get_memblock (CORE_ADDR addr, CORE_ADDR size)
else if (size == 0)
return NULL;
- memblock = xmalloc (size);
+ memblock = (gdb_byte *) xmalloc (size);
memset (memblock, 0, size);
ret = target_read_memory (addr & ~0x3, memblock, size);
if (ret)
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 7261e73..102b41a 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -251,7 +251,7 @@ decode_loadmap (gdb_byte *buf)
external loadsegs. I.e, allocate the internal loadsegs. */
int_ldmbuf_size = (sizeof (struct int_elf32_dsbt_loadmap)
+ (nsegs - 1) * sizeof (struct int_elf32_dsbt_loadseg));
- int_ldmbuf = xmalloc (int_ldmbuf_size);
+ int_ldmbuf = (struct int_elf32_dsbt_loadmap *) xmalloc (int_ldmbuf_size);
/* Place extracted information in internal structs. */
int_ldmbuf->version = version;
@@ -355,7 +355,7 @@ fetch_loadmap (CORE_ADDR ldmaddr)
/* Allocate space for the complete (external) loadmap. */
ext_ldmbuf_size = sizeof (struct ext_elf32_dsbt_loadmap)
+ (nsegs - 1) * sizeof (struct ext_elf32_dsbt_loadseg);
- ext_ldmbuf = xmalloc (ext_ldmbuf_size);
+ ext_ldmbuf = (struct ext_elf32_dsbt_loadmap *) xmalloc (ext_ldmbuf_size);
/* Copy over the portion of the loadmap that's already been read. */
memcpy (ext_ldmbuf, &ext_ldmbuf_partial, sizeof ext_ldmbuf_partial);
@@ -374,7 +374,7 @@ fetch_loadmap (CORE_ADDR ldmaddr)
external loadsegs. I.e, allocate the internal loadsegs. */
int_ldmbuf_size = sizeof (struct int_elf32_dsbt_loadmap)
+ (nsegs - 1) * sizeof (struct int_elf32_dsbt_loadseg);
- int_ldmbuf = xmalloc (int_ldmbuf_size);
+ int_ldmbuf = (struct int_elf32_dsbt_loadmap *) xmalloc (int_ldmbuf_size);
/* Place extracted information in internal structs. */
int_ldmbuf->version = version;
@@ -452,7 +452,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
/* Read in .dynamic from the BFD. We will get the actual value
from memory later. */
sect_size = bfd_section_size (abfd, sect);
- buf = bufstart = alloca (sect_size);
+ buf = bufstart = (gdb_byte *) alloca (sect_size);
if (!bfd_get_section_contents (abfd, sect,
buf, 0, sect_size))
return 0;
@@ -825,7 +825,7 @@ enable_break (void)
/* Read the contents of the .interp section into a local buffer;
the contents specify the dynamic linker this program uses. */
interp_sect_size = bfd_section_size (exec_bfd, interp_sect);
- buf = alloca (interp_sect_size);
+ buf = (char *) alloca (interp_sect_size);
bfd_get_section_contents (exec_bfd, interp_sect,
buf, 0, interp_sect_size);
@@ -944,8 +944,8 @@ dsbt_relocate_main_executable (void)
info->main_executable_lm_info = XCNEW (struct lm_info);
info->main_executable_lm_info->map = ldm;
- new_offsets = xcalloc (symfile_objfile->num_sections,
- sizeof (struct section_offsets));
+ new_offsets = XCNEWVEC (struct section_offsets,
+ symfile_objfile->num_sections);
old_chain = make_cleanup (xfree, new_offsets);
changed = 0;
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index 179974f..922ee36 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -132,7 +132,7 @@ fetch_loadmap (CORE_ADDR ldmaddr)
/* Allocate space for the complete (external) loadmap. */
ext_ldmbuf_size = sizeof (struct ext_elf32_fdpic_loadmap)
+ (nsegs - 1) * sizeof (struct ext_elf32_fdpic_loadseg);
- ext_ldmbuf = xmalloc (ext_ldmbuf_size);
+ ext_ldmbuf = (struct ext_elf32_fdpic_loadmap *) xmalloc (ext_ldmbuf_size);
/* Copy over the portion of the loadmap that's already been read. */
memcpy (ext_ldmbuf, &ext_ldmbuf_partial, sizeof ext_ldmbuf_partial);
@@ -151,7 +151,7 @@ fetch_loadmap (CORE_ADDR ldmaddr)
external loadsegs. I.e, allocate the internal loadsegs. */
int_ldmbuf_size = sizeof (struct int_elf32_fdpic_loadmap)
+ (nsegs - 1) * sizeof (struct int_elf32_fdpic_loadseg);
- int_ldmbuf = xmalloc (int_ldmbuf_size);
+ int_ldmbuf = (struct int_elf32_fdpic_loadmap *) xmalloc (int_ldmbuf_size);
/* Place extracted information in internal structs. */
int_ldmbuf->version = version;
@@ -543,7 +543,7 @@ enable_break2 (void)
/* Read the contents of the .interp section into a local buffer;
the contents specify the dynamic linker this program uses. */
interp_sect_size = bfd_section_size (exec_bfd, interp_sect);
- buf = alloca (interp_sect_size);
+ buf = (char *) alloca (interp_sect_size);
bfd_get_section_contents (exec_bfd, interp_sect,
buf, 0, interp_sect_size);
@@ -802,8 +802,8 @@ frv_relocate_main_executable (void)
main_executable_lm_info = XCNEW (struct lm_info);
main_executable_lm_info->map = ldm;
- new_offsets = xcalloc (symfile_objfile->num_sections,
- sizeof (struct section_offsets));
+ new_offsets = XCNEWVEC (struct section_offsets,
+ symfile_objfile->num_sections);
old_chain = make_cleanup (xfree, new_offsets);
changed = 0;
diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
index a629ec9..12ff49e 100644
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -56,8 +56,8 @@ spu_relocate_main_executable (int spufs_fd)
if (symfile_objfile == NULL)
return;
- new_offsets = alloca (symfile_objfile->num_sections
- * sizeof (struct section_offsets));
+ new_offsets = XALLOCAVEC (struct section_offsets,
+ symfile_objfile->num_sections);
for (i = 0; i < symfile_objfile->num_sections; i++)
new_offsets->offsets[i] = SPUADDR (spufs_fd, 0);
@@ -373,7 +373,8 @@ spu_bfd_open (char *pathname)
if (sect_size > 20)
{
- char *buf = alloca (sect_size - 20 + strlen (original_name) + 1);
+ char *buf
+ = (char *) alloca (sect_size - 20 + strlen (original_name) + 1);
bfd_get_section_contents (abfd, spu_name, buf, 20, sect_size - 20);
buf[sect_size - 20] = '\0';
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 5d3d41e..04d797b 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -197,7 +197,7 @@ lm_info_read (CORE_ADDR lm_addr)
struct lm_info *lm_info;
struct cleanup *back_to;
- lm = xmalloc (lmo->link_map_size);
+ lm = (gdb_byte *) xmalloc (lmo->link_map_size);
back_to = make_cleanup (xfree, lm);
if (target_read_memory (lm_addr, lm, lmo->link_map_size) != 0)
@@ -567,7 +567,7 @@ read_program_header (int type, int *p_sect_size, int *p_arch_size,
}
/* Read in requested program header. */
- buf = xmalloc (sect_size);
+ buf = (gdb_byte *) xmalloc (sect_size);
if (target_read_memory (sect_addr, buf, sect_size))
{
xfree (buf);
@@ -602,7 +602,7 @@ find_program_interpreter (void)
{
int sect_size = bfd_section_size (exec_bfd, interp_sect);
- buf = xmalloc (sect_size);
+ buf = (gdb_byte *) xmalloc (sect_size);
bfd_get_section_contents (exec_bfd, interp_sect, buf, 0, sect_size);
}
}
@@ -666,7 +666,7 @@ scan_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr,
/* Read in .dynamic from the BFD. We will get the actual value
from memory later. */
sect_size = bfd_section_size (abfd, sect);
- buf = bufstart = alloca (sect_size);
+ buf = bufstart = (gdb_byte *) alloca (sect_size);
if (!bfd_get_section_contents (abfd, sect,
buf, 0, sect_size))
return 0;
@@ -811,7 +811,7 @@ elf_locate_base (void)
gdb_byte *pbuf;
int pbuf_size = TYPE_LENGTH (ptr_type);
- pbuf = alloca (pbuf_size);
+ pbuf = (gdb_byte *) alloca (pbuf_size);
/* DT_MIPS_RLD_MAP contains a pointer to the address
of the dynamic link structure. */
if (target_read_memory (dyn_ptr, pbuf, pbuf_size))
@@ -829,7 +829,7 @@ elf_locate_base (void)
gdb_byte *pbuf;
int pbuf_size = TYPE_LENGTH (ptr_type);
- pbuf = alloca (pbuf_size);
+ pbuf = (gdb_byte *) alloca (pbuf_size);
/* DT_MIPS_RLD_MAP_REL contains an offset from the address of the
DT slot to the address of the dynamic link structure. */
if (target_read_memory (dyn_ptr + dyn_ptr_addr, pbuf, pbuf_size))
@@ -1018,7 +1018,7 @@ open_symbol_file_object (void *from_ttyp)
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
int l_name_size = TYPE_LENGTH (ptr_type);
- gdb_byte *l_name_buf = xmalloc (l_name_size);
+ gdb_byte *l_name_buf = (gdb_byte *) xmalloc (l_name_size);
struct cleanup *cleanups = make_cleanup (xfree, l_name_buf);
struct svr4_info *info = get_svr4_info ();
@@ -2569,7 +2569,7 @@ read_program_headers_from_bfd (bfd *abfd, int *phdrs_size)
if (*phdrs_size == 0)
return NULL;
- buf = xmalloc (*phdrs_size);
+ buf = (gdb_byte *) xmalloc (*phdrs_size);
if (bfd_seek (abfd, ehdr->e_phoff, SEEK_SET) != 0
|| bfd_bread (buf, *phdrs_size, abfd) != *phdrs_size)
{
@@ -3033,8 +3033,8 @@ svr4_relocate_main_executable (void)
struct section_offsets *new_offsets;
int i;
- new_offsets = alloca (symfile_objfile->num_sections
- * sizeof (*new_offsets));
+ new_offsets = XALLOCAVEC (struct section_offsets,
+ symfile_objfile->num_sections);
for (i = 0; i < symfile_objfile->num_sections; i++)
new_offsets->offsets[i] = displacement;
diff --git a/gdb/solib-target.c b/gdb/solib-target.c
index f14363a..a41560e 100644
--- a/gdb/solib-target.c
+++ b/gdb/solib-target.c
@@ -345,7 +345,9 @@ solib_target_relocate_section_addresses (struct so_list *so,
{
int num_sections = gdb_bfd_count_sections (so->abfd);
- so->lm_info->offsets = xzalloc (SIZEOF_N_SECTION_OFFSETS (num_sections));
+ so->lm_info->offsets
+ = ((struct section_offsets *)
+ xzalloc (SIZEOF_N_SECTION_OFFSETS (num_sections)));
if (so->lm_info->section_bases)
{
diff --git a/gdb/solib.c b/gdb/solib.c
index c46116d..d6ab93d 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -192,7 +192,7 @@ solib_find_1 (char *in_pathname, int *fd, int is_solib)
char *p;
/* Avoid clobbering our input. */
- p = alloca (strlen (in_pathname) + 1);
+ p = (char *) alloca (strlen (in_pathname) + 1);
strcpy (p, in_pathname);
in_pathname = p;
@@ -396,7 +396,7 @@ exec_file_find (char *in_pathname, int *fd)
{
char *new_pathname;
- new_pathname = alloca (strlen (in_pathname) + 5);
+ new_pathname = (char *) alloca (strlen (in_pathname) + 5);
strcpy (new_pathname, in_pathname);
strcat (new_pathname, ".exe");
@@ -434,8 +434,9 @@ solib_find (char *in_pathname, int *fd)
{
char *new_pathname;
- new_pathname = alloca (p - in_pathname + 1
- + strlen (solib_symbols_extension) + 1);
+ new_pathname
+ = (char *) alloca (p - in_pathname + 1
+ + strlen (solib_symbols_extension) + 1);
memcpy (new_pathname, in_pathname, p - in_pathname + 1);
strcpy (new_pathname + (p - in_pathname) + 1,
solib_symbols_extension);
diff --git a/gdb/source.c b/gdb/source.c
index fab974c..3e5e15c 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -775,7 +775,7 @@ openp (const char *path, int opts, const char *string,
if (is_regular_file (string))
{
- filename = alloca (strlen (string) + 1);
+ filename = (char *) alloca (strlen (string) + 1);
strcpy (filename, string);
fd = gdb_open_cloexec (filename, mode, 0);
if (fd >= 0)
@@ -806,7 +806,7 @@ openp (const char *path, int opts, const char *string,
string += 2;
alloclen = strlen (path) + strlen (string) + 2;
- filename = alloca (alloclen);
+ filename = (char *) alloca (alloclen);
fd = -1;
dir_vec = dirnames_to_char_ptr_vec (path);
@@ -827,7 +827,7 @@ openp (const char *path, int opts, const char *string,
if (newlen > alloclen)
{
alloclen = newlen;
- filename = alloca (alloclen);
+ filename = (char *) alloca (alloclen);
}
strcpy (filename, current_directory);
}
@@ -845,7 +845,7 @@ openp (const char *path, int opts, const char *string,
if (newlen > alloclen)
{
alloclen = newlen;
- filename = alloca (alloclen);
+ filename = (char *) alloca (alloclen);
}
strcpy (filename, tilde_expanded);
xfree (tilde_expanded);
@@ -1366,7 +1366,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
{
const char *filename = symtab_to_filename_for_display (s);
int len = strlen (filename) + 100;
- char *name = alloca (len);
+ char *name = (char *) alloca (len);
xsnprintf (name, len, "%d\t%s", line, filename);
print_sys_errmsg (name, errno);
@@ -1393,7 +1393,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
/* ui_out_field_string may free S_FULLNAME by calling
open_source_file for it again. See e.g.,
tui_field_string->tui_show_source. */
- local_fullname = alloca (strlen (s_fullname) + 1);
+ local_fullname = (char *) alloca (strlen (s_fullname) + 1);
strcpy (local_fullname, s_fullname);
ui_out_field_string (uiout, "fullname", local_fullname);
@@ -1644,7 +1644,7 @@ forward_search_command (char *regex, int from_tty)
int cursize, newsize;
cursize = 256;
- buf = xmalloc (cursize);
+ buf = (char *) xmalloc (cursize);
p = buf;
c = fgetc (stream);
@@ -1656,7 +1656,7 @@ forward_search_command (char *regex, int from_tty)
if (p - buf == cursize)
{
newsize = cursize + cursize / 2;
- buf = xrealloc (buf, newsize);
+ buf = (char *) xrealloc (buf, newsize);
p = buf + cursize;
cursize = newsize;
}
diff --git a/gdb/sparc-ravenscar-thread.c b/gdb/sparc-ravenscar-thread.c
index 80c5e84..02f9f7c 100644
--- a/gdb/sparc-ravenscar-thread.c
+++ b/gdb/sparc-ravenscar-thread.c
@@ -66,7 +66,7 @@ supply_register_at_address (struct regcache *regcache, int regnum,
int buf_size = register_size (gdbarch, regnum);
gdb_byte *buf;
- buf = alloca (buf_size);
+ buf = (gdb_byte *) alloca (buf_size);
read_memory (register_addr, buf, buf_size);
regcache_raw_supply (regcache, regnum, buf);
}
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 4c3f777..6e754a4 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -1228,7 +1228,7 @@ spu2ppu_prev_register (struct frame_info *this_frame,
struct gdbarch *gdbarch = get_regcache_arch (cache->regcache);
gdb_byte *buf;
- buf = alloca (register_size (gdbarch, regnum));
+ buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
regcache_cooked_read (cache->regcache, regnum, buf);
return frame_unwind_got_bytes (this_frame, regnum, buf);
}
@@ -1827,7 +1827,7 @@ spu_get_overlay_table (struct objfile *objfile)
ovly_buf_table_base = BMSYMBOL_VALUE_ADDRESS (ovly_buf_table_msym);
ovly_buf_table_size = MSYMBOL_SIZE (ovly_buf_table_msym.minsym);
- ovly_table = xmalloc (ovly_table_size);
+ ovly_table = (gdb_byte *) xmalloc (ovly_table_size);
read_memory (ovly_table_base, ovly_table, ovly_table_size);
tbl = OBSTACK_CALLOC (&objfile->objfile_obstack,
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 9003442..650d424 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -398,8 +398,8 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs,
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT;
SYMBOL_SET_LINKAGE_NAME
- (sym, obstack_copy0 (&objfile->objfile_obstack,
- name, pp - name));
+ (sym, (char *) obstack_copy0 (&objfile->objfile_obstack,
+ name, pp - name));
pp += 2;
if (*(pp - 1) == 'F' || *(pp - 1) == 'f')
{
@@ -716,7 +716,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
normal:
if (SYMBOL_LANGUAGE (sym) == language_cplus)
{
- char *name = alloca (p - string + 1);
+ char *name = (char *) alloca (p - string + 1);
memcpy (name, string, p - string);
name[p - string] = '\0';
@@ -784,9 +784,9 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
probably has the necessary code. */
dbl_type = objfile_type (objfile)->builtin_double;
- dbl_valu =
- obstack_alloc (&objfile->objfile_obstack,
- TYPE_LENGTH (dbl_type));
+ dbl_valu
+ = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack,
+ TYPE_LENGTH (dbl_type));
store_typed_floating (dbl_valu, dbl_type, d);
SYMBOL_TYPE (sym) = dbl_type;
@@ -868,7 +868,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
SYMBOL_TYPE (sym) = create_array_type (NULL,
objfile_type (objfile)->builtin_char,
range_type);
- string_value = obstack_alloc (&objfile->objfile_obstack, ind + 1);
+ string_value
+ = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, ind + 1);
memcpy (string_value, string_local, ind + 1);
p++;
@@ -1622,15 +1623,16 @@ again:
type_name = NULL;
if (current_subfile->language == language_cplus)
{
- char *new_name, *name = alloca (p - *pp + 1);
+ char *new_name, *name = (char *) alloca (p - *pp + 1);
memcpy (name, *pp, p - *pp);
name[p - *pp] = '\0';
new_name = cp_canonicalize_string (name);
if (new_name != NULL)
{
- type_name = obstack_copy0 (&objfile->objfile_obstack,
- new_name, strlen (new_name));
+ type_name
+ = (char *) obstack_copy0 (&objfile->objfile_obstack,
+ new_name, strlen (new_name));
xfree (new_name);
}
}
@@ -2711,8 +2713,9 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type,
dem_opname, 0);
if (ret)
new_fnlist->fn_fieldlist.name
- = obstack_copy0 (&objfile->objfile_obstack,
- dem_opname, strlen (dem_opname));
+ = ((const char *)
+ obstack_copy0 (&objfile->objfile_obstack, dem_opname,
+ strlen (dem_opname)));
xfree (main_fn_name);
}
@@ -2853,8 +2856,8 @@ read_one_struct_field (struct field_info *fip, char **pp, char *p,
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
- fip->list->field.name =
- obstack_copy0 (&objfile->objfile_obstack, *pp, p - *pp);
+ fip->list->field.name
+ = (const char *) obstack_copy0 (&objfile->objfile_obstack, *pp, p - *pp);
*pp = p + 1;
/* This means we have a visibility for a field coming. */
@@ -3676,7 +3679,7 @@ read_enum_type (char **pp, struct type *type,
p = *pp;
while (*p != ':')
p++;
- name = obstack_copy0 (&objfile->objfile_obstack, *pp, p - *pp);
+ name = (char *) obstack_copy0 (&objfile->objfile_obstack, *pp, p - *pp);
*pp = p + 1;
n = read_huge_number (pp, ',', &nbits, 0);
if (nbits != 0)
@@ -4329,8 +4332,8 @@ common_block_start (char *name, struct objfile *objfile)
}
common_block = local_symbols;
common_block_i = local_symbols ? local_symbols->nsyms : 0;
- common_block_name = obstack_copy0 (&objfile->objfile_obstack,
- name, strlen (name));
+ common_block_name = (char *) obstack_copy0 (&objfile->objfile_obstack, name,
+ strlen (name));
}
/* Process a N_ECOMM symbol. */
diff --git a/gdb/stack.c b/gdb/stack.c
index 7d37dd1..2b7cc92 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -348,7 +348,7 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
}
CATCH (except, RETURN_MASK_ERROR)
{
- val_error = alloca (strlen (except.message) + 1);
+ val_error = (char *) alloca (strlen (except.message) + 1);
strcpy (val_error, except.message);
}
END_CATCH
@@ -475,7 +475,7 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
}
CATCH (except, RETURN_MASK_ERROR)
{
- val_error = alloca (strlen (except.message) + 1);
+ val_error = (char *) alloca (strlen (except.message) + 1);
strcpy (val_error, except.message);
}
END_CATCH
@@ -1915,7 +1915,7 @@ backtrace_command (char *arg, int from_tty)
{
if (arglen > 0)
{
- arg = xmalloc (arglen + 1);
+ arg = (char *) xmalloc (arglen + 1);
make_cleanup (xfree, arg);
arg[0] = 0;
for (i = 0; i < argc; i++)
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index 8f8cea6..691877f 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -653,7 +653,7 @@ stap_parse_register_operand (struct stap_parse_info *p)
len = p->arg - start;
- regname = alloca (len + gdb_reg_prefix_len + gdb_reg_suffix_len + 1);
+ regname = (char *) alloca (len + gdb_reg_prefix_len + gdb_reg_suffix_len + 1);
regname[0] = '\0';
/* We only add the GDB's register prefix/suffix if we are dealing with
diff --git a/gdb/symfile.c b/gdb/symfile.c
index cbb6d25..229f9b4 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1015,7 +1015,8 @@ syms_from_objfile_1 (struct objfile *objfile,
objfile->num_sections = num_sections;
objfile->section_offsets
- = obstack_alloc (&objfile->objfile_obstack, size);
+ = (struct section_offsets *) obstack_alloc (&objfile->objfile_obstack,
+ size);
memset (objfile->section_offsets, 0, size);
return;
}
@@ -1470,12 +1471,13 @@ find_separate_debug_file (const char *dir,
if (canon_dir != NULL && strlen (canon_dir) > i)
i = strlen (canon_dir);
- debugfile = xmalloc (strlen (debug_file_directory) + 1
- + i
- + strlen (DEBUG_SUBDIRECTORY)
- + strlen ("/")
- + strlen (debuglink)
- + 1);
+ debugfile
+ = (char *) xmalloc (strlen (debug_file_directory) + 1
+ + i
+ + strlen (DEBUG_SUBDIRECTORY)
+ + strlen ("/")
+ + strlen (debuglink)
+ + 1);
/* First try in the same directory as the original file. */
strcpy (debugfile, dir);
@@ -1860,7 +1862,7 @@ load_command (char *arg, int from_tty)
if (count)
{
/* We need to quote this string so buildargv can pull it apart. */
- char *temp = xmalloc (strlen (arg) + count + 1 );
+ char *temp = (char *) xmalloc (strlen (arg) + count + 1 );
char *ptemp = temp;
char *prev;
@@ -1971,7 +1973,7 @@ load_progress (ULONGEST bytes, void *untyped_arg)
might add a verify_memory() method to the target vector and
then use that. remote.c could implement that method using
the ``qCRC'' packet. */
- gdb_byte *check = xmalloc (bytes);
+ gdb_byte *check = (gdb_byte *) xmalloc (bytes);
struct cleanup *verify_cleanups = make_cleanup (xfree, check);
if (target_read_memory (args->lma, check, bytes) != 0)
@@ -2026,7 +2028,7 @@ load_section_callback (bfd *abfd, asection *asec, void *data)
new_request->begin = bfd_section_lma (abfd, asec) + args->load_offset;
new_request->end = new_request->begin + size; /* FIXME Should size
be in instead? */
- new_request->data = xmalloc (size);
+ new_request->data = (gdb_byte *) xmalloc (size);
new_request->baton = section_data;
buffer = new_request->data;
@@ -2629,9 +2631,9 @@ reread_symbols (void)
do it *after* the obstack has been initialized. */
set_objfile_per_bfd (objfile);
- objfile->original_name = obstack_copy0 (&objfile->objfile_obstack,
- original_name,
- strlen (original_name));
+ objfile->original_name
+ = (char *) obstack_copy0 (&objfile->objfile_obstack, original_name,
+ strlen (original_name));
/* Reset the sym_fns pointer. The ELF reader can change it
based on whether .gdb_index is present, and we need it to
@@ -2732,9 +2734,9 @@ add_filename_language (char *ext, enum language lang)
if (fl_table_next >= fl_table_size)
{
fl_table_size += 10;
- filename_language_table =
- xrealloc (filename_language_table,
- fl_table_size * sizeof (*filename_language_table));
+ filename_language_table = XRESIZEVEC (filename_language,
+ filename_language_table,
+ fl_table_size);
}
filename_language_table[fl_table_next].ext = xstrdup (ext);
@@ -2961,8 +2963,9 @@ allocate_compunit_symtab (struct objfile *objfile, const char *name)
Just save the basename to avoid path issues (too long for display,
relative vs absolute, etc.). */
saved_name = lbasename (name);
- cu->name = obstack_copy0 (&objfile->objfile_obstack, saved_name,
- strlen (saved_name));
+ cu->name
+ = (const char *) obstack_copy0 (&objfile->objfile_obstack, saved_name,
+ strlen (saved_name));
COMPUNIT_DEBUGFORMAT (cu) = "unknown";
@@ -3562,7 +3565,7 @@ read_target_long_array (CORE_ADDR memaddr, unsigned int *myaddr,
int len, int size, enum bfd_endian byte_order)
{
/* FIXME (alloca): Not safe if array is very large. */
- gdb_byte *buf = alloca (len * size);
+ gdb_byte *buf = (gdb_byte *) alloca (len * size);
int i;
read_memory (memaddr, buf, len * size);
@@ -3608,7 +3611,7 @@ simple_read_overlay_table (void)
cache_novlys = read_memory_integer (BMSYMBOL_VALUE_ADDRESS (novlys_msym),
4, byte_order);
cache_ovly_table
- = (void *) xmalloc (cache_novlys * sizeof (*cache_ovly_table));
+ = (unsigned int (*)[4]) xmalloc (cache_novlys * sizeof (*cache_ovly_table));
cache_ovly_table_base = BMSYMBOL_VALUE_ADDRESS (ovly_table_msym);
read_target_long_array (cache_ovly_table_base,
(unsigned int *) cache_ovly_table,
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 90204cd..9197621 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -874,7 +874,8 @@ symbol_set_names (struct general_symbol_info *gsymbol,
gsymbol->name = linkage_name;
else
{
- char *name = obstack_alloc (&per_bfd->storage_obstack, len + 1);
+ char *name = (char *) obstack_alloc (&per_bfd->storage_obstack,
+ len + 1);
memcpy (name, linkage_name, len);
name[len] = '\0';
@@ -896,7 +897,7 @@ symbol_set_names (struct general_symbol_info *gsymbol,
char *alloc_name;
lookup_len = len + JAVA_PREFIX_LEN;
- alloc_name = alloca (lookup_len + 1);
+ alloc_name = (char *) alloca (lookup_len + 1);
memcpy (alloc_name, JAVA_PREFIX, JAVA_PREFIX_LEN);
memcpy (alloc_name + JAVA_PREFIX_LEN, linkage_name, len);
alloc_name[lookup_len] = '\0';
@@ -909,7 +910,7 @@ symbol_set_names (struct general_symbol_info *gsymbol,
char *alloc_name;
lookup_len = len;
- alloc_name = alloca (lookup_len + 1);
+ alloc_name = (char *) alloca (lookup_len + 1);
memcpy (alloc_name, linkage_name, len);
alloc_name[lookup_len] = '\0';
@@ -950,10 +951,11 @@ symbol_set_names (struct general_symbol_info *gsymbol,
us better bcache hit rates for partial symbols. */
if (!copy_name && lookup_name == linkage_name)
{
- *slot = obstack_alloc (&per_bfd->storage_obstack,
- offsetof (struct demangled_name_entry,
- demangled)
- + demangled_len + 1);
+ *slot
+ = ((struct demangled_name_entry *)
+ obstack_alloc (&per_bfd->storage_obstack,
+ offsetof (struct demangled_name_entry, demangled)
+ + demangled_len + 1));
(*slot)->mangled = lookup_name;
}
else
@@ -963,10 +965,11 @@ symbol_set_names (struct general_symbol_info *gsymbol,
/* If we must copy the mangled name, put it directly after
the demangled name so we can have a single
allocation. */
- *slot = obstack_alloc (&per_bfd->storage_obstack,
- offsetof (struct demangled_name_entry,
- demangled)
- + lookup_len + demangled_len + 2);
+ *slot
+ = ((struct demangled_name_entry *)
+ obstack_alloc (&per_bfd->storage_obstack,
+ offsetof (struct demangled_name_entry, demangled)
+ + lookup_len + demangled_len + 2));
mangled_ptr = &((*slot)->demangled[demangled_len + 1]);
strcpy (mangled_ptr, lookup_name);
(*slot)->mangled = mangled_ptr;
@@ -1291,8 +1294,10 @@ resize_symbol_cache (struct symbol_cache *cache, unsigned int new_size)
{
size_t total_size = symbol_cache_byte_size (new_size);
- cache->global_symbols = xcalloc (1, total_size);
- cache->static_symbols = xcalloc (1, total_size);
+ cache->global_symbols
+ = (struct block_symbol_cache *) xcalloc (1, total_size);
+ cache->static_symbols
+ = (struct block_symbol_cache *) xcalloc (1, total_size);
cache->global_symbols->size = new_size;
cache->static_symbols->size = new_size;
}
@@ -4911,7 +4916,7 @@ rbreak_command (char *regexp, int from_tty)
char *local_name;
colon_index = colon - regexp;
- local_name = alloca (colon_index + 1);
+ local_name = (char *) alloca (colon_index + 1);
memcpy (local_name, regexp, colon_index);
local_name[colon_index--] = 0;
while (isspace (local_name[colon_index]))
@@ -4942,7 +4947,7 @@ rbreak_command (char *regexp, int from_tty)
if (newlen > len)
{
- string = xrealloc (string, newlen);
+ string = (char *) xrealloc (string, newlen);
len = newlen;
}
strcpy (string, fullname);
@@ -4961,7 +4966,7 @@ rbreak_command (char *regexp, int from_tty)
if (newlen > len)
{
- string = xrealloc (string, newlen);
+ string = (char *) xrealloc (string, newlen);
len = newlen;
}
strcpy (string, "'");
@@ -5076,19 +5081,19 @@ completion_list_add_name (const char *symname,
if (word == sym_text)
{
- newobj = xmalloc (strlen (symname) + 5);
+ newobj = (char *) xmalloc (strlen (symname) + 5);
strcpy (newobj, symname);
}
else if (word > sym_text)
{
/* Return some portion of symname. */
- newobj = xmalloc (strlen (symname) + 5);
+ newobj = (char *) xmalloc (strlen (symname) + 5);
strcpy (newobj, symname + (word - sym_text));
}
else
{
/* Return some of SYM_TEXT plus symname. */
- newobj = xmalloc (strlen (symname) + (sym_text - word) + 5);
+ newobj = (char *) xmalloc (strlen (symname) + (sym_text - word) + 5);
strncpy (newobj, word, sym_text - word);
newobj[sym_text - word] = '\0';
strcat (newobj, symname);
@@ -5144,7 +5149,7 @@ completion_list_objc_symbol (struct minimal_symbol *msymbol,
tmplen = 1024;
else
tmplen *= 2;
- tmp = xrealloc (tmp, tmplen);
+ tmp = (char *) xrealloc (tmp, tmplen);
}
selector = strchr (method, ' ');
if (selector != NULL)
@@ -5742,19 +5747,19 @@ add_filename_to_list (const char *fname, const char *text, const char *word,
if (word == text)
{
/* Return exactly fname. */
- newobj = xmalloc (fnlen + 5);
+ newobj = (char *) xmalloc (fnlen + 5);
strcpy (newobj, fname);
}
else if (word > text)
{
/* Return some portion of fname. */
- newobj = xmalloc (fnlen + 5);
+ newobj = (char *) xmalloc (fnlen + 5);
strcpy (newobj, fname + (word - text));
}
else
{
/* Return some of TEXT plus fname. */
- newobj = xmalloc (fnlen + (text - word) + 5);
+ newobj = (char *) xmalloc (fnlen + (text - word) + 5);
strncpy (newobj, word, text - word);
newobj[text - word] = '\0';
strcat (newobj, fname);
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 0eec6be..9ef811b 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1629,7 +1629,7 @@ maint_print_c_tdesc_cmd (char *args, int from_tty)
error (_("The current target description did not come from an XML file."));
filename = lbasename (target_description_filename);
- function = alloca (strlen (filename) + 1);
+ function = (char *) alloca (strlen (filename) + 1);
for (inp = filename, outp = function; *inp != '\0'; inp++)
if (*inp == '.')
break;
diff --git a/gdb/target-memory.c b/gdb/target-memory.c
index 177deb6..93772aa 100644
--- a/gdb/target-memory.c
+++ b/gdb/target-memory.c
@@ -366,7 +366,7 @@ target_write_memory_blocks (VEC(memory_write_request_s) *requests,
for (i = 0; VEC_iterate (memory_write_request_s, garbled, i, r); ++i)
{
gdb_assert (r->data == NULL);
- r->data = xmalloc (r->end - r->begin);
+ r->data = (gdb_byte *) xmalloc (r->end - r->begin);
err = target_read_memory (r->begin, r->data, r->end - r->begin);
if (err != 0)
goto out;
diff --git a/gdb/target.c b/gdb/target.c
index 8df862b..14cec56 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -926,7 +926,7 @@ target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop)
/* Small for testing. */
buffer_allocated = 4;
- buffer = xmalloc (buffer_allocated);
+ buffer = (char *) xmalloc (buffer_allocated);
bufptr = buffer;
while (len > 0)
@@ -953,7 +953,7 @@ target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop)
bytes = bufptr - buffer;
buffer_allocated *= 2;
- buffer = xrealloc (buffer, buffer_allocated);
+ buffer = (char *) xrealloc (buffer, buffer_allocated);
bufptr = buffer + bytes;
}
@@ -1655,7 +1655,7 @@ read_whatever_is_readable (struct target_ops *ops,
int unit_size,
VEC(memory_read_result_s) **result)
{
- gdb_byte *buf = xmalloc (end - begin);
+ gdb_byte *buf = (gdb_byte *) xmalloc (end - begin);
ULONGEST current_begin = begin;
ULONGEST current_end = end;
int forward;
@@ -1755,7 +1755,7 @@ read_whatever_is_readable (struct target_ops *ops,
/* The [current_end, end) range has been read. */
LONGEST region_len = end - current_end;
- r.data = xmalloc (region_len * unit_size);
+ r.data = (gdb_byte *) xmalloc (region_len * unit_size);
memcpy (r.data, buf + (current_end - begin) * unit_size,
region_len * unit_size);
r.begin = current_end;
@@ -1923,7 +1923,7 @@ target_read_alloc_1 (struct target_ops *ops, enum target_object object,
/* Start by reading up to 4K at a time. The target will throttle
this number down if necessary. */
buf_alloc = 4096;
- buf = xmalloc (buf_alloc);
+ buf = (gdb_byte *) xmalloc (buf_alloc);
buf_pos = 0;
while (1)
{
@@ -1956,7 +1956,7 @@ target_read_alloc_1 (struct target_ops *ops, enum target_object object,
if (buf_alloc < buf_pos * 2)
{
buf_alloc *= 2;
- buf = xrealloc (buf, buf_alloc);
+ buf = (gdb_byte *) xrealloc (buf, buf_alloc);
}
QUIT;
@@ -2363,7 +2363,7 @@ simple_search_memory (struct target_ops *ops,
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)
error (_("Unable to allocate memory to perform the search."));
old_cleanups = make_cleanup (free_current_contents, &search_buf);
@@ -3049,7 +3049,7 @@ target_fileio_read_alloc_1 (struct inferior *inf, const char *filename,
/* Start by reading up to 4K at a time. The target will throttle
this number down if necessary. */
buf_alloc = 4096;
- buf = xmalloc (buf_alloc);
+ buf = (gdb_byte *) xmalloc (buf_alloc);
buf_pos = 0;
while (1)
{
@@ -3080,7 +3080,7 @@ target_fileio_read_alloc_1 (struct inferior *inf, const char *filename,
if (buf_alloc < buf_pos * 2)
{
buf_alloc *= 2;
- buf = xrealloc (buf, buf_alloc);
+ buf = (gdb_byte *) xrealloc (buf, buf_alloc);
}
QUIT;
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index d136401..65f0729 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -333,7 +333,7 @@ tilegx_push_dummy_call (struct gdbarch *gdbarch,
typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
slacklen = align_up (typelen, 8) - typelen;
- val = xmalloc (typelen + slacklen);
+ val = (gdb_byte *) xmalloc (typelen + slacklen);
back_to = make_cleanup (xfree, val);
memcpy (val, contents, typelen);
memset (val + typelen, 0, slacklen);
diff --git a/gdb/top.c b/gdb/top.c
index 6388ba2..23ad603 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1065,8 +1065,9 @@ command_line_input (const char *prompt_arg, int repeat, char *annotation_suffix)
{
char *local_prompt;
- local_prompt = alloca ((prompt == NULL ? 0 : strlen (prompt))
- + strlen (annotation_suffix) + 40);
+ local_prompt
+ = (char *) alloca ((prompt == NULL ? 0 : strlen (prompt))
+ + strlen (annotation_suffix) + 40);
if (prompt == NULL)
local_prompt[0] = '\0';
else
@@ -1235,7 +1236,8 @@ command_line_input (const char *prompt_arg, int repeat, char *annotation_suffix)
{
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);
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 8cc36b8..68ff5b1 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -805,7 +805,7 @@ tfile_fetch_registers (struct target_ops *ops,
if (traceframe_find_block_type ('R', 0) >= 0)
{
- gdb_byte *regs = alloca (trace_regblock_size);
+ gdb_byte *regs = (gdb_byte *) alloca (trace_regblock_size);
tfile_read (regs, trace_regblock_size);
diff --git a/gdb/tracefile.c b/gdb/tracefile.c
index a31a589..21bf25f 100644
--- a/gdb/tracefile.c
+++ b/gdb/tracefile.c
@@ -429,7 +429,7 @@ tracefile_fetch_registers (struct regcache *regcache, int regno)
return;
}
- regs = alloca (register_size (gdbarch, pc_regno));
+ regs = (gdb_byte *) alloca (register_size (gdbarch, pc_regno));
store_unsigned_integer (regs, register_size (gdbarch, pc_regno),
gdbarch_byte_order (gdbarch),
tp->base.loc->address);
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 1e079e9..2ed24e9 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -948,8 +948,8 @@ add_memrange (struct collection_list *memranges,
if (memranges->next_memrange >= memranges->listsize)
{
memranges->listsize *= 2;
- memranges->list = xrealloc (memranges->list,
- memranges->listsize);
+ memranges->list = (struct memrange *) xrealloc (memranges->list,
+ memranges->listsize);
}
if (type != memrange_absolute) /* Better collect the base register! */
@@ -1244,12 +1244,10 @@ init_collection_list (struct collection_list *clist)
memset (clist, 0, sizeof *clist);
clist->listsize = 128;
- clist->list = xcalloc (clist->listsize,
- sizeof (struct memrange));
+ clist->list = XCNEWVEC (struct memrange, clist->listsize);
clist->aexpr_listsize = 128;
- clist->aexpr_list = xcalloc (clist->aexpr_listsize,
- sizeof (struct agent_expr *));
+ clist->aexpr_list = XCNEWVEC (struct agent_expr *, clist->aexpr_listsize);
}
/* Reduce a collection list to string form (for gdb protocol). */
@@ -1708,9 +1706,9 @@ add_aexpr (struct collection_list *collect, struct agent_expr *aexpr)
{
if (collect->next_aexpr_elt >= collect->aexpr_listsize)
{
- collect->aexpr_list =
- xrealloc (collect->aexpr_list,
- 2 * collect->aexpr_listsize * sizeof (struct agent_expr *));
+ collect->aexpr_list = XRESIZEVEC (struct agent_expr *,
+ collect->aexpr_list,
+ 2 * collect->aexpr_listsize);
collect->aexpr_listsize *= 2;
}
collect->aexpr_list[collect->next_aexpr_elt] = aexpr;
@@ -2947,7 +2945,7 @@ trace_dump_actions (struct command_line *action,
{
size_t len = next_comma - action_exp;
- cmd = xrealloc (cmd, len + 1);
+ cmd = (char *) xrealloc (cmd, len + 1);
memcpy (cmd, action_exp, len);
cmd[len] = 0;
}
@@ -2955,7 +2953,7 @@ trace_dump_actions (struct command_line *action,
{
size_t len = strlen (action_exp);
- cmd = xrealloc (cmd, len + 1);
+ cmd = (char *) xrealloc (cmd, len + 1);
memcpy (cmd, action_exp, len + 1);
}
@@ -3627,7 +3625,7 @@ Status line: '%s'\n"), p, line);
}
else if (p2 != p1)
{
- ts->stop_desc = xmalloc (strlen (line));
+ ts->stop_desc = (char *) xmalloc (strlen (line));
end = hex2bin (p1, (gdb_byte *) ts->stop_desc, (p2 - p1) / 2);
ts->stop_desc[end] = '\0';
}
@@ -3647,7 +3645,7 @@ Status line: '%s'\n"), p, line);
p2 = strchr (++p1, ':');
if (p2 != p1)
{
- ts->stop_desc = xmalloc ((p2 - p1) / 2 + 1);
+ ts->stop_desc = (char *) xmalloc ((p2 - p1) / 2 + 1);
end = hex2bin (p1, (gdb_byte *) ts->stop_desc, (p2 - p1) / 2);
ts->stop_desc[end] = '\0';
}
@@ -3701,7 +3699,7 @@ Status line: '%s'\n"), p, line);
else if (strncmp (p, "username", p1 - p) == 0)
{
++p1;
- ts->user_name = xmalloc (strlen (p) / 2);
+ ts->user_name = (char *) xmalloc (strlen (p) / 2);
end = hex2bin (p1, (gdb_byte *) ts->user_name, (p3 - p1) / 2);
ts->user_name[end] = '\0';
p = p3;
@@ -3709,7 +3707,7 @@ Status line: '%s'\n"), p, line);
else if (strncmp (p, "notes", p1 - p) == 0)
{
++p1;
- ts->notes = xmalloc (strlen (p) / 2);
+ ts->notes = (char *) xmalloc (strlen (p) / 2);
end = hex2bin (p1, (gdb_byte *) ts->notes, (p3 - p1) / 2);
ts->notes[end] = '\0';
p = p3;
@@ -3836,7 +3834,7 @@ parse_tracepoint_definition (char *line, struct uploaded_tp **utpp)
p = unpack_varlen_hex (p, &xlen);
p++; /* skip a colon */
- buf = alloca (strlen (line));
+ buf = (char *) alloca (strlen (line));
end = hex2bin (p, (gdb_byte *) buf, strlen (p) / 2);
buf[end] = '\0';
@@ -3873,7 +3871,7 @@ parse_tsv_definition (char *line, struct uploaded_tsv **utsvp)
int end;
struct uploaded_tsv *utsv = NULL;
- buf = alloca (strlen (line));
+ buf = (char *) alloca (strlen (line));
p = line;
p = unpack_varlen_hex (p, &num);
@@ -3929,14 +3927,14 @@ parse_static_tracepoint_marker_definition (char *line, char **pp,
if (endp == NULL)
error (_("bad marker definition: %s"), line);
- marker->str_id = xmalloc (endp - p + 1);
+ marker->str_id = (char *) xmalloc (endp - p + 1);
end = hex2bin (p, (gdb_byte *) marker->str_id, (endp - p + 1) / 2);
marker->str_id[end] = '\0';
p += 2 * end;
p++; /* skip a colon */
- marker->extra = xmalloc (strlen (p) + 1);
+ marker->extra = (char *) xmalloc (strlen (p) + 1);
end = hex2bin (p, (gdb_byte *) marker->extra, strlen (p) / 2);
marker->extra[end] = '\0';
diff --git a/gdb/tui/tui-file.c b/gdb/tui/tui-file.c
index 4b4b92c..1aa0a61 100644
--- a/gdb/tui/tui-file.c
+++ b/gdb/tui/tui-file.c
@@ -107,7 +107,7 @@ tui_sfileopen (int n)
tmpstream->ts_filestream = NULL;
if (n > 0)
{
- tmpstream->ts_strbuf = xmalloc ((n + 1) * sizeof (char));
+ tmpstream->ts_strbuf = XNEWVEC (char, n + 1);
tmpstream->ts_strbuf[0] = '\0';
}
else
@@ -221,12 +221,13 @@ tui_file_adjust_strbuf (int n, struct ui_file *file)
if (n > (stream->ts_buflen - non_null_chars - 1))
{
stream->ts_buflen = n + non_null_chars + 1;
- stream->ts_strbuf = xrealloc (stream->ts_strbuf, stream->ts_buflen);
+ stream->ts_strbuf
+ = XRESIZEVEC (char, stream->ts_strbuf, stream->ts_buflen);
}
}
else
/* No buffer yet, so allocate one of the desired size. */
- stream->ts_strbuf = xmalloc ((n + 1) * sizeof (char));
+ stream->ts_strbuf = XNEWVEC (char, n + 1);
}
static void
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index c7a092f..6f81f09 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -671,7 +671,7 @@ tui_expand_tabs (const char *string, int col)
}
/* Allocate the copy. */
- ret = q = xmalloc (strlen (string) + n_adjust + 1);
+ ret = q = (char *) xmalloc (strlen (string) + n_adjust + 1);
/* 2. Copy the original string while replacing TABs with spaces. */
for (ncol = col, s = string; s; )
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 018a1df..9f40781 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -62,7 +62,7 @@ tui_set_source_content (struct symtab *s,
if (!noerror)
{
const char *filename = symtab_to_filename_for_display (s);
- char *name = alloca (strlen (filename) + 100);
+ char *name = (char *) alloca (strlen (filename) + 100);
sprintf (name, "%s:%d", filename, line_no);
print_sys_errmsg (name, errno);
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 9e44225..8dc57f2 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -297,8 +297,9 @@ find_global_typedef (const struct type_print_options *flags,
if (applied != NULL)
{
- new_tf->name = obstack_copy0 (&flags->global_typedefs->storage, applied,
- strlen (applied));
+ new_tf->name
+ = (const char *) obstack_copy0 (&flags->global_typedefs->storage,
+ applied, strlen (applied));
xfree (applied);
}
diff --git a/gdb/ui-file.c b/gdb/ui-file.c
index 3aa2a7c..c59c14c 100644
--- a/gdb/ui-file.c
+++ b/gdb/ui-file.c
@@ -333,9 +333,9 @@ do_ui_file_xstrdup (void *context, const char *buffer, long length)
struct accumulated_ui_file *acc = context;
if (acc->buffer == NULL)
- acc->buffer = xmalloc (length + 1);
+ acc->buffer = (char *) xmalloc (length + 1);
else
- acc->buffer = xrealloc (acc->buffer, acc->length + length + 1);
+ acc->buffer = (char *) xrealloc (acc->buffer, acc->length + length + 1);
memcpy (acc->buffer + acc->length, buffer, length);
acc->length += length;
acc->buffer[acc->length] = '\0';
@@ -371,7 +371,7 @@ ui_file_obsavestring (struct ui_file *file, struct obstack *obstack,
ui_file_put (file, do_ui_file_obsavestring, obstack);
*length = obstack_object_size (obstack);
obstack_1grow (obstack, '\0');
- return obstack_finish (obstack);
+ return (char *) obstack_finish (obstack);
}
/* A pure memory based ``struct ui_file'' that can be used an output
@@ -468,7 +468,7 @@ mem_file_write (struct ui_file *file,
{
stream->length_buffer = length_buffer;
stream->sizeof_buffer = length_buffer;
- stream->buffer = xmalloc (stream->sizeof_buffer);
+ stream->buffer = (char *) xmalloc (stream->sizeof_buffer);
memcpy (stream->buffer, buffer, length_buffer);
}
else
@@ -478,7 +478,8 @@ mem_file_write (struct ui_file *file,
if (new_length >= stream->sizeof_buffer)
{
stream->sizeof_buffer = new_length;
- stream->buffer = xrealloc (stream->buffer, stream->sizeof_buffer);
+ stream->buffer
+ = (char *) xrealloc (stream->buffer, stream->sizeof_buffer);
}
memcpy (stream->buffer + stream->length_buffer, buffer, length_buffer);
stream->length_buffer = new_length;
diff --git a/gdb/utils.c b/gdb/utils.c
index 3ce88b9..3bb82f0 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1112,7 +1112,7 @@ gdb_print_host_address (const void *addr, struct ui_file *stream)
char *
make_hex_string (const gdb_byte *data, size_t length)
{
- char *result = xmalloc (length * 2 + 1);
+ char *result = (char *) xmalloc (length * 2 + 1);
char *p;
size_t i;
@@ -1148,7 +1148,7 @@ char *
get_regcomp_error (int code, regex_t *rx)
{
size_t length = regerror (code, rx, NULL, 0);
- char *result = xmalloc (length);
+ char *result = (char *) xmalloc (length);
regerror (code, rx, result, length);
return result;
@@ -1996,7 +1996,7 @@ puts_filtered_tabular (char *string, int width, int right)
if (right)
spaces += width - stringlen;
- spacebuf = alloca (spaces + 1);
+ spacebuf = (char *) alloca (spaces + 1);
spacebuf[spaces] = '\0';
while (spaces--)
spacebuf[spaces] = ' ';
@@ -2902,7 +2902,7 @@ gdb_realpath_keepfile (const char *filename)
if (base_name == filename)
return xstrdup (filename);
- dir_name = alloca ((size_t) (base_name - filename + 2));
+ dir_name = (char *) alloca ((size_t) (base_name - filename + 2));
/* Allocate enough space to store the dir_name + plus one extra
character sometimes needed under Windows (see below), and
then the closing \000 character. */
@@ -3013,7 +3013,7 @@ ldirname (const char *filename)
if (base == filename)
return NULL;
- dirname = xmalloc (base - filename + 2);
+ dirname = (char *) xmalloc (base - filename + 2);
memcpy (dirname, filename, base - filename);
/* On DOS based file systems, convert "d:foo" to "d:.", so that we
@@ -3079,7 +3079,7 @@ gdb_bfd_errmsg (bfd_error_type error_tag, char **matching)
+ strlen (AMBIGUOUS_MESS2);
for (p = matching; *p; p++)
ret_len += strlen (*p) + 1;
- ret = xmalloc (ret_len + 1);
+ ret = (char *) xmalloc (ret_len + 1);
retp = ret;
make_cleanup (xfree, ret);
@@ -3241,7 +3241,8 @@ substitute_path_component (char **stringp, const char *from, const char *to)
{
char *string_new;
- string_new = xrealloc (string, (strlen (string) + to_len + 1));
+ string_new
+ = (char *) xrealloc (string, (strlen (string) + to_len + 1));
/* Relocate the current S pointer. */
s = s - string + string_new;
diff --git a/gdb/valops.c b/gdb/valops.c
index 173ef4e..1e372ef 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -2047,7 +2047,7 @@ search_struct_method (const char *name, struct value **arg1p,
struct cleanup *back_to;
CORE_ADDR address;
- tmp = xmalloc (TYPE_LENGTH (baseclass));
+ tmp = (gdb_byte *) xmalloc (TYPE_LENGTH (baseclass));
back_to = make_cleanup (xfree, tmp);
address = value_address (*arg1p);
@@ -2900,7 +2900,7 @@ find_oload_champ_namespace_loop (struct value **args, int nargs,
old_cleanups = make_cleanup (xfree, *oload_syms);
make_cleanup (xfree, *oload_champ_bv);
- new_namespace = alloca (namespace_len + 1);
+ new_namespace = (char *) alloca (namespace_len + 1);
strncpy (new_namespace, qualified_name, namespace_len);
new_namespace[namespace_len] = '\0';
new_oload_syms = make_symbol_overload_list (func_name,
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 713998c..c053a81 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1603,7 +1603,7 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
as the base 16 number, which is 2 digits per byte. */
decimal_len = len * 2 * 2;
- digits = xmalloc (decimal_len);
+ digits = (unsigned char *) xmalloc (decimal_len);
for (i = 0; i < decimal_len; i++)
{
@@ -2119,7 +2119,7 @@ read_string (CORE_ADDR addr, int len, int width, unsigned int fetchlimit,
else
{ /* Length of string is really 0! */
/* We always allocate *buffer. */
- *buffer = bufptr = xmalloc (1);
+ *buffer = bufptr = (gdb_byte *) xmalloc (1);
errcode = 0;
}
@@ -2272,7 +2272,7 @@ generic_emit_char (int c, struct type *type, struct ui_file *stream,
struct wchar_iterator *iter;
int need_escape = 0;
- buf = alloca (TYPE_LENGTH (type));
+ buf = (gdb_byte *) alloca (TYPE_LENGTH (type));
pack_long (buf, type, c);
iter = make_wchar_iterator (buf, TYPE_LENGTH (type),
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 2a95c86..74a06d9 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -529,7 +529,7 @@ varobj_delete (struct varobj *var, char ***dellist, int only_children)
/* We may have been asked to return a list of what has been deleted. */
if (dellist != NULL)
{
- *dellist = xmalloc ((delcount + 1) * sizeof (char *));
+ *dellist = XNEWVEC (char *, delcount + 1);
cp = *dellist;
mycount = delcount;
@@ -2610,7 +2610,7 @@ varobj_value_get_print_value (struct value *value,
}
len = strlen (s);
- thevalue = xmemdup (s, len + 1, len + 1);
+ thevalue = (char *) xmemdup (s, len + 1, len + 1);
type = builtin_type (gdbarch)->builtin_char;
xfree (s);
diff --git a/gdb/vaxobsd-tdep.c b/gdb/vaxobsd-tdep.c
index 9a1e4e2..4e2701f 100644
--- a/gdb/vaxobsd-tdep.c
+++ b/gdb/vaxobsd-tdep.c
@@ -69,7 +69,7 @@ vaxobsd_sigtramp_sniffer (const struct frame_unwind *self,
if (name)
return 0;
- buf = alloca(sizeof vaxobsd_sigreturn);
+ buf = (gdb_byte *) alloca (sizeof vaxobsd_sigreturn);
if (!safe_frame_unwind_memory (this_frame, sigreturn_addr,
buf, sizeof vaxobsd_sigreturn))
return 0;
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index dc4e2e4..58e8fca 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -321,7 +321,7 @@ display_one_tib (ptid_t ptid)
max = tib_size / size;
}
- tib = alloca (tib_size);
+ tib = (gdb_byte *) alloca (tib_size);
if (target_get_tib_address (ptid, &thread_local_base) == 0)
{
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 0d49751..2c158b8 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1079,7 +1079,8 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
{
char *p;
- p = obstack_alloc (&objfile->objfile_obstack, E_SYMNMLEN + 1);
+ p = (char *) obstack_alloc (&objfile->objfile_obstack,
+ E_SYMNMLEN + 1);
strncpy (p, cs->c_name, E_SYMNMLEN);
p[E_SYMNMLEN] = '\0';
cs->c_name = p;
@@ -1561,7 +1562,8 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
will be patched with the type from its stab entry later on in
patch_block_stabs (), unless the file was compiled without -g. */
- SYMBOL_SET_LINKAGE_NAME (sym, SYMNAME_ALLOC (name, symname_alloced));
+ SYMBOL_SET_LINKAGE_NAME (sym, ((const char *)
+ SYMNAME_ALLOC (name, symname_alloced)));
SYMBOL_TYPE (sym) = objfile_type (objfile)->nodebug_text_symbol;
SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
@@ -2133,7 +2135,8 @@ swap_sym (struct internal_syment *symbol, union internal_auxent *aux,
into the minimal symbols. */
char *p;
- p = obstack_alloc (&objfile->objfile_obstack, E_SYMNMLEN + 1);
+ p = (char *) obstack_alloc (&objfile->objfile_obstack,
+ E_SYMNMLEN + 1);
strncpy (p, symbol->n_name, E_SYMNMLEN);
p[E_SYMNMLEN] = '\0';
*name = p;
@@ -2789,7 +2792,7 @@ scan_xcoff_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';
@@ -2812,7 +2815,7 @@ scan_xcoff_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';
@@ -2963,7 +2966,9 @@ xcoff_initial_scan (struct objfile *objfile, int symfile_flags)
length = bfd_section_size (abfd, secp);
if (length)
{
- debugsec = obstack_alloc (&objfile->objfile_obstack, length);
+ debugsec
+ = (bfd_byte *) obstack_alloc (&objfile->objfile_obstack,
+ length);
if (!bfd_get_full_section_contents (abfd, secp, &debugsec))
{
@@ -2983,7 +2988,7 @@ xcoff_initial_scan (struct objfile *objfile, int symfile_flags)
error (_("Error reading symbols from %s: %s"),
name, bfd_errmsg (bfd_get_error ()));
size = coff_data (abfd)->local_symesz * num_symbols;
- info->symtbl = obstack_alloc (&objfile->objfile_obstack, size);
+ info->symtbl = (char *) obstack_alloc (&objfile->objfile_obstack, size);
info->symtbl_num_syms = num_symbols;
val = bfd_bread (info->symtbl, size, abfd);
diff --git a/gdb/xml-support.c b/gdb/xml-support.c
index 054d56b..211f745 100644
--- a/gdb/xml-support.c
+++ b/gdb/xml-support.c
@@ -365,7 +365,7 @@ gdb_xml_end_element (void *data, const XML_Char *name)
length = obstack_object_size (scope->body);
obstack_1grow (scope->body, '\0');
- body = obstack_finish (scope->body);
+ body = (char *) obstack_finish (scope->body);
/* Strip leading and trailing whitespace. */
while (length > 0 && ISSPACE (body[length-1]))
@@ -905,7 +905,7 @@ xml_process_xincludes (const char *name, const char *text,
if (gdb_xml_parse (parser, text) == 0)
{
obstack_1grow (&data->obstack, '\0');
- result = xstrdup (obstack_finish (&data->obstack));
+ result = xstrdup ((const char *) obstack_finish (&data->obstack));
if (depth == 0)
gdb_xml_debug (parser, _("XInclude processing succeeded."));
@@ -1041,7 +1041,7 @@ xml_fetch_content_from_file (const char *filename, void *baton)
/* Read in the whole file, one chunk at a time. */
len = 4096;
offset = 0;
- text = xmalloc (len);
+ text = (char *) xmalloc (len);
make_cleanup (free_current_contents, &text);
while (1)
{
@@ -1063,7 +1063,7 @@ xml_fetch_content_from_file (const char *filename, void *baton)
break;
len = len * 2;
- text = xrealloc (text, len);
+ text = (char *) xrealloc (text, len);
}
fclose (file);
diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c
index ea85a2c..255d816 100644
--- a/gdb/xml-syscall.c
+++ b/gdb/xml-syscall.c
@@ -376,7 +376,7 @@ xml_list_of_syscalls (struct gdbarch *gdbarch)
return NULL;
nsyscalls = VEC_length (syscall_desc_p, syscalls_info->syscalls);
- names = xmalloc ((nsyscalls + 1) * sizeof (char *));
+ names = XNEWVEC (const char *, nsyscalls + 1);
for (i = 0;
VEC_iterate (syscall_desc_p, syscalls_info->syscalls, i, sysdesc);
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 05b3039..92e3b37 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -282,7 +282,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
slacklen = typelen & 1;
- val = xmalloc (typelen + slacklen);
+ val = (gdb_byte *) xmalloc (typelen + slacklen);
back_to = make_cleanup (xfree, val);
memcpy (val, bytes, typelen);
memset (val + typelen, 0, slacklen);