diff options
author | Andrew Cagney <cagney@redhat.com> | 2003-06-03 20:54:43 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2003-06-03 20:54:43 +0000 |
commit | a9596cd98aa07c137ed362c7d92df64213b4fa04 (patch) | |
tree | 93d2aea2e0fa868da0f9b56626e5cfe8c2341869 | |
parent | 74eda9eb7acc3c2bd375826f92e8ca233d5f767a (diff) | |
download | binutils-gdb-cagney_writestrings-20030508-branch.tar.gz |
Snap const char * mess.cagney_writestrings-20030508-branch
134 files changed, 1333 insertions, 1238 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9c58b41c498..efcd81fd9e5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,99 @@ +2003-05-10 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (IN_SOLIB_CALL_TRAMPOLINE): Make string parameter + constant. + + * config/rs6000/tm-rs6000.h (rs6000_in_solib_return_trampoline): + Make string parameter constant. + + * stack.c (func_command): Delete cast. + + * gdbarch.sh (PC_IN_SIGTRAMP): Make string parameter constant. + + * infrun.c (pc_in_sigtramp): Make "name" constant. + (struct execution_control_state): Make "stop_func_name" constant. + + * infcmd.c (step_1): Make "name" constant. + (step_once): Make "name" constant. + + * infcall.c (call_function_by_hand): Make "arg_name" constant. + + * command.h (add_com): Make string parameters constant. + (add_com_alias, add_info, add_info_alias): + + * breakpoint.c (create_overlay_event_breakpoint): Update. + (break_at_finish_at_depth_command_1): Delete cast. + (break_at_finish_command_1): Delete cast. + (create_longjmp_breakpoint): Make string parameter constant. + + * printcmd.c (print_address_symbolic): Update. + + * defs.h (print_address_symbolic): Make string parameter constant. + + * breakpoint.c (create_overlay_event_breakpoint): Make string + parameter constant. + (struct ep_type_description): Make "description" constant. + (print_one_breakpoint): Make local variable "bpdisps" constant. + + * command.h (error_no_arg): Make string parameter constant. + + * symtab.h (find_pc_partial_function): Make string parameter + constant. + + * blockframe.c (find_pc_partial_function): Update. + + * symtab.h (find_pc_sect_partial_function): Make string parameter + constant. + + * blockframe.c (find_pc_sect_partial_function): Update. + + * main.c (captured_main): Use xstrdup on TARGET_SYSTEM_ROOT. + + * value.h (lookup_internalvar): Make string parameter constant. + + * values.c (lookup_internalvar): Update. + + * blockframe.c (cache_pc_function_name): Make variable constant. + + * top.c (catcher): Make string parameter constant. + (struct captured_command_args): Make "arg" constant. + + * defs.h (wrap_here): Make string parameter constant. + (catch_errors, catch_command_errors): Ditto. + (error_pre_print): Make string pointer constant. + (quit_pre_print, warning_pre_print): Ditto. + * utils.c (wrap_here): Update. + + * top.c (saved_error_pre_print, saved_quit_pre_print): Make local + pointer variables constant. + (catch_command_errors, catch_errors): Update function signature. + +2003-05-08 Andrew Cagney <cagney@redhat.com> + + * defs.h (store_address): Delete declaration. + findvar.c (store_address): Delete function. + * arm-tdep.c (arm_push_dummy_call): Replace store_address with + store_unsigned_integer. + * xstormy16-tdep.c (xstormy16_address_to_pointer): Ditto. + * v850-tdep.c (v850_push_arguments): Ditto. + * sparc-tdep.c (sparc_get_saved_register): Ditto. + * sh-tdep.c (sh64_get_saved_register): Ditto. + * rs6000-tdep.c (rs6000_push_arguments): Ditto. + * ppc-sysv-tdep.c (ppc_sysv_abi_push_arguments): Ditto. + * mips-tdep.c (mips_eabi_push_arguments): Ditto. + (mips_get_saved_register): Ditto. + * ia64-tdep.c (ia64_get_saved_register): Ditto. + (find_func_descr, ia64_push_arguments): Ditto. + * i386-tdep.c (i386_push_arguments): Ditto. + * hpux-thread.c (hpux_thread_fetch_registers): Ditto. + * frv-tdep.c (frv_push_arguments): Ditto. + * frame.c (legacy_saved_regs_prev_register): Ditto. + (deprecated_generic_get_saved_register): Ditto. + * findvar.c (unsigned_address_to_pointer): Ditto. + * dwarf2read.c (dwarf2_const_value): Ditto. + * arm-linux-tdep.c (arm_linux_push_arguments): Ditto. + * alpha-tdep.c (alpha_push_arguments): Ditto. + 2003-05-08 Andrew Cagney <cagney@redhat.com> * regcache.h (max_register_size): Delete declaration. diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index c1648b48b48..74f4f7da5d4 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -1146,7 +1146,9 @@ alpha_push_arguments (int nargs, struct value **args, CORE_ADDR sp, write_memory (sp + m_arg->offset, m_arg->contents, m_arg->len); if (struct_return) { - store_address (raw_buffer, sizeof (CORE_ADDR), struct_addr); + /* NOTE: cagney/2003-05-09: Using sizeof CORE_ADDR here is just + wrong. */ + store_unsigned_integer (raw_buffer, sizeof (CORE_ADDR), struct_addr); write_memory (sp, raw_buffer, sizeof (CORE_ADDR)); } @@ -1226,7 +1228,7 @@ alpha_push_dummy_frame (void) registers follow in ascending order. The PC is saved immediately below the SP. */ save_address = sp + PROC_REG_OFFSET (proc_desc); - store_address (raw_buffer, 8, read_register (ALPHA_RA_REGNUM)); + store_unsigned_integer (raw_buffer, 8, read_register (ALPHA_RA_REGNUM)); write_memory (save_address, raw_buffer, 8); save_address += 8; mask = PROC_REG_MASK (proc_desc) & 0xffffffffL; @@ -1235,12 +1237,12 @@ alpha_push_dummy_frame (void) { if (ireg == ALPHA_RA_REGNUM) continue; - store_address (raw_buffer, 8, read_register (ireg)); + store_unsigned_integer (raw_buffer, 8, read_register (ireg)); write_memory (save_address, raw_buffer, 8); save_address += 8; } - store_address (raw_buffer, 8, read_register (PC_REGNUM)); + store_unsigned_integer (raw_buffer, 8, read_register (PC_REGNUM)); write_memory (sp - 8, raw_buffer, 8); /* Save floating point registers. */ @@ -1249,7 +1251,7 @@ alpha_push_dummy_frame (void) for (ireg = 0; mask; ireg++, mask >>= 1) if (mask & 1) { - store_address (raw_buffer, 8, read_register (ireg + FP0_REGNUM)); + store_unsigned_integer (raw_buffer, 8, read_register (ireg + FP0_REGNUM)); write_memory (save_address, raw_buffer, 8); save_address += 8; } diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c index a4a77c1c00c..f83b66c6e09 100644 --- a/gdb/alphanbsd-tdep.c +++ b/gdb/alphanbsd-tdep.c @@ -178,7 +178,7 @@ alphanbsd_sigtramp_offset (CORE_ADDR pc) } static int -alphanbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) +alphanbsd_pc_in_sigtramp (CORE_ADDR pc, const char *func_name) { return (nbsd_pc_in_sigtramp (pc, func_name) || alphanbsd_sigtramp_offset (pc) >= 0); diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 2f555ff6fa8..ee5ba195662 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -150,13 +150,13 @@ generic_skip_trampoline_code (CORE_ADDR pc) } int -generic_in_solib_call_trampoline (CORE_ADDR pc, char *name) +generic_in_solib_call_trampoline (CORE_ADDR pc, const char *name) { return 0; } int -generic_in_solib_return_trampoline (CORE_ADDR pc, char *name) +generic_in_solib_return_trampoline (CORE_ADDR pc, const char *name) { return 0; } @@ -470,7 +470,7 @@ generic_register_byte (int regnum) int -legacy_pc_in_sigtramp (CORE_ADDR pc, char *name) +legacy_pc_in_sigtramp (CORE_ADDR pc, const char *name) { #if !defined (IN_SIGTRAMP) if (SIGTRAMP_START_P ()) @@ -530,7 +530,7 @@ static const char *set_endian_string; /* Called by ``show endian''. */ static void -show_endian (char *args, int from_tty) +show_endian (const char *args, int from_tty) { if (TARGET_BYTE_ORDER_AUTO) printf_unfiltered ("The target endianness is set automatically (currently %s endian)\n", @@ -541,7 +541,7 @@ show_endian (char *args, int from_tty) } static void -set_endian (char *ignore_args, int from_tty, struct cmd_list_element *c) +set_endian (const char *ignore_args, int from_tty, struct cmd_list_element *c) { if (set_endian_string == endian_auto) { @@ -713,7 +713,7 @@ set_architecture_from_file (bfd *abfd) argument. */ static void -show_architecture (char *args, int from_tty) +show_architecture (const char *args, int from_tty) { const char *arch; arch = TARGET_ARCHITECTURE->printable_name; @@ -728,7 +728,8 @@ show_architecture (char *args, int from_tty) argument. */ static void -set_architecture (char *ignore_args, int from_tty, struct cmd_list_element *c) +set_architecture (const char *ignore_args, int from_tty, + struct cmd_list_element *c) { if (strcmp (set_architecture_string, "auto") == 0) { diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index cf515a4f76d..808f9b26048 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -148,9 +148,9 @@ extern gdbarch_virtual_frame_pointer_ftype legacy_virtual_frame_pointer; extern CORE_ADDR generic_skip_trampoline_code (CORE_ADDR pc); -extern int generic_in_solib_call_trampoline (CORE_ADDR pc, char *name); +extern int generic_in_solib_call_trampoline (CORE_ADDR pc, const char *name); -extern int generic_in_solib_return_trampoline (CORE_ADDR pc, char *name); +extern int generic_in_solib_return_trampoline (CORE_ADDR pc, const char *name); extern int generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc); @@ -163,7 +163,7 @@ extern int generic_register_size (int regnum); extern int generic_register_byte (int regnum); /* Prop up old targets that use various IN_SIGTRAMP() macros. */ -extern int legacy_pc_in_sigtramp (CORE_ADDR pc, char *name); +extern int legacy_pc_in_sigtramp (CORE_ADDR pc, const char *name); /* The orginal register_convert*() functions were overloaded. They were used to both: convert between virtual and raw register formats diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index 60c8ae492a9..9debbeb4948 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -195,7 +195,7 @@ arm_linux_push_arguments (int nargs, struct value **args, CORE_ADDR sp, { CORE_ADDR regval = extract_address (val, len); if (arm_pc_is_thumb (regval)) - store_address (val, len, MAKE_THUMB_ADDR (regval)); + store_unsigned_integer (val, len, MAKE_THUMB_ADDR (regval)); } /* Copy the argument to general registers or the stack in diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index d2e3ef598a0..59fa2696221 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -1468,7 +1468,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache, if (arm_pc_is_thumb (regval)) { val = alloca (len); - store_address (val, len, MAKE_THUMB_ADDR (regval)); + store_unsigned_integer (val, len, MAKE_THUMB_ADDR (regval)); } } diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index 5692c35f990..c0a48372d76 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -135,7 +135,7 @@ static void gen_expr (union exp_element **pc, struct agent_expr *ax, struct axs_value *value); static void print_axs_value (struct ui_file *f, struct axs_value * value); -static void agent_command (char *exp, int from_tty); +static void agent_command (const char *exp, int from_tty); /* Detecting constant expressions. */ @@ -1826,7 +1826,7 @@ print_axs_value (struct ui_file *f, struct axs_value *value) static void -agent_command (char *exp, int from_tty) +agent_command (const char *exp, int from_tty) { struct cleanup *old_chain = 0; struct expression *expr; diff --git a/gdb/blockframe.c b/gdb/blockframe.c index fce25e469a7..54bf3e55c7d 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -285,7 +285,7 @@ find_pc_function (CORE_ADDR pc) static CORE_ADDR cache_pc_function_low = 0; static CORE_ADDR cache_pc_function_high = 0; -static char *cache_pc_function_name = 0; +static const char *cache_pc_function_name = 0; static struct sec *cache_pc_function_section = NULL; /* Clear cache, e.g. when symbol table is discarded. */ @@ -311,8 +311,9 @@ clear_pc_function_cache (void) returns 0. */ int -find_pc_sect_partial_function (CORE_ADDR pc, asection *section, char **name, - CORE_ADDR *address, CORE_ADDR *endaddr) +find_pc_sect_partial_function (CORE_ADDR pc, asection *section, + const char **name, CORE_ADDR *address, + CORE_ADDR *endaddr) { struct partial_symtab *pst; struct symbol *f; @@ -477,7 +478,7 @@ find_pc_sect_partial_function (CORE_ADDR pc, asection *section, char **name, /* Backward compatibility, no section argument. */ int -find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address, +find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr) { asection *section; diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 66b319e842b..c88eca54124 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -56,40 +56,41 @@ static void until_break_command_continuation (struct continuation_arg *arg); -static void catch_command_1 (char *, int, int); +static void catch_command_1 (const char *, int, int); -static void enable_delete_command (char *, int); +static void enable_delete_command (const char *, int); static void enable_delete_breakpoint (struct breakpoint *); -static void enable_once_command (char *, int); +static void enable_once_command (const char *, int); static void enable_once_breakpoint (struct breakpoint *); -static void disable_command (char *, int); +static void disable_command (const char *, int); -static void enable_command (char *, int); +static void enable_command (const char *, int); -static void map_breakpoint_numbers (char *, void (*)(struct breakpoint *)); +static void map_breakpoint_numbers (const char *, + void (*)(struct breakpoint *)); -static void ignore_command (char *, int); +static void ignore_command (const char *, int); static int breakpoint_re_set_one (void *); -static void clear_command (char *, int); +static void clear_command (const char *, int); -static void catch_command (char *, int); +static void catch_command (const char *, int); -static void watch_command (char *, int); +static void watch_command (const char *, int); static int can_use_hardware_watchpoint (struct value *); -extern void break_at_finish_command (char *, int); -extern void break_at_finish_at_depth_command (char *, int); +extern void break_at_finish_command (const char *, int); +extern void break_at_finish_at_depth_command (const char *, int); -extern void tbreak_at_finish_command (char *, int); +extern void tbreak_at_finish_command (const char *, int); -static void break_command_1 (char *, int, int); +static void break_command_1 (const char *, int, int); static void mention (struct breakpoint *); @@ -99,7 +100,7 @@ static void check_duplicates (struct breakpoint *); static void describe_other_breakpoints (CORE_ADDR, asection *); -static void breakpoints_info (char *, int); +static void breakpoints_info (const char *, int); static void breakpoint_1 (int, int); @@ -109,11 +110,11 @@ static int breakpoint_cond_eval (void *); static void cleanup_executing_breakpoints (void *); -static void commands_command (char *, int); +static void commands_command (const char *, int); -static void condition_command (char *, int); +static void condition_command (const char *, int); -static int get_number_trailer (char **, int); +static int get_number_trailer (const char **, int); void set_breakpoint_count (int); @@ -141,29 +142,29 @@ static int watchpoint_check (void *); static int cover_target_enable_exception_callback (void *); -static void maintenance_info_breakpoints (char *, int); +static void maintenance_info_breakpoints (const char *, int); -static void create_longjmp_breakpoint (char *); +static void create_longjmp_breakpoint (const char *); -static void create_overlay_event_breakpoint (char *); +static void create_overlay_event_breakpoint (const char *); static int hw_breakpoint_used_count (void); static int hw_watchpoint_used_count (enum bptype, int *); -static void hbreak_command (char *, int); +static void hbreak_command (const char *, int); -static void thbreak_command (char *, int); +static void thbreak_command (const char *, int); -static void watch_command_1 (char *, int, int); +static void watch_command_1 (const char *, int, int); -static void rwatch_command (char *, int); +static void rwatch_command (const char *, int); -static void awatch_command (char *, int); +static void awatch_command (const char *, int); static void do_enable_breakpoint (struct breakpoint *, enum bpdisp); -static void solib_load_unload_1 (char *hookname, +static void solib_load_unload_1 (const char *hookname, int tempflag, char *dll_pathname, char *cond_string, enum bptype bp_kind); @@ -172,37 +173,38 @@ static void create_fork_vfork_event_catchpoint (int tempflag, char *cond_string, enum bptype bp_kind); -static void break_at_finish_at_depth_command_1 (char *arg, +static void break_at_finish_at_depth_command_1 (const char *arg, int flag, int from_tty); -static void break_at_finish_command_1 (char *arg, int flag, int from_tty); +static void break_at_finish_command_1 (const char *arg, int flag, int from_tty); -static void stop_command (char *arg, int from_tty); +static void stop_command (const char *arg, int from_tty); -static void stopin_command (char *arg, int from_tty); +static void stopin_command (const char *arg, int from_tty); -static void stopat_command (char *arg, int from_tty); +static void stopat_command (const char *arg, int from_tty); -static char *ep_find_event_name_end (char *arg); +static const char *ep_find_event_name_end (const char *arg); -static char *ep_parse_optional_if_clause (char **arg); +static const char *ep_parse_optional_if_clause (const char **arg); -static char *ep_parse_optional_filename (char **arg); +static char *ep_parse_optional_filename (const char **arg); #if defined(CHILD_INSERT_EXEC_CATCHPOINT) static void catch_exec_command_1 (char *arg, int tempflag, int from_tty); #endif -static void create_exception_catchpoint (int tempflag, char *cond_string, +static void create_exception_catchpoint (int tempflag, const char *cond_string, enum exception_event_kind ex_event, struct symtab_and_line *sal); static void catch_exception_command_1 (enum exception_event_kind ex_event, - char *arg, int tempflag, int from_tty); + const char *arg, int tempflag, + int from_tty); -static void tcatch_command (char *arg, int from_tty); +static void tcatch_command (const char *arg, int from_tty); -static void ep_skip_leading_whitespace (char **s); +static void ep_skip_leading_whitespace (const char **s); /* Prototypes for exported functions. */ @@ -360,10 +362,10 @@ int default_breakpoint_line; TRAILER is a character which can be found after the number; most commonly this is `-'. If you don't want a trailer, use \0. */ static int -get_number_trailer (char **pp, int trailer) +get_number_trailer (const char **pp, int trailer) { int retval = 0; /* default */ - char *p = *pp; + const char *p = *pp; if (p == NULL) /* Empty line means refer to the last breakpoint. */ @@ -373,7 +375,7 @@ get_number_trailer (char **pp, int trailer) /* Make a copy of the name, so we can null-terminate it to pass to lookup_internalvar(). */ char *varname; - char *start = ++p; + const char *start = ++p; struct value *val; while (isalnum (*p) || *p == '_') @@ -424,7 +426,7 @@ get_number_trailer (char **pp, int trailer) /* Like get_number_trailer, but don't allow a trailer. */ int -get_number (char **pp) +get_number (const char **pp) { return get_number_trailer (pp, '\0'); } @@ -446,10 +448,10 @@ get_number (char **pp) */ int -get_number_or_range (char **pp) +get_number_or_range (const char **pp) { static int last_retval, end_value; - static char *end_ptr; + static const char *end_ptr; static int in_range = 0; if (**pp != '-') @@ -459,7 +461,7 @@ get_number_or_range (char **pp) last_retval = get_number_trailer (pp, '-'); if (**pp == '-') { - char **temp; + const char **temp; /* This is the start of a range (<number1> - <number2>). Skip the '-', parse and remember the second number, @@ -510,10 +512,10 @@ get_number_or_range (char **pp) /* condition N EXP -- set break condition of breakpoint N to EXP. */ static void -condition_command (char *arg, int from_tty) +condition_command (const char *arg, int from_tty) { register struct breakpoint *b; - char *p; + const char *p; register int bnum; if (arg == 0) @@ -562,10 +564,10 @@ condition_command (char *arg, int from_tty) /* ARGSUSED */ static void -commands_command (char *arg, int from_tty) +commands_command (const char *arg, int from_tty) { register struct breakpoint *b; - char *p; + const char *p; register int bnum; struct command_line *l; @@ -3198,7 +3200,7 @@ print_one_breakpoint (struct breakpoint *b, struct ep_type_description { enum bptype type; - char *description; + const char *description; }; static struct ep_type_description bptypes[] = { @@ -3229,7 +3231,7 @@ print_one_breakpoint (struct breakpoint *b, {bp_catch_throw, "catch throw"} }; - static char *bpdisps[] = + static const char *bpdisps[] = {"del", "dstp", "dis", "keep"}; static char bpenables[] = "nynny"; char wrap_indent[80]; @@ -3641,7 +3643,7 @@ breakpoint_1 (int bnum, int allflag) /* ARGSUSED */ static void -breakpoints_info (char *bnum_exp, int from_tty) +breakpoints_info (const char *bnum_exp, int from_tty) { int bnum = -1; @@ -3653,7 +3655,7 @@ breakpoints_info (char *bnum_exp, int from_tty) /* ARGSUSED */ static void -maintenance_info_breakpoints (char *bnum_exp, int from_tty) +maintenance_info_breakpoints (const char *bnum_exp, int from_tty) { int bnum = -1; @@ -3916,7 +3918,7 @@ create_internal_breakpoint (CORE_ADDR address, enum bptype type) static void -create_longjmp_breakpoint (char *func_name) +create_longjmp_breakpoint (const char *func_name) { struct breakpoint *b; struct minimal_symbol *m; @@ -3969,7 +3971,7 @@ disable_longjmp_breakpoint (void) } static void -create_overlay_event_breakpoint (char *func_name) +create_overlay_event_breakpoint (const char *func_name) { struct breakpoint *b; struct minimal_symbol *m; @@ -4121,15 +4123,15 @@ re_enable_breakpoints_in_shlibs (void) #endif static void -solib_load_unload_1 (char *hookname, int tempflag, char *dll_pathname, +solib_load_unload_1 (const char *hookname, int tempflag, char *dll_pathname, char *cond_string, enum bptype bp_kind) { struct breakpoint *b; struct symtabs_and_lines sals; struct cleanup *old_chain; struct cleanup *canonical_strings_chain = NULL; - char *addr_start = hookname; - char *addr_end = NULL; + const char *addr_start = hookname; + const char *addr_end = NULL; char **canonical = (char **) NULL; int thread = -1; /* All threads. */ @@ -4608,11 +4610,11 @@ create_breakpoints (struct symtabs_and_lines sals, char **addr_string, address strings. ARG points to the end of the SAL. */ void -parse_breakpoint_sals (char **address, +parse_breakpoint_sals (const char **address, struct symtabs_and_lines *sals, char ***addr_string) { - char *addr_start = *address; + const char *addr_start = *address; *addr_string = NULL; /* If no arg given, or if first arg is 'if ', use the default breakpoint. */ @@ -4676,7 +4678,7 @@ parse_breakpoint_sals (char **address, void breakpoint_sals_to_pc (struct symtabs_and_lines *sals, - char *address) + const char *address) { int i; for (i = 0; i < sals->nelts; i++) @@ -4712,7 +4714,7 @@ breakpoint_sals_to_pc (struct symtabs_and_lines *sals, second bit : 0 normal breakpoint, 1 hardware breakpoint. */ static void -break_command_1 (char *arg, int flag, int from_tty) +break_command_1 (const char *arg, int flag, int from_tty) { int tempflag, hardwareflag; struct symtabs_and_lines sals; @@ -4720,7 +4722,7 @@ break_command_1 (char *arg, int flag, int from_tty) /* Pointers in arg to the start, and one past the end, of the condition. */ char **cond_string = (char **) NULL; - char *addr_start = arg; + const char *addr_start = arg; char **addr_string; struct cleanup *old_chain; struct cleanup *breakpoint_chain = NULL; @@ -4781,13 +4783,13 @@ break_command_1 (char *arg, int flag, int from_tty) thread = -1; /* No specific thread yet */ for (i = 0; i < sals.nelts; i++) { - char *tok = arg; + const char *tok = arg; while (tok && *tok) { - char *end_tok; + const char *end_tok; int toklen; - char *cond_start = NULL; - char *cond_end = NULL; + const char *cond_start = NULL; + const char *cond_end = NULL; while (*tok == ' ' || *tok == '\t') tok++; @@ -4809,7 +4811,7 @@ break_command_1 (char *arg, int flag, int from_tty) } else if (toklen >= 1 && strncmp (tok, "thread", toklen) == 0) { - char *tmptok; + const char *tmptok; tok = end_tok + 1; tmptok = tok; @@ -4866,7 +4868,7 @@ do_captured_breakpoint (void *data) char **addr_string; char **cond_string; - char *address_end; + const char *address_end; /* Parse the source and lines spec. Delay check that the expression didn't contain trailing garbage until after cleanups are in @@ -4927,7 +4929,7 @@ do_captured_breakpoint (void *data) { if (args->condition != NULL) { - char *tok = args->condition; + const char *tok = args->condition; cond[i] = parse_exp_1 (&tok, block_for_pc (sals.sals[i].pc), 0); if (*tok != '\0') error ("Garbage %s follows condition", tok); @@ -4967,11 +4969,11 @@ gdb_breakpoint (char *address, char *condition, static void -break_at_finish_at_depth_command_1 (char *arg, int flag, int from_tty) +break_at_finish_at_depth_command_1 (const char *arg, int flag, int from_tty) { struct frame_info *frame; CORE_ADDR low, high, selected_pc = 0; - char *extra_args = NULL; + const char *extra_args = NULL; char *level_arg; char *addr_string; int extra_args_len = 0, if_arg = 0; @@ -5025,7 +5027,7 @@ break_at_finish_at_depth_command_1 (char *arg, int flag, int from_tty) if (selected_pc) { - if (find_pc_partial_function (selected_pc, (char **) NULL, &low, &high)) + if (find_pc_partial_function (selected_pc, NULL, &low, &high)) { addr_string = (char *) xmalloc (26 + extra_args_len); if (extra_args_len) @@ -5044,14 +5046,16 @@ break_at_finish_at_depth_command_1 (char *arg, int flag, int from_tty) static void -break_at_finish_command_1 (char *arg, int flag, int from_tty) +break_at_finish_command_1 (const char *arg, int flag, int from_tty) { - char *addr_string, *break_string, *beg_addr_string; + const char *addr_string; + char *break_string; + char *beg_addr_string; CORE_ADDR low, high; struct symtabs_and_lines sals; struct symtab_and_line sal; struct cleanup *old_chain; - char *extra_args = NULL; + const char *extra_args = NULL; int extra_args_len = 0; int i, if_arg = 0; @@ -5062,9 +5066,10 @@ break_at_finish_command_1 (char *arg, int flag, int from_tty) { if (deprecated_selected_frame) { - addr_string = (char *) xmalloc (15); - sprintf (addr_string, "*0x%s", - paddr_nz (get_frame_pc (deprecated_selected_frame))); + char *tmp; + xasprintf (&tmp, "*0x%s", + paddr_nz (get_frame_pc (deprecated_selected_frame))); + beg_addr_string = tmp; if (arg) if_arg = 1; } @@ -5076,8 +5081,7 @@ break_at_finish_command_1 (char *arg, int flag, int from_tty) } else { - addr_string = (char *) xmalloc (strlen (arg) + 1); - strcpy (addr_string, arg); + beg_addr_string = xstrdup (arg); } if (if_arg) @@ -5099,7 +5103,7 @@ break_at_finish_command_1 (char *arg, int flag, int from_tty) sals.sals = NULL; sals.nelts = 0; - beg_addr_string = addr_string; + addr_string = beg_addr_string; sals = decode_line_1 (&addr_string, 1, (struct symtab *) NULL, 0, (char ***) NULL); @@ -5108,7 +5112,7 @@ break_at_finish_command_1 (char *arg, int flag, int from_tty) for (i = 0; (i < sals.nelts); i++) { sal = sals.sals[i]; - if (find_pc_partial_function (sal.pc, (char **) NULL, &low, &high)) + if (find_pc_partial_function (sal.pc, NULL, &low, &high)) { break_string = (char *) xmalloc (extra_args_len + 26); if (extra_args_len) @@ -5180,49 +5184,49 @@ resolve_sal_pc (struct symtab_and_line *sal) } void -break_command (char *arg, int from_tty) +break_command (const char *arg, int from_tty) { break_command_1 (arg, 0, from_tty); } void -break_at_finish_command (char *arg, int from_tty) +break_at_finish_command (const char *arg, int from_tty) { break_at_finish_command_1 (arg, 0, from_tty); } void -break_at_finish_at_depth_command (char *arg, int from_tty) +break_at_finish_at_depth_command (const char *arg, int from_tty) { break_at_finish_at_depth_command_1 (arg, 0, from_tty); } void -tbreak_command (char *arg, int from_tty) +tbreak_command (const char *arg, int from_tty) { break_command_1 (arg, BP_TEMPFLAG, from_tty); } void -tbreak_at_finish_command (char *arg, int from_tty) +tbreak_at_finish_command (const char *arg, int from_tty) { break_at_finish_command_1 (arg, BP_TEMPFLAG, from_tty); } static void -hbreak_command (char *arg, int from_tty) +hbreak_command (const char *arg, int from_tty) { break_command_1 (arg, BP_HARDWAREFLAG, from_tty); } static void -thbreak_command (char *arg, int from_tty) +thbreak_command (const char *arg, int from_tty) { break_command_1 (arg, (BP_TEMPFLAG | BP_HARDWAREFLAG), from_tty); } static void -stop_command (char *arg, int from_tty) +stop_command (const char *arg, int from_tty) { printf_filtered ("Specify the type of breakpoint to set.\n\ Usage: stop in <function | address>\n\ @@ -5230,7 +5234,7 @@ Usage: stop in <function | address>\n\ } static void -stopin_command (char *arg, int from_tty) +stopin_command (const char *arg, int from_tty) { int badInput = 0; @@ -5238,7 +5242,7 @@ stopin_command (char *arg, int from_tty) badInput = 1; else if (*arg != '*') { - char *argptr = arg; + const char *argptr = arg; int hasColon = 0; /* look for a ':'. If this is a line number specification, then @@ -5263,7 +5267,7 @@ stopin_command (char *arg, int from_tty) } static void -stopat_command (char *arg, int from_tty) +stopat_command (const char *arg, int from_tty) { int badInput = 0; @@ -5271,7 +5275,7 @@ stopat_command (char *arg, int from_tty) badInput = 1; else { - char *argptr = arg; + const char *argptr = arg; int hasColon = 0; /* look for a ':'. If there is a '::' then get out, otherwise @@ -5299,7 +5303,7 @@ stopat_command (char *arg, int from_tty) hw_read: watch read, hw_access: watch access (read or write) */ static void -watch_command_1 (char *arg, int accessflag, int from_tty) +watch_command_1 (const char *arg, int accessflag, int from_tty) { struct breakpoint *b; struct symtab_and_line sal; @@ -5308,12 +5312,13 @@ watch_command_1 (char *arg, int accessflag, int from_tty) struct value *val, *mark; struct frame_info *frame; struct frame_info *prev_frame = NULL; - char *exp_start = NULL; - char *exp_end = NULL; - char *tok, *end_tok; + const char *exp_start = NULL; + const char *exp_end = NULL; + const char *tok; + const char *end_tok; int toklen; - char *cond_start = NULL; - char *cond_end = NULL; + const char *cond_start = NULL; + const char *cond_end = NULL; struct expression *cond = NULL; int i, other_type_used, target_resources_ok = 0; enum bptype bp_type; @@ -5551,7 +5556,7 @@ watch_command_wrapper (char *arg, int from_tty) } static void -watch_command (char *arg, int from_tty) +watch_command (const char *arg, int from_tty) { watch_command_1 (arg, hw_write, from_tty); } @@ -5563,7 +5568,7 @@ rwatch_command_wrapper (char *arg, int from_tty) } static void -rwatch_command (char *arg, int from_tty) +rwatch_command (const char *arg, int from_tty) { watch_command_1 (arg, hw_read, from_tty); } @@ -5575,7 +5580,7 @@ awatch_command_wrapper (char *arg, int from_tty) } static void -awatch_command (char *arg, int from_tty) +awatch_command (const char *arg, int from_tty) { watch_command_1 (arg, hw_access, from_tty); } @@ -5599,7 +5604,7 @@ until_break_command_continuation (struct continuation_arg *arg) /* ARGSUSED */ void -until_break_command (char *arg, int from_tty, int anywhere) +until_break_command (const char *arg, int from_tty, int anywhere) { struct symtabs_and_lines sals; struct symtab_and_line sal; @@ -5715,7 +5720,7 @@ enable_catch_breakpoint (void) #endif /* 0 */ static void -ep_skip_leading_whitespace (char **s) +ep_skip_leading_whitespace (const char **s) { if ((s == NULL) || (*s == NULL)) return; @@ -5728,11 +5733,11 @@ ep_skip_leading_whitespace (char **s) possible match is found, a pointer to the last character of the token is returned. Else, NULL is returned. */ -static char * -ep_find_event_name_end (char *arg) +static const char * +ep_find_event_name_end (const char *arg) { - char *s = arg; - char *event_name_end = NULL; + const char *s = arg; + const char *event_name_end = NULL; /* If we could depend upon the presense of strrpbrk, we'd use that... */ if (arg == NULL) @@ -5761,10 +5766,10 @@ ep_find_event_name_end (char *arg) it updates arg to point to the first character following the parsed if clause in the arg string. */ -static char * -ep_parse_optional_if_clause (char **arg) +static const char * +ep_parse_optional_if_clause (const char **arg) { - char *cond_string; + const char *cond_string; if (((*arg)[0] != 'i') || ((*arg)[1] != 'f') || !isspace ((*arg)[2])) return NULL; @@ -5794,10 +5799,10 @@ ep_parse_optional_if_clause (char **arg) Note that clients needing to preserve the returned filename for future access should copy it to their own buffers. */ static char * -ep_parse_optional_filename (char **arg) +ep_parse_optional_filename (const char **arg) { static char filename[1024]; - char *arg_p = *arg; + const char *arg_p = *arg; int i; char c; @@ -5893,10 +5898,10 @@ catch_exec_command_1 (char *arg, int tempflag, int from_tty) #if defined(SOLIB_ADD) static void -catch_load_command_1 (char *arg, int tempflag, int from_tty) +catch_load_command_1 (const char *arg, int tempflag, int from_tty) { char *dll_pathname = NULL; - char *cond_string = NULL; + const char *cond_string = NULL; ep_skip_leading_whitespace (&arg); @@ -5935,10 +5940,10 @@ catch_load_command_1 (char *arg, int tempflag, int from_tty) } static void -catch_unload_command_1 (char *arg, int tempflag, int from_tty) +catch_unload_command_1 (const char *arg, int tempflag, int from_tty) { char *dll_pathname = NULL; - char *cond_string = NULL; + const char *cond_string = NULL; ep_skip_leading_whitespace (&arg); @@ -5983,7 +5988,7 @@ catch_unload_command_1 (char *arg, int tempflag, int from_tty) exception event callback */ static void -create_exception_catchpoint (int tempflag, char *cond_string, +create_exception_catchpoint (int tempflag, const char *cond_string, enum exception_event_kind ex_event, struct symtab_and_line *sal) { @@ -6066,10 +6071,11 @@ static struct breakpoint_ops gnu_v3_exception_catchpoint_ops = { }; static int -handle_gnu_v3_exceptions (int tempflag, char *cond_string, +handle_gnu_v3_exceptions (int tempflag, const char *cond_string, enum exception_event_kind ex_event, int from_tty) { - char *trigger_func_name, *nameptr; + char *trigger_func_name; + const char *nameptr; struct symtabs_and_lines sals; struct breakpoint *b; @@ -6106,10 +6112,10 @@ handle_gnu_v3_exceptions (int tempflag, char *cond_string, /* Deal with "catch catch" and "catch throw" commands */ static void -catch_exception_command_1 (enum exception_event_kind ex_event, char *arg, - int tempflag, int from_tty) +catch_exception_command_1 (enum exception_event_kind ex_event, + const char *arg, int tempflag, int from_tty) { - char *cond_string = NULL; + const char *cond_string = NULL; struct symtab_and_line *sal = NULL; ep_skip_leading_whitespace (&arg); @@ -6160,7 +6166,7 @@ cover_target_enable_exception_callback (void *arg) } static void -catch_command_1 (char *arg, int tempflag, int from_tty) +catch_command_1 (const char *arg, int tempflag, int from_tty) { /* The first argument may be an event name, such as "start" or "load". @@ -6169,8 +6175,8 @@ catch_command_1 (char *arg, int tempflag, int from_tty) the v4.16-and-earlier GDB meaning of the "catch" command.) First, try to find the bounds of what might be an event name. */ - char *arg1_start = arg; - char *arg1_end; + const char *arg1_start = arg; + const char *arg1_end; int arg1_length; if (arg1_start == NULL) @@ -6319,14 +6325,14 @@ delete_catch (char *args) #endif /* 0 */ static void -catch_command (char *arg, int from_tty) +catch_command (const char *arg, int from_tty) { catch_command_1 (arg, 0, from_tty); } static void -tcatch_command (char *arg, int from_tty) +tcatch_command (const char *arg, int from_tty) { catch_command_1 (arg, 1, from_tty); } @@ -6334,7 +6340,7 @@ tcatch_command (char *arg, int from_tty) /* Delete breakpoints by address or line. */ static void -clear_command (char *arg, int from_tty) +clear_command (const char *arg, int from_tty) { struct breakpoint *b, *tmp, *prev, *found; int default_match; @@ -6671,7 +6677,7 @@ make_exec_cleanup_delete_breakpoint (struct breakpoint *b) } void -delete_command (char *arg, int from_tty) +delete_command (const char *arg, int from_tty) { struct breakpoint *b, *temp; @@ -6725,7 +6731,7 @@ breakpoint_re_set_one (void *bint) struct value *mark; int i; struct symtabs_and_lines sals; - char *s; + const char *s; enum enable_state save_enable; switch (b->type) @@ -7014,9 +7020,9 @@ breakpoint_clear_ignore_counts (void) /* Command to set ignore-count of breakpoint N to COUNT. */ static void -ignore_command (char *args, int from_tty) +ignore_command (const char *args, int from_tty) { - char *p = args; + const char *p = args; register int num; if (p == 0) @@ -7039,10 +7045,11 @@ ignore_command (char *args, int from_tty) whose numbers are given in ARGS. */ static void -map_breakpoint_numbers (char *args, void (*function) (struct breakpoint *)) +map_breakpoint_numbers (const char *args, + void (*function) (struct breakpoint *)) { - register char *p = args; - char *p1; + const char *p = args; + const char *p1; register int num; register struct breakpoint *b, *tmp; int match; @@ -7107,7 +7114,7 @@ disable_breakpoint (struct breakpoint *bpt) /* ARGSUSED */ static void -disable_command (char *args, int from_tty) +disable_command (const char *args, int from_tty) { register struct breakpoint *bpt; if (args == 0) @@ -7241,7 +7248,7 @@ enable_breakpoint (struct breakpoint *bpt) /* ARGSUSED */ static void -enable_command (char *args, int from_tty) +enable_command (const char *args, int from_tty) { register struct breakpoint *bpt; if (args == 0) @@ -7281,7 +7288,7 @@ enable_once_breakpoint (struct breakpoint *bpt) /* ARGSUSED */ static void -enable_once_command (char *args, int from_tty) +enable_once_command (const char *args, int from_tty) { map_breakpoint_numbers (args, enable_once_breakpoint); } @@ -7294,7 +7301,7 @@ enable_delete_breakpoint (struct breakpoint *bpt) /* ARGSUSED */ static void -enable_delete_command (char *args, int from_tty) +enable_delete_command (const char *args, int from_tty) { map_breakpoint_numbers (args, enable_delete_breakpoint); } @@ -7302,7 +7309,7 @@ enable_delete_command (char *args, int from_tty) /* Use default_breakpoint_'s, or nothing if they aren't valid. */ struct symtabs_and_lines -decode_line_spec_1 (char *string, int funfirstline) +decode_line_spec_1 (const char *string, int funfirstline) { struct symtabs_and_lines sals; if (string == 0) diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 86eec4ae310..c9c795386a6 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -556,7 +556,7 @@ extern int deprecated_frame_in_dummy (struct frame_info *); extern int breakpoint_thread_match (CORE_ADDR, ptid_t); -extern void until_break_command (char *, int, int); +extern void until_break_command (const char *, int, int); extern void breakpoint_re_set (void); @@ -585,15 +585,15 @@ extern void breakpoint_auto_delete (bpstat); extern void breakpoint_clear_ignore_counts (void); -extern void break_command (char *, int); +extern void break_command (const char *, int); extern void hbreak_command_wrapper (char *, int); extern void thbreak_command_wrapper (char *, int); -extern void rbreak_command_wrapper (char *, int); +extern void rbreak_command_wrapper (const char *, int); extern void watch_command_wrapper (char *, int); extern void awatch_command_wrapper (char *, int); extern void rwatch_command_wrapper (char *, int); -extern void tbreak_command (char *, int); +extern void tbreak_command (const char *, int); extern int insert_breakpoints (void); @@ -668,9 +668,9 @@ extern void enable_watchpoints_after_interactive_call_stop (void); extern void clear_breakpoint_hit_counts (void); -extern int get_number (char **); +extern int get_number (const char **); -extern int get_number_or_range (char **); +extern int get_number_or_range (const char **); /* The following are for displays, which aren't really breakpoints, but here is as good a place as any for them. */ @@ -724,7 +724,7 @@ extern struct breakpoint *set_breakpoint_sal (struct symtab_and_line); /* Enable breakpoints and delete when hit. Called with ARG == NULL deletes all breakpoints. */ -extern void delete_command (char *arg, int from_tty); +extern void delete_command (const char *arg, int from_tty); /* Pull all H/W watchpoints from the target. Return non-zero if the remove fails. */ diff --git a/gdb/c-exp.y b/gdb/c-exp.y index cd4e8d0ae8d..4983c036b53 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1543,7 +1543,7 @@ yylex () characters; for comparison expressions, e.g. "a < b > c", there must be spaces before the '<', etc. */ - char * p = find_template_name_end (tokstart + namelen); + const char *p = find_template_name_end (tokstart + namelen); if (p) namelen = p - tokstart; break; diff --git a/gdb/call-cmds.h b/gdb/call-cmds.h index 3d2cda103c8..e048d1a933f 100644 --- a/gdb/call-cmds.h +++ b/gdb/call-cmds.h @@ -28,8 +28,8 @@ extern void initialize_all_files (void); -extern void core_file_command (char *, int); +extern void core_file_command (const char *, int); -extern void break_command (char *, int); +extern void break_command (const char *, int); #endif diff --git a/gdb/charset.c b/gdb/charset.c index 0062e281e99..638fb3a5e6d 100644 --- a/gdb/charset.c +++ b/gdb/charset.c @@ -1046,7 +1046,8 @@ set_target_charset (const char *charset) /* This is the sfunc for the 'set charset' command. */ static void -set_charset_sfunc (char *charset, int from_tty, struct cmd_list_element *c) +set_charset_sfunc (const char *charset, int from_tty, + struct cmd_list_element *c) { struct charset *cs = lookup_charset_or_error (host_charset_name); check_valid_host_charset (cs); @@ -1058,7 +1059,7 @@ set_charset_sfunc (char *charset, int from_tty, struct cmd_list_element *c) /* 'set host-charset' command sfunc. We need a wrapper here because the function needs to have a specific signature. */ static void -set_host_charset_sfunc (char *charset, int from_tty, +set_host_charset_sfunc (const char *charset, int from_tty, struct cmd_list_element *c) { set_host_charset (host_charset_name); @@ -1066,15 +1067,15 @@ set_host_charset_sfunc (char *charset, int from_tty, /* Wrapper for the 'set target-charset' command. */ static void -set_target_charset_sfunc (char *charset, int from_tty, - struct cmd_list_element *c) +set_target_charset_sfunc (const char *charset, int from_tty, + struct cmd_list_element *c) { set_target_charset (target_charset_name); } /* sfunc for the 'show charset' command. */ static void -show_charset (char *arg, int from_tty) +show_charset (const char *arg, int from_tty) { if (current_host_charset == current_target_charset) { diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 108329a50c7..fc7cf037d96 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -62,37 +62,37 @@ extern void show_commands (char *, int); /* Prototypes for local command functions */ -static void complete_command (char *, int); +static void complete_command (const char *, int); -static void echo_command (char *, int); +static void echo_command (const char *, int); -static void pwd_command (char *, int); +static void pwd_command (const char *, int); static void show_version (char *, int); static void validate_comname (char *); -static void help_command (char *, int); +static void help_command (const char *, int); -static void show_command (char *, int); +static void show_command (const char *, int); -static void info_command (char *, int); +static void info_command (const char *, int); -static void show_debug (char *, int); +static void show_debug (const char *, int); -static void set_debug (char *, int); +static void set_debug (const char *, int); -static void show_user (char *, int); +static void show_user (const char *, int); -static void make_command (char *, int); +static void make_command (const char *, int); static void shell_escape (char *, int); -static void edit_command (char *, int); +static void edit_command (const char *, int); -static void list_command (char *, int); +static void list_command (const char *, int); -void apropos_command (char *, int); +void apropos_command (const char *, int); /* Prototypes for local utility functions */ @@ -187,7 +187,7 @@ struct cmd_list_element *showchecklist; none is supplied. */ void -error_no_arg (char *why) +error_no_arg (const char *why) { error ("Argument required (%s).", why); } @@ -197,7 +197,7 @@ error_no_arg (char *why) /* ARGSUSED */ static void -info_command (char *arg, int from_tty) +info_command (const char *arg, int from_tty) { printf_unfiltered ("\"info\" must be followed by the name of an info command.\n"); help_list (infolist, "info ", -1, gdb_stdout); @@ -207,7 +207,7 @@ info_command (char *arg, int from_tty) /* ARGSUSED */ static void -show_command (char *arg, int from_tty) +show_command (const char *arg, int from_tty) { cmd_show_list (showlist, from_tty, ""); } @@ -217,7 +217,7 @@ show_command (char *arg, int from_tty) /* ARGSUSED */ static void -help_command (char *command, int from_tty) +help_command (const char *command, int from_tty) { help_cmd (command, gdb_stdout); } @@ -235,7 +235,7 @@ compare_strings (const void *arg1, const void *arg2) /* ARGSUSED */ static void -complete_command (char *arg, int from_tty) +complete_command (const char *arg, int from_tty) { int i; int argpoint; @@ -299,7 +299,7 @@ show_version (char *args, int from_tty) /* Handle the quit command. */ void -quit_command (char *args, int from_tty) +quit_command (const char *args, int from_tty) { if (!quit_confirm ()) error ("Not confirmed."); @@ -308,7 +308,7 @@ quit_command (char *args, int from_tty) /* ARGSUSED */ static void -pwd_command (char *args, int from_tty) +pwd_command (const char *args, int from_tty) { if (args) error ("The \"pwd\" command does not take an argument: %s", args); @@ -322,7 +322,7 @@ pwd_command (char *args, int from_tty) } void -cd_command (char *dir, int from_tty) +cd_command (const char *dir, int from_tty) { int len; /* Found something other than leading repetitions of "/..". */ @@ -422,7 +422,7 @@ cd_command (char *dir, int from_tty) } void -source_command (char *args, int from_tty) +source_command (const char *args, int from_tty) { FILE *stream; struct cleanup *old_cleanups; @@ -452,7 +452,7 @@ source_command (char *args, int from_tty) /* ARGSUSED */ static void -echo_command (char *text, int from_tty) +echo_command (const char *text, int from_tty) { char *p = text; register int c; @@ -543,7 +543,7 @@ shell_escape (char *arg, int from_tty) } static void -edit_command (char *arg, int from_tty) +edit_command (const char *arg, int from_tty) { struct symtabs_and_lines sals; struct symtab_and_line sal; @@ -648,7 +648,7 @@ edit_command (char *arg, int from_tty) } static void -list_command (char *arg, int from_tty) +list_command (const char *arg, int from_tty) { struct symtabs_and_lines sals, sals_end; struct symtab_and_line sal, sal_end, cursal; @@ -832,10 +832,10 @@ list_command (char *arg, int from_tty) /* ARGSUSED */ static void -disassemble_command (char *arg, int from_tty) +disassemble_command (const char *arg, int from_tty) { CORE_ADDR low, high; - char *name; + const char *name; CORE_ADDR pc, pc_masked; char *space_index; #if 0 @@ -914,7 +914,7 @@ disassemble_command (char *arg, int from_tty) } static void -make_command (char *arg, int from_tty) +make_command (const char *arg, int from_tty) { char *p; @@ -958,7 +958,7 @@ show_user (char *args, int from_tty) regular expression. */ void -apropos_command (char *searchstr, int from_tty) +apropos_command (const char *searchstr, int from_tty) { extern struct cmd_list_element *cmdlist; /*This is the main command list*/ regex_t pattern; diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h index a6e574edd71..974565f0f5a 100644 --- a/gdb/cli/cli-cmds.h +++ b/gdb/cli/cli-cmds.h @@ -109,17 +109,17 @@ int is_complete_command (struct cmd_list_element *cmd); /* Exported to gdb/main.c */ -extern void cd_command (char *, int); +extern void cd_command (const char *, int); /* Exported to gdb/top.c and gdb/main.c */ -extern void quit_command (char *, int); +extern void quit_command (const char *, int); -extern void source_command (char *, int); +extern void source_command (const char *, int); /* Used everywhere whenever at least one parameter is required and none is specified. */ -extern NORETURN void error_no_arg (char *) ATTR_NORETURN; +extern NORETURN void error_no_arg (const char *) ATTR_NORETURN; #endif /* !defined (CLI_CMDS_H) */ diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 2a6d196930e..d2fd03bfcae 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -130,8 +130,9 @@ set_cmd_completer (struct cmd_list_element *cmd, of *LIST). */ struct cmd_list_element * -add_cmd (char *name, enum command_class class, void (*fun) (char *, int), - char *doc, struct cmd_list_element **list) +add_cmd (const char *name, enum command_class class, + void (*fun) (const char *, int), + const char *doc, struct cmd_list_element **list) { register struct cmd_list_element *c = (struct cmd_list_element *) xmalloc (sizeof (struct cmd_list_element)); @@ -187,7 +188,8 @@ add_cmd (char *name, enum command_class class, void (*fun) (char *, int), /* Note: Doesn't seem to be used anywhere currently. */ struct cmd_list_element * -add_abbrev_cmd (char *name, enum command_class class, void (*fun) (char *, int), +add_abbrev_cmd (char *name, enum command_class class, + void (*fun) (const char *, int), char *doc, struct cmd_list_element **list) { register struct cmd_list_element *c @@ -221,11 +223,11 @@ deprecate_cmd (struct cmd_list_element *cmd, char *replacement) } struct cmd_list_element * -add_alias_cmd (char *name, char *oldname, enum command_class class, +add_alias_cmd (const char *name, const char *oldname, enum command_class class, int abbrev_flag, struct cmd_list_element **list) { /* Must do this since lookup_cmd tries to side-effect its first arg */ - char *copied_name; + const char *copied_name; register struct cmd_list_element *old; register struct cmd_list_element *c; copied_name = (char *) alloca (strlen (oldname) + 1); @@ -256,9 +258,10 @@ add_alias_cmd (char *name, char *oldname, enum command_class class, of the variable containing that list. */ struct cmd_list_element * -add_prefix_cmd (char *name, enum command_class class, void (*fun) (char *, int), - char *doc, struct cmd_list_element **prefixlist, - char *prefixname, int allow_unknown, +add_prefix_cmd (const char *name, enum command_class class, + void (*fun) (const char *, int), + const char *doc, struct cmd_list_element **prefixlist, + const char *prefixname, int allow_unknown, struct cmd_list_element **list) { register struct cmd_list_element *c = add_cmd (name, class, fun, doc, list); @@ -307,12 +310,12 @@ empty_sfunc (char *args, int from_tty, struct cmd_list_element *c) DOC is the documentation string. */ static struct cmd_list_element * -add_set_or_show_cmd (char *name, +add_set_or_show_cmd (const char *name, enum cmd_types type, enum command_class class, var_types var_type, void *var, - char *doc, + const char *doc, struct cmd_list_element **list) { struct cmd_list_element *c = add_cmd (name, class, NULL, doc, list); @@ -383,11 +386,11 @@ add_setshow_cmd (char *name, } struct cmd_list_element * -add_set_cmd (char *name, +add_set_cmd (const char *name, enum command_class class, var_types var_type, void *var, - char *doc, + const char *doc, struct cmd_list_element **list) { return add_set_or_show_cmd (name, set_cmd, class, var_type, var, doc, list); @@ -402,11 +405,11 @@ add_set_cmd (char *name, DOC is the documentation string. */ struct cmd_list_element * -add_set_enum_cmd (char *name, +add_set_enum_cmd (const char *name, enum command_class class, const char *enumlist[], const char **var, - char *doc, + const char *doc, struct cmd_list_element **list) { struct cmd_list_element *c @@ -492,7 +495,7 @@ add_show_from_set (struct cmd_list_element *setcmd, /* Remove the command named NAME from the command list. */ void -delete_cmd (char *name, struct cmd_list_element **list) +delete_cmd (const char *name, struct cmd_list_element **list) { register struct cmd_list_element *c; struct cmd_list_element *p; @@ -532,7 +535,7 @@ delete_cmd (char *name, struct cmd_list_element **list) /* Add an element to the list of info subcommands. */ struct cmd_list_element * -add_info (char *name, void (*fun) (char *, int), char *doc) +add_info (const char *name, void (*fun) (char *, int), const char *doc) { return add_cmd (name, no_class, fun, doc, &infolist); } @@ -540,7 +543,7 @@ add_info (char *name, void (*fun) (char *, int), char *doc) /* Add an alias to the list of info subcommands. */ struct cmd_list_element * -add_info_alias (char *name, char *oldname, int abbrev_flag) +add_info_alias (const char *name, const char *oldname, int abbrev_flag) { return add_alias_cmd (name, oldname, 0, abbrev_flag, &infolist); } @@ -548,8 +551,8 @@ add_info_alias (char *name, char *oldname, int abbrev_flag) /* Add an element to the list of commands. */ struct cmd_list_element * -add_com (char *name, enum command_class class, void (*fun) (char *, int), - char *doc) +add_com (const char *name, enum command_class class, void (*fun) (char *, int), + const char *doc) { return add_cmd (name, class, fun, doc, &cmdlist); } @@ -557,7 +560,7 @@ add_com (char *name, enum command_class class, void (*fun) (char *, int), /* Add an alias or abbreviation command to the list of commands. */ struct cmd_list_element * -add_com_alias (char *name, char *oldname, enum command_class class, +add_com_alias (const char *name, const char *oldname, enum command_class class, int abbrev_flag) { return add_alias_cmd (name, oldname, class, abbrev_flag, &cmdlist); @@ -569,7 +572,7 @@ add_com_alias (char *name, char *oldname, enum command_class class, */ void apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist, - struct re_pattern_buffer *regex, char *prefix) + struct re_pattern_buffer *regex, const char *prefix) { register struct cmd_list_element *c; int returnvalue=1; /*Needed to avoid double printing*/ @@ -705,7 +708,7 @@ help_cmd (char *command, struct ui_file *stream) * If you call this routine with a class >= 0, it recurses. */ void -help_list (struct cmd_list_element *list, char *cmdtype, +help_list (struct cmd_list_element *list, const char *cmdtype, enum command_class class, struct ui_file *stream) { int len; @@ -776,11 +779,11 @@ help_all (struct ui_file *stream) /* Print only the first line of STR on STREAM. */ void -print_doc_line (struct ui_file *stream, char *str) +print_doc_line (struct ui_file *stream, const char *str) { static char *line_buffer = 0; static int line_size; - register char *p; + const char *p; if (!line_buffer) { @@ -822,7 +825,7 @@ print_doc_line (struct ui_file *stream, char *str) */ void help_cmd_list (struct cmd_list_element *list, enum command_class class, - char *prefix, int recurse, struct ui_file *stream) + const char *prefix, int recurse, struct ui_file *stream) { register struct cmd_list_element *c; @@ -1046,7 +1049,7 @@ lookup_cmd_1 (char **text, struct cmd_list_element *clist, /* All this hair to move the space to the front of cmdtype */ static void -undef_cmd_error (char *cmdtype, char *q) +undef_cmd_error (const char *cmdtype, char *q) { error ("Undefined %scommand: \"%s\". Try \"help%s%.*s\".", cmdtype, @@ -1109,7 +1112,7 @@ lookup_cmd (char **line, struct cmd_list_element *list, char *cmdtype, values. */ int local_allow_unknown = (last_list ? last_list->allow_unknown : allow_unknown); - char *local_cmdtype = last_list ? last_list->prefixname : cmdtype; + const char *local_cmdtype = last_list ? last_list->prefixname : cmdtype; struct cmd_list_element *local_list = (last_list ? *(last_list->prefixlist) : list); diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h index d8ab67d49f0..a80298ef0bb 100644 --- a/gdb/cli/cli-decode.h +++ b/gdb/cli/cli-decode.h @@ -56,7 +56,7 @@ struct cmd_list_element struct cmd_list_element *next; /* Name of this command. */ - char *name; + const char *name; /* Command class; class values are chosen by application program. */ enum command_class class; @@ -86,7 +86,7 @@ struct cmd_list_element First line is brief documentation; remaining lines form, with it, the full documentation. First line should end with a period. Entire string should also end with a period, not a newline. */ - char *doc; + const char *doc; /* flags : a bitfield @@ -136,7 +136,7 @@ struct cmd_list_element plus any others needed to get to it. Should end in a space. It is used before the word "command" in describing the commands reached through this prefix. */ - char *prefixname; + const char *prefixname; /* For prefix commands only: nonzero means do not get an error if subcommand is not @@ -195,24 +195,27 @@ struct cmd_list_element /* API to the manipulation of command lists. */ -extern struct cmd_list_element *add_cmd (char *, enum command_class, - void (*fun) (char *, int), char *, +extern struct cmd_list_element *add_cmd (const char *, enum command_class, + void (*fun) (const char *, int), + const char *, struct cmd_list_element **); -extern struct cmd_list_element *add_alias_cmd (char *, char *, +extern struct cmd_list_element *add_alias_cmd (const char *, const char *, enum command_class, int, struct cmd_list_element **); -extern struct cmd_list_element *add_prefix_cmd (char *, enum command_class, - void (*fun) (char *, int), - char *, +extern struct cmd_list_element *add_prefix_cmd (const char *, + enum command_class, + void (*fun) (const char *, + int), + const char *, struct cmd_list_element **, - char *, int, + const char *, int, struct cmd_list_element **); extern struct cmd_list_element *add_abbrev_prefix_cmd (char *, enum command_class, - void (*fun) (char *, + void (*fun) (const char *, int), char *, struct cmd_list_element @@ -223,10 +226,10 @@ extern struct cmd_list_element *add_abbrev_prefix_cmd (char *, /* Set the commands corresponding callback. */ extern void set_cmd_cfunc (struct cmd_list_element *cmd, - void (*cfunc) (char *args, int from_tty)); + void (*cfunc) (const char *args, int from_tty)); extern void set_cmd_sfunc (struct cmd_list_element *cmd, - void (*sfunc) (char *args, int from_tty, + void (*sfunc) (const char *args, int from_tty, struct cmd_list_element * c)); extern void set_cmd_completer (struct cmd_list_element *cmd, @@ -235,13 +238,12 @@ extern void set_cmd_completer (struct cmd_list_element *cmd, /* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs around in cmd objects to test the value of the commands sfunc(). */ extern int cmd_cfunc_eq (struct cmd_list_element *cmd, - void (*cfunc) (char *args, int from_tty)); - + void (*cfunc) (const char *args, int from_tty)); /* Access to the command's local context. */ extern void set_cmd_context (struct cmd_list_element *cmd, void *context); extern void *get_cmd_context (struct cmd_list_element *cmd); -extern struct cmd_list_element *lookup_cmd (char **, +extern struct cmd_list_element *lookup_cmd (const char **, struct cmd_list_element *, char *, int, int); @@ -253,46 +255,47 @@ extern struct cmd_list_element *lookup_cmd_1 (char **, extern struct cmd_list_element * deprecate_cmd (struct cmd_list_element *, char * ); -extern void - deprecated_cmd_warning (char **); +extern void deprecated_cmd_warning (const char **); -extern int - lookup_cmd_composition (char *text, - struct cmd_list_element **alias, - struct cmd_list_element **prefix_cmd, - struct cmd_list_element **cmd); +extern int lookup_cmd_composition (const char *text, + struct cmd_list_element **alias, + struct cmd_list_element **prefix_cmd, + struct cmd_list_element **cmd); -extern struct cmd_list_element *add_com (char *, enum command_class, - void (*fun) (char *, int), char *); +extern struct cmd_list_element *add_com (const char *, enum command_class, + void (*fun) (const char *, int), + const char *); -extern struct cmd_list_element *add_com_alias (char *, char *, +extern struct cmd_list_element *add_com_alias (const char *, const char *, enum command_class, int); -extern struct cmd_list_element *add_info (char *, void (*fun) (char *, int), - char *); +extern struct cmd_list_element *add_info (const char *, + void (*fun) (const char *, int), + const char *); -extern struct cmd_list_element *add_info_alias (char *, char *, int); +extern struct cmd_list_element *add_info_alias (const char *, const char *, + int); extern char **complete_on_cmdlist (struct cmd_list_element *, char *, char *); extern char **complete_on_enum (const char *enumlist[], char *, char *); -extern void delete_cmd (char *, struct cmd_list_element **); +extern void delete_cmd (const char *, struct cmd_list_element **); extern void help_cmd_list (struct cmd_list_element *, enum command_class, - char *, int, struct ui_file *); + const char *, int, struct ui_file *); -extern struct cmd_list_element *add_set_cmd (char *name, enum +extern struct cmd_list_element *add_set_cmd (const char *name, enum command_class class, var_types var_type, void *var, - char *doc, + const char *doc, struct cmd_list_element **list); -extern struct cmd_list_element *add_set_enum_cmd (char *name, +extern struct cmd_list_element *add_set_enum_cmd (const char *name, enum command_class class, const char *enumlist[], const char **var, - char *doc, + const char *doc, struct cmd_list_element **list); extern struct cmd_list_element *add_show_from_set (struct cmd_list_element *, @@ -313,11 +316,11 @@ extern void apropos_cmd (struct ui_file *, struct cmd_list_element *, function field NULL, the command is interpreted as a help topic, or as a class of commands. */ -extern void not_just_help_class_command (char *arg, int from_tty); +extern void not_just_help_class_command (const char *arg, int from_tty); /* Exported to cli/cli-setshow.c */ -extern void print_doc_line (struct ui_file *, char *); +extern void print_doc_line (struct ui_file *, const char *); #endif /* !defined (CLI_DECODE_H) */ diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 6bd40e033b1..367a7e6cba0 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -82,8 +82,8 @@ make_cleanup_fclose (FILE *file) return make_cleanup (do_fclose_cleanup, file); } -char * -scan_filename_with_cleanup (char **cmd, const char *defname) +const char * +scan_filename_with_cleanup (const char **cmd, const char *defname) { char *filename; char *fullname; @@ -178,14 +178,14 @@ struct cmd_list_element *binary_dump_cmdlist; struct cmd_list_element *binary_append_cmdlist; static void -dump_command (char *cmd, int from_tty) +dump_command (const char *cmd, int from_tty) { printf_unfiltered ("\"dump\" must be followed by a subcommand.\n\n"); help_list (dump_cmdlist, "dump ", -1, gdb_stdout); } static void -append_command (char *cmd, int from_tty) +append_command (const char *cmd, int from_tty) { printf_unfiltered ("\"append\" must be followed by a subcommand.\n\n"); help_list (dump_cmdlist, "append ", -1, gdb_stdout); @@ -223,7 +223,7 @@ dump_bfd_file (char *filename, char *mode, } static void -dump_memory_to_file (char *cmd, char *mode, char *file_format) +dump_memory_to_file (const char *cmd, char *mode, char *file_format) { struct cleanup *old_cleanups = make_cleanup (null_cleanup, NULL); CORE_ADDR lo; @@ -274,13 +274,13 @@ dump_memory_to_file (char *cmd, char *mode, char *file_format) } static void -dump_memory_command (char *cmd, char *mode) +dump_memory_command (const char *cmd, char *mode) { dump_memory_to_file (cmd, mode, "binary"); } static void -dump_value_to_file (char *cmd, char *mode, char *file_format) +dump_value_to_file (const char *cmd, char *mode, char *file_format) { struct cleanup *old_cleanups = make_cleanup (null_cleanup, NULL); struct value *val; @@ -325,7 +325,7 @@ dump_value_to_file (char *cmd, char *mode, char *file_format) } static void -dump_value_command (char *cmd, char *mode) +dump_value_command (const char *cmd, char *mode) { dump_value_to_file (cmd, mode, "binary"); } @@ -422,19 +422,20 @@ append_binary_value (char *args, int from_tty) struct dump_context { - void (*func) (char *cmd, char *mode); + void (*func) (const char *cmd, char *mode); char *mode; }; static void -call_dump_func (struct cmd_list_element *c, char *args, int from_tty) +call_dump_func (struct cmd_list_element *c, const char *args, int from_tty) { struct dump_context *d = get_cmd_context (c); d->func (args, d->mode); } void -add_dump_command (char *name, void (*func) (char *args, char *mode), +add_dump_command (const char *name, + void (*func) (const char *args, char *mode), char *descr) { @@ -596,7 +597,7 @@ restore_binary_file (char *filename, struct callback_data *data) } static void -restore_command (char *args, int from_tty) +restore_command (const char *args, int from_tty) { char *filename; struct callback_data data; @@ -664,35 +665,35 @@ restore_command (char *args, int from_tty) } static void -srec_dump_command (char *cmd, int from_tty) +srec_dump_command (const char *cmd, int from_tty) { printf_unfiltered ("\"dump srec\" must be followed by a subcommand.\n"); help_list (srec_cmdlist, "dump srec ", -1, gdb_stdout); } static void -ihex_dump_command (char *cmd, int from_tty) +ihex_dump_command (const char *cmd, int from_tty) { printf_unfiltered ("\"dump ihex\" must be followed by a subcommand.\n"); help_list (ihex_cmdlist, "dump ihex ", -1, gdb_stdout); } static void -tekhex_dump_command (char *cmd, int from_tty) +tekhex_dump_command (const char *cmd, int from_tty) { printf_unfiltered ("\"dump tekhex\" must be followed by a subcommand.\n"); help_list (tekhex_cmdlist, "dump tekhex ", -1, gdb_stdout); } static void -binary_dump_command (char *cmd, int from_tty) +binary_dump_command (const char *cmd, int from_tty) { printf_unfiltered ("\"dump binary\" must be followed by a subcommand.\n"); help_list (binary_dump_cmdlist, "dump binary ", -1, gdb_stdout); } static void -binary_append_command (char *cmd, int from_tty) +binary_append_command (const char *cmd, int from_tty) { printf_unfiltered ("\"append binary\" must be followed by a subcommand.\n"); help_list (binary_append_cmdlist, "append binary ", -1, gdb_stdout); diff --git a/gdb/cli/cli-dump.h b/gdb/cli/cli-dump.h index 187e0e0a12e..afeee3215c3 100644 --- a/gdb/cli/cli-dump.h +++ b/gdb/cli/cli-dump.h @@ -23,11 +23,12 @@ #define CLI_DUMP_H extern void add_dump_command (char *name, - void (*func) (char *args, char *mode), + void (*func) (const char *args, char *mode), char *descr); /* Utilities for doing the dump. */ -extern char *scan_filename_with_cleanup (char **cmd, const char *defname); +extern const char *scan_filename_with_cleanup (const char **cmd, + const char *defname); extern char *scan_expression_with_cleanup (char **cmd, const char *defname); diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index d68c365959d..3911497ba51 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -52,7 +52,7 @@ static char *insert_args (char *line); static struct cleanup * setup_user_args (char *p); -static void validate_comname (char *); +static void validate_comname (const char *); /* Level of control structure. */ static int control_level; @@ -80,7 +80,7 @@ struct user_args control commands (if/while). */ static struct command_line * -build_command_line (enum command_control_type type, char *args) +build_command_line (enum command_control_type type, const char *args) { struct command_line *cmd; @@ -446,7 +446,7 @@ execute_control_command (struct command_line *cmd) loop condition is nonzero. */ void -while_command (char *arg, int from_tty) +while_command (const char *arg, int from_tty) { struct command_line *command = NULL; @@ -464,7 +464,7 @@ while_command (char *arg, int from_tty) on the value of the if conditional. */ void -if_command (char *arg, int from_tty) +if_command (const char *arg, int from_tty) { struct command_line *command = NULL; @@ -1044,9 +1044,9 @@ copy_command_lines (struct command_line *cmds) } static void -validate_comname (char *comname) +validate_comname (const char *comname) { - register char *p; + const char *p; if (comname == 0) error_no_arg ("name of command to define"); @@ -1062,12 +1062,12 @@ validate_comname (char *comname) /* This is just a placeholder in the command data structures. */ static void -user_defined_command (char *ignore, int from_tty) +user_defined_command (const char *ignore, int from_tty) { } void -define_command (char *comname, int from_tty) +define_command (const char *comname, int from_tty) { #define MAX_TMPBUF 128 enum cmd_hook_type @@ -1178,11 +1178,11 @@ define_command (char *comname, int from_tty) } void -document_command (char *comname, int from_tty) +document_command (const char *comname, int from_tty) { struct command_line *doclines; register struct cmd_list_element *c; - char *tem = comname; + const char *tem = comname; char tmpbuf[128]; validate_comname (comname); @@ -1223,8 +1223,8 @@ struct source_cleanup_lines_args { int old_line; char *old_file; - char *old_pre_error; - char *old_error_pre_print; + const char *old_pre_error; + const char *old_error_pre_print; }; static void diff --git a/gdb/cli/cli-script.h b/gdb/cli/cli-script.h index 03cb84137e5..8f1c441ef1c 100644 --- a/gdb/cli/cli-script.h +++ b/gdb/cli/cli-script.h @@ -27,7 +27,7 @@ struct cmd_list_element; extern void script_from_file (FILE *stream, char *file); -extern void document_command (char *, int); +extern void document_command (const char *, int); extern void define_command (char *, int); diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index 1d68ae4aa1a..4403021053e 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -351,7 +351,7 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) /* Show all the settings in a list of show commands. */ void -cmd_show_list (struct cmd_list_element *list, int from_tty, char *prefix) +cmd_show_list (struct cmd_list_element *list, int from_tty, const char *prefix) { struct cleanup *showlist_chain; diff --git a/gdb/cli/cli-setshow.h b/gdb/cli/cli-setshow.h index 470b8b754c6..f94924691eb 100644 --- a/gdb/cli/cli-setshow.h +++ b/gdb/cli/cli-setshow.h @@ -33,6 +33,6 @@ extern void do_setshow_command (char *arg, int from_tty, /* Exported to cli/cli-cmds.c and gdb/top.c, language.c and valprint.c */ extern void cmd_show_list (struct cmd_list_element *list, int from_tty, - char *prefix); + const char *prefix); #endif /* !defined (CLI_SETSHOW_H) */ diff --git a/gdb/command.h b/gdb/command.h index 96c99abcaba..2a780a440a3 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -97,24 +97,27 @@ struct cmd_list_element; /* Forward-declarations of the entry-points of cli/cli-decode.c. */ -extern struct cmd_list_element *add_cmd (char *, enum command_class, - void (*fun) (char *, int), char *, +extern struct cmd_list_element *add_cmd (const char *, enum command_class, + void (*fun) (const char *, int), + const char *, struct cmd_list_element **); -extern struct cmd_list_element *add_alias_cmd (char *, char *, +extern struct cmd_list_element *add_alias_cmd (const char *, const char *, enum command_class, int, struct cmd_list_element **); -extern struct cmd_list_element *add_prefix_cmd (char *, enum command_class, - void (*fun) (char *, int), - char *, +extern struct cmd_list_element *add_prefix_cmd (const char *, + enum command_class, + void (*fun) (const char *, + int), + const char *, struct cmd_list_element **, - char *, int, + const char *, int, struct cmd_list_element **); extern struct cmd_list_element *add_abbrev_prefix_cmd (char *, enum command_class, - void (*fun) (char *, + void (*fun) (const char *, int), char *, struct cmd_list_element @@ -124,11 +127,11 @@ extern struct cmd_list_element *add_abbrev_prefix_cmd (char *, /* Set the commands corresponding callback. */ -typedef void cmd_cfunc_ftype (char *args, int from_tty); +typedef void cmd_cfunc_ftype (const char *args, int from_tty); extern void set_cmd_cfunc (struct cmd_list_element *cmd, cmd_cfunc_ftype *cfunc); -typedef void cmd_sfunc_ftype (char *args, int from_tty, +typedef void cmd_sfunc_ftype (const char *args, int from_tty, struct cmd_list_element *c); extern void set_cmd_sfunc (struct cmd_list_element *cmd, cmd_sfunc_ftype *sfunc); @@ -139,7 +142,7 @@ extern void set_cmd_completer (struct cmd_list_element *cmd, /* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs around in cmd objects to test the value of the commands sfunc(). */ extern int cmd_cfunc_eq (struct cmd_list_element *cmd, - void (*cfunc) (char *args, int from_tty)); + void (*cfunc) (const char *args, int from_tty)); /* Each command object has a local context attached to it. . */ extern void set_cmd_context (struct cmd_list_element *cmd, void *context); @@ -164,7 +167,7 @@ extern void execute_cmd_post_hook (struct cmd_list_element *cmd); extern enum cmd_types cmd_type (struct cmd_list_element *cmd); -extern struct cmd_list_element *lookup_cmd (char **, +extern struct cmd_list_element *lookup_cmd (const char **, struct cmd_list_element *, char *, int, int); @@ -176,31 +179,32 @@ extern struct cmd_list_element *lookup_cmd_1 (char **, extern struct cmd_list_element * deprecate_cmd (struct cmd_list_element *, char * ); -extern void - deprecated_cmd_warning (char **); +extern void deprecated_cmd_warning (const char **); -extern int - lookup_cmd_composition (char *text, - struct cmd_list_element **alias, - struct cmd_list_element **prefix_cmd, - struct cmd_list_element **cmd); +extern int lookup_cmd_composition (const char *text, + struct cmd_list_element **alias, + struct cmd_list_element **prefix_cmd, + struct cmd_list_element **cmd); -extern struct cmd_list_element *add_com (char *, enum command_class, - void (*fun) (char *, int), char *); +extern struct cmd_list_element *add_com (const char *, enum command_class, + void (*fun) (const char *, int), + const char *); -extern struct cmd_list_element *add_com_alias (char *, char *, +extern struct cmd_list_element *add_com_alias (const char *, const char *, enum command_class, int); -extern struct cmd_list_element *add_info (char *, void (*fun) (char *, int), - char *); +extern struct cmd_list_element *add_info (const char *, + void (*fun) (const char *, int), + const char *); -extern struct cmd_list_element *add_info_alias (char *, char *, int); +extern struct cmd_list_element *add_info_alias (const char *, const char *, + int); extern char **complete_on_cmdlist (struct cmd_list_element *, char *, char *); extern char **complete_on_enum (const char *enumlist[], char *, char *); -extern void delete_cmd (char *, struct cmd_list_element **); +extern void delete_cmd (const char *, struct cmd_list_element **); extern void help_cmd (char *, struct ui_file *); @@ -208,7 +212,7 @@ extern void help_list (struct cmd_list_element *, char *, enum command_class, struct ui_file *); extern void help_cmd_list (struct cmd_list_element *, enum command_class, - char *, int, struct ui_file *); + const char *, int, struct ui_file *); extern void add_setshow_cmd (char *name, enum command_class class, @@ -230,17 +234,17 @@ extern void add_setshow_cmd_full (char *name, struct cmd_list_element **set_result, struct cmd_list_element **show_result); -extern struct cmd_list_element *add_set_cmd (char *name, enum +extern struct cmd_list_element *add_set_cmd (const char *name, enum command_class class, var_types var_type, void *var, - char *doc, + const char *doc, struct cmd_list_element **list); -extern struct cmd_list_element *add_set_enum_cmd (char *name, +extern struct cmd_list_element *add_set_enum_cmd (const char *name, enum command_class class, const char *enumlist[], const char **var, - char *doc, + const char *doc, struct cmd_list_element **list); extern void add_setshow_auto_boolean_cmd (char *name, @@ -268,9 +272,9 @@ extern struct cmd_list_element *add_show_from_set (struct cmd_list_element *, /* Do a "show" command for each thing on a command list. */ -extern void cmd_show_list (struct cmd_list_element *, int, char *); +extern void cmd_show_list (struct cmd_list_element *, int, const char *); -extern NORETURN void error_no_arg (char *) ATTR_NORETURN; +extern NORETURN void error_no_arg (const char *) ATTR_NORETURN; extern void dont_repeat (void); @@ -278,7 +282,7 @@ extern void dont_repeat (void); function field NULL, the command is interpreted as a help topic, or as a class of commands. */ -extern void not_just_help_class_command (char *, int); +extern void not_just_help_class_command (const char *, int); /* check function pointer */ extern int cmd_func_p (struct cmd_list_element *cmd); diff --git a/gdb/completer.c b/gdb/completer.c index 4274241b00e..a9f6e31a048 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -686,11 +686,11 @@ line_completion_function (const char *text, int matches, char *line_buffer, int either QUOTECHARS or BREAKCHARS is NULL, use the same values used by the completer. */ -char * -skip_quoted_chars (char *str, char *quotechars, char *breakchars) +const char * +skip_quoted_chars (const char *str, char *quotechars, char *breakchars) { char quote_char = '\0'; - char *scan; + const char *scan; if (quotechars == NULL) quotechars = gdb_completer_quote_characters; @@ -728,8 +728,8 @@ skip_quoted_chars (char *str, char *quotechars, char *breakchars) characters and word break characters used by the completer). Returns pointer to the location after the "word". */ -char * -skip_quoted (char *str) +const char * +skip_quoted (const char *str) { return skip_quoted_chars (str, NULL, NULL); } diff --git a/gdb/completer.h b/gdb/completer.h index 7a96951aae3..b0cb488f911 100644 --- a/gdb/completer.h +++ b/gdb/completer.h @@ -37,8 +37,8 @@ extern char *get_gdb_completer_quote_characters (void); /* Exported to linespec.c */ -extern char *skip_quoted_chars (char *, char *, char *); +extern const char *skip_quoted_chars (const char *, char *, char *); -extern char *skip_quoted (char *); +extern const char *skip_quoted (const char *); #endif /* defined (COMPLETER_H) */ diff --git a/gdb/config/rs6000/tm-rs6000.h b/gdb/config/rs6000/tm-rs6000.h index c73658922bd..f377353ad5a 100644 --- a/gdb/config/rs6000/tm-rs6000.h +++ b/gdb/config/rs6000/tm-rs6000.h @@ -34,7 +34,7 @@ struct frame_info; #define IN_SOLIB_RETURN_TRAMPOLINE(pc, name) \ rs6000_in_solib_return_trampoline (pc, name) -extern int rs6000_in_solib_return_trampoline (CORE_ADDR, char *); +extern int rs6000_in_solib_return_trampoline (CORE_ADDR, const char *); /* If PC is in some function-call trampoline code, return the PC where the function itself actually starts. If not, return NULL. */ diff --git a/gdb/copying.c b/gdb/copying.c index a78a862b97d..9514e8660e3 100644 --- a/gdb/copying.c +++ b/gdb/copying.c @@ -5,15 +5,15 @@ #include "command.h" #include "gdbcmd.h" -static void show_copying_command (char *, int); +static void show_copying_command (const char *, int); -static void show_warranty_command (char *, int); +static void show_warranty_command (const char *, int); void _initialize_copying (void); extern int immediate_quit; static void -show_copying_command (char *ignore, int from_tty) +show_copying_command (const char *ignore, int from_tty) { immediate_quit++; printf_filtered (" GNU GENERAL PUBLIC LICENSE\n"); @@ -277,7 +277,7 @@ show_copying_command (char *ignore, int from_tty) } static void -show_warranty_command (char *ignore, int from_tty) +show_warranty_command (const char *ignore, int from_tty) { immediate_quit++; printf_filtered (" NO WARRANTY\n"); diff --git a/gdb/corefile.c b/gdb/corefile.c index 094a3eff0c1..8a45dcbb7d8 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -39,7 +39,7 @@ /* Local function declarations. */ extern void _initialize_core (void); -static void call_extra_exec_file_hooks (char *filename); +static void call_extra_exec_file_hooks (const char *filename); /* You can have any number of hooks for `exec_file_command' command to call. If there's only one hook, it is set in exec_file_display hook. @@ -49,7 +49,7 @@ static void call_extra_exec_file_hooks (char *filename); old code that assumed that only one hook could be set, and which called exec_file_display_hook directly. */ -typedef void (*hook_type) (char *); +typedef void (*hook_type) (const char *); hook_type exec_file_display_hook; /* the original hook */ static hook_type *exec_file_extra_hooks; /* array of additional hooks */ @@ -63,7 +63,7 @@ bfd *core_bfd = NULL; /* Backward compatability with old way of specifying core files. */ void -core_file_command (char *filename, int from_tty) +core_file_command (const char *filename, int from_tty) { struct target_ops *t; @@ -84,7 +84,7 @@ core_file_command (char *filename, int from_tty) * this function will call all of the hook functions. */ static void -call_extra_exec_file_hooks (char *filename) +call_extra_exec_file_hooks (const char *filename) { int i; @@ -96,7 +96,7 @@ call_extra_exec_file_hooks (char *filename) This is called from the x-window display code. */ void -specify_exec_file_hook (void (*hook) (char *)) +specify_exec_file_hook (void (*hook) (const char *)) { hook_type *new_array; @@ -412,10 +412,9 @@ char *gnutarget; /* Same thing, except it is "auto" not NULL for the default case. */ static char *gnutarget_string; -static void set_gnutarget_command (char *, int, struct cmd_list_element *); - static void -set_gnutarget_command (char *ignore, int from_tty, struct cmd_list_element *c) +set_gnutarget_command (const char *ignore, int from_tty, + struct cmd_list_element *c) { if (strcmp (gnutarget_string, "auto") == 0) gnutarget = NULL; diff --git a/gdb/corelow.c b/gdb/corelow.c index 016140fdac6..114b9ea83d4 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -65,9 +65,9 @@ static struct core_fns *sniff_core_bfd (bfd *); static int gdb_check_format (bfd *); -static void core_open (char *, int); +static void core_open (const char *, int); -static void core_detach (char *, int); +static void core_detach (const char *, int); static void core_close (int); @@ -256,7 +256,7 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg) /* This routine opens and sets up the core file bfd. */ static void -core_open (char *filename, int from_tty) +core_open (const char *filename, int from_tty) { const char *p; int siggy; @@ -377,7 +377,7 @@ your %s; do ``info files''", target_longname); } static void -core_detach (char *args, int from_tty) +core_detach (const char *args, int from_tty) { if (args) error ("Too many arguments"); diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c index 3aa9966433f..79cce91a55b 100644 --- a/gdb/cp-abi.c +++ b/gdb/cp-abi.c @@ -209,7 +209,7 @@ list_cp_abis (int from_tty) argument is given. */ static void -set_cp_abi_cmd (char *args, int from_tty) +set_cp_abi_cmd (const char *args, int from_tty) { if (args == NULL) { @@ -224,7 +224,7 @@ set_cp_abi_cmd (char *args, int from_tty) /* Show the currently selected C++ ABI. */ static void -show_cp_abi_cmd (char *args, int from_tty) +show_cp_abi_cmd (const char *args, int from_tty) { ui_out_text (uiout, "The currently selected C++ ABI is \""); diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 14456f8938f..482ef67620b 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -34,8 +34,8 @@ static struct cmd_list_element *maint_cplus_cmd_list = NULL; /* The actual commands. */ -static void maint_cplus_command (char *arg, int from_tty); -static void first_component_command (char *arg, int from_tty); +static void maint_cplus_command (const char *arg, int from_tty); +static void first_component_command (const char *arg, int from_tty); /* Here are some random pieces of trivia to keep in mind while trying to take apart demangled names: @@ -327,7 +327,7 @@ cp_entire_prefix_len (const char *name) /* Don't allow just "maintenance cplus". */ static void -maint_cplus_command (char *arg, int from_tty) +maint_cplus_command (const char *arg, int from_tty) { printf_unfiltered ("\"maintenance cplus\" must be followed by the name of a command.\n"); help_list (maint_cplus_cmd_list, "maintenance cplus ", -1, gdb_stdout); @@ -338,7 +338,7 @@ maint_cplus_command (char *arg, int from_tty) cp_find_first_component. */ static void -first_component_command (char *arg, int from_tty) +first_component_command (const char *arg, int from_tty) { int len = cp_find_first_component (arg); char *prefix = alloca (len + 1); diff --git a/gdb/dcache.c b/gdb/dcache.c index 6e742746363..3c3e71a3ced 100644 --- a/gdb/dcache.c +++ b/gdb/dcache.c @@ -175,7 +175,7 @@ static struct dcache_block *dcache_alloc (DCACHE *dcache, CORE_ADDR addr); static int dcache_writeback (DCACHE *dcache); -static void dcache_info (char *exp, int tty); +static void dcache_info (const char *exp, int tty); void _initialize_dcache (void); @@ -553,7 +553,7 @@ dcache_xfer_memory (DCACHE *dcache, CORE_ADDR memaddr, char *myaddr, int len, } static void -dcache_info (char *exp, int tty) +dcache_info (const char *exp, int tty) { struct dcache_block *p; diff --git a/gdb/defs.h b/gdb/defs.h index d4427830639..edb279492b9 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -399,7 +399,7 @@ extern int annotation_level; /* in stack.c */ extern void begin_line (void); -extern void wrap_here (char *); +extern void wrap_here (const char *); extern void reinitialize_more_filter (void); @@ -501,7 +501,7 @@ extern const char *core_addr_to_string (const CORE_ADDR addr); extern const char *core_addr_to_string_nz (const CORE_ADDR addr); extern CORE_ADDR string_to_core_addr (const char *my_string); -extern void fprintf_symbol_filtered (struct ui_file *, char *, +extern void fprintf_symbol_filtered (struct ui_file *, const char *, enum language, int); extern NORETURN void perror_with_name (const char *) ATTR_NORETURN; @@ -516,10 +516,10 @@ extern char *re_comp (const char *); /* From symfile.c */ -extern void symbol_file_command (char *, int); +extern void symbol_file_command (const char *, int); /* Remote targets may wish to use this as their load function. */ -extern void generic_load (char *name, int from_tty); +extern void generic_load (const char *name, int from_tty); /* Summarise a download */ extern void print_transfer_performance (struct ui_file *stream, @@ -531,7 +531,7 @@ extern void print_transfer_performance (struct ui_file *stream, typedef void initialize_file_ftype (void); -extern char *skip_quoted (char *); +extern const char *skip_quoted (const char *); extern char *gdb_readline (char *); @@ -550,7 +550,7 @@ extern int info_verbose; extern void set_next_address (CORE_ADDR); extern void print_address_symbolic (CORE_ADDR, struct ui_file *, int, - char *); + const char *); extern int build_address_symbolic (CORE_ADDR addr, int do_demangle, @@ -570,11 +570,11 @@ extern int openp (const char *, int, const char *, int, int, char **); extern int source_full_path_of (char *, char **); -extern void mod_path (char *, char **); +extern void mod_path (const char *, char **); -extern void add_path (char *, char **, int); +extern void add_path (const char *, char **, int); -extern void directory_command (char *, int); +extern void directory_command (const char *, int); extern char *source_path; @@ -865,15 +865,15 @@ extern int parse_escape (char **); /* Message to be printed before the error message, when an error occurs. */ -extern char *error_pre_print; +extern const char *error_pre_print; /* Message to be printed before the error message, when an error occurs. */ -extern char *quit_pre_print; +extern const char *quit_pre_print; /* Message to be printed before the warning message, when a warning occurs. */ -extern char *warning_pre_print; +extern const char *warning_pre_print; extern NORETURN void verror (const char *fmt, va_list ap) ATTR_NORETURN; @@ -958,7 +958,7 @@ struct ui_out; typedef int (catch_exceptions_ftype) (struct ui_out *ui_out, void *args); extern int catch_exceptions (struct ui_out *uiout, catch_exceptions_ftype *func, void *func_args, - char *errstring, return_mask mask); + const char *errstring, return_mask mask); /* If CATCH_ERRORS_FTYPE throws an error, catch_errors() returns zero otherwize the result from CATCH_ERRORS_FTYPE is returned. It is @@ -970,13 +970,16 @@ extern int catch_exceptions (struct ui_out *uiout, This function is superseeded 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); /* Template to catch_errors() that wraps calls to command functions. */ -typedef void (catch_command_errors_ftype) (char *, int); -extern int catch_command_errors (catch_command_errors_ftype *func, char *command, int from_tty, return_mask); +typedef void (catch_command_errors_ftype) (const char *, int); +extern int catch_command_errors (catch_command_errors_ftype *func, + const char *command, int from_tty, + return_mask); extern void warning (const char *, ...) ATTR_FORMAT (printf, 1, 2); @@ -1134,8 +1137,6 @@ extern void store_signed_integer (void *, int, LONGEST); extern void store_unsigned_integer (void *, int, ULONGEST); -extern void store_address (void *, int, LONGEST); - extern void store_typed_address (void *buf, struct type *type, CORE_ADDR addr); @@ -1174,7 +1175,7 @@ extern void (*show_load_progress) (const char *section, extern void (*print_frame_info_listing_hook) (struct symtab * s, int line, int stopline, int noerror); -extern struct frame_info *parse_frame_specification (char *frame_exp); +extern struct frame_info *parse_frame_specification (const char *frame_exp); extern int (*query_hook) (const char *, va_list); extern void (*warning_hook) (const char *, va_list); extern void (*flush_hook) (struct ui_file * stream); diff --git a/gdb/demangle.c b/gdb/demangle.c index bcf9b77de51..0e5dcb80c29 100644 --- a/gdb/demangle.c +++ b/gdb/demangle.c @@ -57,8 +57,6 @@ static char *current_demangling_style_string; static const char **demangling_style_names; -static void set_demangling_command (char *, int, struct cmd_list_element *); - /* Set current demangling style. Called by the "set demangle-style" command after it has updated the current_demangling_style_string to match what the user has entered. @@ -76,7 +74,8 @@ static void set_demangling_command (char *, int, struct cmd_list_element *); a malloc'd string, even if it is a null-string. */ static void -set_demangling_command (char *ignore, int from_tty, struct cmd_list_element *c) +set_demangling_command (const char *ignore, int from_tty, + struct cmd_list_element *c) { const struct demangler_engine *dem; @@ -149,7 +148,7 @@ set_demangling_style (char *style) xfree (current_demangling_style_string); } current_demangling_style_string = savestring (style, strlen (style)); - set_demangling_command ((char *) NULL, 0, (struct cmd_list_element *) NULL); + set_demangling_command (NULL, 0, (struct cmd_list_element *) NULL); } /* G++ uses a special character to indicate certain internal names. Which diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index e5258378b61..aae6faf67bf 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2003-05-08 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Delete + reference to "store_address". + 2003-05-08 Jim Blandy <jimb@redhat.com> * gdb.texinfo (Dump/Restore Files): Update documentation for diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 28cdc82242a..42b9de4d80c 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -2617,19 +2617,6 @@ appropriate way for the current architecture. If you can, use @code{extract_typed_address} instead. @end deftypefun -@deftypefun void store_address (void *@var{addr}, int @var{len}, LONGEST @var{val}) -Store @var{val} at @var{addr} as a @var{len}-byte integer, in the -appropriate endianness for the current architecture. Note that -@var{addr} refers to a buffer in @value{GDBN}'s memory, not the -inferior's. - -This function should only be used in architecture-specific code; it -doesn't have enough information to turn a true address into bits in the -appropriate way for the current architecture. If you can, use -@code{store_typed_address} instead. -@end deftypefun - - Here are some macros which architectures can define to indicate the relationship between pointers and addresses. These have default definitions, appropriate for architectures on which all pointers are diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index e16056c4412..2f622628477 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -443,7 +443,7 @@ fprint_dummy_frames (struct ui_file *file) } static void -maintenance_print_dummy_frames (char *args, int from_tty) +maintenance_print_dummy_frames (const char *args, int from_tty) { if (args == NULL) fprint_dummy_frames (gdb_stdout); diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index a0a2f9beaaa..635933789cf 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -5319,8 +5319,10 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym, (sym))); SYMBOL_VALUE_BYTES (sym) = (char *) obstack_alloc (&objfile->symbol_obstack, cu_header->addr_size); - store_address (SYMBOL_VALUE_BYTES (sym), cu_header->addr_size, - DW_ADDR (attr)); + /* NOTE: cagney/2003-05-09: In-lined store_address call with + it's body - store_unsigned_integer. */ + store_unsigned_integer (SYMBOL_VALUE_BYTES (sym), cu_header->addr_size, + DW_ADDR (attr)); SYMBOL_CLASS (sym) = LOC_CONST_BYTES; break; case DW_FORM_block1: diff --git a/gdb/environ.c b/gdb/environ.c index 1f9a9d67e9f..576cd4af0aa 100644 --- a/gdb/environ.c +++ b/gdb/environ.c @@ -161,7 +161,7 @@ set_in_environ (struct environ *e, const char *var, const char *value) /* Remove the setting for variable VAR from environment E. */ void -unset_in_environ (struct environ *e, char *var) +unset_in_environ (struct environ *e, const char *var) { register int len = strlen (var); register char **vector = e->vector; diff --git a/gdb/environ.h b/gdb/environ.h index 1aa13944518..4485b04a52b 100644 --- a/gdb/environ.h +++ b/gdb/environ.h @@ -44,7 +44,7 @@ extern char *get_in_environ (const struct environ *, const char *); extern void set_in_environ (struct environ *, const char *, const char *); -extern void unset_in_environ (struct environ *, char *); +extern void unset_in_environ (struct environ *, const char *); extern char **environ_vector (struct environ *); diff --git a/gdb/eval.c b/gdb/eval.c index c266cd1e33e..44005ac489e 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -77,7 +77,7 @@ evaluate_subexp (struct type *expect_type, register struct expression *exp, and return the result as a number. */ CORE_ADDR -parse_and_eval_address (char *exp) +parse_and_eval_address (const char *exp) { struct expression *expr = parse_expression (exp); register CORE_ADDR addr; @@ -93,7 +93,7 @@ parse_and_eval_address (char *exp) and advanced that variable across the characters parsed. */ CORE_ADDR -parse_and_eval_address_1 (char **expptr) +parse_and_eval_address_1 (const char **expptr) { struct expression *expr = parse_exp_1 (expptr, (struct block *) 0, 0); register CORE_ADDR addr; @@ -108,7 +108,7 @@ parse_and_eval_address_1 (char **expptr) /* Like parse_and_eval_address, but treats the value of the expression as an integer, not an address, returns a LONGEST, not a CORE_ADDR */ LONGEST -parse_and_eval_long (char *exp) +parse_and_eval_long (const char *exp) { struct expression *expr = parse_expression (exp); register LONGEST retval; @@ -121,7 +121,7 @@ parse_and_eval_long (char *exp) } struct value * -parse_and_eval (char *exp) +parse_and_eval (const char *exp) { struct expression *expr = parse_expression (exp); struct value *val; @@ -138,7 +138,7 @@ parse_and_eval (char *exp) EXPP is advanced to point to the comma. */ struct value * -parse_to_comma_and_eval (char **expp) +parse_to_comma_and_eval (const char **expp) { struct expression *expr = parse_exp_1 (expp, (struct block *) 0, 1); struct value *val; diff --git a/gdb/event-top.c b/gdb/event-top.c index ceef7b9c9eb..8e928d97ede 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -1090,7 +1090,8 @@ handle_sigwinch (int sig) /* Called by do_setshow_command. */ /* ARGSUSED */ void -set_async_editing_command (char *args, int from_tty, struct cmd_list_element *c) +set_async_editing_command (const char *args, int from_tty, + struct cmd_list_element *c) { change_line_handler (); } @@ -1098,7 +1099,8 @@ set_async_editing_command (char *args, int from_tty, struct cmd_list_element *c) /* Called by do_setshow_command. */ /* ARGSUSED */ void -set_async_annotation_level (char *args, int from_tty, struct cmd_list_element *c) +set_async_annotation_level (const char *args, int from_tty, + struct cmd_list_element *c) { change_annotation_level (); } @@ -1106,7 +1108,7 @@ set_async_annotation_level (char *args, int from_tty, struct cmd_list_element *c /* Called by do_setshow_command. */ /* ARGSUSED */ void -set_async_prompt (char *args, int from_tty, struct cmd_list_element *c) +set_async_prompt (const char *args, int from_tty, struct cmd_list_element *c) { PROMPT (0) = savestring (new_async_prompt, strlen (new_async_prompt)); } diff --git a/gdb/event-top.h b/gdb/event-top.h index 7e48a6ca190..2609badbd04 100644 --- a/gdb/event-top.h +++ b/gdb/event-top.h @@ -81,11 +81,11 @@ extern void display_gdb_prompt (char *new_prompt); void gdb_setup_readline (void); void gdb_disable_readline (void); extern void async_init_signals (void); -extern void set_async_editing_command (char *args, int from_tty, +extern void set_async_editing_command (const char *args, int from_tty, struct cmd_list_element *c); -extern void set_async_annotation_level (char *args, int from_tty, +extern void set_async_annotation_level (const char *args, int from_tty, struct cmd_list_element *c); -extern void set_async_prompt (char *args, int from_tty, +extern void set_async_prompt (const char *args, int from_tty, struct cmd_list_element *c); /* Signal to catch ^Z typed while reading a command: SIGTSTP or SIGCONT. */ diff --git a/gdb/exec.c b/gdb/exec.c index 0bde096c7c2..4620ad61201 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -51,7 +51,7 @@ struct vmap *map_vmap (bfd *, bfd *); -void (*file_changed_hook) (char *); +void (*file_changed_hook) (const char *); /* Prototypes for local functions */ @@ -59,9 +59,9 @@ static void add_to_section_table (bfd *, sec_ptr, void *); static void exec_close (int); -static void file_command (char *, int); +static void file_command (const char *, int); -static void set_section_command (char *, int); +static void set_section_command (const char *, int); static void exec_files_info (struct target_ops *); @@ -95,7 +95,7 @@ CORE_ADDR text_end = 0; struct vmap *vmap; void -exec_open (char *args, int from_tty) +exec_open (const char *args, int from_tty) { target_preopen (from_tty); exec_file_attach (args, from_tty); @@ -187,7 +187,7 @@ exec_file_clear (int from_tty) ARGS is assumed to be the filename. */ void -exec_file_attach (char *filename, int from_tty) +exec_file_attach (const char *filename, int from_tty) { /* Remove any previous exec file. */ unpush_target (&exec_ops); @@ -312,7 +312,7 @@ exec_file_attach (char *filename, int from_tty) If ARGS is NULL, we just want to close the exec file. */ static void -exec_file_command (char *args, int from_tty) +exec_file_command (const char *args, int from_tty) { char **argv; char *filename; @@ -349,7 +349,7 @@ exec_file_command (char *args, int from_tty) command was added? */ static void -file_command (char *arg, int from_tty) +file_command (const char *arg, int from_tty) { /* FIXME, if we lose on reading the symbol file, we should revert the exec file, but that's rough. */ @@ -645,10 +645,10 @@ exec_set_section_offsets (bfd_signed_vma text_off, bfd_signed_vma data_off, } static void -set_section_command (char *args, int from_tty) +set_section_command (const char *args, int from_tty) { struct section_table *p; - char *secname; + const char *secname; unsigned seclen; unsigned long secaddr; char secprint[100]; diff --git a/gdb/expression.h b/gdb/expression.h index da95fcbcf62..2e6b16223f3 100644 --- a/gdb/expression.h +++ b/gdb/expression.h @@ -356,9 +356,9 @@ struct expression /* From parse.c */ -extern struct expression *parse_expression (char *); +extern struct expression *parse_expression (const char *); -extern struct expression *parse_exp_1 (char **, struct block *, int); +extern struct expression *parse_exp_1 (const char **, struct block *, int); /* The innermost context required by the stack and register variables we've encountered so far. To use this, set it to NULL, then call diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 2a4eac3f119..5c13e2e17d1 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -787,7 +787,7 @@ find_first_common_named (char *name) that belongs to function funcname */ SAVED_F77_COMMON_PTR -find_common_for_function (char *name, char *funcname) +find_common_for_function (const char *name, char *funcname) { SAVED_F77_COMMON_PTR tmp; diff --git a/gdb/f-lang.h b/gdb/f-lang.h index d929b919fc0..3e60773c471 100644 --- a/gdb/f-lang.h +++ b/gdb/f-lang.h @@ -61,7 +61,7 @@ extern SAVED_F77_COMMON_PTR head_common_list; /* Ptr to 1st saved COMMON */ extern SAVED_F77_COMMON_PTR tail_common_list; /* Ptr to last saved COMMON */ extern SAVED_F77_COMMON_PTR current_common; /* Ptr to current COMMON */ -extern SAVED_F77_COMMON_PTR find_common_for_function (char *, char *); +extern SAVED_F77_COMMON_PTR find_common_for_function (const char *, char *); #define UNINITIALIZED_SECNUM -1 #define COMMON_NEEDS_PATCHING(blk) ((blk)->secnum == UNINITIALIZED_SECNUM) diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index f67a260d24c..f6edcb6ea95 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -40,7 +40,7 @@ static int there_is_a_visible_common_named (char *); #endif extern void _initialize_f_valprint (void); -static void info_common_command (char *, int); +static void info_common_command (const char *, int); static void list_all_visible_commons (char *); static void f77_print_array (struct type *, char *, CORE_ADDR, struct ui_file *, int, int, int, @@ -575,7 +575,7 @@ list_all_visible_commons (char *funname) given name */ static void -info_common_command (char *comname, int from_tty) +info_common_command (const char *comname, int from_tty) { SAVED_F77_COMMON_PTR the_common; COMMON_ENTRY_PTR entry; diff --git a/gdb/findvar.c b/gdb/findvar.c index ca371d21e03..c9623bf2c4d 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -252,24 +252,6 @@ store_unsigned_integer (void *addr, int len, ULONGEST val) } } -/* Store the address VAL as a LEN-byte value in target byte order at - ADDR. ADDR is a buffer in the GDB process, not in the inferior. - - This function should only be used by target-specific code. It - assumes that a pointer has the same representation as that thing's - address represented as an integer. Some machines use word - addresses, or similarly munged things, for certain types of - pointers, so that assumption doesn't hold everywhere. - - Common code should use store_typed_address instead, or something else - based on ADDRESS_TO_POINTER. */ -void -store_address (void *addr, int len, LONGEST val) -{ - store_unsigned_integer (addr, len, val); -} - - /* Store the address ADDR as a pointer of type TYPE at BUF, in target form. */ void @@ -365,7 +347,7 @@ signed_pointer_to_address (struct type *type, const void *buf) void unsigned_address_to_pointer (struct type *type, void *buf, CORE_ADDR addr) { - store_address (buf, TYPE_LENGTH (type), addr); + store_unsigned_integer (buf, TYPE_LENGTH (type), addr); } void diff --git a/gdb/frame.c b/gdb/frame.c index a664b97999b..868e80ad4ea 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -983,8 +983,10 @@ legacy_saved_regs_prev_register (struct frame_info *next_frame, *addrp = 0; *realnump = -1; if (bufferp != NULL) - store_address (bufferp, REGISTER_RAW_SIZE (regnum), - get_frame_saved_regs (frame)[regnum]); + /* NOTE: cagney/2003-05-09: In-lined store_address with + it's body - store_unsigned_integer. */ + store_unsigned_integer (bufferp, REGISTER_RAW_SIZE (regnum), + get_frame_saved_regs (frame)[regnum]); } else { @@ -1125,8 +1127,11 @@ deprecated_generic_get_saved_register (char *raw_buffer, int *optimized, if (regnum == SP_REGNUM) { if (raw_buffer) /* SP register treated specially */ - store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), - get_frame_saved_regs (frame)[regnum]); + /* NOTE: cagney/2003-05-09: In-line store_address + with it's body - store_unsigned_integer. */ + store_unsigned_integer (raw_buffer, + REGISTER_RAW_SIZE (regnum), + get_frame_saved_regs (frame)[regnum]); } else { @@ -1166,7 +1171,7 @@ frame_type_from_pc (CORE_ADDR pc) return DUMMY_FRAME; else { - char *name; + const char *name; find_pc_partial_function (pc, &name, NULL, NULL); if (PC_IN_SIGTRAMP (pc, name)) return SIGTRAMP_FRAME; @@ -1674,7 +1679,7 @@ legacy_get_prev_frame (struct frame_info *this_frame) be set and then the entire initialization can be skipped. Unforunatly, its the INIT code that sets the PC (Hmm, catch 22). */ - char *name; + const char *name; find_pc_partial_function (get_frame_pc (prev), &name, NULL, NULL); if (PC_IN_SIGTRAMP (get_frame_pc (prev), name)) prev->type = SIGTRAMP_FRAME; diff --git a/gdb/frame.h b/gdb/frame.h index a8f05f35f8b..3ae0e326024 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -495,13 +495,13 @@ extern int frame_register_read (struct frame_info *frame, int regnum, void *buf); /* From stack.c. */ -extern void args_info (char *, int); +extern void args_info (const char *, int); -extern void locals_info (char *, int); +extern void locals_info (const char *, int); extern void (*selected_frame_level_changed_hook) (int); -extern void return_command (char *, int); +extern void return_command (const char *, int); /* NOTE: cagney/2002-11-27: diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index ce02b7fc6a8..4d8f3fe3cbf 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -843,7 +843,7 @@ frv_push_arguments (int nargs, struct value **args, CORE_ADDR sp, if (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION) { - store_address (valbuf, 4, VALUE_ADDRESS (arg)); + store_unsigned_integer (valbuf, 4, VALUE_ADDRESS (arg)); typecode = TYPE_CODE_PTR; len = 4; val = valbuf; diff --git a/gdb/gdb.h b/gdb/gdb.h index 6a2eaa0ca12..689ff4b98df 100644 --- a/gdb/gdb.h +++ b/gdb/gdb.h @@ -54,7 +54,7 @@ enum gdb_rc gdb_breakpoint (char *address, char *condition, int thread, int ignore_count); /* Switch thread and print notification. */ -enum gdb_rc gdb_thread_select (struct ui_out *uiout, char *tidstr); +enum gdb_rc gdb_thread_select (struct ui_out *uiout, const char *tidstr); /* Print a list of known thread ids. */ enum gdb_rc gdb_list_thread_ids (struct ui_out *uiout); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index db9e76e9671..9c9a2f06e8c 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -5332,7 +5332,7 @@ set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, } int -gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name) +gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name) { gdb_assert (gdbarch != NULL); if (gdbarch->in_solib_call_trampoline == 0) @@ -5351,7 +5351,7 @@ set_gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, } int -gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name) +gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name) { gdb_assert (gdbarch != NULL); if (gdbarch->in_solib_return_trampoline == 0) @@ -5370,7 +5370,8 @@ set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, } int -gdbarch_pc_in_sigtramp (struct gdbarch *gdbarch, CORE_ADDR pc, char *name) +gdbarch_pc_in_sigtramp (struct gdbarch *gdbarch, CORE_ADDR pc, + const char *name) { gdb_assert (gdbarch != NULL); if (gdbarch->pc_in_sigtramp == 0) diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 1a8e386e1a0..d569290dc2d 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -2845,8 +2845,8 @@ extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_s #define IN_SOLIB_CALL_TRAMPOLINE(pc, name) (generic_in_solib_call_trampoline (pc, name)) #endif -typedef int (gdbarch_in_solib_call_trampoline_ftype) (CORE_ADDR pc, char *name); -extern int gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name); +typedef int (gdbarch_in_solib_call_trampoline_ftype) (CORE_ADDR pc, const char *name); +extern int gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name); extern void set_gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, gdbarch_in_solib_call_trampoline_ftype *in_solib_call_trampoline); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (IN_SOLIB_CALL_TRAMPOLINE) #error "Non multi-arch definition of IN_SOLIB_CALL_TRAMPOLINE" @@ -2864,8 +2864,8 @@ extern void set_gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, gdbar #define IN_SOLIB_RETURN_TRAMPOLINE(pc, name) (generic_in_solib_return_trampoline (pc, name)) #endif -typedef int (gdbarch_in_solib_return_trampoline_ftype) (CORE_ADDR pc, char *name); -extern int gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name); +typedef int (gdbarch_in_solib_return_trampoline_ftype) (CORE_ADDR pc, const char *name); +extern int gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name); extern void set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (IN_SOLIB_RETURN_TRAMPOLINE) #error "Non multi-arch definition of IN_SOLIB_RETURN_TRAMPOLINE" @@ -2902,8 +2902,8 @@ extern void set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, gdb #define PC_IN_SIGTRAMP(pc, name) (legacy_pc_in_sigtramp (pc, name)) #endif -typedef int (gdbarch_pc_in_sigtramp_ftype) (CORE_ADDR pc, char *name); -extern int gdbarch_pc_in_sigtramp (struct gdbarch *gdbarch, CORE_ADDR pc, char *name); +typedef int (gdbarch_pc_in_sigtramp_ftype) (CORE_ADDR pc, const char *name); +extern int gdbarch_pc_in_sigtramp (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name); extern void set_gdbarch_pc_in_sigtramp (struct gdbarch *gdbarch, gdbarch_pc_in_sigtramp_ftype *pc_in_sigtramp); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PC_IN_SIGTRAMP) #error "Non multi-arch definition of PC_IN_SIGTRAMP" diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 16165a9858a..632edfecfbe 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -658,10 +658,10 @@ f:2:SKIP_TRAMPOLINE_CODE:CORE_ADDR:skip_trampoline_code:CORE_ADDR pc:pc:::generi # For SVR4 shared libraries, each call goes through a small piece of # trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates # to nonzero if we are currently stopped in one of these. -f:2:IN_SOLIB_CALL_TRAMPOLINE:int:in_solib_call_trampoline:CORE_ADDR pc, char *name:pc, name:::generic_in_solib_call_trampoline::0 +f:2:IN_SOLIB_CALL_TRAMPOLINE:int:in_solib_call_trampoline:CORE_ADDR pc, const char *name:pc, name:::generic_in_solib_call_trampoline::0 # Some systems also have trampoline code for returning from shared libs. -f:2:IN_SOLIB_RETURN_TRAMPOLINE:int:in_solib_return_trampoline:CORE_ADDR pc, char *name:pc, name:::generic_in_solib_return_trampoline::0 +f:2:IN_SOLIB_RETURN_TRAMPOLINE:int:in_solib_return_trampoline:CORE_ADDR pc, char *const name:pc, name:::generic_in_solib_return_trampoline::0 # Sigtramp is a routine that the kernel calls (which then calls the # signal handler). On most machines it is a library routine that is @@ -683,7 +683,7 @@ f:2:IN_SOLIB_RETURN_TRAMPOLINE:int:in_solib_return_trampoline:CORE_ADDR pc, char # FIXME: cagney/2002-04-21: PC_IN_SIGTRAMP is something of a mess. # Some code also depends on SIGTRAMP_START and SIGTRAMP_END but other # does not. -f:2:PC_IN_SIGTRAMP:int:pc_in_sigtramp:CORE_ADDR pc, char *name:pc, name:::legacy_pc_in_sigtramp::0 +f:2:PC_IN_SIGTRAMP:int:pc_in_sigtramp:CORE_ADDR pc, const char *name:pc, name:::legacy_pc_in_sigtramp::0 F:2:SIGTRAMP_START:CORE_ADDR:sigtramp_start:CORE_ADDR pc:pc F:2:SIGTRAMP_END:CORE_ADDR:sigtramp_end:CORE_ADDR pc:pc # A target might have problems with watchpoints as soon as the stack diff --git a/gdb/gdbcmd.h b/gdb/gdbcmd.h index 8c4490ec940..a7b019cac67 100644 --- a/gdb/gdbcmd.h +++ b/gdb/gdbcmd.h @@ -110,7 +110,7 @@ extern struct cmd_list_element *setchecklist; extern struct cmd_list_element *showchecklist; -extern void execute_command (char *, int); +extern void execute_command (const char *, int); enum command_control_type execute_control_command (struct command_line *); diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h index e03ebf47fa7..0aad7fab17b 100644 --- a/gdb/gdbcore.h +++ b/gdb/gdbcore.h @@ -96,14 +96,14 @@ extern void generic_search (int len, char *data, char *mask, /* Hook for `exec_file_command' command to call. */ -extern void (*exec_file_display_hook) (char *filename); +extern void (*exec_file_display_hook) (const char *filename); /* Hook for "file_command", which is more useful than above (because it is invoked AFTER symbols are read, not before) */ -extern void (*file_changed_hook) (char *filename); +extern void (*file_changed_hook) (const char *filename); -extern void specify_exec_file_hook (void (*hook) (char *filename)); +extern void specify_exec_file_hook (void (*hook) (const char *filename)); /* Binary File Diddlers for the exec and core files */ @@ -114,11 +114,11 @@ extern bfd *exec_bfd; extern int write_files; -extern void core_file_command (char *filename, int from_tty); +extern void core_file_command (const char *filename, int from_tty); -extern void exec_open (char *filename, int from_tty); +extern void exec_open (const char *filename, int from_tty); -extern void exec_file_attach (char *filename, int from_tty); +extern void exec_file_attach (const char *filename, int from_tty); extern void exec_file_clear (int from_tty); diff --git a/gdb/hpux-thread.c b/gdb/hpux-thread.c index 7a7b74174a1..02f5acd9a90 100644 --- a/gdb/hpux-thread.c +++ b/gdb/hpux-thread.c @@ -294,7 +294,7 @@ hpux_thread_fetch_registers (int regno) /* Flags must be 0 to avoid bogus value for SS_INSYSCALL */ memset (buf, '\000', REGISTER_RAW_SIZE (regno)); else if (regno == SP_REGNUM) - store_address (buf, sizeof sp, sp); + store_unsigned_integer (buf, sizeof sp, sp); else if (regno == PC_REGNUM) read_memory (sp - 20, buf, REGISTER_RAW_SIZE (regno)); else diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 5cf63b46f86..66d697d780f 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -864,7 +864,7 @@ i386_push_arguments (int nargs, struct value **args, CORE_ADDR sp, char buf[4]; sp -= 4; - store_address (buf, 4, struct_addr); + store_unsigned_integer (buf, 4, struct_addr); write_memory (sp, buf, 4); } diff --git a/gdb/i386nbsd-tdep.c b/gdb/i386nbsd-tdep.c index 64b3dc0984e..7d3fd73d7db 100644 --- a/gdb/i386nbsd-tdep.c +++ b/gdb/i386nbsd-tdep.c @@ -232,7 +232,7 @@ i386nbsd_sigtramp_offset (CORE_ADDR pc) } static int -i386nbsd_pc_in_sigtramp (CORE_ADDR pc, char *name) +i386nbsd_pc_in_sigtramp (CORE_ADDR pc, const char *name) { return (nbsd_pc_in_sigtramp (pc, name) || i386nbsd_sigtramp_offset (pc) >= 0); diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index ce9b26c8e2e..27130469e4e 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -1239,13 +1239,13 @@ ia64_get_saved_register (char *raw_buffer, if (regnum == SP_REGNUM && get_next_frame (frame)) { /* Handle SP values for all frames but the topmost. */ - store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), - get_frame_base (frame)); + store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), + get_frame_base (frame)); } else if (regnum == IA64_BSP_REGNUM) { - store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), - get_frame_extra_info (frame)->bsp); + store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), + get_frame_extra_info (frame)->bsp); } else if (regnum == IA64_VFP_REGNUM) { @@ -1255,7 +1255,7 @@ ia64_get_saved_register (char *raw_buffer, still provide a value since we know the size of the frame */ CORE_ADDR vfp = (get_frame_base (frame) + get_frame_extra_info (frame)->mem_stack_frame_size); - store_address (raw_buffer, REGISTER_RAW_SIZE (IA64_VFP_REGNUM), vfp); + store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (IA64_VFP_REGNUM), vfp); } else if (IA64_PR0_REGNUM <= regnum && regnum <= IA64_PR63_REGNUM) { @@ -1338,7 +1338,7 @@ ia64_get_saved_register (char *raw_buffer, { pc = read_pc (); } - store_address (raw_buffer, REGISTER_RAW_SIZE (IA64_IP_REGNUM), pc); + store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (IA64_IP_REGNUM), pc); } else if (IA64_GR32_REGNUM <= regnum && regnum <= IA64_GR127_REGNUM) { @@ -1769,8 +1769,8 @@ find_func_descr (CORE_ADDR faddr, CORE_ADDR *fdaptr) if (global_pointer == 0) global_pointer = read_register (IA64_GR1_REGNUM); - store_address (buf, 8, faddr); - store_address (buf + 8, 8, global_pointer); + store_unsigned_integer (buf, 8, faddr); + store_unsigned_integer (buf + 8, 8, global_pointer); write_memory (fdesc, buf, 16); } @@ -1862,9 +1862,9 @@ ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, { char val_buf[8]; - store_address (val_buf, 8, - find_func_descr (extract_address (VALUE_CONTENTS (arg), 8), - &funcdescaddr)); + store_unsigned_integer (val_buf, 8, + find_func_descr (extract_address (VALUE_CONTENTS (arg), 8), + &funcdescaddr)); if (slotnum < rseslots) write_memory (rse_address_add (bsp, slotnum), val_buf, 8); else @@ -1920,9 +1920,9 @@ ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, /* Store the struct return value in r8 if necessary. */ if (struct_return) { - store_address (&deprecated_registers[REGISTER_BYTE (IA64_GR8_REGNUM)], - REGISTER_RAW_SIZE (IA64_GR8_REGNUM), - struct_addr); + store_unsigned_integer (&deprecated_registers[REGISTER_BYTE (IA64_GR8_REGNUM)], + REGISTER_RAW_SIZE (IA64_GR8_REGNUM), + struct_addr); } /* Sync gdb's idea of what the registers are with the target. */ diff --git a/gdb/infcall.c b/gdb/infcall.c index 5f80e896bbc..eb13f9a8310 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -599,7 +599,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) type pointer to function or just a function. */ if (args[i]->lval == not_lval) { - char *arg_name; + const char *arg_name; if (find_pc_partial_function ((CORE_ADDR) args[i]->aligner.contents[0], &arg_name, NULL, NULL)) error ("\ You cannot use function <%s> as argument. \n\ diff --git a/gdb/infcmd.c b/gdb/infcmd.c index de6c319608d..7219b0906ac 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -47,21 +47,21 @@ /* Functions exported for general use, in inferior.h: */ -void all_registers_info (char *, int); +void all_registers_info (const char *, int); -void registers_info (char *, int); +void registers_info (const char *, int); -void nexti_command (char *, int); +void nexti_command (const char *, int); -void stepi_command (char *, int); +void stepi_command (const char *, int); -void continue_command (char *, int); +void continue_command (const char *, int); -void interrupt_target_command (char *args, int from_tty); +void interrupt_target_command (const char *args, int from_tty); /* Local functions: */ -static void nofp_registers_info (char *, int); +static void nofp_registers_info (const char *, int); static void print_return_value (int struct_return, struct type *value_type); @@ -69,47 +69,47 @@ static void finish_command_continuation (struct continuation_arg *); static void until_next_command (int); -static void until_command (char *, int); +static void until_command (const char *, int); -static void path_info (char *, int); +static void path_info (const char *, int); -static void path_command (char *, int); +static void path_command (const char *, int); -static void unset_command (char *, int); +static void unset_command (const char *, int); -static void float_info (char *, int); +static void float_info (const char *, int); -static void detach_command (char *, int); +static void detach_command (const char *, int); -static void unset_environment_command (char *, int); +static void unset_environment_command (const char *, int); -static void set_environment_command (char *, int); +static void set_environment_command (const char *, int); -static void environment_info (char *, int); +static void environment_info (const char *, int); -static void program_info (char *, int); +static void program_info (const char *, int); -static void finish_command (char *, int); +static void finish_command (const char *, int); -static void signal_command (char *, int); +static void signal_command (const char *, int); -static void jump_command (char *, int); +static void jump_command (const char *, int); -static void step_1 (int, int, char *); +static void step_1 (int, int, const char *); static void step_once (int skip_subroutines, int single_inst, int count); static void step_1_continuation (struct continuation_arg *arg); -static void next_command (char *, int); +static void next_command (const char *, int); -static void step_command (char *, int); +static void step_command (const char *, int); -static void run_command (char *, int); +static void run_command (const char *, int); -static void run_no_args_command (char *args, int from_tty); +static void run_no_args_command (const char *args, int from_tty); -static void go_command (char *line_no, int from_tty); +static void go_command (const char *line_no, int from_tty); -static int strip_bg_char (char **); +static int strip_bg_char (const char **); void _initialize_infcmd (void); @@ -242,7 +242,7 @@ set_inferior_args_vector (int argc, char **argv) /* Notice when `set args' is run. */ static void -notice_args_set (char *args, int from_tty, struct cmd_list_element *c) +notice_args_set (const char *args, int from_tty, struct cmd_list_element *c) { inferior_argc = 0; inferior_argv = 0; @@ -250,7 +250,7 @@ notice_args_set (char *args, int from_tty, struct cmd_list_element *c) /* Notice when `show args' is run. */ static void -notice_args_read (char *args, int from_tty, struct cmd_list_element *c) +notice_args_read (const char *args, int from_tty, struct cmd_list_element *c) { /* Might compute the value. */ get_inferior_args (); @@ -343,7 +343,7 @@ construct_inferior_arguments (struct gdbarch *gdbarch, int argc, char **argv) of a command. If it has, it removes it and returns 1. Otherwise it does nothing and returns 0. */ static int -strip_bg_char (char **args) +strip_bg_char (const char **args) { char *p = NULL; @@ -370,7 +370,7 @@ strip_bg_char (char **args) /* ARGSUSED */ void -tty_command (char *file, int from_tty) +tty_command (const char *file, int from_tty) { if (file == 0) error_no_arg ("terminal name for running target process"); @@ -379,7 +379,7 @@ tty_command (char *file, int from_tty) } static void -run_command (char *args, int from_tty) +run_command (const char *args, int from_tty) { char *exec_file; @@ -477,7 +477,7 @@ Start it from the beginning? ")) static void -run_no_args_command (char *args, int from_tty) +run_no_args_command (const char *args, int from_tty) { char *old_args = set_inferior_args (xstrdup ("")); xfree (old_args); @@ -485,7 +485,7 @@ run_no_args_command (char *args, int from_tty) void -continue_command (char *proc_count_exp, int from_tty) +continue_command (const char *proc_count_exp, int from_tty) { int async_exec = 0; ERROR_NO_INFERIOR; @@ -543,7 +543,7 @@ continue_command (char *proc_count_exp, int from_tty) /* ARGSUSED */ static void -step_command (char *count_string, int from_tty) +step_command (const char *count_string, int from_tty) { step_1 (0, 0, count_string); } @@ -552,7 +552,7 @@ step_command (char *count_string, int from_tty) /* ARGSUSED */ static void -next_command (char *count_string, int from_tty) +next_command (const char *count_string, int from_tty) { step_1 (1, 0, count_string); } @@ -561,14 +561,14 @@ next_command (char *count_string, int from_tty) /* ARGSUSED */ void -stepi_command (char *count_string, int from_tty) +stepi_command (const char *count_string, int from_tty) { step_1 (0, 1, count_string); } /* ARGSUSED */ void -nexti_command (char *count_string, int from_tty) +nexti_command (const char *count_string, int from_tty) { step_1 (1, 1, count_string); } @@ -580,7 +580,7 @@ disable_longjmp_breakpoint_cleanup (void *ignore) } static void -step_1 (int skip_subroutines, int single_inst, char *count_string) +step_1 (int skip_subroutines, int single_inst, const char *count_string) { register int count = 1; struct frame_info *frame; @@ -634,7 +634,7 @@ step_1 (int skip_subroutines, int single_inst, char *count_string) find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end); if (step_range_end == 0) { - char *name; + const char *name; if (find_pc_partial_function (stop_pc, &name, &step_range_start, &step_range_end) == 0) error ("Cannot find bounds of current function"); @@ -755,7 +755,7 @@ step_once (int skip_subroutines, int single_inst, int count) } else if (step_range_end == 0) { - char *name; + const char *name; if (find_pc_partial_function (stop_pc, &name, &step_range_start, &step_range_end) == 0) error ("Cannot find bounds of current function"); @@ -802,7 +802,7 @@ which has no line number information.\n", name); /* Continue program at specified address. */ static void -jump_command (char *arg, int from_tty) +jump_command (const char *arg, int from_tty) { register CORE_ADDR addr; struct symtabs_and_lines sals; @@ -890,7 +890,7 @@ jump_command (char *arg, int from_tty) /* Go to line or address in current procedure */ static void -go_command (char *line_no, int from_tty) +go_command (const char *line_no, int from_tty) { if (line_no == (char *) NULL || !*line_no) printf_filtered (GO_USAGE); @@ -905,7 +905,7 @@ go_command (char *line_no, int from_tty) /* Continue program giving it specified signal. */ static void -signal_command (char *signum_exp, int from_tty) +signal_command (const char *signum_exp, int from_tty) { enum target_signal oursig; @@ -1004,7 +1004,7 @@ until_next_command (int from_tty) } static void -until_command (char *arg, int from_tty) +until_command (const char *arg, int from_tty) { int async_exec = 0; @@ -1035,7 +1035,7 @@ until_command (char *arg, int from_tty) } static void -advance_command (char *arg, int from_tty) +advance_command (const char *arg, int from_tty) { int async_exec = 0; @@ -1161,7 +1161,7 @@ finish_command_continuation (struct continuation_arg *arg) the selected frame will return to, then continue. */ static void -finish_command (char *arg, int from_tty) +finish_command (const char *arg, int from_tty) { struct symtab_and_line sal; register struct frame_info *frame; @@ -1288,7 +1288,7 @@ finish_command (char *arg, int from_tty) /* ARGSUSED */ static void -program_info (char *args, int from_tty) +program_info (const char *args, int from_tty) { bpstat bs = stop_bpstat; int num = bpstat_num (&bs); @@ -1335,7 +1335,7 @@ program_info (char *args, int from_tty) } static void -environment_info (char *var, int from_tty) +environment_info (const char *var, int from_tty) { if (var) { @@ -1366,9 +1366,11 @@ environment_info (char *var, int from_tty) } static void -set_environment_command (char *arg, int from_tty) +set_environment_command (const char *arg, int from_tty) { - register char *p, *val, *var; + const char *p; + const char *val; + char *var; int nullset = 0; if (arg == 0) @@ -1428,7 +1430,7 @@ set_environment_command (char *arg, int from_tty) } static void -unset_environment_command (char *var, int from_tty) +unset_environment_command (const char *var, int from_tty) { if (var == 0) { @@ -1450,7 +1452,7 @@ static const char path_var_name[] = "PATH"; /* ARGSUSED */ static void -path_info (char *args, int from_tty) +path_info (const char *args, int from_tty) { puts_filtered ("Executable and object file path: "); puts_filtered (get_in_environ (inferior_environ, path_var_name)); @@ -1460,7 +1462,7 @@ path_info (char *args, int from_tty) /* Add zero or more directories to the front of the execution path. */ static void -path_command (char *dirname, int from_tty) +path_command (const char *dirname, int from_tty) { char *exec_path; char *env; @@ -1603,7 +1605,7 @@ default_print_registers_info (struct gdbarch *gdbarch, } void -registers_info (char *addr_exp, int fpregs) +registers_info (const char *addr_exp, int fpregs) { int regnum, numregs; register char *end; @@ -1622,7 +1624,7 @@ registers_info (char *addr_exp, int fpregs) while (*addr_exp != '\0') { - char *start; + const char *start; const char *end; /* Keep skipping leading white space. */ @@ -1706,13 +1708,13 @@ registers_info (char *addr_exp, int fpregs) } void -all_registers_info (char *addr_exp, int from_tty) +all_registers_info (const char *addr_exp, int from_tty) { registers_info (addr_exp, 1); } static void -nofp_registers_info (char *addr_exp, int from_tty) +nofp_registers_info (const char *addr_exp, int from_tty) { registers_info (addr_exp, 0); } @@ -1747,7 +1749,7 @@ print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, } static void -vector_info (char *args, int from_tty) +vector_info (const char *args, int from_tty) { print_vector_info (current_gdbarch, gdb_stdout, deprecated_selected_frame, args); } @@ -1770,7 +1772,7 @@ vector_info (char *args, int from_tty) and wait for the trace-trap that results from attaching. */ void -attach_command (char *args, int from_tty) +attach_command (const char *args, int from_tty) { char *exec_file; char *full_exec_path = NULL; @@ -1865,7 +1867,7 @@ attach_command (char *args, int from_tty) */ static void -detach_command (char *args, int from_tty) +detach_command (const char *args, int from_tty) { dont_repeat (); /* Not for the faint of heart */ target_detach (args, from_tty); @@ -1879,7 +1881,7 @@ detach_command (char *args, int from_tty) /* Stop the execution of the target while running in async mode, in the backgound. */ void -interrupt_target_command (char *args, int from_tty) +interrupt_target_command (const char *args, int from_tty) { if (event_loop_p && target_can_async_p ()) { @@ -1920,14 +1922,14 @@ No floating-point info available for this processor.\n"); } static void -float_info (char *args, int from_tty) +float_info (const char *args, int from_tty) { print_float_info (current_gdbarch, gdb_stdout, deprecated_selected_frame, args); } /* ARGSUSED */ static void -unset_command (char *args, int from_tty) +unset_command (const char *args, int from_tty) { printf_filtered ("\"unset\" must be followed by the name of "); printf_filtered ("an unset subcommand.\n"); diff --git a/gdb/inferior.h b/gdb/inferior.h index 1de3b25e39b..73c2608356e 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -221,9 +221,9 @@ extern void fetch_inferior_registers (int); extern void solib_create_inferior_hook (void); -extern void child_terminal_info (char *, int); +extern void child_terminal_info (const char *, int); -extern void term_info (char *, int); +extern void term_info (const char *, int); extern void terminal_ours_for_output (void); @@ -300,9 +300,9 @@ extern void follow_inferior_reset_breakpoints (void); /* From infcmd.c */ -extern void tty_command (char *, int); +extern void tty_command (const char *, int); -extern void attach_command (char *, int); +extern void attach_command (const char *, int); extern char *get_inferior_args (void); @@ -310,15 +310,15 @@ extern char *set_inferior_args (char *); extern void set_inferior_args_vector (int, char **); -extern void registers_info (char *, int); +extern void registers_info (const char *, int); -extern void nexti_command (char *, int); +extern void nexti_command (const char *, int); -extern void stepi_command (char *, int); +extern void stepi_command (const char *, int); -extern void continue_command (char *, int); +extern void continue_command (const char *, int); -extern void interrupt_target_command (char *args, int from_tty); +extern void interrupt_target_command (const char *args, int from_tty); /* Last signal that the inferior received (why it stopped). */ diff --git a/gdb/inflow.c b/gdb/inflow.c index 2a41f57982f..d91a5f44fcc 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -49,7 +49,7 @@ extern void _initialize_inflow (void); static void pass_signal (int); -static void kill_command (char *, int); +static void kill_command (const char *, int); static void terminal_ours_1 (int); @@ -414,14 +414,14 @@ terminal_ours_1 (int output_only) /* ARGSUSED */ void -term_info (char *arg, int from_tty) +term_info (const char *arg, int from_tty) { target_terminal_info (arg, from_tty); } /* ARGSUSED */ void -child_terminal_info (char *args, int from_tty) +child_terminal_info (const char *args, int from_tty) { if (!gdb_has_a_terminal ()) { @@ -574,7 +574,7 @@ new_tty (void) /* ARGSUSED */ static void -kill_command (char *arg, int from_tty) +kill_command (const char *arg, int from_tty) { /* FIXME: This should not really be inferior_ptid (or target_has_execution). It should be a distinct flag that indicates that a target is active, cuz diff --git a/gdb/infptrace.c b/gdb/infptrace.c index 1225dd8a62c..5d1d3eb64e3 100644 --- a/gdb/infptrace.c +++ b/gdb/infptrace.c @@ -102,7 +102,7 @@ #endif /* !FETCH_INFERIOR_REGISTERS */ #if !defined (CHILD_XFER_MEMORY) -static void udot_info (char *, int); +static void udot_info (const char *, int); #endif #if !defined (FETCH_INFERIOR_REGISTERS) @@ -626,7 +626,7 @@ child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, static void -udot_info (char *dummy1, int dummy2) +udot_info (const char *dummy1, int dummy2) { #if defined (KERNEL_U_SIZE) long udot_off; /* Offset into user struct */ diff --git a/gdb/infrun.c b/gdb/infrun.c index df179682109..f052770d3e6 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -47,9 +47,9 @@ /* Prototypes for local functions */ -static void signals_info (char *, int); +static void signals_info (const char *, int); -static void handle_command (char *, int); +static void handle_command (const char *, int); static void sig_print_info (enum target_signal); @@ -70,14 +70,14 @@ static void build_infrun (void); static int follow_fork (void); -static void set_schedlock_func (char *args, int from_tty, +static void set_schedlock_func (const char *args, int from_tty, struct cmd_list_element *c); struct execution_control_state; static int currently_stepping (struct execution_control_state *ecs); -static void xdb_handle_command (char *args, int from_tty); +static void xdb_handle_command (const char *args, int from_tty); void _initialize_infrun (void); @@ -512,7 +512,7 @@ static const char *scheduler_enums[] = { }; static void -set_schedlock_func (char *args, int from_tty, struct cmd_list_element *c) +set_schedlock_func (const char *args, int from_tty, struct cmd_list_element *c) { /* NOTE: cagney/2002-03-17: The add_show_from_set() function clones the set command passed as a parameter. The clone operation will @@ -924,7 +924,7 @@ struct execution_control_state int random_signal; CORE_ADDR stop_func_start; CORE_ADDR stop_func_end; - char *stop_func_name; + const char *stop_func_name; struct symtab_and_line sal; int remove_breakpoints_on_following_step; int current_line; @@ -1190,7 +1190,7 @@ context_switch (struct execution_control_state *ecs) static int pc_in_sigtramp (CORE_ADDR pc) { - char *name; + const char *name; find_pc_partial_function (pc, &name, NULL, NULL); return PC_IN_SIGTRAMP (pc, name); } @@ -3247,7 +3247,7 @@ sig_print_info (enum target_signal oursig) /* Specify how various signals in the inferior should be handled. */ static void -handle_command (char *args, int from_tty) +handle_command (const char *args, int from_tty) { char **argv; int digits, wordlen; @@ -3427,7 +3427,7 @@ Are you sure you want to change it? ", target_signal_to_name ((enum target_signa } static void -xdb_handle_command (char *args, int from_tty) +xdb_handle_command (const char *args, int from_tty) { char **argv; struct cleanup *old_chain; @@ -3499,7 +3499,7 @@ xdb_handle_command (char *args, int from_tty) targets, all signals should be in the signal tables). */ static void -signals_info (char *signum_exp, int from_tty) +signals_info (const char *signum_exp, int from_tty) { enum target_signal oursig; sig_print_header (); diff --git a/gdb/inftarg.c b/gdb/inftarg.c index 7786579d406..0aaa0c5fbf3 100644 --- a/gdb/inftarg.c +++ b/gdb/inftarg.c @@ -57,13 +57,13 @@ static ptid_t child_wait (ptid_t, struct target_waitstatus *); void child_post_wait (ptid_t, int); #endif -static void child_open (char *, int); +static void child_open (const char *, int); static void child_files_info (struct target_ops *); -static void child_detach (char *, int); +static void child_detach (const char *, int); -static void child_attach (char *, int); +static void child_attach (const char *, int); #if !defined(CHILD_POST_ATTACH) extern void child_post_attach (int); @@ -192,7 +192,7 @@ child_thread_alive (ptid_t ptid) /* Attach to process PID, then initialize for debugging it. */ static void -child_attach (char *args, int from_tty) +child_attach (const char *args, int from_tty) { if (!args) error_no_arg ("process-id to attach"); @@ -203,7 +203,7 @@ child_attach (char *args, int from_tty) { char *exec_file; int pid; - char *dummy; + const char *dummy; dummy = args; pid = strtol (args, &dummy, 0); @@ -254,7 +254,7 @@ child_post_attach (int pid) started via the normal ptrace (PTRACE_TRACEME). */ static void -child_detach (char *args, int from_tty) +child_detach (const char *args, int from_tty) { #ifdef ATTACH_DETACH { @@ -308,7 +308,7 @@ child_files_info (struct target_ops *ignore) /* ARGSUSED */ static void -child_open (char *arg, int from_tty) +child_open (const char *arg, int from_tty) { error ("Use the \"run\" command to start a Unix child process."); } diff --git a/gdb/interps.c b/gdb/interps.c index 748b5b64901..e4939232af4 100644 --- a/gdb/interps.c +++ b/gdb/interps.c @@ -358,7 +358,7 @@ initialize_interps (void) } void -interpreter_exec_cmd (char *args, int from_tty) +interpreter_exec_cmd (const char *args, int from_tty) { struct interp *old_interp, *interp_to_use; char **prules = NULL; diff --git a/gdb/kod-cisco.c b/gdb/kod-cisco.c index de2b4502666..79a8224b5a4 100644 --- a/gdb/kod-cisco.c +++ b/gdb/kod-cisco.c @@ -106,7 +106,7 @@ bad_packet (void) querying the Cisco kernel: we ask for a dump of everything, and it returns it. */ void -cisco_kod_request (char *arg, int from_tty) +cisco_kod_request (const char *arg, int from_tty) { char buffer[PBUFSIZ], command[PBUFSIZ]; int done = 0, i; diff --git a/gdb/kod.c b/gdb/kod.c index 8f565bb8c36..ae57e9a0cae 100644 --- a/gdb/kod.c +++ b/gdb/kod.c @@ -31,7 +31,7 @@ void _initialize_kod (void); /* Prototypes for local functions. */ -static void info_kod_command (char *, int); +static void info_kod_command (const char *, int); static void load_kod_library (char *); /* Prototypes for callbacks. These are passed into the KOD modules. */ @@ -63,7 +63,7 @@ static void gdb_kod_query (char *, char *, int *); static char *(*gdb_kod_open) (kod_display_callback_ftype *display, kod_query_callback_ftype *query); -static void (*gdb_kod_request) (char *, int); +static void (*gdb_kod_request) (const char *, int); static void (*gdb_kod_close) (); @@ -128,7 +128,7 @@ gdb_kod_query (char *arg, char *result, int *maxsiz) subcommand which is what the user actually uses to query the OS. */ static void -kod_set_os (char *arg, int from_tty, struct cmd_list_element *command) +kod_set_os (const char *arg, int from_tty, struct cmd_list_element *command) { char *p; @@ -194,7 +194,7 @@ kod_set_os (char *arg, int from_tty, struct cmd_list_element *command) argument is empty. */ static void -info_kod_command (char *arg, int from_tty) +info_kod_command (const char *arg, int from_tty) { (*gdb_kod_request) (arg, from_tty); } diff --git a/gdb/kod.h b/gdb/kod.h index 6c4d03a3c7b..2800b51be62 100644 --- a/gdb/kod.h +++ b/gdb/kod.h @@ -54,7 +54,7 @@ extern char *cisco_kod_open (kod_display_callback_ftype *display_func, the Cisco kernel: we ask for a dump of everything, and it returns it. */ -extern void cisco_kod_request (char *arg, int from_tty); +extern void cisco_kod_request (const char *arg, int from_tty); extern void cisco_kod_close (void); diff --git a/gdb/language.c b/gdb/language.c index 0a650940444..9382c3dbb5b 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -48,21 +48,21 @@ extern void _initialize_language (void); -static void show_language_command (char *, int); +static void show_language_command (const char *, int); -static void set_language_command (char *, int); +static void set_language_command (const char *, int); -static void show_type_command (char *, int); +static void show_type_command (const char *, int); -static void set_type_command (char *, int); +static void set_type_command (const char *, int); -static void show_range_command (char *, int); +static void show_range_command (const char *, int); -static void set_range_command (char *, int); +static void set_range_command (const char *, int); -static void show_case_command (char *, int); +static void show_case_command (const char *, int); -static void set_case_command (char *, int); +static void set_case_command (const char *, int); static void set_case_str (void); @@ -76,9 +76,9 @@ static void unk_lang_error (char *); static int unk_lang_parser (void); -static void show_check (char *, int); +static void show_check (const char *, int); -static void set_check (char *, int); +static void set_check (const char *, int); static void set_type_range_case (void); @@ -158,7 +158,7 @@ char lang_frame_mismatch_warn[] = /* Show command. Display a warning if the language set does not match the frame. */ static void -show_language_command (char *ignore, int from_tty) +show_language_command (const char *ignore, int from_tty) { enum language flang; /* The language of the current frame */ @@ -171,7 +171,7 @@ show_language_command (char *ignore, int from_tty) /* Set command. Change the current working language. */ static void -set_language_command (char *ignore, int from_tty) +set_language_command (const char *ignore, int from_tty) { int i; enum language flang; @@ -243,7 +243,7 @@ set_language_command (char *ignore, int from_tty) /* Show command. Display a warning if the type setting does not match the current language. */ static void -show_type_command (char *ignore, int from_tty) +show_type_command (const char *ignore, int from_tty) { if (type_check != current_language->la_type_check) printf_unfiltered ( @@ -252,7 +252,7 @@ show_type_command (char *ignore, int from_tty) /* Set command. Change the setting for type checking. */ static void -set_type_command (char *ignore, int from_tty) +set_type_command (const char *ignore, int from_tty) { if (STREQ (type, "on")) { @@ -288,7 +288,7 @@ set_type_command (char *ignore, int from_tty) /* Show command. Display a warning if the range setting does not match the current language. */ static void -show_range_command (char *ignore, int from_tty) +show_range_command (const char *ignore, int from_tty) { if (range_check != current_language->la_range_check) @@ -298,7 +298,7 @@ show_range_command (char *ignore, int from_tty) /* Set command. Change the setting for range checking. */ static void -set_range_command (char *ignore, int from_tty) +set_range_command (const char *ignore, int from_tty) { if (STREQ (range, "on")) { @@ -334,7 +334,7 @@ set_range_command (char *ignore, int from_tty) /* Show command. Display a warning if the case sensitivity setting does not match the current language. */ static void -show_case_command (char *ignore, int from_tty) +show_case_command (const char *ignore, int from_tty) { if (case_sensitivity != current_language->la_case_sensitivity) printf_unfiltered( @@ -343,7 +343,7 @@ show_case_command (char *ignore, int from_tty) /* Set command. Change the setting for case sensitivity. */ static void -set_case_command (char *ignore, int from_tty) +set_case_command (const char *ignore, int from_tty) { if (STREQ (case_sensitive, "on")) { @@ -1300,7 +1300,7 @@ language_str (enum language lang) } static void -set_check (char *ignore, int from_tty) +set_check (const char *ignore, int from_tty) { printf_unfiltered ( "\"set check\" must be followed by the name of a check subcommand.\n"); @@ -1308,7 +1308,7 @@ set_check (char *ignore, int from_tty) } static void -show_check (char *ignore, int from_tty) +show_check (const char *ignore, int from_tty) { cmd_show_list (showchecklist, from_tty, ""); } diff --git a/gdb/linespec.c b/gdb/linespec.c index ea52a803620..3e4df68917b 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -44,29 +44,30 @@ extern char *operator_chars (char *, char **); static void initialize_defaults (struct symtab **default_symtab, int *default_line); -static void set_flags (char *arg, int *is_quoted, char **paren_pointer); +static void set_flags (const char *arg, int *is_quoted, char **paren_pointer); -static struct symtabs_and_lines decode_indirect (char **argptr); +static struct symtabs_and_lines decode_indirect (const char **argptr); -static char *locate_first_half (char **argptr, int *is_quote_enclosed); +static const char *locate_first_half (const char **argptr, + int *is_quote_enclosed); -static struct symtabs_and_lines decode_objc (char **argptr, +static struct symtabs_and_lines decode_objc (const char **argptr, int funfirstline, struct symtab *file_symtab, char ***canonical, - char *saved_arg); + const char *saved_arg); -static struct symtabs_and_lines decode_compound (char **argptr, +static struct symtabs_and_lines decode_compound (const char **argptr, int funfirstline, char ***canonical, - char *saved_arg, - char *p); + const char *saved_arg, + const char *p); -static struct symbol *lookup_prefix_sym (char **argptr, char *p); +static struct symbol *lookup_prefix_sym (const char **argptr, const char *p); static struct symtabs_and_lines find_method (int funfirstline, char ***canonical, - char *saved_arg, + const char *saved_arg, char *copy, struct type *t, struct symbol *sym_class); @@ -85,21 +86,22 @@ static int find_methods (struct type *, char *, struct symbol **); static void build_canonical_line_spec (struct symtab_and_line *, char *, char ***); -static char *find_toplevel_char (char *s, char c); +static const char *find_toplevel_char (const char *s, char c); static struct symtabs_and_lines decode_line_2 (struct symbol *[], int, int, char ***); -static struct symtab *symtab_from_filename (char **argptr, - char *p, int is_quote_enclosed); +static struct symtab *symtab_from_filename (const char **argptr, + const char *p, + int is_quote_enclosed); static struct -symtabs_and_lines decode_all_digits (char **argptr, +symtabs_and_lines decode_all_digits (const char **argptr, struct symtab *default_symtab, int default_line, char ***canonical, struct symtab *file_symtab, - char *q); + const char *q); static struct symtabs_and_lines decode_dollar (char *copy, int funfirstline, @@ -374,14 +376,14 @@ build_canonical_line_spec (struct symtab_and_line *sal, char *symname, strings. Also, ignore the char within a template name, like a ',' within foo<int, int>. */ -static char * -find_toplevel_char (char *s, char c) +static const char * +find_toplevel_char (const char *s, char c) { int quoted = 0; /* zero if we're not in quotes; '"' if we're in a double-quoted string; '\'' if we're in a single-quoted string. */ int depth = 0; /* Number of unclosed parens we've seen. */ - char *scan; + const char *scan; for (scan = s; *scan; scan++) { @@ -579,11 +581,12 @@ decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline, can use as appropriate instead of make_symbol_completion_list. */ struct symtabs_and_lines -decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, +decode_line_1 (const char **argptr, int funfirstline, + struct symtab *default_symtab, int default_line, char ***canonical) { - char *p; - char *q; + const char *p; + const char *q; /* If a file name is specified, this is its symtab. */ struct symtab *file_symtab = NULL; @@ -597,7 +600,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, /* Is part of *ARGPTR is enclosed in double quotes? */ int is_quote_enclosed; int is_objc_method = 0; - char *saved_arg = *argptr; + const char *saved_arg = *argptr; /* Defaults have defaults. */ @@ -811,7 +814,7 @@ initialize_defaults (struct symtab **default_symtab, int *default_line) } static void -set_flags (char *arg, int *is_quoted, char **paren_pointer) +set_flags (const char *arg, int *is_quoted, char **paren_pointer) { char *ii; int has_if = 0; @@ -853,7 +856,7 @@ set_flags (char *arg, int *is_quoted, char **paren_pointer) /* Decode arg of the form *PC. */ static struct symtabs_and_lines -decode_indirect (char **argptr) +decode_indirect (const char **argptr) { struct symtabs_and_lines values; CORE_ADDR pc; @@ -879,11 +882,12 @@ decode_indirect (char **argptr) enclosed in double quotes; if so, set is_quote_enclosed, advance ARGPTR past that and zero out the trailing double quote. */ -static char * -locate_first_half (char **argptr, int *is_quote_enclosed) +static const char * +locate_first_half (const char **argptr, int *is_quote_enclosed) { - char *ii; - char *p, *p1; + const char *ii; + const char *p; + const char *p1; int has_comma; /* Maybe we were called with a line range FILENAME:LINENUM,FILENAME:LINENUM @@ -920,7 +924,7 @@ locate_first_half (char **argptr, int *is_quote_enclosed) { if (p[0] == '<') { - char *temp_end = find_template_name_end (p); + const char *temp_end = find_template_name_end (p); if (!temp_end) error ("malformed template specification in command"); p = temp_end; @@ -983,13 +987,13 @@ locate_first_half (char **argptr, int *is_quote_enclosed) the existing C++ code to let the user choose one. */ struct symtabs_and_lines -decode_objc (char **argptr, int funfirstline, struct symtab *file_symtab, - char ***canonical, char *saved_arg) +decode_objc (const char **argptr, int funfirstline, struct symtab *file_symtab, + char ***canonical, const char *saved_arg) { struct symtabs_and_lines values; struct symbol **sym_arr = NULL; struct symbol *sym = NULL; - char *copy = NULL; + const char *copy = NULL; struct block *block = NULL; int i1 = 0; int i2 = 0; @@ -1068,16 +1072,16 @@ decode_objc (char **argptr, int funfirstline, struct symtab *file_symtab, at the first component separator, i.e. double-colon or period. */ static struct symtabs_and_lines -decode_compound (char **argptr, int funfirstline, char ***canonical, - char *saved_arg, char *p) +decode_compound (const char **argptr, int funfirstline, char ***canonical, + const char *saved_arg, const char *p) { struct symtabs_and_lines values; - char *p2; + const char *p2; #if 0 char *q, *q1; #endif - char *saved_arg2 = *argptr; - char *temp_end; + const char *saved_arg2 = *argptr; + const char *temp_end; struct symbol *sym; /* The symtab that SYM was found in. */ struct symtab *sym_symtab; @@ -1234,9 +1238,9 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, whitespace. */ static struct symbol * -lookup_prefix_sym (char **argptr, char *p) +lookup_prefix_sym (const char **argptr, const char *p) { - char *p1; + const char *p1; char *copy; /* Extract the class name. */ @@ -1261,7 +1265,7 @@ lookup_prefix_sym (char **argptr, char *p) symbol is SYM_CLASS. */ static struct symtabs_and_lines -find_method (int funfirstline, char ***canonical, char *saved_arg, +find_method (int funfirstline, char ***canonical, const char *saved_arg, char *copy, struct type *t, struct symbol *sym_class) { struct symtabs_and_lines values; @@ -1361,9 +1365,10 @@ collect_methods (char *copy, struct type *t, of *ARGPTR ending at P, and advance ARGPTR past that filename. */ static struct symtab * -symtab_from_filename (char **argptr, char *p, int is_quote_enclosed) +symtab_from_filename (const char **argptr, const char *p, + int is_quote_enclosed) { - char *p1; + const char *p1; char *copy; struct symtab *file_symtab; @@ -1405,9 +1410,9 @@ symtab_from_filename (char **argptr, char *p, int is_quote_enclosed) the other arguments are as usual. */ static struct symtabs_and_lines -decode_all_digits (char **argptr, struct symtab *default_symtab, +decode_all_digits (const char **argptr, struct symtab *default_symtab, int default_line, char ***canonical, - struct symtab *file_symtab, char *q) + struct symtab *file_symtab, const char *q) { struct symtabs_and_lines values; diff --git a/gdb/linespec.h b/gdb/linespec.h index 3ede4bd96ac..8b3f44b1520 100644 --- a/gdb/linespec.h +++ b/gdb/linespec.h @@ -21,9 +21,10 @@ struct symtab; -extern struct symtabs_and_lines - decode_line_1 (char **argptr, int funfirstline, - struct symtab *default_symtab, int default_line, - char ***canonical); +extern struct symtabs_and_lines decode_line_1 (const char **argptr, + int funfirstline, + struct symtab *default_symtab, + int default_line, + char ***canonical); #endif /* defined (LINESPEC_H) */ diff --git a/gdb/macrocmd.c b/gdb/macrocmd.c index 02f44fce4cd..93549e9c576 100644 --- a/gdb/macrocmd.c +++ b/gdb/macrocmd.c @@ -33,7 +33,7 @@ static struct cmd_list_element *macrolist; static void -macro_command (char *arg, int from_tty) +macro_command (const char *arg, int from_tty) { printf_unfiltered ("\"macro\" must be followed by the name of a macro command.\n"); @@ -46,7 +46,7 @@ macro_command (char *arg, int from_tty) static void -macro_expand_command (char *exp, int from_tty) +macro_expand_command (const char *exp, int from_tty) { struct macro_scope *ms = NULL; char *expanded = NULL; @@ -82,7 +82,7 @@ macro_expand_command (char *exp, int from_tty) static void -macro_expand_once_command (char *exp, int from_tty) +macro_expand_once_command (const char *exp, int from_tty) { struct macro_scope *ms = NULL; char *expanded = NULL; @@ -135,7 +135,7 @@ show_pp_source_pos (struct ui_file *stream, static void -info_macro_command (char *name, int from_tty) +info_macro_command (const char *name, int from_tty) { struct macro_scope *ms = NULL; struct cleanup *cleanup_chain = make_cleanup (free_current_contents, &ms); @@ -199,21 +199,21 @@ info_macro_command (char *name, int from_tty) static struct macro_table *user_macros; static void -macro_define_command (char *exp, int from_tty) +macro_define_command (const char *exp, int from_tty) { error ("Command not implemented yet."); } static void -macro_undef_command (char *exp, int from_tty) +macro_undef_command (const char *exp, int from_tty) { error ("Command not implemented yet."); } static void -macro_list_command (char *exp, int from_tty) +macro_list_command (const char *exp, int from_tty) { error ("Command not implemented yet."); } diff --git a/gdb/main.c b/gdb/main.c index fd25750b94e..a42225b8713 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -219,7 +219,7 @@ captured_main (void *data) gdb_sysroot = TARGET_SYSTEM_ROOT; #else #if defined (TARGET_SYSTEM_ROOT) - gdb_sysroot = TARGET_SYSTEM_ROOT; + gdb_sysroot = xstrdup (TARGET_SYSTEM_ROOT); #else gdb_sysroot = ""; #endif diff --git a/gdb/maint.c b/gdb/maint.c index aa342390765..034fcbdfd15 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -40,27 +40,15 @@ extern void _initialize_maint_cmds (void); -static void maintenance_command (char *, int); +static void maintenance_do_deprecate (const char *text, int deprecate); -static void maintenance_dump_me (char *, int); +static void maintenance_command (const char *, int); -static void maintenance_internal_error (char *args, int from_tty); - -static void maintenance_demangle (char *, int); - -static void maintenance_time_display (char *, int); - -static void maintenance_space_display (char *, int); - -static void maintenance_info_command (char *, int); +static void maintenance_info_command (const char *, int); static void print_section_table (bfd *, asection *, void *); -static void maintenance_info_sections (char *, int); - -static void maintenance_print_command (char *, int); - -static void maintenance_do_deprecate (char *, int); +static void maintenance_print_command (const char *, int); /* Set this to the maximum number of seconds to wait instead of waiting forever in target_wait(). If this timer times out, then it generates an error and @@ -85,7 +73,7 @@ int watchdog = 0; */ static void -maintenance_command (char *args, int from_tty) +maintenance_command (const char *args, int from_tty) { printf_unfiltered ("\"maintenance\" must be followed by the name of a maintenance command.\n"); help_list (maintenancelist, "maintenance ", -1, gdb_stdout); @@ -94,7 +82,7 @@ maintenance_command (char *args, int from_tty) #ifndef _WIN32 /* ARGSUSED */ static void -maintenance_dump_me (char *args, int from_tty) +maintenance_dump_me (const char *args, int from_tty) { if (query ("Should GDB dump core? ")) { @@ -116,7 +104,7 @@ maintenance_dump_me (char *args, int from_tty) GDB. */ static void -maintenance_internal_error (char *args, int from_tty) +maintenance_internal_error (const char *args, int from_tty) { internal_error (__FILE__, __LINE__, "%s", (args == NULL ? "" : args)); } @@ -141,7 +129,7 @@ maintenance_internal_warning (char *args, int from_tty) demangle and print what it points to, etc. (FIXME) */ static void -maintenance_demangle (char *args, int from_tty) +maintenance_demangle (const char *args, int from_tty) { char *demangled; @@ -166,7 +154,7 @@ maintenance_demangle (char *args, int from_tty) } static void -maintenance_time_display (char *args, int from_tty) +maintenance_time_display (const char *args, int from_tty) { extern int display_time; @@ -177,7 +165,7 @@ maintenance_time_display (char *args, int from_tty) } static void -maintenance_space_display (char *args, int from_tty) +maintenance_space_display (const char *args, int from_tty) { extern int display_space; @@ -193,7 +181,7 @@ maintenance_space_display (char *args, int from_tty) /* ARGSUSED */ static void -maintenance_info_command (char *arg, int from_tty) +maintenance_info_command (const char *arg, int from_tty) { printf_unfiltered ("\"maintenance info\" must be followed by the name of an info command.\n"); help_list (maintenanceinfolist, "maintenance info ", -1, gdb_stdout); @@ -339,7 +327,7 @@ print_bfd_section_info (bfd *abfd, static void print_objfile_section_info (bfd *abfd, struct obj_section *asect, - char *string) + const char *string) { flagword flags = bfd_get_section_flags (abfd, asect->the_bfd_section); const char *name = bfd_section_name (abfd, asect->the_bfd_section); @@ -355,7 +343,7 @@ print_objfile_section_info (bfd *abfd, /* ARGSUSED */ static void -maintenance_info_sections (char *arg, int from_tty) +maintenance_info_sections (const char *arg, int from_tty) { if (exec_bfd) { @@ -428,7 +416,7 @@ maintenance_print_architecture (char *args, int from_tty) /* ARGSUSED */ static void -maintenance_print_command (char *arg, int from_tty) +maintenance_print_command (const char *arg, int from_tty) { printf_unfiltered ("\"maintenance print\" must be followed by the name of a print command.\n"); help_list (maintenanceprintlist, "maintenance print ", -1, gdb_stdout); @@ -536,7 +524,7 @@ the command you want to undeprecate.\n"); replacement. */ static void -maintenance_do_deprecate (char *text, int deprecate) +maintenance_do_deprecate (const char *text, int deprecate) { struct cmd_list_element *alias = NULL; @@ -618,14 +606,14 @@ static struct cmd_list_element *maintenance_set_cmdlist; static struct cmd_list_element *maintenance_show_cmdlist; static void -maintenance_set_cmd (char *args, int from_tty) +maintenance_set_cmd (const char *args, int from_tty) { printf_unfiltered ("\"maintenance set\" must be followed by the name of a set command.\n"); help_list (maintenance_set_cmdlist, "maintenance set ", -1, gdb_stdout); } static void -maintenance_show_cmd (char *args, int from_tty) +maintenance_show_cmd (const char *args, int from_tty) { cmd_show_list (maintenance_show_cmdlist, from_tty, ""); } @@ -656,7 +644,7 @@ mcleanup_wrapper (void) } static void -maintenance_set_profile_cmd (char *args, int from_tty, struct cmd_list_element *c) +maintenance_set_profile_cmd (const char *args, int from_tty, struct cmd_list_element *c) { if (maintenance_profile_p == profiling_state) return; @@ -688,7 +676,7 @@ maintenance_set_profile_cmd (char *args, int from_tty, struct cmd_list_element * } #else static void -maintenance_set_profile_cmd (char *args, int from_tty, struct cmd_list_element *c) +maintenance_set_profile_cmd (const char *args, int from_tty, struct cmd_list_element *c) { error ("Profiling support is not available on this system."); } diff --git a/gdb/memattr.c b/gdb/memattr.c index 05ad413cc0a..ef53adf8f9a 100644 --- a/gdb/memattr.c +++ b/gdb/memattr.c @@ -133,7 +133,7 @@ lookup_mem_region (CORE_ADDR addr) static void -mem_command (char *args, int from_tty) +mem_command (const char *args, int from_tty) { CORE_ADDR lo, hi; char *tok; @@ -211,7 +211,7 @@ mem_command (char *args, int from_tty) static void -mem_info_command (char *args, int from_tty) +mem_info_command (const char *args, int from_tty) { struct mem_region *m; struct mem_attrib *attrib; @@ -350,10 +350,10 @@ mem_enable (int num) } static void -mem_enable_command (char *args, int from_tty) +mem_enable_command (const char *args, int from_tty) { - char *p = args; - char *p1; + const char *p = args; + const char *p1; int num; struct mem_region *m; @@ -400,10 +400,10 @@ mem_disable (int num) } static void -mem_disable_command (char *args, int from_tty) +mem_disable_command (const char *args, int from_tty) { - char *p = args; - char *p1; + const char *p = args; + const char *p1; int num; struct mem_region *m; @@ -479,10 +479,10 @@ mem_delete (int num) } static void -mem_delete_command (char *args, int from_tty) +mem_delete_command (const char *args, int from_tty) { - char *p = args; - char *p1; + const char *p = args; + const char *p1; int num; dcache_invalidate (target_dcache); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index bf19ed8d999..57ee0dfa4d5 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -2767,7 +2767,7 @@ mips_eabi_push_arguments (int nargs, if (len > MIPS_SAVED_REGSIZE && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)) { - store_address (valbuf, MIPS_SAVED_REGSIZE, VALUE_ADDRESS (arg)); + store_unsigned_integer (valbuf, MIPS_SAVED_REGSIZE, VALUE_ADDRESS (arg)); typecode = TYPE_CODE_PTR; len = MIPS_SAVED_REGSIZE; val = valbuf; @@ -5442,7 +5442,7 @@ mips_get_saved_register (char *raw_buffer, /* Only MIPS_SAVED_REGSIZE bytes of GP registers are saved. */ LONGEST val = read_memory_integer ((*addrp), MIPS_SAVED_REGSIZE); - store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), val); + store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), val); } } } diff --git a/gdb/mipsnbsd-tdep.c b/gdb/mipsnbsd-tdep.c index 7776d465ad1..9b40a3dc889 100644 --- a/gdb/mipsnbsd-tdep.c +++ b/gdb/mipsnbsd-tdep.c @@ -218,7 +218,7 @@ mipsnbsd_sigtramp_offset (CORE_ADDR pc) } static int -mipsnbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) +mipsnbsd_pc_in_sigtramp (CORE_ADDR pc, const char *func_name) { return (nbsd_pc_in_sigtramp (pc, func_name) || mipsnbsd_sigtramp_offset (pc) >= 0); diff --git a/gdb/nbsd-tdep.c b/gdb/nbsd-tdep.c index a2d8f7d1533..f1ba411774f 100644 --- a/gdb/nbsd-tdep.c +++ b/gdb/nbsd-tdep.c @@ -99,7 +99,7 @@ nbsd_lp64_solib_svr4_fetch_link_map_offsets (void) } int -nbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) +nbsd_pc_in_sigtramp (CORE_ADDR pc, const char *func_name) { /* Check for libc-provided signal trampoline. All such trampolines have function names which begin with "__sigtramp". */ diff --git a/gdb/nbsd-tdep.h b/gdb/nbsd-tdep.h index 9d26ae9f859..05ea46d63a2 100644 --- a/gdb/nbsd-tdep.h +++ b/gdb/nbsd-tdep.h @@ -25,6 +25,6 @@ struct link_map_offsets *nbsd_ilp32_solib_svr4_fetch_link_map_offsets (void); struct link_map_offsets *nbsd_lp64_solib_svr4_fetch_link_map_offsets (void); -int nbsd_pc_in_sigtramp (CORE_ADDR, char *); +int nbsd_pc_in_sigtramp (CORE_ADDR, const char *); #endif /* NBSD_TDEP_H */ diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 368e3366e0e..b1e558796be 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -855,7 +855,7 @@ compare_selectors (const void *a, const void *b) */ static void -selectors_info (char *regexp, int from_tty) +selectors_info (const char *regexp, int from_tty) { struct objfile *objfile; struct minimal_symbol *msymbol; @@ -1006,7 +1006,7 @@ compare_classes (const void *a, const void *b) */ static void -classes_info (char *regexp, int from_tty) +classes_info (const char *regexp, int from_tty) { struct objfile *objfile; struct minimal_symbol *msymbol; @@ -1419,9 +1419,10 @@ find_methods (struct symtab *symtab, char type, *ndebug = cdebug; } -char *find_imps (struct symtab *symtab, struct block *block, - char *method, struct symbol **syms, - unsigned int *nsym, unsigned int *ndebug) +const char * +find_imps (struct symtab *symtab, struct block *block, + const char *method, struct symbol **syms, + unsigned int *nsym, unsigned int *ndebug) { char type = '\0'; char *class = NULL; @@ -1550,7 +1551,7 @@ char *find_imps (struct symtab *symtab, struct block *block, } void -print_object_command (char *args, int from_tty) +print_object_command (const char *args, int from_tty) { struct value *object, *function, *description; CORE_ADDR string_addr, object_addr; diff --git a/gdb/objc-lang.h b/gdb/objc-lang.h index 0c49bac6382..ef1ec6a8b9c 100644 --- a/gdb/objc-lang.h +++ b/gdb/objc-lang.h @@ -51,9 +51,9 @@ extern char *parse_method (char *method, char *type, char **class, char **category, char **selector); -extern char *find_imps (struct symtab *symtab, struct block *block, - char *method, struct symbol **syms, - unsigned int *nsym, unsigned int *ndebug); +extern const char *find_imps (struct symtab *symtab, struct block *block, + const char *method, struct symbol **syms, + unsigned int *nsym, unsigned int *ndebug); extern struct value *value_nsstring (char *ptr, int len); diff --git a/gdb/osabi.c b/gdb/osabi.c index 22414062705..5084b0f6221 100644 --- a/gdb/osabi.c +++ b/gdb/osabi.c @@ -492,7 +492,7 @@ generic_elf_osabi_sniffer (bfd *abfd) } static void -set_osabi (char *args, int from_tty, struct cmd_list_element *c) +set_osabi (const char *args, int from_tty, struct cmd_list_element *c) { struct gdbarch_info info; @@ -532,7 +532,7 @@ set_osabi (char *args, int from_tty, struct cmd_list_element *c) } void -show_osabi (char *args, int from_tty) +show_osabi (const char *args, int from_tty) { if (user_osabi_state == osabi_auto) printf_filtered ("The current OS ABI is \"auto\" (currently \"%s\").\n", diff --git a/gdb/parse.c b/gdb/parse.c index d4a6a051937..25057b3a404 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -563,7 +563,7 @@ parse_nested_classes_for_hpacc (char *name, int len, char **token, consider *prefixes* of the string; there is no need to look up "B::C" separately as a symbol in the previous example. */ - register char *p; + const char *p; char *start, *end; char *prefix = NULL; char *tmp; @@ -572,7 +572,7 @@ parse_nested_classes_for_hpacc (char *name, int len, char **token, struct type *t; int prefix_len = 0; int done = 0; - char *q; + const char *q; /* Check for HP-compiled executable -- in other cases return NULL, and caller must default to standard GDB @@ -691,8 +691,8 @@ parse_nested_classes_for_hpacc (char *name, int len, char **token, return sym_var ? sym_var : sym_class; /* found */ } -char * -find_template_name_end (char *p) +const char * +find_template_name_end (const char *p) { int depth = 1; int just_seen_right = 0; @@ -1103,11 +1103,11 @@ prefixify_subexp (register struct expression *inexpr, If COMMA is nonzero, stop if a comma is reached. */ struct expression * -parse_exp_1 (char **stringptr, struct block *block, int comma) +parse_exp_1 (const char **stringptr, struct block *block, int comma) { struct cleanup *old_chain; - lexptr = *stringptr; + const char *lexptr = *stringptr; prev_lexptr = NULL; paren_depth = 0; @@ -1172,7 +1172,7 @@ parse_exp_1 (char **stringptr, struct block *block, int comma) to use up all of the contents of STRING. */ struct expression * -parse_expression (char *string) +parse_expression (const char *string) { register struct expression *exp; exp = parse_exp_1 (&string, 0, 0); diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index f03f5370096..9e9534b468b 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -139,7 +139,7 @@ extern void write_dollar_variable (struct stoken str); extern struct symbol *parse_nested_classes_for_hpacc (char *, int, char **, int *, char **); -extern char *find_template_name_end (char *); +extern const char *find_template_name_end (const char *); extern void start_arglist (void); diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index 9894a5883e2..6e8216cdc22 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -180,7 +180,7 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, write_register (SP_REGNUM, sp); /* write the backchain */ - store_address (old_sp_buf, 4, saved_sp); + store_unsigned_integer (old_sp_buf, 4, saved_sp); write_memory (sp, old_sp_buf, 4); argoffset = 8; @@ -261,7 +261,7 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, || TYPE_CODE (type) == TYPE_CODE_UNION) { write_memory (sp + structoffset, val, len); - store_address (val_buf, 4, sp + structoffset); + store_unsigned_integer (val_buf, 4, sp + structoffset); structoffset += round2 (len, 8); } else diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c index 21ab858768e..7c4186c3cad 100644 --- a/gdb/ppcnbsd-tdep.c +++ b/gdb/ppcnbsd-tdep.c @@ -198,7 +198,7 @@ static struct core_fns ppcnbsd_elfcore_fns = }; static int -ppcnbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) +ppcnbsd_pc_in_sigtramp (CORE_ADDR pc, const char *func_name) { /* FIXME: Need to add support for kernel-provided signal trampolines. */ return (nbsd_pc_in_sigtramp (pc, func_name)); diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 018d7731548..d58ca1f32b9 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -126,7 +126,7 @@ static int display_number; /* Prototypes for exported functions. */ -void output_command (char *, int); +void output_command (const char *, int); void _initialize_printcmd (void); @@ -134,38 +134,38 @@ void _initialize_printcmd (void); static void delete_display (int); -static void enable_display (char *, int); +static void enable_display (const char *, int); -static void disable_display_command (char *, int); +static void disable_display_command (const char *, int); -static void printf_command (char *, int); +static void printf_command (const char *, int); static void print_frame_nameless_args (struct frame_info *, long, int, int, struct ui_file *); -static void display_info (char *, int); +static void display_info (const char *, int); static void do_one_display (struct display *); -static void undisplay_command (char *, int); +static void undisplay_command (const char *, int); static void free_display (struct display *); -static void display_command (char *, int); +static void display_command (const char *, int); -void x_command (char *, int); +void x_command (const char *, int); -static void address_info (char *, int); +static void address_info (const char *, int); -static void set_command (char *, int); +static void set_command (const char *, int); -static void call_command (char *, int); +static void call_command (const char *, int); -static void inspect_command (char *, int); +static void inspect_command (const char *, int); -static void print_command (char *, int); +static void print_command (const char *, int); -static void print_command_1 (char *, int, int); +static void print_command_1 (const char *, int, int); static void validate_format (struct format_data, char *); @@ -174,9 +174,9 @@ static void do_examine (struct format_data, CORE_ADDR addr, static void print_formatted (struct value *, int, int, struct ui_file *); -static struct format_data decode_format (char **, int, int); +static struct format_data decode_format (const char **, int, int); -static void sym_info (char *, int); +static void sym_info (const char *, int); /* Decode a format specification. *STRING_PTR should point to it. @@ -190,10 +190,10 @@ static void sym_info (char *, int); past the specification and past all whitespace following it. */ static struct format_data -decode_format (char **string_ptr, int oformat, int osize) +decode_format (const char **string_ptr, int oformat, int osize) { struct format_data val; - register char *p = *string_ptr; + const char *p = *string_ptr; val.format = '?'; val.size = '?'; @@ -542,8 +542,8 @@ set_next_address (CORE_ADDR addr) settings of the demangle and asm_demangle variables. */ void -print_address_symbolic (CORE_ADDR addr, struct ui_file *stream, int do_demangle, - char *leadin) +print_address_symbolic (CORE_ADDR addr, struct ui_file *stream, + int do_demangle, const char *leadin) { char *name = NULL; char *filename = NULL; @@ -872,7 +872,7 @@ validate_format (struct format_data fmt, char *cmdname) */ static void -print_command_1 (char *exp, int inspect, int voidprint) +print_command_1 (const char *exp, int inspect, int voidprint) { struct expression *expr; register struct cleanup *old_chain = 0; @@ -946,7 +946,7 @@ print_command_1 (char *exp, int inspect, int voidprint) /* ARGSUSED */ static void -print_command (char *exp, int from_tty) +print_command (const char *exp, int from_tty) { print_command_1 (exp, 0, 1); } @@ -954,7 +954,7 @@ print_command (char *exp, int from_tty) /* Same as print, except in epoch, it gets its own window */ /* ARGSUSED */ static void -inspect_command (char *exp, int from_tty) +inspect_command (const char *exp, int from_tty) { extern int epoch_interface; @@ -964,14 +964,14 @@ inspect_command (char *exp, int from_tty) /* Same as print, except it doesn't print void results. */ /* ARGSUSED */ static void -call_command (char *exp, int from_tty) +call_command (const char *exp, int from_tty) { print_command_1 (exp, 0, 0); } /* ARGSUSED */ void -output_command (char *exp, int from_tty) +output_command (const char *exp, int from_tty) { struct expression *expr; register struct cleanup *old_chain; @@ -1006,7 +1006,7 @@ output_command (char *exp, int from_tty) /* ARGSUSED */ static void -set_command (char *exp, int from_tty) +set_command (const char *exp, int from_tty) { struct expression *expr = parse_expression (exp); register struct cleanup *old_chain = @@ -1017,7 +1017,7 @@ set_command (char *exp, int from_tty) /* ARGSUSED */ static void -sym_info (char *arg, int from_tty) +sym_info (const char *arg, int from_tty) { struct minimal_symbol *msymbol; struct objfile *objfile; @@ -1062,7 +1062,7 @@ sym_info (char *arg, int from_tty) /* ARGSUSED */ static void -address_info (char *exp, int from_tty) +address_info (const char *exp, int from_tty) { register struct symbol *sym; register struct minimal_symbol *msymbol; @@ -1283,7 +1283,7 @@ address_info (char *exp, int from_tty) } void -x_command (char *exp, int from_tty) +x_command (const char *exp, int from_tty) { struct expression *expr; struct format_data fmt; @@ -1360,7 +1360,7 @@ x_command (char *exp, int from_tty) Specify the expression. */ static void -display_command (char *exp, int from_tty) +display_command (const char *exp, int from_tty) { struct format_data fmt; register struct expression *expr; @@ -1477,10 +1477,10 @@ delete_display (int num) Specify the element numbers. */ static void -undisplay_command (char *args, int from_tty) +undisplay_command (const char *args, int from_tty) { - register char *p = args; - register char *p1; + const char *p = args; + const char *p1; register int num; if (args == 0) @@ -1638,7 +1638,7 @@ disable_current_display (void) } static void -display_info (char *ignore, int from_tty) +display_info (const char *ignore, int from_tty) { register struct display *d; @@ -1665,10 +1665,10 @@ Num Enb Expression\n"); } static void -enable_display (char *args, int from_tty) +enable_display (const char *args, int from_tty) { - register char *p = args; - register char *p1; + const char *p = args; + const char *p1; register int num; register struct display *d; @@ -1704,10 +1704,10 @@ enable_display (char *args, int from_tty) /* ARGSUSED */ static void -disable_display_command (char *args, int from_tty) +disable_display_command (const char *args, int from_tty) { - register char *p = args; - register char *p1; + const char *p = args; + const char *p1; register struct display *d; if (p == 0) @@ -1969,10 +1969,10 @@ print_frame_nameless_args (struct frame_info *fi, long start, int num, /* ARGSUSED */ static void -printf_command (char *arg, int from_tty) +printf_command (const char *arg, int from_tty) { register char *f = NULL; - register char *s = arg; + const char *s = arg; char *string = NULL; struct value **val_args; char *substrings; @@ -2144,7 +2144,7 @@ printf_command (char *arg, int from_tty) while (*s != '\0') { - char *s1; + const char *s1; if (nargs == allocated_args) val_args = (struct value **) xrealloc ((char *) val_args, (allocated_args *= 2) diff --git a/gdb/regcache.c b/gdb/regcache.c index acf3044fa3c..0f6ac92b0e4 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -1410,7 +1410,7 @@ deprecated_read_fp (void) /* ARGSUSED */ static void -reg_flush_command (char *command, int from_tty) +reg_flush_command (const char *command, int from_tty) { /* Force-flush the register cache. */ registers_changed (); @@ -1659,7 +1659,7 @@ regcache_dump (struct regcache *regcache, struct ui_file *file, } static void -regcache_print (char *args, enum regcache_dump_what what_to_dump) +regcache_print (const char *args, enum regcache_dump_what what_to_dump) { if (args == NULL) regcache_dump (current_regcache, gdb_stdout, what_to_dump); @@ -1674,25 +1674,25 @@ regcache_print (char *args, enum regcache_dump_what what_to_dump) } static void -maintenance_print_registers (char *args, int from_tty) +maintenance_print_registers (const char *args, int from_tty) { regcache_print (args, regcache_dump_none); } static void -maintenance_print_raw_registers (char *args, int from_tty) +maintenance_print_raw_registers (const char *args, int from_tty) { regcache_print (args, regcache_dump_raw); } static void -maintenance_print_cooked_registers (char *args, int from_tty) +maintenance_print_cooked_registers (const char *args, int from_tty) { regcache_print (args, regcache_dump_cooked); } static void -maintenance_print_register_groups (char *args, int from_tty) +maintenance_print_register_groups (const char *args, int from_tty) { regcache_print (args, regcache_dump_groups); } diff --git a/gdb/reggroups.c b/gdb/reggroups.c index b72140eadee..071942becc4 100644 --- a/gdb/reggroups.c +++ b/gdb/reggroups.c @@ -214,7 +214,7 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file) } static void -maintenance_print_reggroups (char *args, int from_tty) +maintenance_print_reggroups (const char *args, int from_tty) { if (args == NULL) reggroups_dump (current_gdbarch, gdb_stdout); diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index f7b9e89b0ba..878c3f690e0 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -80,15 +80,15 @@ static void gdbsim_store_register (int regno); static void gdbsim_kill (void); -static void gdbsim_load (char *prog, int fromtty); +static void gdbsim_load (const char *prog, int fromtty); static void gdbsim_create_inferior (char *exec_file, char *args, char **env); -static void gdbsim_open (char *args, int from_tty); +static void gdbsim_open (const char *args, int from_tty); static void gdbsim_close (int quitting); -static void gdbsim_detach (char *args, int from_tty); +static void gdbsim_detach (const char *args, int from_tty); static void gdbsim_resume (ptid_t ptid, int step, enum target_signal siggnal); @@ -107,7 +107,7 @@ static void gdbsim_mourn_inferior (void); static void gdbsim_stop (void); -void simulator_command (char *args, int from_tty); +void simulator_command (const char *args, int from_tty); /* Naming convention: @@ -399,7 +399,7 @@ gdbsim_kill (void) GDB's symbol tables to match. */ static void -gdbsim_load (char *prog, int fromtty) +gdbsim_load (const char *prog, int fromtty) { if (sr_get_debug ()) printf_filtered ("gdbsim_load: prog \"%s\"\n", prog); @@ -477,7 +477,7 @@ gdbsim_create_inferior (char *exec_file, char *args, char **env) /* Called when selecting the simulator. EG: (gdb) target sim name. */ static void -gdbsim_open (char *args, int from_tty) +gdbsim_open (const char *args, int from_tty) { int len; char *arg_buf; @@ -585,7 +585,7 @@ gdbsim_close (int quitting) Use this when you want to detach and do something else with your gdb. */ static void -gdbsim_detach (char *args, int from_tty) +gdbsim_detach (const char *args, int from_tty) { if (sr_get_debug ()) printf_filtered ("gdbsim_detach: args \"%s\"\n", args); @@ -827,7 +827,7 @@ gdbsim_remove_breakpoint (CORE_ADDR addr, char *contents_cache) simulator must do any command interpretation work. */ void -simulator_command (char *args, int from_tty) +simulator_command (const char *args, int from_tty) { if (gdbsim_desc == NULL) { diff --git a/gdb/remote-utils.c b/gdb/remote-utils.c index ba150e34d5d..3c843f94c6f 100644 --- a/gdb/remote-utils.c +++ b/gdb/remote-utils.c @@ -77,7 +77,7 @@ struct _sr_settings sr_settings = struct gr_settings *gr_settings = NULL; static void usage (char *, char *); -static void sr_com (char *, int); +static void sr_com (const char *, int); static void usage (char *proto, char *junk) @@ -277,7 +277,7 @@ sr_expect (char *string) } void -sr_write (char *a, int l) +sr_write (const char *a, int l) { int i; @@ -292,7 +292,7 @@ sr_write (char *a, int l) } void -sr_write_cr (char *s) +sr_write_cr (const char *s) { sr_write (s, strlen (s)); sr_write ("\r", 1); @@ -376,7 +376,7 @@ sr_get_hex_word (void) FIXME: Can't handle commands that take input. */ static void -sr_com (char *args, int fromtty) +sr_com (const char *args, int fromtty) { sr_check_open (); diff --git a/gdb/remote-utils.h b/gdb/remote-utils.h index cae5d5e238d..8b44f3e2a41 100644 --- a/gdb/remote-utils.h +++ b/gdb/remote-utils.h @@ -127,8 +127,8 @@ void gr_prepare_to_store (void); void sr_expect (char *string); void sr_get_hex_byte (char *byt); void sr_scan_args (char *proto, char *args); -void sr_write (char *a, int l); -void sr_write_cr (char *s); +void sr_write (const char *a, int l); +void sr_write_cr (const char *s); void gr_open (char *args, int from_tty, struct gr_settings *gr_settings); void gr_load_image (char *, int from_tty); diff --git a/gdb/remote.c b/gdb/remote.c index 20becee27d6..efb9b94998e 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -88,14 +88,14 @@ static void remote_async_resume (ptid_t ptid, int step, enum target_signal siggnal); static int remote_start_remote (struct ui_out *uiout, void *dummy); -static void remote_open (char *name, int from_tty); -static void remote_async_open (char *name, int from_tty); +static void remote_open (const char *name, int from_tty); +static void remote_async_open (const char *name, int from_tty); -static void extended_remote_open (char *name, int from_tty); -static void extended_remote_async_open (char *name, int from_tty); +static void extended_remote_open (const char *name, int from_tty); +static void extended_remote_async_open (const char *name, int from_tty); -static void remote_open_1 (char *, int, struct target_ops *, int extended_p, - int async_p); +static void remote_open_1 (const char *, int, struct target_ops *, + int extended_p, int async_p); static void remote_close (int quitting); @@ -127,8 +127,8 @@ static void remote_async_kill (void); static int tohex (int nib); -static void remote_detach (char *args, int from_tty); -static void remote_async_detach (char *args, int from_tty); +static void remote_detach (const char *args, int from_tty); +static void remote_async_detach (const char *args, int from_tty); static void remote_interrupt (int signo); @@ -172,13 +172,13 @@ static int hexnumnstr (char *, ULONGEST, int); static CORE_ADDR remote_address_masked (CORE_ADDR); -static void print_packet (char *); +static void print_packet (const char *); static unsigned long crc32 (unsigned char *, int, unsigned int); -static void compare_sections_command (char *, int); +static void compare_sections_command (const char *, int); -static void packet_command (char *, int); +static void packet_command (const char *, int); static int stub_unpack_int (char *buff, int fieldlength); @@ -194,7 +194,7 @@ static int hex2bin (const char *hex, char *bin, int count); static int bin2hex (const char *bin, char *hex, int count); -static int putpkt_binary (char *buf, int cnt); +static int putpkt_binary (const char *buf, int cnt); static void check_binary_download (CORE_ADDR addr); @@ -468,7 +468,7 @@ get_memory_packet_size (struct memory_packet_config *config) something really big then do a sanity check. */ static void -set_memory_packet_size (char *args, struct memory_packet_config *config) +set_memory_packet_size (const char *args, struct memory_packet_config *config) { int fixed_p = config->fixed_p; long size = config->size; @@ -526,13 +526,13 @@ static struct memory_packet_config memory_write_packet_config = }; static void -set_memory_write_packet_size (char *args, int from_tty) +set_memory_write_packet_size (const char *args, int from_tty) { set_memory_packet_size (args, &memory_write_packet_config); } static void -show_memory_write_packet_size (char *args, int from_tty) +show_memory_write_packet_size (const char *args, int from_tty) { show_memory_packet_size (&memory_write_packet_config); } @@ -549,13 +549,13 @@ static struct memory_packet_config memory_read_packet_config = }; static void -set_memory_read_packet_size (char *args, int from_tty) +set_memory_read_packet_size (const char *args, int from_tty) { set_memory_packet_size (args, &memory_read_packet_config); } static void -show_memory_read_packet_size (char *args, int from_tty) +show_memory_read_packet_size (const char *args, int from_tty) { show_memory_packet_size (&memory_read_packet_config); } @@ -759,14 +759,14 @@ packet_ok (const char *buf, struct packet_config *config) static struct packet_config remote_protocol_qSymbol; static void -set_remote_protocol_qSymbol_packet_cmd (char *args, int from_tty, - struct cmd_list_element *c) +set_remote_protocol_qSymbol_packet_cmd (const char *args, int from_tty, + struct cmd_list_element *c) { update_packet_config (&remote_protocol_qSymbol); } static void -show_remote_protocol_qSymbol_packet_cmd (char *args, int from_tty, +show_remote_protocol_qSymbol_packet_cmd (const char *args, int from_tty, struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_qSymbol); @@ -776,14 +776,14 @@ show_remote_protocol_qSymbol_packet_cmd (char *args, int from_tty, static struct packet_config remote_protocol_e; static void -set_remote_protocol_e_packet_cmd (char *args, int from_tty, +set_remote_protocol_e_packet_cmd (const char *args, int from_tty, struct cmd_list_element *c) { update_packet_config (&remote_protocol_e); } static void -show_remote_protocol_e_packet_cmd (char *args, int from_tty, +show_remote_protocol_e_packet_cmd (const char *args, int from_tty, struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_e); @@ -794,14 +794,14 @@ show_remote_protocol_e_packet_cmd (char *args, int from_tty, static struct packet_config remote_protocol_E; static void -set_remote_protocol_E_packet_cmd (char *args, int from_tty, +set_remote_protocol_E_packet_cmd (const char *args, int from_tty, struct cmd_list_element *c) { update_packet_config (&remote_protocol_E); } static void -show_remote_protocol_E_packet_cmd (char *args, int from_tty, +show_remote_protocol_E_packet_cmd (const char *args, int from_tty, struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_E); @@ -813,14 +813,14 @@ show_remote_protocol_E_packet_cmd (char *args, int from_tty, static struct packet_config remote_protocol_P; static void -set_remote_protocol_P_packet_cmd (char *args, int from_tty, +set_remote_protocol_P_packet_cmd (const char *args, int from_tty, struct cmd_list_element *c) { update_packet_config (&remote_protocol_P); } static void -show_remote_protocol_P_packet_cmd (char *args, int from_tty, +show_remote_protocol_P_packet_cmd (const char *args, int from_tty, struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_P); @@ -844,70 +844,70 @@ static struct packet_config remote_protocol_Z[NR_Z_PACKET_TYPES]; command callback should include a context argument. */ static void -set_remote_protocol_Z_software_bp_packet_cmd (char *args, int from_tty, +set_remote_protocol_Z_software_bp_packet_cmd (const char *args, int from_tty, struct cmd_list_element *c) { update_packet_config (&remote_protocol_Z[Z_PACKET_SOFTWARE_BP]); } static void -show_remote_protocol_Z_software_bp_packet_cmd (char *args, int from_tty, +show_remote_protocol_Z_software_bp_packet_cmd (const char *args, int from_tty, struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_SOFTWARE_BP]); } static void -set_remote_protocol_Z_hardware_bp_packet_cmd (char *args, int from_tty, +set_remote_protocol_Z_hardware_bp_packet_cmd (const char *args, int from_tty, struct cmd_list_element *c) { update_packet_config (&remote_protocol_Z[Z_PACKET_HARDWARE_BP]); } static void -show_remote_protocol_Z_hardware_bp_packet_cmd (char *args, int from_tty, +show_remote_protocol_Z_hardware_bp_packet_cmd (const char *args, int from_tty, struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_HARDWARE_BP]); } static void -set_remote_protocol_Z_write_wp_packet_cmd (char *args, int from_tty, - struct cmd_list_element *c) +set_remote_protocol_Z_write_wp_packet_cmd (const char *args, int from_tty, + struct cmd_list_element *c) { update_packet_config (&remote_protocol_Z[Z_PACKET_WRITE_WP]); } static void -show_remote_protocol_Z_write_wp_packet_cmd (char *args, int from_tty, +show_remote_protocol_Z_write_wp_packet_cmd (const char *args, int from_tty, struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_WRITE_WP]); } static void -set_remote_protocol_Z_read_wp_packet_cmd (char *args, int from_tty, - struct cmd_list_element *c) +set_remote_protocol_Z_read_wp_packet_cmd (const char *args, int from_tty, + struct cmd_list_element *c) { update_packet_config (&remote_protocol_Z[Z_PACKET_READ_WP]); } static void -show_remote_protocol_Z_read_wp_packet_cmd (char *args, int from_tty, +show_remote_protocol_Z_read_wp_packet_cmd (const char *args, int from_tty, struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_READ_WP]); } static void -set_remote_protocol_Z_access_wp_packet_cmd (char *args, int from_tty, - struct cmd_list_element *c) +set_remote_protocol_Z_access_wp_packet_cmd (const char *args, int from_tty, + struct cmd_list_element *c) { update_packet_config (&remote_protocol_Z[Z_PACKET_ACCESS_WP]); } static void -show_remote_protocol_Z_access_wp_packet_cmd (char *args, int from_tty, +show_remote_protocol_Z_access_wp_packet_cmd (const char *args, int from_tty, struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_ACCESS_WP]); @@ -919,7 +919,7 @@ show_remote_protocol_Z_access_wp_packet_cmd (char *args, int from_tty, static enum auto_boolean remote_Z_packet_detect; static void -set_remote_protocol_Z_packet_cmd (char *args, int from_tty, +set_remote_protocol_Z_packet_cmd (const char *args, int from_tty, struct cmd_list_element *c) { int i; @@ -931,7 +931,7 @@ set_remote_protocol_Z_packet_cmd (char *args, int from_tty, } static void -show_remote_protocol_Z_packet_cmd (char *args, int from_tty, +show_remote_protocol_Z_packet_cmd (const char *args, int from_tty, struct cmd_list_element *c) { int i; @@ -965,7 +965,7 @@ static int use_threadinfo_query; static int use_threadextra_query; static void -set_remote_protocol_binary_download_cmd (char *args, +set_remote_protocol_binary_download_cmd (const char *args, int from_tty, struct cmd_list_element *c) { @@ -973,7 +973,7 @@ set_remote_protocol_binary_download_cmd (char *args, } static void -show_remote_protocol_binary_download_cmd (char *args, int from_tty, +show_remote_protocol_binary_download_cmd (const char *args, int from_tty, struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_binary_download); @@ -2153,14 +2153,14 @@ remote_start_remote (struct ui_out *uiout, void *dummy) NAME is the filename used for communication. */ static void -remote_open (char *name, int from_tty) +remote_open (const char *name, int from_tty) { remote_open_1 (name, from_tty, &remote_ops, 0, 0); } /* Just like remote_open, but with asynchronous support. */ static void -remote_async_open (char *name, int from_tty) +remote_async_open (const char *name, int from_tty) { remote_open_1 (name, from_tty, &remote_async_ops, 0, 1); } @@ -2169,7 +2169,7 @@ remote_async_open (char *name, int from_tty) remote gdb protocol. NAME is the filename used for communication. */ static void -extended_remote_open (char *name, int from_tty) +extended_remote_open (const char *name, int from_tty) { remote_open_1 (name, from_tty, &extended_remote_ops, 1 /*extended_p */, 0 /* async_p */); @@ -2177,7 +2177,7 @@ extended_remote_open (char *name, int from_tty) /* Just like extended_remote_open, but with asynchronous support. */ static void -extended_remote_async_open (char *name, int from_tty) +extended_remote_async_open (const char *name, int from_tty) { remote_open_1 (name, from_tty, &extended_async_remote_ops, 1 /*extended_p */, 1 /* async_p */); @@ -2240,7 +2240,7 @@ remote_check_symbols (struct objfile *objfile) } static struct serial * -remote_serial_open (char *name) +remote_serial_open (const char *name) { static int udp_warning = 0; @@ -2260,7 +2260,7 @@ remote_serial_open (char *name) } static void -remote_open_1 (char *name, int from_tty, struct target_ops *target, +remote_open_1 (const char *name, int from_tty, struct target_ops *target, int extended_p, int async_p) { int ex; @@ -2403,7 +2403,7 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target, die when it hits one. */ static void -remote_detach (char *args, int from_tty) +remote_detach (const char *args, int from_tty) { struct remote_state *rs = get_remote_state (); char *buf = alloca (rs->remote_packet_size); @@ -2423,7 +2423,7 @@ remote_detach (char *args, int from_tty) /* Same as remote_detach, but with async support. */ static void -remote_async_detach (char *args, int from_tty) +remote_async_detach (const char *args, int from_tty) { struct remote_state *rs = get_remote_state (); char *buf = alloca (rs->remote_packet_size); @@ -4109,7 +4109,7 @@ remote_send (char *buf, string notation. */ static void -print_packet (char *buf) +print_packet (const char *buf) { puts_filtered ("\""); fputstr_filtered (buf, '"', gdb_stdout); @@ -4117,7 +4117,7 @@ print_packet (char *buf) } int -putpkt (char *buf) +putpkt (const char *buf) { return putpkt_binary (buf, strlen (buf)); } @@ -4128,7 +4128,7 @@ putpkt (char *buf) debugging (remote_debug) and want to print the sent packet as a string */ static int -putpkt_binary (char *buf, int cnt) +putpkt_binary (const char *buf, int cnt) { struct remote_state *rs = get_remote_state (); int i; @@ -5029,7 +5029,7 @@ crc32 (unsigned char *buf, int len, unsigned int crc) generic_load()) to make use of this target functionality. */ static void -compare_sections_command (char *args, int from_tty) +compare_sections_command (const char *args, int from_tty) { struct remote_state *rs = get_remote_state (); asection *s; @@ -5173,7 +5173,7 @@ remote_query (int query_type, char *buf, char *outbuf, int *bufsiz) } static void -remote_rcmd (char *command, +remote_rcmd (const char *command, struct ui_file *outbuf) { struct remote_state *rs = get_remote_state (); @@ -5231,7 +5231,7 @@ remote_rcmd (char *command, } static void -packet_command (char *args, int from_tty) +packet_command (const char *args, int from_tty) { struct remote_state *rs = get_remote_state (); char *buf = alloca (rs->remote_packet_size); @@ -5258,26 +5258,26 @@ packet_command (char *args, int from_tty) static void display_thread_info (struct gdb_ext_thread_info *info); -static void threadset_test_cmd (char *cmd, int tty); +static void threadset_test_cmd (const char *cmd, int tty); -static void threadalive_test (char *cmd, int tty); +static void threadalive_test (const char *cmd, int tty); -static void threadlist_test_cmd (char *cmd, int tty); +static void threadlist_test_cmd (const char *cmd, int tty); int get_and_display_threadinfo (threadref * ref); -static void threadinfo_test_cmd (char *cmd, int tty); +static void threadinfo_test_cmd (const char *cmd, int tty); static int thread_display_step (threadref * ref, void *context); -static void threadlist_update_test_cmd (char *cmd, int tty); +static void threadlist_update_test_cmd (const char *cmd, int tty); static void init_remote_threadtests (void); #define SAMPLE_THREAD 0x05060708 /* Truncated 64 bit threadid */ static void -threadset_test_cmd (char *cmd, int tty) +threadset_test_cmd (const char *cmd, int tty) { int sample_thread = SAMPLE_THREAD; @@ -5310,7 +5310,7 @@ output_threadid (char *title, threadref *ref) } static void -threadlist_test_cmd (char *cmd, int tty) +threadlist_test_cmd (const char *cmd, int tty) { int startflag = 1; threadref nextthread; @@ -5355,7 +5355,7 @@ get_and_display_threadinfo (threadref *ref) } static void -threadinfo_test_cmd (char *cmd, int tty) +threadinfo_test_cmd (const char *cmd, int tty) { int athread = SAMPLE_THREAD; threadref thread; @@ -5375,7 +5375,7 @@ thread_display_step (threadref *ref, void *context) } static void -threadlist_update_test_cmd (char *cmd, int tty) +threadlist_update_test_cmd (const char *cmd, int tty) { printf_filtered ("Remote Threadlist update test\n"); remote_threadlist_iterator (thread_display_step, 0, CRAZY_MAX_THREADS); @@ -5493,7 +5493,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya).", */ static void -remote_info_process (char *args, int from_tty) +remote_info_process (const char *args, int from_tty) { struct remote_state *rs = get_remote_state (); char *buf = alloca (rs->remote_packet_size); @@ -5522,7 +5522,7 @@ remote_info_process (char *args, int from_tty) */ static void -remote_cisco_open (char *name, int from_tty) +remote_cisco_open (const char *name, int from_tty) { int ex; if (name == 0) @@ -6000,12 +6000,12 @@ Specify the serial device it is connected to (e.g. /dev/ttya).", } static void -set_remote_cmd (char *args, int from_tty) +set_remote_cmd (const char *args, int from_tty) { } static void -show_remote_cmd (char *args, int from_tty) +show_remote_cmd (const char *args, int from_tty) { /* FIXME: cagney/2002-06-15: This function should iterate over remote_show_cmdlist for a list of sub commands to show. */ diff --git a/gdb/remote.h b/gdb/remote.h index 4477148f9c8..df6d7bc5790 100644 --- a/gdb/remote.h +++ b/gdb/remote.h @@ -36,7 +36,7 @@ extern void getpkt (char *buf, long sizeof_buf, int forever); we are debugging (remote_debug) and want to print the sent packet as a string */ -extern int putpkt (char *buf); +extern int putpkt (const char *buf); /* Send HEX encoded string to the target console. (gdb_stdtarg) */ diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 0b239bd4180..08c97a1256a 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1269,7 +1269,7 @@ ran_out_of_registers_for_arguments: write_register (SP_REGNUM, sp); /* set back chain properly */ - store_address (tmp_buffer, 4, saved_sp); + store_unsigned_integer (tmp_buffer, 4, saved_sp); write_memory (sp, tmp_buffer, 4); target_store_registers (-1); @@ -1415,7 +1415,7 @@ rs6000_extract_return_value (struct type *valtype, char *regbuf, char *valbuf) in handle_inferior_event() to skip past @FIX code. */ int -rs6000_in_solib_return_trampoline (CORE_ADDR pc, char *name) +rs6000_in_solib_return_trampoline (CORE_ADDR pc, const char *name) { return name && !strncmp (name, "@FIX", 4); } @@ -2985,7 +2985,7 @@ rs6000_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) static struct cmd_list_element *info_powerpc_cmdlist = NULL; static void -rs6000_info_powerpc_command (char *args, int from_tty) +rs6000_info_powerpc_command (const char *args, int from_tty) { help_list (info_powerpc_cmdlist, "info powerpc ", class_info, gdb_stdout); } diff --git a/gdb/serial.c b/gdb/serial.c index ada5631dce9..c889ba7b7bd 100644 --- a/gdb/serial.c +++ b/gdb/serial.c @@ -652,14 +652,14 @@ static struct cmd_list_element *serial_set_cmdlist; static struct cmd_list_element *serial_show_cmdlist; static void -serial_set_cmd (char *args, int from_tty) +serial_set_cmd (const char *args, int from_tty) { printf_unfiltered ("\"set serial\" must be followed by the name of a command.\n"); help_list (serial_set_cmdlist, "set serial ", -1, gdb_stdout); } static void -serial_show_cmd (char *args, int from_tty) +serial_show_cmd (const char *args, int from_tty) { cmd_show_list (serial_show_cmdlist, from_tty, ""); } diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 0ef65de2c02..1c7a1dd2532 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1873,8 +1873,8 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, if (regnum == SP_REGNUM) { if (raw_buffer) /* SP register treated specially */ - store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), - get_frame_saved_regs (frame)[regnum]); + store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), + get_frame_saved_regs (frame)[regnum]); } else { /* any other register */ diff --git a/gdb/shnbsd-tdep.c b/gdb/shnbsd-tdep.c index f915d2aa657..7928dfda8ca 100644 --- a/gdb/shnbsd-tdep.c +++ b/gdb/shnbsd-tdep.c @@ -167,7 +167,7 @@ static struct core_fns shnbsd_elfcore_fns = }; static int -shnbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) +shnbsd_pc_in_sigtramp (CORE_ADDR pc, const char *func_name) { /* FIXME: Need to add support for kernel-provided signal trampolines. */ return (nbsd_pc_in_sigtramp (pc, func_name)); diff --git a/gdb/signals/signals.c b/gdb/signals/signals.c index ca46a9ed1c7..622c38a7ec7 100644 --- a/gdb/signals/signals.c +++ b/gdb/signals/signals.c @@ -240,7 +240,7 @@ target_signal_to_name (enum target_signal sig) /* Given a name, return its signal. */ enum target_signal -target_signal_from_name (char *name) +target_signal_from_name (const char *name) { enum target_signal sig; diff --git a/gdb/solib.c b/gdb/solib.c index 289b84f34bf..43655e6265e 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -537,7 +537,8 @@ update_solib_list (int from_tty, struct target_ops *target) FROM_TTY and TARGET are as described for update_solib_list, above. */ void -solib_add (char *pattern, int from_tty, struct target_ops *target, int readsyms) +solib_add (const char *pattern, int from_tty, struct target_ops *target, + int readsyms) { struct so_list *gdb; @@ -618,7 +619,7 @@ solib_add (char *pattern, int from_tty, struct target_ops *target, int readsyms) */ static void -info_sharedlibrary_command (char *ignore, int from_tty) +info_sharedlibrary_command (const char *ignore, int from_tty) { register struct so_list *so = NULL; /* link map state variable */ int header_done = 0; @@ -824,7 +825,7 @@ in_solib_dynsym_resolve_code (CORE_ADDR pc) */ static void -sharedlibrary_command (char *args, int from_tty) +sharedlibrary_command (const char *args, int from_tty) { dont_repeat (); solib_add (args, from_tty, (struct target_ops *) 0, 1); @@ -843,14 +844,14 @@ sharedlibrary_command (char *args, int from_tty) are not discarded. Also called from remote.c. */ void -no_shared_libraries (char *ignored, int from_tty) +no_shared_libraries (const char *ignored, int from_tty) { objfile_purge_solibs (); do_clear_solib (NULL); } static void -reload_shared_libraries (char *ignored, int from_tty) +reload_shared_libraries (const char *ignored, int from_tty) { no_shared_libraries (NULL, from_tty); solib_add (NULL, from_tty, NULL, auto_solib_add); diff --git a/gdb/solib.h b/gdb/solib.h index 04be72da465..06b335c07b0 100644 --- a/gdb/solib.h +++ b/gdb/solib.h @@ -37,7 +37,7 @@ extern void clear_solib (void); #define SOLIB_ADD(filename, from_tty, targ, readsyms) \ solib_add (filename, from_tty, targ, readsyms) -extern void solib_add (char *, int, struct target_ops *, int); +extern void solib_add (const char *, int, struct target_ops *, int); /* Function to be called when the inferior starts up, to discover the names of shared libraries that are dynamically linked, the base addresses to @@ -199,6 +199,6 @@ extern int in_solib_dynsym_resolve_code (CORE_ADDR); /* solib.c */ /* Discard symbols that were auto-loaded from shared libraries. */ -extern void no_shared_libraries (char *ignored, int from_tty); +extern void no_shared_libraries (const char *ignored, int from_tty); #endif /* SOLIB_H */ diff --git a/gdb/source.c b/gdb/source.c index c2269fadcd5..eaf035d28c4 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -74,17 +74,17 @@ void _initialize_source (void); static int get_filename_and_charpos (struct symtab *, char **); -static void reverse_search_command (char *, int); +static void reverse_search_command (const char *, int); -static void forward_search_command (char *, int); +static void forward_search_command (const char *, int); -static void line_info (char *, int); +static void line_info (const char *, int); static void ambiguous_line_spec (struct symtabs_and_lines *); -static void source_info (char *, int); +static void source_info (const char *, int); -static void show_directories (char *, int); +static void show_directories (const char *, int); /* Path of directories to search for source files. Same format as the PATH environment variable's value. */ @@ -303,7 +303,7 @@ select_source_symtab (register struct symtab *s) } static void -show_directories (char *ignore, int from_tty) +show_directories (const char *ignore, int from_tty) { puts_filtered ("Source directories searched: "); puts_filtered (source_path); @@ -367,7 +367,7 @@ init_last_source_visited (void) /* Add zero or more directories to the front of the source path. */ void -directory_command (char *dirname, int from_tty) +directory_command (const char *dirname, int from_tty) { dont_repeat (); /* FIXME, this goes to "delete dir"... */ @@ -392,7 +392,7 @@ directory_command (char *dirname, int from_tty) /* Add zero or more directories to the front of an arbitrary path. */ void -mod_path (char *dirname, char **which_path) +mod_path (const char *dirname, char **which_path) { add_path (dirname, which_path, 1); } @@ -404,15 +404,16 @@ mod_path (char *dirname, char **which_path) as space or tab. */ void -add_path (char *dirname, char **which_path, int parse_separators) +add_path (const char *dir, char **which_path, int parse_separators) { + char *dirname; char *old = *which_path; int prefix = 0; - if (dirname == 0) + if (dir == NULL) return; - dirname = xstrdup (dirname); + dirname = xstrdup (dir); make_cleanup (xfree, dirname); do @@ -592,7 +593,7 @@ add_path (char *dirname, char **which_path, int parse_separators) static void -source_info (char *ignore, int from_tty) +source_info (const char *ignore, int from_tty) { register struct symtab *s = current_source_symtab; @@ -1251,7 +1252,7 @@ ambiguous_line_spec (struct symtabs_and_lines *sals) /* Print info on range of pc's in a specified line. */ static void -line_info (char *arg, int from_tty) +line_info (const char *arg, int from_tty) { struct symtabs_and_lines sals; struct symtab_and_line sal; @@ -1349,7 +1350,7 @@ line_info (char *arg, int from_tty) /* ARGSUSED */ static void -forward_search_command (char *regex, int from_tty) +forward_search_command (const char *regex, int from_tty) { register int c; register int desc; @@ -1445,7 +1446,7 @@ forward_search_command (char *regex, int from_tty) /* ARGSUSED */ static void -reverse_search_command (char *regex, int from_tty) +reverse_search_command (const char *regex, int from_tty) { register int c; register int desc; diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 7f0ae4b2046..cf5d9c5ec0b 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -859,7 +859,7 @@ sparc_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, if (raw_buffer != NULL) { /* Put it back in target format. */ - store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), get_frame_pc (frame)); + store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), get_frame_pc (frame)); } if (addrp != NULL) *addrp = 0; @@ -967,7 +967,7 @@ sparc_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, if (raw_buffer != NULL) { /* Put it back in target format. */ - store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), addr); + store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), addr); } if (addrp != NULL) *addrp = 0; diff --git a/gdb/stack.c b/gdb/stack.c index 0a0aaac2a75..d5c75d70164 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -43,41 +43,41 @@ /* Prototypes for exported functions. */ -void args_info (char *, int); +void args_info (const char *, int); -void locals_info (char *, int); +void locals_info (const char *, int); void (*selected_frame_level_changed_hook) (int); void _initialize_stack (void); -void return_command (char *, int); +void return_command (const char *, int); /* Prototypes for local functions. */ -static void down_command (char *, int); +static void down_command (const char *, int); -static void down_silently_base (char *); +static void down_silently_base (const char *); -static void down_silently_command (char *, int); +static void down_silently_command (const char *, int); -static void up_command (char *, int); +static void up_command (const char *, int); -static void up_silently_base (char *); +static void up_silently_base (const char *); -static void up_silently_command (char *, int); +static void up_silently_command (const char *, int); -void frame_command (char *, int); +void frame_command (const char *, int); -static void current_frame_command (char *, int); +static void current_frame_command (const char *, int); -static void select_frame_command (char *, int); +static void select_frame_command (const char *, int); static void print_frame_arg_vars (struct frame_info *, struct ui_file *); -static void catch_info (char *, int); +static void catch_info (const char *, int); -static void args_plus_locals_info (char *, int); +static void args_plus_locals_info (const char *, int); static void print_frame_label_vars (struct frame_info *, int, struct ui_file *); @@ -99,11 +99,11 @@ static void print_frame (struct frame_info *fi, int args, struct symtab_and_line sal); -static void backtrace_command (char *, int); +static void backtrace_command (const char *, int); -struct frame_info *parse_frame_specification (char *); +struct frame_info *parse_frame_specification (const char *); -static void frame_info (char *, int); +static void frame_info (const char *, int); extern int addressprint; /* Print addresses, or stay symbolic only? */ @@ -486,7 +486,7 @@ show_stack_frame (struct frame_info *fi) this function never returns NULL). */ struct frame_info * -parse_frame_specification (char *frame_exp) +parse_frame_specification (const char *frame_exp) { int numargs = 0; #define MAXARGS 4 @@ -495,7 +495,8 @@ parse_frame_specification (char *frame_exp) if (frame_exp) { - char *addr_string, *p; + char *addr_string; + const char *p; struct cleanup *tmp_cleanup; while (*frame_exp == ' ') @@ -604,7 +605,7 @@ parse_frame_specification (char *frame_exp) This means absolutely all information in the frame is printed. */ static void -frame_info (char *addr_exp, int from_tty) +frame_info (const char *addr_exp, int from_tty) { struct frame_info *fi; struct symtab_and_line sal; @@ -897,10 +898,10 @@ backtrace_limit_info (char *arg, int from_tty) /* Print briefly all stack frames or just the innermost COUNT frames. */ -static void backtrace_command_1 (char *count_exp, int show_locals, +static void backtrace_command_1 (const char *count_exp, int show_locals, int from_tty); static void -backtrace_command_1 (char *count_exp, int show_locals, int from_tty) +backtrace_command_1 (const char *count_exp, int show_locals, int from_tty) { struct frame_info *fi; register int count; @@ -997,12 +998,12 @@ backtrace_command_1 (char *count_exp, int show_locals, int from_tty) } static void -backtrace_command (char *arg, int from_tty) +backtrace_command (const char *arg, int from_tty) { struct cleanup *old_chain = (struct cleanup *) NULL; char **argv = (char **) NULL; int argIndicatingFullTrace = (-1), totArgLen = 0, argc = 0; - char *argPtr = arg; + const char *argPtr = arg; if (arg != (char *) NULL) { @@ -1061,9 +1062,9 @@ backtrace_command (char *arg, int from_tty) do_cleanups (old_chain); } -static void backtrace_full_command (char *arg, int from_tty); +static void backtrace_full_command (const char *arg, int from_tty); static void -backtrace_full_command (char *arg, int from_tty) +backtrace_full_command (const char *arg, int from_tty) { backtrace_command_1 (arg, 1, from_tty); } @@ -1253,7 +1254,7 @@ print_frame_label_vars (register struct frame_info *fi, int this_level_only, /* ARGSUSED */ void -locals_info (char *args, int from_tty) +locals_info (const char *args, int from_tty) { if (!deprecated_selected_frame) error ("No frame selected."); @@ -1261,7 +1262,7 @@ locals_info (char *args, int from_tty) } static void -catch_info (char *ignore, int from_tty) +catch_info (const char *ignore, int from_tty) { struct symtab_and_line *sal; @@ -1349,7 +1350,7 @@ print_frame_arg_vars (register struct frame_info *fi, } void -args_info (char *ignore, int from_tty) +args_info (const char *ignore, int from_tty) { if (!deprecated_selected_frame) error ("No frame selected."); @@ -1358,7 +1359,7 @@ args_info (char *ignore, int from_tty) static void -args_plus_locals_info (char *ignore, int from_tty) +args_plus_locals_info (const char *ignore, int from_tty) { args_info (ignore, from_tty); locals_info (ignore, from_tty); @@ -1465,7 +1466,7 @@ select_frame_command_wrapper (char *level_exp, int from_tty) } static void -select_frame_command (char *level_exp, int from_tty) +select_frame_command (const char *level_exp, int from_tty) { struct frame_info *frame; int level = frame_relative_level (deprecated_selected_frame); @@ -1485,7 +1486,7 @@ select_frame_command (char *level_exp, int from_tty) frame. */ void -frame_command (char *level_exp, int from_tty) +frame_command (const char *level_exp, int from_tty) { select_frame_command (level_exp, from_tty); print_stack_frame (deprecated_selected_frame, @@ -1495,7 +1496,7 @@ frame_command (char *level_exp, int from_tty) /* The XDB Compatibility command to print the current frame. */ static void -current_frame_command (char *level_exp, int from_tty) +current_frame_command (const char *level_exp, int from_tty) { if (target_has_stack == 0 || deprecated_selected_frame == 0) error ("No stack."); @@ -1508,7 +1509,7 @@ current_frame_command (char *level_exp, int from_tty) /* ARGSUSED */ static void -up_silently_base (char *count_exp) +up_silently_base (const char *count_exp) { register struct frame_info *fi; int count = 1, count1; @@ -1527,13 +1528,13 @@ up_silently_base (char *count_exp) } static void -up_silently_command (char *count_exp, int from_tty) +up_silently_command (const char *count_exp, int from_tty) { up_silently_base (count_exp); } static void -up_command (char *count_exp, int from_tty) +up_command (const char *count_exp, int from_tty) { up_silently_base (count_exp); print_stack_frame (deprecated_selected_frame, @@ -1545,7 +1546,7 @@ up_command (char *count_exp, int from_tty) /* ARGSUSED */ static void -down_silently_base (char *count_exp) +down_silently_base (const char *count_exp) { register struct frame_info *frame; int count = -1, count1; @@ -1574,13 +1575,13 @@ down_silently_base (char *count_exp) /* ARGSUSED */ static void -down_silently_command (char *count_exp, int from_tty) +down_silently_command (const char *count_exp, int from_tty) { down_silently_base (count_exp); } static void -down_command (char *count_exp, int from_tty) +down_command (const char *count_exp, int from_tty) { down_silently_base (count_exp); print_stack_frame (deprecated_selected_frame, @@ -1588,7 +1589,7 @@ down_command (char *count_exp, int from_tty) } void -return_command (char *retval_exp, int from_tty) +return_command (const char *retval_exp, int from_tty) { struct symbol *thisfun; CORE_ADDR selected_frame_addr; @@ -1693,9 +1694,8 @@ struct function_bounds CORE_ADDR low, high; }; -static void func_command (char *arg, int from_tty); static void -func_command (char *arg, int from_tty) +func_command (const char *arg, int from_tty) { struct frame_info *fp; int found = 0; @@ -1714,8 +1714,7 @@ func_command (char *arg, int from_tty) for (i = 0; (i < sals.nelts && !found); i++) { if (sals.sals[i].pc == (CORE_ADDR) 0 || - find_pc_partial_function (sals.sals[i].pc, - (char **) NULL, + find_pc_partial_function (sals.sals[i].pc, NULL, &func_bounds[i].low, &func_bounds[i].high) == 0) { diff --git a/gdb/symfile.c b/gdb/symfile.c index 7d7886a2921..6696aa219de 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -79,7 +79,7 @@ void (*show_load_progress) (const char *section, unsigned long section_size, unsigned long total_sent, unsigned long total_size); -void (*pre_add_symbol_hook) (char *); +void (*pre_add_symbol_hook) (const char *); void (*post_add_symbol_hook) (void); void (*target_new_objfile_hook) (struct objfile *); @@ -101,19 +101,19 @@ static void simple_free_overlay_region_table (void); static void set_initial_language (void); -static void load_command (char *, int); +static void load_command (const char *, int); -static void symbol_file_add_main_1 (char *args, int from_tty, int flags); +static void symbol_file_add_main_1 (const char *args, int from_tty, int flags); -static void add_symbol_file_command (char *, int); +static void add_symbol_file_command (const char *, int); -static void add_shared_symbol_files_command (char *, int); +static void add_shared_symbol_files_command (const char *, int); static void reread_separate_symbols (struct objfile *objfile); static void cashier_psymtab (struct partial_symtab *); -bfd *symfile_bfd_open (char *); +bfd *symfile_bfd_open (const char *); int get_section_index (struct objfile *, char *); @@ -125,21 +125,21 @@ static void overlay_invalidate_all (void); static int overlay_is_mapped (struct obj_section *); -void list_overlays_command (char *, int); +void list_overlays_command (const char *, int); -void map_overlay_command (char *, int); +void map_overlay_command (const char *, int); -void unmap_overlay_command (char *, int); +void unmap_overlay_command (const char *, int); -static void overlay_auto_command (char *, int); +static void overlay_auto_command (const char *, int); -static void overlay_manual_command (char *, int); +static void overlay_manual_command (const char *, int); -static void overlay_off_command (char *, int); +static void overlay_off_command (const char *, int); -static void overlay_load_command (char *, int); +static void overlay_load_command (const char *, int); -static void overlay_command (char *, int); +static void overlay_command (const char *, int); static void simple_free_overlay_table (void); @@ -151,9 +151,9 @@ static int simple_overlay_update_1 (struct obj_section *); static void add_filename_language (char *ext, enum language lang); -static void set_ext_lang_command (char *args, int from_tty); +static void set_ext_lang_command (const char *args, int from_tty); -static void info_ext_lang_command (char *args, int from_tty); +static void info_ext_lang_command (const char *args, int from_tty); static char *find_separate_debug_file (struct objfile *objfile); @@ -846,7 +846,7 @@ new_symfile_objfile (struct objfile *objfile, int mainline, int verbo) Upon success, returns a pointer to the objfile that was added. Upon failure, jumps back to command level (never returns). */ static struct objfile * -symbol_file_add_with_addrs_or_offsets (char *name, int from_tty, +symbol_file_add_with_addrs_or_offsets (const char *name, int from_tty, struct section_addr_info *addrs, struct section_offsets *offsets, int num_offsets, @@ -995,7 +995,8 @@ symbol_file_add_with_addrs_or_offsets (char *name, int from_tty, loaded file. See symbol_file_add_with_addrs_or_offsets's comments for details. */ struct objfile * -symbol_file_add (char *name, int from_tty, struct section_addr_info *addrs, +symbol_file_add (const char *name, int from_tty, + struct section_addr_info *addrs, int mainline, int flags) { return symbol_file_add_with_addrs_or_offsets (name, from_tty, addrs, 0, 0, @@ -1012,13 +1013,13 @@ symbol_file_add (char *name, int from_tty, struct section_addr_info *addrs, command itself. */ void -symbol_file_add_main (char *args, int from_tty) +symbol_file_add_main (const char *args, int from_tty) { symbol_file_add_main_1 (args, from_tty, 0); } static void -symbol_file_add_main_1 (char *args, int from_tty, int flags) +symbol_file_add_main_1 (const char *args, int from_tty, int flags) { symbol_file_add (args, from_tty, NULL, 1, flags); @@ -1212,7 +1213,7 @@ find_separate_debug_file (struct objfile *objfile) and pass that to symbol_file_add(). This is no longer supported. */ void -symbol_file_command (char *args, int from_tty) +symbol_file_command (const char *args, int from_tty) { char **argv; char *name = NULL; @@ -1298,15 +1299,12 @@ set_initial_language (void) In case of trouble, error() is called. */ bfd * -symfile_bfd_open (char *name) +symfile_bfd_open (const char *n) { bfd *sym_bfd; int desc; char *absolute_name; - - - - name = tilde_expand (name); /* Returns 1st new malloc'd copy */ + char *name = tilde_expand (n); /* Returns 1st new malloc'd copy */ /* Look down path for it, allocate 2nd new malloc'd copy. */ desc = openp (getenv ("PATH"), 1, name, O_RDONLY | O_BINARY, 0, &absolute_name); @@ -1412,7 +1410,7 @@ find_sym_fns (struct objfile *objfile) /* This function runs the load command of our current target. */ static void -load_command (char *arg, int from_tty) +load_command (const char *arg, int from_tty) { if (arg == NULL) arg = get_exec_file (1); @@ -1547,7 +1545,7 @@ load_section_callback (bfd *abfd, asection *asec, void *data) } void -generic_load (char *args, int from_tty) +generic_load (const char *args, int from_tty) { asection *s; bfd *loadfile_bfd; @@ -1683,11 +1681,11 @@ print_transfer_performance (struct ui_file *stream, /* ARGSUSED */ static void -add_symbol_file_command (char *args, int from_tty) +add_symbol_file_command (const char *args, int from_tty) { char *filename = NULL; int flags = OBJF_USERLOADED; - char *arg; + const char *arg; int expecting_option = 0; int section_index = 0; int argcnt = 0; @@ -1698,8 +1696,8 @@ add_symbol_file_command (char *args, int from_tty) struct { - char *name; - char *value; + const char *name; + const char *value; } sect_opts[SECT_OFF_MAX]; struct section_addr_info section_addrs; @@ -1802,8 +1800,8 @@ 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; val = sect_opts[i].value; if (val[0] == '0' && val[1] == 'x') @@ -1839,7 +1837,7 @@ add_symbol_file_command (char *args, int from_tty) } static void -add_shared_symbol_files_command (char *args, int from_tty) +add_shared_symbol_files_command (const char *args, int from_tty) { #ifdef ADD_SHARED_SYMBOL_FILES ADD_SHARED_SYMBOL_FILES (args, from_tty); @@ -2156,7 +2154,7 @@ add_filename_language (char *ext, enum language lang) static char *ext_args; static void -set_ext_lang_command (char *args, int from_tty) +set_ext_lang_command (const char *args, int from_tty) { int i; char *cp = ext_args; @@ -2213,7 +2211,7 @@ set_ext_lang_command (char *args, int from_tty) } static void -info_ext_lang_command (char *args, int from_tty) +info_ext_lang_command (const char *args, int from_tty) { int i; @@ -3107,7 +3105,7 @@ find_pc_mapped_section (CORE_ADDR pc) Print a list of mapped sections and their PC ranges */ void -list_overlays_command (char *args, int from_tty) +list_overlays_command (const char *args, int from_tty) { int nmapped = 0; struct objfile *objfile; @@ -3146,7 +3144,7 @@ list_overlays_command (char *args, int from_tty) Mark the named section as mapped (ie. residing at its VMA address). */ void -map_overlay_command (char *args, int from_tty) +map_overlay_command (const char *args, int from_tty) { struct objfile *objfile, *objfile2; struct obj_section *sec, *sec2; @@ -3197,7 +3195,7 @@ the 'overlay manual' command."); (ie. resident in its LMA address range, rather than the VMA range). */ void -unmap_overlay_command (char *args, int from_tty) +unmap_overlay_command (const char *args, int from_tty) { struct objfile *objfile; struct obj_section *sec; @@ -3227,7 +3225,7 @@ the 'overlay manual' command."); Possibly this should be done via a set/show command. */ static void -overlay_auto_command (char *args, int from_tty) +overlay_auto_command (const char *args, int from_tty) { overlay_debugging = ovly_auto; enable_overlay_breakpoints (); @@ -3240,7 +3238,7 @@ overlay_auto_command (char *args, int from_tty) Possibly this should be done via a set/show command. */ static void -overlay_manual_command (char *args, int from_tty) +overlay_manual_command (const char *args, int from_tty) { overlay_debugging = ovly_on; disable_overlay_breakpoints (); @@ -3253,7 +3251,7 @@ overlay_manual_command (char *args, int from_tty) Possibly this should be done via a set/show command. */ static void -overlay_off_command (char *args, int from_tty) +overlay_off_command (const char *args, int from_tty) { overlay_debugging = ovly_off; disable_overlay_breakpoints (); @@ -3262,7 +3260,7 @@ overlay_off_command (char *args, int from_tty) } static void -overlay_load_command (char *args, int from_tty) +overlay_load_command (const char *args, int from_tty) { if (target_overlay_update) (*target_overlay_update) (NULL); @@ -3277,7 +3275,7 @@ overlay_load_command (char *args, int from_tty) struct cmd_list_element *overlaylist; static void -overlay_command (char *args, int from_tty) +overlay_command (const char *args, int from_tty) { printf_unfiltered ("\"overlay\" must be followed by the name of an overlay command.\n"); diff --git a/gdb/symfile.h b/gdb/symfile.h index 0e2f1ef096b..5a112244d1f 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -74,7 +74,7 @@ struct section_addr_info struct other_sections { CORE_ADDR addr; - char *name; + const char *name; int sectindex; } other[MAX_SECTIONS]; }; @@ -182,7 +182,7 @@ extern void syms_from_objfile (struct objfile *, extern void new_symfile_objfile (struct objfile *, int, int); -extern struct objfile *symbol_file_add (char *, int, +extern struct objfile *symbol_file_add (const char *, int, struct section_addr_info *, int, int); /* Build (allocate and populate) a section_addr_info struct from @@ -256,7 +256,7 @@ extern void discard_psymtab (struct partial_symtab *); extern void find_lowest_section (bfd *, asection *, void *); -extern bfd *symfile_bfd_open (char *); +extern bfd *symfile_bfd_open (const char *); extern int get_section_index (struct objfile *, char *); @@ -296,7 +296,7 @@ extern CORE_ADDR overlay_unmapped_address (CORE_ADDR, asection *); extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *); /* Load symbols from a file. */ -extern void symbol_file_add_main (char *args, int from_tty); +extern void symbol_file_add_main (const char *args, int from_tty); /* Clear GDB symbol tables. */ extern void symbol_file_clear (int from_tty); diff --git a/gdb/symtab.c b/gdb/symtab.c index 2c46f9d6751..cdd31a1844e 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -58,15 +58,15 @@ static void completion_list_add_name (char *, char *, int, char *, char *); -static void rbreak_command (char *, int); +static void rbreak_command (const char *, int); -static void types_info (char *, int); +static void types_info (const char *, int); -static void functions_info (char *, int); +static void functions_info (const char *, int); -static void variables_info (char *, int); +static void variables_info (const char *, int); -static void sources_info (char *, int); +static void sources_info (const char *, int); static void output_source_filename (char *, int *); @@ -74,7 +74,7 @@ static int find_line_common (struct linetable *, int, int *); /* This one is used by linespec.c */ -char *operator_chars (char *p, char **end); +const char *operator_chars (const char *p, const char **end); static struct partial_symbol *lookup_partial_symbol (struct partial_symtab *, const char *, @@ -139,7 +139,7 @@ static void print_symbol_info (namespace_enum, static void print_msymbol_info (struct minimal_symbol *); -static void symtab_symbol_info (char *, namespace_enum, int); +static void symtab_symbol_info (const char *, namespace_enum, int); static void overload_list_add_symbol (struct symbol *sym, char *oload_name); @@ -2530,8 +2530,8 @@ find_function_start_sal (struct symbol *sym, int funfirstline) some legitimate operator text, return a pointer to the beginning of the substring of the operator text. Otherwise, return "". */ -char * -operator_chars (char *p, char **end) +const char * +operator_chars (const char *p, const char **end) { *end = ""; if (strncmp (p, "operator", 8)) @@ -2551,7 +2551,7 @@ operator_chars (char *p, char **end) if (isalpha (*p) || *p == '_' || *p == '$') { - register char *q = p + 1; + const char *q = p + 1; while (isalnum (*q) || *q == '_' || *q == '$') q++; *end = q; @@ -2739,7 +2739,7 @@ output_source_filename (char *name, int *first) } static void -sources_info (char *ignore, int from_tty) +sources_info (const char *ignore, int from_tty) { register struct symtab *s; register struct partial_symtab *ps; @@ -2880,8 +2880,8 @@ sort_search_symbols (struct symbol_search *prevtail, int nfound) separately alphabetized. */ void -search_symbols (char *regexp, namespace_enum kind, int nfiles, char *files[], - struct symbol_search **matches) +search_symbols (const char *regexp, namespace_enum kind, int nfiles, + char *files[], struct symbol_search **matches) { register struct symtab *s; register struct partial_symtab *ps; @@ -2934,8 +2934,8 @@ search_symbols (char *regexp, namespace_enum kind, int nfiles, char *files[], This is just a courtesy to make the matching less sensitive to how many spaces the user leaves between 'operator' and <TYPENAME> or <OPERATOR>. */ - char *opend; - char *opname = operator_chars (regexp, &opend); + const char *opend; + const char *opname = operator_chars (regexp, &opend); if (*opname) { int fix = -1; /* -1 means ok; otherwise number of spaces needed. */ @@ -3237,7 +3237,7 @@ print_msymbol_info (struct minimal_symbol *msymbol) matches. */ static void -symtab_symbol_info (char *regexp, namespace_enum kind, int from_tty) +symtab_symbol_info (const char *regexp, namespace_enum kind, int from_tty) { static char *classnames[] = @@ -3285,20 +3285,20 @@ symtab_symbol_info (char *regexp, namespace_enum kind, int from_tty) } static void -variables_info (char *regexp, int from_tty) +variables_info (const char *regexp, int from_tty) { symtab_symbol_info (regexp, VARIABLES_NAMESPACE, from_tty); } static void -functions_info (char *regexp, int from_tty) +functions_info (const char *regexp, int from_tty) { symtab_symbol_info (regexp, FUNCTIONS_NAMESPACE, from_tty); } static void -types_info (char *regexp, int from_tty) +types_info (const char *regexp, int from_tty) { symtab_symbol_info (regexp, TYPES_NAMESPACE, from_tty); } @@ -3306,13 +3306,13 @@ types_info (char *regexp, int from_tty) /* Breakpoint all functions matching regular expression. */ void -rbreak_command_wrapper (char *regexp, int from_tty) +rbreak_command_wrapper (const char *regexp, int from_tty) { rbreak_command (regexp, from_tty); } static void -rbreak_command (char *regexp, int from_tty) +rbreak_command (const char *regexp, int from_tty) { struct symbol_search *ss; struct symbol_search *p; @@ -4162,7 +4162,7 @@ make_symbol_overload_list (struct symbol *fsym) /* End of overload resolution functions */ struct symtabs_and_lines -decode_line_spec (char *string, int funfirstline) +decode_line_spec (const char *string, int funfirstline) { struct symtabs_and_lines sals; struct symtab_and_line cursal; diff --git a/gdb/symtab.h b/gdb/symtab.h index 4330b962257..fb5887a4294 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1029,13 +1029,13 @@ extern struct symbol *find_pc_sect_function (CORE_ADDR, asection *); /* lookup function from address, return name, start addr and end addr */ -extern int find_pc_partial_function (CORE_ADDR, char **, CORE_ADDR *, +extern int find_pc_partial_function (CORE_ADDR, const char **, CORE_ADDR *, CORE_ADDR *); extern void clear_pc_function_cache (void); -extern int find_pc_sect_partial_function (CORE_ADDR, asection *, - char **, CORE_ADDR *, CORE_ADDR *); +extern int find_pc_sect_partial_function (CORE_ADDR, asection *, const char **, + CORE_ADDR *, CORE_ADDR *); /* from symtab.c: */ @@ -1219,29 +1219,29 @@ extern void resolve_sal_pc (struct symtab_and_line *); /* Given a string, return the line specified by it. For commands like "list" and "breakpoint". */ -extern struct symtabs_and_lines decode_line_spec (char *, int); +extern struct symtabs_and_lines decode_line_spec (const char *, int); -extern struct symtabs_and_lines decode_line_spec_1 (char *, int); +extern struct symtabs_and_lines decode_line_spec_1 (const char *, int); /* Symmisc.c */ -void maintenance_print_symbols (char *, int); +void maintenance_print_symbols (const char *, int); -void maintenance_print_psymbols (char *, int); +void maintenance_print_psymbols (const char *, int); -void maintenance_print_msymbols (char *, int); +void maintenance_print_msymbols (const char *, int); -void maintenance_print_objfiles (char *, int); +void maintenance_print_objfiles (const char *, int); -void maintenance_info_symtabs (char *, int); +void maintenance_info_symtabs (const char *, int); -void maintenance_info_psymtabs (char *, int); +void maintenance_info_psymtabs (const char *, int); -void maintenance_check_symtabs (char *, int); +void maintenance_check_symtabs (const char *, int); /* maint.c */ -void maintenance_print_statistics (char *, int); +void maintenance_print_statistics (const char *, int); extern void free_symtab (struct symtab *); @@ -1320,7 +1320,7 @@ struct symbol_search struct symbol_search *next; }; -extern void search_symbols (char *, namespace_enum, int, char **, +extern void search_symbols (const char *, namespace_enum, int, char **, struct symbol_search **); extern void free_search_symbols (struct symbol_search *); extern struct cleanup *make_cleanup_free_search_symbols (struct symbol_search diff --git a/gdb/target.c b/gdb/target.c index fd0165a19ba..bfbeda5323c 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -38,17 +38,13 @@ extern int errno; -static void target_info (char *, int); - static void cleanup_target (struct target_ops *); static void maybe_kill_then_create_inferior (char *, char *, char **); -static void maybe_kill_then_attach (char *, int); - static void kill_or_be_killed (int); -static void default_terminal_info (char *, int); +static void default_terminal_info (const char *, int); static int default_region_size_ok_for_hw_watchpoint (int); @@ -66,7 +62,7 @@ static int return_minus_one (void); void target_ignore (void); -static void target_command (char *, int); +static void target_command (const char *, int); static struct target_ops *find_default_run_target (char *); @@ -87,13 +83,13 @@ static int target_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, static void init_dummy_target (void); -static void debug_to_open (char *, int); +static void debug_to_open (const char *, int); static void debug_to_close (int); -static void debug_to_attach (char *, int); +static void debug_to_attach (const char *, int); -static void debug_to_detach (char *, int); +static void debug_to_detach (const char *, int); static void debug_to_resume (ptid_t, int, enum target_signal); @@ -140,12 +136,10 @@ static void debug_to_terminal_save_ours (void); static void debug_to_terminal_ours (void); -static void debug_to_terminal_info (char *, int); +static void debug_to_terminal_info (const char *, int); static void debug_to_kill (void); -static void debug_to_load (char *, int); - static int debug_to_lookup_symbol (char *, CORE_ADDR *); static void debug_to_create_inferior (char *, char *, char **); @@ -206,7 +200,7 @@ DCACHE *target_dcache; /* ARGSUSED */ static void -target_command (char *arg, int from_tty) +target_command (const char *arg, int from_tty) { fputs_filtered ("Argument required (target name). Try `help target'\n", gdb_stdout); @@ -252,7 +246,7 @@ target_ignore (void) } void -target_load (char *arg, int from_tty) +target_load (const char *arg, int from_tty) { dcache_invalidate (target_dcache); (*current_target.to_load) (arg, from_tty); @@ -300,7 +294,7 @@ nosupport_runtime (void) /* ARGSUSED */ static void -default_terminal_info (char *args, int from_tty) +default_terminal_info (const char *args, int from_tty) { printf_unfiltered ("No saved terminal information.\n"); } @@ -333,7 +327,7 @@ kill_or_be_killed (int from_tty) } static void -maybe_kill_then_attach (char *args, int from_tty) +maybe_kill_then_attach (const char *args, int from_tty) { kill_or_be_killed (from_tty); target_attach (args, from_tty); @@ -358,7 +352,7 @@ cleanup_target (struct target_ops *t) t->field = value de_fault (to_open, - (void (*) (char *, int)) + (void (*) (const char *, int)) tcomplain); de_fault (to_close, (void (*) (int)) @@ -369,7 +363,7 @@ cleanup_target (struct target_ops *t) (void (*) (int)) target_ignore); de_fault (to_detach, - (void (*) (char *, int)) + (void (*) (const char *, int)) target_ignore); de_fault (to_resume, (void (*) (ptid_t, int, enum target_signal)) @@ -443,7 +437,7 @@ cleanup_target (struct target_ops *t) (void (*) (void)) noprocess); de_fault (to_load, - (void (*) (char *, int)) + (void (*) (const char *, int)) tcomplain); de_fault (to_lookup_symbol, (int (*) (char *, CORE_ADDR *)) @@ -504,7 +498,7 @@ cleanup_target (struct target_ops *t) (void (*) (void)) target_ignore); de_fault (to_rcmd, - (void (*) (char *, struct ui_file *)) + (void (*) (const char *, struct ui_file *)) tcomplain); de_fault (to_enable_exception_callback, (struct symtab_and_line * (*) (enum exception_event_kind, int)) @@ -1073,7 +1067,7 @@ target_write_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err) /* ARGSUSED */ static void -target_info (char *args, int from_tty) +target_info (const char *args, int from_tty) { struct target_ops *t; struct target_stack_item *item; @@ -1131,7 +1125,7 @@ target_preopen (int from_tty) /* Detach a target after doing deferred register stores. */ void -target_detach (char *args, int from_tty) +target_detach (const char *args, int from_tty) { /* Handle any optimized stores to the inferior. */ #ifdef DO_DEFERRED_STORES @@ -1193,7 +1187,7 @@ find_default_run_target (char *do_mesg) } void -find_default_attach (char *args, int from_tty) +find_default_attach (const char *args, int from_tty) { struct target_ops *t; @@ -1521,7 +1515,7 @@ init_dummy_target (void) static struct target_ops debug_target; static void -debug_to_open (char *args, int from_tty) +debug_to_open (const char *args, int from_tty) { debug_target.to_open (args, from_tty); @@ -1537,7 +1531,7 @@ debug_to_close (int quitting) } static void -debug_to_attach (char *args, int from_tty) +debug_to_attach (const char *args, int from_tty) { debug_target.to_attach (args, from_tty); @@ -1554,7 +1548,7 @@ debug_to_post_attach (int pid) } static void -debug_to_detach (char *args, int from_tty) +debug_to_detach (const char *args, int from_tty) { debug_target.to_detach (args, from_tty); @@ -1902,7 +1896,7 @@ debug_to_terminal_save_ours (void) } static void -debug_to_terminal_info (char *arg, int from_tty) +debug_to_terminal_info (const char *arg, int from_tty) { debug_target.to_terminal_info (arg, from_tty); @@ -1919,7 +1913,7 @@ debug_to_kill (void) } static void -debug_to_load (char *args, int from_tty) +debug_to_load (const char *args, int from_tty) { debug_target.to_load (args, from_tty); @@ -2152,7 +2146,7 @@ debug_to_query (int type, char *req, char *resp, int *siz) } static void -debug_to_rcmd (char *command, +debug_to_rcmd (const char *command, struct ui_file *outbuf) { debug_target.to_rcmd (command, outbuf); @@ -2262,14 +2256,13 @@ Shows the entire stack of targets currently in use (including the exec-file,\n\ core-file, and process, if any), as well as the symbol file name."; static void -do_monitor_command (char *cmd, - int from_tty) +do_monitor_command (const char *cmd, int from_tty) { if ((current_target.to_rcmd - == (void (*) (char *, struct ui_file *)) tcomplain) + == (void (*) (const char *, struct ui_file *)) tcomplain) || (current_target.to_rcmd == debug_to_rcmd && (debug_target.to_rcmd - == (void (*) (char *, struct ui_file *)) tcomplain))) + == (void (*) (const char *, struct ui_file *)) tcomplain))) { error ("\"monitor\" command not supported by this target.\n"); } diff --git a/gdb/target.h b/gdb/target.h index e757b6701d9..15bfa48d9ef 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -173,7 +173,7 @@ extern char *target_signal_to_string (enum target_signal); extern char *target_signal_to_name (enum target_signal); /* Given a name (SIGHUP, etc.), return its signal. */ -enum target_signal target_signal_from_name (char *); +enum target_signal target_signal_from_name (const char *); /* If certain kinds of activity happen, target_wait should perform @@ -193,11 +193,11 @@ struct target_ops char *to_doc; /* Documentation. Does not include trailing newline, and starts with a one-line descrip- tion (probably similar to to_longname). */ - void (*to_open) (char *, int); + void (*to_open) (const char *, int); void (*to_close) (int); - void (*to_attach) (char *, int); + void (*to_attach) (const char *, int); void (*to_post_attach) (int); - void (*to_detach) (char *, int); + void (*to_detach) (const char *, int); void (*to_resume) (ptid_t, int, enum target_signal); ptid_t (*to_wait) (ptid_t, struct target_waitstatus *); void (*to_post_wait) (ptid_t, int); @@ -268,9 +268,9 @@ struct target_ops void (*to_terminal_ours_for_output) (void); void (*to_terminal_ours) (void); void (*to_terminal_save_ours) (void); - void (*to_terminal_info) (char *, int); + void (*to_terminal_info) (const char *, int); void (*to_kill) (void); - void (*to_load) (char *, int); + void (*to_load) (const char *, int); int (*to_lookup_symbol) (char *, CORE_ADDR *); void (*to_create_inferior) (char *, char *, char **); void (*to_post_startup_inferior) (ptid_t); @@ -293,7 +293,7 @@ struct target_ops char *(*to_extra_thread_info) (struct thread_info *); void (*to_stop) (void); int (*to_query) (int /*char */ , char *, char *, int *); - void (*to_rcmd) (char *command, struct ui_file *output); + void (*to_rcmd) (const char *command, struct ui_file *output); struct symtab_and_line *(*to_enable_exception_callback) (enum exception_event_kind, int); @@ -412,7 +412,7 @@ extern struct target_stack_item *target_stack; typed by the user (e.g. a signal to send the process). FROM_TTY says whether to be verbose or not. */ -extern void target_detach (char *, int); +extern void target_detach (const char *, int); /* Resume execution of the target process PTID. STEP says whether to single-step or to run free; SIGGNAL is the signal to be given to @@ -622,7 +622,7 @@ extern void print_section_info (struct target_ops *, bfd *); to not only bring new code into the target process, but also to update GDB's symbol tables to match. */ -extern void target_load (char *arg, int from_tty); +extern void target_load (const char *arg, int from_tty); /* Look up a symbol in the target's symbol table. NAME is the symbol name. ADDRP is a CORE_ADDR * pointing to where the value of the @@ -1136,7 +1136,7 @@ extern void initialize_targets (void); extern void noprocess (void); -extern void find_default_attach (char *, int); +extern void find_default_attach (const char *, int); extern void find_default_create_inferior (char *, char *, char **); diff --git a/gdb/thread.c b/gdb/thread.c index 315f33b1c4a..84e5e8deb1e 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -56,11 +56,11 @@ static int highest_thread_num; static struct thread_info *find_thread_id (int num); -static void thread_command (char *tidstr, int from_tty); -static void thread_apply_all_command (char *, int); +static void thread_command (const char *tidstr, int from_tty); +static void thread_apply_all_command (const char *, int); static int thread_alive (struct thread_info *); -static void info_threads_command (char *, int); -static void thread_apply_command (char *, int); +static void info_threads_command (const char *, int); +static void thread_apply_command (const char *, int); static void restore_current_thread (ptid_t); static void switch_to_thread (ptid_t ptid); static void prune_threads (void); @@ -412,7 +412,7 @@ prune_threads (void) */ static void -info_threads_command (char *arg, int from_tty) +info_threads_command (const char *arg, int from_tty) { struct thread_info *tp; ptid_t current_ptid; @@ -536,7 +536,7 @@ make_cleanup_restore_current_thread (ptid_t inferior_ptid) */ static void -thread_apply_all_command (char *cmd, int from_tty) +thread_apply_all_command (const char *cmd, int from_tty) { struct thread_info *tp; struct cleanup *old_chain; @@ -576,9 +576,9 @@ thread_apply_all_command (char *cmd, int from_tty) } static void -thread_apply_command (char *tidlist, int from_tty) +thread_apply_command (const char *tidlist, int from_tty) { - char *cmd; + const char *cmd; char *p; struct cleanup *old_chain; struct cleanup *saved_cmd_cleanup_chain; @@ -657,7 +657,7 @@ thread_apply_command (char *tidlist, int from_tty) if prefix of arg is `apply'. */ static void -thread_command (char *tidstr, int from_tty) +thread_command (const char *tidstr, int from_tty) { if (!tidstr) { @@ -713,7 +713,7 @@ do_captured_thread_select (struct ui_out *uiout, void *tidstr) } enum gdb_rc -gdb_thread_select (struct ui_out *uiout, char *tidstr) +gdb_thread_select (struct ui_out *uiout, const char *tidstr) { return catch_exceptions (uiout, do_captured_thread_select, tidstr, NULL, RETURN_MASK_ALL); diff --git a/gdb/top.c b/gdb/top.c index fea71dfd87f..b99cbd689a5 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -377,14 +377,14 @@ catcher (catch_exceptions_ftype *func, void *func_args, int *func_val, enum return_reason *func_caught, - char *errstring, + const char *errstring, return_mask mask) { SIGJMP_BUF *saved_catch; SIGJMP_BUF catch; struct cleanup *saved_cleanup_chain; - char *saved_error_pre_print; - char *saved_quit_pre_print; + const char *saved_error_pre_print; + const char *saved_quit_pre_print; struct ui_out *saved_uiout; /* Return value from SIGSETJMP(): enum return_reason if error or @@ -466,7 +466,7 @@ int catch_exceptions (struct ui_out *uiout, catch_exceptions_ftype *func, void *func_args, - char *errstring, + const char *errstring, return_mask mask) { int val; @@ -493,7 +493,7 @@ do_catch_errors (struct ui_out *uiout, void *data) } int -catch_errors (catch_errors_ftype *func, void *func_args, char *errstring, +catch_errors (catch_errors_ftype *func, void *func_args, const char *errstring, return_mask mask) { int val; @@ -508,11 +508,11 @@ catch_errors (catch_errors_ftype *func, void *func_args, char *errstring, } struct captured_command_args - { - catch_command_errors_ftype *command; - char *arg; - int from_tty; - }; +{ + catch_command_errors_ftype *command; + const char *arg; + int from_tty; +}; static int do_captured_command (void *data) @@ -532,7 +532,7 @@ do_captured_command (void *data) int catch_command_errors (catch_command_errors_ftype * command, - char *arg, int from_tty, return_mask mask) + const char *arg, int from_tty, return_mask mask) { struct captured_command_args args; args.command = command; @@ -633,12 +633,12 @@ do_chdir_cleanup (void *old_dir) Pass FROM_TTY as second argument to the defining function. */ void -execute_command (char *p, int from_tty) +execute_command (const char *p, int from_tty) { register struct cmd_list_element *c; register enum language flang; static int warned = 0; - char *line; + const char *line; free_all_values (); @@ -656,7 +656,7 @@ execute_command (char *p, int from_tty) p++; if (*p) { - char *arg; + const char *arg; line = p; c = lookup_cmd (&p, cmdlist, "", 0, 1); @@ -1419,7 +1419,9 @@ get_prompt_1 (void *data) else /* formatted prompt */ { - char fmt[40], *promptp, *outp, *tmp; + char fmt[40]; + const char **promptp; + char *outp, *tmp; struct value *arg_val; DOUBLEST doubleval; LONGEST longval; @@ -1738,7 +1740,7 @@ input_from_terminal_p (void) /* ARGSUSED */ static void -dont_repeat_command (char *ignored, int from_tty) +dont_repeat_command (const char *ignored, int from_tty) { *line = 0; /* Can't call dont_repeat here because we're not necessarily reading from stdin. */ @@ -1824,7 +1826,8 @@ show_commands (char *args, int from_tty) /* Called by do_setshow_command. */ /* ARGSUSED */ static void -set_history_size_command (char *args, int from_tty, struct cmd_list_element *c) +set_history_size_command (const char *args, int from_tty, + struct cmd_list_element *c) { if (history_size == INT_MAX) unstifle_history (); diff --git a/gdb/top.h b/gdb/top.h index ca0b3d13dc6..20b0a704b0f 100644 --- a/gdb/top.h +++ b/gdb/top.h @@ -33,8 +33,8 @@ extern char gdbinit[]; extern void print_gdb_version (struct ui_file *); -extern void source_command (char *, int); -extern void cd_command (char *, int); +extern void source_command (const char *, int); +extern void cd_command (const char *, int); extern void read_command_file (FILE *); extern void init_history (void); extern void command_loop (void); @@ -43,9 +43,9 @@ extern void simplified_command_loop (char *(*read_input_func) (char *), int)); extern int quit_confirm (void); extern void quit_force (char *, int); -extern void quit_command (char *, int); +extern void quit_command (const char *, int); extern int quit_cover (void *); -extern void execute_command (char *, int); +extern void execute_command (const char *, int); /* This function returns a pointer to the string that is used by gdb for its command prompt. */ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 17ee07c898d..8585790505d 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -125,24 +125,24 @@ static struct symtab_and_line traceframe_sal; static struct cmd_list_element *tfindlist; /* ======= Important command functions: ======= */ -static void trace_command (char *, int); -static void tracepoints_info (char *, int); -static void delete_trace_command (char *, int); -static void enable_trace_command (char *, int); -static void disable_trace_command (char *, int); -static void trace_pass_command (char *, int); -static void trace_actions_command (char *, int); -static void trace_start_command (char *, int); -static void trace_stop_command (char *, int); -static void trace_status_command (char *, int); -static void trace_find_command (char *, int); -static void trace_find_pc_command (char *, int); -static void trace_find_tracepoint_command (char *, int); -static void trace_find_line_command (char *, int); -static void trace_find_range_command (char *, int); -static void trace_find_outside_command (char *, int); -static void tracepoint_save_command (char *, int); -static void trace_dump_command (char *, int); +static void trace_command (const char *, int); +static void tracepoints_info (const char *, int); +static void delete_trace_command (const char *, int); +static void enable_trace_command (const char *, int); +static void disable_trace_command (const char *, int); +static void trace_pass_command (const char *, int); +static void trace_actions_command (const char *, int); +static void trace_start_command (const char *, int); +static void trace_stop_command (const char *, int); +static void trace_status_command (const char *, int); +static void trace_find_command (const char *, int); +static void trace_find_pc_command (const char *, int); +static void trace_find_tracepoint_command (const char *, int); +static void trace_find_line_command (const char *, int); +static void trace_find_range_command (const char *, int); +static void trace_find_outside_command (const char *, int); +static void tracepoint_save_command (const char *, int); +static void trace_dump_command (const char *, int); /* support routines */ static void trace_mention (struct tracepoint *); @@ -192,8 +192,7 @@ trace_error (char *buf) /* Utility: wait for reply from stub, while accepting "O" packets */ static char * -remote_get_noisy_reply (char *buf, - long sizeof_buf) +remote_get_noisy_reply (const char *buf, long sizeof_buf) { do /* loop on reply from remote stub */ { @@ -375,13 +374,14 @@ set_raw_tracepoint (struct symtab_and_line sal) /* Set a tracepoint according to ARG (function, linenum or *address) */ static void -trace_command (char *arg, int from_tty) +trace_command (const char *arg, int from_tty) { char **canonical = (char **) NULL; struct symtabs_and_lines sals; struct symtab_and_line sal; struct tracepoint *t; - char *addr_start = 0, *addr_end = 0; + const char *addr_start = 0; + const char *addr_end = 0; int i; if (!arg || !*arg) @@ -448,7 +448,7 @@ trace_mention (struct tracepoint *tp) /* Print information on tracepoint number TPNUM_EXP, or all if omitted. */ static void -tracepoints_info (char *tpnum_exp, int from_tty) +tracepoints_info (const char *tpnum_exp, int from_tty) { struct tracepoint *t; struct action_line *action; @@ -598,11 +598,11 @@ tracepoint_operation (struct tracepoint *t, int from_tty, if OPTIONAL_P is true, then if the argument is missing, the most recent tracepoint (tracepoint_count) is returned. */ struct tracepoint * -get_tracepoint_by_number (char **arg, int multi_p, int optional_p) +get_tracepoint_by_number (const char **arg, int multi_p, int optional_p) { struct tracepoint *t; int tpnum; - char *instring = arg == NULL ? NULL : *arg; + const char *instring = arg == NULL ? NULL : *arg; if (arg == NULL || *arg == NULL || ! **arg) { @@ -638,7 +638,7 @@ get_tracepoint_by_number (char **arg, int multi_p, int optional_p) /* Utility: parse a list of tracepoint numbers, and call a func for each. */ static void -map_args_over_tracepoints (char *args, int from_tty, +map_args_over_tracepoints (const char *args, int from_tty, enum tracepoint_opcode opcode) { struct tracepoint *t, *tmp; @@ -659,7 +659,7 @@ map_args_over_tracepoints (char *args, int from_tty, /* The 'enable trace' command enables tracepoints. Not supported by all targets. */ static void -enable_trace_command (char *args, int from_tty) +enable_trace_command (const char *args, int from_tty) { dont_repeat (); map_args_over_tracepoints (args, from_tty, enable_op); @@ -667,7 +667,7 @@ enable_trace_command (char *args, int from_tty) /* The 'disable trace' command enables tracepoints. Not supported by all targets. */ static void -disable_trace_command (char *args, int from_tty) +disable_trace_command (const char *args, int from_tty) { dont_repeat (); map_args_over_tracepoints (args, from_tty, disable_op); @@ -675,7 +675,7 @@ disable_trace_command (char *args, int from_tty) /* Remove a tracepoint (or all if no argument) */ static void -delete_trace_command (char *args, int from_tty) +delete_trace_command (const char *args, int from_tty) { dont_repeat (); if (!args || !*args) /* No args implies all tracepoints; */ @@ -694,7 +694,7 @@ delete_trace_command (char *args, int from_tty) Also accepts special argument "all". */ static void -trace_pass_command (char *args, int from_tty) +trace_pass_command (const char *args, int from_tty) { struct tracepoint *t1 = (struct tracepoint *) -1, *t2; unsigned int count; @@ -753,26 +753,26 @@ static void read_actions (struct tracepoint *); which is always an error. */ static void -end_actions_pseudocommand (char *args, int from_tty) +end_actions_pseudocommand (const char *args, int from_tty) { error ("This command cannot be used at the top level."); } static void -while_stepping_pseudocommand (char *args, int from_tty) +while_stepping_pseudocommand (const char *args, int from_tty) { error ("This command can only be used in a tracepoint actions list."); } static void -collect_pseudocommand (char *args, int from_tty) +collect_pseudocommand (const char *args, int from_tty) { error ("This command can only be used in a tracepoint actions list."); } /* Enter a list of actions for a tracepoint. */ static void -trace_actions_command (char *args, int from_tty) +trace_actions_command (const char *args, int from_tty) { struct tracepoint *t; char tmpbuf[128]; @@ -911,7 +911,7 @@ validate_actionline (char **line, struct tracepoint *t) struct cmd_list_element *c; struct expression *exp = NULL; struct cleanup *old_chain = NULL; - char *p; + const char *p; for (p = *line; isspace ((int) *p);) p++; @@ -999,7 +999,7 @@ validate_actionline (char **line, struct tracepoint *t) } else if (cmd_cfunc_eq (c, while_stepping_pseudocommand)) { - char *steparg; /* in case warning is necessary */ + const char *steparg; /* in case warning is necessary */ while (isspace ((int) *p)) p++; @@ -1476,7 +1476,7 @@ encode_actions (struct tracepoint *t, char ***tdp_actions, char ***stepping_actions) { static char tdp_buff[2048], step_buff[2048]; - char *action_exp; + const char *action_exp; struct expression *exp = NULL; struct action_line *action; int i; @@ -1708,7 +1708,7 @@ remote_set_transparent_ranges (void) Tell target to start a new trace experiment. */ static void -trace_start_command (char *args, int from_tty) +trace_start_command (const char *args, int from_tty) { /* STUB_COMM MOSTLY_IMPLEMENTED */ struct tracepoint *t; char buf[2048]; @@ -1808,7 +1808,7 @@ trace_start_command (char *args, int from_tty) /* tstop command */ static void -trace_stop_command (char *args, int from_tty) +trace_stop_command (const char *args, int from_tty) { /* STUB_COMM IS_IMPLEMENTED */ if (target_is_remote ()) { @@ -1828,7 +1828,7 @@ unsigned long trace_running_p; /* tstatus command */ static void -trace_status_command (char *args, int from_tty) +trace_status_command (const char *args, int from_tty) { /* STUB_COMM IS_IMPLEMENTED */ if (target_is_remote ()) { @@ -1848,7 +1848,7 @@ trace_status_command (char *args, int from_tty) /* Worker function for the various flavors of the tfind command */ static void -finish_tfind_command (char *msg, +finish_tfind_command (const char *msg, long sizeof_msg, int from_tty) { @@ -1972,7 +1972,7 @@ finish_tfind_command (char *msg, /* tfind command */ static void -trace_find_command (char *args, int from_tty) +trace_find_command (const char *args, int from_tty) { /* STUB_COMM PART_IMPLEMENTED */ /* this should only be called with a numeric argument */ int frameno = -1; @@ -2013,28 +2013,28 @@ trace_find_command (char *args, int from_tty) /* tfind end */ static void -trace_find_end_command (char *args, int from_tty) +trace_find_end_command (const char *args, int from_tty) { trace_find_command ("-1", from_tty); } /* tfind none */ static void -trace_find_none_command (char *args, int from_tty) +trace_find_none_command (const char *args, int from_tty) { trace_find_command ("-1", from_tty); } /* tfind start */ static void -trace_find_start_command (char *args, int from_tty) +trace_find_start_command (const char *args, int from_tty) { trace_find_command ("0", from_tty); } /* tfind pc command */ static void -trace_find_pc_command (char *args, int from_tty) +trace_find_pc_command (const char *args, int from_tty) { /* STUB_COMM PART_IMPLEMENTED */ CORE_ADDR pc; char tmp[40]; @@ -2056,7 +2056,7 @@ trace_find_pc_command (char *args, int from_tty) /* tfind tracepoint command */ static void -trace_find_tracepoint_command (char *args, int from_tty) +trace_find_tracepoint_command (const char *args, int from_tty) { /* STUB_COMM PART_IMPLEMENTED */ int tdp; @@ -2088,7 +2088,7 @@ trace_find_tracepoint_command (char *args, int from_tty) corresponding to a source line OTHER THAN THE CURRENT ONE. */ static void -trace_find_line_command (char *args, int from_tty) +trace_find_line_command (const char *args, int from_tty) { /* STUB_COMM PART_IMPLEMENTED */ static CORE_ADDR start_pc, end_pc; struct symtabs_and_lines sals; @@ -2176,7 +2176,7 @@ trace_find_line_command (char *args, int from_tty) /* tfind range command */ static void -trace_find_range_command (char *args, int from_tty) +trace_find_range_command (const char *args, int from_tty) { static CORE_ADDR start, stop; char start_str[40], stop_str[40]; @@ -2215,7 +2215,7 @@ trace_find_range_command (char *args, int from_tty) /* tfind outside command */ static void -trace_find_outside_command (char *args, int from_tty) +trace_find_outside_command (const char *args, int from_tty) { CORE_ADDR start, stop; char start_str[40], stop_str[40]; @@ -2254,7 +2254,7 @@ trace_find_outside_command (char *args, int from_tty) /* save-tracepoints command */ static void -tracepoint_save_command (char *args, int from_tty) +tracepoint_save_command (const char *args, int from_tty) { struct tracepoint *tp; struct action_line *line; @@ -2470,11 +2470,11 @@ replace_comma (void *data) /* tdump command */ static void -trace_dump_command (char *args, int from_tty) +trace_dump_command (const char *args, int from_tty) { struct tracepoint *t; struct action_line *action; - char *action_exp, *next_comma; + const char *action_exp, *next_comma; struct cleanup *old_cleanups; int stepping_actions = 0; int stepping_frame = 0; diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h index c464ae1f98c..b40a6c01b11 100644 --- a/gdb/tracepoint.h +++ b/gdb/tracepoint.h @@ -112,10 +112,10 @@ extern unsigned long trace_running_p; void (*create_tracepoint_hook) (struct tracepoint *); void (*delete_tracepoint_hook) (struct tracepoint *); void (*modify_tracepoint_hook) (struct tracepoint *); -void (*trace_find_hook) (char *arg, int from_tty); +void (*trace_find_hook) (char *const arg, int from_tty); void (*trace_start_stop_hook) (int start, int from_tty); -struct tracepoint *get_tracepoint_by_number (char **, int, int); +struct tracepoint *get_tracepoint_by_number (const char **, int, int); int get_traceframe_number (void); void free_actions (struct tracepoint *); enum actionline_type validate_actionline (char **, struct tracepoint *); diff --git a/gdb/typeprint.c b/gdb/typeprint.c index 22a1eab9707..6f901e7cff4 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -43,13 +43,13 @@ extern int objectprint; /* Controls looking up an object's derived type extern void _initialize_typeprint (void); -static void ptype_command (char *, int); +static void ptype_command (const char *, int); static struct type *ptype_eval (struct expression *); -static void whatis_command (char *, int); +static void whatis_command (const char *, int); -static void whatis_exp (char *, int); +static void whatis_exp (const char *, int); /* Print a description of a type in the format of a typedef for the current language. @@ -113,7 +113,7 @@ type_print (struct type *type, char *varstring, struct ui_file *stream, show is passed to type_print. */ static void -whatis_exp (char *exp, int show) +whatis_exp (const char *exp, int show) { struct expression *expr; struct value *val; @@ -175,7 +175,7 @@ whatis_exp (char *exp, int show) /* ARGSUSED */ static void -whatis_command (char *exp, int from_tty) +whatis_command (const char *exp, int from_tty) { /* Most of the time users do not want to see all the fields in a structure. If they do they can use the "ptype" command. @@ -202,7 +202,7 @@ ptype_eval (struct expression *exp) /* ARGSUSED */ static void -ptype_command (char *typename, int from_tty) +ptype_command (const char *typename, int from_tty) { register struct type *type; struct expression *expr; diff --git a/gdb/ui-file.c b/gdb/ui-file.c index 3af6d2cc3b2..216885282f9 100644 --- a/gdb/ui-file.c +++ b/gdb/ui-file.c @@ -476,7 +476,7 @@ stdio_fileopen (FILE *file) } struct ui_file * -gdb_fopen (char *name, char *mode) +gdb_fopen (const char *name, const char *mode) { FILE *f = fopen (name, mode); if (f == NULL) diff --git a/gdb/ui-file.h b/gdb/ui-file.h index 989c343dfa0..b708e3483e5 100644 --- a/gdb/ui-file.h +++ b/gdb/ui-file.h @@ -88,7 +88,7 @@ extern struct ui_file *mem_fileopen (void); extern struct ui_file *stdio_fileopen (FILE *file); /* Open NAME returning an STDIO based UI_FILE. */ -extern struct ui_file *gdb_fopen (char *name, char *mode); +extern struct ui_file *gdb_fopen (const char *name, const char *mode); /* Create a file which writes to both ONE and TWO. CLOSE_ONE and CLOSE_TWO indicate whether the original files should be diff --git a/gdb/utils.c b/gdb/utils.c index 3d820deae0b..5364b821ce1 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -102,7 +102,7 @@ static void malloc_botch (void); static void prompt_for_continue (void); -static void set_width_command (char *, int, struct cmd_list_element *); +static void set_width_command (const char *, int, struct cmd_list_element *); static void set_width (void); @@ -163,15 +163,15 @@ int sevenbit_strings = 0; /* String to be printed before error messages, if any. */ -char *error_pre_print; +const char *error_pre_print; /* String to be printed before quit messages, if any. */ -char *quit_pre_print; +const char *quit_pre_print; /* String to be printed before warning messages, if any. */ -char *warning_pre_print = "\nwarning: "; +const char *warning_pre_print = "\nwarning: "; int pagination_enabled = 1; @@ -1575,7 +1575,7 @@ static char *wrap_pointer; /* String to indent by if the wrap occurs. Must not be NULL if wrap_column is non-zero. */ -static char *wrap_indent; +static const char *wrap_indent; /* Column number on the screen where wrap_buffer begins, or 0 if wrapping is not in effect. */ @@ -1668,7 +1668,7 @@ set_width (void) /* ARGSUSED */ static void -set_width_command (char *args, int from_tty, struct cmd_list_element *c) +set_width_command (const char *args, int from_tty, struct cmd_list_element *c) { set_width (); } @@ -1765,7 +1765,7 @@ reinitialize_more_filter (void) used to force out output from the wrap_buffer. */ void -wrap_here (char *indent) +wrap_here (const char *indent) { /* This should have been allocated, but be paranoid anyway. */ if (!wrap_buffer) @@ -2279,7 +2279,7 @@ print_spaces_filtered (int n, struct ui_file *stream) demangling is off, the name is printed in its "raw" form. */ void -fprintf_symbol_filtered (struct ui_file *stream, char *name, +fprintf_symbol_filtered (struct ui_file *stream, const char *name, enum language lang, int arg_mode) { char *demangled; @@ -2448,16 +2448,16 @@ subset_compare (char *string_to_compare, char *template_string) } -static void pagination_on_command (char *arg, int from_tty); +static void pagination_on_command (const char *arg, int from_tty); static void -pagination_on_command (char *arg, int from_tty) +pagination_on_command (const char *arg, int from_tty) { pagination_enabled = 1; } -static void pagination_on_command (char *arg, int from_tty); +static void pagination_on_command (const char *arg, int from_tty); static void -pagination_off_command (char *arg, int from_tty) +pagination_off_command (const char *arg, int from_tty) { pagination_enabled = 0; } diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 1828d1c74df..e6b238e112e 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -958,7 +958,7 @@ v850_push_arguments (int nargs, struct value **args, CORE_ADDR sp, if (!v850_type_is_scalar (VALUE_TYPE (*args)) && TYPE_LENGTH (VALUE_TYPE (*args)) > E_MAX_RETTYPE_SIZE_IN_REGS) { - store_address (valbuf, 4, VALUE_ADDRESS (*args)); + store_unsigned_integer (valbuf, 4, VALUE_ADDRESS (*args)); len = 4; val = valbuf; } diff --git a/gdb/valprint.c b/gdb/valprint.c index d4b8bf5faf7..05b64a42010 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -45,19 +45,19 @@ static int partial_memory_read (CORE_ADDR memaddr, char *myaddr, static void print_hex_chars (struct ui_file *, unsigned char *, unsigned int); -static void show_print (char *, int); +static void show_print (const char *, int); -static void set_print (char *, int); +static void set_print (const char *, int); -static void set_radix (char *, int); +static void set_radix (const char *, int); -static void show_radix (char *, int); +static void show_radix (const char *, int); -static void set_input_radix (char *, int, struct cmd_list_element *); +static void set_input_radix (const char *, int, struct cmd_list_element *); static void set_input_radix_1 (int, unsigned); -static void set_output_radix (char *, int, struct cmd_list_element *); +static void set_output_radix (const char *, int, struct cmd_list_element *); static void set_output_radix_1 (int, unsigned); @@ -1185,7 +1185,7 @@ val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream) /* ARGSUSED */ static void -set_input_radix (char *args, int from_tty, struct cmd_list_element *c) +set_input_radix (const char *args, int from_tty, struct cmd_list_element *c) { set_input_radix_1 (from_tty, input_radix); } @@ -1218,7 +1218,7 @@ set_input_radix_1 (int from_tty, unsigned radix) /* ARGSUSED */ static void -set_output_radix (char *args, int from_tty, struct cmd_list_element *c) +set_output_radix (const char *args, int from_tty, struct cmd_list_element *c) { set_output_radix_1 (from_tty, output_radix); } @@ -1262,7 +1262,7 @@ set_output_radix_1 (int from_tty, unsigned radix) the 'set input-radix' command. */ static void -set_radix (char *arg, int from_tty) +set_radix (const char *arg, int from_tty) { unsigned radix; @@ -1280,7 +1280,7 @@ set_radix (char *arg, int from_tty) /*ARGSUSED */ static void -show_radix (char *arg, int from_tty) +show_radix (const char *arg, int from_tty) { if (from_tty) { @@ -1302,7 +1302,7 @@ show_radix (char *arg, int from_tty) /*ARGSUSED */ static void -set_print (char *arg, int from_tty) +set_print (const char *arg, int from_tty) { printf_unfiltered ( "\"set print\" must be followed by the name of a print subcommand.\n"); @@ -1311,7 +1311,7 @@ set_print (char *arg, int from_tty) /*ARGSUSED */ static void -show_print (char *args, int from_tty) +show_print (const char *args, int from_tty) { cmd_show_list (showprintlist, from_tty, ""); } diff --git a/gdb/value.h b/gdb/value.h index 54854e5f563..856a3f37084 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -431,17 +431,17 @@ extern struct value *evaluate_type (struct expression *exp); extern struct value *evaluate_subexp_with_coercion (struct expression *, int *, enum noside); -extern struct value *parse_and_eval (char *exp); +extern struct value *parse_and_eval (const char *exp); -extern struct value *parse_to_comma_and_eval (char **expp); +extern struct value *parse_to_comma_and_eval (const char **expp); extern struct type *parse_and_eval_type (char *p, int length); -extern CORE_ADDR parse_and_eval_address (char *exp); +extern CORE_ADDR parse_and_eval_address (const char *exp); -extern CORE_ADDR parse_and_eval_address_1 (char **expptr); +extern CORE_ADDR parse_and_eval_address_1 (const char **expptr); -extern LONGEST parse_and_eval_long (char *exp); +extern LONGEST parse_and_eval_long (const char *exp); extern struct value *access_value_history (int num); @@ -454,7 +454,7 @@ extern void set_internalvar_component (struct internalvar *var, int bitpos, int bitsize, struct value *newvalue); -extern struct internalvar *lookup_internalvar (char *name); +extern struct internalvar *lookup_internalvar (const char *name); extern int value_equal (struct value *arg1, struct value *arg2); diff --git a/gdb/values.c b/gdb/values.c index 88c6a61037b..a74198255ec 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -44,9 +44,9 @@ void _initialize_values (void); /* Prototypes for local functions. */ -static void show_values (char *, int); +static void show_values (const char *, int); -static void show_convenience (char *, int); +static void show_convenience (const char *, int); /* The value-history records all the values printed @@ -345,7 +345,7 @@ clear_value_history (void) } static void -show_values (char *num_exp, int from_tty) +show_values (const char *num_exp, int from_tty) { register int i; struct value *val; @@ -402,7 +402,7 @@ static struct internalvar *internalvars; one is created, with a void value. */ struct internalvar * -lookup_internalvar (char *name) +lookup_internalvar (const char *name) { register struct internalvar *var; @@ -496,7 +496,7 @@ clear_internalvars (void) } static void -show_convenience (char *ignore, int from_tty) +show_convenience (const char *ignore, int from_tty) { register struct internalvar *var; int varseen = 0; diff --git a/gdb/varobj.c b/gdb/varobj.c index 0c9f0484268..0aa23d7131d 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -433,7 +433,7 @@ varobj_create (char *objname, if (expression != NULL) { - char *p; + const char *p; enum varobj_languages lang; /* Parse and evaluate the expression, filling in as much @@ -795,7 +795,7 @@ varobj_set_value (struct varobj *var, char *expression) if (var->value != NULL && variable_editable (var) && !var->error) { - char *s = expression; + const char *s = expression; int i; input_radix = 10; /* ALWAYS reset to decimal temporarily */ diff --git a/gdb/wrapper.c b/gdb/wrapper.c index 6c9c6d60cef..f88955cfeeb 100644 --- a/gdb/wrapper.c +++ b/gdb/wrapper.c @@ -70,7 +70,7 @@ static int do_captured_value_struct_elt (struct ui_out *uiout, void *data); static int wrap_parse_and_eval_type (char *); int -gdb_parse_exp_1 (char **stringptr, struct block *block, int comma, +gdb_parse_exp_1 (const char **stringptr, struct block *block, int comma, struct expression **expression) { struct gdb_wrapper_arguments args; @@ -95,7 +95,7 @@ wrap_parse_exp_1 (char *argptr) { struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) argptr; - args->result.pointer = parse_exp_1((char **) args->args[0].pointer, + args->result.pointer = parse_exp_1((const char **) args->args[0].pointer, (struct block *) args->args[1].pointer, args->args[2].integer); return 1; diff --git a/gdb/wrapper.h b/gdb/wrapper.h index b287b29db1e..40e554700c6 100644 --- a/gdb/wrapper.h +++ b/gdb/wrapper.h @@ -27,7 +27,7 @@ struct block; /* Use this struct to pass arguments to wrapper routines. */ struct gdb_wrapper_arguments; -extern int gdb_parse_exp_1 (char **, struct block *, +extern int gdb_parse_exp_1 (const char **, struct block *, int, struct expression **); extern int gdb_evaluate_expression (struct expression *, struct value **); diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index d6aa0183e1e..7f170e909d9 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -985,7 +985,7 @@ xstormy16_address_to_pointer (struct type *type, void *buf, CORE_ADDR addr) if (addr2) addr = addr2; } - store_address (buf, TYPE_LENGTH (type), addr); + store_unsigned_integer (buf, TYPE_LENGTH (type), addr); } static CORE_ADDR |