Apply 'const' in more places

Many global arrays in gdb could be marked "const" but are not.  This
patch changes some of them.  (There may be other arrays that could
benefit from this treatment.  I only examined arrays of strings.)

This lets the linker move some symbols to the readonly data section.
For example, previously:

0000000000000000 d _ZL18can_use_agent_enum

is now:

0000000000000030 r _ZL18can_use_agent_enum

2020-09-14  Tom Tromey  <tromey@adacore.com>

	* x86-tdep.h (x86_in_indirect_branch_thunk): Update.
	* x86-tdep.c (x86_is_thunk_register_name)
	(x86_in_indirect_branch_thunk): Update.
	* sparc64-tdep.c (sparc64_fpu_register_names)
	(sparc64_cp0_register_names, sparc64_register_names)
	(sparc64_pseudo_register_names): Now const.
	* sparc-tdep.h (struct gdbarch_tdep) <fpu_register_names,
	cp0_registers_num>: Now const.
	* sparc-tdep.c (sparc_core_register_names)
	(sparc32_fpu_register_names, sparc32_cp0_register_names)
	(sparc32_pseudo_register_names): Now const.
	(validate_tdesc_registers): Update.
	* rust-lang.c (rust_extensions): Now const.
	* p-lang.c (p_extensions): Now const.
	* objc-lang.c (objc_extensions): Now const.
	* nto-tdep.c (nto_thread_state_str): Now const.
	* moxie-tdep.c (moxie_register_names): Now const.
	* mips-tdep.h (struct gdbarch_tdep) <mips_processor_reg_names>:
	Now const.
	* mips-tdep.c (mips_generic_reg_names, mips_tx39_reg_names)
	(mips_linux_reg_names): Now const.
	(mips_gdbarch_init): Update.
	* microblaze-tdep.c (microblaze_register_names): Now const.
	* m68k-tdep.c (m68k_register_names): Now const.
	* m32r-tdep.c (m32r_register_names): Now const.
	* ia64-tdep.c (ia64_register_names): Now const.
	* i386-tdep.h (struct gdbarch_tdep) <register_names,
	ymmh_register_names, ymm16h_regnum, mpx_register_names,
	k_register_names, zmmh_register_names, xmm_avx512_register_names,
	ymm_avx512_register_names, pkeys_register_names>: Now const.
	* i386-tdep.c (i386_register_names, i386_zmm_names)
	(i386_zmmh_names, i386_k_names, i386_ymm_names, i386_ymmh_names)
	(i386_mpx_names, i386_pkeys_names, i386_bnd_names)
	(i386_mmx_names, i386_byte_names, i386_word_names): Now const.
	* f-lang.c (f_extensions): Now const.
	* d-lang.c (d_extensions): Now const.
	* csky-tdep.c (csky_register_names): Now const.
	* charset.c (default_charset_names, charset_enum): Now const.
	(_initialize_charset): Update.
	* c-lang.c (c_extensions, cplus_extensions, asm_extensions): Now
	const.
	* bsd-uthread.c (bsd_uthread_solib_names): Now const.
	(bsd_uthread_solib_loaded): Update.
	(bsd_uthread_state): Now const.
	* amd64-tdep.c (amd64_register_names, amd64_ymm_names)
	(amd64_ymm_avx512_names, amd64_ymmh_names)
	(amd64_ymmh_avx512_names, amd64_mpx_names, amd64_k_names)
	(amd64_zmmh_names, amd64_zmm_names, amd64_xmm_avx512_names)
	(amd64_pkeys_names, amd64_byte_names, amd64_word_names)
	(amd64_dword_names): Now const.
	* agent.c (can_use_agent_enum): Now const.
	* ada-tasks.c (task_states, long_task_states): Now const.
	* ada-lang.c (known_runtime_file_name_patterns)
	(known_auxiliary_function_name_patterns, attribute_names)
	(standard_exc, ada_extensions): Now const.

