+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
return 0;
len = tmp - start;
- regname = alloca (len + 2);
+ regname = (char *) alloca (len + 2);
strncpy (regname, start, len);
regname[len] = '\0';
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));
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,
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';
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);
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';
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;
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;
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
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);
{
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);
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;
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);
}
{
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;
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';
}
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);
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;
/* 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';
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;
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)
{
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
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);
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);
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;
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;
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;
/* 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;
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);
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;
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;
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);
/* 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,
return 0;
len = tmp - start;
- regname = alloca (len + 2);
+ regname = (char *) alloca (len + 2);
offset = 0;
if (isdigit (*start))
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;
{
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,
{
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,
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);
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;
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)
/* 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;
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';
{
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);
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;
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;
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);
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. */
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;
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;
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);
}
}
/* 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;
/* 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;
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
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. */
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. */
{
/* 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. */
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);
}
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;
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] = '~';
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 (©[1], token.ptr, token.length);
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;
struct type *unsigned_type;
char *p;
- p = alloca (len);
+ p = (char *) alloca (len);
memcpy (p, buf, len);
if (parsed_float)
/* 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
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, ¤t);
if (checkpoint > 1)
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';
/* 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;
}
{
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));
}
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;
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;
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);
}
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),
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);
/* 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
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);
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);
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);
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,
{
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);
{
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;
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);
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);
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;
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,
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;
{
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. */
/* 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;
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);
}
/* 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])
{
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,
/* 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"),
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);
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);
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);
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);
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);
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;
}
section_name);
}
- contents = alloca (size);
+ contents = (char *) alloca (size);
if (! bfd_get_section_contents (core_bfd, section, contents,
(file_ptr) 0, size))
{
{
if (demangle_info->next == NULL)
{
- more = malloc (sizeof (struct demangle_info));
+ more = XNEW (struct demangle_info);
more->next = NULL;
demangle_info->next = more;
}
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;
{
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);
? 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);
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);
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,
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,
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);
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);
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. */
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);
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, "::");
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';
return;
len = cp_find_first_component (arg);
- prefix = alloca (len + 1);
+ prefix = (char *) alloca (len + 1);
memcpy (prefix, arg, len);
prefix[len] = '\0';
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,
gdb_byte *contents;
int k;
- contents = xmalloc (mlen);
+ contents = (gdb_byte *) xmalloc (mlen);
for (k = 0; k < mlen; k++)
{
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
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;
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);
/* 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,
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);
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);
if (p == NULL)
p = namestring;
n = p - namestring;
- p = alloca (n + 2);
+ p = (char *) alloca (n + 2);
strncpy (p, namestring, n);
p[n] = 0;
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';
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);
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';
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';
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;
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);
}
}
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++;
}
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++)
{
long i, symcount;
- symbol_table = xmalloc (storage_needed);
+ symbol_table = (asymbol **) xmalloc (storage_needed);
symcount = bfd_canonicalize_symtab (abfd, symbol_table);
if (symcount < 0)
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;
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;
}
{
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;
{
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;
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;
}
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;
}
}
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;
++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);
{
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;
}
}
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));
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;
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;
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);
}
{
/* 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))
/* 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;
if (buffer_size < this_size)
{
buffer_size = this_size;
- buffer = xrealloc (buffer, buffer_size);
+ buffer = (gdb_byte *) xrealloc (buffer, buffer_size);
}
intermediate_buffer = buffer;
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;
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
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;
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;
{
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;
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;
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;
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;
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,
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);
}
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;
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;
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. */
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;
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;
{
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
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;
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);
}
}
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++];
*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;
}
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;
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);
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);
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,
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);
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);
}
}
/* 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);
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;
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;
}
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';
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);
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;
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,
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)
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);
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)
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);
/* 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)
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);
}
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);
{
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);
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
{
char *s, *nextS;
- s = alloca (strlen (selector) + 1);
+ s = (char *) alloca (strlen (selector) + 1);
strcpy (s, selector);
for (tem = 0; tem < nargs; tem++)
{
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)
{
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. */
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);
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;
}
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,
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;
}
/* 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);
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);
}
va_end (ap);
obstack_1grow (obstackp, 0);
- return obstack_finish (obstackp);
+ return (char *) obstack_finish (obstackp);
}
/* See gdb_obstack.h. */
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;
}
+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.
++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;
{
char *rslt;
- rslt = xmalloc (2 * aexpr->length + 1);
+ rslt = (char *) xmalloc (2 * aexpr->length + 1);
bin2hex (aexpr->bytes, rslt, aexpr->length);
return rslt;
}
{
int input_index, output_index, escaped;
- *data = xmalloc (p_len);
+ *data = (char *) xmalloc (p_len);
output_index = 0;
escaped = 0;
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
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;
}
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))
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)
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;
}
}
- document = xmalloc (allocated);
+ document = (char *) xmalloc (allocated);
strcpy (document, "<library-list-svr4 version=\"1.0\"");
p = document + strlen (document);
/* 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;
}
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)
/* 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
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)
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)
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)
{
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;
}
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");
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. */
}
if (*to_p == NULL)
- *to_p = xmalloc (*len_ptr);
+ *to_p = (unsigned char *) xmalloc (*len_ptr);
hex2bin (&from[i++], *to_p, *len_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)
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
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
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);
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");
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);
}
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);
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;
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);
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);
p = strtok (NULL, ";"))
{
count++;
- qsupported = xrealloc (qsupported, count * sizeof (char *));
+ qsupported = XRESIZEVEC (char *, qsupported, count);
qsupported[count - 1] = xstrdup (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)
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;
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);
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';
}
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;
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);
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';
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;
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);
{
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);
{
struct traceframe *tframe;
- tframe = trace_buffer_alloc (sizeof (struct traceframe));
+ tframe
+ = (struct traceframe *) trace_buffer_alloc (sizeof (struct traceframe));
if (tframe == NULL)
return NULL;
if (!tframe)
return NULL;
- block = trace_buffer_alloc (amt);
+ block = (unsigned char *) trace_buffer_alloc (amt);
if (!block)
return NULL;
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;
++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';
++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';
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));
/* 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);
}
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",
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);
}
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 */
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 */
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 */
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");
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
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;
}
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");
}
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];
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))
{
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);
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);
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));
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));
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);
{
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;
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;
}
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;
#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
{
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;
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);
}
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;
}
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;
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)
{
|| 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';
return result;
}
- prefix_text = xmalloc (i + 2);
+ prefix_text = (char *) xmalloc (i + 2);
memcpy (prefix_text, name, i + 1);
prefix_text[i + 1] = '\0';
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])
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;
}
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;
}
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
{
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;
}
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;
}
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;
/* 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)
/* 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);
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
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,
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);
&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;
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);
return 0;
len = s - start - 1;
- regname = alloca (len + 1);
+ regname = (char *) alloca (len + 1);
strncpy (regname, start, len);
regname[len] = '\0';
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';
++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';
return 0;
/* Allocate buffer. */
- buf = alloca (buflen);
+ buf = (gdb_byte *) alloca (buflen);
/* Loop over all offsets. */
for (offset = i386obsd_sigreturn_offset; *offset != -1; offset++)
return NULL;
}
- ret = xmalloc (len + 1);
+ ret = (char *) xmalloc (len + 1);
memcpy (ret, buf, len);
ret[len] = '\0';
return ret;
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++)
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);
{
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);
}
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);
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;
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 (¤t_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
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,
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);
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++)
{
* 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
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;
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;
{
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);
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;
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;
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';
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';
}
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';
{
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));
/* 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;
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;
}
{
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)
{
{
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';
/* 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);
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++)
/* 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)
return NULL;
}
- ret = xmalloc (len + 1);
+ ret = (char *) xmalloc (len + 1);
memcpy (ret, buf, len);
ret[len] = '\0';
return ret;
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;
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)
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++)
{
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))
&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;
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);
&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;
&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,
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);
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);
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++)
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))
{
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"));
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. */
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 (¤t_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
char *path, *cp;
int result;
const char *obj_name = objfile_name (obj);
+ int alloc_len;
if (obj_name[0] != '/')
{
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);
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);
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);
}
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. */
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");
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
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);
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);
}
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. */
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;
while (b->size <= n)
b->size *= 2;
- b->text = xrealloc (b->text, b->size);
+ b->text = (char *) xrealloc (b->text, b->size);
}
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. */
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);
{
/* 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);
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;
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;
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;
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]);
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;
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)));
}
}
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)
/* 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);
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';
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';
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.
/* 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)
{
}
obstack_1grow (&obstack, '\0');
- ret = xstrdup (obstack_finish (&obstack));
+ ret = xstrdup ((const char *) obstack_finish (&obstack));
obstack_free (&obstack, NULL);
return ret;
/* 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
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);
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)
{
/* 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. */
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);
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)
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)
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 != '"')
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;
}
/* 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';
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';
}
}
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
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)
break;
}
- uncompressed = xmalloc (iter.block.uncompressed_size);
+ uncompressed = (gdb_byte *) xmalloc (iter.block.uncompressed_size);
memset (&block, 0, sizeof (block));
block.filters = filters;
{
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)"),
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",
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);
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,
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;
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);
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;
/* 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);
{
struct using_direct *current;
struct using_direct *newobj;
+ int alloc_len;
/* Has it already been added? */
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
{
}
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;
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);
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;
}
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)
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)
{
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);
out = "";
err = "";
- argv = xcalloc (n + 1, sizeof argv[0]);
+ argv = XCNEWVEC (char *, n + 1);
argc = n;
for (i = 0, n = 0; n < argc; n++)
{
(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 */
while ((strlen (symname) + 1) >= tmplen)
{
tmplen = (tmplen == 0) ? 1024 : tmplen * 2;
- tmp = xrealloc (tmp, tmplen);
+ tmp = (char *) xrealloc (tmp, tmplen);
}
strcpy (tmp, symname);
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
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;
}
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
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,
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);
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)
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);
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);
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;
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;
{
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;
}
|| 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';
}
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);
char *copy;
int n, num;
- copy = xmalloc (len + 1);
+ copy = (char *) xmalloc (len + 1);
memcpy (copy, p, len);
copy[len] = 0;
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);
}
}
}
len = s - p->arg;
- regname = alloca (len + 2);
+ regname = (char *) alloca (len + 2);
regname[0] = 'r';
strncpy (regname + 1, p->arg, len);
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);
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);
}
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;
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;
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);
|| 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';
return result;
}
- prefix_text = xmalloc (i + 2);
+ prefix_text = (char *) xmalloc (i + 2);
memcpy (prefix_text, name, i + 1);
prefix_text[i + 1] = '\0';
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;
/* Detect EOF (Ctrl-D). */
if (p == NULL)
{
- q = PyMem_Malloc (1);
+ q = (char *) PyMem_Malloc (1);
if (q != NULL)
q[0] = '\0';
return q;
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);
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;
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;
if (arg && *arg)
{
int len = strlen (arg);
- char *script = xmalloc (len + 2);
+ char *script = (char *) xmalloc (len + 2);
strcpy (script, arg);
script[len] = '\n';
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)
{
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);
}
/* 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,
/* 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);
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
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
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
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
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 ();
}
/* 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 ();
}
/* 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 ();
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 ();
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 ();
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 ();
/* 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)
{
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)
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");
/* 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;
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++)
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);
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;
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;
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++)
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++)
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);
}
/* 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. */
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. */
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)
}
}
- 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);
{
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++)
{
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;
{
/* 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;
}
{
/* 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;
}
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);
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);
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);
/* 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);
/* 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);
{
const int annex_size = 9;
- annex = alloca (annex_size);
+ annex = (char *) alloca (annex_size);
xsnprintf (annex, annex_size, "%x", pid);
}
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);
}
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;
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,
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;
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);
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);
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)
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;
/* 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);
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;
/* 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;
/* 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);
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;
/* 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);
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;
/* 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);
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;
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);
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';
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)
}
/* 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);
{
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);
}
}
/* 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;
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))
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))
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 ();
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)
{
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;
{
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)
{
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;
{
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");
{
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);
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)
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);
if (newlen > alloclen)
{
alloclen = newlen;
- filename = alloca (alloclen);
+ filename = (char *) alloca (alloclen);
}
strcpy (filename, current_directory);
}
if (newlen > alloclen)
{
alloclen = newlen;
- filename = alloca (alloclen);
+ filename = (char *) alloca (alloclen);
}
strcpy (filename, tilde_expanded);
xfree (tilde_expanded);
{
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);
/* 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);
int cursize, newsize;
cursize = 256;
- buf = xmalloc (cursize);
+ buf = (char *) xmalloc (cursize);
p = buf;
c = fgetc (stream);
if (p - buf == cursize)
{
newsize = cursize + cursize / 2;
- buf = xrealloc (buf, newsize);
+ buf = (char *) xrealloc (buf, newsize);
p = buf + cursize;
cursize = newsize;
}
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);
}
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);
}
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,
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')
{
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';
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;
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++;
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);
}
}
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);
}
{
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. */
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)
}
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. */
}
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
}
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
{
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++)
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
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;
}
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);
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;
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)
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;
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
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);
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";
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);
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,
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';
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';
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';
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
/* 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;
{
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;
}
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]))
if (newlen > len)
{
- string = xrealloc (string, newlen);
+ string = (char *) xrealloc (string, newlen);
len = newlen;
}
strcpy (string, fullname);
if (newlen > len)
{
- string = xrealloc (string, newlen);
+ string = (char *) xrealloc (string, newlen);
len = newlen;
}
strcpy (string, "'");
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);
tmplen = 1024;
else
tmplen *= 2;
- tmp = xrealloc (tmp, tmplen);
+ tmp = (char *) xrealloc (tmp, tmplen);
}
selector = strchr (method, ' ');
if (selector != NULL)
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);
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;
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;
/* Small for testing. */
buffer_allocated = 4;
- buffer = xmalloc (buffer_allocated);
+ buffer = (char *) xmalloc (buffer_allocated);
bufptr = buffer;
while (len > 0)
bytes = bufptr - buffer;
buffer_allocated *= 2;
- buffer = xrealloc (buffer, buffer_allocated);
+ buffer = (char *) xrealloc (buffer, buffer_allocated);
bufptr = buffer + bytes;
}
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;
/* 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;
/* 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)
{
if (buf_alloc < buf_pos * 2)
{
buf_alloc *= 2;
- buf = xrealloc (buf, buf_alloc);
+ buf = (gdb_byte *) xrealloc (buf, buf_alloc);
}
QUIT;
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);
/* 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)
{
if (buf_alloc < buf_pos * 2)
{
buf_alloc *= 2;
- buf = xrealloc (buf, buf_alloc);
+ buf = (gdb_byte *) xrealloc (buf, buf_alloc);
}
QUIT;
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);
{
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
{
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);
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);
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);
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! */
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). */
{
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;
{
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;
}
{
size_t len = strlen (action_exp);
- cmd = xrealloc (cmd, len + 1);
+ cmd = (char *) xrealloc (cmd, len + 1);
memcpy (cmd, action_exp, len + 1);
}
}
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';
}
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';
}
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;
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;
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';
int end;
struct uploaded_tsv *utsv = NULL;
- buf = alloca (strlen (line));
+ buf = (char *) alloca (strlen (line));
p = line;
p = unpack_varlen_hex (p, &num);
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';
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
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
}
/* 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; )
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);
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);
}
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';
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);
}
\f
/* A pure memory based ``struct ui_file'' that can be used an output
{
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
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;
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;
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;
if (right)
spaces += width - stringlen;
- spacebuf = alloca (spaces + 1);
+ spacebuf = (char *) alloca (spaces + 1);
spacebuf[spaces] = '\0';
while (spaces--)
spacebuf[spaces] = ' ';
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. */
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
+ 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);
{
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;
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);
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,
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++)
{
else
{ /* Length of string is really 0! */
/* We always allocate *buffer. */
- *buffer = bufptr = xmalloc (1);
+ *buffer = bufptr = (gdb_byte *) xmalloc (1);
errcode = 0;
}
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),
/* 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;
}
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);
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;
max = tib_size / size;
}
- tib = alloca (tib_size);
+ tib = (gdb_byte *) alloca (tib_size);
if (target_get_tib_address (ptid, &thread_local_base) == 0)
{
{
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;
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;
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;
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';
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';
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))
{
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);
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]))
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."));
/* 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)
{
break;
len = len * 2;
- text = xrealloc (text, len);
+ text = (char *) xrealloc (text, len);
}
fclose (file);
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);
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);