This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3/3] bfd: Improve lookup of file / line information for errors


Hi Andrew,

> @@ -4155,6 +4155,38 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,

The find_nearest_line functions are used not only when emitting error/warning
messages, but also when displaying disassembly mixed with source code.  Hence
it is helpful if these functions can be relatively efficient.  (I have fixed
several PRs over the last year about "objdump -dS" being very slow...)  With
that in mind then:


> +	  for (tmp = symbols; (*tmp) != NULL; ++tmp)
> +	    if ((*tmp)->the_bfd == abfd
> +		&& (*tmp)->section == section
> +		&& (*tmp)->value == offset
> +		&& ((*tmp)->flags & BSF_SECTION_SYM) == 0)

Wouldn't a binary search be more efficient here ?  Also it might be worthwhile
caching the result in case the next call is for the same offset, or a very similar
one.

Cheers
  Nick



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]