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]

[PATCH] Speedup-objdump-in-processing-of-source-line-information


The issue occurs in objdump when using the –S and –l flags in
combination with –d on a compilation unit containing a large function
table.  Both the number of functions and the number of inlined instances
of each function contribute to the overall size of the function table.

Each function has 1) a very big linked list of address ranges and
2) a code sequence has a very big linked list of lines associated with
the code. When objdump needs to comment a line of code with source line
information it has to traverse these big linked lists each time. Time
consuming functions are
functions lookup_address_in_function_table and
lookup_address_in_line_info_table.

The issue is resolved by introducing a lookup tables for functions and
its address ranges and a lookup table for line info. The lists traverse is
replaced with a binary search in the lookup tables. The patch reduces the
processing time from hours to several minutes. The attached .c file can
be used to reproduce the issue.

Ok for trunk?

bfd/

* dwarf2.c (comp_unit): Add new fields 'lookup_funcinfo_table' and
'number_of_functions' to keep lookup table and number of entries in
the table.
(line_sequence): Add new fields 'line_info_lookup' and 'num_lines'
to keep lookup table and number of entries in the table.
(lookup_funcinfo): New structure for lookup table for function
references.
(build_line_info_table): New function to create and build the lookup
table for line information.
(lookup_address_in_line_info_table): Use the lookup table instead of
traverse a linked list.
(compare_lookup_funcinfos): New compare fuction used in sorting of
lookup table for function references.
(build_lookup_funcinfo_table): New function to create, build and
sort the lookup table for functions references.
(lookup_address_in_function_table): Use the table instead of
traverse a linked list.
(_bfd_dwarf2_cleanup_debug_info): Free memory from function references
lookup table.
---
 bfd/dwarf2.c | 286 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 249 insertions(+), 37 deletions(-)

Attachment: 0001-Speedup-objdump-in-processing-of-source-line-informa.patch
Description: Binary data


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