gdbserver/ChangeLog
2020-09-14  Tom Tromey  <tromey@adacore.com>

	* tracepoint.cc (eval_result_names): Now const.
	* ax.cc (gdb_agent_op_names): Now const.
This commit is contained in:
Tom Tromey 2020-09-14 12:09:59 -06:00
parent 8980662640
commit 27087b7f6c
32 changed files with 160 additions and 87 deletions

View File

@ -1,3 +1,61 @@
2020-09-14 Tom Tromey <tromey@adacore.com>
* x86-tdep.h (x86_in_indirect_branch_thunk): Update.
* x86-tdep.c (x86_is_thunk_register_name)
(x86_in_indirect_branch_thunk): Update.
* sparc64-tdep.c (sparc64_fpu_register_names)
(sparc64_cp0_register_names, sparc64_register_names)
(sparc64_pseudo_register_names): Now const.
* sparc-tdep.h (struct gdbarch_tdep) <fpu_register_names,
cp0_registers_num>: Now const.
* sparc-tdep.c (sparc_core_register_names)
(sparc32_fpu_register_names, sparc32_cp0_register_names)
(sparc32_pseudo_register_names): Now const.
(validate_tdesc_registers): Update.
* rust-lang.c (rust_extensions): Now const.
* p-lang.c (p_extensions): Now const.
* objc-lang.c (objc_extensions): Now const.
* nto-tdep.c (nto_thread_state_str): Now const.
* moxie-tdep.c (moxie_register_names): Now const.
* mips-tdep.h (struct gdbarch_tdep) <mips_processor_reg_names>:
Now const.
* mips-tdep.c (mips_generic_reg_names, mips_tx39_reg_names)
(mips_linux_reg_names): Now const.
(mips_gdbarch_init): Update.
* microblaze-tdep.c (microblaze_register_names): Now const.
* m68k-tdep.c (m68k_register_names): Now const.
* m32r-tdep.c (m32r_register_names): Now const.
* ia64-tdep.c (ia64_register_names): Now const.
* i386-tdep.h (struct gdbarch_tdep) <register_names,
ymmh_register_names, ymm16h_regnum, mpx_register_names,
k_register_names, zmmh_register_names, xmm_avx512_register_names,
ymm_avx512_register_names, pkeys_register_names>: Now const.
* i386-tdep.c (i386_register_names, i386_zmm_names)
(i386_zmmh_names, i386_k_names, i386_ymm_names, i386_ymmh_names)
(i386_mpx_names, i386_pkeys_names, i386_bnd_names)
(i386_mmx_names, i386_byte_names, i386_word_names): Now const.
* f-lang.c (f_extensions): Now const.
* d-lang.c (d_extensions): Now const.
* csky-tdep.c (csky_register_names): Now const.
* charset.c (default_charset_names, charset_enum): Now const.
(_initialize_charset): Update.
* c-lang.c (c_extensions, cplus_extensions, asm_extensions): Now
const.
* bsd-uthread.c (bsd_uthread_solib_names): Now const.
(bsd_uthread_solib_loaded): Update.
(bsd_uthread_state): Now const.
* amd64-tdep.c (amd64_register_names, amd64_ymm_names)
(amd64_ymm_avx512_names, amd64_ymmh_names)
(amd64_ymmh_avx512_names, amd64_mpx_names, amd64_k_names)
(amd64_zmmh_names, amd64_zmm_names, amd64_xmm_avx512_names)
(amd64_pkeys_names, amd64_byte_names, amd64_word_names)
(amd64_dword_names): Now const.
* agent.c (can_use_agent_enum): Now const.
* ada-tasks.c (task_states, long_task_states): Now const.
* ada-lang.c (known_runtime_file_name_patterns)
(known_auxiliary_function_name_patterns, attribute_names)
(standard_exc, ada_extensions): Now const.
2020-09-14 Simon Marchi <simon.marchi@polymtl.ca>
* bcache.h (struct bcache) <bcache>: Remove constructor.

View File

