diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2015-09-25 14:08:06 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2015-09-25 14:08:06 -0400 |
commit | 224c3ddb89a43bf8db06c373d4ff429477833c0f (patch) | |
tree | af9bcd14473ad47b2815503d9ee9a4803d152715 /gdb/gdbserver | |
parent | 8e394ffc7ab691eafcf276d7ae578454a8c5548f (diff) | |
download | gdb-224c3ddb89a43bf8db06c373d4ff429477833c0f.zip gdb-224c3ddb89a43bf8db06c373d4ff429477833c0f.tar.gz gdb-224c3ddb89a43bf8db06c373d4ff429477833c0f.tar.bz2 |
Add casts to memory allocation related calls
Most allocation functions (if not all) return a void* pointing to the
allocated memory. In C++, we need to add an explicit cast when
assigning the result to a pointer to another type (which is the case
more often than not).
The content of this patch is taken from Pedro's branch, from commit
"(mostly) auto-generated patch to insert casts needed for C++". I
validated that the changes make sense and manually reflowed the code to
make it respect the coding style. I also found multiple places where I
could use XNEW/XNEWVEC/XRESIZEVEC/etc.
Thanks a lot to whoever did that automated script to insert casts, doing
it completely by hand would have taken a ridiculous amount of time.
Only files built on x86 with --enable-targets=all are modified. This
means that all other -nat.c files are untouched and will have to be
dealt with later by using appropiate compilers. Or maybe we can try to
build them with a regular g++ just to know where to add casts, I don't
know.
I built-tested this with --enable-targets=all and reg-tested.
Here's the changelog entry, which was not too bad to make despite the
size, thanks to David Malcom's script. I fixed some bits by hand, but
there might be some wrong parts left (hopefully not).
gdb/ChangeLog:
* aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Add cast
to allocation result assignment.
* ada-exp.y (write_object_renaming): Likewise.
(write_ambiguous_var): Likewise.
(ada_nget_field_index): Likewise.
(write_var_or_type): Likewise.
* ada-lang.c (ada_decode_symbol): Likewise.
(ada_value_assign): Likewise.
(value_pointer): Likewise.
(cache_symbol): Likewise.
(add_nonlocal_symbols): Likewise.
(ada_name_for_lookup): Likewise.
(symbol_completion_add): Likewise.
(ada_to_fixed_type_1): Likewise.
(ada_get_next_arg): Likewise.
(defns_collected): Likewise.
* ada-lex.l (processId): Likewise.
(processString): Likewise.
* ada-tasks.c (read_known_tasks_array): Likewise.
(read_known_tasks_list): Likewise.
* ada-typeprint.c (decoded_type_name): Likewise.
* addrmap.c (addrmap_mutable_create_fixed): Likewise.
* amd64-tdep.c (amd64_push_arguments): Likewise.
(amd64_displaced_step_copy_insn): Likewise.
(amd64_classify_insn_at): Likewise.
(amd64_relocate_instruction): Likewise.
* amd64obsd-tdep.c (amd64obsd_sigtramp_p): Likewise.
* arch-utils.c (simple_displaced_step_copy_insn): Likewise.
(initialize_current_architecture): Likewise.
* arm-linux-tdep.c (arm_stap_parse_special_token): Likewise.
* arm-symbian-tdep.c (arm_symbian_osabi_sniffer): Likewise.
* arm-tdep.c (arm_exidx_new_objfile): Likewise.
(arm_push_dummy_call): Likewise.
(extend_buffer_earlier): Likewise.
(arm_adjust_breakpoint_address): Likewise.
(arm_skip_stub): Likewise.
* auto-load.c (filename_is_in_pattern): Likewise.
(maybe_add_script_file): Likewise.
(maybe_add_script_text): Likewise.
(auto_load_objfile_script_1): Likewise.
* auxv.c (ld_so_xfer_auxv): Likewise.
* ax-general.c (new_agent_expr): Likewise.
(grow_expr): Likewise.
(ax_reg_mask): Likewise.
* bcache.c (bcache_full): Likewise.
* breakpoint.c (program_breakpoint_here_p): Likewise.
* btrace.c (parse_xml_raw): Likewise.
* build-id.c (build_id_to_debug_bfd): Likewise.
* buildsym.c (end_symtab_with_blockvector): Likewise.
* c-exp.y (string_exp): Likewise.
(qualified_name): Likewise.
(write_destructor_name): Likewise.
(operator_stoken): Likewise.
(parse_number): Likewise.
(scan_macro_expansion): Likewise.
(yylex): Likewise.
(c_print_token): Likewise.
* c-lang.c (c_get_string): Likewise.
(emit_numeric_character): Likewise.
* charset.c (wchar_iterate): Likewise.
* cli/cli-cmds.c (complete_command): Likewise.
(make_command): Likewise.
* cli/cli-dump.c (restore_section_callback): Likewise.
(restore_binary_file): Likewise.
* cli/cli-interp.c (cli_interpreter_exec): Likewise.
* cli/cli-script.c (execute_control_command): Likewise.
* cli/cli-setshow.c (do_set_command): Likewise.
* coff-pe-read.c (add_pe_forwarded_sym): Likewise.
(read_pe_exported_syms): Likewise.
* coffread.c (coff_read_struct_type): Likewise.
(coff_read_enum_type): Likewise.
* common/btrace-common.c (btrace_data_append): Likewise.
* common/buffer.c (buffer_grow): Likewise.
* common/filestuff.c (gdb_fopen_cloexec): Likewise.
* common/format.c (parse_format_string): Likewise.
* common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise.
* common/xml-utils.c (xml_escape_text): Likewise.
* compile/compile-object-load.c (copy_sections): Likewise.
(compile_object_load): Likewise.
* compile/compile-object-run.c (compile_object_run): Likewise.
* completer.c (filename_completer): Likewise.
* corefile.c (read_memory_typed_address): Likewise.
(write_memory_unsigned_integer): Likewise.
(write_memory_signed_integer): Likewise.
(complete_set_gnutarget): Likewise.
* corelow.c (get_core_register_section): Likewise.
* cp-name-parser.y (d_grab): Likewise.
(allocate_info): Likewise.
(cp_new_demangle_parse_info): Likewise.
* cp-namespace.c (cp_scan_for_anonymous_namespaces): Likewise.
(cp_lookup_symbol_in_namespace): Likewise.
(lookup_namespace_scope): Likewise.
(find_symbol_in_baseclass): Likewise.
(cp_lookup_nested_symbol): Likewise.
(cp_lookup_transparent_type_loop): Likewise.
* cp-support.c (copy_string_to_obstack): Likewise.
(make_symbol_overload_list): Likewise.
(make_symbol_overload_list_namespace): Likewise.
(make_symbol_overload_list_adl_namespace): Likewise.
(first_component_command): Likewise.
* cp-valprint.c (cp_print_value): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* d-exp.y (StringExp): Likewise.
* d-namespace.c (d_lookup_symbol_in_module): Likewise.
(lookup_module_scope): Likewise.
(find_symbol_in_baseclass): Likewise.
(d_lookup_nested_symbol): Likewise.
* dbxread.c (find_stab_function_addr): Likewise.
(read_dbx_symtab): Likewise.
(dbx_end_psymtab): Likewise.
(cp_set_block_scope): Likewise.
* dcache.c (dcache_alloc): Likewise.
* demangle.c (_initialize_demangler): Likewise.
* dicos-tdep.c (dicos_load_module_p): Likewise.
* dictionary.c (dict_create_hashed_expandable): Likewise.
(dict_create_linear_expandable): Likewise.
(expand_hashtable): Likewise.
(add_symbol_linear_expandable): Likewise.
* dwarf2-frame.c (add_cie): Likewise.
(add_fde): Likewise.
(dwarf2_build_frame_info): Likewise.
* dwarf2expr.c (dwarf_expr_grow_stack): Likewise.
(dwarf_expr_fetch_address): Likewise.
(add_piece): Likewise.
(execute_stack_op): Likewise.
* dwarf2loc.c (chain_candidate): Likewise.
(dwarf_entry_parameter_to_value): Likewise.
(read_pieced_value): Likewise.
(write_pieced_value): Likewise.
* dwarf2read.c (dwarf2_read_section): Likewise.
(add_type_unit): Likewise.
(read_comp_units_from_section): Likewise.
(fixup_go_packaging): Likewise.
(dwarf2_compute_name): Likewise.
(dwarf2_physname): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(read_func_scope): Likewise.
(read_call_site_scope): Likewise.
(dwarf2_attach_fields_to_type): Likewise.
(process_structure_scope): Likewise.
(mark_common_block_symbol_computed): Likewise.
(read_common_block): Likewise.
(abbrev_table_read_table): Likewise.
(guess_partial_die_structure_name): Likewise.
(fixup_partial_die): Likewise.
(add_file_name): Likewise.
(dwarf2_const_value_data): Likewise.
(dwarf2_const_value_attr): Likewise.
(build_error_marker_type): Likewise.
(guess_full_die_structure_name): Likewise.
(anonymous_struct_prefix): Likewise.
(typename_concat): Likewise.
(dwarf2_canonicalize_name): Likewise.
(dwarf2_name): Likewise.
(write_constant_as_bytes): Likewise.
(dwarf2_fetch_constant_bytes): Likewise.
(copy_string): Likewise.
(parse_macro_definition): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
(elf_rel_plt_read): Likewise.
(elf_gnu_ifunc_resolve_by_cache): Likewise.
(elf_gnu_ifunc_resolve_by_got): Likewise.
(elf_read_minimal_symbols): Likewise.
(elf_gnu_ifunc_record_cache): Likewise.
* event-top.c (top_level_prompt): Likewise.
(command_line_handler): Likewise.
* exec.c (resize_section_table): Likewise.
* expprint.c (print_subexp_standard): Likewise.
* fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise.
* findcmd.c (parse_find_args): Likewise.
* findvar.c (address_from_register): Likewise.
* frame.c (get_prev_frame_always): Likewise.
* gdb_bfd.c (gdb_bfd_ref): Likewise.
(get_section_descriptor): Likewise.
* gdb_obstack.c (obconcat): Likewise.
(obstack_strdup): Likewise.
* gdbtypes.c (lookup_function_type_with_arguments): Likewise.
(create_set_type): Likewise.
(lookup_unsigned_typename): Likewise.
(lookup_signed_typename): Likewise.
(resolve_dynamic_union): Likewise.
(resolve_dynamic_struct): Likewise.
(add_dyn_prop): Likewise.
(copy_dynamic_prop_list): Likewise.
(arch_flags_type): Likewise.
(append_composite_type_field_raw): Likewise.
* gdbtypes.h (INIT_FUNC_SPECIFIC): Likewise.
* gnu-v3-abi.c (gnuv3_rtti_type): Likewise.
* go-exp.y (string_exp): Likewise.
* go-lang.c (go_demangle): Likewise.
* guile/guile.c (compute_scheme_string): Likewise.
* guile/scm-cmd.c (gdbscm_parse_command_name): Likewise.
(gdbscm_canonicalize_command_name): Likewise.
* guile/scm-ports.c (ioscm_init_stdio_buffers): Likewise.
(ioscm_init_memory_port): Likewise.
(ioscm_reinit_memory_port): Likewise.
* guile/scm-utils.c (gdbscm_gc_xstrdup): Likewise.
(gdbscm_gc_dup_argv): Likewise.
* h8300-tdep.c (h8300_push_dummy_call): Likewise.
* hppa-tdep.c (internalize_unwinds): Likewise.
(read_unwind_info): Likewise.
* i386-cygwin-tdep.c (core_process_module_section): Likewise.
(windows_core_xfer_shared_libraries): Likewise.
* i386-tdep.c (i386_displaced_step_copy_insn): Likewise.
(i386_stap_parse_special_token_triplet): Likewise.
(i386_stap_parse_special_token_three_arg_disp): Likewise.
* i386obsd-tdep.c (i386obsd_sigtramp_p): Likewise.
* inf-child.c (inf_child_fileio_readlink): Likewise.
* inf-ptrace.c (inf_ptrace_fetch_register): Likewise.
(inf_ptrace_store_register): Likewise.
* infrun.c (follow_exec): Likewise.
(displaced_step_prepare_throw): Likewise.
(save_stop_context): Likewise.
(save_infcall_suspend_state): Likewise.
* jit.c (jit_read_descriptor): Likewise.
(jit_read_code_entry): Likewise.
(jit_symtab_line_mapping_add_impl): Likewise.
(finalize_symtab): Likewise.
(jit_unwind_reg_get_impl): Likewise.
* jv-exp.y (QualifiedName): Likewise.
* jv-lang.c (get_java_utf8_name): Likewise.
(type_from_class): Likewise.
(java_demangle_type_signature): Likewise.
(java_class_name_from_physname): Likewise.
* jv-typeprint.c (java_type_print_base): Likewise.
* jv-valprint.c (java_value_print): Likewise.
* language.c (add_language): Likewise.
* linespec.c (add_sal_to_sals_basic): Likewise.
(add_sal_to_sals): Likewise.
(decode_objc): Likewise.
(find_linespec_symbols): Likewise.
* linux-fork.c (fork_save_infrun_state): Likewise.
* linux-nat.c (linux_nat_detach): Likewise.
(linux_nat_fileio_readlink): Likewise.
* linux-record.c (record_linux_sockaddr): Likewise.
(record_linux_msghdr): Likewise.
(Do): Likewise.
* linux-tdep.c (linux_core_info_proc_mappings): Likewise.
(linux_collect_regset_section_cb): Likewise.
(linux_get_siginfo_data): Likewise.
* linux-thread-db.c (try_thread_db_load_from_pdir_1): Likewise.
(try_thread_db_load_from_dir): Likewise.
(thread_db_load_search): Likewise.
(info_auto_load_libthread_db): Likewise.
* m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise.
(m32c_m16c_pointer_to_address): Likewise.
* m68hc11-tdep.c (m68hc11_pseudo_register_write): Likewise.
* m68k-tdep.c (m68k_get_longjmp_target): Likewise.
* machoread.c (macho_check_dsym): Likewise.
* macroexp.c (resize_buffer): Likewise.
(gather_arguments): Likewise.
(maybe_expand): Likewise.
* macrotab.c (new_macro_key): Likewise.
(new_source_file): Likewise.
(new_macro_definition): Likewise.
* mdebugread.c (parse_symbol): Likewise.
(parse_type): Likewise.
(parse_partial_symbols): Likewise.
(psymtab_to_symtab_1): Likewise.
* mem-break.c (default_memory_insert_breakpoint): Likewise.
* mi/mi-cmd-break.c (mi_argv_to_format): Likewise.
* mi/mi-main.c (mi_cmd_data_read_memory): Likewise.
(mi_cmd_data_read_memory_bytes): Likewise.
(mi_cmd_data_write_memory_bytes): Likewise.
(mi_cmd_trace_frame_collected): Likewise.
* mi/mi-parse.c (mi_parse_argv): Likewise.
(mi_parse): Likewise.
* minidebug.c (lzma_open): Likewise.
(lzma_pread): Likewise.
* mips-tdep.c (mips_read_fp_register_single): Likewise.
(mips_print_fp_register): Likewise.
* mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise.
* mipsread.c (read_alphacoff_dynamic_symtab): Likewise.
* mt-tdep.c (mt_register_name): Likewise.
(mt_registers_info): Likewise.
(mt_push_dummy_call): Likewise.
* namespace.c (add_using_directive): Likewise.
* nat/linux-btrace.c (perf_event_read): Likewise.
(linux_enable_bts): Likewise.
* nat/linux-osdata.c (linux_common_core_of_thread): Likewise.
* nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Likewise.
* nto-tdep.c (nto_find_and_open_solib): Likewise.
(nto_parse_redirection): Likewise.
* objc-lang.c (objc_demangle): Likewise.
(find_methods): Likewise.
* objfiles.c (get_objfile_bfd_data): Likewise.
(set_objfile_main_name): Likewise.
(allocate_objfile): Likewise.
(objfile_relocate): Likewise.
(update_section_map): Likewise.
* osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise.
* p-exp.y (exp): Likewise.
(yylex): Likewise.
* p-valprint.c (pascal_object_print_value): Likewise.
* parse.c (initialize_expout): Likewise.
(mark_completion_tag): Likewise.
(copy_name): Likewise.
(parse_float): Likewise.
(type_stack_reserve): Likewise.
* ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise.
(ppu2spu_prev_register): Likewise.
* ppc-ravenscar-thread.c (supply_register_at_address): Likewise.
* printcmd.c (printf_wide_c_string): Likewise.
(printf_pointer): Likewise.
* probe.c (parse_probes): Likewise.
* python/py-cmd.c (gdbpy_parse_command_name): Likewise.
(cmdpy_init): Likewise.
* python/py-gdb-readline.c (gdbpy_readline_wrapper): Likewise.
* python/py-symtab.c (set_sal): Likewise.
* python/py-unwind.c (pyuw_sniffer): Likewise.
* python/python.c (python_interactive_command): Likewise.
(compute_python_string): Likewise.
* ravenscar-thread.c (get_running_thread_id): Likewise.
* record-full.c (record_full_exec_insn): Likewise.
(record_full_core_open_1): Likewise.
* regcache.c (regcache_raw_read_signed): Likewise.
(regcache_raw_read_unsigned): Likewise.
(regcache_cooked_read_signed): Likewise.
(regcache_cooked_read_unsigned): Likewise.
* remote-fileio.c (remote_fileio_func_open): Likewise.
(remote_fileio_func_rename): Likewise.
(remote_fileio_func_unlink): Likewise.
(remote_fileio_func_stat): Likewise.
(remote_fileio_func_system): Likewise.
* remote-mips.c (mips_xfer_memory): Likewise.
(mips_load_srec): Likewise.
(pmon_end_download): Likewise.
* remote.c (new_remote_state): Likewise.
(map_regcache_remote_table): Likewise.
(remote_register_number_and_offset): Likewise.
(init_remote_state): Likewise.
(get_memory_packet_size): Likewise.
(remote_pass_signals): Likewise.
(remote_program_signals): Likewise.
(remote_start_remote): Likewise.
(remote_check_symbols): Likewise.
(remote_query_supported): Likewise.
(extended_remote_attach): Likewise.
(process_g_packet): Likewise.
(store_registers_using_G): Likewise.
(putpkt_binary): Likewise.
(read_frame): Likewise.
(compare_sections_command): Likewise.
(remote_hostio_pread): Likewise.
(remote_hostio_readlink): Likewise.
(remote_file_put): Likewise.
(remote_file_get): Likewise.
(remote_pid_to_exec_file): Likewise.
(_initialize_remote): Likewise.
* rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise.
(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
* rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise.
(bfd_uses_spe_extensions): Likewise.
* s390-linux-tdep.c (s390_displaced_step_copy_insn): Likewise.
* score-tdep.c (score7_malloc_and_get_memblock): Likewise.
* solib-dsbt.c (decode_loadmap): Likewise.
(fetch_loadmap): Likewise.
(scan_dyntag): Likewise.
(enable_break): Likewise.
(dsbt_relocate_main_executable): Likewise.
* solib-frv.c (fetch_loadmap): Likewise.
(enable_break2): Likewise.
(frv_relocate_main_executable): Likewise.
* solib-spu.c (spu_relocate_main_executable): Likewise.
(spu_bfd_open): Likewise.
* solib-svr4.c (lm_info_read): Likewise.
(read_program_header): Likewise.
(find_program_interpreter): Likewise.
(scan_dyntag): Likewise.
(elf_locate_base): Likewise.
(open_symbol_file_object): Likewise.
(read_program_headers_from_bfd): Likewise.
(svr4_relocate_main_executable): Likewise.
* solib-target.c (solib_target_relocate_section_addresses): Likewise.
* solib.c (solib_find_1): Likewise.
(exec_file_find): Likewise.
(solib_find): Likewise.
* source.c (openp): Likewise.
(print_source_lines_base): Likewise.
(forward_search_command): Likewise.
* sparc-ravenscar-thread.c (supply_register_at_address): Likewise.
* spu-tdep.c (spu2ppu_prev_register): Likewise.
(spu_get_overlay_table): Likewise.
* stabsread.c (patch_block_stabs): Likewise.
(define_symbol): Likewise.
(again:): Likewise.
(read_member_functions): Likewise.
(read_one_struct_field): Likewise.
(read_enum_type): Likewise.
(common_block_start): Likewise.
* stack.c (read_frame_arg): Likewise.
(backtrace_command): Likewise.
* stap-probe.c (stap_parse_register_operand): Likewise.
* symfile.c (syms_from_objfile_1): Likewise.
(find_separate_debug_file): Likewise.
(load_command): Likewise.
(load_progress): Likewise.
(load_section_callback): Likewise.
(reread_symbols): Likewise.
(add_filename_language): Likewise.
(allocate_compunit_symtab): Likewise.
(read_target_long_array): Likewise.
(simple_read_overlay_table): Likewise.
* symtab.c (symbol_set_names): Likewise.
(resize_symbol_cache): Likewise.
(rbreak_command): Likewise.
(completion_list_add_name): Likewise.
(completion_list_objc_symbol): Likewise.
(add_filename_to_list): Likewise.
* target-descriptions.c (maint_print_c_tdesc_cmd): Likewise.
* target-memory.c (target_write_memory_blocks): Likewise.
* target.c (target_read_string): Likewise.
(read_whatever_is_readable): Likewise.
(target_read_alloc_1): Likewise.
(simple_search_memory): Likewise.
(target_fileio_read_alloc_1): Likewise.
* tilegx-tdep.c (tilegx_push_dummy_call): Likewise.
* top.c (command_line_input): Likewise.
* tracefile-tfile.c (tfile_fetch_registers): Likewise.
* tracefile.c (tracefile_fetch_registers): Likewise.
* tracepoint.c (add_memrange): Likewise.
(init_collection_list): Likewise.
(add_aexpr): Likewise.
(trace_dump_actions): Likewise.
(parse_trace_status): Likewise.
(parse_tracepoint_definition): Likewise.
(parse_tsv_definition): Likewise.
(parse_static_tracepoint_marker_definition): Likewise.
* tui/tui-file.c (tui_sfileopen): Likewise.
(tui_file_adjust_strbuf): Likewise.
* tui/tui-io.c (tui_expand_tabs): Likewise.
* tui/tui-source.c (tui_set_source_content): Likewise.
* typeprint.c (find_global_typedef): Likewise.
* ui-file.c (do_ui_file_xstrdup): Likewise.
(ui_file_obsavestring): Likewise.
(mem_file_write): Likewise.
* utils.c (make_hex_string): Likewise.
(get_regcomp_error): Likewise.
(puts_filtered_tabular): Likewise.
(gdb_realpath_keepfile): Likewise.
(ldirname): Likewise.
(gdb_bfd_errmsg): Likewise.
(substitute_path_component): Likewise.
* valops.c (search_struct_method): Likewise.
(find_oload_champ_namespace_loop): Likewise.
* valprint.c (print_decimal_chars): Likewise.
(read_string): Likewise.
(generic_emit_char): Likewise.
* varobj.c (varobj_delete): Likewise.
(varobj_value_get_print_value): Likewise.
* vaxobsd-tdep.c (vaxobsd_sigtramp_sniffer): Likewise.
* windows-tdep.c (display_one_tib): Likewise.
* xcoffread.c (read_xcoff_symtab): Likewise.
(process_xcoff_symbol): Likewise.
(swap_sym): Likewise.
(scan_xcoff_symtab): Likewise.
(xcoff_initial_scan): Likewise.
* xml-support.c (gdb_xml_end_element): Likewise.
(xml_process_xincludes): Likewise.
(xml_fetch_content_from_file): Likewise.
* xml-syscall.c (xml_list_of_syscalls): Likewise.
* xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise.
gdb/gdbserver/ChangeLog:
* ax.c (gdb_parse_agent_expr): Add cast to allocation result
assignment.
(gdb_unparse_agent_expr): Likewise.
* hostio.c (require_data): Likewise.
(handle_pread): Likewise.
* linux-low.c (disable_regset): Likewise.
(fetch_register): Likewise.
(store_register): Likewise.
(get_dynamic): Likewise.
(linux_qxfer_libraries_svr4): Likewise.
* mem-break.c (delete_fast_tracepoint_jump): Likewise.
(set_fast_tracepoint_jump): Likewise.
(uninsert_fast_tracepoint_jumps_at): Likewise.
(reinsert_fast_tracepoint_jumps_at): Likewise.
(validate_inserted_breakpoint): Likewise.
(clone_agent_expr): Likewise.
* regcache.c (init_register_cache): Likewise.
* remote-utils.c (putpkt_binary_1): Likewise.
(decode_M_packet): Likewise.
(decode_X_packet): Likewise.
(look_up_one_symbol): Likewise.
(relocate_instruction): Likewise.
(monitor_output): Likewise.
* server.c (handle_search_memory): Likewise.
(handle_qxfer_exec_file): Likewise.
(handle_qxfer_libraries): Likewise.
(handle_qxfer): Likewise.
(handle_query): Likewise.
(handle_v_cont): Likewise.
(handle_v_run): Likewise.
(captured_main): Likewise.
* target.c (write_inferior_memory): Likewise.
* thread-db.c (try_thread_db_load_from_dir): Likewise.
* tracepoint.c (init_trace_buffer): Likewise.
(add_tracepoint_action): Likewise.
(add_traceframe): Likewise.
(add_traceframe_block): Likewise.
(cmd_qtdpsrc): Likewise.
(cmd_qtdv): Likewise.
(cmd_qtstatus): Likewise.
(response_source): Likewise.
(response_tsv): Likewise.
(cmd_qtnotes): Likewise.
(gdb_collect): Likewise.
(initialize_tracepoint): Likewise.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 48 | ||||
-rw-r--r-- | gdb/gdbserver/ax.c | 4 | ||||
-rw-r--r-- | gdb/gdbserver/hostio.c | 4 | ||||
-rw-r--r-- | gdb/gdbserver/linux-low.c | 12 | ||||
-rw-r--r-- | gdb/gdbserver/mem-break.c | 14 | ||||
-rw-r--r-- | gdb/gdbserver/regcache.c | 6 | ||||
-rw-r--r-- | gdb/gdbserver/remote-utils.c | 12 | ||||
-rw-r--r-- | gdb/gdbserver/server.c | 28 | ||||
-rw-r--r-- | gdb/gdbserver/target.c | 2 | ||||
-rw-r--r-- | gdb/gdbserver/thread-db.c | 2 | ||||
-rw-r--r-- | gdb/gdbserver/tracepoint.c | 61 |
11 files changed, 122 insertions, 71 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index d09c454..d6ce174 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,51 @@ +2015-09-25 Simon Marchi <simon.marchi@ericsson.com> + + * ax.c (gdb_parse_agent_expr): Add cast to allocation result + assignment. + (gdb_unparse_agent_expr): Likewise. + * hostio.c (require_data): Likewise. + (handle_pread): Likewise. + * linux-low.c (disable_regset): Likewise. + (fetch_register): Likewise. + (store_register): Likewise. + (get_dynamic): Likewise. + (linux_qxfer_libraries_svr4): Likewise. + * mem-break.c (delete_fast_tracepoint_jump): Likewise. + (set_fast_tracepoint_jump): Likewise. + (uninsert_fast_tracepoint_jumps_at): Likewise. + (reinsert_fast_tracepoint_jumps_at): Likewise. + (validate_inserted_breakpoint): Likewise. + (clone_agent_expr): Likewise. + * regcache.c (init_register_cache): Likewise. + * remote-utils.c (putpkt_binary_1): Likewise. + (decode_M_packet): Likewise. + (decode_X_packet): Likewise. + (look_up_one_symbol): Likewise. + (relocate_instruction): Likewise. + (monitor_output): Likewise. + * server.c (handle_search_memory): Likewise. + (handle_qxfer_exec_file): Likewise. + (handle_qxfer_libraries): Likewise. + (handle_qxfer): Likewise. + (handle_query): Likewise. + (handle_v_cont): Likewise. + (handle_v_run): Likewise. + (captured_main): Likewise. + * target.c (write_inferior_memory): Likewise. + * thread-db.c (try_thread_db_load_from_dir): Likewise. + * tracepoint.c (init_trace_buffer): Likewise. + (add_tracepoint_action): Likewise. + (add_traceframe): Likewise. + (add_traceframe_block): Likewise. + (cmd_qtdpsrc): Likewise. + (cmd_qtdv): Likewise. + (cmd_qtstatus): Likewise. + (response_source): Likewise. + (response_tsv): Likewise. + (cmd_qtnotes): Likewise. + (gdb_collect): Likewise. + (initialize_tracepoint): Likewise. + 2015-09-21 Pierre Langlois <pierre.langlois@arm.com> * linux-aarch64-low-.c: Include ax.h and tracepoint.h. diff --git a/gdb/gdbserver/ax.c b/gdb/gdbserver/ax.c index 3d0d93d..4c9dadc 100644 --- a/gdb/gdbserver/ax.c +++ b/gdb/gdbserver/ax.c @@ -106,7 +106,7 @@ gdb_parse_agent_expr (char **actparm) ++act; /* skip a comma */ aexpr = XNEW (struct agent_expr); aexpr->length = xlen; - aexpr->bytes = xmalloc (xlen); + aexpr->bytes = (unsigned char *) xmalloc (xlen); hex2bin (act, aexpr->bytes, xlen); *actparm = act + (xlen * 2); return aexpr; @@ -131,7 +131,7 @@ gdb_unparse_agent_expr (struct agent_expr *aexpr) { char *rslt; - rslt = xmalloc (2 * aexpr->length + 1); + rslt = (char *) xmalloc (2 * aexpr->length + 1); bin2hex (aexpr->bytes, rslt, aexpr->length); return rslt; } diff --git a/gdb/gdbserver/hostio.c b/gdb/gdbserver/hostio.c index a631d9e..48fa6f3 100644 --- a/gdb/gdbserver/hostio.c +++ b/gdb/gdbserver/hostio.c @@ -126,7 +126,7 @@ require_data (char *p, int p_len, char **data, int *data_len) { int input_index, output_index, escaped; - *data = xmalloc (p_len); + *data = (char *) xmalloc (p_len); output_index = 0; escaped = 0; @@ -371,7 +371,7 @@ handle_pread (char *own_buf, int *new_packet_len) if (len > max_reply_size) len = max_reply_size; - data = xmalloc (len); + data = (char *) xmalloc (len); #ifdef HAVE_PREAD ret = pread (fd, data, len, offset); #else diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index f5b64ab..12a2332 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -4896,7 +4896,7 @@ disable_regset (struct regsets_info *info, struct regset_info *regset) dr_offset = regset - info->regsets; if (info->disabled_regsets == NULL) - info->disabled_regsets = xcalloc (1, info->num_regsets); + info->disabled_regsets = (char *) xcalloc (1, info->num_regsets); info->disabled_regsets[dr_offset] = 1; } @@ -5119,7 +5119,7 @@ fetch_register (const struct usrregs_info *usrregs, size = ((register_size (regcache->tdesc, regno) + sizeof (PTRACE_XFER_TYPE) - 1) & -sizeof (PTRACE_XFER_TYPE)); - buf = alloca (size); + buf = (char *) alloca (size); pid = lwpid_of (current_thread); for (i = 0; i < size; i += sizeof (PTRACE_XFER_TYPE)) @@ -5163,7 +5163,7 @@ store_register (const struct usrregs_info *usrregs, size = ((register_size (regcache->tdesc, regno) + sizeof (PTRACE_XFER_TYPE) - 1) & -sizeof (PTRACE_XFER_TYPE)); - buf = alloca (size); + buf = (char *) alloca (size); memset (buf, 0, size); if (the_low_target.collect_ptrace_register) @@ -6324,7 +6324,7 @@ get_dynamic (const int pid, const int is_elf64) return 0; gdb_assert (num_phdr < 100); /* Basic sanity check. */ - phdr_buf = alloca (num_phdr * phdr_size); + phdr_buf = (unsigned char *) alloca (num_phdr * phdr_size); if (linux_read_memory (phdr_memaddr, phdr_buf, num_phdr * phdr_size)) return 0; @@ -6653,7 +6653,7 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf, } } - document = xmalloc (allocated); + document = (char *) xmalloc (allocated); strcpy (document, "<library-list-svr4 version=\"1.0\""); p = document + strlen (document); @@ -6714,7 +6714,7 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf, /* Expand to guarantee sufficient storage. */ uintptr_t document_len = p - document; - document = xrealloc (document, 2 * allocated); + document = (char *) xrealloc (document, 2 * allocated); allocated *= 2; p = document + document_len; } diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c index 9356741..f077497 100644 --- a/gdb/gdbserver/mem-break.c +++ b/gdb/gdbserver/mem-break.c @@ -527,7 +527,7 @@ delete_fast_tracepoint_jump (struct fast_tracepoint_jump *todel) pass the current shadow contents, because write_inferior_memory updates any shadow memory with what we pass here, and we want that to be a nop. */ - buf = alloca (bp->length); + buf = (unsigned char *) alloca (bp->length); memcpy (buf, fast_tracepoint_jump_shadow (bp), bp->length); ret = write_inferior_memory (bp->pc, buf, bp->length); if (ret != 0) @@ -585,12 +585,12 @@ set_fast_tracepoint_jump (CORE_ADDR where, /* We don't, so create a new object. Double the length, because the flexible array member holds both the jump insn, and the shadow. */ - jp = xcalloc (1, sizeof (*jp) + (length * 2)); + jp = (struct fast_tracepoint_jump *) xcalloc (1, sizeof (*jp) + (length * 2)); jp->pc = where; jp->length = length; memcpy (fast_tracepoint_jump_insn (jp), insn, length); jp->refcount = 1; - buf = alloca (length); + buf = (unsigned char *) alloca (length); /* Note that there can be trap breakpoints inserted in the same address range. To access the original memory contents, we use @@ -670,7 +670,7 @@ uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc) pass the current shadow contents, because write_inferior_memory updates any shadow memory with what we pass here, and we want that to be a nop. */ - buf = alloca (jp->length); + buf = (unsigned char *) alloca (jp->length); memcpy (buf, fast_tracepoint_jump_shadow (jp), jp->length); err = write_inferior_memory (jp->pc, buf, jp->length); if (err != 0) @@ -717,7 +717,7 @@ reinsert_fast_tracepoint_jumps_at (CORE_ADDR where) to pass the current shadow contents, because write_inferior_memory updates any shadow memory with what we pass here, and we want that to be a nop. */ - buf = alloca (jp->length); + buf = (unsigned char *) alloca (jp->length); memcpy (buf, fast_tracepoint_jump_shadow (jp), jp->length); err = write_inferior_memory (where, buf, jp->length); if (err != 0) @@ -1669,7 +1669,7 @@ validate_inserted_breakpoint (struct raw_breakpoint *bp) gdb_assert (bp->inserted); gdb_assert (bp->raw_type == raw_bkpt_type_sw); - buf = alloca (breakpoint_len); + buf = (unsigned char *) alloca (breakpoint_len); err = (*the_target->read_memory) (bp->pc, buf, breakpoint_len); if (err || memcmp (buf, breakpoint_data, breakpoint_len) != 0) { @@ -1939,7 +1939,7 @@ clone_agent_expr (const struct agent_expr *src_ax) ax = XCNEW (struct agent_expr); ax->length = src_ax->length; - ax->bytes = xcalloc (ax->length, 1); + ax->bytes = (unsigned char *) xcalloc (ax->length, 1); memcpy (ax->bytes, src_ax->bytes, ax->length); return ax; } diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c index 59bdc53..f79063c 100644 --- a/gdb/gdbserver/regcache.c +++ b/gdb/gdbserver/regcache.c @@ -131,9 +131,11 @@ init_register_cache (struct regcache *regcache, fetches. This way they'll read as zero instead of garbage. */ regcache->tdesc = tdesc; - regcache->registers = xcalloc (1, tdesc->registers_size); + regcache->registers + = (unsigned char *) xcalloc (1, tdesc->registers_size); regcache->registers_owned = 1; - regcache->register_status = xcalloc (1, tdesc->num_registers); + regcache->register_status + = (unsigned char *) xcalloc (1, tdesc->num_registers); gdb_assert (REG_UNAVAILABLE == 0); #else gdb_assert_not_reached ("can't allocate memory from the heap"); diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index 7cf66cc..e366091 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -622,7 +622,7 @@ putpkt_binary_1 (char *buf, int cnt, int is_notif) char *p; int cc; - buf2 = xmalloc (strlen ("$") + cnt + strlen ("#nn") + 1); + buf2 = (char *) xmalloc (strlen ("$") + cnt + strlen ("#nn") + 1); /* Copy the packet into buffer BUF2, encapsulating it and giving it a checksum. */ @@ -1325,7 +1325,7 @@ decode_M_packet (char *from, CORE_ADDR *mem_addr_ptr, unsigned int *len_ptr, } if (*to_p == NULL) - *to_p = xmalloc (*len_ptr); + *to_p = (unsigned char *) xmalloc (*len_ptr); hex2bin (&from[i++], *to_p, *len_ptr); } @@ -1351,7 +1351,7 @@ decode_X_packet (char *from, int packet_len, CORE_ADDR *mem_addr_ptr, } if (*to_p == NULL) - *to_p = xmalloc (*len_ptr); + *to_p = (unsigned char *) xmalloc (*len_ptr); if (remote_unescape_input ((const gdb_byte *) &from[i], packet_len - i, *to_p, *len_ptr) != *len_ptr) @@ -1478,7 +1478,7 @@ look_up_one_symbol (const char *name, CORE_ADDR *addrp, int may_ask_gdb) unsigned int mem_len; decode_m_packet (&own_buf[1], &mem_addr, &mem_len); - mem_buf = xmalloc (mem_len); + mem_buf = (unsigned char *) xmalloc (mem_len); if (read_inferior_memory (mem_addr, mem_buf, mem_len) == 0) bin2hex (mem_buf, own_buf, mem_len); else @@ -1562,7 +1562,7 @@ relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc) if (own_buf[0] == 'm') { decode_m_packet (&own_buf[1], &mem_addr, &mem_len); - mem_buf = xmalloc (mem_len); + mem_buf = (unsigned char *) xmalloc (mem_len); if (read_inferior_memory (mem_addr, mem_buf, mem_len) == 0) bin2hex (mem_buf, own_buf, mem_len); else @@ -1617,7 +1617,7 @@ void monitor_output (const char *msg) { int len = strlen (msg); - char *buf = xmalloc (len * 2 + 2); + char *buf = (char *) xmalloc (len * 2 + 2); buf[0] = 'O'; bin2hex ((const gdb_byte *) msg, buf + 1, len); diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 827316f..53763e5 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -959,7 +959,7 @@ handle_search_memory (char *own_buf, int packet_len) CORE_ADDR found_addr; int cmd_name_len = sizeof ("qSearch:memory:") - 1; - pattern = malloc (packet_len); + pattern = (gdb_byte *) malloc (packet_len); if (pattern == NULL) { error ("Unable to allocate memory to perform the search"); @@ -983,7 +983,7 @@ handle_search_memory (char *own_buf, int packet_len) if (search_space_len < search_buf_size) search_buf_size = search_space_len; - search_buf = malloc (search_buf_size); + search_buf = (gdb_byte *) malloc (search_buf_size); if (search_buf == NULL) { free (pattern); @@ -1211,7 +1211,7 @@ handle_qxfer_exec_file (const char *const_annex, } else { - char *annex = alloca (strlen (const_annex) + 1); + char *annex = (char *) alloca (strlen (const_annex) + 1); strcpy (annex, const_annex); annex = unpack_varlen_hex (annex, &pid); @@ -1334,7 +1334,7 @@ handle_qxfer_libraries (const char *annex, for_each_inferior_with_data (&all_dlls, accumulate_file_name_length, &total_len); - document = malloc (total_len); + document = (char *) malloc (total_len); if (document == NULL) return -1; @@ -1795,7 +1795,7 @@ handle_qxfer (char *own_buf, int packet_len, int *new_packet_len_p) more. */ if (len > PBUFSIZ - 2) len = PBUFSIZ - 2; - data = malloc (len + 1); + data = (unsigned char *) malloc (len + 1); if (data == NULL) { write_enn (own_buf); @@ -1829,7 +1829,7 @@ handle_qxfer (char *own_buf, int packet_len, int *new_packet_len_p) unsigned char *data; strcpy (own_buf, "E00"); - data = malloc (packet_len - (offset - own_buf)); + data = (unsigned char *) malloc (packet_len - (offset - own_buf)); if (data == NULL) { write_enn (own_buf); @@ -2071,7 +2071,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) p = strtok (NULL, ";")) { count++; - qsupported = xrealloc (qsupported, count * sizeof (char *)); + qsupported = XRESIZEVEC (char *, qsupported, count); qsupported[count - 1] = xstrdup (p); } @@ -2334,7 +2334,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) /* Handle "monitor" commands. */ if (startswith (own_buf, "qRcmd,")) { - char *mon = malloc (PBUFSIZ); + char *mon = (char *) malloc (PBUFSIZ); int len = strlen (own_buf + 6); if (mon == NULL) @@ -2523,7 +2523,7 @@ handle_v_cont (char *own_buf) p = strchr (p, ';'); } - resume_info = malloc (n * sizeof (resume_info[0])); + resume_info = (struct thread_resume *) malloc (n * sizeof (resume_info[0])); if (resume_info == NULL) goto err; @@ -2718,7 +2718,7 @@ handle_v_run (char *own_buf) new_argc++; } - new_argv = calloc (new_argc + 2, sizeof (char *)); + new_argv = (char **) calloc (new_argc + 2, sizeof (char *)); if (new_argv == NULL) { write_enn (own_buf); @@ -2737,7 +2737,7 @@ handle_v_run (char *own_buf) else { /* FIXME: Fail request if out of memory instead of dying. */ - new_argv[i] = xmalloc (1 + (next_p - p) / 2); + new_argv[i] = (char *) xmalloc (1 + (next_p - p) / 2); hex2bin (p, (gdb_byte *) new_argv[i], (next_p - p) / 2); new_argv[i][(next_p - p) / 2] = '\0'; } @@ -3524,15 +3524,15 @@ captured_main (int argc, char *argv[]) initialize_tracepoint (); initialize_notif (); - own_buf = xmalloc (PBUFSIZ + 1); - mem_buf = xmalloc (PBUFSIZ); + own_buf = (char *) xmalloc (PBUFSIZ + 1); + mem_buf = (unsigned char *) xmalloc (PBUFSIZ); if (pid == 0 && *next_arg != NULL) { int i, n; n = argc - (next_arg - argv); - program_argv = xmalloc (sizeof (char *) * (n + 1)); + program_argv = XNEWVEC (char *, n + 1); for (i = 0; i < n; i++) program_argv[i] = xstrdup (next_arg[i]); program_argv[i] = NULL; diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c index 17ff7a6..301f90e 100644 --- a/gdb/gdbserver/target.c +++ b/gdb/gdbserver/target.c @@ -75,7 +75,7 @@ write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr, if (buffer != NULL) free (buffer); - buffer = xmalloc (len); + buffer = (unsigned char *) xmalloc (len); memcpy (buffer, myaddr, len); check_mem_write (memaddr, buffer, myaddr, len); res = (*the_target->write_memory) (memaddr, buffer, len); diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c index cd07c52..f5fdf10 100644 --- a/gdb/gdbserver/thread-db.c +++ b/gdb/gdbserver/thread-db.c @@ -749,7 +749,7 @@ try_thread_db_load_from_dir (const char *dir, size_t dir_len) if (dir_len + 1 + strlen (LIBTHREAD_DB_SO) + 1 > sizeof (path)) { - char *cp = xmalloc (dir_len + 1); + char *cp = (char *) xmalloc (dir_len + 1); memcpy (cp, dir, dir_len); cp[dir_len] = '\0'; diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c index 6b50f26..1b3a5d0 100644 --- a/gdb/gdbserver/tracepoint.c +++ b/gdb/gdbserver/tracepoint.c @@ -1497,7 +1497,7 @@ init_trace_buffer (LONGEST bufsize) marker. */ alloc_size = (bufsize < TRACEFRAME_EOB_MARKER_SIZE ? TRACEFRAME_EOB_MARKER_SIZE : bufsize); - trace_buffer_lo = xrealloc (trace_buffer_lo, alloc_size); + trace_buffer_lo = (unsigned char *) xrealloc (trace_buffer_lo, alloc_size); trace_buffer_hi = trace_buffer_lo + trace_buffer_size; @@ -2024,13 +2024,11 @@ add_tracepoint_action (struct tracepoint *tpoint, char *packet) tpoint->num_step_actions++; tpoint->step_actions - = xrealloc (tpoint->step_actions, - (sizeof (*tpoint->step_actions) - * tpoint->num_step_actions)); + = XRESIZEVEC (struct tracepoint_action *, tpoint->step_actions, + tpoint->num_step_actions); tpoint->step_actions_str - = xrealloc (tpoint->step_actions_str, - (sizeof (*tpoint->step_actions_str) - * tpoint->num_step_actions)); + = XRESIZEVEC (char *, tpoint->step_actions_str, + tpoint->num_step_actions); tpoint->step_actions[tpoint->num_step_actions - 1] = action; tpoint->step_actions_str[tpoint->num_step_actions - 1] = savestring (act_start, act - act_start); @@ -2039,11 +2037,10 @@ add_tracepoint_action (struct tracepoint *tpoint, char *packet) { tpoint->numactions++; tpoint->actions - = xrealloc (tpoint->actions, - sizeof (*tpoint->actions) * tpoint->numactions); + = XRESIZEVEC (struct tracepoint_action *, tpoint->actions, + tpoint->numactions); tpoint->actions_str - = xrealloc (tpoint->actions_str, - sizeof (*tpoint->actions_str) * tpoint->numactions); + = XRESIZEVEC (char *, tpoint->actions_str, tpoint->numactions); tpoint->actions[tpoint->numactions - 1] = action; tpoint->actions_str[tpoint->numactions - 1] = savestring (act_start, act - act_start); @@ -2201,7 +2198,8 @@ add_traceframe (struct tracepoint *tpoint) { struct traceframe *tframe; - tframe = trace_buffer_alloc (sizeof (struct traceframe)); + tframe + = (struct traceframe *) trace_buffer_alloc (sizeof (struct traceframe)); if (tframe == NULL) return NULL; @@ -2223,7 +2221,7 @@ add_traceframe_block (struct traceframe *tframe, if (!tframe) return NULL; - block = trace_buffer_alloc (amt); + block = (unsigned char *) trace_buffer_alloc (amt); if (!block) return NULL; @@ -2685,7 +2683,7 @@ cmd_qtdpsrc (char *own_buf) saved = packet; packet = strchr (packet, ':'); - srctype = xmalloc (packet - saved + 1); + srctype = (char *) xmalloc (packet - saved + 1); memcpy (srctype, saved, packet - saved); srctype[packet - saved] = '\0'; ++packet; @@ -2693,7 +2691,7 @@ cmd_qtdpsrc (char *own_buf) ++packet; /* skip a colon */ packet = unpack_varlen_hex (packet, &slen); ++packet; /* skip a colon */ - src = xmalloc (slen + 1); + src = (char *) xmalloc (slen + 1); nbytes = hex2bin (packet, (gdb_byte *) src, strlen (packet) / 2); src[nbytes] = '\0'; @@ -2735,7 +2733,7 @@ cmd_qtdv (char *own_buf) ++packet; /* skip a colon */ nbytes = strlen (packet) / 2; - varname = xmalloc (nbytes + 1); + varname = (char *) xmalloc (nbytes + 1); nbytes = hex2bin (packet, (gdb_byte *) varname, nbytes); varname[nbytes] = '\0'; @@ -3659,7 +3657,8 @@ cmd_qtstatus (char *packet) result_name = stop_reason_rsp + strlen ("terror:"); hexstr_len = strlen (result_name) * 2; - p = stop_reason_rsp = alloca (strlen ("terror:") + hexstr_len + 1); + p = stop_reason_rsp + = (char *) alloca (strlen ("terror:") + hexstr_len + 1); strcpy (p, "terror:"); p += strlen (p); bin2hex ((gdb_byte *) result_name, p, strlen (result_name)); @@ -3668,7 +3667,7 @@ cmd_qtstatus (char *packet) /* If this was a forced stop, include any stop note that was supplied. */ if (strcmp (stop_reason_rsp, "tstop") == 0) { - stop_reason_rsp = alloca (strlen ("tstop:") + strlen (buf3) + 1); + stop_reason_rsp = (char *) alloca (strlen ("tstop:") + strlen (buf3) + 1); strcpy (stop_reason_rsp, "tstop:"); strcat (stop_reason_rsp, buf3); } @@ -3780,7 +3779,7 @@ response_source (char *packet, int len; len = strlen (src->str); - buf = alloca (len * 2 + 1); + buf = (char *) alloca (len * 2 + 1); bin2hex ((gdb_byte *) src->str, buf, len); sprintf (packet, "Z%x:%s:%s:%x:%x:%s", @@ -3869,7 +3868,7 @@ response_tsv (char *packet, struct trace_state_variable *tsv) if (tsv->name) { namelen = strlen (tsv->name); - buf = alloca (namelen * 2 + 1); + buf = (char *) alloca (namelen * 2 + 1); bin2hex ((gdb_byte *) tsv->name, buf, namelen); } @@ -4110,7 +4109,7 @@ cmd_qtnotes (char *own_buf) saved = packet; packet = strchr (packet, ';'); nbytes = (packet - saved) / 2; - user = xmalloc (nbytes + 1); + user = (char *) xmalloc (nbytes + 1); nbytes = hex2bin (saved, (gdb_byte *) user, nbytes); user[nbytes] = '\0'; ++packet; /* skip the semicolon */ @@ -4124,7 +4123,7 @@ cmd_qtnotes (char *own_buf) saved = packet; packet = strchr (packet, ';'); nbytes = (packet - saved) / 2; - notes = xmalloc (nbytes + 1); + notes = (char *) xmalloc (nbytes + 1); nbytes = hex2bin (saved, (gdb_byte *) notes, nbytes); notes[nbytes] = '\0'; ++packet; /* skip the semicolon */ @@ -4138,7 +4137,7 @@ cmd_qtnotes (char *own_buf) saved = packet; packet = strchr (packet, ';'); nbytes = (packet - saved) / 2; - stopnote = xmalloc (nbytes + 1); + stopnote = (char *) xmalloc (nbytes + 1); nbytes = hex2bin (saved, (gdb_byte *) stopnote, nbytes); stopnote[nbytes] = '\0'; ++packet; /* skip the semicolon */ @@ -5800,7 +5799,7 @@ gdb_collect (struct tracepoint *tpoint, unsigned char *regs) ctx.regcache_initted = 0; /* Wrap the regblock in a register cache (in the stack, we don't want to malloc here). */ - ctx.regspace = alloca (ipa_tdesc->registers_size); + ctx.regspace = (unsigned char *) alloca (ipa_tdesc->registers_size); if (ctx.regspace == NULL) { trace_debug ("Trace buffer block allocation failed, skipping"); @@ -7365,7 +7364,7 @@ initialize_tracepoint (void) if (pagesize == -1) perror_with_name ("sysconf"); - gdb_tp_heap_buffer = xmalloc (5 * 1024 * 1024); + gdb_tp_heap_buffer = (char *) xmalloc (5 * 1024 * 1024); #define SCRATCH_BUFFER_NPAGES 20 @@ -7373,10 +7372,12 @@ initialize_tracepoint (void) address (close to the main executable's code). */ for (addr = pagesize; addr != 0; addr += pagesize) { - gdb_jump_pad_buffer = mmap ((void *) addr, pagesize * SCRATCH_BUFFER_NPAGES, - PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, - -1, 0); + gdb_jump_pad_buffer + = (char *) mmap ((void *) addr, + pagesize * SCRATCH_BUFFER_NPAGES, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, + -1, 0); if (gdb_jump_pad_buffer != MAP_FAILED) break; } @@ -7393,7 +7394,7 @@ initialize_tracepoint (void) buffer setup, but it can be mysterious, so create a channel to report back on what went wrong, using a fixed size since we may not be able to allocate space later when the problem occurs. */ - gdb_trampoline_buffer_error = xmalloc (IPA_BUFSIZ); + gdb_trampoline_buffer_error = (char *) xmalloc (IPA_BUFSIZ); strcpy (gdb_trampoline_buffer_error, "No errors reported"); |