public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Jon TURNEY <jturney@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: Add a new win32_pstatus data type for modules on x86_64 Date: Sun, 12 Jul 2020 14:10:39 +0000 (GMT) [thread overview] Message-ID: <20200712141039.240CB3858D37@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7dd1b08836e8a7bb37d330995096540afce152a0 commit 7dd1b08836e8a7bb37d330995096540afce152a0 Author: Jon Turney <jon.turney@dronecode.org.uk> Date: Mon Jun 29 16:45:26 2020 +0100 Cygwin: Add a new win32_pstatus data type for modules on x86_64 Also take a bit more care with sizes in other data types to ensure they are the same on x86 and x86_64. Add some explanatory comments. Diff: --- winsup/cygwin/include/cygwin/core_dump.h | 16 ++++++++++++---- winsup/utils/dumper.cc | 4 ++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/include/cygwin/core_dump.h b/winsup/cygwin/include/cygwin/core_dump.h index 92ecae7ab..cd218ac45 100644 --- a/winsup/cygwin/include/cygwin/core_dump.h +++ b/winsup/cygwin/include/cygwin/core_dump.h @@ -11,17 +11,23 @@ details. */ #ifndef _CYGWIN_CORE_DUMP_H #define _CYGWIN_CORE_DUMP_H +/* + Note that elfcore_grok_win32pstatus() in libbfd relies on the precise layout + of these structures. +*/ + #include <windows.h> #define NOTE_INFO_PROCESS 1 #define NOTE_INFO_THREAD 2 #define NOTE_INFO_MODULE 3 +#define NOTE_INFO_MODULE64 4 struct win32_core_process_info { DWORD pid; - int signal; - int command_line_size; + DWORD signal; + DWORD command_line_size; char command_line[1]; } #ifdef __GNUC__ @@ -40,10 +46,12 @@ struct win32_core_thread_info #endif ; +/* Used with data_type NOTE_INFO_MODULE or NOTE_INFO_MODULE64, depending on + arch */ struct win32_core_module_info { void* base_address; - int module_name_size; + DWORD module_name_size; char module_name[1]; } #ifdef __GNUC__ @@ -53,7 +61,7 @@ struct win32_core_module_info struct win32_pstatus { - unsigned long data_type; + DWORD data_type; union { struct win32_core_process_info process_info; diff --git a/winsup/utils/dumper.cc b/winsup/utils/dumper.cc index e16d80a36..dcf01e800 100644 --- a/winsup/utils/dumper.cc +++ b/winsup/utils/dumper.cc @@ -502,7 +502,11 @@ dumper::dump_module (asection * to, process_module * module) strncpy (header.elf_note_header.name, "win32module", NOTE_NAME_SIZE); #pragma GCC diagnostic pop +#ifdef __x86_64__ + module_pstatus_ptr->data_type = NOTE_INFO_MODULE64; +#else module_pstatus_ptr->data_type = NOTE_INFO_MODULE; +#endif module_pstatus_ptr->data.module_info.base_address = module->base_address; module_pstatus_ptr->data.module_info.module_name_size = strlen (module->name) + 1; strcpy (module_pstatus_ptr->data.module_info.module_name, module->name);
reply other threads:[~2020-07-12 14:10 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200712141039.240CB3858D37@sourceware.org \ --to=jturney@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).