diff options
author | Tom Tromey <tromey@adacore.com> | 2025-03-06 10:09:38 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2025-03-06 11:25:45 -0700 |
commit | 78dd36b8f21a05337ebb1888cddd34dcabf261d0 (patch) | |
tree | 28537162a5fce41640872401e424a6d2d8eb658e | |
parent | 8d95753834490ae778a261305d8942c762160940 (diff) | |
download | binutils-78dd36b8f21a05337ebb1888cddd34dcabf261d0.zip binutils-78dd36b8f21a05337ebb1888cddd34dcabf261d0.tar.gz binutils-78dd36b8f21a05337ebb1888cddd34dcabf261d0.tar.bz2 |
Use 'const' in some gdbarch methods
This changes a couple of gdbarch methods to use 'const' for an
"asymbol *" parameter. These methods shouldn't be modifying the
underlying symbol in the BFD.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
-rw-r--r-- | gdb/arm-tdep.c | 6 | ||||
-rw-r--r-- | gdb/gdbarch-gen.c | 4 | ||||
-rw-r--r-- | gdb/gdbarch-gen.h | 8 | ||||
-rw-r--r-- | gdb/gdbarch_components.py | 4 | ||||
-rw-r--r-- | gdb/m68hc11-tdep.c | 5 | ||||
-rw-r--r-- | gdb/mips-tdep.c | 5 | ||||
-rw-r--r-- | gdb/ppc-linux-tdep.c | 5 | ||||
-rw-r--r-- | gdb/ppc64-tdep.c | 5 | ||||
-rw-r--r-- | gdb/ppc64-tdep.h | 2 |
9 files changed, 24 insertions, 20 deletions
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index bdad077..879f5cf 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -9719,9 +9719,9 @@ coff_sym_is_thumb (int val) symbol to indicate that it does. */ static void -arm_elf_make_msymbol_special(asymbol *sym, struct minimal_symbol *msym) +arm_elf_make_msymbol_special (const asymbol *sym, struct minimal_symbol *msym) { - elf_symbol_type *elfsym = (elf_symbol_type *) sym; + const elf_symbol_type *elfsym = (const elf_symbol_type *) sym; if (ARM_GET_SYM_BRANCH_TYPE (elfsym->internal_elf_sym.st_target_internal) == ST_BRANCH_TO_THUMB) @@ -9737,7 +9737,7 @@ arm_coff_make_msymbol_special(int val, struct minimal_symbol *msym) static void arm_record_special_symbol (struct gdbarch *gdbarch, struct objfile *objfile, - asymbol *sym) + const asymbol *sym) { const char *name = bfd_asymbol_name (sym); struct arm_per_bfd *data; diff --git a/gdb/gdbarch-gen.c b/gdb/gdbarch-gen.c index 8137ece..97d7ed9 100644 --- a/gdb/gdbarch-gen.c +++ b/gdb/gdbarch-gen.c @@ -3562,7 +3562,7 @@ gdbarch_elf_make_msymbol_special_p (struct gdbarch *gdbarch) } void -gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, asymbol *sym, struct minimal_symbol *msym) +gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, const asymbol *sym, struct minimal_symbol *msym) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->elf_make_msymbol_special != NULL); @@ -4575,7 +4575,7 @@ gdbarch_record_special_symbol_p (struct gdbarch *gdbarch) } void -gdbarch_record_special_symbol (struct gdbarch *gdbarch, struct objfile *objfile, asymbol *sym) +gdbarch_record_special_symbol (struct gdbarch *gdbarch, struct objfile *objfile, const asymbol *sym) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->record_special_symbol != NULL); diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h index abffcf9..7a52f79 100644 --- a/gdb/gdbarch-gen.h +++ b/gdb/gdbarch-gen.h @@ -867,8 +867,8 @@ extern void set_gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch, gdbarc extern bool gdbarch_elf_make_msymbol_special_p (struct gdbarch *gdbarch); -typedef void (gdbarch_elf_make_msymbol_special_ftype) (asymbol *sym, struct minimal_symbol *msym); -extern void gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, asymbol *sym, struct minimal_symbol *msym); +typedef void (gdbarch_elf_make_msymbol_special_ftype) (const asymbol *sym, struct minimal_symbol *msym); +extern void gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, const asymbol *sym, struct minimal_symbol *msym); extern void set_gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special); typedef void (gdbarch_coff_make_msymbol_special_ftype) (int val, struct minimal_symbol *msym); @@ -1325,8 +1325,8 @@ extern void set_gdbarch_get_siginfo_type (struct gdbarch *gdbarch, gdbarch_get_s extern bool gdbarch_record_special_symbol_p (struct gdbarch *gdbarch); -typedef void (gdbarch_record_special_symbol_ftype) (struct gdbarch *gdbarch, struct objfile *objfile, asymbol *sym); -extern void gdbarch_record_special_symbol (struct gdbarch *gdbarch, struct objfile *objfile, asymbol *sym); +typedef void (gdbarch_record_special_symbol_ftype) (struct gdbarch *gdbarch, struct objfile *objfile, const asymbol *sym); +extern void gdbarch_record_special_symbol (struct gdbarch *gdbarch, struct objfile *objfile, const asymbol *sym); extern void set_gdbarch_record_special_symbol (struct gdbarch *gdbarch, gdbarch_record_special_symbol_ftype *record_special_symbol); /* Function for the 'catch syscall' feature. diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py index e0fd74e..cd0a894 100644 --- a/gdb/gdbarch_components.py +++ b/gdb/gdbarch_components.py @@ -1506,7 +1506,7 @@ the main symbol table and DWARF-2 records. """, type="void", name="elf_make_msymbol_special", - params=[("asymbol *", "sym"), ("struct minimal_symbol *", "msym")], + params=[("const asymbol *", "sym"), ("struct minimal_symbol *", "msym")], predicate=True, ) @@ -2126,7 +2126,7 @@ Record architecture-specific information from the symbol table. """, type="void", name="record_special_symbol", - params=[("struct objfile *", "objfile"), ("asymbol *", "sym")], + params=[("struct objfile *", "objfile"), ("const asymbol *", "sym")], predicate=True, ) diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 84a44f5..234edcf 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1326,11 +1326,12 @@ m68hc11_return_value (struct gdbarch *gdbarch, struct value *function, rti to return. */ static void -m68hc11_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym) +m68hc11_elf_make_msymbol_special (const asymbol *sym, + struct minimal_symbol *msym) { unsigned char flags; - flags = ((elf_symbol_type *)sym)->internal_elf_sym.st_other; + flags = ((const elf_symbol_type *) sym)->internal_elf_sym.st_other; if (flags & STO_M68HC12_FAR) MSYMBOL_SET_RTC (msym); if (flags & STO_M68HC12_INTERRUPT) diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 93f8cd0..3613f9b 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -422,9 +422,10 @@ mips_unmake_compact_addr (CORE_ADDR addr) in a minimal symbol. */ static void -mips_elf_make_msymbol_special (asymbol * sym, struct minimal_symbol *msym) +mips_elf_make_msymbol_special (const asymbol * sym, + struct minimal_symbol *msym) { - elf_symbol_type *elfsym = (elf_symbol_type *) sym; + const elf_symbol_type *elfsym = (const elf_symbol_type *) sym; unsigned char st_other; if ((sym->flags & BSF_SYNTHETIC) == 0) diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 8a5eea7..a9f43c4 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1638,14 +1638,15 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch, gdbarch.h. This implementation is used for the ELFv2 ABI only. */ static void -ppc_elfv2_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym) +ppc_elfv2_elf_make_msymbol_special (const asymbol *sym, + struct minimal_symbol *msym) { if ((sym->flags & BSF_SYNTHETIC) != 0) /* ELFv2 synthetic symbols (the PLT stubs and the __glink_PLTresolve trampoline) do not have a local entry point. */ return; - elf_symbol_type *elf_sym = (elf_symbol_type *)sym; + const elf_symbol_type *elf_sym = (const elf_symbol_type *)sym; /* If the symbol is marked as having a local entry point, set a target flag in the msymbol. We currently only support local entry point diff --git a/gdb/ppc64-tdep.c b/gdb/ppc64-tdep.c index 79bc4da..5e75800 100644 --- a/gdb/ppc64-tdep.c +++ b/gdb/ppc64-tdep.c @@ -793,11 +793,12 @@ ppc64_convert_from_func_ptr_addr (struct gdbarch *gdbarch, from that symbol. */ void -ppc64_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym) +ppc64_elf_make_msymbol_special (const asymbol *sym, + struct minimal_symbol *msym) { if ((sym->flags & BSF_SYNTHETIC) != 0 && sym->udata.p != NULL) { - elf_symbol_type *elf_sym = (elf_symbol_type *) sym->udata.p; + const elf_symbol_type *elf_sym = (const elf_symbol_type *) sym->udata.p; msym->set_size (elf_sym->internal_elf_sym.st_size); } } diff --git a/gdb/ppc64-tdep.h b/gdb/ppc64-tdep.h index 7bea549..5ad8841 100644 --- a/gdb/ppc64-tdep.h +++ b/gdb/ppc64-tdep.h @@ -31,6 +31,6 @@ extern CORE_ADDR ppc64_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ); -extern void ppc64_elf_make_msymbol_special (asymbol *, +extern void ppc64_elf_make_msymbol_special (const asymbol *, struct minimal_symbol *); #endif /* GDB_PPC64_TDEP_H */ |