Hi I just found some small issue where addr2line finds the symbols if it searches all sections but when call with '-j .text' (i.e. a single section where the symbol in there) it doesn't finds it.
addr2linw without -j addr2line -e helloworld 0x123456 helloworld.c:51 addr2line with -j addr2line -e helloworld -j .text 0x123456 ??:0 in addr2line.c I noticed a difference the the callback that handles all sections: 1) find_address_in_section() between the function that handle a single section: 2) find_offset_in_section(). so I just copy the missing code from (1) to (2) and all works just fine. attached patch.diff and config.status. addr2line version: GNU addr2line (GNU Binutils) 2.25.1 Copyright (C) 2014 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) any later version. This program has absolutely no warranty. Hope this will help. Thanks Amir Haroush
diff -rupN binutils-2.25.1.orig/binutils/addr2line.c binutils-2.25.1/binutils/addr2line.c --- binutils-2.25.1.orig/binutils/addr2line.c 2015-12-17 16:39:14.956344244 +0200 +++ binutils-2.25.1/binutils/addr2line.c 2015-12-17 16:59:13.060296646 +0200 @@ -194,6 +194,7 @@ find_address_in_section (bfd *abfd, asec static void find_offset_in_section (bfd *abfd, asection *section) { + bfd_vma vma; bfd_size_type size; if (found) @@ -202,11 +203,15 @@ find_offset_in_section (bfd *abfd, asect if ((bfd_get_section_flags (abfd, section) & SEC_ALLOC) == 0) return; + vma = bfd_get_section_vma (abfd, section); + if (pc < vma) + return; + size = bfd_get_section_size (section); - if (pc >= size) + if (pc >= vma + size) return; - found = bfd_find_nearest_line_discriminator (abfd, section, syms, pc, + found = bfd_find_nearest_line_discriminator (abfd, section, syms, pc - vma, &filename, &functionname, &line, &discriminator); }
config.status
Description: Binary data
_______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils