Read tid from correct offset in win32pstatus NOTE_INFO_THREAD
authorJon Turney <jon.turney@dronecode.org.uk>
Mon, 29 Jun 2020 14:54:41 +0000 (15:54 +0100)
committerJon Turney <jon.turney@dronecode.org.uk>
Wed, 12 Aug 2020 14:08:21 +0000 (15:08 +0100)
Fix the offset used to read the tid from a win32pstatus ELF note.

This probably meant that registers were only being correctly recovered
from the core dump for the current thread.

It looks like this has beeen incorrect since 4a6636fb.

Also fix offsets used in NOTE_INFO_PROCESS (which is not actually
generated by the Cygwin dumper tool).

Also improve comment.

bfd/ChangeLog:

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

* elf.c (elfcore_grok_win32pstatus): Fix the offset used to read
the tid from a win32pstatus NOTE_INFO_THREAD ELF note.  Fix
offsets used to read NOTE_INFO_PROCESS.

bfd/ChangeLog
bfd/elf.c

index bce02c802e4c47e3efa06c46d43f6aa40d563d90..f6ded673a20e37220c574d856cd1b012c21d7cae 100644 (file)
@@ -1,3 +1,9 @@
+2020-07-01  Jon Turney  <jon.turney@dronecode.org.uk>
+
+       * elf.c (elfcore_grok_win32pstatus): Fix the offset used to read
+       the tid from a win32pstatus NOTE_INFO_THREAD ELF note.  Fix
+       offsets used to read NOTE_INFO_PROCESS.
+
 2020-08-12  Nick Clifton  <nickc@redhat.com>
 
        * po/ru.po: Updated Russian translation.
index cc2b46ccc7f1555944ce27fdfa00dc0f6c9252e0..0bae0aacdb60f2bec13df896978bd2491536ec83 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -10151,15 +10151,16 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
     case 1 /* NOTE_INFO_PROCESS */:
       /* FIXME: need to add ->core->command.  */
       /* process_info.pid */
-      elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 8);
+      elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 4);
       /* process_info.signal */
-      elf_tdata (abfd)->core->signal = bfd_get_32 (abfd, note->descdata + 12);
+      elf_tdata (abfd)->core->signal = bfd_get_32 (abfd, note->descdata + 8);
       break;
 
     case 2 /* NOTE_INFO_THREAD */:
-      /* Make a ".reg/999" section.  */
+      /* Make a ".reg/<tid>" section containing the Win32 API thread CONTEXT
+         structure. */
       /* thread_info.tid */
-      sprintf (buf, ".reg/%ld", (long) bfd_get_32 (abfd, note->descdata + 8));
+      sprintf (buf, ".reg/%ld", (long) bfd_get_32 (abfd, note->descdata + 4));
 
       len = strlen (buf) + 1;
       name = (char *) bfd_alloc (abfd, len);
This page took 0.045316 seconds and 4 git commands to generate.