From 19cf757a87d4ad1300f3de1e5c9bcb675e0ef331 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Fri, 12 Feb 2021 11:39:23 +0000 Subject: 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) : Make return type const. * gdb/exec.c (struct exec_target) : 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) : Make return type const. (target_section_by_addr): Likewise. (target_get_section_table): Likewise. --- gdb/exec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gdb/exec.c') diff --git a/gdb/exec.c b/gdb/exec.c index 68b3520..1cac5fb 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -75,7 +75,7 @@ struct exec_target final : public target_ops const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) override; - target_section_table *get_section_table () override; + const target_section_table *get_section_table () override; void files_info () override; bool has_memory () override; @@ -775,7 +775,7 @@ enum target_xfer_status section_table_read_available_memory (gdb_byte *readbuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) { - target_section_table *table = target_get_section_table (&exec_ops); + const target_section_table *table = target_get_section_table (&exec_ops); std::vector available_memory = section_table_available_memory (offset, len, *table); @@ -884,7 +884,7 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf, return TARGET_XFER_EOF; /* We can't help. */ } -target_section_table * +const target_section_table * exec_target::get_section_table () { return ¤t_program_space->target_sections; @@ -896,7 +896,7 @@ exec_target::xfer_partial (enum target_object object, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) { - target_section_table *table = get_section_table (); + const target_section_table *table = target_get_section_table (this); if (object == TARGET_OBJECT_MEMORY) return section_table_xfer_memory_partial (readbuf, writebuf, @@ -908,7 +908,7 @@ exec_target::xfer_partial (enum target_object object, void -print_section_info (target_section_table *t, bfd *abfd) +print_section_info (const target_section_table *t, bfd *abfd) { struct gdbarch *gdbarch = gdbarch_from_bfd (abfd); /* FIXME: 16 is not wide enough when gdbarch_addr_bit > 64. */ -- cgit v1.1