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

Message ID 20200703140505.26682-4-jon.turney@dronecode.org.uk
State Superseded
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.
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 373e285ca4f..a3b8abf2410 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -10171,7 +10171,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;