aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.h
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2020-07-03 13:32:08 -0700
committerKevin Buettner <kevinb@redhat.com>2020-07-22 12:44:13 -0700
commit7e183d273682fe94c6b9777ae2f3d981f415b8cd (patch)
treeaaaba0da3cfd0faf29d83537da10d1c03fe6a7cc /gdb/gdbarch.h
parent5efb677960e786a7cfa3b5a53f15cc6656f33f02 (diff)
downloadgdb-7e183d273682fe94c6b9777ae2f3d981f415b8cd.zip
gdb-7e183d273682fe94c6b9777ae2f3d981f415b8cd.tar.gz
gdb-7e183d273682fe94c6b9777ae2f3d981f415b8cd.tar.bz2
Add new gdbarch method, read_core_file_mappings
The new gdbarch method, read_core_file_mappings, will be used for reading file-backed mappings from a core file. It'll be used for two purposes: 1) to construct a table of file-backed mappings in corelow.c, and 2) for display of core file mappings. For Linux, I tried a different approach in which knowledge of the note format was placed directly in corelow.c. This seemed okay at first; it was only one note format and the note format was fairly simple. After looking at FreeBSD's note/mapping reading code, I concluded that it's best to leave architecture specific details for decoding the note in (architecture specific) tdep files. With regard to display of core file mappings, I experimented with placing the mappings display code in corelow.c. It has access to the file-backed mappings which were read in when the core file was loaded. And, better, still common code could be used for all architectures. But, again, the FreeBSD mapping code convinced me that this was not the best approach since it has even more mapping info than Linux. Display code which would work well for Linux will leave out mappings as well as protection info for mappings. So, for these reasons, I'm introducing a new gdbarch method for reading core file mappings. gdb/ChangeLog: * arch-utils.c (default_read_core_file_mappings): New function. * arch-utils.c (default_read_core_file_mappings): Declare. * gdbarch.sh (read_core_file_mappings): New gdbarch method. * gdbarch.h, gdbarch.c: Regenerate.
Diffstat (limited to 'gdb/gdbarch.h')
-rw-r--r--gdb/gdbarch.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 6c125d1..7a3060e 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -1627,6 +1627,12 @@ typedef std::string (gdbarch_get_pc_address_flags_ftype) (frame_info *frame, COR
extern std::string gdbarch_get_pc_address_flags (struct gdbarch *gdbarch, frame_info *frame, CORE_ADDR pc);
extern void set_gdbarch_get_pc_address_flags (struct gdbarch *gdbarch, gdbarch_get_pc_address_flags_ftype *get_pc_address_flags);
+/* Read core file mappings */
+
+typedef void (gdbarch_read_core_file_mappings_ftype) (struct gdbarch *gdbarch, struct bfd *cbfd,gdb::function_view<void (ULONGEST count)> pre_loop_cb,gdb::function_view<void (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs, const char *filename, const void *other)> loop_cb);
+extern void gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, struct bfd *cbfd,gdb::function_view<void (ULONGEST count)> pre_loop_cb,gdb::function_view<void (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs, const char *filename, const void *other)> loop_cb);
+extern void set_gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, gdbarch_read_core_file_mappings_ftype *read_core_file_mappings);
+
extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);