-Wwrite-strings: The Rest
authorPedro Alves <palves@redhat.com>
Wed, 5 Apr 2017 18:21:37 +0000 (19:21 +0100)
committerPedro Alves <palves@redhat.com>
Wed, 5 Apr 2017 18:21:37 +0000 (19:21 +0100)
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.

150 files changed:
gdb/ChangeLog
gdb/ada-exp.y
gdb/ada-lang.c
gdb/ada-lang.h
gdb/arc-tdep.c
gdb/arm-tdep.c
gdb/ax-gdb.c
gdb/bcache.c
gdb/bcache.h
gdb/breakpoint.c
gdb/breakpoint.h
gdb/bsd-uthread.c
gdb/buildsym.c
gdb/buildsym.h
gdb/c-exp.y
gdb/c-lang.h
gdb/c-varobj.c
gdb/charset.c
gdb/cli/cli-cmds.c
gdb/cli/cli-decode.c
gdb/cli/cli-dump.c
gdb/cli/cli-script.c
gdb/cli/cli-script.h
gdb/coff-pe-read.c
gdb/command.h
gdb/common/print-utils.c
gdb/completer.c
gdb/corefile.c
gdb/cp-name-parser.y
gdb/cp-valprint.c
gdb/cris-tdep.c
gdb/d-exp.y
gdb/d-lang.h
gdb/dbxread.c
gdb/defs.h
gdb/dwarf2read.c
gdb/event-top.c
gdb/exceptions.c
gdb/exceptions.h
gdb/expprint.c
gdb/expression.h
gdb/f-exp.y
gdb/f-lang.h
gdb/fork-child.c
gdb/frv-tdep.c
gdb/gdbarch.c
gdb/gdbarch.sh
gdb/gdbcore.h
gdb/gdbserver/ChangeLog
gdb/gdbserver/gdbreplay.c
gdb/gdbserver/linux-x86-low.c
gdb/go-exp.y
gdb/go-lang.h
gdb/go32-nat.c
gdb/guile/scm-breakpoint.c
gdb/guile/scm-cmd.c
gdb/guile/scm-param.c
gdb/h8300-tdep.c
gdb/hppa-tdep.c
gdb/ia64-tdep.c
gdb/infcmd.c
gdb/language.c
gdb/language.h
gdb/linespec.c
gdb/linux-thread-db.c
gdb/lm32-tdep.c
gdb/m2-exp.y
gdb/m2-lang.h
gdb/m32r-tdep.c
gdb/m68hc11-tdep.c
gdb/m88k-tdep.c
gdb/macroexp.c
gdb/mdebugread.c
gdb/memattr.c
gdb/mep-tdep.c
gdb/mi/mi-cmd-env.c
gdb/mi/mi-cmd-stack.c
gdb/mi/mi-cmd-var.c
gdb/mi/mi-main.c
gdb/mips-tdep.c
gdb/mn10300-tdep.c
gdb/moxie-tdep.c
gdb/nat/linux-osdata.c
gdb/nto-tdep.c
gdb/objc-lang.c
gdb/objc-lang.h
gdb/objfiles.c
gdb/objfiles.h
gdb/p-exp.y
gdb/p-lang.h
gdb/parser-defs.h
gdb/printcmd.c
gdb/psymtab.c
gdb/python/py-breakpoint.c
gdb/python/py-cmd.c
gdb/python/py-event.c
gdb/python/py-event.h
gdb/python/py-evts.c
gdb/python/py-finishbreakpoint.c
gdb/python/py-framefilter.c
gdb/python/py-inferior.c
gdb/python/py-param.c
gdb/python/py-unwind.c
gdb/python/python.c
gdb/remote-fileio.c
gdb/remote.c
gdb/reverse.c
gdb/rs6000-tdep.c
gdb/rust-exp.y
gdb/rust-lang.c
gdb/rust-lang.h
gdb/serial.h
gdb/sh-tdep.c
gdb/sh64-tdep.c
gdb/solib-darwin.c
gdb/spu-tdep.c
gdb/stabsread.c
gdb/stabsread.h
gdb/symfile.c
gdb/symfile.h
gdb/target-descriptions.c
gdb/target.c
gdb/target.h
gdb/thread.c
gdb/top.c
gdb/top.h
gdb/tracefile-tfile.c
gdb/tracepoint.c
gdb/tracepoint.h
gdb/tui/tui-data.c
gdb/tui/tui-data.h
gdb/tui/tui-source.c
gdb/tui/tui-source.h
gdb/tui/tui-win.c
gdb/tui/tui-windata.c
gdb/tui/tui-windata.h
gdb/tui/tui-winsource.c
gdb/tui/tui.c
gdb/utils.c
gdb/utils.h
gdb/varobj.c
gdb/varobj.h
gdb/vax-tdep.c
gdb/windows-nat.c
gdb/xcoffread.c
gdb/xml-support.c
gdb/xml-tdesc.c
gdb/xstormy16-tdep.c
gdb/xtensa-tdep.c
gdb/xtensa-tdep.h

