[4/4] Add handling for 64-bit module addresses in Cygwin core dumps

Message ID 20200703140505.26682-5-jon.turney@dronecode.org.uk
State New
Headers show
Series
  • bfd: Add support for Cygwin x86_64 core dumps
Related show

Commit Message

Jon Turney July 3, 2020, 2:05 p.m.
bfd/ChangeLog:

2020-07-01  Jon Turney  <jon.turney@dronecode.org.uk>

	* elf.c (elfcore_grok_win32pstatus): Handle NOTE_INFO_MODULE64.
---
 bfd/ChangeLog |  4 ++++
 bfd/elf.c     | 15 ++++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

-- 
2.27.0

Patch

diff --git a/bfd/elf.c b/bfd/elf.c
index a3b8abf2410..513ccc79c76 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -10185,10 +10185,19 @@  elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
       break;
 
     case 3 /* NOTE_INFO_MODULE */:
-      /* Make a ".module/xxxxxxxx" section.  */
+    case 4 /* NOTE_INFO_MODULE64 */:
+      /* Make a ".module/<base_address>" section.  */
       /* module_info.base_address */
-      base_addr = bfd_get_32 (abfd, note->descdata + 4);
-      sprintf (buf, ".module/%08lx", (unsigned long) base_addr);
+      if (type == 3)
+        {
+          base_addr = bfd_get_32 (abfd, note->descdata + 4);
+          sprintf (buf, ".module/%08lx", (unsigned long) base_addr);
+        }
+      else
+        {
+          base_addr = bfd_get_64 (abfd, note->descdata + 4);
+          sprintf (buf, ".module/%016lx", (unsigned long) base_addr);
+        }
 
       len = strlen (buf) + 1;
       name = (char *) bfd_alloc (abfd, len);