aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog11
-rw-r--r--gdb/exec.c10
-rw-r--r--gdb/target-delegates.c2
-rw-r--r--gdb/target.c7
-rw-r--r--gdb/target.h6
-rw-r--r--gdb/testsuite/gdb.base/maint-info-sections.exp4
6 files changed, 27 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 841d51b..f50d89f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,16 @@
2021-02-24 Andrew Burgess <andrew.burgess@embecosm.com>
+ * exec.c (exec_target::get_section_table): Delete member function.
+ (section_table_read_available_memory): Use current_top_target, not
+ just the exec_ops target.
+ * target-delegates.c: Regenerate.
+ * target.c (default_get_section_table): New function.
+ * target.h (target_ops::get_section_table): Change default
+ behaviour to call default_get_section_table.
+ (default_get_section_table): Declare.
+
+2021-02-24 Andrew Burgess <andrew.burgess@embecosm.com>
+
* exec.c (exec_target::close): Call new clear_target_sections
function.
(program_space::add_target_sections): Update name of member
diff --git a/gdb/exec.c b/gdb/exec.c
index c55a41a..8e3c19e 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -75,7 +75,6 @@ struct exec_target final : public target_ops
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
- const target_section_table *get_section_table () override;
void files_info () override;
bool has_memory () override;
@@ -775,7 +774,8 @@ enum target_xfer_status
section_table_read_available_memory (gdb_byte *readbuf, ULONGEST offset,
ULONGEST len, ULONGEST *xfered_len)
{
- const target_section_table *table = target_get_section_table (&exec_ops);
+ const target_section_table *table
+ = target_get_section_table (current_top_target ());
std::vector<mem_range> available_memory
= section_table_available_memory (offset, len, *table);
@@ -884,12 +884,6 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
return TARGET_XFER_EOF; /* We can't help. */
}
-const target_section_table *
-exec_target::get_section_table ()
-{
- return &current_program_space->target_sections ();
-}
-
enum target_xfer_status
exec_target::xfer_partial (enum target_object object,
const char *annex, gdb_byte *readbuf,
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 69fbc0f..1c79997 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -2030,7 +2030,7 @@ target_ops::get_section_table ()
const target_section_table *
dummy_target::get_section_table ()
{
- return NULL;
+ return default_get_section_table ();
}
const target_section_table *
diff --git a/gdb/target.c b/gdb/target.c
index 78535b8..ba445e7 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -836,6 +836,13 @@ target_section_by_addr (struct target_ops *target, CORE_ADDR addr)
return NULL;
}
+/* See target.h. */
+
+const target_section_table *
+default_get_section_table ()
+{
+ return &current_program_space->target_sections ();
+}
/* Helper for the memory xfer routines. Checks the attributes of the
memory region of MEMADDR against the read or write being attempted.
diff --git a/gdb/target.h b/gdb/target.h
index 66d46e2..ee93c5c 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -688,7 +688,7 @@ struct target_ops
virtual void log_command (const char *)
TARGET_DEFAULT_IGNORE ();
virtual const target_section_table *get_section_table ()
- TARGET_DEFAULT_RETURN (NULL);
+ TARGET_DEFAULT_RETURN (default_get_section_table ());
/* Provide default values for all "must have" methods. */
virtual bool has_all_memory () { return false; }
@@ -2436,6 +2436,10 @@ const struct target_section *target_section_by_addr (struct target_ops *target,
extern const target_section_table *target_get_section_table
(struct target_ops *target);
+/* Default implementation of get_section_table for dummy_target. */
+
+extern const target_section_table *default_get_section_table ();
+
/* From mem-break.c */
extern int memory_remove_breakpoint (struct target_ops *,
diff --git a/gdb/testsuite/gdb.base/maint-info-sections.exp b/gdb/testsuite/gdb.base/maint-info-sections.exp
index 17e38eb..06508de 100644
--- a/gdb/testsuite/gdb.base/maint-info-sections.exp
+++ b/gdb/testsuite/gdb.base/maint-info-sections.exp
@@ -223,9 +223,7 @@ gdb_test_multiple "maint info sections -all-objects" "" {
}
}
-# NOTE: We would like to check 'maint info target-sections' again
-# here, but GDB currently doesn't display the target sections table in
-# this case. This is a bug and will be fixed shortly!!
+check_maint_info_target_sections_output "with loaded symbol file"
# Test the command line completion on 'maint info sections'. First
# the command line flag.