summaryrefslogtreecommitdiffstats
path: root/llvm/test/DebugInfo
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2014-06-12 23:58:49 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2014-06-12 23:58:49 +0000
commit0670cfaf01bc70c159132836be62c8b91e18dedb (patch)
treea2ca45ce8c200ae8c09ec91690aff769e9f74ca9 /llvm/test/DebugInfo
parent70e005a1719978a134b0d65a38828b41338263fb (diff)
downloadbcm5719-llvm-0670cfaf01bc70c159132836be62c8b91e18dedb.tar.gz
bcm5719-llvm-0670cfaf01bc70c159132836be62c8b91e18dedb.zip
[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. llvm-svn: 210860
Diffstat (limited to 'llvm/test/DebugInfo')
-rw-r--r--llvm/test/DebugInfo/Inputs/arange-overlap.cc26
-rwxr-xr-xllvm/test/DebugInfo/Inputs/arange-overlap.elf-x86_64bin0 -> 9824 bytes
-rw-r--r--llvm/test/DebugInfo/llvm-symbolizer.test4
3 files changed, 30 insertions, 0 deletions
diff --git a/llvm/test/DebugInfo/Inputs/arange-overlap.cc b/llvm/test/DebugInfo/Inputs/arange-overlap.cc
new file mode 100644
index 00000000000..82e3f120efd
--- /dev/null
+++ b/llvm/test/DebugInfo/Inputs/arange-overlap.cc
@@ -0,0 +1,26 @@
+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>
diff --git a/llvm/test/DebugInfo/Inputs/arange-overlap.elf-x86_64 b/llvm/test/DebugInfo/Inputs/arange-overlap.elf-x86_64
new file mode 100755
index 00000000000..075e9c27123
--- /dev/null
+++ b/llvm/test/DebugInfo/Inputs/arange-overlap.elf-x86_64
Binary files differ
diff --git a/llvm/test/DebugInfo/llvm-symbolizer.test b/llvm/test/DebugInfo/llvm-symbolizer.test
index 1ddfd9cf55c..20d3dda21ab 100644
--- a/llvm/test/DebugInfo/llvm-symbolizer.test
+++ b/llvm/test/DebugInfo/llvm-symbolizer.test
@@ -18,6 +18,7 @@ RUN: echo "%p/Inputs/macho-universal:i386 0x1f67" >> %t.input
RUN: echo "%p/Inputs/macho-universal:x86_64 0x100000f05" >> %t.input
RUN: echo "%p/Inputs/llvm-symbolizer-dwo-test 0x400514" >> %t.input
RUN: echo "%p/Inputs/fission-ranges.elf-x86_64 0x720" >> %t.input
+RUN: echo "%p/Inputs/arange-overlap.elf-x86_64 0x714" >> %t.input
RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false \
RUN: --default-arch=i386 < %t.input | FileCheck %s
@@ -94,6 +95,9 @@ CHECK-NEXT: llvm-symbolizer-dwo-test.cc:11
CHECK: main
CHECK-NEXT: {{.*}}fission-ranges.cc:6
+CHECK: _ZN1S3bazEv
+CHECK-NEXT: {{.*}}arange-overlap.cc:6
+
RUN: echo "unexisting-file 0x1234" > %t.input2
RUN: llvm-symbolizer < %t.input2
OpenPOWER on IntegriCloud