index 3a40ad9c8681b496c17ff4d8efbf8895a287e598..cbf3c0cb6517f31976b35f8809ddae4949ed2f4e 100644 (file)
@@ -1,3 +1,243 @@
+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.
index d9fcdfaac2da94aa9adc7774e04ab9987767385c..1eea4546706a7e90535c42c6619063f7dea06b54 100644 (file)
@@ -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);
 }
index 7be135edfc16e308358de1dbf3865e0edcc29bcf..2e5643bd032f985c4b3aee9fd44b7e4cbf08a325 100644 (file)
@@ -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)
index 794a282da83827f83c61396d2351b68609bab7ff..5f97a6cdccd3cb081374c035baddfd9f3613162d 100644 (file)
@@ -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 *);
 
index 657b1eb84f4e13764516e765b9a31477b6e14e3c..4f866a9ccafbc65b05e55f7064ae3238dc895b7e 100644 (file)
@@ -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);
index ade770ea0162cf69a76880e758d27268f77eb4aa..9be79437941af89b877fff04dd4fa9f98f480693 100644 (file)
@@ -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"
       };
index 01099f5abaff4dd5f7a21cc06c43dce362525887..05b1dd7019a01a9f486d738c834285185c3c8946 100644 (file)
@@ -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))
     {
index d6c0921fd5c0bd1439a2e2ba8e629bef3c5d62e8..06ab843d3ac6fe4ebdadd866f4c81f85565c0a58 100644 (file)
@@ -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;
index 8ec0bde7760e034fe79a645605bc21c32ce44cc3..f9590aa270c36dc39cad23469edd9ec75e27f5b3 100644 (file)
@@ -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 */
index 4cd7a00e9942412914c8d104766f1df58b9bbe45..3925ec6189bf697871b3bed0ab59ff63c7ffb72c 100644 (file)
@@ -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,
index 6940270d80ce61870188f7d6777c59fbb45bc6a2..a7f2128a78384ff0f16556c93f82630a7d302d04 100644 (file)
@@ -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
index 5d4775c0f0bb1eb94c9c281ab5dd26284b786fc9..9769d207dda2de82566ff60b17283db1e5b165d7 100644 (file)
@@ -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",
index 76d74f89a0bca1bc879c36d37ecfe0bbcdbcdaab..cbad027d0c462a2655f77b2307bdcce80c9b5978 100644 (file)
@@ -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
index fc5f0e7df61bf3e8c9ab2c9820ffce338bd1a0dc..60109a0da2e12c8d804978f5a73858a4b988cf30 100644 (file)
@@ -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);
 
index 7c25641738bebbf4167c57af79728a2d1ad23106..b2fc1959c050b6c25989c38f78220c5b5b657c9b 100644 (file)
@@ -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;
index c4b19ecfef610584a1c716fff0d802495c379be0..974623897247c77e1756036985620f125fa1370e 100644 (file)
@@ -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,
index a5793e58639c18bbb5963aa094791972af457300..e3b097b227578d208f6a5098a147a01f39281662 100644 (file)
@@ -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);
index cc24f70e00d6c19a19494364329bb23e064671c3..8302c59bacdf7e6fe9123ca2cc8a31baf8e9c756 100644 (file)
@@ -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);
index f7ffb6dfe56bf46bc884907734692a1d005ead63..4956ba76dff63b0e4bb9d37a5be701327fbee56c 100644 (file)
@@ -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;
 
