Cache the text section offset of shared libraries

Each time a dll is loaded, update_solib_list is called.
This in turn calls deep down xfer_partial -> windows_xfer_shared_libraries,
which calls windows_xfer_shared_library for each loaded dll,
and pe_text_section_offset reads the dll for the text section offset.

Also if the data provided by xfer_partial is bigger than 4K,
then all of this is done for each 4K chunk (see target_read_alloc_1).

Caching of the text section offset 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:

2020-01-23  Hannes Domani  <ssbssa@yahoo.de>

	* 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.
This commit is contained in:
Hannes Domani
2019-12-21 17:08:14 +01:00
parent 24e648d4b8
commit c162ed3e66
5 changed files with 27 additions and 7 deletions

View File

@ -682,6 +682,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;
@ -2974,6 +2975,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, "</library-list>\n");