[3/5] Don't hardcode CONTEXT size for a NOTE_INFO_THREAD win32pstatus note

Message ID 20200712125542.1322-4-jon.turney@dronecode.org.uk
State New
Headers show
Series
  • bfd: Add support for Cygwin x86_64 core dumps (v2)
Related show

Commit Message

Jon Turney July 12, 2020, 12:55 p.m.
Don't hardcode the size of the Win32 API thread CONTEXT type read from a
NOTE_INFO_THREAD win32pstatus note (since it's different on different
architectures).

bfd/ChangeLog:

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

	* elf.c (elfcore_grok_win32pstatus): Don't hardcode the size of
	the Win32 API thread CONTEXT type read from a NOTE_INFO_THREAD
	win32pstatus note.
---
 bfd/ChangeLog | 6 ++++++
 bfd/elf.c     | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

-- 
2.27.0

Patch

diff --git a/bfd/elf.c b/bfd/elf.c
index d4900dd3709..61a7f0930e2 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -10178,7 +10178,7 @@  elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
 	return FALSE;
 
       /* sizeof (thread_info.thread_context) */
-      sect->size = 716;
+      sect->size = note->descsz - 12;
       /* offsetof (thread_info.thread_context) */
       sect->filepos = note->descpos + 12;
       sect->alignment_power = 2;