Add testcase for llvm-dwarfdump to test parsing of the pubnames data.
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Thu, 14 Feb 2013 16:10:58 +0000 (16:10 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Thu, 14 Feb 2013 16:10:58 +0000 (16:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175168 91177308-0d34-0410-b5e6-96231b3b80d8

test/DebugInfo/Inputs/dwarfdump-pubnames.cc [new file with mode: 0644]
test/DebugInfo/Inputs/dwarfdump-pubnames.elf-x86-64 [new file with mode: 0644]
test/DebugInfo/dwarfdump-pubnames.test [new file with mode: 0644]

diff --git a/test/DebugInfo/Inputs/dwarfdump-pubnames.cc b/test/DebugInfo/Inputs/dwarfdump-pubnames.cc
new file mode 100644 (file)
index 0000000..284755b
--- /dev/null
@@ -0,0 +1,32 @@
+// Object file built using:
+// clang -g -mllvm -generate-dwarf-pubnames -o dwarfdump-pubnames.elf-x86_64 \
+//    dwarfdump-pubnames.cc  -c
+
+struct C {
+  void member_function();
+  static int static_member_function();
+  static int static_member_variable;
+};
+
+int C::static_member_variable = 0;
+
+void C::member_function() {
+  static_member_variable = 0;
+}
+
+int C::static_member_function() {
+  return static_member_variable;
+}
+
+C global_variable;
+
+int global_function() {
+  return -1;
+}
+
+namespace ns {
+  void global_namespace_function() {
+    global_variable.member_function();
+  }
+  int global_namespace_variable = 1;
+}
diff --git a/test/DebugInfo/Inputs/dwarfdump-pubnames.elf-x86-64 b/test/DebugInfo/Inputs/dwarfdump-pubnames.elf-x86-64
new file mode 100644 (file)
index 0000000..3c9c1ad
Binary files /dev/null and b/test/DebugInfo/Inputs/dwarfdump-pubnames.elf-x86-64 differ
diff --git a/test/DebugInfo/dwarfdump-pubnames.test b/test/DebugInfo/dwarfdump-pubnames.test
new file mode 100644 (file)
index 0000000..e1b16c2
--- /dev/null
@@ -0,0 +1,16 @@
+RUN: llvm-dwarfdump %p/Inputs/dwarfdump-pubnames.elf-x86-64 \
+RUN:   -debug-dump=pubnames | FileCheck %s
+
+CHECK: .debug_pubnames contents:
+CHECK: Length:                161
+CHECK: Version:               2
+CHECK: Offset in .debug_info: 0
+CHECK: Size:                  321
+
+CHECK:  Offset    Name
+CHECK:      98    global_namespace_variable
+CHECK:      a7    global_namespace_function
+CHECK:      ec    static_member_function
+CHECK:      7c    global_variable
+CHECK:     103    global_function
+CHECK:      c2    member_function