]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
get_next_core_memtag_section: Accept section name as an argument.
authorJohn Baldwin <jhb@FreeBSD.org>
Fri, 2 Sep 2022 16:43:57 +0000 (09:43 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Fri, 2 Sep 2022 16:43:57 +0000 (09:43 -0700)
This permits callers to search for other memory tag section types.

gdb/corelow.c
gdb/linux-tdep.c
gdb/memtag.c
gdb/memtag.h

index 8c00b6e116f9fab1dda8795fdadc4d0968e689eb..46396cb903be22c7e1ea612d73f1e94486744dbe 100644 (file)
@@ -1158,7 +1158,7 @@ core_target::fetch_memtags (CORE_ADDR address, size_t len,
   memtag_section_info info;
   info.memtag_section = nullptr;
 
-  while (get_next_core_memtag_section (core_bfd, info.memtag_section,
+  while (get_next_core_memtag_section (core_bfd, "memtag", info.memtag_section,
                                       address, info))
   {
     size_t adjusted_length
index 517d3bd884b4baf208a4277744919d15f68d6d7f..92b26e877fad066bcf670192c79ceef5301a822a 100644 (file)
@@ -1496,7 +1496,8 @@ linux_core_file_address_in_memtag_page (CORE_ADDR address)
     return false;
 
   memtag_section_info info;
-  return get_next_core_memtag_section (core_bfd, nullptr, address, info);
+  return get_next_core_memtag_section (core_bfd, "memtag", nullptr, address,
+                                      info);
 }
 
 /* See linux-tdep.h.  */
index ca645694bb84fc09c192a601a141a9cbc2b819ef..7eadc3ec741932b81a6edb5ce495e1b6db903d5d 100644 (file)
 /* See memtag.h */
 
 bool
-get_next_core_memtag_section (bfd *abfd, asection *section,
-                             CORE_ADDR address, memtag_section_info &info)
+get_next_core_memtag_section (bfd *abfd, const char *section_name,
+                             asection *section, CORE_ADDR address,
+                             memtag_section_info &info)
 {
   /* If the caller provided no SECTION to start from, search from the
      beginning.  */
   if (section == nullptr)
-    section = bfd_get_section_by_name (abfd, "memtag");
+    section = bfd_get_section_by_name (abfd, section_name);
 
   /* Go through all the memtag sections and figure out if ADDRESS
      falls within one of the memory ranges that contain tags.  */
index fe908c1e5e3ff68762f03b9d25cdbc0c5e108210..5148b0817b5387b8b07412db7fe48a7c621ba4fd 100644 (file)
@@ -34,17 +34,17 @@ struct memtag_section_info
 
 /* Helper function to walk through memory tag sections in a core file.
 
-   Return TRUE if there is a "memtag" section containing ADDRESS.  Return FALSE
-   otherwise.
+   Return TRUE if there is a memory tag section named SECTION_NAME
+   containing ADDRESS.  Return FALSE otherwise.
 
    If SECTION is provided, search from that section onwards. If SECTION is
    nullptr, then start a new search.
 
-   If a "memtag" section containing ADDRESS is found, fill INFO with data
+   If a memory tag section containing ADDRESS is found, fill INFO with data
    about such section.  Otherwise leave it unchanged.  */
 
-bool get_next_core_memtag_section (bfd *abfd, asection *section,
-                                  CORE_ADDR address,
+bool get_next_core_memtag_section (bfd *abfd, const char *section_name,
+                                  asection *section, CORE_ADDR address,
                                   memtag_section_info &info);
 
 #endif /* MEMTAG_H */