From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126104 invoked by alias); 4 Jan 2020 17:55:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 126092 invoked by uid 89); 4 Jan 2020 17:55:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.1 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=H*r:sk:sonic30, H*RU:sk:sonic30, HX-Spam-Relays-External:sk:sonic30, HX-HELO:sk:sonic30 X-HELO: sonic308-18.consmr.mail.ir2.yahoo.com Received: from sonic308-18.consmr.mail.ir2.yahoo.com (HELO sonic308-18.consmr.mail.ir2.yahoo.com) (77.238.178.146) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 04 Jan 2020 17:54:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1578160496; bh=jtnLPn2hKZHIz45ygc5eu48maQOfmse5fZySNFcv7DA=; h=Date:From:To:Subject:References:From:Subject; b=SIXduIBFJTmJDhgVW/2tL17qvr+1T2X62GH+GDDho54qV/R++qqYNir5QthlUO/PhOYIEpf4XvVxBTpfudExtAK1pYVOdn7l1iPAJvYcHZ9OaupvXmX++AmF0H9FNPh2jAe6/QgYEcFFZecrnFa7BGA/PoFIwDMeUjOmVD78ebPljarXSbIEWWi8SrpiVVEdyEjPKyqYkQ5STc64WjZj+hVshRvtj9jM+dO7+BG0NZKbbVXX5sgmsEwIqzOp5fXiGUsKjVAoz3Xy0x3ZN8w41X1hhgF9mB4DHEpOM9UxwRPX9GSpKRBVnVKnBKVQvTJ1Q8ijzDGcxy2WdBJb2QWpkQ== Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.ir2.yahoo.com with HTTP; Sat, 4 Jan 2020 17:54:56 +0000 Date: Sat, 04 Jan 2020 17:55:00 -0000 From: "Hannes Domani via gdb-patches" Reply-To: Hannes Domani To: Gdb-patches Message-ID: <61945806.10663072.1578160491001@mail.yahoo.com> Subject: [PING] [PATCH] Cache the text section offset of shared libraries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable References: <61945806.10663072.1578160491001.ref@mail.yahoo.com> X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00054.txt.bz2 Ping. Am Samstag, 21. Dezember 2019, 17:33:49 MEZ hat Hannes Domani via gdb-patch= es Folgendes geschrieben: > 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=C2=A0 Hannes Domani=C2=A0 > >=C2=A0=C2=A0=C2=A0=C2=A0 * i386-cygwin-tdep.c (core_process_module_section= ): Update. >=C2=A0=C2=A0=C2=A0=C2=A0 * windows-nat.c (struct lm_info_windows): Add tex= t_offset. >=C2=A0=C2=A0=C2=A0=C2=A0 (windows_xfer_shared_libraries): Update. >=C2=A0=C2=A0=C2=A0=C2=A0 * windows-tdep.c (windows_xfer_shared_library): >=C2=A0=C2=A0=C2=A0=C2=A0 Add text_offset_cached argument. >=C2=A0=C2=A0=C2=A0=C2=A0 * windows-tdep.h (windows_xfer_shared_library): U= pdate. > --- > gdb/i386-cygwin-tdep.c |=C2=A0 2 +- > gdb/windows-nat.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 2 ++ > gdb/windows-tdep.c=C2=A0=C2=A0=C2=A0 | 20 ++++++++++++++------ > gdb/windows-tdep.h=C2=A0=C2=A0=C2=A0 |=C2=A0 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 *sec= t, void *obj) >=C2=A0=C2=A0 /* The first module is the .exe itself.=C2=A0 */ >=C2=A0=C2=A0 if (data->module_count !=3D 0) >=C2=A0=C2=A0=C2=A0=C2=A0 windows_xfer_shared_library (module_name, base_ad= dr, > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 data->gdbarch, data->obstack); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 NULL, data->gdbarch, data->obstack); >=C2=A0=C2=A0 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 > { >=C2=A0=C2=A0 LPVOID load_addr =3D 0; > +=C2=A0 CORE_ADDR text_offset =3D 0; > }; > > static struct so_list solib_start, *solib_end; > @@ -2949,6 +2950,7 @@ windows_xfer_shared_libraries (struct target_ops *o= ps, > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 windows_xfer_shared_library (so->so_n= ame, (CORE_ADDR) >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (uintptr_t) li->load_addr, > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 &li->text_offset, >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 target_gdbarch (), &obstack); >=C2=A0=C2=A0=C2=A0=C2=A0 } >=C2=A0=C2=A0 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, > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 CORE_ADDR *text_offset_cached, >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 struct gdbarch *gdbarch, struct obstack *obstack) > { > -=C2=A0 CORE_ADDR text_offset; > +=C2=A0 CORE_ADDR text_offset =3D text_offset_cached ? *text_offset_cache= d : 0; > >=C2=A0=C2=A0 obstack_grow_str (obstack, "=C2=A0=C2=A0 std::string p =3D xml_escape_text (so_name); >=C2=A0=C2=A0 obstack_grow_str (obstack, p.c_str ()); >=C2=A0=C2=A0 obstack_grow_str (obstack, "\"> -=C2=A0 gdb_bfd_ref_ptr dll (gdb_bfd_open (so_name, gnutarget, -1)); > -=C2=A0 /* The following calls are OK even if dll is NULL. > -=C2=A0=C2=A0=C2=A0 The default value 0x1000 is returned by pe_text_secti= on_offset > -=C2=A0=C2=A0=C2=A0 in that case.=C2=A0 */ > -=C2=A0 text_offset =3D pe_text_section_offset (dll.get ()); > + > +=C2=A0 if (!text_offset) > +=C2=A0=C2=A0=C2=A0 { > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 gdb_bfd_ref_ptr dll (gdb_bfd_open (so_nam= e, gnutarget, -1)); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* The following calls are OK even if dll= is NULL. > +=C2=A0=C2=A0=C2=A0 The default value 0x1000 is returned by pe_text_secti= on_offset > +=C2=A0=C2=A0=C2=A0 in that case.=C2=A0 */ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text_offset =3D pe_text_section_offset (d= ll.get ()); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (text_offset_cached) > +=C2=A0=C2=A0=C2=A0 *text_offset_cached =3D text_offset; > +=C2=A0=C2=A0=C2=A0 } > + >=C2=A0=C2=A0 obstack_grow_str (obstack, paddress (gdbarch, load_addr + tex= t_offset)); >=C2=A0=C2=A0 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, >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CORE_ADDR load_addr, > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CORE_ADDR *text_offset_cached, >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct gdbarch *gdbarch, >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct obstack *obstack); > > -- > 2.24.1