index 4e302b7e8dea4e3926961261fa623d8cbad5b35b..fc14465211f5d9a5f821b5cba4051b0eb5fcba25 100644 (file)
@@ -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;
index 96302615d04e3e6e08d8d1771efbc26b285347c2..213622d8f35d5354cf9e164b712b56ba7ab179a5 100644 (file)
@@ -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))
index c3f1c65b228fe5f8ed6a928f041ce1ca027dce42..33b657d64f1ac26219bc9a8eed2c9db3001a3096 100644 (file)
@@ -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;
index 969c5c6e499c7333df7e0660d0f2c4ff95e14f5b..c8859763a3d15f52c11cef09b4f2417f99a01d18 100644 (file)
@@ -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);
index 65004c095c8c7f8a4795ec74d7d5f281babd2d4c..e8c6b67d623835bef49f5137391600efd8171ffc 100644 (file)
@@ -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
index 2c86da4550feee25ff7d50c274c3425164deee0c..ae200217be03f34a24ba29faa53e9feb2f5dabad 100644 (file)
@@ -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 **,
index a0fb54139ac10e12726dddff6cabdc686facc7da..52ecaf1b2e56452b7bb38fcb058d74e8f78d0ef4 100644 (file)
@@ -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?  */
index 9183e2aef7a75144662720d164ec2dc9a3fe7ed0..7e46416b1c7eef243a5b894be46e9befcae63074 100644 (file)
@@ -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;
index 54cb789d797566af5c02f2f367bb2474b3d3c491..13a90b967fe9ad97126e635fc1e915952fd573f2 100644 (file)
@@ -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);
index 73a4d9083a7178d9f778d06a242f8216baa1ec7c..78745cb5c7e4a6693bbd9e7ed6bb9d76d178bfe5 100644 (file)
@@ -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;
index 143bb48db37c08877d11b07ea66b4f256a55104d..73fe03d5c9b035f12aea2192d908d3ab4f5c94d9 100644 (file)
@@ -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));
 
index aefd44ad192acb0d428e8b9cf870b673e60fe02d..a46356ff8b6f35aa536528089d292e39645f2a7b 100644 (file)
@@ -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", \
index 8625e41f3ccb30da0ad2cb73c4f0aff3f007c87f..06eef5f22932a2ff39b60932e743993bcd5e9a84 100644 (file)
@@ -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;
index 27e05a1d8cef5c7a94b2f19af2aa693a32facf1c..f47050aa30128b0db9fa2b41c1f01f9b2a07a64b 100644 (file)
@@ -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  */
 
index e95d2287ff5e30bcde4c875f552cd28c0adc918b..daa3ce9f813367773e62b75f92e5a6bfe05f80d7 100644 (file)
@@ -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
index aa586055d399fa0d0ba3c05328009e82cdd16eb8..f689ec5048a91509de907d2a3854ada5d1b22e19 100644 (file)
@@ -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);
index aa20c42db6cda95dd83c8d6cc542cec602549df6..966e1ee81ba99a17f96b095c19a5d14485f84af9 100644 (file)
@@ -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)
index dd2770a8806624c574af3ef86df92979a0b58633..1281df89225d80ee50643f7ce4531a99ad4609bc 100644 (file)
@@ -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;
index b0f28d9a97d8559185bdb0fd2a28b1aa7f27e176..f9a80a0b3fabff4faf5078c2d0eeb1385964bdf0 100644 (file)
@@ -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;
index cf7d0f0d1e230a590bb266b5249a4cbe60d0724b..b2cdee3c43cbf61869acd2d7fa72ed62993851cb 100644 (file)
@@ -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,
index b74d32cb410ea399b427e12de6ab6f20b6defbb4..9b8ac4c070b4db0729eff48261405ab8117492ad 100644 (file)
@@ -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, "  ");
 
index e4e96f6cf42de1c08c58829f2b916cecbf21f612..8fe6b070445492243f4162a591a5e453b3c198e8 100644 (file)
@@ -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
index 49d797d7d45ed6458ad4993ec201141985dffcd7..7e9e234bf68fc309f85726dfcbe83fd12f69d52c 100644 (file)
@@ -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;
index 08a5f2578f1005caf4606fc472e2e93015926361..5633b4121d826cea53dcd20215538247d829392a 100644 (file)
@@ -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 *);
index dc2a314edf06dc9ee39c48f4b70360c24709998d..04d2cdfbfac3f992c1b673612e7857dca7a19b0f 100644 (file)
@@ -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;
     }
index 87124e7efdba2c5025ffcc343e31b6cd58b17ba0..87447337a8767600bbbe83b0a5aa5f1e5559c6e2 100644 (file)
@@ -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] = "";
 
index 6debb10f594c4b26a76ccdf96e8637f98aa9e89f..319a8902a831ad19e785385fb52269659443a861 100644 (file)
@@ -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];
index c471b73cb10b024fd1ff955fbbc0469f1f0732f6..bdfb6b20d0f3e131bcaaf4ef682360612ac69145 100755 (executable)
@@ -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];
index 12ce46669d18cd454785fa159a78b1d41c2dc651..40ae37c69f2fb69c0e1681d15198556d9ce8dc12 100644 (file)
@@ -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.  */
index 0bfe2ecf83d8579f3afbfd32827855b59c3fbd7b..a09006a5d42e01270a53204710ccfe30fccba094 100644 (file)
@@ -1,3 +1,8 @@
+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)
index 3bd9f3f0a6eb4d7036a0ed7cfa19aa3f523e8654..b76850617fba1bb44705f57c3e6a5ab9d1cfc9d5 100644 (file)
@@ -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",
index 6df1d5169f04fe23fb4f91bbacf1fb8db2f1cb75..b39026ceae8fbc0ff92c000107f3c3febf6bef37 100644 (file)
@@ -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;
 
index c4d0d2bde7e2719d5aa964bbe4c2c55b64c13e02..1906e68c7a91d5d08b3657ef7e44aee2a7cd0664 100644 (file)
@@ -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;
index 101cf9da8b68790b6e8d0f5f9d98ca625154b9d8..e08b2f0a806a81c7af2b21088f3b4536178c9479 100644 (file)
@@ -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.  */
 
index d2d8d7affaa06512ccc13747b93341bf806d5914..a20067e7ef7ae052c49cc4ba451a4025d630f452 100644 (file)
@@ -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",
index 71cffbb273fde3574af1cbc89f96e36e43656b1d..9189446f114b633aaddb291da80731981433ce8a 100644 (file)
@@ -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 = "";
 
index 5f6d442fbbc65924cdc00926f2fe1bd793a0118b..ae5d14599dbea5207d2557b608bad2d7b5929ac9 100644 (file)
@@ -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;
 
index 6d2cc139f5a26757838508121ad9fbcb389e44ad..ab00fd93e5d5990ebe9545a0306b917c6151756e 100644 (file)
@@ -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 = "";
index 10ef7962e2f9255a5eadf8ad1fee9c9cd9218355..060e5d371480093b6abe7571481360a008c5c735 100644 (file)
@@ -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",
index a5053c6868d541c9c2a80dce122bf035c1f6ba86..2636a27bbbe64d593f0509ceb54d9d7dd064a9c0 100644 (file)
@@ -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",
index 4c53bc6b05a011e4995c94b669b4f11108a12a38..22e158866bbbf0d9457737ac973027521e2c1655 100644 (file)
@@ -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",
index d41e609f8e27a4870a330d1fa5ea0c4868be5696..f6ffb9ba18631fdc76eead426022a21afb7182fc 100644 (file)
@@ -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;
 
