aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2020-06-29 17:11:51 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2020-08-12 15:08:28 +0100
commitd61f3d038344734da3eb4b1cb085f387f8ad4ffa (patch)
tree773703be0178f939769721dd3ace44697194050c /bfd
parent04ec0fa297637e6077cdbb735ce6d3c8fde3c9a5 (diff)
downloadgdb-d61f3d038344734da3eb4b1cb085f387f8ad4ffa.zip
gdb-d61f3d038344734da3eb4b1cb085f387f8ad4ffa.tar.gz
gdb-d61f3d038344734da3eb4b1cb085f387f8ad4ffa.tar.bz2
Add handling for 64-bit module addresses in Cygwin core dumps
bfd/ChangeLog: 2020-07-01 Jon Turney <jon.turney@dronecode.org.uk> * elf.c (elfcore_grok_win32pstatus): Handle NOTE_INFO_MODULE64.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/elf.c32
2 files changed, 28 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 9b4e74d..fe7fdbf6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,7 @@
+2020-07-01 Jon Turney <jon.turney@dronecode.org.uk>
+
+ * elf.c (elfcore_grok_win32pstatus): Handle NOTE_INFO_MODULE64.
+
2020-07-11 Jon Turney <jon.turney@dronecode.org.uk>
* elf.c (elfcore_grok_win32pstatus): Don't apply size constraint
diff --git a/bfd/elf.c b/bfd/elf.c
index 171880d..6fad516 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -10132,6 +10132,7 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note)
#define NOTE_INFO_PROCESS 1
#define NOTE_INFO_THREAD 2
#define NOTE_INFO_MODULE 3
+#define NOTE_INFO_MODULE64 4
static bfd_boolean
elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
@@ -10199,13 +10200,30 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
break;
case NOTE_INFO_MODULE:
- if (note->descsz < 12)
- return FALSE;
-
+ case NOTE_INFO_MODULE64:
/* Make a ".module/xxxxxxxx" section. */
- /* module_info.base_address */
- base_addr = bfd_get_32 (abfd, note->descdata + 4);
- sprintf (buf, ".module/%08lx", (unsigned long) base_addr);
+ if (type == NOTE_INFO_MODULE)
+ {
+ if (note->descsz < 12)
+ return FALSE;
+
+ /* module_info.base_address */
+ base_addr = bfd_get_32 (abfd, note->descdata + 4);
+ sprintf (buf, ".module/%08lx", (unsigned long) base_addr);
+ /* module_info.module_name_size */
+ name_size = bfd_get_32 (abfd, note->descdata + 8);
+ }
+ else /* NOTE_INFO_MODULE64 */
+ {
+ if (note->descsz < 16)
+ return FALSE;
+
+ /* module_info.base_address */
+ base_addr = bfd_get_64 (abfd, note->descdata + 4);
+ sprintf (buf, ".module/%016lx", (unsigned long) base_addr);
+ /* module_info.module_name_size */
+ name_size = bfd_get_32 (abfd, note->descdata + 12);
+ }
len = strlen (buf) + 1;
name = (char *) bfd_alloc (abfd, len);
@@ -10219,8 +10237,6 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
if (sect == NULL)
return FALSE;
- /* module_info.module_name_size */
- name_size = bfd_get_32 (abfd, note->descdata + 8);
if (note->descsz < 12 + name_size)
return FALSE;