diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-02-12 11:39:23 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-02-24 16:58:02 +0000 |
commit | 19cf757a87d4ad1300f3de1e5c9bcb675e0ef331 (patch) | |
tree | e6a5813dee072ee9e1ad696ef125895f66b87419 /gdb/target.c | |
parent | 02a79309925c71591d825f8fc4e2b79ce0faa45b (diff) | |
download | gdb-19cf757a87d4ad1300f3de1e5c9bcb675e0ef331.zip gdb-19cf757a87d4ad1300f3de1e5c9bcb675e0ef331.tar.gz gdb-19cf757a87d4ad1300f3de1e5c9bcb675e0ef331.tar.bz2 |
gdb: spread a little 'const' through the target_section_table code
The code to access the target section table can be made more const, so
lets do that. There should be no user visible changes after this
commit.
gdb/ChangeLog:
* gdb/bfd-target.c (class target_bfd) <get_section_table>: Make
return type const.
* gdb/exec.c (struct exec_target) <get_section_table>: Likewise.
(section_table_read_available_memory): Make local const.
(exec_target::xfer_partial): Make local const.
(print_section_info): Make parameter const.
* gdb/exec.h (print_section_info): Likewise.
* gdb/ppc64-tdep.c (ppc64_convert_from_func_ptr_addr): Make local
const.
* gdb/record-btrace.c (record_btrace_target::xfer_partial):
Likewise.
* gdb/remote.c (remote_target::remote_xfer_live_readonly_partial):
Likewise.
* gdb/s390-tdep.c (s390_load): Likewise.
* gdb/solib-dsbt.c (scan_dyntag): Likewise.
* gdb/solib-svr4.c (scan_dyntag): Likewise.
* gdb/target-debug.h (target_debug_print_target_section_table_p):
Rename to...
(target_debug_print_const_target_section_table_p): ...this.
* gdb/target-delegates.c: Regenerate.
* gdb/target.c (target_get_section_table): Make return type const.
(target_section_by_addr): Likewise. Also make some locals const.
(memory_xfer_partial_1): Make some locals const.
* gdb/target.h (struct target_ops) <get_section_table>: Make
return type const.
(target_section_by_addr): Likewise.
(target_get_section_table): Likewise.
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/gdb/target.c b/gdb/target.c index 06d7b4f..78535b8 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -812,7 +812,7 @@ target_read_string (CORE_ADDR memaddr, int len, int *bytes_read) return gdb::unique_xmalloc_ptr<char> ((char *) buffer.release ()); } -target_section_table * +const target_section_table * target_get_section_table (struct target_ops *target) { return target->get_section_table (); @@ -820,15 +820,15 @@ target_get_section_table (struct target_ops *target) /* Find a section containing ADDR. */ -struct target_section * +const struct target_section * target_section_by_addr (struct target_ops *target, CORE_ADDR addr) { - target_section_table *table = target_get_section_table (target); + const target_section_table *table = target_get_section_table (target); if (table == NULL) return NULL; - for (target_section &secp : *table) + for (const target_section &secp : *table) { if (addr >= secp.addr && addr < secp.endaddr) return &secp; @@ -965,7 +965,7 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object, if (pc_in_unmapped_range (memaddr, section)) { - target_section_table *table = target_get_section_table (ops); + const target_section_table *table = target_get_section_table (ops); const char *section_name = section->the_bfd_section->name; memaddr = overlay_mapped_address (memaddr, section); @@ -984,13 +984,12 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object, /* Try the executable files, if "trust-readonly-sections" is set. */ if (readbuf != NULL && trust_readonly) { - struct target_section *secp; - - secp = target_section_by_addr (ops, memaddr); + const struct target_section *secp + = target_section_by_addr (ops, memaddr); if (secp != NULL && (bfd_section_flags (secp->the_bfd_section) & SEC_READONLY)) { - target_section_table *table = target_get_section_table (ops); + const target_section_table *table = target_get_section_table (ops); return section_table_xfer_memory_partial (readbuf, writebuf, memaddr, len, xfered_len, *table); |