[binutils-gdb] Don't hardcode CONTEXT size for a NOTE_INFO_THREAD win32pstatus note

Jon TURNEY jturney@sourceware.org
Wed Aug 12 14:09:03 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=03c29a6faf7bd25a4ff368530e700f70363fe772

commit 03c29a6faf7bd25a4ff368530e700f70363fe772
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Mon Jun 29 17:15:02 2020 +0100

    Don't hardcode CONTEXT size for a NOTE_INFO_THREAD win32pstatus note
    
    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.

Diff:
---
 bfd/ChangeLog | 6 ++++++
 bfd/elf.c     | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 84b290527d5..c99e654cc20 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
 2020-07-11  Jon Turney  <jon.turney@dronecode.org.uk>
 
 	* elf.c (NOTE_INFO{_PROCESS,_THREAD,_MODULE}): Define.
diff --git a/bfd/elf.c b/bfd/elf.c
index 26a4d32d185..43a6cba89da 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;


More information about the Binutils-cvs mailing list