index f1fc220ea8933be99cac7948415bb25668c10698..ee0101db74af2cb108b4e053dbdbc699d847639a 100644 (file)
@@ -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"));
 }
index 96080ac4eca216605fecbd29dcc0fe7c17bbbb8b..58bcbe8faec0f948000c7f4698a487d20b6f546c 100644 (file)
@@ -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
index a3cb0cbba165c07cd1dcc007ebca0cd2a38bd91f..dcbe25375dc744ab3ff770ef45a8e763c2257e4e 100644 (file)
@@ -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;
index 0e2607b5d96683aba65cb7a50aa109476a2c03a1..eda3d7bff16903e8162023736ec2faca88f6a820 100644 (file)
@@ -262,7 +262,7 @@ struct private_thread_info
 };
 \f
 
-static char *
+static const char *
 thread_db_err_str (td_err_e err)
 {
   static char buf[64];
index 3cd93381bdd787e6ef18b34b58039c8588223839..bd3e182a6757acf8ae0b852fd8a5143ad50c1ec7 100644 (file)
@@ -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",
index acf2e1b83dc0b7f73730ccfe328242e1bfc90a51..9179187aa20e2125d774e04480835896bf38a56f 100644 (file)
@@ -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;
index 6f73394147746ba937784b9ca1b1810c0ca2f7a7..30fddd7b4b1e6c93713ccdf8d7f3277992cc8da4 100644 (file)
@@ -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,
index 40f29d343b91f254cce2dd783553795c9c990eff..1d0d7edbc042131b8042153aba75b8a94fff8ac7 100644 (file)
@@ -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",
index d06598feedcaf4d3d169c77b1a630dc2705b71fc..893d9c24798adea87010a847df205d7dc64ca9d0 100644 (file)
@@ -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",
index 6ae95901b349ce1e1942411c074f100274919d42..57fe6449aebcb1d3729e4cd9cc5e843cdd577001 100644 (file)
@@ -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",
index 5537d9d60f4a9a8bd947780a6ece288fb8a9c82f..e7a0dadaef7663aacc49f7c936cc18fc46817e35 100644 (file)
@@ -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;
 
index 952dffb60a31610bc5a9e0bb4573abf9330dfedb..8e27194a642960e09c0d484a11dff52d68b80daf 100644 (file)
@@ -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 *);
 \f
 /* 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);
 
index e01e2c8bba0a1dea184ef40d851d4e2568c8f7f3..2493537fe0af25257544af1210e78970dfebf325 100644 (file)
@@ -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,
index b1dcc863ef0b18472e2cbc123244b12ab397e7d1..5a45d6e8a84f74da2eaaf13f1581201fbf52e406 100644 (file)
@@ -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
index a6347ee11e2c50bcf890fdd4edbf32e813b75b2b..4093178713ff1b1fd93a08ad3e229a38a8799a27 100644 (file)
@@ -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
index bb56205f058825a70558ecdd37af776ef50d42a0..bd910337486bab27c97474963794b01dd0d399bf 100644 (file)
@@ -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);
index 430c07b9de0e450f29615643ad420e50d98c22a5..78ef8e00a74c6c49990827de110ec267e247dd73 100644 (file)
@@ -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)
index 9a876574201a73de048edd8f2752e5389291992d..91fe1044a168274427271838f894071f633f0c60 100644 (file)
@@ -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;
index 41cb9d82c6ef473c1fbbf86601914f9a4f462411..45d1d731b0cd129f58101a7b2ba922974aa11aee 100644 (file)
@@ -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)
     {
index 38356e541d19d072fbb39da4e46b20b6b0f4e1bf..0f5e10fccc54efc9275511bb06e9b27636d0565f 100644 (file)
@@ -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",
index 7383f272454a50d37d1c7ece37a8f857bdb24e84..d0f4223d7f074aa6e63166eacd9c6489c573fc22 100644 (file)
@@ -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",
index 2417a468bd135f9f4b07f9fe8eaf01edba51c635..ba2e5a5d8feee3a7ac78092726ba27a2346cd749 100644 (file)
@@ -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",
index 04ad06c431a0e8c8e6c4286f06185be01d727b0d..8f8d1d5384621f6aa326497fcdd20f2efeb072c1 100644 (file)
@@ -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++);
index ad7c64ea9fe9cc0a136cbcfa51c6094da6e11ca5..e102b800aa53cd305cab3e143dab430bb024603e 100644 (file)
@@ -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.  */
index 49e687811998b85145533c007aeb0e42d2e2859f..e22b198d7d140ae3f9f64a17ac4ae231420e185f 100644 (file)
@@ -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
index 758fa864a5593b9b344dea13d80d110c742ae3f4..9500b1c7f44bad424efe214e943534323aab0961 100644 (file)
@@ -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;
index f719d30614c9c8e05fbbdf5b87a0e43eb8e33534..58db6c9194f909d507458863f5ffb0eb5232788c 100644 (file)
@@ -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.  */
index 5911d8de24d71a012b28ed95c95d86897e5ed8bc..81eb2162589678c2205fbec94881610a38eeb756 100644 (file)
@@ -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;
index aa0398743dfc6335aa91fa2bcc1ade1fb3b77453..96a290b8e0b6e627392db0671397d45ab3068f34 100644 (file)
@@ -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 *,
index 0913580d32dbc89cec23927870243880f88648a5..fadc2ef2b13d0ca00d7c9d8485546a57f6c42919 100644 (file)
@@ -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
index e4a35a7b40d8fe0542f63f0973d598e71d8b308f..f09f18a4399a11ade46d3ab3b613944cad4050dc 100644 (file)
@@ -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;
index d98a4af0d97ff807055f4374a3d3fac119da27d7..bdce8f239aa999f8fda242979e74983d27e4f929 100644 (file)
@@ -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);
index a08501ee2334a29707bb38a419f979441547074e..6bf517c641a2b42a4f51dd1e8e8d53d00795984e 100644 (file)
@@ -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;
 
