+2017-04-05 Pedro Alves <palves@redhat.com>
+
+ * ada-exp.y (yyerror): Constify.
+ * ada-lang.c (bound_name, get_selections)
+ (ada_variant_discrim_type)
+ (ada_variant_discrim_name, ada_value_struct_elt)
+ (ada_lookup_struct_elt_type, is_unchecked_variant)
+ (ada_which_variant_applies, standard_exc, ada_get_next_arg)
+ (catch_ada_exception_command_split)
+ (catch_ada_assert_command_split, catch_assert_command)
+ (ada_op_name): Constify.
+ * ada-lang.h (ada_yyerror, get_selections)
+ (ada_variant_discrim_name, ada_value_struct_elt): Constify.
+ * arc-tdep.c (arc_print_frame_cache): Constify.
+ * arm-tdep.c (arm_skip_stub): Constify.
+ * ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref)
+ (gen_aggregate_elt_ref): Constify.
+ * bcache.c (print_bcache_statistics): Constify.
+ * bcache.h (print_bcache_statistics): Constify.
+ * break-catch-throw.c (catch_exception_command_1):
+ * breakpoint.c (struct ep_type_description::description):
+ Constify.
+ (add_solib_catchpoint): Constify.
+ (catch_fork_command_1): Add cast.
+ (add_catch_command): Constify.
+ * breakpoint.h (add_catch_command, add_solib_catchpoint):
+ Constify.
+ * bsd-uthread.c (bsd_uthread_state): Constify.
+ * buildsym.c (patch_subfile_names): Constify.
+ * buildsym.h (next_symbol_text_func, patch_subfile_names):
+ Constify.
+ * c-exp.y (yyerror): Constify.
+ (token::oper): Constify.
+ * c-lang.h (c_yyerror, cp_print_class_member): Constify.
+ * c-varobj.c (cplus_describe_child): Constify.
+ * charset.c (find_charset_names): Add cast.
+ (find_charset_names): Constify array and add const_cast.
+ * cli/cli-cmds.c (complete_command, cd_command): Constify.
+ (edit_command): Constify.
+ * cli/cli-decode.c (lookup_cmd): Constify.
+ * cli/cli-dump.c (dump_memory_command, dump_value_command):
+ Constify.
+ (struct dump_context): Constify.
+ (add_dump_command, restore_command): Constify.
+ * cli/cli-script.c (get_command_line): Constify.
+ * cli/cli-script.h (get_command_line): Constify.
+ * cli/cli-utils.c (check_for_argument): Constify.
+ * cli/cli-utils.h (check_for_argument): Constify.
+ * coff-pe-read.c (struct read_pe_section_data): Constify.
+ * command.h (lookup_cmd): Constify.
+ * common/print-utils.c (decimal2str): Constify.
+ * completer.c (gdb_print_filename): Constify.
+ * corefile.c (set_gnutarget): Constify.
+ * cp-name-parser.y (yyerror): Constify.
+ * cp-valprint.c (cp_print_class_member): Constify.
+ * cris-tdep.c (cris_register_name, crisv32_register_name):
+ Constify.
+ * d-exp.y (yyerror): Constify.
+ (struct token::oper): Constify.
+ * d-lang.h (d_yyerror): Constify.
+ * dbxread.c (struct header_file_location::name): Constify.
+ (add_old_header_file, add_new_header_file, last_function_name)
+ (dbx_next_symbol_text, add_bincl_to_list)
+ (find_corresponding_bincl_psymtab, set_namestring)
+ (find_stab_function_addr, read_dbx_symtab, start_psymtab)
+ (dbx_end_psymtab, read_ofile_symtab, process_one_symbol):
+ * defs.h (command_line_input, print_address_symbolic)
+ (deprecated_readline_begin_hook): Constify.
+ * dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name):
+ Constify.
+ * event-top.c (handle_line_of_input): Constify and add cast.
+ * exceptions.c (catch_errors): Constify.
+ * exceptions.h (catch_errors): Constify.
+ * expprint.c (print_subexp_standard, op_string, op_name)
+ (op_name_standard, dump_raw_expression, dump_raw_expression):
+ * expression.h (op_name, op_string, dump_raw_expression):
+ Constify.
+ * f-exp.y (yyerror): Constify.
+ (struct token::oper): Constify.
+ (struct f77_boolean_val::name): Constify.
+ * f-lang.c (f_word_break_characters): Constify.
+ * f-lang.h (f_yyerror): Constify.
+ * fork-child.c (fork_inferior): Add cast.
+ * frv-tdep.c (struct gdbarch_tdep::register_names): Constify.
+ (new_variant): Constify.
+ * gdbarch.sh (pstring_ptr, pstring_list): Constify.
+ * gdbarch.c: Regenerate.
+ * gdbcore.h (set_gnutarget): Constify.
+ * go-exp.y (yyerror): Constify.
+ (token::oper): Constify.
+ * go-lang.h (go_yyerror): Constify.
+ * go32-nat.c (go32_sysinfo): Constify.
+ * guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify.
+ * guile/scm-cmd.c (cmdscm_function): Constify.
+ * guile/scm-param.c (pascm_param_value): Constify.
+ * h8300-tdep.c (h8300_register_name, h8300s_register_name)
+ (h8300sx_register_name): Constify.
+ * hppa-tdep.c (hppa32_register_name, hppa64_register_name):
+ Constify.
+ * ia64-tdep.c (ia64_register_names): Constify.
+ * infcmd.c (construct_inferior_arguments): Constify.
+ (path_command, attach_post_wait): Constify.
+ * language.c (show_range_command, show_case_command)
+ (unk_lang_error): Constify.
+ * language.h (language_defn::la_error)
+ (language_defn::la_name_of_this): Constify.
+ * linespec.c (decode_line_2): Constify.
+ * linux-thread-db.c (thread_db_err_str): Constify.
+ * lm32-tdep.c (lm32_register_name): Constify.
+ * m2-exp.y (yyerror): Constify.
+ * m2-lang.h (m2_yyerror): Constify.
+ * m32r-tdep.c (m32r_register_names): Constify and make static.
+ * m68hc11-tdep.c (m68hc11_register_names): Constify.
+ * m88k-tdep.c (m88k_register_name): Constify.
+ * macroexp.c (appendmem): Constify.
+ * mdebugread.c (fdr_name, add_data_symbol, parse_type)
+ (upgrade_type, parse_external, parse_partial_symbols)
+ (mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab)
+ (new_symbol): Constify.
+ * memattr.c (mem_info_command): Constify.
+ * mep-tdep.c (register_name_from_keyword): Constify.
+ * mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env):
+ Constify.
+ * mi/mi-cmd-stack.c (list_args_or_locals): Constify.
+ * mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify.
+ * mi/mi-main.c (captured_mi_execute_command): Constify and add
+ cast.
+ (mi_execute_async_cli_command): Constify.
+ * mips-tdep.c (mips_register_name): Constify.
+ * mn10300-tdep.c (register_name, mn10300_generic_register_name)
+ (am33_register_name, am33_2_register_name)
+ * moxie-tdep.c (moxie_register_names): Constify.
+ * nat/linux-osdata.c (osdata_type): Constify fields.
+ * nto-tdep.c (nto_parse_redirection): Constify.
+ * objc-lang.c (lookup_struct_typedef, lookup_objc_class)
+ (lookup_child_selector): Constify.
+ (objc_methcall::name): Constify.
+ * objc-lang.h (lookup_objc_class, lookup_child_selector)
+ (lookup_struct_typedef): Constify.
+ * objfiles.c (pc_in_section): Constify.
+ * objfiles.h (pc_in_section): Constify.
+ * p-exp.y (struct token::oper): Constify.
+ (yyerror): Constify.
+ * p-lang.h (pascal_yyerror): Constify.
+ * parser-defs.h (op_name_standard): Constify.
+ (op_print::string): Constify.
+ (exp_descriptor::op_name): Constify.
+ * printcmd.c (print_address_symbolic): Constify.
+ * psymtab.c (print_partial_symbols): Constify.
+ * python/py-breakpoint.c (stop_func): Constify.
+ (bppy_get_expression): Constify.
+ * python/py-cmd.c (cmdpy_completer::name): Constify.
+ (cmdpy_function): Constify.
+ * python/py-event.c (evpy_add_attribute)
+ (gdbpy_initialize_event_generic): Constify.
+ * python/py-event.h (evpy_add_attribute)
+ (gdbpy_initialize_event_generic): Constify.
+ * python/py-evts.c (add_new_registry): Constify.
+ * python/py-finishbreakpoint.c (outofscope_func): Constify.
+ * python/py-framefilter.c (get_py_iter_from_func): Constify.
+ * python/py-inferior.c (get_buffer): Add cast.
+ * python/py-param.c (parm_constant::name): Constify.
+ * python/py-unwind.c (fprint_frame_id): Constify.
+ * python/python.c (gdbpy_parameter_value): Constify.
+ * remote-fileio.c (remote_fio_func_map): Make 'name' const.
+ * remote.c (memory_packet_config::name): Constify.
+ (show_packet_config_cmd, remote_write_bytes)
+ (remote_buffer_add_string):
+ * reverse.c (exec_reverse_once): Constify.
+ * rs6000-tdep.c (variant::name, variant::description): Constify.
+ * rust-exp.y (rustyyerror): Constify.
+ * rust-lang.c (rust_op_name): Constify.
+ * rust-lang.h (rustyyerror): Constify.
+ * serial.h (serial_ops::name): Constify.
+ * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name)
+ (sh_sh3e_register_name, sh_sh2e_register_name)
+ (sh_sh2a_register_name, sh_sh2a_nofpu_register_name)
+ (sh_sh_dsp_register_name, sh_sh3_dsp_register_name)
+ (sh_sh4_register_name, sh_sh4_nofpu_register_name)
+ (sh_sh4al_dsp_register_name): Constify.
+ * sh64-tdep.c (sh64_register_name): Constify.
+ * solib-darwin.c (lookup_symbol_from_bfd): Constify.
+ * spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify.
+ * stabsread.c (patch_block_stabs, read_type_number)
+ (ref_map::stabs, ref_add, process_reference)
+ (symbol_reference_defined, define_symbol, define_symbol)
+ (error_type, read_type, read_member_functions, read_cpp_abbrev)
+ (read_one_struct_field, read_struct_fields, read_baseclasses)
+ (read_tilde_fields, read_struct_type, read_array_type)
+ (read_enum_type, read_sun_builtin_type, read_sun_floating_type)
+ (read_huge_number, read_range_type, read_args, common_block_start)
+ (find_name_end): Constify.
+ * stabsread.h (common_block_start, define_symbol)
+ (process_one_symbol, symbol_reference_defined, ref_add):
+ * symfile.c (get_section_index, add_symbol_file_command):
+ * symfile.h (get_section_index): Constify.
+ * target-descriptions.c (tdesc_type::name): Constify.
+ (tdesc_free_type): Add cast.
+ * target.c (find_default_run_target):
+ (add_deprecated_target_alias, find_default_run_target)
+ (target_announce_detach): Constify.
+ (do_option): Constify.
+ * target.h (add_deprecated_target_alias): Constify.
+ * thread.c (print_thread_info_1): Constify.
+ * top.c (deprecated_readline_begin_hook, command_line_input):
+ Constify.
+ (init_main): Add casts.
+ * top.h (handle_line_of_input): Constify.
+ * tracefile-tfile.c (tfile_write_uploaded_tsv): Constify.
+ * tracepoint.c (tvariables_info_1, trace_status_mi): Constify.
+ (tfind_command): Rename to ...
+ (tfind_command_1): ... this and constify.
+ (tfind_command): New function.
+ (tfind_end_command, tfind_start_command): Adjust.
+ (encode_source_string): Constify.
+ * tracepoint.h (encode_source_string): Constify.
+ * tui/tui-data.c (tui_partial_win_by_name): Constify.
+ * tui/tui-data.h (tui_partial_win_by_name): Constify.
+ * tui/tui-source.c (tui_set_source_content_nil): Constify.
+ * tui/tui-source.h (tui_set_source_content_nil): Constify.
+ * tui/tui-win.c (parse_scrolling_args): Constify.
+ * tui/tui-windata.c (tui_erase_data_content): Constify.
+ * tui/tui-windata.h (tui_erase_data_content): Constify.
+ * tui/tui-winsource.c (tui_erase_source_content): Constify.
+ * tui/tui.c (tui_enable): Add cast.
+ * utils.c (defaulted_query): Constify.
+ (init_page_info): Add cast.
+ (puts_debug, subset_compare): Constify.
+ * utils.h (subset_compare): Constify.
+ * varobj.c (varobj_format_string): Constify.
+ * varobj.h (varobj_format_string): Constify.
+ * vax-tdep.c (vax_register_name): Constify.
+ * windows-nat.c (windows_detach): Constify.
+ * xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify.
+ * xml-support.c (gdb_xml_end_element): Constify.
+ * xml-tdesc.c (tdesc_start_reg): Constify.
+ * xstormy16-tdep.c (xstormy16_register_name): Constify.
+ * xtensa-tdep.c (xtensa_find_register_by_name): Constify.
+ * xtensa-tdep.h (xtensa_register_t::name): Constify.
+
2017-04-05 Pedro Alves <palves@redhat.com>
* proc-api.c (struct trans): Constify.
static int yylex (void);
-void yyerror (char *);
+void yyerror (const char *);
static void write_int (struct parser_state *, LONGEST, struct type *);
}
void
-yyerror (char *msg)
+yyerror (const char *msg)
{
error (_("Error in expression, near `%s'."), lexptr);
}
static int possible_user_operator_p (enum exp_opcode, struct value **);
-static char *ada_op_name (enum exp_opcode);
+static const char *ada_op_name (enum exp_opcode);
static const char *ada_decoded_op_name (enum exp_opcode);
static struct symbol *find_old_style_renaming_symbol (const char *,
const struct block *);
-static struct type *ada_lookup_struct_elt_type (struct type *, char *,
+static struct type *ada_lookup_struct_elt_type (struct type *, const char *,
int, int, int *);
static struct value *evaluate_subexp_type (struct expression *, int *);
/* Names of MAX_ADA_DIMENS bounds in P_BOUNDS fields of array descriptors. */
-static char *bound_name[] = {
+static const char *bound_name[] = {
"LB0", "UB0", "LB1", "UB1", "LB2", "UB2", "LB3", "UB3",
"LB4", "UB4", "LB5", "UB5", "LB6", "UB6", "LB7", "UB7"
};
int
get_selections (int *choices, int n_choices, int max_results,
- int is_all_choice, char *annotation_suffix)
+ int is_all_choice, const char *annotation_suffix)
{
char *args;
- char *prompt;
+ const char *prompt;
int n_chosen;
int first_choice = is_all_choice ? 2 : 1;
struct type *
ada_variant_discrim_type (struct type *var_type, struct type *outer_type)
{
- char *name = ada_variant_discrim_name (var_type);
+ const char *name = ada_variant_discrim_name (var_type);
return ada_lookup_struct_elt_type (outer_type, name, 1, 1, NULL);
}
returns the name of the discriminant controlling the variant.
The value is valid until the next call to ada_variant_discrim_name. */
-char *
+const char *
ada_variant_discrim_name (struct type *type0)
{
static char *result = NULL;
calling error. */
struct value *
-ada_value_struct_elt (struct value *arg, char *name, int no_err)
+ada_value_struct_elt (struct value *arg, const char *name, int no_err)
{
struct type *t, *t1;
struct value *v;
TYPE is not a type of the right kind. */
static struct type *
-ada_lookup_struct_elt_type (struct type *type, char *name, int refok,
+ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
int noerr, int *dispp)
{
int i;
static int
is_unchecked_variant (struct type *var_type, struct type *outer_type)
{
- char *discrim_name = ada_variant_discrim_name (var_type);
+ const char *discrim_name = ada_variant_discrim_name (var_type);
return (ada_lookup_struct_elt_type (outer_type, discrim_name, 0, 1, NULL)
== NULL);
{
int others_clause;
int i;
- char *discrim_name = ada_variant_discrim_name (var_type);
+ const char *discrim_name = ada_variant_discrim_name (var_type);
struct value *outer;
struct value *discrim;
LONGEST discrim_val;
an Ada83 compiler). As such, we do not include Numeric_Error from
this list of standard exceptions. */
-static char *standard_exc[] = {
+static const char *standard_exc[] = {
"constraint_error",
"program_error",
"storage_error",
Return NULL if ARGPS does not contain any more tokens. */
static char *
-ada_get_next_arg (char **argsp)
+ada_get_next_arg (const char **argsp)
{
- char *args = *argsp;
- char *end;
+ const char *args = *argsp;
+ const char *end;
char *result;
- args = skip_spaces (args);
+ args = skip_spaces_const (args);
if (args[0] == '\0')
return NULL; /* No more arguments. */
/* Find the end of the current argument. */
- end = skip_to_space (args);
+ end = skip_to_space_const (args);
/* Adjust ARGSP to point to the start of the next argument. */
after use). Otherwise COND_STRING is set to NULL. */
static void
-catch_ada_exception_command_split (char *args,
+catch_ada_exception_command_split (const char *args,
enum ada_exception_catchpoint_kind *ex,
char **excep_string,
char **cond_string)
/* Check to see if we have a condition. */
- args = skip_spaces (args);
+ args = skip_spaces_const (args);
if (startswith (args, "if")
&& (isspace (args[2]) || args[2] == '\0'))
{
args += 2;
- args = skip_spaces (args);
+ args = skip_spaces_const (args);
if (args[0] == '\0')
error (_("Condition missing after `if' keyword"));
/* Implement the "catch exception" command. */
static void
-catch_ada_exception_command (char *arg, int from_tty,
+catch_ada_exception_command (char *arg_entry, int from_tty,
struct cmd_list_element *command)
{
+ const char *arg = arg_entry;
struct gdbarch *gdbarch = get_current_arch ();
int tempflag;
enum ada_exception_catchpoint_kind ex_kind;
(the memory needs to be deallocated after use). */
static void
-catch_ada_assert_command_split (char *args, char **cond_string)
+catch_ada_assert_command_split (const char *args, char **cond_string)
{
- args = skip_spaces (args);
+ args = skip_spaces_const (args);
/* Check whether a condition was provided. */
if (startswith (args, "if")
&& (isspace (args[2]) || args[2] == '\0'))
{
args += 2;
- args = skip_spaces (args);
+ args = skip_spaces_const (args);
if (args[0] == '\0')
error (_("condition missing after `if' keyword"));
*cond_string = xstrdup (args);
/* Implement the "catch assert" command. */
static void
-catch_assert_command (char *arg, int from_tty,
+catch_assert_command (char *arg_entry, int from_tty,
struct cmd_list_element *command)
{
+ const char *arg = arg_entry;
struct gdbarch *gdbarch = get_current_arch ();
int tempflag;
char *cond_string = NULL;
return 0;
}
-static char *
+static const char *
ada_op_name (enum exp_opcode opcode)
{
switch (opcode)
extern int ada_parse (struct parser_state *); /* Defined in ada-exp.y */
-extern void ada_yyerror (char *); /* Defined in ada-exp.y */
+extern void ada_yyerror (const char *); /* Defined in ada-exp.y */
/* Defined in ada-typeprint.c */
extern void ada_print_type (struct type *, const char *, struct ui_file *, int,
extern int user_select_syms (struct block_symbol *, int, int);
-extern int get_selections (int *, int, int, int, char *);
+extern int get_selections (int *, int, int, int, const char *);
extern int ada_scan_number (const char *, int, LONGEST *, int *);
extern int ada_in_variant (LONGEST, struct type *, int);
-extern char *ada_variant_discrim_name (struct type *);
+extern const char *ada_variant_discrim_name (struct type *);
-extern struct value *ada_value_struct_elt (struct value *, char *, int);
+extern struct value *ada_value_struct_elt (struct value *, const char *, int);
extern int ada_is_aligner_type (struct type *);
/* Dump the frame info. Used for internal debugging only. */
static void
-arc_print_frame_cache (struct gdbarch *gdbarch, char *message,
+arc_print_frame_cache (struct gdbarch *gdbarch, const char *message,
struct arc_frame_cache *cache, int addresses_known)
{
debug_printf ("arc: frame_info %s\n", message);
{
/* Use the name suffix to determine which register contains the
target PC. */
- static char *table[15] =
+ static const char *table[15] =
{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "sl", "fp", "ip", "sp", "lr"
};
struct axs_value *value1,
struct axs_value *value2,
enum agent_op op,
- enum agent_op op_unsigned, int may_carry, char *name);
+ enum agent_op op_unsigned, int may_carry,
+ const char *name);
static void gen_logical_not (struct agent_expr *ax, struct axs_value *value,
struct type *result_type);
static void gen_complement (struct agent_expr *ax, struct axs_value *value);
static int gen_struct_ref_recursive (struct expression *exp,
struct agent_expr *ax,
struct axs_value *value,
- char *field, int offset,
+ const char *field, int offset,
struct type *type);
static void gen_struct_ref (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- char *field,
- char *operator_name, char *operand_name);
+ const char *field,
+ const char *operator_name,
+ const char *operand_name);
static void gen_static_field (struct gdbarch *gdbarch,
struct agent_expr *ax, struct axs_value *value,
struct type *type, int fieldno);
gen_binop (struct agent_expr *ax, struct axs_value *value,
struct axs_value *value1, struct axs_value *value2,
enum agent_op op, enum agent_op op_unsigned,
- int may_carry, char *name)
+ int may_carry, const char *name)
{
/* We only handle INT op INT. */
if ((TYPE_CODE (value1->type) != TYPE_CODE_INT)
static int
gen_struct_ref_recursive (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- char *field, int offset, struct type *type)
+ const char *field, int offset, struct type *type)
{
int i, rslt;
int nbases = TYPE_N_BASECLASSES (type);
it operates on; we use them in error messages. */
static void
gen_struct_ref (struct expression *exp, struct agent_expr *ax,
- struct axs_value *value, char *field,
- char *operator_name, char *operand_name)
+ struct axs_value *value, const char *field,
+ const char *operator_name, const char *operand_name)
{
struct type *type;
int found;
gen_aggregate_elt_ref (struct expression *exp,
struct agent_expr *ax, struct axs_value *value,
struct type *type, char *field,
- char *operator_name, char *operand_name)
+ const char *operator_name,
+ const char *operand_name)
{
switch (TYPE_CODE (type))
{
BCACHE holds. Statistics are printed using `printf_filtered' and
its ilk. */
void
-print_bcache_statistics (struct bcache *c, char *type)
+print_bcache_statistics (struct bcache *c, const char *type)
{
int occupied_buckets;
int max_chain_length;
eliminating duplication. TYPE should be a string describing the
kind of data BCACHE holds. Statistics are printed using
`printf_filtered' and its ilk. */
-extern void print_bcache_statistics (struct bcache *bcache, char *type);
+extern void print_bcache_statistics (struct bcache *bcache, const char *type);
extern int bcache_memory_used (struct bcache *bcache);
/* The hash functions */
struct ep_type_description
{
enum bptype type;
- char *description;
+ const char *description;
};
static struct ep_type_description bptypes[] =
{
created in an enabled state. */
void
-add_solib_catchpoint (char *arg, int is_load, int is_temp, int enabled)
+add_solib_catchpoint (const char *arg, int is_load, int is_temp, int enabled)
{
struct solib_catchpoint *c;
struct gdbarch *gdbarch = get_current_arch ();
if (!arg)
arg = "";
- arg = skip_spaces (arg);
+ arg = skip_spaces_const (arg);
c = new solib_catchpoint ();
cleanup = make_cleanup (xfree, c);
static struct cmd_list_element *tcatch_cmdlist;
void
-add_catch_command (char *name, char *docstring,
+add_catch_command (const char *name, const char *docstring,
cmd_sfunc_ftype *sfunc,
completer_ftype *completer,
void *user_data_catch,
function. */
extern void
- add_catch_command (char *name, char *docstring,
+ add_catch_command (const char *name, const char *docstring,
cmd_sfunc_ftype *sfunc,
completer_ftype *completer,
void *user_data_catch,
/* Shared helper function (MI and CLI) for creating and installing
a shared object event catchpoint. */
-extern void add_solib_catchpoint (char *arg, int is_load, int is_temp,
+extern void add_solib_catchpoint (const char *arg, int is_load, int is_temp,
int enabled);
/* Enable breakpoints and delete when hit. Called with ARG == NULL
}
/* Possible states a thread can be in. */
-static char *bsd_uthread_state[] =
+static const char *bsd_uthread_state[] =
{
"RUNNING",
"SIGTHREAD",
directory name actually is (by checking for a trailing '/'). */
void
-patch_subfile_names (struct subfile *subfile, char *name)
+patch_subfile_names (struct subfile *subfile, const char *name)
{
if (subfile != NULL
&& buildsym_compunit->comp_dir == NULL
/* Function to invoke get the next symbol. Return the symbol name. */
-EXTERN char *(*next_symbol_text_func) (struct objfile *);
+EXTERN const char *(*next_symbol_text_func) (struct objfile *);
extern void add_symbol_to_list (struct symbol *symbol,
struct pending **listhead);
extern void start_subfile (const char *name);
-extern void patch_subfile_names (struct subfile *subfile, char *name);
+extern void patch_subfile_names (struct subfile *subfile, const char *name);
extern void push_subfile (void);
static int yylex (void);
-void yyerror (char *);
+void yyerror (const char *);
static int type_aggregate_p (struct type *);
struct token
{
- char *oper;
+ const char *oper;
int token;
enum exp_opcode opcode;
token_flags flags;
#endif
void
-yyerror (char *msg)
+yyerror (const char *msg)
{
if (prev_lexptr)
lexptr = prev_lexptr;
extern int c_parse (struct parser_state *);
-extern void c_yyerror (char *);
+extern void c_yyerror (const char *);
extern int c_parse_escape (const char **, struct obstack *);
/* These are in cp-valprint.c */
extern void cp_print_class_member (const gdb_byte *, struct type *,
- struct ui_file *, char *);
+ struct ui_file *, const char *);
extern void cp_print_value_fields (struct type *, struct type *,
LONGEST, CORE_ADDR,
}
else
{
- char *access = NULL;
+ const char *access = NULL;
int children[3];
cplus_class_num_children (type, children);
static void
find_charset_names (void)
{
- VEC_safe_push (char_ptr, charsets, GDB_DEFAULT_HOST_CHARSET);
+ /* Cast is fine here, because CHARSETS is never released. Note that
+ the vec does not hold "const char *" pointers instead of "char *"
+ because the non-phony version stores heap-allocated strings in
+ it. */
+ VEC_safe_push (char_ptr, charsets, (char *) GDB_DEFAULT_HOST_CHARSET);
VEC_safe_push (char_ptr, charsets, NULL);
}
find_charset_names (void)
{
struct pex_obj *child;
- char *args[3];
+ const char *args[3];
int err, status;
int fail = 1;
int flags;
#endif
/* Note that we simply ignore errors here. */
if (!pex_run_in_environment (child, flags,
- args[0], args, environ_vector (iconv_env),
+ args[0], const_cast<char **> (args),
+ environ_vector (iconv_env),
NULL, NULL, &err))
{
FILE *in = pex_read_output (child, 0);
[Is that why this function writes output with *_unfiltered?] */
static void
-complete_command (char *arg, int from_tty)
+complete_command (char *arg_entry, int from_tty)
{
+ const char *arg = arg_entry;
int argpoint;
- char *point, *arg_prefix;
+ char *arg_prefix;
VEC (char_ptr) *completions;
dont_repeat ();
within, and except for filenames at the beginning of, the word to
be completed. The following crude imitation of readline's
word-breaking tries to accomodate this. */
- point = arg + argpoint;
+ const char *point = arg + argpoint;
while (point > arg)
{
if (strchr (rl_completer_word_break_characters, point[-1]) != 0)
repeat might be useful but is more likely to be a mistake. */
dont_repeat ();
- if (dir == 0)
- dir = "~";
-
- dir = tilde_expand (dir);
+ dir = tilde_expand (dir != NULL ? dir : "~");
cleanup = make_cleanup (xfree, dir);
if (chdir (dir) < 0)
struct symtabs_and_lines sals;
struct symtab_and_line sal;
struct symbol *sym;
- char *editor;
+ const char *editor;
char *p;
const char *fn;
the function field of the struct cmd_list_element is 0). */
struct cmd_list_element *
-lookup_cmd (const char **line, struct cmd_list_element *list, char *cmdtype,
+lookup_cmd (const char **line, struct cmd_list_element *list,
+ const char *cmdtype,
int allow_unknown, int ignore_help_classes)
{
struct cmd_list_element *last_list = 0;
}
static void
-dump_memory_command (char *cmd, char *mode)
+dump_memory_command (char *cmd, const char *mode)
{
dump_memory_to_file (cmd, mode, "binary");
}
}
static void
-dump_value_command (char *cmd, char *mode)
+dump_value_command (char *cmd, const char *mode)
{
dump_value_to_file (cmd, mode, "binary");
}
struct dump_context
{
- void (*func) (char *cmd, char *mode);
- char *mode;
+ void (*func) (char *cmd, const char *mode);
+ const char *mode;
};
static void
}
static void
-add_dump_command (char *name, void (*func) (char *args, char *mode),
- char *descr)
+add_dump_command (const char *name,
+ void (*func) (char *args, const char *mode),
+ const char *descr)
{
struct cmd_list_element *c;
filename = scan_filename_with_cleanup (&args, NULL);
if (args != NULL && *args != '\0')
{
- char *binary_string = "binary";
+ static const char binary_string[] = "binary";
/* Look for optional "binary" flag. */
if (startswith (args, binary_string))
such as "if" and "while". */
struct command_line *
-get_command_line (enum command_control_type type, char *arg)
+get_command_line (enum command_control_type type, const char *arg)
{
struct command_line *cmd;
struct cleanup *old_chain = NULL;
execute_control_command_untraced (struct command_line *cmd);
extern struct command_line *get_command_line (enum command_control_type,
- char *);
+ const char *);
extern void print_command_lines (struct ui_out *,
struct command_line *, unsigned int);
enum minimal_symbol_type ms_type; /* Type to assign symbols in
section. */
unsigned int index; /* BFD section number. */
- char *section_name; /* Recorded section name. */
+ const char *section_name; /* Recorded section name. */
};
#define IMAGE_SCN_CNT_CODE 0x20
#define CMD_LIST_AMBIGUOUS ((struct cmd_list_element *) -1)
extern struct cmd_list_element *lookup_cmd (const char **,
- struct cmd_list_element *, char *,
+ struct cmd_list_element *,
+ const char *,
int, int);
extern struct cmd_list_element *lookup_cmd_1 (const char **,
}
static char *
-decimal2str (char *sign, ULONGEST addr, int width)
+decimal2str (const char *sign, ULONGEST addr, int width)
{
/* Steal code from valprint.c:print_decimal(). Should this worry
about the real size of addr as the above does? */
const struct match_list_displayer *displayer)
{
int printed_len, extension_char, slen, tlen;
- char *s, c, *new_full_pathname, *dn;
+ char *s, c, *new_full_pathname;
+ const char *dn;
extern int _rl_complete_mark_directories;
extension_char = 0;
/* Set the gnutarget. */
void
-set_gnutarget (char *newtarget)
+set_gnutarget (const char *newtarget)
{
if (gnutarget_string != NULL)
xfree (gnutarget_string);
int yyparse (void);
static int yylex (void);
-static void yyerror (char *);
+static void yyerror (const char *);
/* Enable yydebug for the stand-alone parser. */
#ifdef TEST_CPNAMES
}
static void
-yyerror (char *msg)
+yyerror (const char *msg)
{
if (global_errmsg)
return;
void
cp_print_class_member (const gdb_byte *valaddr, struct type *type,
- struct ui_file *stream, char *prefix)
+ struct ui_file *stream, const char *prefix)
{
enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
static const char *
cris_register_name (struct gdbarch *gdbarch, int regno)
{
- static char *cris_genreg_names[] =
+ static const char *cris_genreg_names[] =
{ "r0", "r1", "r2", "r3", \
"r4", "r5", "r6", "r7", \
"r8", "r9", "r10", "r11", \
static const char *
crisv32_register_name (struct gdbarch *gdbarch, int regno)
{
- static char *crisv32_genreg_names[] =
+ static const char *crisv32_genreg_names[] =
{ "r0", "r1", "r2", "r3", \
"r4", "r5", "r6", "r7", \
"r8", "r9", "r10", "r11", \
"r12", "r13", "sp", "acr"
};
- static char *crisv32_sreg_names[] =
+ static const char *crisv32_sreg_names[] =
{ "s0", "s1", "s2", "s3", \
"s4", "s5", "s6", "s7", \
"s8", "s9", "s10", "s11", \
static int yylex (void);
-void yyerror (char *);
+void yyerror (const char *);
static int type_aggregate_p (struct type *);
struct token
{
- char *oper;
+ const char *oper;
int token;
enum exp_opcode opcode;
};
}
void
-yyerror (char *msg)
+yyerror (const char *msg)
{
if (prev_lexptr)
lexptr = prev_lexptr;
extern int d_parse (struct parser_state *);
-extern void d_yyerror (char *);
+extern void d_yyerror (const char *);
/* Defined in d-lang.c */
struct header_file_location
{
- char *name; /* Name of header file */
+ const char *name; /* Name of header file */
int instance; /* See above */
struct partial_symtab *pst; /* Partial symtab that has the
BINCL/EINCL defs for this file. */
static void free_bincl_list (struct objfile *);
-static struct partial_symtab *find_corresponding_bincl_psymtab (char *, int);
+static struct partial_symtab *find_corresponding_bincl_psymtab (const char *,
+ int);
-static void add_bincl_to_list (struct partial_symtab *, char *, int);
+static void add_bincl_to_list (struct partial_symtab *, const char *, int);
static void init_bincl_list (int, struct objfile *);
-static char *dbx_next_symbol_text (struct objfile *);
+static const char *dbx_next_symbol_text (struct objfile *);
static void fill_symbuf (bfd *);
const char *, CORE_ADDR, int,
struct objfile *);
-static void add_new_header_file (char *, int);
+static void add_new_header_file (const char *, int);
-static void add_old_header_file (char *, int);
+static void add_old_header_file (const char *, int);
static void add_this_object_header_file (int);
-static struct partial_symtab *start_psymtab (struct objfile *, char *,
+static struct partial_symtab *start_psymtab (struct objfile *, const char *,
CORE_ADDR, int,
struct partial_symbol **,
struct partial_symbol **);
symbol tables for the same header file. */
static void
-add_old_header_file (char *name, int instance)
+add_old_header_file (const char *name, int instance)
{
struct header_file *p = HEADER_FILES (dbxread_objfile);
int i;
so we record the file when its "begin" is seen and ignore the "end". */
static void
-add_new_header_file (char *name, int instance)
+add_new_header_file (const char *name, int instance)
{
int i;
struct header_file *hfile;
/* Name of last function encountered. Used in Solaris to approximate
object file boundaries. */
-static char *last_function_name;
+static const char *last_function_name;
/* The address in memory of the string table of the object file we are
reading (which might not be the "main" object file, but might be a
(a \ at the end of the text of a name)
call this function to get the continuation. */
-static char *
+static const char *
dbx_next_symbol_text (struct objfile *objfile)
{
struct internal_nlist nlist;
/* Add a bincl to the list. */
static void
-add_bincl_to_list (struct partial_symtab *pst, char *name, int instance)
+add_bincl_to_list (struct partial_symtab *pst, const char *name, int instance)
{
if (next_bincl >= bincl_list + bincls_allocated)
{
with that header_file_location. */
static struct partial_symtab *
-find_corresponding_bincl_psymtab (char *name, int instance)
+find_corresponding_bincl_psymtab (const char *name, int instance)
{
struct header_file_location *bincl;
give a fake name, and print a single error message per symbol file read,
rather than abort the symbol reading or flood the user with messages. */
-static char *
+static const char *
set_namestring (struct objfile *objfile, const struct internal_nlist *nlist)
{
- char *namestring;
+ const char *namestring;
if (nlist->n_strx + file_string_table_offset
>= DBX_STRINGTAB_SIZE (objfile)
}
static CORE_ADDR
-find_stab_function_addr (char *namestring, const char *filename,
+find_stab_function_addr (const char *namestring, const char *filename,
struct objfile *objfile)
{
struct bound_minimal_symbol msym;
- char *p;
int n;
- p = strchr (namestring, ':');
- if (p == NULL)
- p = namestring;
- n = p - namestring;
- p = (char *) alloca (n + 2);
+ const char *colon = strchr (namestring, ':');
+ if (colon == NULL)
+ n = 0;
+ else
+ n = colon - namestring;
+
+ char *p = (char *) alloca (n + 2);
strncpy (p, namestring, n);
p[n] = 0;
struct internal_nlist nlist;
CORE_ADDR text_addr;
int text_size;
- char *sym_name;
+ const char *sym_name;
int sym_len;
- char *namestring;
+ const char *namestring;
int nsl;
int past_first_source_file = 0;
CORE_ADDR last_function_start = 0;
static int prev_so_symnum = -10;
static int first_so_symnum;
const char *p;
- static char *dirname_nso;
+ static const char *dirname_nso;
int prev_textlow_not_set;
valu = nlist.n_value + ANOFFSET (objfile->section_offsets,
case N_M2C: /* I suspect that I can ignore this here. */
case N_SCOPE: /* Same. */
{
- char *p;
+ const char *p;
namestring = set_namestring (objfile, &nlist);
Accept either. */
while (*p && *p != ';' && *p != ',')
{
- char *q;
+ const char *q;
/* Check for and handle cretinous dbx symbol name
continuation! */
(normal). */
static struct partial_symtab *
-start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow,
+start_psymtab (struct objfile *objfile, const char *filename, CORE_ADDR textlow,
int ldsymoff, struct partial_symbol **global_syms,
struct partial_symbol **static_syms)
{
if (pst->texthigh == 0 && last_function_name
&& gdbarch_sofun_address_maybe_missing (gdbarch))
{
- char *p;
int n;
struct bound_minimal_symbol minsym;
- p = strchr (last_function_name, ':');
- if (p == NULL)
- p = last_function_name;
- n = p - last_function_name;
- p = (char *) alloca (n + 2);
+ const char *colon = strchr (last_function_name, ':');
+ if (colon == NULL)
+ n = 0;
+ else
+ n = colon - last_function_name;
+ char *p = (char *) alloca (n + 2);
strncpy (p, last_function_name, n);
p[n] = 0;
static void
read_ofile_symtab (struct objfile *objfile, struct partial_symtab *pst)
{
- char *namestring;
+ const char *namestring;
struct external_nlist *bufp;
struct internal_nlist nlist;
unsigned char type;
is used in end_symtab. */
void
-process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
+process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
const struct section_offsets *section_offsets,
struct objfile *objfile)
{
down ONE MORE function call level, which we really don't want
to do). */
{
- char *p;
+ const char *p;
/* Normal object file and NLMs have non-zero text seg offsets,
but don't need their static syms offset in this fashion.
if (name)
{
int deftype;
- char *colon_pos = strchr (name, ':');
+ const char *colon_pos = strchr (name, ':');
if (colon_pos == NULL)
deftype = '\0';
definition. If a symbol reference is being defined, go ahead
and add it. Otherwise, just return. */
- char *s = name;
+ const char *s = name;
int refnum;
/* If this stab defines a new reference ID that is not on the
extern char *gdb_readline_wrapper (const char *);
-extern char *command_line_input (const char *, int, char *);
+extern char *command_line_input (const char *, int, const char *);
extern void print_prompt (void);
extern void set_next_address (struct gdbarch *, CORE_ADDR);
extern int print_address_symbolic (struct gdbarch *, CORE_ADDR,
- struct ui_file *, int, char *);
+ struct ui_file *, int,
+ const char *);
extern int build_address_symbolic (struct gdbarch *,
CORE_ADDR addr,
extern void (*deprecated_warning_hook) (const char *, va_list)
ATTRIBUTE_FPTR_PRINTF(1,0);
extern void (*deprecated_interactive_hook) (void);
-extern void (*deprecated_readline_begin_hook) (char *, ...)
+extern void (*deprecated_readline_begin_hook) (const char *, ...)
ATTRIBUTE_FPTR_PRINTF_1;
extern char *(*deprecated_readline_hook) (const char *);
extern void (*deprecated_readline_end_hook) (void);
static const char *dwarf_form_name (unsigned int);
-static char *dwarf_bool_name (unsigned int);
+static const char *dwarf_bool_name (unsigned int);
static const char *dwarf_type_encoding_name (unsigned int);
prefix part in such case. See
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47510. */
-static char *
+static const char *
anonymous_struct_prefix (struct die_info *die, struct dwarf2_cu *cu)
{
struct attribute *attr;
struct die_info *parent, *spec_die;
struct dwarf2_cu *spec_cu;
struct type *parent_type;
- char *retval;
+ const char *retval;
if (cu->language != language_cplus
&& cu->language != language_fortran && cu->language != language_d
return name;
}
-static char *
+static const char *
dwarf_bool_name (unsigned mybool)
{
if (mybool)
char *
handle_line_of_input (struct buffer *cmd_line_buffer,
- char *rl, int repeat, char *annotation_suffix)
+ char *rl, int repeat, const char *annotation_suffix)
{
struct ui *ui = current_ui;
int from_tty = ui->instream == ui->stdin_stream;
/* This function is superseded by catch_exceptions(). */
int
-catch_errors (catch_errors_ftype *func, void *func_args, char *errstring,
- return_mask mask)
+catch_errors (catch_errors_ftype *func, void *func_args,
+ const char *errstring, return_mask mask)
{
struct gdb_exception exception = exception_none;
volatile int val = 0;
This function is superseded by catch_exceptions(). */
typedef int (catch_errors_ftype) (void *);
-extern int catch_errors (catch_errors_ftype *, void *, char *, return_mask);
+extern int catch_errors (catch_errors_ftype *, void *,
+ const char *, return_mask);
/* Compare two exception objects for print equality. */
extern int exception_print_same (struct gdb_exception e1,
const struct op_print *op_print_tab;
int pc;
unsigned nargs;
- char *op_str;
+ const char *op_str;
int assign_modify = 0;
enum exp_opcode opcode;
enum precedence myprec = PREC_NULL;
/* Return the operator corresponding to opcode OP as
a string. NULL indicates that the opcode was not found in the
current language table. */
-char *
+const char *
op_string (enum exp_opcode op)
{
int tem;
/* Name for OPCODE, when it appears in expression EXP. */
-char *
+const char *
op_name (struct expression *exp, enum exp_opcode opcode)
{
return exp->language_defn->la_exp_desc->op_name (opcode);
/* Default name for the standard operator OPCODE (i.e., one defined in
the definition of enum exp_opcode). */
-char *
+const char *
op_name_standard (enum exp_opcode opcode)
{
switch (opcode)
void
dump_raw_expression (struct expression *exp, struct ui_file *stream,
- char *note)
+ const char *note)
{
int elt;
- char *opcode_name;
char *eltscan;
int eltsize;
for (elt = 0; elt < exp->nelts; elt++)
{
fprintf_filtered (stream, "\t%5d ", elt);
- opcode_name = op_name (exp, exp->elts[elt].opcode);
+ const char *opcode_name = op_name (exp, exp->elts[elt].opcode);
fprintf_filtered (stream, "%20s ", opcode_name);
+
print_longest (stream, 'd', 0, exp->elts[elt].longconst);
fprintf_filtered (stream, " ");
extern void print_expression (struct expression *, struct ui_file *);
-extern char *op_name (struct expression *exp, enum exp_opcode opcode);
+extern const char *op_name (struct expression *exp, enum exp_opcode opcode);
-extern char *op_string (enum exp_opcode);
+extern const char *op_string (enum exp_opcode);
extern void dump_raw_expression (struct expression *,
- struct ui_file *, char *);
+ struct ui_file *, const char *);
extern void dump_prefix_expression (struct expression *, struct ui_file *);
/* In an OP_RANGE expression, either bound could be empty, indicating
static int yylex (void);
-void yyerror (char *);
+void yyerror (const char *);
static void growbuf_by_size (int);
struct token
{
- char *oper;
+ const char *oper;
int token;
enum exp_opcode opcode;
};
struct f77_boolean_val
{
- char *name;
+ const char *name;
int value;
};
}
void
-yyerror (char *msg)
+yyerror (const char *msg)
{
if (prev_lexptr)
lexptr = prev_lexptr;
extern int f_parse (struct parser_state *);
-extern void f_yyerror (char *); /* Defined in f-exp.y */
+extern void f_yyerror (const char *); /* Defined in f-exp.y */
extern void f_print_type (struct type *, const char *, struct ui_file *, int,
int, const struct type_print_options *);
<args>". */
argv = (char **) alloca (4 * sizeof (char *));
argv[0] = shell_file;
- argv[1] = "-c";
+ argv[1] = (char *) "-c";
argv[2] = shell_command;
argv[3] = (char *) 0;
}
int num_hw_breakpoints;
/* Register names. */
- char **register_names;
+ const char **register_names;
};
/* Return the FR-V ABI associated with GDBARCH. */
/* By default, don't supply any general-purpose or floating-point
register names. */
var->register_names
- = (char **) xmalloc ((frv_num_regs + frv_num_pseudo_regs)
- * sizeof (char *));
+ = (const char **) xmalloc ((frv_num_regs + frv_num_pseudo_regs)
+ * sizeof (const char *));
for (r = 0; r < frv_num_regs + frv_num_pseudo_regs; r++)
var->register_names[r] = "";
return string;
}
-static char *
+static const char *
pstring_ptr (char **string)
{
if (string == NULL || *string == NULL)
/* Helper function to print a list of strings, represented as "const
char *const *". The list is printed comma-separated. */
-static char *
+static const char *
pstring_list (const char *const *list)
{
static char ret[100];
return string;
}
-static char *
+static const char *
pstring_ptr (char **string)
{
if (string == NULL || *string == NULL)
/* Helper function to print a list of strings, represented as "const
char *const *". The list is printed comma-separated. */
-static char *
+static const char *
pstring_list (const char *const *list)
{
static char ret[100];
extern char *gnutarget;
-extern void set_gnutarget (char *);
+extern void set_gnutarget (const char *);
/* Structure to keep track of core register reading functions for
various core file types. */
+2017-04-05 Pedro Alves <palves@redhat.com>
+
+ * gdbreplay.c (sync_error): Constify.
+ * linux-x86-low.c (push_opcode): Constify.
+
2017-04-05 Pedro Alves <palves@redhat.com>
* win32-low.c (get_child_debug_event)
}
static void
-sync_error (FILE *fp, char *desc, int expect, int got)
+sync_error (FILE *fp, const char *desc, int expect, int got)
{
fprintf (stderr, "\n%s\n", desc);
fprintf (stderr, "At logfile offset %ld, expected '0x%x' got '0x%x'\n",
}
static int
-push_opcode (unsigned char *buf, char *op)
+push_opcode (unsigned char *buf, const char *op)
{
unsigned char *buf_org = buf;
static int yylex (void);
-void yyerror (char *);
+void yyerror (const char *);
%}
struct token
{
- char *oper;
+ const char *oper;
int token;
enum exp_opcode opcode;
};
}
void
-yyerror (char *msg)
+yyerror (const char *msg)
{
if (prev_lexptr)
lexptr = prev_lexptr;
extern int go_parse (struct parser_state *);
-extern void go_yyerror (char *);
+extern void go_yyerror (const char *);
/* Defined in go-lang.c. */
/* CPUID with EAX = 1 returns processor signature and features. */
if (cpuid_max >= 1)
{
- static char *brand_name[] = {
+ static const char *brand_name[] = {
"",
" Celeron",
" III",
{
breakpoint_smob *bp_smob
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- char *str;
struct watchpoint *wp;
if (!is_watchpoint (bp_smob->bp))
wp = (struct watchpoint *) bp_smob->bp;
- str = wp->exp_string;
+ const char *str = wp->exp_string;
if (! str)
str = "";
/* Called by gdb to invoke the command. */
static void
-cmdscm_function (struct cmd_list_element *command, char *args, int from_tty)
+cmdscm_function (struct cmd_list_element *command,
+ char *args_entry, int from_tty)
{
+ const char *args = args_entry;
command_smob *c_smob/*obj*/ = (command_smob *) get_cmd_context (command);
SCM arg_scm, tty_scm, result;
case var_filename:
case var_enum:
{
- char *str = * (char **) var;
+ const char *str = *(char **) var;
if (str == NULL)
str = "";
{
/* The register names change depending on which h8300 processor
type is selected. */
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6",
"sp", "", "pc", "cycles", "tick", "inst",
"ccr", /* pseudo register */
static const char *
h8300s_register_name (struct gdbarch *gdbarch, int regno)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"er0", "er1", "er2", "er3", "er4", "er5", "er6",
"sp", "", "pc", "cycles", "", "tick", "inst",
"mach", "macl",
static const char *
h8300sx_register_name (struct gdbarch *gdbarch, int regno)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"er0", "er1", "er2", "er3", "er4", "er5", "er6",
"sp", "", "pc", "cycles", "", "tick", "inst",
"mach", "macl", "sbr", "vbr",
static const char *
hppa32_register_name (struct gdbarch *gdbarch, int i)
{
- static char *names[] = {
+ static const char *names[] = {
"flags", "r1", "rp", "r3",
"r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11",
static const char *
hppa64_register_name (struct gdbarch *gdbarch, int i)
{
- static char *names[] = {
+ static const char *names[] = {
"flags", "r1", "rp", "r3",
"r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11",
/* Array of register names; There should be ia64_num_regs strings in
the initializer. */
-static char *ia64_register_names[] =
+static const char *ia64_register_names[] =
{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
#ifdef __MINGW32__
/* This holds all the characters considered special to the
Windows shells. */
- char *special = "\"!&*|[]{}<>?`~^=;, \t\n";
- const char quote = '"';
+ static const char special[] = "\"!&*|[]{}<>?`~^=;, \t\n";
+ static const char quote = '"';
#else
/* This holds all the characters considered special to the
typical Unix shells. We include `^' because the SunOS
/bin/sh treats it as a synonym for `|'. */
- char *special = "\"!#$&*()\\|[]{}<>?'`~^; \t\n";
- const char quote = '\'';
+ static const char special[] = "\"!#$&*()\\|[]{}<>?'`~^; \t\n";
+ static const char quote = '\'';
#endif
int i;
int length = 0;
path_command (char *dirname, int from_tty)
{
char *exec_path;
- char *env;
+ const char *env;
dont_repeat ();
env = get_in_environ (current_inferior ()->environment, path_var_name);
should be running. Else if ATTACH, */
static void
-attach_post_wait (char *args, int from_tty, enum attach_post_wait_mode mode)
+attach_post_wait (const char *args, int from_tty, enum attach_post_wait_mode mode)
{
struct inferior *inferior;
extern void _initialize_language (void);
-static void unk_lang_error (char *);
+static void unk_lang_error (const char *);
static int unk_lang_parser (struct parser_state *);
{
if (range_mode == range_mode_auto)
{
- char *tmp;
+ const char *tmp;
switch (range_check)
{
{
if (case_mode == case_mode_auto)
{
- char *tmp = NULL;
+ const char *tmp = NULL;
switch (case_sensitivity)
{
}
static void
-unk_lang_error (char *msg)
+unk_lang_error (const char *msg)
{
error (_("Attempted to parse an expression with unknown language"));
}
/* Parser error function. */
- void (*la_error) (char *);
+ void (*la_error) (const char *);
/* Given an expression *EXPP created by prefixifying the result of
la_parser, perform any remaining processing necessary to complete
/* If this is non-NULL, specifies the name that of the implicit
local variable that refers to the current object instance. */
- char *la_name_of_this;
+ const char *la_name_of_this;
/* This is a function that lookup_symbol will call when it gets to
the part of symbol lookup where C looks up static and global
struct symtabs_and_lines *result,
const char *select_mode)
{
- char *args, *prompt;
+ char *args;
+ const char *prompt;
int i;
struct cleanup *old_chain;
VEC (const_char_ptr) *filters = NULL;
};
\f
-static char *
+static const char *
thread_db_err_str (td_err_e err)
{
static char buf[64];
static const char *
lm32_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
static int yylex (void);
-void yyerror (char *);
+void yyerror (const char *);
static int parse_number (int);
}
void
-yyerror (char *msg)
+yyerror (const char *msg)
{
if (prev_lexptr)
lexptr = prev_lexptr;
extern int m2_parse (struct parser_state *); /* Defined in m2-exp.y */
-extern void m2_yyerror (char *); /* Defined in m2-exp.y */
+extern void m2_yyerror (const char *); /* Defined in m2-exp.y */
/* Defined in m2-typeprint.c */
extern void m2_print_type (struct type *, const char *, struct ui_file *, int,
}
}
-char *m32r_register_names[] = {
+static const char *m32r_register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "fp", "lr", "sp",
"psw", "cbr", "spi", "spu", "bpc", "pc", "accl", "acch",
/* Table of registers for 68HC11. This includes the hard registers
and the soft registers used by GCC. */
-static char *
+static const char *
m68hc11_register_names[] =
{
"x", "d", "y", "sp", "pc", "a", "b",
static const char *
m88k_register_name (struct gdbarch *gdbarch, int regnum)
{
- static char *register_names[] =
+ static const char *register_names[] =
{
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
/* Append the LEN bytes at ADDR to the buffer B. */
static void
-appendmem (struct macro_buffer *b, char *addr, int len)
+appendmem (struct macro_buffer *b, const char *addr, int len)
{
int new_len = b->len + len;
/* Forward declarations. */
static int upgrade_type (int, struct type **, int, union aux_ext *,
- int, char *);
+ int, const char *);
static void parse_partial_symbols (minimal_symbol_reader &,
struct objfile *);
static int has_opaque_xref (FDR *, SYMR *);
static int cross_ref (int, union aux_ext *, struct type **, enum type_code,
- char **, int, char *);
+ const char **, int, const char *);
-static struct symbol *new_symbol (char *);
+static struct symbol *new_symbol (const char *);
static struct type *new_type (char *);
static struct blockvector *new_bvect (int);
static struct type *parse_type (int, union aux_ext *, unsigned int, int *,
- int, char *);
+ int, const char *);
-static struct symbol *mylookup_symbol (char *, const struct block *,
+static struct symbol *mylookup_symbol (const char *, const struct block *,
domain_enum, enum address_class);
static void sort_blocks (struct symtab *);
-static struct partial_symtab *new_psymtab (char *, struct objfile *);
+static struct partial_symtab *new_psymtab (const char *, struct objfile *);
static void psymtab_to_symtab_1 (struct objfile *objfile,
struct partial_symtab *, const char *);
static void handle_psymbol_enumerators (struct objfile *, FDR *, int,
CORE_ADDR);
-static char *mdebug_next_symbol_text (struct objfile *);
+static const char *mdebug_next_symbol_text (struct objfile *);
\f
/* Exported procedure: Builds a symtab from the partial symtab SELF.
Restores the environment in effect when SELF was created, delegates
/* Return a safer print NAME for a file descriptor. */
-static char *
+static const char *
fdr_name (FDR *f)
{
if (f->rss == -1)
static void
add_data_symbol (SYMR *sh, union aux_ext *ax, int bigend,
struct symbol *s, int aclass_index, struct block *b,
- struct objfile *objfile, char *name)
+ struct objfile *objfile, const char *name)
{
SYMBOL_DOMAIN (s) = VAR_DOMAIN;
SYMBOL_ACLASS_INDEX (s) = aclass_index;
struct gdbarch *gdbarch = get_objfile_arch (objfile);
const bfd_size_type external_sym_size = debug_swap->external_sym_size;
void (*const swap_sym_in) (bfd *, void *, SYMR *) = debug_swap->swap_sym_in;
- char *name;
+ const char *name;
struct symbol *s;
struct block *b;
struct mdebug_pending *pend;
static struct type *
parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
- int bigend, char *sym_name)
+ int bigend, const char *sym_name)
{
TIR t[1];
struct type *tp = 0;
name. This apparently is a MIPS extension for C sets. */
t->bt == btSet)
{
- char *name;
+ const char *name;
/* Try to cross reference this type, build new type on failure. */
ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
FIXME: We are not doing any guessing on range types. */
if (t->bt == btRange)
{
- char *name;
+ const char *name;
/* Try to cross reference this type, build new type on failure. */
ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
}
if (t->bt == btTypedef)
{
- char *name;
+ const char *name;
/* Try to cross reference this type, it should succeed. */
ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
static int
upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
- char *sym_name)
+ const char *sym_name)
{
int off;
struct type *t;
/* Reading .o files */
if (SC_IS_UNDEF (es->asym.sc) || es->asym.sc == scNil)
{
- char *what;
+ const char *what;
switch (es->asym.st)
{
case stNil:
switch (type_code)
{
- char *p;
+ const char *p;
/* Standard, external, non-debugger, symbols. */
Accept either. */
while (*p && *p != ';' && *p != ',')
{
- char *q;
+ const char *q;
/* Check for and handle cretinous dbx
symbol name continuation! */
/* Get the next symbol. OBJFILE is unused. */
-static char *
+static const char *
mdebug_next_symbol_text (struct objfile *objfile)
{
SYMR sh;
cross_ref (int fd, union aux_ext *ax, struct type **tpp,
enum type_code type_code,
/* Use to alloc new type if none is found. */
- char **pname, int bigend, char *sym_name)
+ const char **pname, int bigend, const char *sym_name)
{
RNDXR rn[1];
unsigned int rf;
keeping the symtab sorted. */
static struct symbol *
-mylookup_symbol (char *name, const struct block *block,
+mylookup_symbol (const char *name, const struct block *block,
domain_enum domain, enum address_class theclass)
{
struct block_iterator iter;
/* Allocate a new partial_symtab NAME. */
static struct partial_symtab *
-new_psymtab (char *name, struct objfile *objfile)
+new_psymtab (const char *name, struct objfile *objfile)
{
struct partial_symtab *psymtab;
/* Create a new symbol with printname NAME. */
static struct symbol *
-new_symbol (char *name)
+new_symbol (const char *name)
{
struct symbol *s = allocate_symbol (mdebugread_objfile);
for (ix = 0; VEC_iterate (mem_region_s, mem_region_list, ix, m); ix++)
{
- char *tmp;
+ const char *tmp;
printf_filtered ("%-3d %-3c\t",
m->number,
/* Given a keyword table KEYWORD and a register number REGNUM, return
the name of the register, or "" if KEYWORD contains no register
whose number is REGNUM. */
-static char *
+static const char *
register_name_from_keyword (CGEN_KEYWORD *keyword_table, int regnum)
{
const CGEN_KEYWORD_ENTRY *entry
{
struct ui_out *uiout = current_uiout;
char *exec_path;
- char *env;
+ const char *env;
int reset = 0;
int oind = 0;
int i;
_initialize_mi_cmd_env (void)
{
struct gdb_environ *environment;
- char *env;
+ const char *env;
/* We want original execution path to reset to, if desired later.
At this point, current inferior is not created, so cannot use
struct block_iterator iter;
struct cleanup *cleanup_list;
struct type *type;
- char *name_of_result;
+ const char *name_of_result;
struct ui_out *uiout = current_uiout;
block = get_frame_block (fi, 0);
{
struct ui_out *uiout = current_uiout;
int attr;
- char *attstr;
+ const char *attstr;
struct varobj *var;
if (argc != 1)
static void mi_execute_cli_command (const char *cmd, int args_p,
const char *args);
-static void mi_execute_async_cli_command (char *cli_command,
+static void mi_execute_async_cli_command (const char *cli_command,
char **argv, int argc);
static int register_changed_p (int regnum, struct regcache *,
struct regcache *);
/* Echo the command on the console. */
fprintf_unfiltered (gdb_stdlog, "%s\n", context->command);
/* Call the "console" interpreter. */
- argv[0] = INTERP_CONSOLE;
+ argv[0] = (char *) INTERP_CONSOLE;
argv[1] = context->command;
mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2);
}
void
-mi_execute_async_cli_command (char *cli_command, char **argv, int argc)
+mi_execute_async_cli_command (const char *cli_command, char **argv, int argc)
{
struct cleanup *old_cleanups;
char *run;
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* GPR names for all ABIs other than n32/n64. */
- static char *mips_gpr_names[] = {
+ static const char *mips_gpr_names[] = {
"zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
"s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
};
/* GPR names for n32 and n64 ABIs. */
- static char *mips_n32_n64_gpr_names[] = {
+ static const char *mips_n32_n64_gpr_names[] = {
"zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
"a4", "a5", "a6", "a7", "t0", "t1", "t2", "t3",
"s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
static void
show_mipsfpu_command (char *args, int from_tty)
{
- char *fpu;
+ const char *fpu;
if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_mips)
{
return RETURN_VALUE_REGISTER_CONVENTION;
}
-static char *
-register_name (int reg, char **regs, long sizeof_regs)
+static const char *
+register_name (int reg, const char **regs, long sizeof_regs)
{
if (reg < 0 || reg >= sizeof_regs / sizeof (regs[0]))
return NULL;
static const char *
mn10300_generic_register_name (struct gdbarch *gdbarch, int reg)
{
- static char *regs[] =
+ static const char *regs[] =
{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
"sp", "pc", "mdr", "psw", "lir", "lar", "", "",
"", "", "", "", "", "", "", "",
static const char *
am33_register_name (struct gdbarch *gdbarch, int reg)
{
- static char *regs[] =
+ static const char *regs[] =
{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
"sp", "pc", "mdr", "psw", "lir", "lar", "",
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
static const char *
am33_2_register_name (struct gdbarch *gdbarch, int reg)
{
- static char *regs[] =
+ static const char *regs[] =
{
"d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
"sp", "pc", "mdr", "psw", "lir", "lar", "mdrq", "r0",
/* Moxie register names. */
-char *moxie_register_names[] = {
+static const char *moxie_register_names[] = {
"$fp", "$sp", "$r0", "$r1", "$r2",
"$r3", "$r4", "$r5", "$r6", "$r7",
"$r8", "$r9", "$r10", "$r11", "$r12",
}
struct osdata_type {
- char *type;
- char *title;
- char *description;
+ const char *type;
+ const char *title;
+ const char *description;
LONGEST (*getter) (gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
} osdata_table[] = {
{ "cpus", "CPUs", "Listing of all cpus/cores on the system",
const char **perr)
{
char **argv;
- char *in, *out, *err, *p;
+ const char *in, *out, *err, *p;
int argc, i, n;
for (n = 0; pargv[n]; n++);
suitably defined. */
struct symbol *
-lookup_struct_typedef (char *name, const struct block *block, int noerr)
+lookup_struct_typedef (const char *name, const struct block *block, int noerr)
{
struct symbol *sym;
}
CORE_ADDR
-lookup_objc_class (struct gdbarch *gdbarch, char *classname)
+lookup_objc_class (struct gdbarch *gdbarch, const char *classname)
{
struct type *char_type = builtin_type (gdbarch)->builtin_char;
struct value * function, *classval;
}
CORE_ADDR
-lookup_child_selector (struct gdbarch *gdbarch, char *selname)
+lookup_child_selector (struct gdbarch *gdbarch, const char *selname)
{
struct type *char_type = builtin_type (gdbarch)->builtin_char;
struct value * function, *selstring;
*/
struct objc_methcall {
- char *name;
+ const char *name;
/* Return instance method to be called. */
int (*stop_at) (CORE_ADDR, CORE_ADDR *);
/* Start of pc range corresponding to method invocation. */
struct parser_state;
extern CORE_ADDR lookup_objc_class (struct gdbarch *gdbarch,
- char *classname);
+ const char *classname);
extern CORE_ADDR lookup_child_selector (struct gdbarch *gdbarch,
- char *methodname);
+ const char *methodname);
extern char *objc_demangle (const char *mangled, int options);
extern void add_msglist (struct stoken *str, int addcolon);
extern int end_msglist (struct parser_state *);
-struct symbol *lookup_struct_typedef (char *name, const struct block *block,
+struct symbol *lookup_struct_typedef (const char *name,
+ const struct block *block,
int noerr);
#endif
/* Return non-zero if PC is in a section called NAME. */
int
-pc_in_section (CORE_ADDR pc, char *name)
+pc_in_section (CORE_ADDR pc, const char *name)
{
struct obj_section *s;
int retval = 0;
extern struct obj_section *find_pc_section (CORE_ADDR pc);
/* Return non-zero if PC is in a section called NAME. */
-extern int pc_in_section (CORE_ADDR, char *);
+extern int pc_in_section (CORE_ADDR, const char *);
/* Return non-zero if PC is in a SVR4-style procedure linkage table
section. */
static int yylex (void);
-void yyerror (char *);
+void yyerror (const char *);
static char *uptok (const char *, int);
%}
struct token
{
- char *oper;
+ const char *oper;
int token;
enum exp_opcode opcode;
};
}
void
-yyerror (char *msg)
+yyerror (const char *msg)
{
if (prev_lexptr)
lexptr = prev_lexptr;
extern int pascal_parse (struct parser_state *); /* Defined in p-exp.y */
-extern void pascal_yyerror (char *); /* Defined in p-exp.y */
+extern void pascal_yyerror (const char *); /* Defined in p-exp.y */
/* Defined in p-typeprint.c */
extern void pascal_print_type (struct type *, const char *, struct ui_file *,
(struct objfile *objfile, void *data),
void *data);
-extern char *op_name_standard (enum exp_opcode);
+extern const char *op_name_standard (enum exp_opcode);
extern struct type *follow_types (struct type *);
struct op_print
{
- char *string;
+ const char *string;
enum exp_opcode opcode;
/* Precedence of operator. These values are used only by comparisons. */
enum precedence precedence;
The returned value should never be NULL, even if EXP_OPCODE is
an unknown opcode (a string containing an image of the numeric
value of the opcode can be returned, for instance). */
- char *(*op_name) (enum exp_opcode);
+ const char *(*op_name) (enum exp_opcode);
/* Dump the rest of this (prefix) expression after the operator
itself has been printed. See dump_subexp_body_standard in
int
print_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr,
struct ui_file *stream,
- int do_demangle, char *leadin)
+ int do_demangle, const char *leadin)
{
char *name = NULL;
char *filename = NULL;
static void
print_partial_symbols (struct gdbarch *gdbarch,
- struct partial_symbol **p, int count, char *what,
+ struct partial_symbol **p, int count, const char *what,
struct ui_file *outfile)
{
fprintf_filtered (outfile, " %s partial symbols:\n", what);
gdbpy_breakpoint_object *bppy_pending_object;
/* Function that is called when a Python condition is evaluated. */
-static char * const stop_func = "stop";
+static const char stop_func[] = "stop";
/* This is used to initialize various gdb.bp_* constants. */
struct pybp_code
static PyObject *
bppy_get_expression (PyObject *self, void *closure)
{
- char *str;
+ const char *str;
gdbpy_breakpoint_object *obj = (gdbpy_breakpoint_object *) self;
struct watchpoint *wp;
/* Struct representing built-in completion types. */
struct cmdpy_completer
{
- /* Python symbol name.
- This isn't a const char * for Python 2.4's sake.
- PyModule_AddIntConstant only takes a char *, sigh. */
- char *name;
+ /* Python symbol name. */
+ const char *name;
/* Completion function. */
completer_ftype *completer;
};
/* Called by gdb to invoke the command. */
static void
-cmdpy_function (struct cmd_list_element *command, char *args, int from_tty)
+cmdpy_function (struct cmd_list_element *command,
+ char *args_entry, int from_tty)
{
+ const char *args = args_entry;
cmdpy_object *obj = (cmdpy_object *) get_cmd_context (command);
gdbpy_enter enter_py (get_current_arch (), current_language);
function acquires a new reference to ATTR. */
int
-evpy_add_attribute (PyObject *event, char *name, PyObject *attr)
+evpy_add_attribute (PyObject *event, const char *name, PyObject *attr)
{
return PyObject_SetAttrString (event, name, attr);
}
int
gdbpy_initialize_event_generic (PyTypeObject *type,
- char *name)
+ const char *name)
{
if (PyType_Ready (type) < 0)
return -1;
extern void evpy_dealloc (PyObject *self);
extern int evpy_add_attribute (PyObject *event,
- char *name, PyObject *attr)
+ const char *name, PyObject *attr)
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_event_generic (PyTypeObject *type, char *name)
+int gdbpy_initialize_event_generic (PyTypeObject *type, const char *name)
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
#endif /* GDB_PY_EVENT_H */
/* Initialize python events. */
static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-add_new_registry (eventregistry_object **registryp, char *name)
+add_new_registry (eventregistry_object **registryp, const char *name)
{
*registryp = create_eventregistry_object ();
#include "py-ref.h"
/* Function that is called when a Python finish bp is found out of scope. */
-static char * const outofscope_func = "out_of_scope";
+static const char outofscope_func[] = "out_of_scope";
/* struct implementing the gdb.FinishBreakpoint object by extending
the gdb.Breakpoint class. */
This function can return an iterator, or NULL. */
static PyObject *
-get_py_iter_from_func (PyObject *filter, char *func)
+get_py_iter_from_func (PyObject *filter, const char *func)
{
if (PyObject_HasAttrString (filter, func))
{
ret = PyBuffer_FillInfo (buf, self, membuf_obj->buffer,
membuf_obj->length, 0,
PyBUF_CONTIG);
- buf->format = "c";
+
+ /* Despite the documentation saying this field is a "const char *",
+ in Python 3.4 at least, it's really a "char *". */
+ buf->format = (char *) "c";
return ret;
}
/* Parameter constants and their values. */
struct parm_constant
{
- char *name;
+ const char *name;
int value;
};
stb.puts ("Frame ID: ");
fprint_frame_id (&stb, unwind_info->frame_id);
{
- char *sep = "";
+ const char *sep = "";
int i;
struct value_print_options opts;
saved_reg *reg;
case var_filename:
case var_enum:
{
- char *str = * (char **) var;
+ const char *str = *(char **) var;
if (! str)
str = "";
}
static struct {
- char *name;
+ const char *name;
void (*func)(char *);
} remote_fio_func_map[] = {
{ "open", remote_fileio_func_open },
struct memory_packet_config
{
- char *name;
+ const char *name;
long size;
int fixed_p;
};
static void
show_packet_config_cmd (struct packet_config *config)
{
- char *support = "internal-error";
+ const char *support = "internal-error";
switch (packet_config_support (config))
{
remote_write_bytes (CORE_ADDR memaddr, const gdb_byte *myaddr, ULONGEST len,
int unit_size, ULONGEST *xfered_len)
{
- char *packet_format = 0;
+ const char *packet_format = NULL;
/* Check whether the target supports binary download. */
check_binary_download (memaddr);
decrease *LEFT. Otherwise raise an error. */
static void
-remote_buffer_add_string (char **buffer, int *left, char *string)
+remote_buffer_add_string (char **buffer, int *left, const char *string)
{
int len = strlen (string);
Used to implement reverse-next etc. commands. */
static void
-exec_reverse_once (char *cmd, char *args, int from_tty)
+exec_reverse_once (const char *cmd, char *args, int from_tty)
{
char *reverse_command;
enum exec_direction_kind dir = execution_direction;
struct variant
{
/* Name of this variant. */
- char *name;
+ const char *name;
/* English description of the variant. */
- char *description;
+ const char *description;
/* bfd_arch_info.arch corresponding to variant. */
enum bfd_architecture arch;
/* The parser error handler. */
void
-rustyyerror (char *msg)
+rustyyerror (const char *msg)
{
const char *where = prev_lexptr ? prev_lexptr : lexptr;
error (_("%s in expression, near `%s'."), (msg ? msg : "Error"), where);
/* op_name implementation for Rust. */
-static char *
+static const char *
rust_op_name (enum exp_opcode opcode)
{
switch (opcode)
extern int rust_parse (struct parser_state *);
/* The la_error implementation for Rust. */
-extern void rustyyerror (char *);
+extern void rustyyerror (const char *);
/* Return true if TYPE is a tuple type; otherwise false. */
extern bool rust_tuple_type_p (struct type *type);
struct serial_ops
{
- char *name;
+ const char *name;
int (*open) (struct serial *, const char *name);
void (*close) (struct serial *);
int (*fdopen) (struct serial *, int fd);
static const char *
sh_sh_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
static const char *
sh_sh3_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
static const char *
sh_sh3e_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
static const char *
sh_sh2e_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
static const char *
sh_sh2a_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
/* general registers 0-15 */
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
static const char *
sh_sh2a_nofpu_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
/* general registers 0-15 */
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
static const char *
sh_sh_dsp_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
static const char *
sh_sh3_dsp_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
static const char *
sh_sh4_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
/* general registers 0-15 */
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
static const char *
sh_sh4_nofpu_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
/* general registers 0-15 */
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
static const char *
sh_sh4al_dsp_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
static const char *
sh64_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] =
+ static const char *register_names[] =
{
/* SH MEDIA MODE (ISA 32) */
/* general registers (64-bit) 0-63 */
/* Lookup the value for a specific symbol. */
static CORE_ADDR
-lookup_symbol_from_bfd (bfd *abfd, char *symname)
+lookup_symbol_from_bfd (bfd *abfd, const char *symname)
{
long storage_needed;
asymbol **symbol_table;
static const char *
spu_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static char *register_names[] =
+ static const char *register_names[] =
{
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
static void
info_spu_dma_cmdlist (gdb_byte *buf, int nr, enum bfd_endian byte_order)
{
- static char *spu_mfc_opcode[256] =
+ static const char *spu_mfc_opcode[256] =
{
/* 00 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
};
static void
-read_one_struct_field (struct field_info *, char **, char *,
+read_one_struct_field (struct field_info *, const char **, const char *,
struct type *, struct objfile *);
static struct type *dbx_alloc_type (int[2], struct objfile *);
-static long read_huge_number (char **, int, int *, int);
+static long read_huge_number (const char **, int, int *, int);
-static struct type *error_type (char **, struct objfile *);
+static struct type *error_type (const char **, struct objfile *);
static void
patch_block_stabs (struct pending *, struct pending_stabs *,
static void fix_common_block (struct symbol *, CORE_ADDR);
-static int read_type_number (char **, int *);
+static int read_type_number (const char **, int *);
-static struct type *read_type (char **, struct objfile *);
+static struct type *read_type (const char **, struct objfile *);
-static struct type *read_range_type (char **, int[2], int, struct objfile *);
+static struct type *read_range_type (const char **, int[2],
+ int, struct objfile *);
-static struct type *read_sun_builtin_type (char **, int[2], struct objfile *);
+static struct type *read_sun_builtin_type (const char **,
+ int[2], struct objfile *);
-static struct type *read_sun_floating_type (char **, int[2],
+static struct type *read_sun_floating_type (const char **, int[2],
struct objfile *);
-static struct type *read_enum_type (char **, struct type *, struct objfile *);
+static struct type *read_enum_type (const char **, struct type *, struct objfile *);
static struct type *rs6000_builtin_type (int, struct objfile *);
static int
-read_member_functions (struct field_info *, char **, struct type *,
+read_member_functions (struct field_info *, const char **, struct type *,
struct objfile *);
static int
-read_struct_fields (struct field_info *, char **, struct type *,
+read_struct_fields (struct field_info *, const char **, struct type *,
struct objfile *);
static int
-read_baseclasses (struct field_info *, char **, struct type *,
+read_baseclasses (struct field_info *, const char **, struct type *,
struct objfile *);
static int
-read_tilde_fields (struct field_info *, char **, struct type *,
+read_tilde_fields (struct field_info *, const char **, struct type *,
struct objfile *);
static int attach_fn_fields_to_type (struct field_info *, struct type *);
static int attach_fields_to_type (struct field_info *, struct type *,
struct objfile *);
-static struct type *read_struct_type (char **, struct type *,
+static struct type *read_struct_type (const char **, struct type *,
enum type_code,
struct objfile *);
-static struct type *read_array_type (char **, struct type *,
+static struct type *read_array_type (const char **, struct type *,
struct objfile *);
-static struct field *read_args (char **, int, struct objfile *, int *, int *);
+static struct field *read_args (const char **, int, struct objfile *,
+ int *, int *);
static void add_undefined_type (struct type *, int[2]);
static int
-read_cpp_abbrev (struct field_info *, char **, struct type *,
+read_cpp_abbrev (struct field_info *, const char **, struct type *,
struct objfile *);
-static char *find_name_end (char *name);
+static const char *find_name_end (const char *name);
-static int process_reference (char **string);
+static int process_reference (const char **string);
void stabsread_clear_cache (void);
{
int ii;
char *name;
- char *pp;
+ const char *pp;
struct symbol *sym;
if (stabs)
Returns 0 for success, -1 for error. */
static int
-read_type_number (char **pp, int *typenums)
+read_type_number (const char **pp, int *typenums)
{
int nbits;
struct ref_map
{
- char *stabs;
+ const char *stabs;
CORE_ADDR value;
struct symbol *sym;
};
find them, using their reference numbers as our index.
These will be used later when we resolve references. */
void
-ref_add (int refnum, struct symbol *sym, char *stabs, CORE_ADDR value)
+ref_add (int refnum, struct symbol *sym, const char *stabs, CORE_ADDR value)
{
if (ref_count == 0)
ref_chunk = 0;
reference number. Move STRING beyond the reference id. */
static int
-process_reference (char **string)
+process_reference (const char **string)
{
- char *p;
+ const char *p;
int refnum = 0;
if (**string != '#')
definition for later use. Return the reference number. */
int
-symbol_reference_defined (char **string)
+symbol_reference_defined (const char **string)
{
- char *p = *string;
+ const char *p = *string;
int refnum = 0;
refnum = process_reference (&p);
static int stab_regparm_index;
struct symbol *
-define_symbol (CORE_ADDR valu, char *string, int desc, int type,
+define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
struct objfile *objfile)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct symbol *sym;
- char *p = (char *) find_name_end (string);
+ const char *p = find_name_end (string);
int deftype;
int synonym = 0;
int i;
struct type *ftype = SYMBOL_TYPE (sym);
int nsemi = 0;
int nparams = 0;
- char *p1 = p;
+ const char *p1 = p;
/* Obtain a worst case guess for the number of arguments
by counting the semicolons. */
debugger will be able to read the new symbol tables. */
static struct type *
-error_type (char **pp, struct objfile *objfile)
+error_type (const char **pp, struct objfile *objfile)
{
complaint (&symfile_complaints,
_("couldn't parse type; debugger out of date?"));
deciding whether to call read_type. */
static struct type *
-read_type (char **pp, struct objfile *objfile)
+read_type (const char **pp, struct objfile *objfile)
{
struct type *type = 0;
struct type *type1;
char *type_name;
{
- char *from, *to, *p, *q1, *q2;
+ const char *from, *p, *q1, *q2;
/* Set the type code according to the following letter. */
switch ((*pp)[0])
}
if (type_name == NULL)
{
- to = type_name = (char *)
+ char *to = type_name = (char *)
obstack_alloc (&objfile->objfile_obstack, p - *pp + 1);
/* Copy the name. */
else
/* type attribute */
{
- char *attr = *pp;
+ const char *attr = *pp;
/* Skip to the semicolon. */
while (**pp != ';' && **pp != '\0')
Returns 1 for success, 0 for failure. */
static int
-read_member_functions (struct field_info *fip, char **pp, struct type *type,
- struct objfile *objfile)
+read_member_functions (struct field_info *fip, const char **pp,
+ struct type *type, struct objfile *objfile)
{
int nfn_fields = 0;
int length = 0;
struct next_fnfieldlist *new_fnlist;
struct next_fnfield *new_sublist;
char *main_fn_name;
- char *p;
+ const char *p;
/* Process each list until we find something that is not a member function
or find the end of the functions. */
keep parsing and it's time for error_type(). */
static int
-read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type,
+read_cpp_abbrev (struct field_info *fip, const char **pp, struct type *type,
struct objfile *objfile)
{
- char *p;
+ const char *p;
const char *name;
char cpp_abbrev;
struct type *context;
}
static void
-read_one_struct_field (struct field_info *fip, char **pp, char *p,
+read_one_struct_field (struct field_info *fip, const char **pp, const char *p,
struct type *type, struct objfile *objfile)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
Returns 1 for success, 0 for failure. */
static int
-read_struct_fields (struct field_info *fip, char **pp, struct type *type,
+read_struct_fields (struct field_info *fip, const char **pp, struct type *type,
struct objfile *objfile)
{
- char *p;
+ const char *p;
struct nextfield *newobj;
/* We better set p right now, in case there are no fields at all... */
static int
-read_baseclasses (struct field_info *fip, char **pp, struct type *type,
+read_baseclasses (struct field_info *fip, const char **pp, struct type *type,
struct objfile *objfile)
{
int i;
so we can look for the vptr base class info. */
static int
-read_tilde_fields (struct field_info *fip, char **pp, struct type *type,
+read_tilde_fields (struct field_info *fip, const char **pp, struct type *type,
struct objfile *objfile)
{
- char *p;
+ const char *p;
STABS_CONTINUE (pp, objfile);
*/
static struct type *
-read_struct_type (char **pp, struct type *type, enum type_code type_code,
+read_struct_type (const char **pp, struct type *type, enum type_code type_code,
struct objfile *objfile)
{
struct cleanup *back_to;
array. */
static struct type *
-read_array_type (char **pp, struct type *type,
+read_array_type (const char **pp, struct type *type,
struct objfile *objfile)
{
struct type *index_type, *element_type, *range_type;
Also defines the symbols that represent the values of the type. */
static struct type *
-read_enum_type (char **pp, struct type *type,
+read_enum_type (const char **pp, struct type *type,
struct objfile *objfile)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
- char *p;
+ const char *p;
char *name;
long n;
struct symbol *sym;
FIXME. */
static struct type *
-read_sun_builtin_type (char **pp, int typenums[2], struct objfile *objfile)
+read_sun_builtin_type (const char **pp, int typenums[2], struct objfile *objfile)
{
int type_bits;
int nbits;
}
static struct type *
-read_sun_floating_type (char **pp, int typenums[2], struct objfile *objfile)
+read_sun_floating_type (const char **pp, int typenums[2],
+ struct objfile *objfile)
{
int nbits;
int details;
If encounter garbage, set *BITS to -1 and return 0. */
static long
-read_huge_number (char **pp, int end, int *bits, int twos_complement_bits)
+read_huge_number (const char **pp, int end, int *bits,
+ int twos_complement_bits)
{
- char *p = *pp;
+ const char *p = *pp;
int sign = 1;
int sign_bit = 0;
long n = 0;
negative number. */
size_t len;
- char *p1 = p;
+ const char *p1 = p;
while ((c = *p1) >= '0' && c < '8')
p1++;
}
static struct type *
-read_range_type (char **pp, int typenums[2], int type_size,
+read_range_type (const char **pp, int typenums[2], int type_size,
struct objfile *objfile)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
- char *orig_pp = *pp;
+ const char *orig_pp = *pp;
int rangenums[2];
long n2, n3;
int n2bits, n3bits;
if there is an error. */
static struct field *
-read_args (char **pp, int end, struct objfile *objfile, int *nargsp,
+read_args (const char **pp, int end, struct objfile *objfile, int *nargsp,
int *varargsp)
{
/* FIXME! Remove this arbitrary limit! */
to remain after this function returns. */
void
-common_block_start (char *name, struct objfile *objfile)
+common_block_start (const char *name, struct objfile *objfile)
{
if (common_block_name != NULL)
{
/* Find the end of the name, delimited by a ':', but don't match
ObjC symbols which look like -[Foo bar::]:bla. */
-static char *
-find_name_end (char *name)
+static const char *
+find_name_end (const char *name)
{
- char *s = name;
+ const char *s = name;
if (s[0] == '-' || *s == '+')
{
EXTERN struct symbol *global_sym_chain[HASHSIZE];
-extern void common_block_start (char *, struct objfile *);
+extern void common_block_start (const char *, struct objfile *);
extern void common_block_end (struct objfile *);
/* Kludge for xcoffread.c */
extern long read_number (char **, int);
-extern struct symbol *define_symbol (CORE_ADDR, char *, int, int,
+extern struct symbol *define_symbol (CORE_ADDR, const char *, int, int,
struct objfile *);
extern void stabsread_init (void);
struct partial_symtab **dependency_list, int number_dependencies,
int textlow_not_set);
-extern void process_one_symbol (int, int, CORE_ADDR, char *,
+extern void process_one_symbol (int, int, CORE_ADDR, const char *,
const struct section_offsets *,
struct objfile *);
extern void stabsect_build_psymtabs (struct objfile *objfile, char *stab_name,
char *stabstr_name, char *text_name);
-extern int symbol_reference_defined (char **);
+extern int symbol_reference_defined (const char **);
-extern void ref_add (int, struct symbol *, char *, CORE_ADDR);
+extern void ref_add (int, struct symbol *, const char *, CORE_ADDR);
extern struct symbol *ref_search (int);
the section was not found. */
int
-get_section_index (struct objfile *objfile, char *section_name)
+get_section_index (struct objfile *objfile, const char *section_name)
{
asection *sect = bfd_get_section_by_name (objfile->obfd, section_name);
struct sect_opt
{
- char *name;
- char *value;
+ const char *name;
+ const char *value;
};
struct section_addr_info *section_addrs;
for (i = 0; i < section_index; i++)
{
CORE_ADDR addr;
- char *val = sect_opts[i].value;
- char *sec = sect_opts[i].name;
+ const char *val = sect_opts[i].value;
+ const char *sec = sect_opts[i].name;
addr = parse_and_eval_address (val);
/* Here we store the section offsets in the order they were
entered on the command line. */
- section_addrs->other[sec_num].name = sec;
+ section_addrs->other[sec_num].name = (char *) sec;
section_addrs->other[sec_num].addr = addr;
printf_unfiltered ("\t%s_addr = %s\n", sec,
paddress (gdbarch, addr));
extern gdb_bfd_ref_ptr symfile_bfd_open (const char *);
-extern int get_section_index (struct objfile *, char *);
+extern int get_section_index (struct objfile *, const char *);
extern int print_symbol_loading_p (int from_tty, int mainline, int full);
typedef struct tdesc_type
{
- /* The name of this type. */
- char *name;
+ /* The name of this type. If this type is a built-in type, this is
+ a pointer to a constant string. Otherwise, it's a
+ malloc-allocated string (and thus must be freed). */
+ const char *name;
/* Identify the kind of this type. */
enum tdesc_type_kind kind;
break;
}
- xfree (type->name);
+ xfree ((char *) type->name);
xfree (type);
}
static void target_command (char *, int);
-static struct target_ops *find_default_run_target (char *);
+static struct target_ops *find_default_run_target (const char *);
static struct gdbarch *default_thread_architecture (struct target_ops *ops,
ptid_t ptid);
/* See target.h. */
void
-add_deprecated_target_alias (struct target_ops *t, char *alias)
+add_deprecated_target_alias (struct target_ops *t, const char *alias)
{
struct cmd_list_element *c;
char *alt;
called for errors); else, return NULL on error. */
static struct target_ops *
-find_default_run_target (char *do_mesg)
+find_default_run_target (const char *do_mesg)
{
struct target_ops *runable = NULL;
target_announce_detach (int from_tty)
{
pid_t pid;
- char *exec_file;
+ const char *exec_file;
if (!from_tty)
return;
static char *
do_option (int *target_options, char *ret,
- int opt, char *opt_str)
+ int opt, const char *opt_str)
{
if ((*target_options & opt) != 0)
{
/* Adds a command ALIAS for target T and marks it deprecated. This is useful
for maintaining backwards compatibility when renaming targets. */
-extern void add_deprecated_target_alias (struct target_ops *t, char *alias);
+extern void add_deprecated_target_alias (struct target_ops *t,
+ const char *alias);
extern void push_target (struct target_ops *);
if (uiout->is_mi_like_p ())
{
- char *state = "stopped";
+ const char *state = "stopped";
if (tp->state == THREAD_RUNNING)
state = "running";
called to notify the GUI that we are done with the interaction
window and it can close it. */
-void (*deprecated_readline_begin_hook) (char *, ...);
+void (*deprecated_readline_begin_hook) (const char *, ...);
char *(*deprecated_readline_hook) (const char *);
void (*deprecated_readline_end_hook) (void);
as the user has requested. */
char *
-command_line_input (const char *prompt_arg, int repeat, char *annotation_suffix)
+command_line_input (const char *prompt_arg, int repeat,
+ const char *annotation_suffix)
{
static struct buffer cmd_line_buffer;
static int cmd_line_buffer_initialized;
extern char *handle_line_of_input (struct buffer *cmd_line_buffer,
char *rl, int repeat,
- char *annotation_suffix);
+ const char *annotation_suffix);
#endif
tfile_write_uploaded_tsv (struct trace_file_writer *self,
struct uploaded_tsv *utsv)
{
- char *buf = "";
+ char *buf = NULL;
struct tfile_trace_file_writer *writer
= (struct tfile_trace_file_writer *) self;
fprintf (writer->fp, "tsv %x:%s:%x:%s\n",
utsv->number, phex_nz (utsv->initial_value, 8),
- utsv->builtin, buf);
+ utsv->builtin, buf != NULL ? buf : "");
if (utsv->name)
xfree (buf);
static void tstart_command (char *, int);
static void tstop_command (char *, int);
static void tstatus_command (char *, int);
-static void tfind_command (char *, int);
static void tfind_pc_command (char *, int);
static void tfind_tracepoint_command (char *, int);
static void tfind_line_command (char *, int);
for (ix = 0; VEC_iterate (tsv_s, tvariables, ix, tsv); ++ix)
{
struct cleanup *back_to2;
- char *c;
+ const char *c;
char *name;
back_to2 = make_cleanup_ui_out_tuple_begin_end (uiout, "variable");
}
else
{
- char *stop_reason = NULL;
+ const char *stop_reason = NULL;
int stopping_tracepoint = -1;
if (!on_stop)
/* tfind command */
static void
-tfind_command (char *args, int from_tty)
+tfind_command_1 (const char *args, int from_tty)
{ /* This should only be called with a numeric argument. */
int frameno = -1;
tfind_1 (tfind_number, frameno, 0, 0, from_tty);
}
+static void
+tfind_command (char *args, int from_tty)
+{
+ tfind_command_1 (const_cast<char *> (args), from_tty);
+}
+
/* tfind end */
static void
tfind_end_command (char *args, int from_tty)
{
- tfind_command ("-1", from_tty);
+ tfind_command_1 ("-1", from_tty);
}
/* tfind start */
static void
tfind_start_command (char *args, int from_tty)
{
- tfind_command ("0", from_tty);
+ tfind_command_1 ("0", from_tty);
}
/* tfind pc command */
/* This version does not do multiple encodes for long strings; it should
return an offset to the next piece to encode. FIXME */
-extern int
+int
encode_source_string (int tpnum, ULONGEST addr,
- char *srctype, const char *src, char *buf, int buf_size)
+ const char *srctype, const char *src,
+ char *buf, int buf_size)
{
if (80 + strlen (srctype) > buf_size)
error (_("Buffer too small for source encoding"));
extern struct trace_state_variable *create_trace_state_variable (const char *name);
extern int encode_source_string (int num, ULONGEST addr,
- char *srctype, const char *src,
+ const char *srctype, const char *src,
char *buf, int buf_size);
extern void parse_trace_status (char *line, struct trace_status *ts);
/* Answer the window represented by name. */
struct tui_win_info *
-tui_partial_win_by_name (char *name)
+tui_partial_win_by_name (const char *name)
{
struct tui_win_info *win_info = NULL;
extern void tui_free_all_source_wins_content (void);
extern void tui_del_window (struct tui_win_info *);
extern void tui_del_data_windows (tui_win_content, int);
-extern struct tui_win_info *tui_partial_win_by_name (char *);
+extern struct tui_win_info *tui_partial_win_by_name (const char *);
extern const char *tui_win_name (const struct tui_gen_win_info *);
extern enum tui_layout_type tui_current_layout (void);
extern void tui_set_current_layout_to (enum tui_layout_type);
void
tui_set_source_content_nil (struct tui_win_info *win_info,
- char *warning_string)
+ const char *warning_string)
{
int line_width;
int n_lines;
struct tui_win_info;
extern void tui_set_source_content_nil (struct tui_win_info *,
- char *);
+ const char *);
extern enum tui_status tui_set_source_content (struct symtab *,
int, int);
/* Process the window name if one is specified. */
if (buf_ptr != (char *) NULL)
{
- char *wname;
- int i;
+ const char *wname;
if (*buf_ptr == ' ')
while (*(++buf_ptr) == ' ')
if (*buf_ptr != (char) 0)
{
- wname = buf_ptr;
-
/* Validate the window name. */
- for (i = 0; i < strlen (wname); i++)
- wname[i] = tolower (wname[i]);
+ for (char *p = buf_ptr; *p != '\0'; p++)
+ *p = tolower (*p);
+
+ wname = buf_ptr;
}
else
wname = "?";
void
-tui_erase_data_content (char *prompt)
+tui_erase_data_content (const char *prompt)
{
werase (TUI_DATA_WIN->generic.handle);
tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
#include "tui/tui-data.h"
-extern void tui_erase_data_content (char *);
+extern void tui_erase_data_content (const char *);
extern void tui_display_all_data (void);
extern void tui_check_data_values (struct frame_info *);
extern void tui_display_data_from_line (int);
tui_check_and_display_highlight_if_needed (win_info);
if (display_prompt == EMPTY_SOURCE_PROMPT)
{
- char *no_src_str;
+ const char *no_src_str;
if (win_info->generic.type == SRC_WIN)
no_src_str = NO_SRC_STRING;
/* Check required terminal capabilities. The MinGW port of
ncurses does have them, but doesn't expose them through "cup". */
#ifndef __MINGW32__
- cap = tigetstr ("cup");
+ cap = tigetstr ((char *) "cup");
if (cap == NULL || cap == (char *) -1 || *cap == '\0')
{
endwin ();
int retval;
int def_value;
char def_answer, not_def_answer;
- char *y_string, *n_string, *question, *prompt;
+ const char *y_string, *n_string;
+ char *question, *prompt;
struct cleanup *old_chain;
/* Set up according to which answer is the default. */
/* Readline should have fetched the termcap entry for us.
Only try to use tgetnum function if rl_get_screen_size
did not return a useful value. */
- if (((rows <= 0) && (tgetnum ("li") < 0))
+ if (((rows <= 0) && (tgetnum ((char *) "li") < 0))
/* Also disable paging if inside Emacs. $EMACS was used
before Emacs v25.1, $INSIDE_EMACS is used since then. */
|| getenv ("EMACS") || getenv ("INSIDE_EMACS"))
/* Print prefix and suffix after each line. */
static int new_line = 1;
static int return_p = 0;
- static char *prev_prefix = "";
- static char *prev_suffix = "";
+ static const char *prev_prefix = "";
+ static const char *prev_suffix = "";
if (*string == '\n')
return_p = 0;
** at index 0.
*/
int
-subset_compare (char *string_to_compare, char *template_string)
+subset_compare (const char *string_to_compare, const char *template_string)
{
int match;
extern int streq (const char *, const char *);
-extern int subset_compare (char *, char *);
+extern int subset_compare (const char *, const char *);
int compare_positive_ints (const void *ap, const void *bp);
int compare_strings (const void *ap, const void *bp);
}
/* String representations of gdb's format codes. */
-char *varobj_format_string[] =
+const char *varobj_format_string[] =
{ "natural", "binary", "decimal", "hexadecimal", "octal", "zero-hexadecimal" };
/* True if we want to allow Python-based pretty-printing. */
};
/* String representations of gdb's format codes (defined in varobj.c). */
-extern char *varobj_format_string[];
+extern const char *varobj_format_string[];
/* Struct that describes a variable object instance. */
static const char *
vax_register_name (struct gdbarch *gdbarch, int regnum)
{
- static char *register_names[] =
+ static const char *register_names[] =
{
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "ap", "fp", "sp", "pc",
if (detached && from_tty)
{
- char *exec_file = get_exec_file (0);
+ const char *exec_file = get_exec_file (0);
if (exec_file == 0)
exec_file = "";
printf_unfiltered ("Detaching from program: %s, Pid %u\n", exec_file,
static void scan_xcoff_symtab (minimal_symbol_reader &,
struct objfile *);
-static char *xcoff_next_symbol_text (struct objfile *);
+static const char *xcoff_next_symbol_text (struct objfile *);
static void record_include_begin (struct coff_symbol *);
/* Pick a fake name that will produce the same results as this
one when passed to deduce_language_from_filename. Kludge on
top of kludge. */
- char *fakename = strrchr (inclTable[ii].name, '.');
+ const char *fakename = strrchr (inclTable[ii].name, '.');
if (fakename == NULL)
fakename = " ?";
/* This is the function which stabsread.c calls to get symbol
continuations. */
-static char *
+static const char *
xcoff_next_symbol_text (struct objfile *objfile)
{
struct internal_syment symbol;
- char *retval;
+ const char *retval;
/* FIXME: is this the same as the passed arg? */
if (this_symtab_objfile)
/* Call the element processor. */
if (scope->element != NULL && scope->element->end_handler)
{
- char *body;
+ const char *scope_body;
if (scope->body == NULL)
- body = "";
+ scope_body = "";
else
{
int length;
length = obstack_object_size (scope->body);
obstack_1grow (scope->body, '\0');
- body = (char *) obstack_finish (scope->body);
+ char *body = (char *) obstack_finish (scope->body);
/* Strip leading and trailing whitespace. */
while (length > 0 && ISSPACE (body[length-1]))
body[--length] = '\0';
while (*body && ISSPACE (*body))
body++;
+
+ scope_body = body;
}
scope->element->end_handler (parser, scope->element, parser->user_data,
- body);
+ scope_body);
}
else if (scope->element == NULL)
XML_DefaultCurrent (parser->expat_parser);
struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
struct gdb_xml_value *attrs = VEC_address (gdb_xml_value_s, attributes);
int ix = 0, length;
- char *name, *group, *type;
+ char *name, *group;
+ const char *type;
int bitsize, regnum, save_restore;
length = VEC_length (gdb_xml_value_s, attributes);
static const char *
xstormy16_register_name (struct gdbarch *gdbarch, int regnum)
{
- static char *register_names[] = {
+ static const char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13",
"psw", "sp", "pc"
/* Find register by name. */
static int
-xtensa_find_register_by_name (struct gdbarch *gdbarch, char *name)
+xtensa_find_register_by_name (struct gdbarch *gdbarch, const char *name)
{
int i;
typedef struct
{
- char* name; /* Register name. */
+ const char *name; /* Register name. */
int offset; /* Offset. */
xtensa_register_type_t type; /* Register type. */
xtensa_register_group_t group;/* Register group. */