aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-04-05 19:21:37 +0100
committerPedro Alves <palves@redhat.com>2017-04-05 19:21:37 +0100
commita121b7c1ac76833018f4fc3adaeddc3147272dd0 (patch)
tree9e044ce8ef97570e6cce69381c49fa0a22339015
parent-Wwrite-strings: More Solaris (diff)
downloadbinutils-gdb-a121b7c1ac76833018f4fc3adaeddc3147272dd0.tar.gz
binutils-gdb-a121b7c1ac76833018f4fc3adaeddc3147272dd0.tar.bz2
binutils-gdb-a121b7c1ac76833018f4fc3adaeddc3147272dd0.zip
-Wwrite-strings: The Rest
This is the remainder boring constification that all looks more of less borderline obvious IMO. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * ada-exp.y (yyerror): Constify. * ada-lang.c (bound_name, get_selections) (ada_variant_discrim_type) (ada_variant_discrim_name, ada_value_struct_elt) (ada_lookup_struct_elt_type, is_unchecked_variant) (ada_which_variant_applies, standard_exc, ada_get_next_arg) (catch_ada_exception_command_split) (catch_ada_assert_command_split, catch_assert_command) (ada_op_name): Constify. * ada-lang.h (ada_yyerror, get_selections) (ada_variant_discrim_name, ada_value_struct_elt): Constify. * arc-tdep.c (arc_print_frame_cache): Constify. * arm-tdep.c (arm_skip_stub): Constify. * ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref) (gen_aggregate_elt_ref): Constify. * bcache.c (print_bcache_statistics): Constify. * bcache.h (print_bcache_statistics): Constify. * break-catch-throw.c (catch_exception_command_1): * breakpoint.c (struct ep_type_description::description): Constify. (add_solib_catchpoint): Constify. (catch_fork_command_1): Add cast. (add_catch_command): Constify. * breakpoint.h (add_catch_command, add_solib_catchpoint): Constify. * bsd-uthread.c (bsd_uthread_state): Constify. * buildsym.c (patch_subfile_names): Constify. * buildsym.h (next_symbol_text_func, patch_subfile_names): Constify. * c-exp.y (yyerror): Constify. (token::oper): Constify. * c-lang.h (c_yyerror, cp_print_class_member): Constify. * c-varobj.c (cplus_describe_child): Constify. * charset.c (find_charset_names): Add cast. (find_charset_names): Constify array and add const_cast. * cli/cli-cmds.c (complete_command, cd_command): Constify. (edit_command): Constify. * cli/cli-decode.c (lookup_cmd): Constify. * cli/cli-dump.c (dump_memory_command, dump_value_command): Constify. (struct dump_context): Constify. (add_dump_command, restore_command): Constify. * cli/cli-script.c (get_command_line): Constify. * cli/cli-script.h (get_command_line): Constify. * cli/cli-utils.c (check_for_argument): Constify. * cli/cli-utils.h (check_for_argument): Constify. * coff-pe-read.c (struct read_pe_section_data): Constify. * command.h (lookup_cmd): Constify. * common/print-utils.c (decimal2str): Constify. * completer.c (gdb_print_filename): Constify. * corefile.c (set_gnutarget): Constify. * cp-name-parser.y (yyerror): Constify. * cp-valprint.c (cp_print_class_member): Constify. * cris-tdep.c (cris_register_name, crisv32_register_name): Constify. * d-exp.y (yyerror): Constify. (struct token::oper): Constify. * d-lang.h (d_yyerror): Constify. * dbxread.c (struct header_file_location::name): Constify. (add_old_header_file, add_new_header_file, last_function_name) (dbx_next_symbol_text, add_bincl_to_list) (find_corresponding_bincl_psymtab, set_namestring) (find_stab_function_addr, read_dbx_symtab, start_psymtab) (dbx_end_psymtab, read_ofile_symtab, process_one_symbol): * defs.h (command_line_input, print_address_symbolic) (deprecated_readline_begin_hook): Constify. * dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name): Constify. * event-top.c (handle_line_of_input): Constify and add cast. * exceptions.c (catch_errors): Constify. * exceptions.h (catch_errors): Constify. * expprint.c (print_subexp_standard, op_string, op_name) (op_name_standard, dump_raw_expression, dump_raw_expression): * expression.h (op_name, op_string, dump_raw_expression): Constify. * f-exp.y (yyerror): Constify. (struct token::oper): Constify. (struct f77_boolean_val::name): Constify. * f-lang.c (f_word_break_characters): Constify. * f-lang.h (f_yyerror): Constify. * fork-child.c (fork_inferior): Add cast. * frv-tdep.c (struct gdbarch_tdep::register_names): Constify. (new_variant): Constify. * gdbarch.sh (pstring_ptr, pstring_list): Constify. * gdbarch.c: Regenerate. * gdbcore.h (set_gnutarget): Constify. * go-exp.y (yyerror): Constify. (token::oper): Constify. * go-lang.h (go_yyerror): Constify. * go32-nat.c (go32_sysinfo): Constify. * guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify. * guile/scm-cmd.c (cmdscm_function): Constify. * guile/scm-param.c (pascm_param_value): Constify. * h8300-tdep.c (h8300_register_name, h8300s_register_name) (h8300sx_register_name): Constify. * hppa-tdep.c (hppa32_register_name, hppa64_register_name): Constify. * ia64-tdep.c (ia64_register_names): Constify. * infcmd.c (construct_inferior_arguments): Constify. (path_command, attach_post_wait): Constify. * language.c (show_range_command, show_case_command) (unk_lang_error): Constify. * language.h (language_defn::la_error) (language_defn::la_name_of_this): Constify. * linespec.c (decode_line_2): Constify. * linux-thread-db.c (thread_db_err_str): Constify. * lm32-tdep.c (lm32_register_name): Constify. * m2-exp.y (yyerror): Constify. * m2-lang.h (m2_yyerror): Constify. * m32r-tdep.c (m32r_register_names): Constify and make static. * m68hc11-tdep.c (m68hc11_register_names): Constify. * m88k-tdep.c (m88k_register_name): Constify. * macroexp.c (appendmem): Constify. * mdebugread.c (fdr_name, add_data_symbol, parse_type) (upgrade_type, parse_external, parse_partial_symbols) (mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab) (new_symbol): Constify. * memattr.c (mem_info_command): Constify. * mep-tdep.c (register_name_from_keyword): Constify. * mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env): Constify. * mi/mi-cmd-stack.c (list_args_or_locals): Constify. * mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify. * mi/mi-main.c (captured_mi_execute_command): Constify and add cast. (mi_execute_async_cli_command): Constify. * mips-tdep.c (mips_register_name): Constify. * mn10300-tdep.c (register_name, mn10300_generic_register_name) (am33_register_name, am33_2_register_name) * moxie-tdep.c (moxie_register_names): Constify. * nat/linux-osdata.c (osdata_type): Constify fields. * nto-tdep.c (nto_parse_redirection): Constify. * objc-lang.c (lookup_struct_typedef, lookup_objc_class) (lookup_child_selector): Constify. (objc_methcall::name): Constify. * objc-lang.h (lookup_objc_class, lookup_child_selector) (lookup_struct_typedef): Constify. * objfiles.c (pc_in_section): Constify. * objfiles.h (pc_in_section): Constify. * p-exp.y (struct token::oper): Constify. (yyerror): Constify. * p-lang.h (pascal_yyerror): Constify. * parser-defs.h (op_name_standard): Constify. (op_print::string): Constify. (exp_descriptor::op_name): Constify. * printcmd.c (print_address_symbolic): Constify. * psymtab.c (print_partial_symbols): Constify. * python/py-breakpoint.c (stop_func): Constify. (bppy_get_expression): Constify. * python/py-cmd.c (cmdpy_completer::name): Constify. (cmdpy_function): Constify. * python/py-event.c (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-event.h (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-evts.c (add_new_registry): Constify. * python/py-finishbreakpoint.c (outofscope_func): Constify. * python/py-framefilter.c (get_py_iter_from_func): Constify. * python/py-inferior.c (get_buffer): Add cast. * python/py-param.c (parm_constant::name): Constify. * python/py-unwind.c (fprint_frame_id): Constify. * python/python.c (gdbpy_parameter_value): Constify. * remote-fileio.c (remote_fio_func_map): Make 'name' const. * remote.c (memory_packet_config::name): Constify. (show_packet_config_cmd, remote_write_bytes) (remote_buffer_add_string): * reverse.c (exec_reverse_once): Constify. * rs6000-tdep.c (variant::name, variant::description): Constify. * rust-exp.y (rustyyerror): Constify. * rust-lang.c (rust_op_name): Constify. * rust-lang.h (rustyyerror): Constify. * serial.h (serial_ops::name): Constify. * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name) (sh_sh3e_register_name, sh_sh2e_register_name) (sh_sh2a_register_name, sh_sh2a_nofpu_register_name) (sh_sh_dsp_register_name, sh_sh3_dsp_register_name) (sh_sh4_register_name, sh_sh4_nofpu_register_name) (sh_sh4al_dsp_register_name): Constify. * sh64-tdep.c (sh64_register_name): Constify. * solib-darwin.c (lookup_symbol_from_bfd): Constify. * spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify. * stabsread.c (patch_block_stabs, read_type_number) (ref_map::stabs, ref_add, process_reference) (symbol_reference_defined, define_symbol, define_symbol) (error_type, read_type, read_member_functions, read_cpp_abbrev) (read_one_struct_field, read_struct_fields, read_baseclasses) (read_tilde_fields, read_struct_type, read_array_type) (read_enum_type, read_sun_builtin_type, read_sun_floating_type) (read_huge_number, read_range_type, read_args, common_block_start) (find_name_end): Constify. * stabsread.h (common_block_start, define_symbol) (process_one_symbol, symbol_reference_defined, ref_add): * symfile.c (get_section_index, add_symbol_file_command): * symfile.h (get_section_index): Constify. * target-descriptions.c (tdesc_type::name): Constify. (tdesc_free_type): Add cast. * target.c (find_default_run_target): (add_deprecated_target_alias, find_default_run_target) (target_announce_detach): Constify. (do_option): Constify. * target.h (add_deprecated_target_alias): Constify. * thread.c (print_thread_info_1): Constify. * top.c (deprecated_readline_begin_hook, command_line_input): Constify. (init_main): Add casts. * top.h (handle_line_of_input): Constify. * tracefile-tfile.c (tfile_write_uploaded_tsv): Constify. * tracepoint.c (tvariables_info_1, trace_status_mi): Constify. (tfind_command): Rename to ... (tfind_command_1): ... this and constify. (tfind_command): New function. (tfind_end_command, tfind_start_command): Adjust. (encode_source_string): Constify. * tracepoint.h (encode_source_string): Constify. * tui/tui-data.c (tui_partial_win_by_name): Constify. * tui/tui-data.h (tui_partial_win_by_name): Constify. * tui/tui-source.c (tui_set_source_content_nil): Constify. * tui/tui-source.h (tui_set_source_content_nil): Constify. * tui/tui-win.c (parse_scrolling_args): Constify. * tui/tui-windata.c (tui_erase_data_content): Constify. * tui/tui-windata.h (tui_erase_data_content): Constify. * tui/tui-winsource.c (tui_erase_source_content): Constify. * tui/tui.c (tui_enable): Add cast. * utils.c (defaulted_query): Constify. (init_page_info): Add cast. (puts_debug, subset_compare): Constify. * utils.h (subset_compare): Constify. * varobj.c (varobj_format_string): Constify. * varobj.h (varobj_format_string): Constify. * vax-tdep.c (vax_register_name): Constify. * windows-nat.c (windows_detach): Constify. * xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify. * xml-support.c (gdb_xml_end_element): Constify. * xml-tdesc.c (tdesc_start_reg): Constify. * xstormy16-tdep.c (xstormy16_register_name): Constify. * xtensa-tdep.c (xtensa_find_register_by_name): Constify. * xtensa-tdep.h (xtensa_register_t::name): Constify. gdb/gdbserver/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * gdbreplay.c (sync_error): Constify. * linux-x86-low.c (push_opcode): Constify.
-rw-r--r--gdb/ChangeLog240
-rw-r--r--gdb/ada-exp.y4
-rw-r--r--gdb/ada-lang.c54
-rw-r--r--gdb/ada-lang.h8
-rw-r--r--gdb/arc-tdep.c2
-rw-r--r--gdb/arm-tdep.c2
-rw-r--r--gdb/ax-gdb.c21
-rw-r--r--gdb/bcache.c2
-rw-r--r--gdb/bcache.h2
-rw-r--r--gdb/breakpoint.c8
-rw-r--r--gdb/breakpoint.h4
-rw-r--r--gdb/bsd-uthread.c2
-rw-r--r--gdb/buildsym.c2
-rw-r--r--gdb/buildsym.h4
-rw-r--r--gdb/c-exp.y6
-rw-r--r--gdb/c-lang.h4
-rw-r--r--gdb/c-varobj.c2
-rw-r--r--gdb/charset.c11
-rw-r--r--gdb/cli/cli-cmds.c14
-rw-r--r--gdb/cli/cli-decode.c3
-rw-r--r--gdb/cli/cli-dump.c15
-rw-r--r--gdb/cli/cli-script.c2
-rw-r--r--gdb/cli/cli-script.h2
-rw-r--r--gdb/coff-pe-read.c2
-rw-r--r--gdb/command.h3
-rw-r--r--gdb/common/print-utils.c2
-rw-r--r--gdb/completer.c3
-rw-r--r--gdb/corefile.c2
-rw-r--r--gdb/cp-name-parser.y4
-rw-r--r--gdb/cp-valprint.c2
-rw-r--r--gdb/cris-tdep.c6
-rw-r--r--gdb/d-exp.y6
-rw-r--r--gdb/d-lang.h2
-rw-r--r--gdb/dbxread.c80
-rw-r--r--gdb/defs.h7
-rw-r--r--gdb/dwarf2read.c8
-rw-r--r--gdb/event-top.c2
-rw-r--r--gdb/exceptions.c4
-rw-r--r--gdb/exceptions.h3
-rw-r--r--gdb/expprint.c14
-rw-r--r--gdb/expression.h6
-rw-r--r--gdb/f-exp.y8
-rw-r--r--gdb/f-lang.h2
-rw-r--r--gdb/fork-child.c2
-rw-r--r--gdb/frv-tdep.c6
-rw-r--r--gdb/gdbarch.c4
-rwxr-xr-xgdb/gdbarch.sh4
-rw-r--r--gdb/gdbcore.h2
-rw-r--r--gdb/gdbserver/ChangeLog5
-rw-r--r--gdb/gdbserver/gdbreplay.c2
-rw-r--r--gdb/gdbserver/linux-x86-low.c2
-rw-r--r--gdb/go-exp.y6
-rw-r--r--gdb/go-lang.h2
-rw-r--r--gdb/go32-nat.c2
-rw-r--r--gdb/guile/scm-breakpoint.c3
-rw-r--r--gdb/guile/scm-cmd.c4
-rw-r--r--gdb/guile/scm-param.c2
-rw-r--r--gdb/h8300-tdep.c6
-rw-r--r--gdb/hppa-tdep.c4
-rw-r--r--gdb/ia64-tdep.c2
-rw-r--r--gdb/infcmd.c12
-rw-r--r--gdb/language.c8
-rw-r--r--gdb/language.h4
-rw-r--r--gdb/linespec.c3
-rw-r--r--gdb/linux-thread-db.c2
-rw-r--r--gdb/lm32-tdep.c2
-rw-r--r--gdb/m2-exp.y4
-rw-r--r--gdb/m2-lang.h2
-rw-r--r--gdb/m32r-tdep.c2
-rw-r--r--gdb/m68hc11-tdep.c2
-rw-r--r--gdb/m88k-tdep.c2
-rw-r--r--gdb/macroexp.c2
-rw-r--r--gdb/mdebugread.c46
-rw-r--r--gdb/memattr.c2
-rw-r--r--gdb/mep-tdep.c2
-rw-r--r--gdb/mi/mi-cmd-env.c4
-rw-r--r--gdb/mi/mi-cmd-stack.c2
-rw-r--r--gdb/mi/mi-cmd-var.c2
-rw-r--r--gdb/mi/mi-main.c6
-rw-r--r--gdb/mips-tdep.c6
-rw-r--r--gdb/mn10300-tdep.c10
-rw-r--r--gdb/moxie-tdep.c2
-rw-r--r--gdb/nat/linux-osdata.c6
-rw-r--r--gdb/nto-tdep.c2
-rw-r--r--gdb/objc-lang.c8
-rw-r--r--gdb/objc-lang.h7
-rw-r--r--gdb/objfiles.c2
-rw-r--r--gdb/objfiles.h2
-rw-r--r--gdb/p-exp.y6
-rw-r--r--gdb/p-lang.h2
-rw-r--r--gdb/parser-defs.h6
-rw-r--r--gdb/printcmd.c2
-rw-r--r--gdb/psymtab.c2
-rw-r--r--gdb/python/py-breakpoint.c4
-rw-r--r--gdb/python/py-cmd.c10
-rw-r--r--gdb/python/py-event.c4
-rw-r--r--gdb/python/py-event.h4
-rw-r--r--gdb/python/py-evts.c2
-rw-r--r--gdb/python/py-finishbreakpoint.c2
-rw-r--r--gdb/python/py-framefilter.c2
-rw-r--r--gdb/python/py-inferior.c5
-rw-r--r--gdb/python/py-param.c2
-rw-r--r--gdb/python/py-unwind.c2
-rw-r--r--gdb/python/python.c2
-rw-r--r--gdb/remote-fileio.c2
-rw-r--r--gdb/remote.c8
-rw-r--r--gdb/reverse.c2
-rw-r--r--gdb/rs6000-tdep.c4
-rw-r--r--gdb/rust-exp.y2
-rw-r--r--gdb/rust-lang.c2
-rw-r--r--gdb/rust-lang.h2
-rw-r--r--gdb/serial.h2
-rw-r--r--gdb/sh-tdep.c22
-rw-r--r--gdb/sh64-tdep.c2
-rw-r--r--gdb/solib-darwin.c2
-rw-r--r--gdb/spu-tdep.c4
-rw-r--r--gdb/stabsread.c129
-rw-r--r--gdb/stabsread.h10
-rw-r--r--gdb/symfile.c12
-rw-r--r--gdb/symfile.h2
-rw-r--r--gdb/target-descriptions.c8
-rw-r--r--gdb/target.c10
-rw-r--r--gdb/target.h3
-rw-r--r--gdb/thread.c2
-rw-r--r--gdb/top.c5
-rw-r--r--gdb/top.h2
-rw-r--r--gdb/tracefile-tfile.c4
-rw-r--r--gdb/tracepoint.c22
-rw-r--r--gdb/tracepoint.h2
-rw-r--r--gdb/tui/tui-data.c2
-rw-r--r--gdb/tui/tui-data.h2
-rw-r--r--gdb/tui/tui-source.c2
-rw-r--r--gdb/tui/tui-source.h2
-rw-r--r--gdb/tui/tui-win.c11
-rw-r--r--gdb/tui/tui-windata.c2
-rw-r--r--gdb/tui/tui-windata.h2
-rw-r--r--gdb/tui/tui-winsource.c2
-rw-r--r--gdb/tui/tui.c2
-rw-r--r--gdb/utils.c11
-rw-r--r--gdb/utils.h2
-rw-r--r--gdb/varobj.c2
-rw-r--r--gdb/varobj.h2
-rw-r--r--gdb/vax-tdep.c2
-rw-r--r--gdb/windows-nat.c2
-rw-r--r--gdb/xcoffread.c8
-rw-r--r--gdb/xml-support.c10
-rw-r--r--gdb/xml-tdesc.c3
-rw-r--r--gdb/xstormy16-tdep.c2
-rw-r--r--gdb/xtensa-tdep.c2
-rw-r--r--gdb/xtensa-tdep.h2
150 files changed, 737 insertions, 452 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3a40ad9c868..cbf3c0cb651 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,245 @@
2017-04-05 Pedro Alves <palves@redhat.com>
+ * ada-exp.y (yyerror): Constify.
+ * ada-lang.c (bound_name, get_selections)
+ (ada_variant_discrim_type)
+ (ada_variant_discrim_name, ada_value_struct_elt)
+ (ada_lookup_struct_elt_type, is_unchecked_variant)
+ (ada_which_variant_applies, standard_exc, ada_get_next_arg)
+ (catch_ada_exception_command_split)
+ (catch_ada_assert_command_split, catch_assert_command)
+ (ada_op_name): Constify.
+ * ada-lang.h (ada_yyerror, get_selections)
+ (ada_variant_discrim_name, ada_value_struct_elt): Constify.
+ * arc-tdep.c (arc_print_frame_cache): Constify.
+ * arm-tdep.c (arm_skip_stub): Constify.
+ * ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref)
+ (gen_aggregate_elt_ref): Constify.
+ * bcache.c (print_bcache_statistics): Constify.
+ * bcache.h (print_bcache_statistics): Constify.
+ * break-catch-throw.c (catch_exception_command_1):
+ * breakpoint.c (struct ep_type_description::description):
+ Constify.
+ (add_solib_catchpoint): Constify.
+ (catch_fork_command_1): Add cast.
+ (add_catch_command): Constify.
+ * breakpoint.h (add_catch_command, add_solib_catchpoint):
+ Constify.
+ * bsd-uthread.c (bsd_uthread_state): Constify.
+ * buildsym.c (patch_subfile_names): Constify.
+ * buildsym.h (next_symbol_text_func, patch_subfile_names):
+ Constify.
+ * c-exp.y (yyerror): Constify.
+ (token::oper): Constify.
+ * c-lang.h (c_yyerror, cp_print_class_member): Constify.
+ * c-varobj.c (cplus_describe_child): Constify.
+ * charset.c (find_charset_names): Add cast.
+ (find_charset_names): Constify array and add const_cast.
+ * cli/cli-cmds.c (complete_command, cd_command): Constify.
+ (edit_command): Constify.
+ * cli/cli-decode.c (lookup_cmd): Constify.
+ * cli/cli-dump.c (dump_memory_command, dump_value_command):
+ Constify.
+ (struct dump_context): Constify.
+ (add_dump_command, restore_command): Constify.
+ * cli/cli-script.c (get_command_line): Constify.
+ * cli/cli-script.h (get_command_line): Constify.
+ * cli/cli-utils.c (check_for_argument): Constify.
+ * cli/cli-utils.h (check_for_argument): Constify.
+ * coff-pe-read.c (struct read_pe_section_data): Constify.
+ * command.h (lookup_cmd): Constify.
+ * common/print-utils.c (decimal2str): Constify.
+ * completer.c (gdb_print_filename): Constify.
+ * corefile.c (set_gnutarget): Constify.
+ * cp-name-parser.y (yyerror): Constify.
+ * cp-valprint.c (cp_print_class_member): Constify.
+ * cris-tdep.c (cris_register_name, crisv32_register_name):
+ Constify.
+ * d-exp.y (yyerror): Constify.
+ (struct token::oper): Constify.
+ * d-lang.h (d_yyerror): Constify.
+ * dbxread.c (struct header_file_location::name): Constify.
+ (add_old_header_file, add_new_header_file, last_function_name)
+ (dbx_next_symbol_text, add_bincl_to_list)
+ (find_corresponding_bincl_psymtab, set_namestring)
+ (find_stab_function_addr, read_dbx_symtab, start_psymtab)
+ (dbx_end_psymtab, read_ofile_symtab, process_one_symbol):
+ * defs.h (command_line_input, print_address_symbolic)
+ (deprecated_readline_begin_hook): Constify.
+ * dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name):
+ Constify.
+ * event-top.c (handle_line_of_input): Constify and add cast.
+ * exceptions.c (catch_errors): Constify.
+ * exceptions.h (catch_errors): Constify.
+ * expprint.c (print_subexp_standard, op_string, op_name)
+ (op_name_standard, dump_raw_expression, dump_raw_expression):
+ * expression.h (op_name, op_string, dump_raw_expression):
+ Constify.
+ * f-exp.y (yyerror): Constify.
+ (struct token::oper): Constify.
+ (struct f77_boolean_val::name): Constify.
+ * f-lang.c (f_word_break_characters): Constify.
+ * f-lang.h (f_yyerror): Constify.
+ * fork-child.c (fork_inferior): Add cast.
+ * frv-tdep.c (struct gdbarch_tdep::register_names): Constify.
+ (new_variant): Constify.
+ * gdbarch.sh (pstring_ptr, pstring_list): Constify.
+ * gdbarch.c: Regenerate.
+ * gdbcore.h (set_gnutarget): Constify.
+ * go-exp.y (yyerror): Constify.
+ (token::oper): Constify.
+ * go-lang.h (go_yyerror): Constify.
+ * go32-nat.c (go32_sysinfo): Constify.
+ * guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify.
+ * guile/scm-cmd.c (cmdscm_function): Constify.
+ * guile/scm-param.c (pascm_param_value): Constify.
+ * h8300-tdep.c (h8300_register_name, h8300s_register_name)
+ (h8300sx_register_name): Constify.
+ * hppa-tdep.c (hppa32_register_name, hppa64_register_name):
+ Constify.
+ * ia64-tdep.c (ia64_register_names): Constify.
+ * infcmd.c (construct_inferior_arguments): Constify.
+ (path_command, attach_post_wait): Constify.
+ * language.c (show_range_command, show_case_command)
+ (unk_lang_error): Constify.
+ * language.h (language_defn::la_error)
+ (language_defn::la_name_of_this): Constify.
+ * linespec.c (decode_line_2): Constify.
+ * linux-thread-db.c (thread_db_err_str): Constify.
+ * lm32-tdep.c (lm32_register_name): Constify.
+ * m2-exp.y (yyerror): Constify.
+ * m2-lang.h (m2_yyerror): Constify.
+ * m32r-tdep.c (m32r_register_names): Constify and make static.
+ * m68hc11-tdep.c (m68hc11_register_names): Constify.
+ * m88k-tdep.c (m88k_register_name): Constify.
+ * macroexp.c (appendmem): Constify.
+ * mdebugread.c (fdr_name, add_data_symbol, parse_type)
+ (upgrade_type, parse_external, parse_partial_symbols)
+ (mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab)
+ (new_symbol): Constify.
+ * memattr.c (mem_info_command): Constify.
+ * mep-tdep.c (register_name_from_keyword): Constify.
+ * mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env):
+ Constify.
+ * mi/mi-cmd-stack.c (list_args_or_locals): Constify.
+ * mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify.
+ * mi/mi-main.c (captured_mi_execute_command): Constify and add
+ cast.
+ (mi_execute_async_cli_command): Constify.
+ * mips-tdep.c (mips_register_name): Constify.
+ * mn10300-tdep.c (register_name, mn10300_generic_register_name)
+ (am33_register_name, am33_2_register_name)
+ * moxie-tdep.c (moxie_register_names): Constify.
+ * nat/linux-osdata.c (osdata_type): Constify fields.
+ * nto-tdep.c (nto_parse_redirection): Constify.
+ * objc-lang.c (lookup_struct_typedef, lookup_objc_class)
+ (lookup_child_selector): Constify.
+ (objc_methcall::name): Constify.
+ * objc-lang.h (lookup_objc_class, lookup_child_selector)
+ (lookup_struct_typedef): Constify.
+ * objfiles.c (pc_in_section): Constify.
+ * objfiles.h (pc_in_section): Constify.
+ * p-exp.y (struct token::oper): Constify.
+ (yyerror): Constify.
+ * p-lang.h (pascal_yyerror): Constify.
+ * parser-defs.h (op_name_standard): Constify.
+ (op_print::string): Constify.
+ (exp_descriptor::op_name): Constify.
+ * printcmd.c (print_address_symbolic): Constify.
+ * psymtab.c (print_partial_symbols): Constify.
+ * python/py-breakpoint.c (stop_func): Constify.
+ (bppy_get_expression): Constify.
+ * python/py-cmd.c (cmdpy_completer::name): Constify.
+ (cmdpy_function): Constify.
+ * python/py-event.c (evpy_add_attribute)
+ (gdbpy_initialize_event_generic): Constify.
+ * python/py-event.h (evpy_add_attribute)
+ (gdbpy_initialize_event_generic): Constify.
+ * python/py-evts.c (add_new_registry): Constify.
+ * python/py-finishbreakpoint.c (outofscope_func): Constify.
+ * python/py-framefilter.c (get_py_iter_from_func): Constify.
+ * python/py-inferior.c (get_buffer): Add cast.
+ * python/py-param.c (parm_constant::name): Constify.
+ * python/py-unwind.c (fprint_frame_id): Constify.
+ * python/python.c (gdbpy_parameter_value): Constify.
+ * remote-fileio.c (remote_fio_func_map): Make 'name' const.
+ * remote.c (memory_packet_config::name): Constify.
+ (show_packet_config_cmd, remote_write_bytes)
+ (remote_buffer_add_string):
+ * reverse.c (exec_reverse_once): Constify.
+ * rs6000-tdep.c (variant::name, variant::description): Constify.
+ * rust-exp.y (rustyyerror): Constify.
+ * rust-lang.c (rust_op_name): Constify.
+ * rust-lang.h (rustyyerror): Constify.
+ * serial.h (serial_ops::name): Constify.
+ * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name)
+ (sh_sh3e_register_name, sh_sh2e_register_name)
+ (sh_sh2a_register_name, sh_sh2a_nofpu_register_name)
+ (sh_sh_dsp_register_name, sh_sh3_dsp_register_name)
+ (sh_sh4_register_name, sh_sh4_nofpu_register_name)
+ (sh_sh4al_dsp_register_name): Constify.
+ * sh64-tdep.c (sh64_register_name): Constify.
+ * solib-darwin.c (lookup_symbol_from_bfd): Constify.
+ * spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify.
+ * stabsread.c (patch_block_stabs, read_type_number)
+ (ref_map::stabs, ref_add, process_reference)
+ (symbol_reference_defined, define_symbol, define_symbol)
+ (error_type, read_type, read_member_functions, read_cpp_abbrev)
+ (read_one_struct_field, read_struct_fields, read_baseclasses)
+ (read_tilde_fields, read_struct_type, read_array_type)
+ (read_enum_type, read_sun_builtin_type, read_sun_floating_type)
+ (read_huge_number, read_range_type, read_args, common_block_start)
+ (find_name_end): Constify.
+ * stabsread.h (common_block_start, define_symbol)
+ (process_one_symbol, symbol_reference_defined, ref_add):
+ * symfile.c (get_section_index, add_symbol_file_command):
+ * symfile.h (get_section_index): Constify.
+ * target-descriptions.c (tdesc_type::name): Constify.
+ (tdesc_free_type): Add cast.
+ * target.c (find_default_run_target):
+ (add_deprecated_target_alias, find_default_run_target)
+ (target_announce_detach): Constify.
+ (do_option): Constify.
+ * target.h (add_deprecated_target_alias): Constify.
+ * thread.c (print_thread_info_1): Constify.
+ * top.c (deprecated_readline_begin_hook, command_line_input):
+ Constify.
+ (init_main): Add casts.
+ * top.h (handle_line_of_input): Constify.
+ * tracefile-tfile.c (tfile_write_uploaded_tsv): Constify.
+ * tracepoint.c (tvariables_info_1, trace_status_mi): Constify.
+ (tfind_command): Rename to ...
+ (tfind_command_1): ... this and constify.
+ (tfind_command): New function.
+ (tfind_end_command, tfind_start_command): Adjust.
+ (encode_source_string): Constify.
+ * tracepoint.h (encode_source_string): Constify.
+ * tui/tui-data.c (tui_partial_win_by_name): Constify.
+ * tui/tui-data.h (tui_partial_win_by_name): Constify.
+ * tui/tui-source.c (tui_set_source_content_nil): Constify.
+ * tui/tui-source.h (tui_set_source_content_nil): Constify.
+ * tui/tui-win.c (parse_scrolling_args): Constify.
+ * tui/tui-windata.c (tui_erase_data_content): Constify.
+ * tui/tui-windata.h (tui_erase_data_content): Constify.
+ * tui/tui-winsource.c (tui_erase_source_content): Constify.
+ * tui/tui.c (tui_enable): Add cast.
+ * utils.c (defaulted_query): Constify.
+ (init_page_info): Add cast.
+ (puts_debug, subset_compare): Constify.
+ * utils.h (subset_compare): Constify.
+ * varobj.c (varobj_format_string): Constify.
+ * varobj.h (varobj_format_string): Constify.
+ * vax-tdep.c (vax_register_name): Constify.
+ * windows-nat.c (windows_detach): Constify.
+ * xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify.
+ * xml-support.c (gdb_xml_end_element): Constify.
+ * xml-tdesc.c (tdesc_start_reg): Constify.
+ * xstormy16-tdep.c (xstormy16_register_name): Constify.
+ * xtensa-tdep.c (xtensa_find_register_by_name): Constify.
+ * xtensa-tdep.h (xtensa_register_t::name): Constify.
+
+2017-04-05 Pedro Alves <palves@redhat.com>
+
* proc-api.c (struct trans): Constify.
(procfs_note): Constify.
* proc-events.c (struct trans, syscall_table):
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index d9fcdfaac2d..1eea4546706 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -77,7 +77,7 @@ int yyparse (void);
static int yylex (void);
-void yyerror (char *);
+void yyerror (const char *);
static void write_int (struct parser_state *, LONGEST, struct type *);
@@ -751,7 +751,7 @@ ada_parse (struct parser_state *par_state)
}
void
-yyerror (char *msg)
+yyerror (const char *msg)
{
error (_("Error in expression, near `%s'."), lexptr);
}
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 7be135edfc1..2e5643bd032 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -130,7 +130,7 @@ static void replace_operator_with_call (struct expression **, int, int, int,
static int possible_user_operator_p (enum exp_opcode, struct value **);
-static char *ada_op_name (enum exp_opcode);
+static const char *ada_op_name (enum exp_opcode);
static const char *ada_decoded_op_name (enum exp_opcode);
@@ -150,7 +150,7 @@ static enum ada_renaming_category parse_old_style_renaming (struct type *,
static struct symbol *find_old_style_renaming_symbol (const char *,
const struct block *);
-static struct type *ada_lookup_struct_elt_type (struct type *, char *,
+static struct type *ada_lookup_struct_elt_type (struct type *, const char *,
int, int, int *);
static struct value *evaluate_subexp_type (struct expression *, int *);
@@ -1576,7 +1576,7 @@ ada_fixup_array_indexes_type (struct type *index_desc_type)
/* Names of MAX_ADA_DIMENS bounds in P_BOUNDS fields of array descriptors. */
-static char *bound_name[] = {
+static const char *bound_name[] = {
"LB0", "UB0", "LB1", "UB1", "LB2", "UB2", "LB3", "UB3",
"LB4", "UB4", "LB5", "UB5", "LB6", "UB6", "LB7", "UB7"
};
@@ -4035,10 +4035,10 @@ See set/show multiple-symbol."));
int
get_selections (int *choices, int n_choices, int max_results,
- int is_all_choice, char *annotation_suffix)
+ int is_all_choice, const char *annotation_suffix)
{
char *args;
- char *prompt;
+ const char *prompt;
int n_chosen;
int first_choice = is_all_choice ? 2 : 1;
@@ -7066,7 +7066,7 @@ ada_is_variant_part (struct type *type, int field_num)
struct type *
ada_variant_discrim_type (struct type *var_type, struct type *outer_type)
{
- char *name = ada_variant_discrim_name (var_type);
+ const char *name = ada_variant_discrim_name (var_type);
return ada_lookup_struct_elt_type (outer_type, name, 1, 1, NULL);
}
@@ -7087,7 +7087,7 @@ ada_is_others_clause (struct type *type, int field_num)
returns the name of the discriminant controlling the variant.
The value is valid until the next call to ada_variant_discrim_name. */
-char *
+const char *
ada_variant_discrim_name (struct type *type0)
{
static char *result = NULL;
@@ -7484,7 +7484,7 @@ ada_index_struct_field_1 (int *index_p, struct value *arg, int offset,
calling error. */
struct value *
-ada_value_struct_elt (struct value *arg, char *name, int no_err)
+ada_value_struct_elt (struct value *arg, const char *name, int no_err)
{
struct type *t, *t1;
struct value *v;
@@ -7598,7 +7598,7 @@ type_as_string (struct type *type)
TYPE is not a type of the right kind. */
static struct type *
-ada_lookup_struct_elt_type (struct type *type, char *name, int refok,
+ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
int noerr, int *dispp)
{
int i;
@@ -7711,7 +7711,7 @@ BadName:
static int
is_unchecked_variant (struct type *var_type, struct type *outer_type)
{
- char *discrim_name = ada_variant_discrim_name (var_type);
+ const char *discrim_name = ada_variant_discrim_name (var_type);
return (ada_lookup_struct_elt_type (outer_type, discrim_name, 0, 1, NULL)
== NULL);
@@ -7729,7 +7729,7 @@ ada_which_variant_applies (struct type *var_type, struct type *outer_type,
{
int others_clause;
int i;
- char *discrim_name = ada_variant_discrim_name (var_type);
+ const char *discrim_name = ada_variant_discrim_name (var_type);
struct value *outer;
struct value *discrim;
LONGEST discrim_val;
@@ -11834,7 +11834,7 @@ ada_modulus (struct type *type)
an Ada83 compiler). As such, we do not include Numeric_Error from
this list of standard exceptions. */
-static char *standard_exc[] = {
+static const char *standard_exc[] = {
"constraint_error",
"program_error",
"storage_error",
@@ -12791,19 +12791,19 @@ static struct breakpoint_ops catch_assert_breakpoint_ops;
Return NULL if ARGPS does not contain any more tokens. */
static char *
-ada_get_next_arg (char **argsp)
+ada_get_next_arg (const char **argsp)
{
- char *args = *argsp;
- char *end;
+ const char *args = *argsp;
+ const char *end;
char *result;
- args = skip_spaces (args);
+ args = skip_spaces_const (args);
if (args[0] == '\0')
return NULL; /* No more arguments. */
/* Find the end of the current argument. */
- end = skip_to_space (args);
+ end = skip_to_space_const (args);
/* Adjust ARGSP to point to the start of the next argument. */
@@ -12827,7 +12827,7 @@ ada_get_next_arg (char **argsp)
after use). Otherwise COND_STRING is set to NULL. */
static void
-catch_ada_exception_command_split (char *args,
+catch_ada_exception_command_split (const char *args,
enum ada_exception_catchpoint_kind *ex,
char **excep_string,
char **cond_string)
@@ -12850,12 +12850,12 @@ catch_ada_exception_command_split (char *args,
/* Check to see if we have a condition. */
- args = skip_spaces (args);
+ args = skip_spaces_const (args);
if (startswith (args, "if")
&& (isspace (args[2]) || args[2] == '\0'))
{
args += 2;
- args = skip_spaces (args);
+ args = skip_spaces_const (args);
if (args[0] == '\0')
error (_("Condition missing after `if' keyword"));
@@ -13077,9 +13077,10 @@ create_ada_exception_catchpoint (struct gdbarch *gdbarch,
/* Implement the "catch exception" command. */
static void
-catch_ada_exception_command (char *arg, int from_tty,
+catch_ada_exception_command (char *arg_entry, int from_tty,
struct cmd_list_element *command)
{
+ const char *arg = arg_entry;
struct gdbarch *gdbarch = get_current_arch ();
int tempflag;
enum ada_exception_catchpoint_kind ex_kind;
@@ -13107,16 +13108,16 @@ catch_ada_exception_command (char *arg, int from_tty,
(the memory needs to be deallocated after use). */
static void
-catch_ada_assert_command_split (char *args, char **cond_string)
+catch_ada_assert_command_split (const char *args, char **cond_string)
{
- args = skip_spaces (args);
+ args = skip_spaces_const (args);
/* Check whether a condition was provided. */
if (startswith (args, "if")
&& (isspace (args[2]) || args[2] == '\0'))
{
args += 2;
- args = skip_spaces (args);
+ args = skip_spaces_const (args);
if (args[0] == '\0')
error (_("condition missing after `if' keyword"));
*cond_string = xstrdup (args);
@@ -13131,9 +13132,10 @@ catch_ada_assert_command_split (char *args, char **cond_string)
/* Implement the "catch assert" command. */
static void
-catch_assert_command (char *arg, int from_tty,
+catch_assert_command (char *arg_entry, int from_tty,
struct cmd_list_element *command)
{
+ const char *arg = arg_entry;
struct gdbarch *gdbarch = get_current_arch ();
int tempflag;
char *cond_string = NULL;
@@ -13571,7 +13573,7 @@ ada_operator_check (struct expression *exp, int pos,
return 0;
}
-static char *
+static const char *
ada_op_name (enum exp_opcode opcode)
{
switch (opcode)
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 794a282da83..5f97a6cdccd 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -159,7 +159,7 @@ extern int ada_get_field_index (const struct type *type,
extern int ada_parse (struct parser_state *); /* Defined in ada-exp.y */
-extern void ada_yyerror (char *); /* Defined in ada-exp.y */
+extern void ada_yyerror (const char *); /* Defined in ada-exp.y */
/* Defined in ada-typeprint.c */
extern void ada_print_type (struct type *, const char *, struct ui_file *, int,
@@ -243,7 +243,7 @@ extern void ada_fill_in_ada_prototype (struct symbol *);
extern int user_select_syms (struct block_symbol *, int, int);
-extern int get_selections (int *, int, int, int, char *);
+extern int get_selections (int *, int, int, int, const char *);
extern int ada_scan_number (const char *, int, LONGEST *, int *);
@@ -288,9 +288,9 @@ extern int ada_is_others_clause (struct type *, int);
extern int ada_in_variant (LONGEST, struct type *, int);
-extern char *ada_variant_discrim_name (struct type *);
+extern const char *ada_variant_discrim_name (struct type *);
-extern struct value *ada_value_struct_elt (struct value *, char *, int);
+extern struct value *ada_value_struct_elt (struct value *, const char *, int);
extern int ada_is_aligner_type (struct type *);
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index 657b1eb84f4..4f866a9ccaf 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -1530,7 +1530,7 @@ arc_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
/* Dump the frame info. Used for internal debugging only. */
static void
-arc_print_frame_cache (struct gdbarch *gdbarch, char *message,
+arc_print_frame_cache (struct gdbarch *gdbarch, const char *message,
struct arc_frame_cache *cache, int addresses_known)
{
debug_printf ("arc: frame_info %s\n", message);
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index ade770ea016..9be79437941 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -8367,7 +8367,7 @@ arm_skip_stub (struct frame_info *frame, CORE_ADDR pc)
{
/* Use the name suffix to determine which register contains the
target PC. */
- static char *table[15] =
+ static const char *table[15] =
{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "sl", "fp", "ip", "sp", "lr"
};
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 01099f5abaf..05b1dd7019a 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -128,7 +128,8 @@ static void gen_binop (struct agent_expr *ax,
struct axs_value *value1,
struct axs_value *value2,
enum agent_op op,
- enum agent_op op_unsigned, int may_carry, char *name);
+ enum agent_op op_unsigned, int may_carry,
+ const char *name);
static void gen_logical_not (struct agent_expr *ax, struct axs_value *value,
struct type *result_type);
static void gen_complement (struct agent_expr *ax, struct axs_value *value);
@@ -144,12 +145,13 @@ static void gen_primitive_field (struct expression *exp,
static int gen_struct_ref_recursive (struct expression *exp,
struct agent_expr *ax,
struct axs_value *value,
- char *field, int offset,
+ const char *field, int offset,
struct type *type);
static void gen_struct_ref (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- char *field,
- char *operator_name, char *operand_name);
+ const char *field,
+ const char *operator_name,
+ const char *operand_name);
static void gen_static_field (struct gdbarch *gdbarch,
struct agent_expr *ax, struct axs_value *value,
struct type *type, int fieldno);
@@ -1149,7 +1151,7 @@ static void
gen_binop (struct agent_expr *ax, struct axs_value *value,
struct axs_value *value1, struct axs_value *value2,
enum agent_op op, enum agent_op op_unsigned,
- int may_carry, char *name)
+ int may_carry, const char *name)
{
/* We only handle INT op INT. */
if ((TYPE_CODE (value1->type) != TYPE_CODE_INT)
@@ -1434,7 +1436,7 @@ gen_primitive_field (struct expression *exp,
static int
gen_struct_ref_recursive (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- char *field, int offset, struct type *type)
+ const char *field, int offset, struct type *type)
{
int i, rslt;
int nbases = TYPE_N_BASECLASSES (type);
@@ -1498,8 +1500,8 @@ gen_struct_ref_recursive (struct expression *exp, struct agent_expr *ax,
it operates on; we use them in error messages. */
static void
gen_struct_ref (struct expression *exp, struct agent_expr *ax,
- struct axs_value *value, char *field,
- char *operator_name, char *operand_name)
+ struct axs_value *value, const char *field,
+ const char *operator_name, const char *operand_name)
{
struct type *type;
int found;
@@ -1671,7 +1673,8 @@ static int
gen_aggregate_elt_ref (struct expression *exp,
struct agent_expr *ax, struct axs_value *value,
struct type *type, char *field,
- char *operator_name, char *operand_name)
+ const char *operator_name,
+ const char *operand_name)
{
switch (TYPE_CODE (type))
{
diff --git a/gdb/bcache.c b/gdb/bcache.c
index d6c0921fd5c..06ab843d3ac 100644
--- a/gdb/bcache.c
+++ b/gdb/bcache.c
@@ -356,7 +356,7 @@ print_percentage (int portion, int total)
BCACHE holds. Statistics are printed using `printf_filtered' and
its ilk. */
void
-print_bcache_statistics (struct bcache *c, char *type)
+print_bcache_statistics (struct bcache *c, const char *type)
{
int occupied_buckets;
int max_chain_length;
diff --git a/gdb/bcache.h b/gdb/bcache.h
index 8ec0bde7760..f9590aa270c 100644
--- a/gdb/bcache.h
+++ b/gdb/bcache.h
@@ -165,7 +165,7 @@ extern struct bcache *bcache_xmalloc (
eliminating duplication. TYPE should be a string describing the
kind of data BCACHE holds. Statistics are printed using
`printf_filtered' and its ilk. */
-extern void print_bcache_statistics (struct bcache *bcache, char *type);
+extern void print_bcache_statistics (struct bcache *bcache, const char *type);
extern int bcache_memory_used (struct bcache *bcache);
/* The hash functions */
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 4cd7a00e994..3925ec6189b 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -6215,7 +6215,7 @@ bptype_string (enum bptype type)
struct ep_type_description
{
enum bptype type;
- char *description;
+ const char *description;
};
static struct ep_type_description bptypes[] =
{
@@ -8507,7 +8507,7 @@ static struct breakpoint_ops catch_solib_breakpoint_ops;
created in an enabled state. */
void
-add_solib_catchpoint (char *arg, int is_load, int is_temp, int enabled)
+add_solib_catchpoint (const char *arg, int is_load, int is_temp, int enabled)
{
struct solib_catchpoint *c;
struct gdbarch *gdbarch = get_current_arch ();
@@ -8515,7 +8515,7 @@ add_solib_catchpoint (char *arg, int is_load, int is_temp, int enabled)
if (!arg)
arg = "";
- arg = skip_spaces (arg);
+ arg = skip_spaces_const (arg);
c = new solib_catchpoint ();
cleanup = make_cleanup (xfree, c);
@@ -15857,7 +15857,7 @@ static struct cmd_list_element *catch_cmdlist;
static struct cmd_list_element *tcatch_cmdlist;
void
-add_catch_command (char *name, char *docstring,
+add_catch_command (const char *name, const char *docstring,
cmd_sfunc_ftype *sfunc,
completer_ftype *completer,
void *user_data_catch,
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 6940270d80c..a7f2128a783 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1275,7 +1275,7 @@ extern void initialize_breakpoint_ops (void);
function. */
extern void
- add_catch_command (char *name, char *docstring,
+ add_catch_command (const char *name, const char *docstring,
cmd_sfunc_ftype *sfunc,
completer_ftype *completer,
void *user_data_catch,
@@ -1517,7 +1517,7 @@ extern int is_catchpoint (struct breakpoint *);
/* Shared helper function (MI and CLI) for creating and installing
a shared object event catchpoint. */
-extern void add_solib_catchpoint (char *arg, int is_load, int is_temp,
+extern void add_solib_catchpoint (const char *arg, int is_load, int is_temp,
int enabled);
/* Enable breakpoints and delete when hit. Called with ARG == NULL
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index 5d4775c0f0b..9769d207dda 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -464,7 +464,7 @@ bsd_uthread_update_thread_list (struct target_ops *ops)
}
/* Possible states a thread can be in. */
-static char *bsd_uthread_state[] =
+static const char *bsd_uthread_state[] =
{
"RUNNING",
"SIGTHREAD",
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 76d74f89a0b..cbad027d0c4 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -825,7 +825,7 @@ free_buildsym_compunit (void)
directory name actually is (by checking for a trailing '/'). */
void
-patch_subfile_names (struct subfile *subfile, char *name)
+patch_subfile_names (struct subfile *subfile, const char *name)
{
if (subfile != NULL
&& buildsym_compunit->comp_dir == NULL
diff --git a/gdb/buildsym.h b/gdb/buildsym.h
index fc5f0e7df61..60109a0da2e 100644
--- a/gdb/buildsym.h
+++ b/gdb/buildsym.h
@@ -194,7 +194,7 @@ typedef void (record_line_ftype) (struct subfile *subfile, int line,
/* Function to invoke get the next symbol. Return the symbol name. */
-EXTERN char *(*next_symbol_text_func) (struct objfile *);
+EXTERN const char *(*next_symbol_text_func) (struct objfile *);
extern void add_symbol_to_list (struct symbol *symbol,
struct pending **listhead);
@@ -216,7 +216,7 @@ extern void really_free_pendings (void *dummy);
extern void start_subfile (const char *name);
-extern void patch_subfile_names (struct subfile *subfile, char *name);
+extern void patch_subfile_names (struct subfile *subfile, const char *name);
extern void push_subfile (void);
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 7c25641738b..b2fc1959c05 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -70,7 +70,7 @@ int yyparse (void);
static int yylex (void);
-void yyerror (char *);
+void yyerror (const char *);
static int type_aggregate_p (struct type *);
@@ -2217,7 +2217,7 @@ DEF_ENUM_FLAGS_TYPE (enum token_flag, token_flags);
struct token
{
- char *oper;
+ const char *oper;
int token;
enum exp_opcode opcode;
token_flags flags;
@@ -3265,7 +3265,7 @@ c_print_token (FILE *file, int type, YYSTYPE value)
#endif
void
-yyerror (char *msg)
+yyerror (const char *msg)
{
if (prev_lexptr)
lexptr = prev_lexptr;
diff --git a/gdb/c-lang.h b/gdb/c-lang.h
index c4b19ecfef6..97462389724 100644
--- a/gdb/c-lang.h
+++ b/gdb/c-lang.h
@@ -63,7 +63,7 @@ DEF_ENUM_FLAGS_TYPE (enum c_string_type_values, c_string_type);
extern int c_parse (struct parser_state *);
-extern void c_yyerror (char *);
+extern void c_yyerror (const char *);
extern int c_parse_escape (const char **, struct obstack *);
@@ -120,7 +120,7 @@ extern void c_type_print_base (struct type *, struct ui_file *,
/* These are in cp-valprint.c */
extern void cp_print_class_member (const gdb_byte *, struct type *,
- struct ui_file *, char *);
+ struct ui_file *, const char *);
extern void cp_print_value_fields (struct type *, struct type *,
LONGEST, CORE_ADDR,
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c
index a5793e58639..e3b097b2275 100644
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -843,7 +843,7 @@ cplus_describe_child (const struct varobj *parent, int index,
}
else
{
- char *access = NULL;
+ const char *access = NULL;
int children[3];
cplus_class_num_children (type, children);
diff --git a/gdb/charset.c b/gdb/charset.c
index cc24f70e00d..8302c59bacd 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -706,7 +706,11 @@ static VEC (char_ptr) *charsets;
static void
find_charset_names (void)
{
- VEC_safe_push (char_ptr, charsets, GDB_DEFAULT_HOST_CHARSET);
+ /* Cast is fine here, because CHARSETS is never released. Note that
+ the vec does not hold "const char *" pointers instead of "char *"
+ because the non-phony version stores heap-allocated strings in
+ it. */
+ VEC_safe_push (char_ptr, charsets, (char *) GDB_DEFAULT_HOST_CHARSET);
VEC_safe_push (char_ptr, charsets, NULL);
}
@@ -775,7 +779,7 @@ static void
find_charset_names (void)
{
struct pex_obj *child;
- char *args[3];
+ const char *args[3];
int err, status;
int fail = 1;
int flags;
@@ -811,7 +815,8 @@ find_charset_names (void)
#endif
/* Note that we simply ignore errors here. */
if (!pex_run_in_environment (child, flags,
- args[0], args, environ_vector (iconv_env),
+ args[0], const_cast<char **> (args),
+ environ_vector (iconv_env),
NULL, NULL, &err))
{
FILE *in = pex_read_output (child, 0);
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index f7ffb6dfe56..4956ba76dff 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -242,10 +242,11 @@ help_command (char *command, int from_tty)
[Is that why this function writes output with *_unfiltered?] */
static void
-complete_command (char *arg, int from_tty)
+complete_command (char *arg_entry, int from_tty)
{
+ const char *arg = arg_entry;
int argpoint;
- char *point, *arg_prefix;
+ char *arg_prefix;
VEC (char_ptr) *completions;
dont_repeat ();
@@ -270,7 +271,7 @@ complete_command (char *arg, int from_tty)
within, and except for filenames at the beginning of, the word to
be completed. The following crude imitation of readline's
word-breaking tries to accomodate this. */
- point = arg + argpoint;
+ const char *point = arg + argpoint;
while (point > arg)
{
if (strchr (rl_completer_word_break_characters, point[-1]) != 0)
@@ -392,10 +393,7 @@ cd_command (char *dir, int from_tty)
repeat might be useful but is more likely to be a mistake. */
dont_repeat ();
- if (dir == 0)
- dir = "~";
-
- dir = tilde_expand (dir);
+ dir = tilde_expand (dir != NULL ? dir : "~");
cleanup = make_cleanup (xfree, dir);
if (chdir (dir) < 0)
@@ -809,7 +807,7 @@ edit_command (char *arg, int from_tty)
struct symtabs_and_lines sals;
struct symtab_and_line sal;
struct symbol *sym;
- char *editor;
+ const char *editor;
char *p;
const char *fn;
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 4e302b7e8de..fc14465211f 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -1479,7 +1479,8 @@ undef_cmd_error (const char *cmdtype, const char *q)
the function field of the struct cmd_list_element is 0). */
struct cmd_list_element *
-lookup_cmd (const char **line, struct cmd_list_element *list, char *cmdtype,
+lookup_cmd (const char **line, struct cmd_list_element *list,
+ const char *cmdtype,
int allow_unknown, int ignore_help_classes)
{
struct cmd_list_element *last_list = 0;
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 96302615d04..213622d8f35 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -247,7 +247,7 @@ dump_memory_to_file (const char *cmd, const char *mode, const char *file_format)
}
static void
-dump_memory_command (char *cmd, char *mode)
+dump_memory_command (char *cmd, const char *mode)
{
dump_memory_to_file (cmd, mode, "binary");
}
@@ -298,7 +298,7 @@ dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
}
static void
-dump_value_command (char *cmd, char *mode)
+dump_value_command (char *cmd, const char *mode)
{
dump_value_to_file (cmd, mode, "binary");
}
@@ -377,8 +377,8 @@ append_binary_value (char *args, int from_tty)
struct dump_context
{
- void (*func) (char *cmd, char *mode);
- char *mode;
+ void (*func) (char *cmd, const char *mode);
+ const char *mode;
};
static void
@@ -390,8 +390,9 @@ call_dump_func (struct cmd_list_element *c, char *args, int from_tty)
}
static void
-add_dump_command (char *name, void (*func) (char *args, char *mode),
- char *descr)
+add_dump_command (const char *name,
+ void (*func) (char *args, const char *mode),
+ const char *descr)
{
struct cmd_list_element *c;
@@ -576,7 +577,7 @@ restore_command (char *args_in, int from_tty)
filename = scan_filename_with_cleanup (&args, NULL);
if (args != NULL && *args != '\0')
{
- char *binary_string = "binary";
+ static const char binary_string[] = "binary";
/* Look for optional "binary" flag. */
if (startswith (args, binary_string))
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index c3f1c65b228..33b657d64f1 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -166,7 +166,7 @@ build_command_line (enum command_control_type type, const char *args)
such as "if" and "while". */
struct command_line *
-get_command_line (enum command_control_type type, char *arg)
+get_command_line (enum command_control_type type, const char *arg)
{
struct command_line *cmd;
struct cleanup *old_chain = NULL;
diff --git a/gdb/cli/cli-script.h b/gdb/cli/cli-script.h
index 969c5c6e499..c8859763a3d 100644
--- a/gdb/cli/cli-script.h
+++ b/gdb/cli/cli-script.h
@@ -39,7 +39,7 @@ extern enum command_control_type
execute_control_command_untraced (struct command_line *cmd);
extern struct command_line *get_command_line (enum command_control_type,
- char *);
+ const char *);
extern void print_command_lines (struct ui_out *,
struct command_line *, unsigned int);
diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c
index 65004c095c8..e8c6b67d623 100644
--- a/gdb/coff-pe-read.c
+++ b/gdb/coff-pe-read.c
@@ -54,7 +54,7 @@ struct read_pe_section_data
enum minimal_symbol_type ms_type; /* Type to assign symbols in
section. */
unsigned int index; /* BFD section number. */
- char *section_name; /* Recorded section name. */
+ const char *section_name; /* Recorded section name. */
};
#define IMAGE_SCN_CNT_CODE 0x20
diff --git a/gdb/command.h b/gdb/command.h
index 2c86da4550f..ae200217be0 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -204,7 +204,8 @@ extern enum cmd_types cmd_type (struct cmd_list_element *cmd);
#define CMD_LIST_AMBIGUOUS ((struct cmd_list_element *) -1)
extern struct cmd_list_element *lookup_cmd (const char **,
- struct cmd_list_element *, char *,
+ struct cmd_list_element *,
+ const char *,
int, int);
extern struct cmd_list_element *lookup_cmd_1 (const char **,
diff --git a/gdb/common/print-utils.c b/gdb/common/print-utils.c
index a0fb54139ac..52ecaf1b2e5 100644
--- a/gdb/common/print-utils.c
+++ b/gdb/common/print-utils.c
@@ -38,7 +38,7 @@ get_print_cell (void)
}
static char *
-decimal2str (char *sign, ULONGEST addr, int width)
+decimal2str (const char *sign, ULONGEST addr, int width)
{
/* Steal code from valprint.c:print_decimal(). Should this worry
about the real size of addr as the above does? */
diff --git a/gdb/completer.c b/gdb/completer.c
index 9183e2aef7a..7e46416b1c7 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -1684,7 +1684,8 @@ gdb_print_filename (char *to_print, char *full_pathname, int prefix_bytes,
const struct match_list_displayer *displayer)
{
int printed_len, extension_char, slen, tlen;
- char *s, c, *new_full_pathname, *dn;
+ char *s, c, *new_full_pathname;
+ const char *dn;
extern int _rl_complete_mark_directories;
extension_char = 0;
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 54cb789d797..13a90b967fe 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -509,7 +509,7 @@ complete_set_gnutarget (struct cmd_list_element *cmd,
/* Set the gnutarget. */
void
-set_gnutarget (char *newtarget)
+set_gnutarget (const char *newtarget)
{
if (gnutarget_string != NULL)
xfree (gnutarget_string);
diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y
index 73a4d9083a7..78745cb5c7e 100644
--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -173,7 +173,7 @@ static struct demangle_component *d_binary (const char *,
int yyparse (void);
static int yylex (void);
-static void yyerror (char *);
+static void yyerror (const char *);
/* Enable yydebug for the stand-alone parser. */
#ifdef TEST_CPNAMES
@@ -1934,7 +1934,7 @@ yylex (void)
}
static void
-yyerror (char *msg)
+yyerror (const char *msg)
{
if (global_errmsg)
return;
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 143bb48db37..73fe03d5c9b 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -759,7 +759,7 @@ cp_find_class_member (struct type **self_p, int *fieldno,
void
cp_print_class_member (const gdb_byte *valaddr, struct type *type,
- struct ui_file *stream, char *prefix)
+ struct ui_file *stream, const char *prefix)
{
enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index aefd44ad192..a46356ff8b6 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -1695,7 +1695,7 @@ cris_special_register_name (struct gdbarch *gdbarch, int regno)
static const char *
cris_register_name (struct gdbarch *gdbarch, int regno)
{
- static char *cris_genreg_names[] =
+ static const char *cris_genreg_names[] =
{ "r0", "r1", "r2", "r3", \
"r4", "r5", "r6", "r7", \
"r8", "r9", "r10", "r11", \
@@ -1720,14 +1720,14 @@ cris_register_name (struct gdbarch *gdbarch, int regno)
static const char *
crisv32_register_name (struct gdbarch *gdbarch, int regno)
{
- static char *crisv32_genreg_names[] =
+ static const char *crisv32_genreg_names[] =
{ "r0", "r1", "r2", "r3", \
"r4", "r5", "r6", "r7", \
"r8", "r9", "r10", "r11", \
"r12", "r13", "sp", "acr"
};
- static char *crisv32_sreg_names[] =
+ static const char *crisv32_sreg_names[] =
{ "s0", "s1", "s2", "s3", \
"s4", "s5", "s6", "s7", \
"s8", "s9", "s10", "s11", \
diff --git a/gdb/d-exp.y b/gdb/d-exp.y
index 8625e41f3cc..06eef5f2293 100644
--- a/gdb/d-exp.y
+++ b/gdb/d-exp.y
@@ -69,7 +69,7 @@ int yyparse (void);
static int yylex (void);
-void yyerror (char *);
+void yyerror (const char *);
static int type_aggregate_p (struct type *);
@@ -957,7 +957,7 @@ parse_string_or_char (const char *tokptr, const char **outptr,
struct token
{
- char *oper;
+ const char *oper;
int token;
enum exp_opcode opcode;
};
@@ -1648,7 +1648,7 @@ d_parse (struct parser_state *par_state)
}
void
-yyerror (char *msg)
+yyerror (const char *msg)
{
if (prev_lexptr)
lexptr = prev_lexptr;
diff --git a/gdb/d-lang.h b/gdb/d-lang.h
index 27e05a1d8ce..f47050aa301 100644
--- a/gdb/d-lang.h
+++ b/gdb/d-lang.h
@@ -58,7 +58,7 @@ struct builtin_d_type
extern int d_parse (struct parser_state *);
-extern void d_yyerror (char *);
+extern void d_yyerror (const char *);
/* Defined in d-lang.c */
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index e95d2287ff5..daa3ce9f813 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -237,7 +237,7 @@ find_text_range (bfd * sym_bfd, struct objfile *objfile)
struct header_file_location
{
- char *name; /* Name of header file */
+ const char *name; /* Name of header file */
int instance; /* See above */
struct partial_symtab *pst; /* Partial symtab that has the
BINCL/EINCL defs for this file. */
@@ -262,13 +262,14 @@ static void read_dbx_symtab (minimal_symbol_reader &, struct objfile *);
static void free_bincl_list (struct objfile *);
-static struct partial_symtab *find_corresponding_bincl_psymtab (char *, int);
+static struct partial_symtab *find_corresponding_bincl_psymtab (const char *,
+ int);
-static void add_bincl_to_list (struct partial_symtab *, char *, int);
+static void add_bincl_to_list (struct partial_symtab *, const char *, int);
static void init_bincl_list (int, struct objfile *);
-static char *dbx_next_symbol_text (struct objfile *);
+static const char *dbx_next_symbol_text (struct objfile *);
static void fill_symbuf (bfd *);
@@ -284,13 +285,13 @@ static void record_minimal_symbol (minimal_symbol_reader &,
const char *, CORE_ADDR, int,
struct objfile *);
-static void add_new_header_file (char *, int);
+static void add_new_header_file (const char *, int);
-static void add_old_header_file (char *, int);
+static void add_old_header_file (const char *, int);
static void add_this_object_header_file (int);
-static struct partial_symtab *start_psymtab (struct objfile *, char *,
+static struct partial_symtab *start_psymtab (struct objfile *, const char *,
CORE_ADDR, int,
struct partial_symbol **,
struct partial_symbol **);
@@ -340,7 +341,7 @@ add_this_object_header_file (int i)
symbol tables for the same header file. */
static void
-add_old_header_file (char *name, int instance)
+add_old_header_file (const char *name, int instance)
{
struct header_file *p = HEADER_FILES (dbxread_objfile);
int i;
@@ -366,7 +367,7 @@ add_old_header_file (char *name, int instance)
so we record the file when its "begin" is seen and ignore the "end". */
static void
-add_new_header_file (char *name, int instance)
+add_new_header_file (const char *name, int instance)
{
int i;
struct header_file *hfile;
@@ -734,7 +735,7 @@ static int symbuf_end;
/* Name of last function encountered. Used in Solaris to approximate
object file boundaries. */
-static char *last_function_name;
+static const char *last_function_name;
/* The address in memory of the string table of the object file we are
reading (which might not be the "main" object file, but might be a
@@ -842,7 +843,7 @@ stabs_seek (int sym_offset)
(a \ at the end of the text of a name)
call this function to get the continuation. */
-static char *
+static const char *
dbx_next_symbol_text (struct objfile *objfile)
{
struct internal_nlist nlist;
@@ -873,7 +874,7 @@ init_bincl_list (int number, struct objfile *objfile)
/* Add a bincl to the list. */
static void
-add_bincl_to_list (struct partial_symtab *pst, char *name, int instance)
+add_bincl_to_list (struct partial_symtab *pst, const char *name, int instance)
{
if (next_bincl >= bincl_list + bincls_allocated)
{
@@ -895,7 +896,7 @@ add_bincl_to_list (struct partial_symtab *pst, char *name, int instance)
with that header_file_location. */
static struct partial_symtab *
-find_corresponding_bincl_psymtab (char *name, int instance)
+find_corresponding_bincl_psymtab (const char *name, int instance)
{
struct header_file_location *bincl;
@@ -933,10 +934,10 @@ make_cleanup_free_bincl_list (struct objfile *objfile)
give a fake name, and print a single error message per symbol file read,
rather than abort the symbol reading or flood the user with messages. */
-static char *
+static const char *
set_namestring (struct objfile *objfile, const struct internal_nlist *nlist)
{
- char *namestring;
+ const char *namestring;
if (nlist->n_strx + file_string_table_offset
>= DBX_STRINGTAB_SIZE (objfile)
@@ -954,18 +955,19 @@ set_namestring (struct objfile *objfile, const struct internal_nlist *nlist)
}
static CORE_ADDR
-find_stab_function_addr (char *namestring, const char *filename,
+find_stab_function_addr (const char *namestring, const char *filename,
struct objfile *objfile)
{
struct bound_minimal_symbol msym;
- char *p;
int n;
- p = strchr (namestring, ':');
- if (p == NULL)
- p = namestring;
- n = p - namestring;
- p = (char *) alloca (n + 2);
+ const char *colon = strchr (namestring, ':');
+ if (colon == NULL)
+ n = 0;
+ else
+ n = colon - namestring;
+
+ char *p = (char *) alloca (n + 2);
strncpy (p, namestring, n);
p[n] = 0;
@@ -1017,10 +1019,10 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
struct internal_nlist nlist;
CORE_ADDR text_addr;
int text_size;
- char *sym_name;
+ const char *sym_name;
int sym_len;
- char *namestring;
+ const char *namestring;
int nsl;
int past_first_source_file = 0;
CORE_ADDR last_function_start = 0;
@@ -1283,7 +1285,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
static int prev_so_symnum = -10;
static int first_so_symnum;
const char *p;
- static char *dirname_nso;
+ static const char *dirname_nso;
int prev_textlow_not_set;
valu = nlist.n_value + ANOFFSET (objfile->section_offsets,
@@ -1477,7 +1479,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
case N_M2C: /* I suspect that I can ignore this here. */
case N_SCOPE: /* Same. */
{
- char *p;
+ const char *p;
namestring = set_namestring (objfile, &nlist);
@@ -1631,7 +1633,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
Accept either. */
while (*p && *p != ';' && *p != ',')
{
- char *q;
+ const char *q;
/* Check for and handle cretinous dbx symbol name
continuation! */
@@ -1996,7 +1998,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
(normal). */
static struct partial_symtab *
-start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow,
+start_psymtab (struct objfile *objfile, const char *filename, CORE_ADDR textlow,
int ldsymoff, struct partial_symbol **global_syms,
struct partial_symbol **static_syms)
{
@@ -2057,15 +2059,15 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
if (pst->texthigh == 0 && last_function_name
&& gdbarch_sofun_address_maybe_missing (gdbarch))
{
- char *p;
int n;
struct bound_minimal_symbol minsym;
- p = strchr (last_function_name, ':');
- if (p == NULL)
- p = last_function_name;
- n = p - last_function_name;
- p = (char *) alloca (n + 2);
+ const char *colon = strchr (last_function_name, ':');
+ if (colon == NULL)
+ n = 0;
+ else
+ n = colon - last_function_name;
+ char *p = (char *) alloca (n + 2);
strncpy (p, last_function_name, n);
p[n] = 0;
@@ -2293,7 +2295,7 @@ dbx_read_symtab (struct partial_symtab *self, struct objfile *objfile)
static void
read_ofile_symtab (struct objfile *objfile, struct partial_symtab *pst)
{
- char *namestring;
+ const char *namestring;
struct external_nlist *bufp;
struct internal_nlist nlist;
unsigned char type;
@@ -2499,7 +2501,7 @@ cp_set_block_scope (const struct symbol *symbol,
is used in end_symtab. */
void
-process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
+process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
const struct section_offsets *section_offsets,
struct objfile *objfile)
{
@@ -2805,7 +2807,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
down ONE MORE function call level, which we really don't want
to do). */
{
- char *p;
+ const char *p;
/* Normal object file and NLMs have non-zero text seg offsets,
but don't need their static syms offset in this fashion.
@@ -2898,7 +2900,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
if (name)
{
int deftype;
- char *colon_pos = strchr (name, ':');
+ const char *colon_pos = strchr (name, ':');
if (colon_pos == NULL)
deftype = '\0';
@@ -3021,7 +3023,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
definition. If a symbol reference is being defined, go ahead
and add it. Otherwise, just return. */
- char *s = name;
+ const char *s = name;
int refnum;
/* If this stab defines a new reference ID that is not on the
diff --git a/gdb/defs.h b/gdb/defs.h
index aa586055d39..f689ec5048a 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -309,7 +309,7 @@ typedef void initialize_file_ftype (void);
extern char *gdb_readline_wrapper (const char *);
-extern char *command_line_input (const char *, int, char *);
+extern char *command_line_input (const char *, int, const char *);
extern void print_prompt (void);
@@ -324,7 +324,8 @@ extern int info_verbose;
extern void set_next_address (struct gdbarch *, CORE_ADDR);
extern int print_address_symbolic (struct gdbarch *, CORE_ADDR,
- struct ui_file *, int, char *);
+ struct ui_file *, int,
+ const char *);
extern int build_address_symbolic (struct gdbarch *,
CORE_ADDR addr,
@@ -678,7 +679,7 @@ extern int (*deprecated_query_hook) (const char *, va_list)
extern void (*deprecated_warning_hook) (const char *, va_list)
ATTRIBUTE_FPTR_PRINTF(1,0);
extern void (*deprecated_interactive_hook) (void);
-extern void (*deprecated_readline_begin_hook) (char *, ...)
+extern void (*deprecated_readline_begin_hook) (const char *, ...)
ATTRIBUTE_FPTR_PRINTF_1;
extern char *(*deprecated_readline_hook) (const char *);
extern void (*deprecated_readline_end_hook) (void);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index aa20c42db6c..966e1ee81ba 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1825,7 +1825,7 @@ static const char *dwarf_attr_name (unsigned int);
static const char *dwarf_form_name (unsigned int);
-static char *dwarf_bool_name (unsigned int);
+static const char *dwarf_bool_name (unsigned int);
static const char *dwarf_type_encoding_name (unsigned int);
@@ -19800,7 +19800,7 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu)
prefix part in such case. See
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47510. */
-static char *
+static const char *
anonymous_struct_prefix (struct die_info *die, struct dwarf2_cu *cu)
{
struct attribute *attr;
@@ -19853,7 +19853,7 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
struct die_info *parent, *spec_die;
struct dwarf2_cu *spec_cu;
struct type *parent_type;
- char *retval;
+ const char *retval;
if (cu->language != language_cplus
&& cu->language != language_fortran && cu->language != language_d
@@ -20255,7 +20255,7 @@ dwarf_form_name (unsigned form)
return name;
}
-static char *
+static const char *
dwarf_bool_name (unsigned mybool)
{
if (mybool)
diff --git a/gdb/event-top.c b/gdb/event-top.c
index dd2770a8806..1281df89225 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -650,7 +650,7 @@ command_line_append_input_line (struct buffer *cmd_line_buffer, char *rl)
char *
handle_line_of_input (struct buffer *cmd_line_buffer,
- char *rl, int repeat, char *annotation_suffix)
+ char *rl, int repeat, const char *annotation_suffix)
{
struct ui *ui = current_ui;
int from_tty = ui->instream == ui->stdin_stream;
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index b0f28d9a97d..f9a80a0b3fa 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -221,8 +221,8 @@ catch_exceptions_with_msg (struct ui_out *func_uiout,
/* This function is superseded by catch_exceptions(). */
int
-catch_errors (catch_errors_ftype *func, void *func_args, char *errstring,
- return_mask mask)
+catch_errors (catch_errors_ftype *func, void *func_args,
+ const char *errstring, return_mask mask)
{
struct gdb_exception exception = exception_none;
volatile int val = 0;
diff --git a/gdb/exceptions.h b/gdb/exceptions.h
index cf7d0f0d1e2..b2cdee3c43c 100644
--- a/gdb/exceptions.h
+++ b/gdb/exceptions.h
@@ -86,7 +86,8 @@ extern int catch_exceptions_with_msg (struct ui_out *uiout,
This function is superseded by catch_exceptions(). */
typedef int (catch_errors_ftype) (void *);
-extern int catch_errors (catch_errors_ftype *, void *, char *, return_mask);
+extern int catch_errors (catch_errors_ftype *, void *,
+ const char *, return_mask);
/* Compare two exception objects for print equality. */
extern int exception_print_same (struct gdb_exception e1,
diff --git a/gdb/expprint.c b/gdb/expprint.c
index b74d32cb410..9b8ac4c070b 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -62,7 +62,7 @@ print_subexp_standard (struct expression *exp, int *pos,
const struct op_print *op_print_tab;
int pc;
unsigned nargs;
- char *op_str;
+ const char *op_str;
int assign_modify = 0;
enum exp_opcode opcode;
enum precedence myprec = PREC_NULL;
@@ -649,7 +649,7 @@ print_subexp_standard (struct expression *exp, int *pos,
/* Return the operator corresponding to opcode OP as
a string. NULL indicates that the opcode was not found in the
current language table. */
-char *
+const char *
op_string (enum exp_opcode op)
{
int tem;
@@ -669,7 +669,7 @@ static int dump_subexp_body (struct expression *exp, struct ui_file *, int);
/* Name for OPCODE, when it appears in expression EXP. */
-char *
+const char *
op_name (struct expression *exp, enum exp_opcode opcode)
{
return exp->language_defn->la_exp_desc->op_name (opcode);
@@ -678,7 +678,7 @@ op_name (struct expression *exp, enum exp_opcode opcode)
/* Default name for the standard operator OPCODE (i.e., one defined in
the definition of enum exp_opcode). */
-char *
+const char *
op_name_standard (enum exp_opcode opcode)
{
switch (opcode)
@@ -703,10 +703,9 @@ op_name_standard (enum exp_opcode opcode)
void
dump_raw_expression (struct expression *exp, struct ui_file *stream,
- char *note)
+ const char *note)
{
int elt;
- char *opcode_name;
char *eltscan;
int eltsize;
@@ -722,9 +721,10 @@ dump_raw_expression (struct expression *exp, struct ui_file *stream,
for (elt = 0; elt < exp->nelts; elt++)
{
fprintf_filtered (stream, "\t%5d ", elt);
- opcode_name = op_name (exp, exp->elts[elt].opcode);
+ const char *opcode_name = op_name (exp, exp->elts[elt].opcode);
fprintf_filtered (stream, "%20s ", opcode_name);
+
print_longest (stream, 'd', 0, exp->elts[elt].longconst);
fprintf_filtered (stream, " ");
diff --git a/gdb/expression.h b/gdb/expression.h
index e4e96f6cf42..8fe6b070445 100644
--- a/gdb/expression.h
+++ b/gdb/expression.h
@@ -146,12 +146,12 @@ extern struct value *evaluate_subexp_standard
extern void print_expression (struct expression *, struct ui_file *);
-extern char *op_name (struct expression *exp, enum exp_opcode opcode);
+extern const char *op_name (struct expression *exp, enum exp_opcode opcode);
-extern char *op_string (enum exp_opcode);
+extern const char *op_string (enum exp_opcode);
extern void dump_raw_expression (struct expression *,
- struct ui_file *, char *);
+ struct ui_file *, const char *);
extern void dump_prefix_expression (struct expression *, struct ui_file *);
/* In an OP_RANGE expression, either bound could be empty, indicating
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 49d797d7d45..7e9e234bf68 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -72,7 +72,7 @@ int yyparse (void);
static int yylex (void);
-void yyerror (char *);
+void yyerror (const char *);
static void growbuf_by_size (int);
@@ -773,7 +773,7 @@ parse_number (struct parser_state *par_state,
struct token
{
- char *oper;
+ const char *oper;
int token;
enum exp_opcode opcode;
};
@@ -807,7 +807,7 @@ static const struct token dot_ops[] =
struct f77_boolean_val
{
- char *name;
+ const char *name;
int value;
};
@@ -1219,7 +1219,7 @@ f_parse (struct parser_state *par_state)
}
void
-yyerror (char *msg)
+yyerror (const char *msg)
{
if (prev_lexptr)
lexptr = prev_lexptr;
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
index 08a5f2578f1..5633b4121d8 100644
--- a/gdb/f-lang.h
+++ b/gdb/f-lang.h
@@ -25,7 +25,7 @@ struct parser_state;
extern int f_parse (struct parser_state *);
-extern void f_yyerror (char *); /* Defined in f-exp.y */
+extern void f_yyerror (const char *); /* Defined in f-exp.y */
extern void f_print_type (struct type *, const char *, struct ui_file *, int,
int, const struct type_print_options *);
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index dc2a314edf0..04d2cdfbfac 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -292,7 +292,7 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
<args>". */
argv = (char **) alloca (4 * sizeof (char *));
argv[0] = shell_file;
- argv[1] = "-c";
+ argv[1] = (char *) "-c";
argv[2] = shell_command;
argv[3] = (char *) 0;
}
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 87124e7efdb..87447337a87 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -87,7 +87,7 @@ struct gdbarch_tdep
int num_hw_breakpoints;
/* Register names. */
- char **register_names;
+ const char **register_names;
};
/* Return the FR-V ABI associated with GDBARCH. */
@@ -147,8 +147,8 @@ new_variant (void)
/* By default, don't supply any general-purpose or floating-point
register names. */
var->register_names
- = (char **) xmalloc ((frv_num_regs + frv_num_pseudo_regs)
- * sizeof (char *));
+ = (const char **) xmalloc ((frv_num_regs + frv_num_pseudo_regs)
+ * sizeof (const char *));
for (r = 0; r < frv_num_regs + frv_num_pseudo_regs; r++)
var->register_names[r] = "";
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 6debb10f594..319a8902a83 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -84,7 +84,7 @@ pstring (const char *string)
return string;
}
-static char *
+static const char *
pstring_ptr (char **string)
{
if (string == NULL || *string == NULL)
@@ -95,7 +95,7 @@ pstring_ptr (char **string)
/* Helper function to print a list of strings, represented as "const
char *const *". The list is printed comma-separated. */
-static char *
+static const char *
pstring_list (const char *const *list)
{
static char ret[100];
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index c471b73cb10..bdfb6b20d0f 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -1678,7 +1678,7 @@ pstring (const char *string)
return string;
}
-static char *
+static const char *
pstring_ptr (char **string)
{
if (string == NULL || *string == NULL)
@@ -1689,7 +1689,7 @@ pstring_ptr (char **string)
/* Helper function to print a list of strings, represented as "const
char *const *". The list is printed comma-separated. */
-static char *
+static const char *
pstring_list (const char *const *list)
{
static char ret[100];
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index 12ce46669d1..40ae37c69f2 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -167,7 +167,7 @@ extern void validate_files (void);
extern char *gnutarget;
-extern void set_gnutarget (char *);
+extern void set_gnutarget (const char *);
/* Structure to keep track of core register reading functions for
various core file types. */
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 0bfe2ecf83d..a09006a5d42 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,10 @@
2017-04-05 Pedro Alves <palves@redhat.com>
+ * gdbreplay.c (sync_error): Constify.
+ * linux-x86-low.c (push_opcode): Constify.
+
+2017-04-05 Pedro Alves <palves@redhat.com>
+
* win32-low.c (get_child_debug_event)
<CREATE_PROCESS_DEBUG_EVENT>: Don't report TARGET_WAITKIND_EXECD.
Report TARGET_WAITKIND_SPURIOUS instead.
diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c
index 3bd9f3f0a6e..b76850617fb 100644
--- a/gdb/gdbserver/gdbreplay.c
+++ b/gdb/gdbserver/gdbreplay.c
@@ -142,7 +142,7 @@ perror_with_name (const char *string)
}
static void
-sync_error (FILE *fp, char *desc, int expect, int got)
+sync_error (FILE *fp, const char *desc, int expect, int got)
{
fprintf (stderr, "\n%s\n", desc);
fprintf (stderr, "At logfile offset %ld, expected '0x%x' got '0x%x'\n",
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 6df1d5169f0..b39026ceae8 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -1067,7 +1067,7 @@ append_insns (CORE_ADDR *to, size_t len, const unsigned char *buf)
}
static int
-push_opcode (unsigned char *buf, char *op)
+push_opcode (unsigned char *buf, const char *op)
{
unsigned char *buf_org = buf;
diff --git a/gdb/go-exp.y b/gdb/go-exp.y
index c4d0d2bde7e..1906e68c7a9 100644
--- a/gdb/go-exp.y
+++ b/gdb/go-exp.y
@@ -81,7 +81,7 @@ int yyparse (void);
static int yylex (void);
-void yyerror (char *);
+void yyerror (const char *);
%}
@@ -936,7 +936,7 @@ parse_string_or_char (const char *tokptr, const char **outptr,
struct token
{
- char *oper;
+ const char *oper;
int token;
enum exp_opcode opcode;
};
@@ -1588,7 +1588,7 @@ go_parse (struct parser_state *par_state)
}
void
-yyerror (char *msg)
+yyerror (const char *msg)
{
if (prev_lexptr)
lexptr = prev_lexptr;
diff --git a/gdb/go-lang.h b/gdb/go-lang.h
index 101cf9da8b6..e08b2f0a806 100644
--- a/gdb/go-lang.h
+++ b/gdb/go-lang.h
@@ -60,7 +60,7 @@ enum go_type
extern int go_parse (struct parser_state *);
-extern void go_yyerror (char *);
+extern void go_yyerror (const char *);
/* Defined in go-lang.c. */
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index d2d8d7affaa..a20067e7ef7 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -1126,7 +1126,7 @@ go32_sysinfo (char *arg, int from_tty)
/* CPUID with EAX = 1 returns processor signature and features. */
if (cpuid_max >= 1)
{
- static char *brand_name[] = {
+ static const char *brand_name[] = {
"",
" Celeron",
" III",
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index 71cffbb273f..9189446f114 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -851,7 +851,6 @@ gdbscm_breakpoint_expression (SCM self)
{
breakpoint_smob *bp_smob
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- char *str;
struct watchpoint *wp;
if (!is_watchpoint (bp_smob->bp))
@@ -859,7 +858,7 @@ gdbscm_breakpoint_expression (SCM self)
wp = (struct watchpoint *) bp_smob->bp;
- str = wp->exp_string;
+ const char *str = wp->exp_string;
if (! str)
str = "";
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index 5f6d442fbbc..ae5d14599db 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -291,8 +291,10 @@ cmdscm_destroyer (struct cmd_list_element *self, void *context)
/* Called by gdb to invoke the command. */
static void
-cmdscm_function (struct cmd_list_element *command, char *args, int from_tty)
+cmdscm_function (struct cmd_list_element *command,
+ char *args_entry, int from_tty)
{
+ const char *args = args_entry;
command_smob *c_smob/*obj*/ = (command_smob *) get_cmd_context (command);
SCM arg_scm, tty_scm, result;
diff --git a/gdb/guile/scm-param.c b/gdb/guile/scm-param.c
index 6d2cc139f5a..ab00fd93e5d 100644
--- a/gdb/guile/scm-param.c
+++ b/gdb/guile/scm-param.c
@@ -602,7 +602,7 @@ pascm_param_value (enum var_types type, void *var,
case var_filename:
case var_enum:
{
- char *str = * (char **) var;
+ const char *str = *(char **) var;
if (str == NULL)
str = "";
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 10ef7962e2f..060e5d37148 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -954,7 +954,7 @@ h8300_register_name (struct gdbarch *gdbarch, int regno)
{
/* The register names change depending on which h8300 processor
type is selected. */
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6",
"sp", "", "pc", "cycles", "tick", "inst",
"ccr", /* pseudo register */
@@ -971,7 +971,7 @@ h8300_register_name (struct gdbarch *gdbarch, int regno)
static const char *
h8300s_register_name (struct gdbarch *gdbarch, int regno)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"er0", "er1", "er2", "er3", "er4", "er5", "er6",
"sp", "", "pc", "cycles", "", "tick", "inst",
"mach", "macl",
@@ -989,7 +989,7 @@ h8300s_register_name (struct gdbarch *gdbarch, int regno)
static const char *
h8300sx_register_name (struct gdbarch *gdbarch, int regno)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"er0", "er1", "er2", "er3", "er4", "er5", "er6",
"sp", "", "pc", "cycles", "", "tick", "inst",
"mach", "macl", "sbr", "vbr",
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index a5053c6868d..2636a27bbbe 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -613,7 +613,7 @@ typedef BP_MANIPULATION (hppa_break_insn) hppa_breakpoint;
static const char *
hppa32_register_name (struct gdbarch *gdbarch, int i)
{
- static char *names[] = {
+ static const char *names[] = {
"flags", "r1", "rp", "r3",
"r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11",
@@ -656,7 +656,7 @@ hppa32_register_name (struct gdbarch *gdbarch, int i)
static const char *
hppa64_register_name (struct gdbarch *gdbarch, int i)
{
- static char *names[] = {
+ static const char *names[] = {
"flags", "r1", "rp", "r3",
"r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11",
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 4c53bc6b05a..22e158866bb 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -140,7 +140,7 @@ enum pseudo_regs { FIRST_PSEUDO_REGNUM = NUM_IA64_RAW_REGS,
/* Array of register names; There should be ia64_num_regs strings in
the initializer. */
-static char *ia64_register_names[] =
+static const char *ia64_register_names[] =
{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index d41e609f8e2..f6ffb9ba186 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -261,14 +261,14 @@ construct_inferior_arguments (int argc, char **argv)
#ifdef __MINGW32__
/* This holds all the characters considered special to the
Windows shells. */
- char *special = "\"!&*|[]{}<>?`~^=;, \t\n";
- const char quote = '"';
+ static const char special[] = "\"!&*|[]{}<>?`~^=;, \t\n";
+ static const char quote = '"';
#else
/* This holds all the characters considered special to the
typical Unix shells. We include `^' because the SunOS
/bin/sh treats it as a synonym for `|'. */
- char *special = "\"!#$&*()\\|[]{}<>?'`~^; \t\n";
- const char quote = '\'';
+ static const char special[] = "\"!#$&*()\\|[]{}<>?'`~^; \t\n";
+ static const char quote = '\'';
#endif
int i;
int length = 0;
@@ -2267,7 +2267,7 @@ static void
path_command (char *dirname, int from_tty)
{
char *exec_path;
- char *env;
+ const char *env;
dont_repeat ();
env = get_in_environ (current_inferior ()->environment, path_var_name);
@@ -2681,7 +2681,7 @@ enum attach_post_wait_mode
should be running. Else if ATTACH, */
static void
-attach_post_wait (char *args, int from_tty, enum attach_post_wait_mode mode)
+attach_post_wait (const char *args, int from_tty, enum attach_post_wait_mode mode)
{
struct inferior *inferior;
diff --git a/gdb/language.c b/gdb/language.c
index f1fc220ea89..ee0101db74a 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -46,7 +46,7 @@
extern void _initialize_language (void);
-static void unk_lang_error (char *);
+static void unk_lang_error (const char *);
static int unk_lang_parser (struct parser_state *);
@@ -206,7 +206,7 @@ show_range_command (struct ui_file *file, int from_tty,
{
if (range_mode == range_mode_auto)
{
- char *tmp;
+ const char *tmp;
switch (range_check)
{
@@ -280,7 +280,7 @@ show_case_command (struct ui_file *file, int from_tty,
{
if (case_mode == case_mode_auto)
{
- char *tmp = NULL;
+ const char *tmp = NULL;
switch (case_sensitivity)
{
@@ -731,7 +731,7 @@ unk_lang_parser (struct parser_state *ps)
}
static void
-unk_lang_error (char *msg)
+unk_lang_error (const char *msg)
{
error (_("Attempted to parse an expression with unknown language"));
}
diff --git a/gdb/language.h b/gdb/language.h
index 96080ac4eca..58bcbe8faec 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -183,7 +183,7 @@ struct language_defn
/* Parser error function. */
- void (*la_error) (char *);
+ void (*la_error) (const char *);
/* Given an expression *EXPP created by prefixifying the result of
la_parser, perform any remaining processing necessary to complete
@@ -271,7 +271,7 @@ struct language_defn
/* If this is non-NULL, specifies the name that of the implicit
local variable that refers to the current object instance. */
- char *la_name_of_this;
+ const char *la_name_of_this;
/* This is a function that lookup_symbol will call when it gets to
the part of symbol lookup where C looks up static and global
diff --git a/gdb/linespec.c b/gdb/linespec.c
index a3cb0cbba16..dcbe25375dc 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1293,7 +1293,8 @@ decode_line_2 (struct linespec_state *self,
struct symtabs_and_lines *result,
const char *select_mode)
{
- char *args, *prompt;
+ char *args;
+ const char *prompt;
int i;
struct cleanup *old_chain;
VEC (const_char_ptr) *filters = NULL;
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 0e2607b5d96..eda3d7bff16 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -262,7 +262,7 @@ struct private_thread_info
};
-static char *
+static const char *
thread_db_err_str (td_err_e err)
{
static char buf[64];
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 3cd93381bdd..bd3e182a675 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -91,7 +91,7 @@ lm32_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
static const char *
lm32_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index acf2e1b83dc..9179187aa20 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -65,7 +65,7 @@ int yyparse (void);
static int yylex (void);
-void yyerror (char *);
+void yyerror (const char *);
static int parse_number (int);
@@ -1050,7 +1050,7 @@ m2_parse (struct parser_state *par_state)
}
void
-yyerror (char *msg)
+yyerror (const char *msg)
{
if (prev_lexptr)
lexptr = prev_lexptr;
diff --git a/gdb/m2-lang.h b/gdb/m2-lang.h
index 6f733941477..30fddd7b4b1 100644
--- a/gdb/m2-lang.h
+++ b/gdb/m2-lang.h
@@ -22,7 +22,7 @@ struct parser_state;
extern int m2_parse (struct parser_state *); /* Defined in m2-exp.y */
-extern void m2_yyerror (char *); /* Defined in m2-exp.y */
+extern void m2_yyerror (const char *); /* Defined in m2-exp.y */
/* Defined in m2-typeprint.c */
extern void m2_print_type (struct type *, const char *, struct ui_file *, int,
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index 40f29d343b9..1d0d7edbc04 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -202,7 +202,7 @@ m32r_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
}
}
-char *m32r_register_names[] = {
+static const char *m32r_register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "fp", "lr", "sp",
"psw", "cbr", "spi", "spu", "bpc", "pc", "accl", "acch",
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index d06598feedc..893d9c24798 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -166,7 +166,7 @@ struct m68hc11_unwind_cache
/* Table of registers for 68HC11. This includes the hard registers
and the soft registers used by GCC. */
-static char *
+static const char *
m68hc11_register_names[] =
{
"x", "d", "y", "sp", "pc", "a", "b",
diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c
index 6ae95901b34..57fe6449aeb 100644
--- a/gdb/m88k-tdep.c
+++ b/gdb/m88k-tdep.c
@@ -49,7 +49,7 @@ m88k_fetch_instruction (CORE_ADDR pc, enum bfd_endian byte_order)
static const char *
m88k_register_name (struct gdbarch *gdbarch, int regnum)
{
- static char *register_names[] =
+ static const char *register_names[] =
{
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
diff --git a/gdb/macroexp.c b/gdb/macroexp.c
index 5537d9d60f4..e7a0dadaef7 100644
--- a/gdb/macroexp.c
+++ b/gdb/macroexp.c
@@ -170,7 +170,7 @@ appendc (struct macro_buffer *b, int c)
/* Append the LEN bytes at ADDR to the buffer B. */
static void
-appendmem (struct macro_buffer *b, char *addr, int len)
+appendmem (struct macro_buffer *b, const char *addr, int len)
{
int new_len = b->len + len;
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 952dffb60a3..8e27194a642 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -220,7 +220,7 @@ static int found_ecoff_debugging_info;
/* Forward declarations. */
static int upgrade_type (int, struct type **, int, union aux_ext *,
- int, char *);
+ int, const char *);
static void parse_partial_symbols (minimal_symbol_reader &,
struct objfile *);
@@ -228,9 +228,9 @@ static void parse_partial_symbols (minimal_symbol_reader &,
static int has_opaque_xref (FDR *, SYMR *);
static int cross_ref (int, union aux_ext *, struct type **, enum type_code,
- char **, int, char *);
+ const char **, int, const char *);
-static struct symbol *new_symbol (char *);
+static struct symbol *new_symbol (const char *);
static struct type *new_type (char *);
@@ -245,14 +245,14 @@ static struct linetable *new_linetable (int);
static struct blockvector *new_bvect (int);
static struct type *parse_type (int, union aux_ext *, unsigned int, int *,
- int, char *);
+ int, const char *);
-static struct symbol *mylookup_symbol (char *, const struct block *,
+static struct symbol *mylookup_symbol (const char *, const struct block *,
domain_enum, enum address_class);
static void sort_blocks (struct symtab *);
-static struct partial_symtab *new_psymtab (char *, struct objfile *);
+static struct partial_symtab *new_psymtab (const char *, struct objfile *);
static void psymtab_to_symtab_1 (struct objfile *objfile,
struct partial_symtab *, const char *);
@@ -268,7 +268,7 @@ static struct linetable *shrink_linetable (struct linetable *);
static void handle_psymbol_enumerators (struct objfile *, FDR *, int,
CORE_ADDR);
-static char *mdebug_next_symbol_text (struct objfile *);
+static const char *mdebug_next_symbol_text (struct objfile *);
/* Exported procedure: Builds a symtab from the partial symtab SELF.
Restores the environment in effect when SELF was created, delegates
@@ -322,7 +322,7 @@ get_rfd (int cf, int rf)
/* Return a safer print NAME for a file descriptor. */
-static char *
+static const char *
fdr_name (FDR *f)
{
if (f->rss == -1)
@@ -574,7 +574,7 @@ static int mdebug_regparm_index;
static void
add_data_symbol (SYMR *sh, union aux_ext *ax, int bigend,
struct symbol *s, int aclass_index, struct block *b,
- struct objfile *objfile, char *name)
+ struct objfile *objfile, const char *name)
{
SYMBOL_DOMAIN (s) = VAR_DOMAIN;
SYMBOL_ACLASS_INDEX (s) = aclass_index;
@@ -596,7 +596,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
struct gdbarch *gdbarch = get_objfile_arch (objfile);
const bfd_size_type external_sym_size = debug_swap->external_sym_size;
void (*const swap_sym_in) (bfd *, void *, SYMR *) = debug_swap->swap_sym_in;
- char *name;
+ const char *name;
struct symbol *s;
struct block *b;
struct mdebug_pending *pend;
@@ -1530,7 +1530,7 @@ basic_type (int bt, struct objfile *objfile)
static struct type *
parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
- int bigend, char *sym_name)
+ int bigend, const char *sym_name)
{
TIR t[1];
struct type *tp = 0;
@@ -1658,7 +1658,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
name. This apparently is a MIPS extension for C sets. */
t->bt == btSet)
{
- char *name;
+ const char *name;
/* Try to cross reference this type, build new type on failure. */
ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
@@ -1718,7 +1718,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
FIXME: We are not doing any guessing on range types. */
if (t->bt == btRange)
{
- char *name;
+ const char *name;
/* Try to cross reference this type, build new type on failure. */
ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
@@ -1751,7 +1751,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
}
if (t->bt == btTypedef)
{
- char *name;
+ const char *name;
/* Try to cross reference this type, it should succeed. */
ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
@@ -1819,7 +1819,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
static int
upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
- char *sym_name)
+ const char *sym_name)
{
int off;
struct type *t;
@@ -2110,7 +2110,7 @@ parse_external (EXTR *es, int bigend, struct section_offsets *section_offsets,
/* Reading .o files */
if (SC_IS_UNDEF (es->asym.sc) || es->asym.sc == scNil)
{
- char *what;
+ const char *what;
switch (es->asym.st)
{
case stNil:
@@ -2851,7 +2851,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
switch (type_code)
{
- char *p;
+ const char *p;
/* Standard, external, non-debugger, symbols. */
@@ -3205,7 +3205,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
Accept either. */
while (*p && *p != ';' && *p != ',')
{
- char *q;
+ const char *q;
/* Check for and handle cretinous dbx
symbol name continuation! */
@@ -3887,7 +3887,7 @@ handle_psymbol_enumerators (struct objfile *objfile, FDR *fh, int stype,
/* Get the next symbol. OBJFILE is unused. */
-static char *
+static const char *
mdebug_next_symbol_text (struct objfile *objfile)
{
SYMR sh;
@@ -4360,7 +4360,7 @@ static int
cross_ref (int fd, union aux_ext *ax, struct type **tpp,
enum type_code type_code,
/* Use to alloc new type if none is found. */
- char **pname, int bigend, char *sym_name)
+ const char **pname, int bigend, const char *sym_name)
{
RNDXR rn[1];
unsigned int rf;
@@ -4556,7 +4556,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
keeping the symtab sorted. */
static struct symbol *
-mylookup_symbol (char *name, const struct block *block,
+mylookup_symbol (const char *name, const struct block *block,
domain_enum domain, enum address_class theclass)
{
struct block_iterator iter;
@@ -4742,7 +4742,7 @@ new_symtab (const char *name, int maxlines, struct objfile *objfile)
/* Allocate a new partial_symtab NAME. */
static struct partial_symtab *
-new_psymtab (char *name, struct objfile *objfile)
+new_psymtab (const char *name, struct objfile *objfile)
{
struct partial_symtab *psymtab;
@@ -4836,7 +4836,7 @@ new_block (enum block_type type)
/* Create a new symbol with printname NAME. */
static struct symbol *
-new_symbol (char *name)
+new_symbol (const char *name)
{
struct symbol *s = allocate_symbol (mdebugread_objfile);
diff --git a/gdb/memattr.c b/gdb/memattr.c
index e01e2c8bba0..2493537fe0a 100644
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -441,7 +441,7 @@ mem_info_command (char *args, int from_tty)
for (ix = 0; VEC_iterate (mem_region_s, mem_region_list, ix, m); ix++)
{
- char *tmp;
+ const char *tmp;
printf_filtered ("%-3d %-3c\t",
m->number,
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index b1dcc863ef0..5a45d6e8a84 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -305,7 +305,7 @@ register_set_keyword_table (const CGEN_HW_ENTRY *hw)
/* Given a keyword table KEYWORD and a register number REGNUM, return
the name of the register, or "" if KEYWORD contains no register
whose number is REGNUM. */
-static char *
+static const char *
register_name_from_keyword (CGEN_KEYWORD *keyword_table, int regnum)
{
const CGEN_KEYWORD_ENTRY *entry
diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c
index a6347ee11e2..4093178713f 100644
--- a/gdb/mi/mi-cmd-env.c
+++ b/gdb/mi/mi-cmd-env.c
@@ -116,7 +116,7 @@ mi_cmd_env_path (const char *command, char **argv, int argc)
{
struct ui_out *uiout = current_uiout;
char *exec_path;
- char *env;
+ const char *env;
int reset = 0;
int oind = 0;
int i;
@@ -271,7 +271,7 @@ void
_initialize_mi_cmd_env (void)
{
struct gdb_environ *environment;
- char *env;
+ const char *env;
/* We want original execution path to reset to, if desired later.
At this point, current inferior is not created, so cannot use
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index bb56205f058..bd910337486 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -578,7 +578,7 @@ list_args_or_locals (enum what_to_list what, enum print_values values,
struct block_iterator iter;
struct cleanup *cleanup_list;
struct type *type;
- char *name_of_result;
+ const char *name_of_result;
struct ui_out *uiout = current_uiout;
block = get_frame_block (fi, 0);
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 430c07b9de0..78ef8e00a74 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -492,7 +492,7 @@ mi_cmd_var_show_attributes (const char *command, char **argv, int argc)
{
struct ui_out *uiout = current_uiout;
int attr;
- char *attstr;
+ const char *attstr;
struct varobj *var;
if (argc != 1)
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 9a876574201..91fe1044a16 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -89,7 +89,7 @@ static void mi_cmd_execute (struct mi_parse *parse);
static void mi_execute_cli_command (const char *cmd, int args_p,
const char *args);
-static void mi_execute_async_cli_command (char *cli_command,
+static void mi_execute_async_cli_command (const char *cli_command,
char **argv, int argc);
static int register_changed_p (int regnum, struct regcache *,
struct regcache *);
@@ -2031,7 +2031,7 @@ captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context)
/* Echo the command on the console. */
fprintf_unfiltered (gdb_stdlog, "%s\n", context->command);
/* Call the "console" interpreter. */
- argv[0] = INTERP_CONSOLE;
+ argv[0] = (char *) INTERP_CONSOLE;
argv[1] = context->command;
mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2);
@@ -2344,7 +2344,7 @@ mi_execute_cli_command (const char *cmd, int args_p, const char *args)
}
void
-mi_execute_async_cli_command (char *cli_command, char **argv, int argc)
+mi_execute_async_cli_command (const char *cli_command, char **argv, int argc)
{
struct cleanup *old_cleanups;
char *run;
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 41cb9d82c6e..45d1d731b0c 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -608,7 +608,7 @@ mips_register_name (struct gdbarch *gdbarch, int regno)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* GPR names for all ABIs other than n32/n64. */
- static char *mips_gpr_names[] = {
+ static const char *mips_gpr_names[] = {
"zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
"s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
@@ -616,7 +616,7 @@ mips_register_name (struct gdbarch *gdbarch, int regno)
};
/* GPR names for n32 and n64 ABIs. */
- static char *mips_n32_n64_gpr_names[] = {
+ static const char *mips_n32_n64_gpr_names[] = {
"zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
"a4", "a5", "a6", "a7", "t0", "t1", "t2", "t3",
"s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
@@ -6880,7 +6880,7 @@ set_mips_command (char *args, int from_tty)
static void
show_mipsfpu_command (char *args, int from_tty)
{
- char *fpu;
+ const char *fpu;
if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_mips)
{
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index 38356e541d1..0f5e10fccc5 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -246,8 +246,8 @@ mn10300_return_value (struct gdbarch *gdbarch, struct value *function,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-static char *
-register_name (int reg, char **regs, long sizeof_regs)
+static const char *
+register_name (int reg, const char **regs, long sizeof_regs)
{
if (reg < 0 || reg >= sizeof_regs / sizeof (regs[0]))
return NULL;
@@ -258,7 +258,7 @@ register_name (int reg, char **regs, long sizeof_regs)
static const char *
mn10300_generic_register_name (struct gdbarch *gdbarch, int reg)
{
- static char *regs[] =
+ static const char *regs[] =
{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
"sp", "pc", "mdr", "psw", "lir", "lar", "", "",
"", "", "", "", "", "", "", "",
@@ -271,7 +271,7 @@ mn10300_generic_register_name (struct gdbarch *gdbarch, int reg)
static const char *
am33_register_name (struct gdbarch *gdbarch, int reg)
{
- static char *regs[] =
+ static const char *regs[] =
{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
"sp", "pc", "mdr", "psw", "lir", "lar", "",
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
@@ -283,7 +283,7 @@ am33_register_name (struct gdbarch *gdbarch, int reg)
static const char *
am33_2_register_name (struct gdbarch *gdbarch, int reg)
{
- static char *regs[] =
+ static const char *regs[] =
{
"d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
"sp", "pc", "mdr", "psw", "lir", "lar", "mdrq", "r0",
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 7383f272454..d0f4223d7f0 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -74,7 +74,7 @@ typedef BP_MANIPULATION (moxie_break_insn) moxie_breakpoint;
/* Moxie register names. */
-char *moxie_register_names[] = {
+static const char *moxie_register_names[] = {
"$fp", "$sp", "$r0", "$r1", "$r2",
"$r3", "$r4", "$r5", "$r6", "$r7",
"$r8", "$r9", "$r10", "$r11", "$r12",
diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c
index 2417a468bd1..ba2e5a5d8fe 100644
--- a/gdb/nat/linux-osdata.c
+++ b/gdb/nat/linux-osdata.c
@@ -1627,9 +1627,9 @@ linux_xfer_osdata_modules (gdb_byte *readbuf,
}
struct osdata_type {
- char *type;
- char *title;
- char *description;
+ const char *type;
+ const char *title;
+ const char *description;
LONGEST (*getter) (gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
} osdata_table[] = {
{ "cpus", "CPUs", "Listing of all cpus/cores on the system",
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index 04ad06c431a..8f8d1d53846 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -190,7 +190,7 @@ nto_parse_redirection (char *pargv[], const char **pin, const char **pout,
const char **perr)
{
char **argv;
- char *in, *out, *err, *p;
+ const char *in, *out, *err, *p;
int argc, i, n;
for (n = 0; pargv[n]; n++);
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index ad7c64ea9fe..e102b800aa5 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -81,7 +81,7 @@ static const struct objfile_data *objc_objfile_data;
suitably defined. */
struct symbol *
-lookup_struct_typedef (char *name, const struct block *block, int noerr)
+lookup_struct_typedef (const char *name, const struct block *block, int noerr)
{
struct symbol *sym;
@@ -106,7 +106,7 @@ lookup_struct_typedef (char *name, const struct block *block, int noerr)
}
CORE_ADDR
-lookup_objc_class (struct gdbarch *gdbarch, char *classname)
+lookup_objc_class (struct gdbarch *gdbarch, const char *classname)
{
struct type *char_type = builtin_type (gdbarch)->builtin_char;
struct value * function, *classval;
@@ -135,7 +135,7 @@ lookup_objc_class (struct gdbarch *gdbarch, char *classname)
}
CORE_ADDR
-lookup_child_selector (struct gdbarch *gdbarch, char *selname)
+lookup_child_selector (struct gdbarch *gdbarch, const char *selname)
{
struct type *char_type = builtin_type (gdbarch)->builtin_char;
struct value * function, *selstring;
@@ -1233,7 +1233,7 @@ print_object_command (char *args, int from_tty)
*/
struct objc_methcall {
- char *name;
+ const char *name;
/* Return instance method to be called. */
int (*stop_at) (CORE_ADDR, CORE_ADDR *);
/* Start of pc range corresponding to method invocation. */
diff --git a/gdb/objc-lang.h b/gdb/objc-lang.h
index 49e68781199..e22b198d7d1 100644
--- a/gdb/objc-lang.h
+++ b/gdb/objc-lang.h
@@ -29,9 +29,9 @@ struct block;
struct parser_state;
extern CORE_ADDR lookup_objc_class (struct gdbarch *gdbarch,
- char *classname);
+ const char *classname);
extern CORE_ADDR lookup_child_selector (struct gdbarch *gdbarch,
- char *methodname);
+ const char *methodname);
extern char *objc_demangle (const char *mangled, int options);
@@ -48,7 +48,8 @@ extern void start_msglist (void);
extern void add_msglist (struct stoken *str, int addcolon);
extern int end_msglist (struct parser_state *);
-struct symbol *lookup_struct_typedef (char *name, const struct block *block,
+struct symbol *lookup_struct_typedef (const char *name,
+ const struct block *block,
int noerr);
#endif
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 758fa864a55..9500b1c7f44 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -1469,7 +1469,7 @@ find_pc_section (CORE_ADDR pc)
/* Return non-zero if PC is in a section called NAME. */
int
-pc_in_section (CORE_ADDR pc, char *name)
+pc_in_section (CORE_ADDR pc, const char *name)
{
struct obj_section *s;
int retval = 0;
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index f719d30614c..58db6c9194f 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -514,7 +514,7 @@ extern int have_minimal_symbols (void);
extern struct obj_section *find_pc_section (CORE_ADDR pc);
/* Return non-zero if PC is in a section called NAME. */
-extern int pc_in_section (CORE_ADDR, char *);
+extern int pc_in_section (CORE_ADDR, const char *);
/* Return non-zero if PC is in a SVR4-style procedure linkage table
section. */
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index 5911d8de24d..81eb2162589 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -72,7 +72,7 @@ int yyparse (void);
static int yylex (void);
-void yyerror (char *);
+void yyerror (const char *);
static char *uptok (const char *, int);
%}
@@ -1047,7 +1047,7 @@ pop_current_type (void)
struct token
{
- char *oper;
+ const char *oper;
int token;
enum exp_opcode opcode;
};
@@ -1714,7 +1714,7 @@ pascal_parse (struct parser_state *par_state)
}
void
-yyerror (char *msg)
+yyerror (const char *msg)
{
if (prev_lexptr)
lexptr = prev_lexptr;
diff --git a/gdb/p-lang.h b/gdb/p-lang.h
index aa0398743df..96a290b8e0b 100644
--- a/gdb/p-lang.h
+++ b/gdb/p-lang.h
@@ -27,7 +27,7 @@ extern const char *pascal_main_name (void);
extern int pascal_parse (struct parser_state *); /* Defined in p-exp.y */
-extern void pascal_yyerror (char *); /* Defined in p-exp.y */
+extern void pascal_yyerror (const char *); /* Defined in p-exp.y */
/* Defined in p-typeprint.c */
extern void pascal_print_type (struct type *, const char *, struct ui_file *,
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index 0913580d32d..fadc2ef2b13 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -262,7 +262,7 @@ extern int operator_check_standard (struct expression *exp, int pos,
(struct objfile *objfile, void *data),
void *data);
-extern char *op_name_standard (enum exp_opcode);
+extern const char *op_name_standard (enum exp_opcode);
extern struct type *follow_types (struct type *);
@@ -312,7 +312,7 @@ enum precedence
struct op_print
{
- char *string;
+ const char *string;
enum exp_opcode opcode;
/* Precedence of operator. These values are used only by comparisons. */
enum precedence precedence;
@@ -352,7 +352,7 @@ struct exp_descriptor
The returned value should never be NULL, even if EXP_OPCODE is
an unknown opcode (a string containing an image of the numeric
value of the opcode can be returned, for instance). */
- char *(*op_name) (enum exp_opcode);
+ const char *(*op_name) (enum exp_opcode);
/* Dump the rest of this (prefix) expression after the operator
itself has been printed. See dump_subexp_body_standard in
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index e4a35a7b40d..f09f18a4399 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -560,7 +560,7 @@ set_next_address (struct gdbarch *gdbarch, CORE_ADDR addr)
int
print_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr,
struct ui_file *stream,
- int do_demangle, char *leadin)
+ int do_demangle, const char *leadin)
{
char *name = NULL;
char *filename = NULL;
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index d98a4af0d97..bdce8f239aa 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -875,7 +875,7 @@ psym_forget_cached_source_info (struct objfile *objfile)
static void
print_partial_symbols (struct gdbarch *gdbarch,
- struct partial_symbol **p, int count, char *what,
+ struct partial_symbol **p, int count, const char *what,
struct ui_file *outfile)
{
fprintf_filtered (outfile, " %s partial symbols:\n", what);
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index a08501ee233..6bf517c641a 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -41,7 +41,7 @@ static int bppy_live;
gdbpy_breakpoint_object *bppy_pending_object;
/* Function that is called when a Python condition is evaluated. */
-static char * const stop_func = "stop";
+static const char stop_func[] = "stop";
/* This is used to initialize various gdb.bp_* constants. */
struct pybp_code
@@ -400,7 +400,7 @@ bppy_get_location (PyObject *self, void *closure)
static PyObject *
bppy_get_expression (PyObject *self, void *closure)
{
- char *str;
+ const char *str;
gdbpy_breakpoint_object *obj = (gdbpy_breakpoint_object *) self;
struct watchpoint *wp;
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index 3e60673ca23..62032115b0c 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -32,10 +32,8 @@
/* Struct representing built-in completion types. */
struct cmdpy_completer
{
- /* Python symbol name.
- This isn't a const char * for Python 2.4's sake.
- PyModule_AddIntConstant only takes a char *, sigh. */
- char *name;
+ /* Python symbol name. */
+ const char *name;
/* Completion function. */
completer_ftype *completer;
};
@@ -111,8 +109,10 @@ cmdpy_destroyer (struct cmd_list_element *self, void *context)
/* Called by gdb to invoke the command. */
static void
-cmdpy_function (struct cmd_list_element *command, char *args, int from_tty)
+cmdpy_function (struct cmd_list_element *command,
+ char *args_entry, int from_tty)
{
+ const char *args = args_entry;
cmdpy_object *obj = (cmdpy_object *) get_cmd_context (command);
gdbpy_enter enter_py (get_current_arch (), current_language);
diff --git a/gdb/python/py-event.c b/gdb/python/py-event.c
index dc1d73e78b4..b349891269f 100644
--- a/gdb/python/py-event.c
+++ b/gdb/python/py-event.c
@@ -47,7 +47,7 @@ create_event_object (PyTypeObject *py_type)
function acquires a new reference to ATTR. */
int
-evpy_add_attribute (PyObject *event, char *name, PyObject *attr)
+evpy_add_attribute (PyObject *event, const char *name, PyObject *attr)
{
return PyObject_SetAttrString (event, name, attr);
}
@@ -67,7 +67,7 @@ gdbpy_initialize_event (void)
int
gdbpy_initialize_event_generic (PyTypeObject *type,
- char *name)
+ const char *name)
{
if (PyType_Ready (type) < 0)
return -1;
diff --git a/gdb/python/py-event.h b/gdb/python/py-event.h
index 4b2f4c03ab3..ccb851339c8 100644
--- a/gdb/python/py-event.h
+++ b/gdb/python/py-event.h
@@ -131,9 +131,9 @@ extern int emit_clear_objfiles_event (void);
extern void evpy_dealloc (PyObject *self);
extern int evpy_add_attribute (PyObject *event,
- char *name, PyObject *attr)
+ const char *name, PyObject *attr)
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_event_generic (PyTypeObject *type, char *name)
+int gdbpy_initialize_event_generic (PyTypeObject *type, const char *name)
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
#endif /* GDB_PY_EVENT_H */
diff --git a/gdb/python/py-evts.c b/gdb/python/py-evts.c
index 4766bd65059..126d18cead4 100644
--- a/gdb/python/py-evts.c
+++ b/gdb/python/py-evts.c
@@ -38,7 +38,7 @@ static struct PyModuleDef EventModuleDef =
/* Initialize python events. */
static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-add_new_registry (eventregistry_object **registryp, char *name)
+add_new_registry (eventregistry_object **registryp, const char *name)
{
*registryp = create_eventregistry_object ();
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 06f6ff90a01..797ca848be4 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -33,7 +33,7 @@
#include "py-ref.h"
/* Function that is called when a Python finish bp is found out of scope. */
-static char * const outofscope_func = "out_of_scope";
+static const char outofscope_func[] = "out_of_scope";
/* struct implementing the gdb.FinishBreakpoint object by extending
the gdb.Breakpoint class. */
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index 6db4aab8957..75b055c98c9 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -301,7 +301,7 @@ py_print_value (struct ui_out *out, struct value *val,
This function can return an iterator, or NULL. */
static PyObject *
-get_py_iter_from_func (PyObject *filter, char *func)
+get_py_iter_from_func (PyObject *filter, const char *func)
{
if (PyObject_HasAttrString (filter, func))
{
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index 4b43c54e843..3d2cb1ddbeb 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -576,7 +576,10 @@ get_buffer (PyObject *self, Py_buffer *buf, int flags)
ret = PyBuffer_FillInfo (buf, self, membuf_obj->buffer,
membuf_obj->length, 0,
PyBUF_CONTIG);
- buf->format = "c";
+
+ /* Despite the documentation saying this field is a "const char *",
+ in Python 3.4 at least, it's really a "char *". */
+ buf->format = (char *) "c";
return ret;
}
diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c
index d80b731860c..f0d3423e3bf 100644
--- a/gdb/python/py-param.c
+++ b/gdb/python/py-param.c
@@ -32,7 +32,7 @@
/* Parameter constants and their values. */
struct parm_constant
{
- char *name;
+ const char *name;
int value;
};
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index b7821b59373..a5c28736979 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -204,7 +204,7 @@ unwind_infopy_str (PyObject *self)
stb.puts ("Frame ID: ");
fprint_frame_id (&stb, unwind_info->frame_id);
{
- char *sep = "";
+ const char *sep = "";
int i;
struct value_print_options opts;
saved_reg *reg;
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 25f475ff39d..cc58267b955 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -457,7 +457,7 @@ gdbpy_parameter_value (enum var_types type, void *var)
case var_filename:
case var_enum:
{
- char *str = * (char **) var;
+ const char *str = *(char **) var;
if (! str)
str = "";
diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index 5f3aac2281d..252b423bfab 100644
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -1100,7 +1100,7 @@ remote_fileio_func_system (char *buf)
}
static struct {
- char *name;
+ const char *name;
void (*func)(char *);
} remote_fio_func_map[] = {
{ "open", remote_fileio_func_open },
diff --git a/gdb/remote.c b/gdb/remote.c
index 30cd47ac8bf..a61469c9872 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1025,7 +1025,7 @@ static int remote_async_terminal_ours_p;
struct memory_packet_config
{
- char *name;
+ const char *name;
long size;
int fixed_p;
};
@@ -1242,7 +1242,7 @@ static enum packet_support packet_support (int packet);
static void
show_packet_config_cmd (struct packet_config *config)
{
- char *support = "internal-error";
+ const char *support = "internal-error";
switch (packet_config_support (config))
{
@@ -8239,7 +8239,7 @@ static enum target_xfer_status
remote_write_bytes (CORE_ADDR memaddr, const gdb_byte *myaddr, ULONGEST len,
int unit_size, ULONGEST *xfered_len)
{
- char *packet_format = 0;
+ const char *packet_format = NULL;
/* Check whether the target supports binary download. */
check_binary_download (memaddr);
@@ -11190,7 +11190,7 @@ remote_read_description (struct target_ops *target)
decrease *LEFT. Otherwise raise an error. */
static void
-remote_buffer_add_string (char **buffer, int *left, char *string)
+remote_buffer_add_string (char **buffer, int *left, const char *string)
{
int len = strlen (string);
diff --git a/gdb/reverse.c b/gdb/reverse.c
index 7f0a027af0e..4080616b6e3 100644
--- a/gdb/reverse.c
+++ b/gdb/reverse.c
@@ -43,7 +43,7 @@ exec_direction_default (void *notused)
Used to implement reverse-next etc. commands. */
static void
-exec_reverse_once (char *cmd, char *args, int from_tty)
+exec_reverse_once (const char *cmd, char *args, int from_tty)
{
char *reverse_command;
enum exec_direction_kind dir = execution_direction;
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 67c4d5184b9..eb784c562fd 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3146,10 +3146,10 @@ rs6000_adjust_frame_regnum (struct gdbarch *gdbarch, int num, int eh_frame_p)
struct variant
{
/* Name of this variant. */
- char *name;
+ const char *name;
/* English description of the variant. */
- char *description;
+ const char *description;
/* bfd_arch_info.arch corresponding to variant. */
enum bfd_architecture arch;
diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y
index b3e03664e26..64b7c55efeb 100644
--- a/gdb/rust-exp.y
+++ b/gdb/rust-exp.y
@@ -2471,7 +2471,7 @@ rust_parse (struct parser_state *state)
/* The parser error handler. */
void
-rustyyerror (char *msg)
+rustyyerror (const char *msg)
{
const char *where = prev_lexptr ? prev_lexptr : lexptr;
error (_("%s in expression, near `%s'."), (msg ? msg : "Error"), where);
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 4977b0a1aa3..fe8a58cb0f3 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -1891,7 +1891,7 @@ rust_operator_length (const struct expression *exp, int pc, int *oplenp,
/* op_name implementation for Rust. */
-static char *
+static const char *
rust_op_name (enum exp_opcode opcode)
{
switch (opcode)
diff --git a/gdb/rust-lang.h b/gdb/rust-lang.h
index 8f2b6826c15..61547d772af 100644
--- a/gdb/rust-lang.h
+++ b/gdb/rust-lang.h
@@ -27,7 +27,7 @@ struct type;
extern int rust_parse (struct parser_state *);
/* The la_error implementation for Rust. */
-extern void rustyyerror (char *);
+extern void rustyyerror (const char *);
/* Return true if TYPE is a tuple type; otherwise false. */
extern bool rust_tuple_type_p (struct type *type);
diff --git a/gdb/serial.h b/gdb/serial.h
index b39cc338715..c76ddbee108 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -259,7 +259,7 @@ struct serial
struct serial_ops
{
- char *name;
+ const char *name;
int (*open) (struct serial *, const char *name);
void (*close) (struct serial *);
int (*fdopen) (struct serial *, int fd);
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 9b3692dc0c3..f4b4c486fd5 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -111,7 +111,7 @@ sh_is_renesas_calling_convention (struct type *func_type)
static const char *
sh_sh_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
@@ -133,7 +133,7 @@ sh_sh_register_name (struct gdbarch *gdbarch, int reg_nr)
static const char *
sh_sh3_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
@@ -155,7 +155,7 @@ sh_sh3_register_name (struct gdbarch *gdbarch, int reg_nr)
static const char *
sh_sh3e_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
@@ -177,7 +177,7 @@ sh_sh3e_register_name (struct gdbarch *gdbarch, int reg_nr)
static const char *
sh_sh2e_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
@@ -199,7 +199,7 @@ sh_sh2e_register_name (struct gdbarch *gdbarch, int reg_nr)
static const char *
sh_sh2a_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
/* general registers 0-15 */
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
@@ -239,7 +239,7 @@ sh_sh2a_register_name (struct gdbarch *gdbarch, int reg_nr)
static const char *
sh_sh2a_nofpu_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
/* general registers 0-15 */
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
@@ -279,7 +279,7 @@ sh_sh2a_nofpu_register_name (struct gdbarch *gdbarch, int reg_nr)
static const char *
sh_sh_dsp_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
@@ -301,7 +301,7 @@ sh_sh_dsp_register_name (struct gdbarch *gdbarch, int reg_nr)
static const char *
sh_sh3_dsp_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
@@ -324,7 +324,7 @@ sh_sh3_dsp_register_name (struct gdbarch *gdbarch, int reg_nr)
static const char *
sh_sh4_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
/* general registers 0-15 */
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
@@ -362,7 +362,7 @@ sh_sh4_register_name (struct gdbarch *gdbarch, int reg_nr)
static const char *
sh_sh4_nofpu_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
/* general registers 0-15 */
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
@@ -398,7 +398,7 @@ sh_sh4_nofpu_register_name (struct gdbarch *gdbarch, int reg_nr)
static const char *
sh_sh4al_dsp_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index 23f5ade3b2e..33986fd12ff 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -125,7 +125,7 @@ enum
static const char *
sh64_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] =
+ static const char *register_names[] =
{
/* SH MEDIA MODE (ISA 32) */
/* general registers (64-bit) 0-63 */
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index 232641b9c6c..0b975569e25 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -170,7 +170,7 @@ struct darwin_so_list
/* Lookup the value for a specific symbol. */
static CORE_ADDR
-lookup_symbol_from_bfd (bfd *abfd, char *symname)
+lookup_symbol_from_bfd (bfd *abfd, const char *symname)
{
long storage_needed;
asymbol **symbol_table;
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index cd8b64d5395..00e59c21df9 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -114,7 +114,7 @@ static struct cmd_list_element *infospucmdlist = NULL;
static const char *
spu_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] =
+ static const char *register_names[] =
{
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
@@ -2300,7 +2300,7 @@ spu_mfc_get_bitfield (ULONGEST word, int first, int last)
static void
info_spu_dma_cmdlist (gdb_byte *buf, int nr, enum bfd_endian byte_order)
{
- static char *spu_mfc_opcode[256] =
+ static const char *spu_mfc_opcode[256] =
{
/* 00 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 14122021c63..8ba6bb55632 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -85,14 +85,14 @@ struct field_info
};
static void
-read_one_struct_field (struct field_info *, char **, char *,
+read_one_struct_field (struct field_info *, const char **, const char *,
struct type *, struct objfile *);
static struct type *dbx_alloc_type (int[2], struct objfile *);
-static long read_huge_number (char **, int, int *, int);
+static long read_huge_number (const char **, int, int *, int);
-static struct type *error_type (char **, struct objfile *);
+static struct type *error_type (const char **, struct objfile *);
static void
patch_block_stabs (struct pending *, struct pending_stabs *,
@@ -100,35 +100,37 @@ patch_block_stabs (struct pending *, struct pending_stabs *,
static void fix_common_block (struct symbol *, CORE_ADDR);
-static int read_type_number (char **, int *);
+static int read_type_number (const char **, int *);
-static struct type *read_type (char **, struct objfile *);
+static struct type *read_type (const char **, struct objfile *);
-static struct type *read_range_type (char **, int[2], int, struct objfile *);
+static struct type *read_range_type (const char **, int[2],
+ int, struct objfile *);
-static struct type *read_sun_builtin_type (char **, int[2], struct objfile *);
+static struct type *read_sun_builtin_type (const char **,
+ int[2], struct objfile *);
-static struct type *read_sun_floating_type (char **, int[2],
+static struct type *read_sun_floating_type (const char **, int[2],
struct objfile *);
-static struct type *read_enum_type (char **, struct type *, struct objfile *);
+static struct type *read_enum_type (const char **, struct type *, struct objfile *);
static struct type *rs6000_builtin_type (int, struct objfile *);
static int
-read_member_functions (struct field_info *, char **, struct type *,
+read_member_functions (struct field_info *, const char **, struct type *,
struct objfile *);
static int
-read_struct_fields (struct field_info *, char **, struct type *,
+read_struct_fields (struct field_info *, const char **, struct type *,
struct objfile *);
static int
-read_baseclasses (struct field_info *, char **, struct type *,
+read_baseclasses (struct field_info *, const char **, struct type *,
struct objfile *);
static int
-read_tilde_fields (struct field_info *, char **, struct type *,
+read_tilde_fields (struct field_info *, const char **, struct type *,
struct objfile *);
static int attach_fn_fields_to_type (struct field_info *, struct type *);
@@ -136,24 +138,25 @@ static int attach_fn_fields_to_type (struct field_info *, struct type *);
static int attach_fields_to_type (struct field_info *, struct type *,
struct objfile *);
-static struct type *read_struct_type (char **, struct type *,
+static struct type *read_struct_type (const char **, struct type *,
enum type_code,
struct objfile *);
-static struct type *read_array_type (char **, struct type *,
+static struct type *read_array_type (const char **, struct type *,
struct objfile *);
-static struct field *read_args (char **, int, struct objfile *, int *, int *);
+static struct field *read_args (const char **, int, struct objfile *,
+ int *, int *);
static void add_undefined_type (struct type *, int[2]);
static int
-read_cpp_abbrev (struct field_info *, char **, struct type *,
+read_cpp_abbrev (struct field_info *, const char **, struct type *,
struct objfile *);
-static char *find_name_end (char *name);
+static const char *find_name_end (const char *name);
-static int process_reference (char **string);
+static int process_reference (const char **string);
void stabsread_clear_cache (void);
@@ -381,7 +384,7 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs,
{
int ii;
char *name;
- char *pp;
+ const char *pp;
struct symbol *sym;
if (stabs)
@@ -461,7 +464,7 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs,
Returns 0 for success, -1 for error. */
static int
-read_type_number (char **pp, int *typenums)
+read_type_number (const char **pp, int *typenums)
{
int nbits;
@@ -496,7 +499,7 @@ read_type_number (char **pp, int *typenums)
struct ref_map
{
- char *stabs;
+ const char *stabs;
CORE_ADDR value;
struct symbol *sym;
};
@@ -528,7 +531,7 @@ stabsread_clear_cache (void)
find them, using their reference numbers as our index.
These will be used later when we resolve references. */
void
-ref_add (int refnum, struct symbol *sym, char *stabs, CORE_ADDR value)
+ref_add (int refnum, struct symbol *sym, const char *stabs, CORE_ADDR value)
{
if (ref_count == 0)
ref_chunk = 0;
@@ -563,9 +566,9 @@ ref_search (int refnum)
reference number. Move STRING beyond the reference id. */
static int
-process_reference (char **string)
+process_reference (const char **string)
{
- char *p;
+ const char *p;
int refnum = 0;
if (**string != '#')
@@ -588,9 +591,9 @@ process_reference (char **string)
definition for later use. Return the reference number. */
int
-symbol_reference_defined (char **string)
+symbol_reference_defined (const char **string)
{
- char *p = *string;
+ const char *p = *string;
int refnum = 0;
refnum = process_reference (&p);
@@ -641,12 +644,12 @@ static int stab_register_index;
static int stab_regparm_index;
struct symbol *
-define_symbol (CORE_ADDR valu, char *string, int desc, int type,
+define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
struct objfile *objfile)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct symbol *sym;
- char *p = (char *) find_name_end (string);
+ const char *p = find_name_end (string);
int deftype;
int synonym = 0;
int i;
@@ -976,7 +979,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
struct type *ftype = SYMBOL_TYPE (sym);
int nsemi = 0;
int nparams = 0;
- char *p1 = p;
+ const char *p1 = p;
/* Obtain a worst case guess for the number of arguments
by counting the semicolons. */
@@ -1490,7 +1493,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
debugger will be able to read the new symbol tables. */
static struct type *
-error_type (char **pp, struct objfile *objfile)
+error_type (const char **pp, struct objfile *objfile)
{
complaint (&symfile_complaints,
_("couldn't parse type; debugger out of date?"));
@@ -1523,7 +1526,7 @@ error_type (char **pp, struct objfile *objfile)
deciding whether to call read_type. */
static struct type *
-read_type (char **pp, struct objfile *objfile)
+read_type (const char **pp, struct objfile *objfile)
{
struct type *type = 0;
struct type *type1;
@@ -1595,7 +1598,7 @@ again:
char *type_name;
{
- char *from, *to, *p, *q1, *q2;
+ const char *from, *p, *q1, *q2;
/* Set the type code according to the following letter. */
switch ((*pp)[0])
@@ -1661,7 +1664,7 @@ again:
}
if (type_name == NULL)
{
- to = type_name = (char *)
+ char *to = type_name = (char *)
obstack_alloc (&objfile->objfile_obstack, p - *pp + 1);
/* Copy the name. */
@@ -1910,7 +1913,7 @@ again:
else
/* type attribute */
{
- char *attr = *pp;
+ const char *attr = *pp;
/* Skip to the semicolon. */
while (**pp != ';' && **pp != '\0')
@@ -2280,8 +2283,8 @@ stabs_method_name_from_physname (const char *physname)
Returns 1 for success, 0 for failure. */
static int
-read_member_functions (struct field_info *fip, char **pp, struct type *type,
- struct objfile *objfile)
+read_member_functions (struct field_info *fip, const char **pp,
+ struct type *type, struct objfile *objfile)
{
int nfn_fields = 0;
int length = 0;
@@ -2296,7 +2299,7 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type,
struct next_fnfieldlist *new_fnlist;
struct next_fnfield *new_sublist;
char *main_fn_name;
- char *p;
+ const char *p;
/* Process each list until we find something that is not a member function
or find the end of the functions. */
@@ -2770,10 +2773,10 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type,
keep parsing and it's time for error_type(). */
static int
-read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type,
+read_cpp_abbrev (struct field_info *fip, const char **pp, struct type *type,
struct objfile *objfile)
{
- char *p;
+ const char *p;
const char *name;
char cpp_abbrev;
struct type *context;
@@ -2866,7 +2869,7 @@ read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type,
}
static void
-read_one_struct_field (struct field_info *fip, char **pp, char *p,
+read_one_struct_field (struct field_info *fip, const char **pp, const char *p,
struct type *type, struct objfile *objfile)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
@@ -3009,10 +3012,10 @@ read_one_struct_field (struct field_info *fip, char **pp, char *p,
Returns 1 for success, 0 for failure. */
static int
-read_struct_fields (struct field_info *fip, char **pp, struct type *type,
+read_struct_fields (struct field_info *fip, const char **pp, struct type *type,
struct objfile *objfile)
{
- char *p;
+ const char *p;
struct nextfield *newobj;
/* We better set p right now, in case there are no fields at all... */
@@ -3107,7 +3110,7 @@ read_struct_fields (struct field_info *fip, char **pp, struct type *type,
static int
-read_baseclasses (struct field_info *fip, char **pp, struct type *type,
+read_baseclasses (struct field_info *fip, const char **pp, struct type *type,
struct objfile *objfile)
{
int i;
@@ -3233,10 +3236,10 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type,
so we can look for the vptr base class info. */
static int
-read_tilde_fields (struct field_info *fip, char **pp, struct type *type,
+read_tilde_fields (struct field_info *fip, const char **pp, struct type *type,
struct objfile *objfile)
{
- char *p;
+ const char *p;
STABS_CONTINUE (pp, objfile);
@@ -3509,7 +3512,7 @@ set_length_in_type_chain (struct type *type)
*/
static struct type *
-read_struct_type (char **pp, struct type *type, enum type_code type_code,
+read_struct_type (const char **pp, struct type *type, enum type_code type_code,
struct objfile *objfile)
{
struct cleanup *back_to;
@@ -3583,7 +3586,7 @@ read_struct_type (char **pp, struct type *type, enum type_code type_code,
array. */
static struct type *
-read_array_type (char **pp, struct type *type,
+read_array_type (const char **pp, struct type *type,
struct objfile *objfile)
{
struct type *index_type, *element_type, *range_type;
@@ -3646,11 +3649,11 @@ read_array_type (char **pp, struct type *type,
Also defines the symbols that represent the values of the type. */
static struct type *
-read_enum_type (char **pp, struct type *type,
+read_enum_type (const char **pp, struct type *type,
struct objfile *objfile)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
- char *p;
+ const char *p;
char *name;
long n;
struct symbol *sym;
@@ -3772,7 +3775,7 @@ read_enum_type (char **pp, struct type *type,
FIXME. */
static struct type *
-read_sun_builtin_type (char **pp, int typenums[2], struct objfile *objfile)
+read_sun_builtin_type (const char **pp, int typenums[2], struct objfile *objfile)
{
int type_bits;
int nbits;
@@ -3847,7 +3850,8 @@ read_sun_builtin_type (char **pp, int typenums[2], struct objfile *objfile)
}
static struct type *
-read_sun_floating_type (char **pp, int typenums[2], struct objfile *objfile)
+read_sun_floating_type (const char **pp, int typenums[2],
+ struct objfile *objfile)
{
int nbits;
int details;
@@ -3895,9 +3899,10 @@ read_sun_floating_type (char **pp, int typenums[2], struct objfile *objfile)
If encounter garbage, set *BITS to -1 and return 0. */
static long
-read_huge_number (char **pp, int end, int *bits, int twos_complement_bits)
+read_huge_number (const char **pp, int end, int *bits,
+ int twos_complement_bits)
{
- char *p = *pp;
+ const char *p = *pp;
int sign = 1;
int sign_bit = 0;
long n = 0;
@@ -3932,7 +3937,7 @@ read_huge_number (char **pp, int end, int *bits, int twos_complement_bits)
negative number. */
size_t len;
- char *p1 = p;
+ const char *p1 = p;
while ((c = *p1) >= '0' && c < '8')
p1++;
@@ -4059,11 +4064,11 @@ read_huge_number (char **pp, int end, int *bits, int twos_complement_bits)
}
static struct type *
-read_range_type (char **pp, int typenums[2], int type_size,
+read_range_type (const char **pp, int typenums[2], int type_size,
struct objfile *objfile)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
- char *orig_pp = *pp;
+ const char *orig_pp = *pp;
int rangenums[2];
long n2, n3;
int n2bits, n3bits;
@@ -4267,7 +4272,7 @@ handle_true_range:
if there is an error. */
static struct field *
-read_args (char **pp, int end, struct objfile *objfile, int *nargsp,
+read_args (const char **pp, int end, struct objfile *objfile, int *nargsp,
int *varargsp)
{
/* FIXME! Remove this arbitrary limit! */
@@ -4331,7 +4336,7 @@ static char *common_block_name;
to remain after this function returns. */
void
-common_block_start (char *name, struct objfile *objfile)
+common_block_start (const char *name, struct objfile *objfile)
{
if (common_block_name != NULL)
{
@@ -4814,10 +4819,10 @@ finish_global_stabs (struct objfile *objfile)
/* Find the end of the name, delimited by a ':', but don't match
ObjC symbols which look like -[Foo bar::]:bla. */
-static char *
-find_name_end (char *name)
+static const char *
+find_name_end (const char *name)
{
- char *s = name;
+ const char *s = name;
if (s[0] == '-' || *s == '+')
{
diff --git a/gdb/stabsread.h b/gdb/stabsread.h
index 988063f2429..b37be1a0421 100644
--- a/gdb/stabsread.h
+++ b/gdb/stabsread.h
@@ -40,7 +40,7 @@ struct objfile;
EXTERN struct symbol *global_sym_chain[HASHSIZE];
-extern void common_block_start (char *, struct objfile *);
+extern void common_block_start (const char *, struct objfile *);
extern void common_block_end (struct objfile *);
/* Kludge for xcoffread.c */
@@ -132,7 +132,7 @@ extern void cleanup_undefined_stabs_types (struct objfile *);
extern long read_number (char **, int);
-extern struct symbol *define_symbol (CORE_ADDR, char *, int, int,
+extern struct symbol *define_symbol (CORE_ADDR, const char *, int, int,
struct objfile *);
extern void stabsread_init (void);
@@ -167,7 +167,7 @@ extern struct partial_symtab *dbx_end_psymtab
struct partial_symtab **dependency_list, int number_dependencies,
int textlow_not_set);
-extern void process_one_symbol (int, int, CORE_ADDR, char *,
+extern void process_one_symbol (int, int, CORE_ADDR, const char *,
const struct section_offsets *,
struct objfile *);
@@ -185,9 +185,9 @@ extern void coffstab_build_psymtabs
extern void stabsect_build_psymtabs (struct objfile *objfile, char *stab_name,
char *stabstr_name, char *text_name);
-extern int symbol_reference_defined (char **);
+extern int symbol_reference_defined (const char **);
-extern void ref_add (int, struct symbol *, char *, CORE_ADDR);
+extern void ref_add (int, struct symbol *, const char *, CORE_ADDR);
extern struct symbol *ref_search (int);
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 8b795085437..750039dbc93 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1768,7 +1768,7 @@ symfile_bfd_open (const char *name)
the section was not found. */
int
-get_section_index (struct objfile *objfile, char *section_name)
+get_section_index (struct objfile *objfile, const char *section_name)
{
asection *sect = bfd_get_section_by_name (objfile->obfd, section_name);
@@ -2235,8 +2235,8 @@ add_symbol_file_command (char *args, int from_tty)
struct sect_opt
{
- char *name;
- char *value;
+ const char *name;
+ const char *value;
};
struct section_addr_info *section_addrs;
@@ -2333,14 +2333,14 @@ add_symbol_file_command (char *args, int from_tty)
for (i = 0; i < section_index; i++)
{
CORE_ADDR addr;
- char *val = sect_opts[i].value;
- char *sec = sect_opts[i].name;
+ const char *val = sect_opts[i].value;
+ const char *sec = sect_opts[i].name;
addr = parse_and_eval_address (val);
/* Here we store the section offsets in the order they were
entered on the command line. */
- section_addrs->other[sec_num].name = sec;
+ section_addrs->other[sec_num].name = (char *) sec;
section_addrs->other[sec_num].addr = addr;
printf_unfiltered ("\t%s_addr = %s\n", sec,
paddress (gdbarch, addr));
diff --git a/gdb/symfile.h b/gdb/symfile.h
index c3e7a314c9c..6066481fd59 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -495,7 +495,7 @@ extern void find_lowest_section (bfd *, asection *, void *);
extern gdb_bfd_ref_ptr symfile_bfd_open (const char *);
-extern int get_section_index (struct objfile *, char *);
+extern int get_section_index (struct objfile *, const char *);
extern int print_symbol_loading_p (int from_tty, int mainline, int full);
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 33ae1fa7ebc..9a7e2ddfbd6 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -128,8 +128,10 @@ enum tdesc_type_kind
typedef struct tdesc_type
{
- /* The name of this type. */
- char *name;
+ /* The name of this type. If this type is a built-in type, this is
+ a pointer to a constant string. Otherwise, it's a
+ malloc-allocated string (and thus must be freed). */
+ const char *name;
/* Identify the kind of this type. */
enum tdesc_type_kind kind;
@@ -1335,7 +1337,7 @@ tdesc_free_type (struct tdesc_type *type)
break;
}
- xfree (type->name);
+ xfree ((char *) type->name);
xfree (type);
}
diff --git a/gdb/target.c b/gdb/target.c
index fd9181ee30d..10a53150cdc 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -91,7 +91,7 @@ static int return_zero_has_execution (struct target_ops *, ptid_t);
static void target_command (char *, int);
-static struct target_ops *find_default_run_target (char *);
+static struct target_ops *find_default_run_target (const char *);
static struct gdbarch *default_thread_architecture (struct target_ops *ops,
ptid_t ptid);
@@ -403,7 +403,7 @@ add_target (struct target_ops *t)
/* See target.h. */
void
-add_deprecated_target_alias (struct target_ops *t, char *alias)
+add_deprecated_target_alias (struct target_ops *t, const char *alias)
{
struct cmd_list_element *c;
char *alt;
@@ -2624,7 +2624,7 @@ show_auto_connect_native_target (struct ui_file *file, int from_tty,
called for errors); else, return NULL on error. */
static struct target_ops *
-find_default_run_target (char *do_mesg)
+find_default_run_target (const char *do_mesg)
{
struct target_ops *runable = NULL;
@@ -3291,7 +3291,7 @@ void
target_announce_detach (int from_tty)
{
pid_t pid;
- char *exec_file;
+ const char *exec_file;
if (!from_tty)
return;
@@ -3518,7 +3518,7 @@ str_comma_list_concat_elem (char *list, const char *elem)
static char *
do_option (int *target_options, char *ret,
- int opt, char *opt_str)
+ int opt, const char *opt_str)
{
if ((*target_options & opt) != 0)
{
diff --git a/gdb/target.h b/gdb/target.h
index 6553f491b29..fac9d51c017 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -2324,7 +2324,8 @@ extern void complete_target_initialization (struct target_ops *t);
/* Adds a command ALIAS for target T and marks it deprecated. This is useful
for maintaining backwards compatibility when renaming targets. */
-extern void add_deprecated_target_alias (struct target_ops *t, char *alias);
+extern void add_deprecated_target_alias (struct target_ops *t,
+ const char *alias);
extern void push_target (struct target_ops *);
diff --git a/gdb/thread.c b/gdb/thread.c
index fd9022ff806..24347dd6e66 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -1360,7 +1360,7 @@ print_thread_info_1 (struct ui_out *uiout, char *requested_threads,
if (uiout->is_mi_like_p ())
{
- char *state = "stopped";
+ const char *state = "stopped";
if (tp->state == THREAD_RUNNING)
state = "running";
diff --git a/gdb/top.c b/gdb/top.c
index 4a22be135ab..3de8a266567 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -218,7 +218,7 @@ void (*deprecated_warning_hook) (const char *, va_list);
called to notify the GUI that we are done with the interaction
window and it can close it. */
-void (*deprecated_readline_begin_hook) (char *, ...);
+void (*deprecated_readline_begin_hook) (const char *, ...);
char *(*deprecated_readline_hook) (const char *);
void (*deprecated_readline_end_hook) (void);
@@ -1216,7 +1216,8 @@ gdb_safe_append_history (void)
as the user has requested. */
char *
-command_line_input (const char *prompt_arg, int repeat, char *annotation_suffix)
+command_line_input (const char *prompt_arg, int repeat,
+ const char *annotation_suffix)
{
static struct buffer cmd_line_buffer;
static int cmd_line_buffer_initialized;
diff --git a/gdb/top.h b/gdb/top.h
index 2da92dfa9fa..452a3819514 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -295,6 +295,6 @@ extern void do_restore_instream_cleanup (void *stream);
extern char *handle_line_of_input (struct buffer *cmd_line_buffer,
char *rl, int repeat,
- char *annotation_suffix);
+ const char *annotation_suffix);
#endif
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index dbcd65d5dfa..5d63c16e150 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -192,7 +192,7 @@ static void
tfile_write_uploaded_tsv (struct trace_file_writer *self,
struct uploaded_tsv *utsv)
{
- char *buf = "";
+ char *buf = NULL;
struct tfile_trace_file_writer *writer
= (struct tfile_trace_file_writer *) self;
@@ -204,7 +204,7 @@ tfile_write_uploaded_tsv (struct trace_file_writer *self,
fprintf (writer->fp, "tsv %x:%s:%x:%s\n",
utsv->number, phex_nz (utsv->initial_value, 8),
- utsv->builtin, buf);
+ utsv->builtin, buf != NULL ? buf : "");
if (utsv->name)
xfree (buf);
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 87ef1418e6d..c28aa384edc 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -170,7 +170,6 @@ static void actions_command (char *, int);
static void tstart_command (char *, int);
static void tstop_command (char *, int);
static void tstatus_command (char *, int);
-static void tfind_command (char *, int);
static void tfind_pc_command (char *, int);
static void tfind_tracepoint_command (char *, int);
static void tfind_line_command (char *, int);
@@ -508,7 +507,7 @@ tvariables_info_1 (void)
for (ix = 0; VEC_iterate (tsv_s, tvariables, ix, tsv); ++ix)
{
struct cleanup *back_to2;
- char *c;
+ const char *c;
char *name;
back_to2 = make_cleanup_ui_out_tuple_begin_end (uiout, "variable");
@@ -2058,7 +2057,7 @@ trace_status_mi (int on_stop)
}
else
{
- char *stop_reason = NULL;
+ const char *stop_reason = NULL;
int stopping_tracepoint = -1;
if (!on_stop)
@@ -2343,7 +2342,7 @@ check_trace_running (struct trace_status *status)
/* tfind command */
static void
-tfind_command (char *args, int from_tty)
+tfind_command_1 (const char *args, int from_tty)
{ /* This should only be called with a numeric argument. */
int frameno = -1;
@@ -2377,18 +2376,24 @@ tfind_command (char *args, int from_tty)
tfind_1 (tfind_number, frameno, 0, 0, from_tty);
}
+static void
+tfind_command (char *args, int from_tty)
+{
+ tfind_command_1 (const_cast<char *> (args), from_tty);
+}
+
/* tfind end */
static void
tfind_end_command (char *args, int from_tty)
{
- tfind_command ("-1", from_tty);
+ tfind_command_1 ("-1", from_tty);
}
/* tfind start */
static void
tfind_start_command (char *args, int from_tty)
{
- tfind_command ("0", from_tty);
+ tfind_command_1 ("0", from_tty);
}
/* tfind pc command */
@@ -2957,9 +2962,10 @@ tdump_command (char *args, int from_tty)
/* This version does not do multiple encodes for long strings; it should
return an offset to the next piece to encode. FIXME */
-extern int
+int
encode_source_string (int tpnum, ULONGEST addr,
- char *srctype, const char *src, char *buf, int buf_size)
+ const char *srctype, const char *src,
+ char *buf, int buf_size)
{
if (80 + strlen (srctype) > buf_size)
error (_("Buffer too small for source encoding"));
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
index 8c4dedcecff..474563e7e93 100644
--- a/gdb/tracepoint.h
+++ b/gdb/tracepoint.h
@@ -339,7 +339,7 @@ extern struct trace_state_variable *
extern struct trace_state_variable *create_trace_state_variable (const char *name);
extern int encode_source_string (int num, ULONGEST addr,
- char *srctype, const char *src,
+ const char *srctype, const char *src,
char *buf, int buf_size);
extern void parse_trace_status (char *line, struct trace_status *ts);
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index dcf8c9bbddc..749a62e3043 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -371,7 +371,7 @@ tui_prev_win (struct tui_win_info *cur_win)
/* Answer the window represented by name. */
struct tui_win_info *
-tui_partial_win_by_name (char *name)
+tui_partial_win_by_name (const char *name)
{
struct tui_win_info *win_info = NULL;
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 63bcdf4d7b8..2a4f55be797 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -317,7 +317,7 @@ extern void tui_free_data_content (tui_win_content, int);
extern void tui_free_all_source_wins_content (void);
extern void tui_del_window (struct tui_win_info *);
extern void tui_del_data_windows (tui_win_content, int);
-extern struct tui_win_info *tui_partial_win_by_name (char *);
+extern struct tui_win_info *tui_partial_win_by_name (const char *);
extern const char *tui_win_name (const struct tui_gen_win_info *);
extern enum tui_layout_type tui_current_layout (void);
extern void tui_set_current_layout_to (enum tui_layout_type);
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 423a455c196..c037648800f 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -251,7 +251,7 @@ tui_set_source_content (struct symtab *s,
void
tui_set_source_content_nil (struct tui_win_info *win_info,
- char *warning_string)
+ const char *warning_string)
{
int line_width;
int n_lines;
diff --git a/gdb/tui/tui-source.h b/gdb/tui/tui-source.h
index a9c591f07e2..09ce12adb68 100644
--- a/gdb/tui/tui-source.h
+++ b/gdb/tui/tui-source.h
@@ -28,7 +28,7 @@ struct symtab;
struct tui_win_info;
extern void tui_set_source_content_nil (struct tui_win_info *,
- char *);
+ const char *);
extern enum tui_status tui_set_source_content (struct symtab *,
int, int);
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 2477fa9090e..f49d7d5b87e 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -1690,8 +1690,7 @@ parse_scrolling_args (char *arg,
/* Process the window name if one is specified. */
if (buf_ptr != (char *) NULL)
{
- char *wname;
- int i;
+ const char *wname;
if (*buf_ptr == ' ')
while (*(++buf_ptr) == ' ')
@@ -1699,11 +1698,11 @@ parse_scrolling_args (char *arg,
if (*buf_ptr != (char) 0)
{
- wname = buf_ptr;
-
/* Validate the window name. */
- for (i = 0; i < strlen (wname); i++)
- wname[i] = tolower (wname[i]);
+ for (char *p = buf_ptr; *p != '\0'; p++)
+ *p = tolower (*p);
+
+ wname = buf_ptr;
}
else
wname = "?";
diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c
index dadae6c4c09..8e7d55c4205 100644
--- a/gdb/tui/tui-windata.c
+++ b/gdb/tui/tui-windata.c
@@ -101,7 +101,7 @@ tui_delete_data_content_windows (void)
void
-tui_erase_data_content (char *prompt)
+tui_erase_data_content (const char *prompt)
{
werase (TUI_DATA_WIN->generic.handle);
tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
diff --git a/gdb/tui/tui-windata.h b/gdb/tui/tui-windata.h
index 1a68ea9d45c..08b2f487786 100644
--- a/gdb/tui/tui-windata.h
+++ b/gdb/tui/tui-windata.h
@@ -24,7 +24,7 @@
#include "tui/tui-data.h"
-extern void tui_erase_data_content (char *);
+extern void tui_erase_data_content (const char *);
extern void tui_display_all_data (void);
extern void tui_check_data_values (struct frame_info *);
extern void tui_display_data_from_line (int);
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index b4446018ca3..73ad93f324a 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -241,7 +241,7 @@ tui_erase_source_content (struct tui_win_info *win_info,
tui_check_and_display_highlight_if_needed (win_info);
if (display_prompt == EMPTY_SOURCE_PROMPT)
{
- char *no_src_str;
+ const char *no_src_str;
if (win_info->generic.type == SRC_WIN)
no_src_str = NO_SRC_STRING;
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 7ff2a537377..eb489b15332 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -439,7 +439,7 @@ tui_enable (void)
/* Check required terminal capabilities. The MinGW port of
ncurses does have them, but doesn't expose them through "cup". */
#ifndef __MINGW32__
- cap = tigetstr ("cup");
+ cap = tigetstr ((char *) "cup");
if (cap == NULL || cap == (char *) -1 || *cap == '\0')
{
endwin ();
diff --git a/gdb/utils.c b/gdb/utils.c
index 6b8f2f7820a..b4332f83b72 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1136,7 +1136,8 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args)
int retval;
int def_value;
char def_answer, not_def_answer;
- char *y_string, *n_string, *question, *prompt;
+ const char *y_string, *n_string;
+ char *question, *prompt;
struct cleanup *old_chain;
/* Set up according to which answer is the default. */
@@ -1626,7 +1627,7 @@ init_page_info (void)
/* Readline should have fetched the termcap entry for us.
Only try to use tgetnum function if rl_get_screen_size
did not return a useful value. */
- if (((rows <= 0) && (tgetnum ("li") < 0))
+ if (((rows <= 0) && (tgetnum ((char *) "li") < 0))
/* Also disable paging if inside Emacs. $EMACS was used
before Emacs v25.1, $INSIDE_EMACS is used since then. */
|| getenv ("EMACS") || getenv ("INSIDE_EMACS"))
@@ -2137,8 +2138,8 @@ puts_debug (char *prefix, char *string, char *suffix)
/* Print prefix and suffix after each line. */
static int new_line = 1;
static int return_p = 0;
- static char *prev_prefix = "";
- static char *prev_suffix = "";
+ static const char *prev_prefix = "";
+ static const char *prev_suffix = "";
if (*string == '\n')
return_p = 0;
@@ -2607,7 +2608,7 @@ streq (const char *lhs, const char *rhs)
** at index 0.
*/
int
-subset_compare (char *string_to_compare, char *template_string)
+subset_compare (const char *string_to_compare, const char *template_string)
{
int match;
diff --git a/gdb/utils.h b/gdb/utils.h
index 2380bd7121d..f3e800743c0 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -37,7 +37,7 @@ extern int strcmp_iw_ordered (const char *, const char *);
extern int streq (const char *, const char *);
-extern int subset_compare (char *, char *);
+extern int subset_compare (const char *, const char *);
int compare_positive_ints (const void *ap, const void *bp);
int compare_strings (const void *ap, const void *bp);
diff --git a/gdb/varobj.c b/gdb/varobj.c
index f5d1cbf011e..5f21d84f594 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -50,7 +50,7 @@ show_varobjdebug (struct ui_file *file, int from_tty,
}
/* String representations of gdb's format codes. */
-char *varobj_format_string[] =
+const char *varobj_format_string[] =
{ "natural", "binary", "decimal", "hexadecimal", "octal", "zero-hexadecimal" };
/* True if we want to allow Python-based pretty-printing. */
diff --git a/gdb/varobj.h b/gdb/varobj.h
index 989c8cdc04d..e35c1b86e7f 100644
--- a/gdb/varobj.h
+++ b/gdb/varobj.h
@@ -51,7 +51,7 @@ enum varobj_scope_status
};
/* String representations of gdb's format codes (defined in varobj.c). */
-extern char *varobj_format_string[];
+extern const char *varobj_format_string[];
/* Struct that describes a variable object instance. */
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index 6c8de83d654..870d26800df 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -39,7 +39,7 @@
static const char *
vax_register_name (struct gdbarch *gdbarch, int regnum)
{
- static char *register_names[] =
+ static const char *register_names[] =
{
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "ap", "fp", "sp", "pc",
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 85f2030214e..ec0ae0691cc 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1925,7 +1925,7 @@ windows_detach (struct target_ops *ops, const char *args, int from_tty)
if (detached && from_tty)
{
- char *exec_file = get_exec_file (0);
+ const char *exec_file = get_exec_file (0);
if (exec_file == 0)
exec_file = "";
printf_unfiltered ("Detaching from program: %s, Pid %u\n", exec_file,
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 9c4769a7443..4f22cecec9d 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -203,7 +203,7 @@ static void xcoff_initial_scan (struct objfile *, symfile_add_flags);
static void scan_xcoff_symtab (minimal_symbol_reader &,
struct objfile *);
-static char *xcoff_next_symbol_text (struct objfile *);
+static const char *xcoff_next_symbol_text (struct objfile *);
static void record_include_begin (struct coff_symbol *);
@@ -771,7 +771,7 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
/* Pick a fake name that will produce the same results as this
one when passed to deduce_language_from_filename. Kludge on
top of kludge. */
- char *fakename = strrchr (inclTable[ii].name, '.');
+ const char *fakename = strrchr (inclTable[ii].name, '.');
if (fakename == NULL)
fakename = " ?";
@@ -963,11 +963,11 @@ static char *raw_symbol;
/* This is the function which stabsread.c calls to get symbol
continuations. */
-static char *
+static const char *
xcoff_next_symbol_text (struct objfile *objfile)
{
struct internal_syment symbol;
- char *retval;
+ const char *retval;
/* FIXME: is this the same as the passed arg? */
if (this_symtab_objfile)
diff --git a/gdb/xml-support.c b/gdb/xml-support.c
index cb97beea703..ea0657d9b85 100644
--- a/gdb/xml-support.c
+++ b/gdb/xml-support.c
@@ -355,27 +355,29 @@ gdb_xml_end_element (void *data, const XML_Char *name)
/* Call the element processor. */
if (scope->element != NULL && scope->element->end_handler)
{
- char *body;
+ const char *scope_body;
if (scope->body == NULL)
- body = "";
+ scope_body = "";
else
{
int length;
length = obstack_object_size (scope->body);
obstack_1grow (scope->body, '\0');
- body = (char *) obstack_finish (scope->body);
+ char *body = (char *) obstack_finish (scope->body);
/* Strip leading and trailing whitespace. */
while (length > 0 && ISSPACE (body[length-1]))
body[--length] = '\0';
while (*body && ISSPACE (*body))
body++;
+
+ scope_body = body;
}
scope->element->end_handler (parser, scope->element, parser->user_data,
- body);
+ scope_body);
}
else if (scope->element == NULL)
XML_DefaultCurrent (parser->expat_parser);
diff --git a/gdb/xml-tdesc.c b/gdb/xml-tdesc.c
index d24c5ad88b5..522a9ba0987 100644
--- a/gdb/xml-tdesc.c
+++ b/gdb/xml-tdesc.c
@@ -184,7 +184,8 @@ tdesc_start_reg (struct gdb_xml_parser *parser,
struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
struct gdb_xml_value *attrs = VEC_address (gdb_xml_value_s, attributes);
int ix = 0, length;
- char *name, *group, *type;
+ char *name, *group;
+ const char *type;
int bitsize, regnum, save_restore;
length = VEC_length (gdb_xml_value_s, attributes);
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 91983f88ae7..bfa7f0a6eef 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -103,7 +103,7 @@ enum
static const char *
xstormy16_register_name (struct gdbarch *gdbarch, int regnum)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13",
"psw", "sp", "pc"
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 13f1514e765..7fc881f8022 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -228,7 +228,7 @@ extract_call_winsize (struct gdbarch *gdbarch, CORE_ADDR pc)
/* Find register by name. */
static int
-xtensa_find_register_by_name (struct gdbarch *gdbarch, char *name)
+xtensa_find_register_by_name (struct gdbarch *gdbarch, const char *name)
{
int i;
diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h
index 986aa689f0c..68f9d0ebb2f 100644
--- a/gdb/xtensa-tdep.h
+++ b/gdb/xtensa-tdep.h
@@ -103,7 +103,7 @@ typedef struct
typedef struct
{
- char* name; /* Register name. */
+ const char *name; /* Register name. */
int offset; /* Offset. */
xtensa_register_type_t type; /* Register type. */
xtensa_register_group_t group;/* Register group. */