index 3e60673ca23f9f86d62b5cdacb2d7db32a30d210..62032115b0c7963d0b190b15c220b5a2fa662754 100644 (file)
 /* 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);
index dc1d73e78b4ba5898969c5a9ea56a882e09e6c49..b349891269fc859be44908434e06fe13d937a093 100644 (file)
@@ -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;
index 4b2f4c03ab370c52c41e4229b19fef1a01eac2a3..ccb851339c8ede138f2b0f6f96f2e2b5d725d851 100644 (file)
@@ -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 */
index 4766bd65059053e9a0d41df080939590b2c1dcdb..126d18cead414e1cbab0a124bc54b24f87c2db64 100644 (file)
@@ -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 ();
 
index 06f6ff90a01d3b971e931f315570796784e506cc..797ca848be4413c83ad825707331e2c8d4d9b3ae 100644 (file)
@@ -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.  */
index 6db4aab895732cdf45cd0bb61ed9887c6727274d..75b055c98c9803eaab26689c9b902812518f87f0 100644 (file)
@@ -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))
     {
index 4b43c54e843e8fbc8493da036f8cab8506362e02..3d2cb1ddbeb38d53dd63cb3b3884e9b0f5d266f1 100644 (file)
@@ -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;
 }
index d80b731860c056a54d1737869654ac93dcd454e7..f0d3423e3bf93a871bf334d0995062f96415e7c2 100644 (file)
@@ -32,7 +32,7 @@
 /* Parameter constants and their values.  */
 struct parm_constant
 {
-  char *name;
+  const char *name;
   int value;
 };
 
index b7821b5937306097d0d8871493e0f6f6b0afb4ef..a5c2873697944c1293fdd9f8265dde078378e6c2 100644 (file)
@@ -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;
index 25f475ff39df7af8fbfc69b2393550179b3a2e7c..cc58267b9557a9d6893f03b99d7912b5a3affdbb 100644 (file)
@@ -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 = "";
index 5f3aac2281df331d752368bd0cf8bce8b8903afe..252b423bfabc43a46c375b582037bea4132b2683 100644 (file)
@@ -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 },
index 30cd47ac8bfde2d417b78ed22e7be33dee8bb90f..a61469c987258e3149543a547ec1e4e2117ca2e8 100644 (file)
@@ -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);
 