@ -315,11 +315,11 @@ static int warning_limit = 2;
expression evaluation. */
static int warnings_issued = 0;
static const char *known_runtime_file_name_patterns[] = {
static const char * const known_runtime_file_name_patterns[] = {
ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS NULL
};
static const char *known_auxiliary_function_name_patterns[] = {
static const char * const known_auxiliary_function_name_patterns[] = {
ADA_KNOWN_AUXILIARY_FUNCTION_NAME_PATTERNS NULL
};
@ -8828,7 +8828,7 @@ ada_to_fixed_value (struct value *val)
/* Table mapping attribute numbers to names.
NOTE: Keep up to date with enum ada_attribute definition in ada-lang.h. */
static const char *attribute_names[] = {
static const char * const attribute_names[] = {
"<?>",
"first",
@ -11503,7 +11503,7 @@ ada_modulus (struct type *type)
an Ada83 compiler). As such, we do not include Numeric_Error from
this list of standard exceptions. */
static const char *standard_exc[] = {
static const char * const standard_exc[] = {
"constraint_error",
"program_error",
"storage_error",
@ -13704,7 +13704,7 @@ ada_get_symbol_name_matcher (const lookup_name_info &lookup_name)
}
}
static const char *ada_extensions[] =
static const char * const ada_extensions[] =
{
".adb", ".ads", ".a", ".ada", ".dg", NULL
};

View File

@ -64,7 +64,7 @@ enum task_states
};
/* A short description corresponding to each possible task state. */
static const char *task_states[] = {
static const char * const task_states[] = {
N_("Unactivated"),
N_("Runnable"),
N_("Terminated"),
@ -86,7 +86,7 @@ static const char *task_states[] = {
};
/* A longer description corresponding to each possible task state. */
static const char *long_task_states[] = {
static const char * const long_task_states[] = {
N_("Unactivated"),
N_("Runnable"),
N_("Terminated"),

View File

@ -27,7 +27,7 @@
static const char can_use_agent_on[] = "on";
static const char can_use_agent_off[] = "off";
static const char *can_use_agent_enum[] =
static const char * const can_use_agent_enum[] =
{
can_use_agent_on,
can_use_agent_off,

View File

@ -59,7 +59,7 @@
/* Register information. */
static const char *amd64_register_names[] =
static const char * const amd64_register_names[] =
{
"rax", "rbx", "rcx", "rdx", "rsi", "rdi", "rbp", "rsp",
@ -77,7 +77,7 @@ static const char *amd64_register_names[] =
"mxcsr",
};
static const char *amd64_ymm_names[] =
static const char * const amd64_ymm_names[] =
{
"ymm0", "ymm1", "ymm2", "ymm3",
"ymm4", "ymm5", "ymm6", "ymm7",
@ -85,7 +85,7 @@ static const char *amd64_ymm_names[] =
"ymm12", "ymm13", "ymm14", "ymm15"
};
static const char *amd64_ymm_avx512_names[] =
static const char * const amd64_ymm_avx512_names[] =
{
"ymm16", "ymm17", "ymm18", "ymm19",
"ymm20", "ymm21", "ymm22", "ymm23",
@ -93,7 +93,7 @@ static const char *amd64_ymm_avx512_names[] =
"ymm28", "ymm29", "ymm30", "ymm31"
};
static const char *amd64_ymmh_names[] =
static const char * const amd64_ymmh_names[] =
{
"ymm0h", "ymm1h", "ymm2h", "ymm3h",
"ymm4h", "ymm5h", "ymm6h", "ymm7h",
@ -101,7 +101,7 @@ static const char *amd64_ymmh_names[] =
"ymm12h", "ymm13h", "ymm14h", "ymm15h"
};
static const char *amd64_ymmh_avx512_names[] =
static const char * const amd64_ymmh_avx512_names[] =
{
"ymm16h", "ymm17h", "ymm18h", "ymm19h",
"ymm20h", "ymm21h", "ymm22h", "ymm23h",
@ -109,18 +109,18 @@ static const char *amd64_ymmh_avx512_names[] =
"ymm28h", "ymm29h", "ymm30h", "ymm31h"
};
static const char *amd64_mpx_names[] =
static const char * const amd64_mpx_names[] =
{
"bnd0raw", "bnd1raw", "bnd2raw", "bnd3raw", "bndcfgu", "bndstatus"
};
static const char *amd64_k_names[] =
static const char * const amd64_k_names[] =
{
"k0", "k1", "k2", "k3",
"k4", "k5", "k6", "k7"
};
static const char *amd64_zmmh_names[] =
static const char * const amd64_zmmh_names[] =
{
"zmm0h", "zmm1h", "zmm2h", "zmm3h",
"zmm4h", "zmm5h", "zmm6h", "zmm7h",
@ -132,7 +132,7 @@ static const char *amd64_zmmh_names[] =
"zmm28h", "zmm29h", "zmm30h", "zmm31h"
};
static const char *amd64_zmm_names[] =
static const char * const amd64_zmm_names[] =
{
"zmm0", "zmm1", "zmm2", "zmm3",
"zmm4", "zmm5", "zmm6", "zmm7",
@ -144,14 +144,14 @@ static const char *amd64_zmm_names[] =
"zmm28", "zmm29", "zmm30", "zmm31"
};
static const char *amd64_xmm_avx512_names[] = {
static const char * const amd64_xmm_avx512_names[] = {
"xmm16", "xmm17", "xmm18", "xmm19",
"xmm20", "xmm21", "xmm22", "xmm23",
"xmm24", "xmm25", "xmm26", "xmm27",
"xmm28", "xmm29", "xmm30", "xmm31"
};
static const char *amd64_pkeys_names[] = {
static const char * const amd64_pkeys_names[] = {
"pkru"
};
@ -298,7 +298,7 @@ amd64_arch_reg_to_regnum (int reg)
/* Register names for byte pseudo-registers. */
static const char *amd64_byte_names[] =
static const char * const amd64_byte_names[] =
{
"al", "bl", "cl", "dl", "sil", "dil", "bpl", "spl",
"r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l",
@ -310,7 +310,7 @@ static const char *amd64_byte_names[] =
/* Register names for word pseudo-registers. */
static const char *amd64_word_names[] =
static const char * const amd64_word_names[] =
{
"ax", "bx", "cx", "dx", "si", "di", "bp", "",
"r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
@ -318,7 +318,7 @@ static const char *amd64_word_names[] =
/* Register names for dword pseudo-registers. */
static const char *amd64_dword_names[] =
static const char * const amd64_dword_names[] =
{
"eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp",
"r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d",

View File

@ -269,7 +269,7 @@ bsd_uthread_inferior_created (struct target_ops *ops, int from_tty)
}
/* Likely candidates for the threads library. */
static const char *bsd_uthread_solib_names[] =
static const char * const bsd_uthread_solib_names[] =
{
"/usr/lib/libc_r.so", /* FreeBSD */
"/usr/lib/libpthread.so", /* OpenBSD */
@ -279,7 +279,7 @@ static const char *bsd_uthread_solib_names[] =
static void
bsd_uthread_solib_loaded (struct so_list *so)
{
const char **names = bsd_uthread_solib_names;
const char * const *names = bsd_uthread_solib_names;
for (names = bsd_uthread_solib_names; *names; names++)
{
@ -488,7 +488,7 @@ bsd_uthread_target::update_thread_list ()
}
/* Possible states a thread can be in. */
static const char *bsd_uthread_state[] =
static const char * const bsd_uthread_state[] =
{
"RUNNING",
"SIGTHREAD",

View File

@ -871,7 +871,7 @@ const struct exp_descriptor exp_descriptor_c =
evaluate_subexp_c
};
static const char *c_extensions[] =
static const char * const c_extensions[] =
{
".c", NULL
};
@ -972,7 +972,7 @@ enum cplus_primitive_types {
nr_cplus_primitive_types
};
static const char *cplus_extensions[] =
static const char * const cplus_extensions[] =
{
".C", ".cc", ".cp", ".cpp", ".cxx", ".c++", NULL
};
@ -1170,7 +1170,7 @@ protected:
static cplus_language cplus_language_defn;
static const char *asm_extensions[] =
static const char * const asm_extensions[] =
{
".s", ".sx", ".S", NULL
};

View File

@ -271,13 +271,13 @@ show_target_wide_charset_name (struct ui_file *file,
value);
}
static const char *default_charset_names[] =
static const char * const default_charset_names[] =
{
DEFAULT_CHARSET_NAMES
0
};
static const char **charset_enum;
static const char * const *charset_enum;
/* If the target wide character set has big- or little-endian
@ -1004,7 +1004,7 @@ _initialize_charset ()
find_charset_names ();
if (charsets.charsets.size () > 1)
charset_enum = (const char **) charsets.charsets.data ();
charset_enum = (const char * const *) charsets.charsets.data ();
else
charset_enum = default_charset_names;

View File

@ -162,7 +162,7 @@ csky_write_pc (regcache *regcache, CORE_ADDR val)
/* C-Sky ABI register names. */
static const char *csky_register_names[] =
static const char * const csky_register_names[] =
{
/* General registers 0 - 31. */
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",

View File

@ -124,7 +124,7 @@ enum d_primitive_types {
nr_d_primitive_types
};
static const char *d_extensions[] =
static const char * const d_extensions[] =
{
".d", NULL
};

View File

@ -471,7 +471,7 @@ operator_check_f (struct expression *exp, int pos,
return 0;
}
static const char *f_extensions[] =
static const char * const f_extensions[] =
{
".f", ".F", ".for", ".FOR", ".ftn", ".FTN", ".fpp", ".FPP",
".f90", ".F90", ".f95", ".F95", ".f03", ".F03", ".f08", ".F08",

View File

@ -69,7 +69,7 @@
/* Register names. */
static const char *i386_register_names[] =
static const char * const i386_register_names[] =
{
"eax", "ecx", "edx", "ebx",
"esp", "ebp", "esi", "edi",
@ -84,56 +84,56 @@ static const char *i386_register_names[] =
"mxcsr"
};
static const char *i386_zmm_names[] =
static const char * const i386_zmm_names[] =
{
"zmm0", "zmm1", "zmm2", "zmm3",
"zmm4", "zmm5", "zmm6", "zmm7"
};
static const char *i386_zmmh_names[] =
static const char * const i386_zmmh_names[] =
{
"zmm0h", "zmm1h", "zmm2h", "zmm3h",
"zmm4h", "zmm5h", "zmm6h", "zmm7h"
};
static const char *i386_k_names[] =
static const char * const i386_k_names[] =
{
"k0", "k1", "k2", "k3",
"k4", "k5", "k6", "k7"
};
static const char *i386_ymm_names[] =
static const char * const i386_ymm_names[] =
{
"ymm0", "ymm1", "ymm2", "ymm3",
"ymm4", "ymm5", "ymm6", "ymm7",
};
static const char *i386_ymmh_names[] =
static const char * const i386_ymmh_names[] =
{
"ymm0h", "ymm1h", "ymm2h", "ymm3h",
"ymm4h", "ymm5h", "ymm6h", "ymm7h",
};
static const char *i386_mpx_names[] =
static const char * const i386_mpx_names[] =
{
"bnd0raw", "bnd1raw", "bnd2raw", "bnd3raw", "bndcfgu", "bndstatus"
};
static const char* i386_pkeys_names[] =
static const char * const i386_pkeys_names[] =
{
"pkru"
};
/* Register names for MPX pseudo-registers. */
static const char *i386_bnd_names[] =
static const char * const i386_bnd_names[] =
{
"bnd0", "bnd1", "bnd2", "bnd3"
};
/* Register names for MMX pseudo-registers. */
static const char *i386_mmx_names[] =
static const char * const i386_mmx_names[] =
{
"mm0", "mm1", "mm2", "mm3",
"mm4", "mm5", "mm6", "mm7"
@ -141,7 +141,7 @@ static const char *i386_mmx_names[] =
/* Register names for byte pseudo-registers. */
static const char *i386_byte_names[] =
static const char * const i386_byte_names[] =
{
"al", "cl", "dl", "bl",
"ah", "ch", "dh", "bh"
@ -149,7 +149,7 @@ static const char *i386_byte_names[] =
/* Register names for word pseudo-registers. */
static const char *i386_word_names[] =
static const char * const i386_word_names[] =
{
"ax", "cx", "dx", "bx",
"", "bp", "si", "di"

View File

@ -145,21 +145,21 @@ struct gdbarch_tdep
int xsave_xcr0_offset;
/* Register names. */
const char **register_names;
const char * const *register_names;
/* Register number for %ymm0h. Set this to -1 to indicate the absence
of upper YMM register support. */
int ymm0h_regnum;
/* Upper YMM register names. Only used for tdesc_numbered_register. */
const char **ymmh_register_names;
const char * const *ymmh_register_names;
/* Register number for %ymm16h. Set this to -1 to indicate the absence
of support for YMM16-31. */
int ymm16h_regnum;
/* YMM16-31 register names. Only used for tdesc_numbered_register. */
const char **ymm16h_register_names;
const char * const *ymm16h_register_names;
/* Register number for %bnd0r. Set this to -1 to indicate the absence
bound registers. */
@ -174,23 +174,23 @@ struct gdbarch_tdep
int bndcfgu_regnum;
/* MPX register names. Only used for tdesc_numbered_register. */
const char **mpx_register_names;
const char * const *mpx_register_names;
/* Register number for %zmm0h. Set this to -1 to indicate the absence
of ZMM_HI256 register support. */
int zmm0h_regnum;
/* OpMask register names. */
const char **k_register_names;
const char * const *k_register_names;
/* ZMM register names. Only used for tdesc_numbered_register. */
const char **zmmh_register_names;
const char * const *zmmh_register_names;
/* XMM16-31 register names. Only used for tdesc_numbered_register. */
const char **xmm_avx512_register_names;
const char * const *xmm_avx512_register_names;
/* YMM16-31 register names. Only used for tdesc_numbered_register. */
const char **ymm_avx512_register_names;
const char * const *ymm_avx512_register_names;
/* Number of PKEYS registers. */
int num_pkeys_regs;
@ -199,7 +199,7 @@ struct gdbarch_tdep
int pkru_regnum;
/* PKEYS register names. */
const char **pkeys_register_names;
const char * const *pkeys_register_names;
/* Register number for %fsbase. Set this to -1 to indicate the
absence of segment base registers. */

View File

@ -144,7 +144,7 @@ enum pseudo_regs { FIRST_PSEUDO_REGNUM = NUM_IA64_RAW_REGS,
/* Array of register names; There should be ia64_num_regs strings in
the initializer. */
static const char *ia64_register_names[] =
static const char * const 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",

View File

@ -202,7 +202,7 @@ m32r_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
}
}
static const char *m32r_register_names[] = {
static const char * const 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",

View File

@ -157,7 +157,7 @@ m68k_register_type (struct gdbarch *gdbarch, int regnum)
return builtin_type (gdbarch)->builtin_int32;
}
static const char *m68k_register_names[] = {
static const char * const m68k_register_names[] = {
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
"a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp",
"ps", "pc",

View File

@ -65,7 +65,7 @@
/* The registers of the Xilinx microblaze processor. */
static const char *microblaze_register_names[] =
static const char * const microblaze_register_names[] =
{
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",

View File

@ -578,7 +578,7 @@ enum
/* Generic MIPS. */
static const char *mips_generic_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
static const char * const mips_generic_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
"sr", "lo", "hi", "bad", "cause", "pc",
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
@ -589,7 +589,7 @@ static const char *mips_generic_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
/* Names of tx39 registers. */
static const char *mips_tx39_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
static const char * const mips_tx39_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
"sr", "lo", "hi", "bad", "cause", "pc",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
@ -601,7 +601,7 @@ static const char *mips_tx39_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
};
/* Names of registers with Linux kernels. */
static const char *mips_linux_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
static const char * const mips_linux_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
"sr", "lo", "hi", "bad", "cause", "pc",
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
@ -8049,7 +8049,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
enum mips_fpu_type fpu_type;
struct tdesc_arch_data *tdesc_data = NULL;
int elf_fpu_type = Val_GNU_MIPS_ABI_FP_ANY;
const char **reg_names;
const char * const *reg_names;
struct mips_regnum mips_regnum, *regnum;
enum mips_isa mips_isa;
int dspacc;

View File

@ -104,7 +104,7 @@ struct gdbarch_tdep
add any that do not need to be public. */
const struct mips_regnum *regnum;
/* Register names table for the current register set. */
const char **mips_processor_reg_names;
const char * const *mips_processor_reg_names;
/* The size of register data available from the target, if known.
This doesn't quite obsolete the manual

View File

@ -70,7 +70,7 @@ typedef BP_MANIPULATION (moxie_break_insn) moxie_breakpoint;
/* Moxie register names. */
static const char *moxie_register_names[] = {
static const char * const moxie_register_names[] = {
"$fp", "$sp", "$r0", "$r1", "$r2",
"$r3", "$r4", "$r5", "$r6", "$r7",
"$r8", "$r9", "$r10", "$r11", "$r12",

View File

@ -355,7 +355,7 @@ nto_elf_osabi_sniffer (bfd *abfd)
return osabi;
}
static const char *nto_thread_state_str[] =
static const char * const nto_thread_state_str[] =
{
"DEAD", /* 0 0x00 */
"RUNNING", /* 1 0x01 */

View File

@ -319,7 +319,7 @@ static const struct op_print objc_op_print_tab[] =
{NULL, OP_NULL, PREC_NULL, 0}
};
static const char *objc_extensions[] =
static const char * const objc_extensions[] =
{
".m", NULL
};

View File

@ -248,7 +248,7 @@ enum pascal_primitive_types {
nr_pascal_primitive_types
};
static const char *p_extensions[] =
static const char * const p_extensions[] =
{
".pas", ".p", ".pp", NULL
};

View File

@ -1902,7 +1902,7 @@ static const struct exp_descriptor exp_descriptor_rust =
rust_evaluate_subexp
};
static const char *rust_extensions[] =
static const char * const rust_extensions[] =
{
".rs", NULL
};

View File

@ -363,11 +363,17 @@ sparc_arg_by_memory_p (const struct type *type)
#define SPARC32_CP0_REGISTERS \
"y", "psr", "wim", "tbr", "pc", "npc", "fsr", "csr"
static const char *sparc_core_register_names[] = { SPARC_CORE_REGISTERS };
static const char *sparc32_fpu_register_names[] = { SPARC32_FPU_REGISTERS };
static const char *sparc32_cp0_register_names[] = { SPARC32_CP0_REGISTERS };
static const char * const sparc_core_register_names[] = {
SPARC_CORE_REGISTERS
};
static const char * const sparc32_fpu_register_names[] = {
SPARC32_FPU_REGISTERS
};
static const char * const sparc32_cp0_register_names[] = {
SPARC32_CP0_REGISTERS
};
static const char *sparc32_register_names[] =
static const char * const sparc32_register_names[] =
{
SPARC_CORE_REGISTERS,
SPARC32_FPU_REGISTERS,
@ -380,7 +386,7 @@ static const char *sparc32_register_names[] =
/* We provide the aliases %d0..%d30 for the floating registers as
"psuedo" registers. */
static const char *sparc32_pseudo_register_names[] =
static const char * const sparc32_pseudo_register_names[] =
{
"d0", "d2", "d4", "d6", "d8", "d10", "d12", "d14",
"d16", "d18", "d20", "d22", "d24", "d26", "d28", "d30"
@ -1784,7 +1790,7 @@ static int
validate_tdesc_registers (const struct target_desc *tdesc,
struct tdesc_arch_data *tdesc_data,
const char *feature_name,
const char *register_names[],
const char * const register_names[],
unsigned int registers_num,
unsigned int reg_start)
{

View File

@ -64,9 +64,9 @@ struct gdbarch_tdep
int npc_regnum;
/* Register names specific for architecture (sparc32 vs. sparc64) */
const char **fpu_register_names;
const char * const *fpu_register_names;
size_t fpu_registers_num;
const char **cp0_register_names;
const char * const *cp0_register_names;
size_t cp0_registers_num;
/* Register sets. */

View File

@ -764,10 +764,14 @@ sparc64_fprs_type (struct gdbarch *gdbarch)
"fprs", \
"y"
static const char *sparc64_fpu_register_names[] = { SPARC64_FPU_REGISTERS };
static const char *sparc64_cp0_register_names[] = { SPARC64_CP0_REGISTERS };
static const char * const sparc64_fpu_register_names[] = {
SPARC64_FPU_REGISTERS
};
static const char * const sparc64_cp0_register_names[] = {
SPARC64_CP0_REGISTERS
};
static const char *sparc64_register_names[] =
static const char * const sparc64_register_names[] =
{
SPARC_CORE_REGISTERS,
SPARC64_FPU_REGISTERS,
@ -780,7 +784,7 @@ static const char *sparc64_register_names[] =
/* We provide the aliases %d0..%d62 and %q0..%q60 for the floating
registers as "psuedo" registers. */
static const char *sparc64_pseudo_register_names[] =
static const char * const sparc64_pseudo_register_names[] =
{
"cwp", "pstate", "asi", "ccr",

View File

@ -26,8 +26,8 @@
(exclusive). */
static bool
x86_is_thunk_register_name (const char *name, const char **names, int lo,
int hi)
x86_is_thunk_register_name (const char *name, const char * const *names,
int lo, int hi)
{
int reg;
for (reg = lo; reg < hi; ++reg)
@ -40,7 +40,7 @@ x86_is_thunk_register_name (const char *name, const char **names, int lo,
/* See x86-tdep.h. */
bool
x86_in_indirect_branch_thunk (CORE_ADDR pc, const char **register_names,
x86_in_indirect_branch_thunk (CORE_ADDR pc, const char * const *register_names,
int lo, int hi)
{
struct bound_minimal_symbol bmfun = lookup_minimal_symbol_by_pc (pc);

View File

@ -24,7 +24,7 @@
REGISTER_NAMES[LO] (inclusive) to REGISTER_NAMES[HI] (exclusive). */
extern bool x86_in_indirect_branch_thunk (CORE_ADDR pc,
const char **register_names,
const char * const *register_names,
int lo, int hi);
#endif /* x86-tdep.h */

View File

@ -1,3 +1,8 @@
2020-09-14 Tom Tromey <tromey@adacore.com>
* tracepoint.cc (eval_result_names): Now const.
* ax.cc (gdb_agent_op_names): Now const.
2020-09-10 Kamil Rytarowski <n54@gmx.com>
* netbsd-low.cc: Add.

View File

@ -65,7 +65,7 @@ enum gdb_agent_op
gdb_agent_op_last
};
static const char *gdb_agent_op_names [gdb_agent_op_last] =
static const char * const gdb_agent_op_names [gdb_agent_op_last] =
{
"?undef?"
#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE) , # NAME

View File

@ -863,7 +863,7 @@ EXTERN_C_POP
static struct tracepoint *last_tracepoint;
static const char *eval_result_names[] =
static const char * const eval_result_names[] =
{
"terror:in the attic", /* this should never be reported */
"terror:empty expression",