mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
27087b7f6c
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.
97 lines
2.8 KiB
C
97 lines
2.8 KiB
C
/* Copyright (C) 2012-2020 Free Software Foundation, Inc.
|
|
|
|
This file is part of GDB.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
#include "defs.h"
|
|
#include "command.h"
|
|
#include "gdbcmd.h"
|
|
#include "target.h"
|
|
#include "gdbsupport/agent.h"
|
|
#include "observable.h"
|
|
#include "objfiles.h"
|
|
|
|
/* Enum strings for "set|show agent". */
|
|
|
|
static const char can_use_agent_on[] = "on";
|
|
static const char can_use_agent_off[] = "off";
|
|
static const char * const can_use_agent_enum[] =
|
|
{
|
|
can_use_agent_on,
|
|
can_use_agent_off,
|
|
NULL,
|
|
};
|
|
|
|
static const char *can_use_agent = can_use_agent_off;
|
|
|
|
static void
|
|
show_can_use_agent (struct ui_file *file, int from_tty,
|
|
struct cmd_list_element *c, const char *value)
|
|
{
|
|
fprintf_filtered (file,
|
|
_("Debugger's willingness to use agent in inferior "
|
|
"as a helper is %s.\n"), value);
|
|
}
|
|
|
|
static void
|
|
set_can_use_agent (const char *args, int from_tty, struct cmd_list_element *c)
|
|
{
|
|
bool can_use = (can_use_agent == can_use_agent_on);
|
|
if (can_use && !agent_loaded_p ())
|
|
{
|
|
/* Since the setting was off, we may not have observed the objfiles and
|
|
therefore not looked up the required symbols. Do so now. */
|
|
for (objfile *objfile : current_program_space->objfiles ())
|
|
if (agent_look_up_symbols (objfile) == 0)
|
|
break;
|
|
}
|
|
if (target_use_agent (can_use) == 0)
|
|
/* Something wrong during setting, set flag to default value. */
|
|
can_use_agent = can_use_agent_off;
|
|
}
|
|
|
|
static void
|
|
agent_new_objfile (struct objfile *objfile)
|
|
{
|
|
if (objfile == NULL || agent_loaded_p ())
|
|
return;
|
|
|
|
if (can_use_agent == can_use_agent_off)
|
|
return;
|
|
|
|
agent_look_up_symbols (objfile);
|
|
}
|
|
|
|
void _initialize_agent ();
|
|
void
|
|
_initialize_agent ()
|
|
{
|
|
gdb::observers::new_objfile.attach (agent_new_objfile);
|
|
|
|
add_setshow_enum_cmd ("agent", class_run,
|
|
can_use_agent_enum,
|
|
&can_use_agent, _("\
|
|
Set debugger's willingness to use agent as a helper."), _("\
|
|
Show debugger's willingness to use agent as a helper."), _("\
|
|
If on, GDB will delegate some of the debugging operations to the\n\
|
|
agent, if the target supports it. This will speed up those\n\
|
|
operations that are supported by the agent.\n\
|
|
If off, GDB will not use agent, even if such is supported by the\n\
|
|
target."),
|
|
set_can_use_agent,
|
|
show_can_use_agent,
|
|
&setlist, &showlist);
|
|
}
|