index 7f0a027af0e9990302a32715c62de0eb873c8169..4080616b6e34e71297bbe79aa2e7bd7080b8bc89 100644 (file)
@@ -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;
index 67c4d5184b93189b80e5e37aaff2b9e23c9b7b1e..eb784c562fd158b815c8056c131f2922996fa92d 100644 (file)
@@ -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;
index b3e03664e268c985ae1f1f8ee27835aba12be5d0..64b7c55efeb83a1f8fcdda1ad565fd93534c7625 100644 (file)
@@ -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);
index 4977b0a1aa3f04b18e8e6179915b9898156cb75e..fe8a58cb0f3ff2d6b21a225ed76c5f8452f03ad6 100644 (file)
@@ -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)
index 8f2b6826c152eabfcb6950bc38220b687f9d10f7..61547d772afc20e8d57ccb05ebab3822fc60bfe0 100644 (file)
@@ -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);
index b39cc3387151113a688bc9a4e6cbf8ecdcaf7b1c..c76ddbee108efe946db90578391dbe500a3ee2cb 100644 (file)
@@ -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);
index 9b3692dc0c32ffcb53d99f0fc095303d2c221fcb..f4b4c486fd59715b9eacfecf034653ce570716a9 100644 (file)
@@ -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",
index 23f5ade3b2e631eeb50cb918a4f36bb8cfbe6131..33986fd12ffa37d59a5021cc3dcf25ad6fbceedf 100644 (file)
@@ -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 */
index 232641b9c6c314e4376b7babd40687755290107e..0b975569e25c81f03ec1fc1f216d0aeeab534e67 100644 (file)
@@ -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;
index cd8b64d53952f2802b6618f6223bcc84189872df..00e59c21df95807c6bc450514e04a7490501e93c 100644 (file)
@@ -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,
index 14122021c63863ad3b096a0c823f3cfd0e21d161..8ba6bb5563258bcf0bd08b90ed3ea0647684ed0f 100644 (file)
@@ -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 == '+')
     {
index 988063f242969aecac74010c6123a68fc9d0a154..b37be1a0421592e92b406e5236ca645a09676d5b 100644 (file)
@@ -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);
 
index 8b795085437829b63424fddbb37bcff8b176249c..750039dbc932d4404958179be986aa43b1eb44af 100644 (file)
@@ -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));
index c3e7a314c9cbcd930f17c6f88f12b7ec4b802aeb..6066481fd590ae439d8ef788cbcb06281e45f06f 100644 (file)
@@ -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);
 
index 33ae1fa7ebceff34d0b2cce5d3e22c7c03cb65e2..9a7e2ddfbd632f4e55f8c8834576dd89ad9c82ee 100644 (file)
@@ -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);
 }
 
index fd9181ee30d89d7f45adaf51e34027d93d259061..10a53150cdc1ff607aa2653b7dbba2449a88b6fd 100644 (file)
@@ -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)
     {
index 6553f491b298063823a62dd0691bd4fe67ecce36..fac9d51c017e41ecbf267e8bb89154fdc0604a9b 100644 (file)
@@ -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 *);
 
index fd9022ff806b3de62133c848e28fb284fcad6a67..24347dd6e66768d7d66cecfc5b81289163c53af2 100644 (file)
@@ -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";
index 4a22be135ab58caa28f19749c53c1dac5f96fb14..3de8a2665670248ced0535b8a52784f4dd3525f6 100644 (file)
--- 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;
index 2da92dfa9faffe1c8edc1841b3d0f876cc0c6e18..452a381951445aad81a05eb79071c3edbd4988bc 100644 (file)
--- 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
index dbcd65d5dfac71424dfc690caf22d05e0eaf1522..5d63c16e1503baf517ddbcbac107b1a8d27d05c8 100644 (file)
@@ -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);
index 87ef1418e6dc0f1cfcc8635fc87764a68241c149..c28aa384edc688e05abc90c2349b18c95ca04516 100644 (file)
@@ -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"));
index 8c4dedcecffe1d5a3e35f543fab18d64c91b34e4..474563e7e93357b4faae587b97213cfe42be79b5 100644 (file)
@@ -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);
index dcf8c9bbddc1668858d24ea69078acdf18c23a6a..749a62e30437646b1a437479040c428cc4acf27e 100644 (file)
@@ -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;
 
