From patchwork Sat Dec 21 16:33:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Terekhov, Mikhail via Gdb-patches" X-Patchwork-Id: 37066 Received: (qmail 105298 invoked by alias); 21 Dec 2019 16:33:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 105290 invoked by uid 89); 21 Dec 2019 16:33:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: sonic312-26.consmr.mail.ir2.yahoo.com Received: from sonic312-26.consmr.mail.ir2.yahoo.com (HELO sonic312-26.consmr.mail.ir2.yahoo.com) (77.238.178.97) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 21 Dec 2019 16:33:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1576946018; bh=pYnq1tlb5vhBN6gwBlUooevsgFMuy03AGPRZ6dV1qVU=; h=From:To:Subject:Date:References:From:Subject; b=M8mfLe8K9qOrV2CsL88YbG0Tdbml6XDhkHD3vfrtIl21ZQYJ/SDaw/6QBoB0eZhRQKxvDRDWgaPP314KZLMw/DlY1H0UH12kCt1uDvcGZgwwdZTMs32NbIWgWcSl9e8xMN2CM3iel8hvxPCPRxGTnnZNlTuU50i4Sq3MmGwg9R9SdpOnAASO+0zoZzcY5ToTYFlH6s9qVqGeAS3F9XZtwLYu8f7SH+JVGAxr6s/cXueQ0RBPCLTev1slByBHBS1Icpeoihdm063Qn2qgYSJAP6hv0w9418WgDGNijzFR7hQmGkLexWV/Ce3puE2xvtXJRPQhDZdWVDKfzx2IBLcCog== Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ir2.yahoo.com with HTTP; Sat, 21 Dec 2019 16:33:38 +0000 Received: by smtp429.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 8887ea1c117bf689dab69c1308afa47a; Sat, 21 Dec 2019 16:33:34 +0000 (UTC) X-Patchwork-Original-From: "Hannes Domani via gdb-patches" From: "Terekhov, Mikhail via Gdb-patches" Reply-To: Hannes Domani To: gdb-patches@sourceware.org Subject: [PATCH] Cache the text section offset of shared libraries Date: Sat, 21 Dec 2019 17:33:03 +0100 Message-Id: <20191221163303.8764-1-ssbssa@yahoo.de> MIME-Version: 1.0 References: <20191221163303.8764-1-ssbssa.ref@yahoo.de> Content-Length: 3761 X-IsSubscribed: yes This improves the startup time of an application with >300 dynamically loaded plugins from 2m10s to 10s. And the shutdown time improves from 2m to 2s. gdb/ChangeLog: 2019-12-21 Hannes Domani * i386-cygwin-tdep.c (core_process_module_section): Update. * windows-nat.c (struct lm_info_windows): Add text_offset. (windows_xfer_shared_libraries): Update. * windows-tdep.c (windows_xfer_shared_library): Add text_offset_cached argument. * windows-tdep.h (windows_xfer_shared_library): Update. --- gdb/i386-cygwin-tdep.c | 2 +- gdb/windows-nat.c | 2 ++ gdb/windows-tdep.c | 20 ++++++++++++++------ gdb/windows-tdep.h | 1 + 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/gdb/i386-cygwin-tdep.c b/gdb/i386-cygwin-tdep.c index 25c3cfcbb9..6bf6166f73 100644 --- a/gdb/i386-cygwin-tdep.c +++ b/gdb/i386-cygwin-tdep.c @@ -137,7 +137,7 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj) /* The first module is the .exe itself. */ if (data->module_count != 0) windows_xfer_shared_library (module_name, base_addr, - data->gdbarch, data->obstack); + NULL, data->gdbarch, data->obstack); data->module_count++; out: diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 10d5c95d09..6216af8175 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -679,6 +679,7 @@ windows_nat_target::store_registers (struct regcache *regcache, int r) struct lm_info_windows : public lm_info_base { LPVOID load_addr = 0; + CORE_ADDR text_offset = 0; }; static struct so_list solib_start, *solib_end; @@ -2949,6 +2950,7 @@ windows_xfer_shared_libraries (struct target_ops *ops, windows_xfer_shared_library (so->so_name, (CORE_ADDR) (uintptr_t) li->load_addr, + &li->text_offset, target_gdbarch (), &obstack); } obstack_grow_str0 (&obstack, "\n"); diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index bb69a79996..6fb119361b 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -373,19 +373,27 @@ display_tib (const char * args, int from_tty) void windows_xfer_shared_library (const char* so_name, CORE_ADDR load_addr, + CORE_ADDR *text_offset_cached, struct gdbarch *gdbarch, struct obstack *obstack) { - CORE_ADDR text_offset; + CORE_ADDR text_offset = text_offset_cached ? *text_offset_cached : 0; obstack_grow_str (obstack, ""); } diff --git a/gdb/windows-tdep.h b/gdb/windows-tdep.h index 594c675d97..969afce816 100644 --- a/gdb/windows-tdep.h +++ b/gdb/windows-tdep.h @@ -27,6 +27,7 @@ extern void init_w32_command_list (void); extern void windows_xfer_shared_library (const char* so_name, CORE_ADDR load_addr, + CORE_ADDR *text_offset_cached, struct gdbarch *gdbarch, struct obstack *obstack);