From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sa-prd-fep-042.btinternet.com (mailomta27-sa.btinternet.com [213.120.69.33]) by sourceware.org (Postfix) with ESMTPS id 3E9B33857007 for ; Wed, 1 Jul 2020 21:34:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3E9B33857007 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dronecode.org.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=jon.turney@dronecode.org.uk Received: from sa-prd-rgout-001.btmx-prd.synchronoss.net ([10.2.38.4]) by sa-prd-fep-042.btinternet.com with ESMTP id <20200701213430.YJT2233.sa-prd-fep-042.btinternet.com@sa-prd-rgout-001.btmx-prd.synchronoss.net>; Wed, 1 Jul 2020 22:34:30 +0100 Authentication-Results: btinternet.com; none X-Originating-IP: [31.51.206.31] X-OWM-Source-IP: 31.51.206.31 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-VadeSecure-score: verdict=clean score=0/300, class=clean X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgeduiedrtddvgdduieehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuueftkffvkffujffvgffngfevqffopdfqfgfvnecuuegrihhlohhuthemuceftddunecunecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeflohhnucfvuhhrnhgvhicuoehjohhnrdhtuhhrnhgvhiesughrohhnvggtohguvgdrohhrghdruhhkqeenucggtffrrghtthgvrhhnpeefieduveehgfffffeuueehleefgeevfedvffeljeefheduteelteelvdettefhvdenucfkphepfedurdehuddrvddtiedrfedunecuvehluhhsthgvrhfuihiivgepieenucfrrghrrghmpehhvghloheplhhotggrlhhhohhsthdrlhhotggrlhguohhmrghinhdpihhnvghtpeefuddrhedurddvtdeirdefuddpmhgrihhlfhhrohhmpeeojhhonhdrthhurhhnvgihsegurhhonhgvtghouggvrdhorhhgrdhukheqpdhrtghpthhtohepoehguggsqdhprghttghhvghssehsohhurhgtvgifrghrvgdrohhrgheqpdhrtghpthhtohepoehjohhnrdhtuhhrnhgvhiesughrohhnvggtohguvgdrohhrghdruhhkqe X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean Received: from localhost.localdomain (31.51.206.31) by sa-prd-rgout-001.btmx-prd.synchronoss.net (5.8.340) (authenticated as jonturney@btinternet.com) id 5ED99EC904C00B73; Wed, 1 Jul 2020 22:34:30 +0100 From: Jon Turney To: gdb-patches@sourceware.org Cc: Jon Turney Subject: [PATCH 7/7] Add handling for 64-bit module addresses in Cygwin core dumps Date: Wed, 1 Jul 2020 22:32:25 +0100 Message-Id: <20200701213225.14144-8-jon.turney@dronecode.org.uk> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200701213225.14144-1-jon.turney@dronecode.org.uk> References: <20200701213225.14144-1-jon.turney@dronecode.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2020 21:34:32 -0000 bfd/ChangeLog: 2020-07-01 Jon Turney * elf.c (elfcore_grok_win32pstatus): Handle NOTE_INFO_MODULE64. gdb/ChangeLog: 2020-07-01 Jon Turney * windows-tdep.c (core_process_module_section): Handle NOTE_INFO_MODULE64. --- bfd/ChangeLog | 4 ++++ bfd/elf.c | 15 ++++++++++++--- gdb/ChangeLog | 5 +++++ gdb/windows-tdep.c | 24 +++++++++++++++++------- 4 files changed, 38 insertions(+), 10 deletions(-) diff --git a/bfd/elf.c b/bfd/elf.c index a61e2b7dd1d..00858e16fd3 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -10185,10 +10185,19 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note) break; case 3 /* NOTE_INFO_MODULE */: - /* Make a ".module/xxxxxxxx" section. */ + case 4 /* NOTE_INFO_MODULE64 */: + /* Make a ".module/" section. */ /* module_info.base_address */ - base_addr = bfd_get_32 (abfd, note->descdata + 4); - sprintf (buf, ".module/%08lx", (unsigned long) base_addr); + if (type == 3) + { + base_addr = bfd_get_32 (abfd, note->descdata + 4); + sprintf (buf, ".module/%08lx", (unsigned long) base_addr); + } + else + { + base_addr = bfd_get_64 (abfd, note->descdata + 4); + sprintf (buf, ".module/%016lx", (unsigned long) base_addr); + } len = strlen (buf) + 1; name = (char *) bfd_alloc (abfd, len); diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index 9dae287554c..7dffad00240 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -1134,8 +1134,10 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj) struct cpms_data *data = (struct cpms_data *) obj; enum bfd_endian byte_order = gdbarch_byte_order (data->gdbarch); + unsigned int data_type; char *module_name; size_t module_name_size; + size_t module_name_offset; CORE_ADDR base_addr; gdb_byte *buf = NULL; @@ -1156,16 +1158,24 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj) /* A DWORD (data_type) followed by struct windows_core_module_info. */ + data_type = extract_unsigned_integer (buf, 4, byte_order); - base_addr = - extract_unsigned_integer (buf + 4, 4, byte_order); - - module_name_size = - extract_unsigned_integer (buf + 8, 4, byte_order); + if (data_type == 3) /* NOTE_INFO_MODULE */ + { + base_addr = extract_unsigned_integer (buf + 4, 4, byte_order); + module_name_size = extract_unsigned_integer (buf + 8, 4, byte_order); + module_name_offset = 12; + } + else /* NOTE_INFO_MODULE64 */ + { + base_addr = extract_unsigned_integer (buf + 4, 8, byte_order); + module_name_size = extract_unsigned_integer (buf + 12, 4, byte_order); + module_name_offset = 16; + } - if (12 + module_name_size > bfd_section_size (sect)) + if (module_name_offset + module_name_size > bfd_section_size (sect)) goto out; - module_name = (char *) buf + 12; + module_name = (char *) buf + module_name_offset; /* The first module is the .exe itself. */ if (data->module_count != 0) -- 2.27.0