index 63bcdf4d7b8b16b54e98b639aac1a6b5d1d7f62c..2a4f55be7979787d7d829c61dd17e53a3ef831bf 100644 (file)
@@ -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);
index 423a455c19655f1a0ef10acb584499ca7660afe7..c037648800f477c05914c753f0fcbe0582c65c11 100644 (file)
@@ -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;
index a9c591f07e279da4db6ed754f355257ad1cd45fa..09ce12adb68950e1b2436cbf15b28e63984ffcc2 100644 (file)
@@ -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);
index 2477fa9090e6fe78b71be733475583ad0e85d78f..f49d7d5b87e0d090be54ce42bbf4622b19da8a76 100644 (file)
@@ -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 = "?";
index dadae6c4c091ab23ee94d9935a9ce7ac45ea0165..8e7d55c420532ba413bd0523839359aa01d991fd 100644 (file)
@@ -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);
index 1a68ea9d45cb8224d9e09e9f1f7bfcafe7dc3df0..08b2f48778665905822f25afbd492ac1fbc70fb2 100644 (file)
@@ -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);
index b4446018ca339477898bf774771ff787052289ff..73ad93f324a31928e4c914d6ae74a5053be4bf1f 100644 (file)
@@ -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;
index 7ff2a5373770e46d97b69a38558c94b8e86e75af..eb489b1533219140aa6d478d6a2e8119c85c2da6 100644 (file)
@@ -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 ();
index 6b8f2f7820aef481f1657e49dc82da4c62422eb0..b4332f83b72758e906b5dee03b6ff76a727d6694 100644 (file)
@@ -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;
 
index 2380bd7121dcd89c3870fc0665a7a4b7163ae285..f3e800743c02f1905ee98fb41b3caa324301e297 100644 (file)
@@ -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);
index f5d1cbf011ebbe91df755bf653fe1735a28f4e81..5f21d84f594bd1f177e052677d60243b5f4cbece 100644 (file)
@@ -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.  */
index 989c8cdc04d0aa2ba374617177f5ee277f194c8c..e35c1b86e7fa5ea617ffa6cacecccd9feddcad4e 100644 (file)
@@ -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.  */
 
index 6c8de83d65497f3bb7d11740536d50ee5198b746..870d26800dfe3b2fda7b7d4122e71e901b1bae71 100644 (file)
@@ -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",
index 85f2030214ea563eb9c0d5cbccb7ec57551710fc..ec0ae0691cc84badd9bd5ed5d92420f9c644802e 100644 (file)
@@ -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,
index 9c4769a7443b624dc2bebaa16dc8d28d9af06230..4f22cecec9de9574b25b8858ae973d90758b0dd1 100644 (file)
@@ -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)
index cb97beea70389880b5639808db524c4a5ffba23a..ea0657d9b8573114846461e10e8fb0ebb9e35c41 100644 (file)
@@ -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);
index d24c5ad88b591a481ee71ddf623e8566faebff2a..522a9ba0987365bb0d532ad29cb130e6f42eee69 100644 (file)
@@ -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);
index 91983f88ae75145ea77d9154ceb406a2df311967..bfa7f0a6eef43594627c44bf404e6b4cf6928948 100644 (file)
@@ -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"
index 13f1514e7651e47a268ef809b1324167f1f759bd..7fc881f8022f596ef229f31b20929852eaef442a 100644 (file)
@@ -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;
 
index 986aa689f0cd30e2b7c311ab7e23c20f6b888787..68f9d0ebb2f28fe8e6107c9c6cc142e8c98a0b6a 100644 (file)
@@ -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.  */
This page took 0.124635 seconds and 4 git commands to generate.