llvm-6502/test/DebugInfo/Inputs/arange-overlap.cc
Alexey Samsonov 740a75968a [DWARF parser] Fix broken address ranges construction.
Previous algorithm for constructing [Address ranges]->[Compile Units]
mapping was wrong. It somewhat relied on the assumption that address ranges
for different compile units may not overlap. It is not so.
For example, two compile units may contain the definition of the same
linkonce_odr function. These definitions will be merged at link-time,
resulting in equivalent .debug_ranges entries for both these units

Instead of sorting and merging original address ranges (from .debug_ranges
and .debug_aranges), implement a different approach: save endpoints
of all ranges, and then use a sweep-line approach to construct
the desired mapping. If we find that certain address maps to
several compilation units, we just pick any of them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210860 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 23:58:49 +00:00

27 lines
511 B
C++

void call();
struct S {
static void foo() { call(); call(); }
static void bar() { call(); call(); }
static void baz() {}
};
#ifdef FILE1
# define FUNC_NAME func1
# define FUNC_BODY \
S::foo(); S::bar(); S::baz();
#else
# define FUNC_NAME func2
# define FUNC_BODY \
S::bar();
#endif
void FUNC_NAME() {
FUNC_BODY
}
// Build instructions:
// $ clang -g -fPIC -c -DFILE1 arange-overlap.cc -o obj1.o
// $ clang -g -fPIC -c arange-overlap.cc -o obj2.o
// $ clang -shared obj1.o obj2.o -o <output>