[DWARF] Fix a bug in line info handling
authorKeno Fischer <kfischer@college.harvard.edu>
Sun, 31 May 2015 23:37:04 +0000 (23:37 +0000)
committerKeno Fischer <kfischer@college.harvard.edu>
Sun, 31 May 2015 23:37:04 +0000 (23:37 +0000)
commit23125c500fcc2a13c10a71c1625f9a33c2c84f89
treef2391e6d87e86e6f63d9e8bbcd9568e534c54588
parentf8f9476a1b0c36cf397478f7da6a54a05f266a9a
[DWARF] Fix a bug in line info handling

This fixes a bug in the line info handling in the dwarf code, based on a
problem I when implementing RelocVisitor support for MachO.
Since addr+size will give the first address past the end of the function,
we need to back up one line table entry. Fix this by looking up the
end_addr-1, which is the last address in the range. Note that this also
removes a duplicate output from the llvm-rtdyld line table dump. The
relevant line is the end_sequence one in the line table and has an offset
of the first address part the end of the range and hence should not be
included.
Also factor out the common functionality into a separate function.
This comes up on MachO much more than on ELF, since MachO
doesn't store the symbol size separately, hence making
said situation always occur.

Differential Revision: http://reviews.llvm.org/D9925

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238699 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
lib/DebugInfo/DWARF/DWARFDebugLine.cpp
test/DebugInfo/debuglineinfo-macho.test
test/DebugInfo/debuglineinfo.test