diff options
author | Nick Clifton <nickc@redhat.com> | 2017-03-29 12:27:44 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2017-03-29 12:27:44 +0100 |
commit | e643cb45bf85fa5c8c49a89ff177de246af4212e (patch) | |
tree | 7502fe7dfb9df55c6101f35cd641c008b9ec4510 /bfd/coffgen.c | |
parent | 7cc0cd2903612a0730de6ba00181b9016e77ea3d (diff) | |
download | gdb-e643cb45bf85fa5c8c49a89ff177de246af4212e.zip gdb-e643cb45bf85fa5c8c49a89ff177de246af4212e.tar.gz gdb-e643cb45bf85fa5c8c49a89ff177de246af4212e.tar.bz2 |
Improve the speed of scanning PE binaries for line number information.
PR binutils/18025
* coff-bfd.h (struct coff_section_data): Add new fields:
saved_bias and bias.
* coffgen.c (coff_find_nearest_line_with_names): Cache the bias
computed for PE binaries.
* dwarf2.c (scan_unit_for_symbols): Only warn once about each
missing abbrev.
Diffstat (limited to 'bfd/coffgen.c')
-rw-r--r-- | bfd/coffgen.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 5a61f6d..3c60ed4 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -2259,6 +2259,8 @@ coff_find_nearest_line_with_names (bfd *abfd, &coff_data(abfd)->dwarf2_find_line_info)) return TRUE; + sec_data = coff_section_data (abfd, section); + /* If the DWARF lookup failed, but there is DWARF information available then the problem might be that the file has been rebased. This tool changes the VMAs of all the sections, but it does not update the DWARF @@ -2267,8 +2269,26 @@ coff_find_nearest_line_with_names (bfd *abfd, { bfd_signed_vma bias; - bias = _bfd_dwarf2_find_symbol_bias (symbols, - & coff_data (abfd)->dwarf2_find_line_info); + /* Create a cache of the result for the next call. */ + if (sec_data == NULL && section->owner == abfd) + { + amt = sizeof (struct coff_section_tdata); + section->used_by_bfd = bfd_zalloc (abfd, amt); + sec_data = (struct coff_section_tdata *) section->used_by_bfd; + } + + if (sec_data != NULL && sec_data->saved_bias) + bias = sec_data->saved_bias; + else + { + bias = _bfd_dwarf2_find_symbol_bias (symbols, + & coff_data (abfd)->dwarf2_find_line_info); + if (sec_data) + { + sec_data->saved_bias = TRUE; + sec_data->bias = bias; + } + } if (bias && _bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, @@ -2363,10 +2383,16 @@ coff_find_nearest_line_with_names (bfd *abfd, } } - /* Now wander though the raw linenumbers of the section. */ - /* If we have been called on this section before, and the offset we - want is further down then we can prime the lookup loop. */ - sec_data = coff_section_data (abfd, section); + if (section->lineno_count == 0) + { + *functionname_ptr = NULL; + *line_ptr = 0; + return TRUE; + } + + /* Now wander though the raw linenumbers of the section. + If we have been called on this section before, and the offset + we want is further down then we can prime the lookup loop. */ if (sec_data != NULL && sec_data->i > 0 && offset >= sec_data->offset) @@ -2395,6 +2421,7 @@ coff_find_nearest_line_with_names (bfd *abfd, coff_symbol_type *coff = (coff_symbol_type *) (l->u.sym); if (coff->symbol.value > offset) break; + *functionname_ptr = coff->symbol.name; last_value = coff->symbol.value; if (coff->native) @@ -2451,6 +2478,7 @@ coff_find_nearest_line_with_names (bfd *abfd, section->used_by_bfd = bfd_zalloc (abfd, amt); sec_data = (struct coff_section_tdata *) section->used_by_bfd; } + if (sec_data != NULL) { sec_data->offset = offset; |