Using addr2line to display all inlined functions referenced by an address often fails with our code. The outermost function is marked as unknown, even though source and line information is available and objdump can be used to identify the function.
For example: addr2line -C -f -i -e libpolicy_enforcement.so 0x12ffa7 Ternary_OR /home/brad/root/scorpius/main/src/common/include/fdt/ternary.hpp:121 ?? /home/brad/root/scorpius/main/src/policy/policy_enforcement/afl/afl_section.cpp: 619 Tracing the code, the problem seems to be in bfd/dwarf2.c:scan_unit_for_symbols. When the code goes through the func attributes, it does not handle the case where the function has a DW_AT_specification and points to a previous declaration for its name. This seems to occur frequently for nested functions. The following patch to dwarf2.c (based on binutils-2.20.51) fixes the issue for me: --- binutils-modified/bfd/dwarf2.c 2010-09-29 10:44:40.000000000 -0400 +++ binutils-2.20.51/bfd/dwarf2.c 2010-07-14 18:18:07.000000000 -0400 @@ -2115,10 +2115,6 @@ { switch (attr.name) { - case DW_AT_specification: - func->name = find_abstract_instance_name (unit, &attr); - break; - case DW_AT_call_file: func->caller_file = concat_filename (unit->line_table, attr.u.val); Now running the same command with the updated addr2line gives the following output: addr2line -C -f -i -e libpolicy_enforcement.so 0x12ffa7 Ternary_OR /home/brad/root/scorpius/main/src/common/include/fdt/ternary.hpp:121 AFL_Section::Compute_rule_filters(AFL_Environment&, AFL_Filter*&) /home/brad/root/scorpius/main/src/policy/policy_enforcement/afl/afl_section.cpp: 619 -- Summary: addr2line unwind inlined functions does not always work with dwarf2 Product: binutils Version: 2.21 (HEAD) Status: NEW Severity: normal Priority: P2 Component: binutils AssignedTo: unassigned at sources dot redhat dot com ReportedBy: brad dot kish at bluecoat dot com CC: bug-binutils at gnu dot org http://sourceware.org/bugzilla/show_bug.cgi?id=12073 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils