aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Merey <amerey@redhat.com>2021-11-09 16:47:36 -0500
committerAaron Merey <amerey@redhat.com>2021-11-16 22:29:51 -0500
commitaa95b2d43883666937d31335d0178d2218d9c9aa (patch)
treeeb9f3dc97b6f5e108184897a02221b226978f1b3
parentc2aad00a7447a32e1f4b0bd558a1bd2b13085381 (diff)
downloadgdb-aa95b2d43883666937d31335d0178d2218d9c9aa.zip
gdb-aa95b2d43883666937d31335d0178d2218d9c9aa.tar.gz
gdb-aa95b2d43883666937d31335d0178d2218d9c9aa.tar.bz2
gdb: Add aliases for read_core_file_mappings callbacks
Add aliases read_core_file_mappings_loop_ftype and read_core_file_mappings_pre_loop_ftype. Intended for use with read_core_file_mappings. Also add build_id parameter to read_core_file_mappings_loop_ftype.
-rw-r--r--gdb/arch-utils.c15
-rw-r--r--gdb/arch-utils.h15
-rw-r--r--gdb/corelow.c2
-rw-r--r--gdb/gdbarch.c2
-rw-r--r--gdb/gdbarch.h16
-rwxr-xr-xgdb/gdbarch.sh14
-rw-r--r--gdb/linux-tdep.c19
7 files changed, 46 insertions, 37 deletions
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 862f26b..6c6dca2 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -1075,16 +1075,11 @@ default_get_pc_address_flags (frame_info *frame, CORE_ADDR pc)
/* See arch-utils.h. */
void
-default_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)>
- loop_cb)
+default_read_core_file_mappings
+ (struct gdbarch *gdbarch,
+ struct bfd *cbfd,
+ read_core_file_mappings_pre_loop_ftype pre_loop_cb,
+ read_core_file_mappings_loop_ftype loop_cb)
{
}
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 03e9082..07cc496 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -295,14 +295,9 @@ extern std::string default_get_pc_address_flags (frame_info *frame,
CORE_ADDR pc);
/* Default implementation of gdbarch read_core_file_mappings method. */
-extern void default_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)>
- loop_cb);
+extern void default_read_core_file_mappings
+ (struct gdbarch *gdbarch,
+ struct bfd *cbfd,
+ read_core_file_mappings_pre_loop_ftype pre_loop_cb,
+ read_core_file_mappings_loop_ftype loop_cb);
#endif /* ARCH_UTILS_H */
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 5f48d96..10942e6 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -214,7 +214,7 @@ core_target::build_file_mappings ()
/* read_core_file_mappings will invoke this lambda for each mapping
that it finds. */
[&] (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs,
- const char *filename)
+ const char *filename, const bfd_build_id *build_id)
{
/* Architecture-specific read_core_mapping methods are expected to
weed out non-file-backed mappings. */
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index f89dcc5..689187f 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -5411,7 +5411,7 @@ set_gdbarch_get_pc_address_flags (struct gdbarch *gdbarch,
}
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)> loop_cb)
+gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, struct bfd *cbfd, read_core_file_mappings_pre_loop_ftype pre_loop_cb, read_core_file_mappings_loop_ftype loop_cb)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->read_core_file_mappings != NULL);
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index f73d562..eae5395 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -131,6 +131,18 @@ enum class memtag_type
allocation,
};
+/* Callback types for 'read_core_file_mappings' gdbarch method. */
+
+using read_core_file_mappings_pre_loop_ftype =
+ gdb::function_view<void (ULONGEST count)>;
+
+using read_core_file_mappings_loop_ftype =
+ gdb::function_view<void (int num,
+ ULONGEST start,
+ ULONGEST end,
+ ULONGEST file_ofs,
+ const char *filename,
+ const bfd_build_id *build_id)>;
/* The following are pre-initialized by GDBARCH. */
@@ -1712,8 +1724,8 @@ extern void set_gdbarch_get_pc_address_flags (struct gdbarch *gdbarch, gdbarch_g
/* 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)> 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)> loop_cb);
+typedef void (gdbarch_read_core_file_mappings_ftype) (struct gdbarch *gdbarch, struct bfd *cbfd, read_core_file_mappings_pre_loop_ftype pre_loop_cb, read_core_file_mappings_loop_ftype loop_cb);
+extern void gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, struct bfd *cbfd, read_core_file_mappings_pre_loop_ftype pre_loop_cb, read_core_file_mappings_loop_ftype 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);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 829f241..83a359b 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -1210,7 +1210,7 @@ m;ULONGEST;type_align;struct type *type;type;;default_type_align;;0
f;std::string;get_pc_address_flags;frame_info *frame, CORE_ADDR pc;frame, pc;;default_get_pc_address_flags;;0
# Read core file mappings
-m;void;read_core_file_mappings;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)> loop_cb;cbfd, pre_loop_cb, loop_cb;;default_read_core_file_mappings;;0
+m;void;read_core_file_mappings;struct bfd *cbfd, read_core_file_mappings_pre_loop_ftype pre_loop_cb, read_core_file_mappings_loop_ftype loop_cb;cbfd, pre_loop_cb, loop_cb;;default_read_core_file_mappings;;0
EOF
}
@@ -1402,6 +1402,18 @@ enum class memtag_type
allocation,
};
+/* Callback types for 'read_core_file_mappings' gdbarch method. */
+
+using read_core_file_mappings_pre_loop_ftype =
+ gdb::function_view<void (ULONGEST count)>;
+
+using read_core_file_mappings_loop_ftype =
+ gdb::function_view<void (int num,
+ ULONGEST start,
+ ULONGEST end,
+ ULONGEST file_ofs,
+ const char *filename,
+ const bfd_build_id *build_id)>;
EOF
# function typedef's
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index ae2f7c1..e2cff83 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1097,16 +1097,11 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
for each mapping. */
static void
-linux_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)>
- loop_cb)
+linux_read_core_file_mappings
+ (struct gdbarch *gdbarch,
+ struct bfd *cbfd,
+ read_core_file_mappings_pre_loop_ftype pre_loop_cb,
+ read_core_file_mappings_loop_ftype loop_cb)
{
/* Ensure that ULONGEST is big enough for reading 64-bit core files. */
gdb_static_assert (sizeof (ULONGEST) >= 8);
@@ -1189,7 +1184,7 @@ linux_read_core_file_mappings (struct gdbarch *gdbarch,
char * filename = filenames;
filenames += strlen ((char *) filenames) + 1;
- loop_cb (i, start, end, file_ofs, filename);
+ loop_cb (i, start, end, file_ofs, filename, nullptr);
}
}
@@ -1218,7 +1213,7 @@ linux_core_info_proc_mappings (struct gdbarch *gdbarch, const char *args)
}
},
[=] (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs,
- const char *filename)
+ const char *filename, const bfd_build_id *build_id)
{
if (gdbarch_addr_bit (gdbarch) == 32)
printf_filtered ("\t%10s %10s %10s %10s %s\n",