aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/functionalities/archives
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-01-06 20:12:03 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-01-06 20:12:03 +0000
commit9e6d35490a6542f9c97607f93c2ef8ca8e03cbcc (patch)
treedd2a1ddf0476664c2b823409c36cbccd52662ca7 /packages/Python/lldbsuite/test/functionalities/archives
parent3bd2e91faeb9eeec1aae82c64a3253afff551cfd (diff)
downloadsrc-503acc3a0a1fd9a610f1a126b8608cb84b185170.tar.gz
src-503acc3a0a1fd9a610f1a126b8608cb84b185170.zip
Vendor import of lldb trunk r256945:vendor/lldb/lldb-trunk-r256945
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/archives')
-rw-r--r--packages/Python/lldbsuite/test/functionalities/archives/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/archives/README62
-rw-r--r--packages/Python/lldbsuite/test/functionalities/archives/TestBSDArchives.py57
-rw-r--r--packages/Python/lldbsuite/test/functionalities/archives/a.c19
-rw-r--r--packages/Python/lldbsuite/test/functionalities/archives/b.c19
-rw-r--r--packages/Python/lldbsuite/test/functionalities/archives/main.c17
6 files changed, 183 insertions, 0 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/archives/Makefile b/packages/Python/lldbsuite/test/functionalities/archives/Makefile
new file mode 100644
index 000000000000..64da83becbda
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/archives/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../make
+
+C_SOURCES := main.c
+
+MAKE_DSYM := NO
+ARCHIVE_NAME := libfoo.a
+ARCHIVE_C_SOURCES := a.c b.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/archives/README b/packages/Python/lldbsuite/test/functionalities/archives/README
new file mode 100644
index 000000000000..d327f4585c67
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/archives/README
@@ -0,0 +1,62 @@
+a.out file refers to libfoo.a for a.o and b.o, which is what we want to accomplish for
+this test case.
+
+[16:17:44] johnny:/Volumes/data/lldb/svn/latest/test/functionalities/archives $ dsymutil -s a.out
+----------------------------------------------------------------------
+Symbol table for: 'a.out' (x86_64)
+----------------------------------------------------------------------
+Index n_strx n_type n_sect n_desc n_value
+======== -------- ------------------ ------ ------ ----------------
+[ 0] 00000002 64 (N_SO ) 00 0000 0000000000000000 '/Volumes/data/lldb/svn/latest/test/functionalities/archives/'
+[ 1] 0000003f 64 (N_SO ) 00 0000 0000000000000000 'main.c'
+[ 2] 00000046 66 (N_OSO ) 03 0001 000000004f0f780c '/Volumes/data/lldb/svn/latest/test/functionalities/archives/main.o'
+[ 3] 00000001 2e (N_BNSYM ) 01 0000 0000000100000d70
+[ 4] 00000089 24 (N_FUN ) 01 0000 0000000100000d70 '_main'
+[ 5] 00000001 24 (N_FUN ) 00 0000 000000000000005d
+[ 6] 00000001 4e (N_ENSYM ) 01 0000 000000000000005d
+[ 7] 00000001 64 (N_SO ) 01 0000 0000000000000000
+[ 8] 00000002 64 (N_SO ) 00 0000 0000000000000000 '/Volumes/data/lldb/svn/latest/test/functionalities/archives/'
+[ 9] 0000008f 64 (N_SO ) 00 0000 0000000000000000 'a.c'
+[ 10] 00000093 66 (N_OSO ) 03 0001 000000004f0f780c '/Volumes/data/lldb/svn/latest/test/functionalities/archives/libfoo.a(a.o)'
+[ 11] 00000001 2e (N_BNSYM ) 01 0000 0000000100000dd0
+[ 12] 000000dd 24 (N_FUN ) 01 0000 0000000100000dd0 '_a'
+[ 13] 00000001 24 (N_FUN ) 00 0000 0000000000000020
+[ 14] 00000001 4e (N_ENSYM ) 01 0000 0000000000000020
+[ 15] 00000001 2e (N_BNSYM ) 01 0000 0000000100000df0
+[ 16] 000000e0 24 (N_FUN ) 01 0000 0000000100000df0 '_aa'
+[ 17] 00000001 24 (N_FUN ) 00 0000 0000000000000018
+[ 18] 00000001 4e (N_ENSYM ) 01 0000 0000000000000018
+[ 19] 000000e4 20 (N_GSYM ) 00 0000 0000000000000000 '___a_global'
+[ 20] 00000001 64 (N_SO ) 01 0000 0000000000000000
+[ 21] 00000002 64 (N_SO ) 00 0000 0000000000000000 '/Volumes/data/lldb/svn/latest/test/functionalities/archives/'
+[ 22] 000000f0 64 (N_SO ) 00 0000 0000000000000000 'b.c'
+[ 23] 000000f4 66 (N_OSO ) 03 0001 000000004f0f780c '/Volumes/data/lldb/svn/latest/test/functionalities/archives/libfoo.a(b.o)'
+[ 24] 00000001 2e (N_BNSYM ) 01 0000 0000000100000e10
+[ 25] 0000013e 24 (N_FUN ) 01 0000 0000000100000e10 '_b'
+[ 26] 00000001 24 (N_FUN ) 00 0000 0000000000000020
+[ 27] 00000001 4e (N_ENSYM ) 01 0000 0000000000000020
+[ 28] 00000001 2e (N_BNSYM ) 01 0000 0000000100000e30
+[ 29] 00000141 24 (N_FUN ) 01 0000 0000000100000e30 '_bb'
+[ 30] 00000001 24 (N_FUN ) 00 0000 0000000000000018
+[ 31] 00000001 4e (N_ENSYM ) 01 0000 0000000000000018
+[ 32] 00000145 26 (N_STSYM ) 0a 0000 000000010000104c '___b_global'
+[ 33] 00000001 64 (N_SO ) 01 0000 0000000000000000
+[ 34] 00000151 0e ( SECT ) 07 0000 0000000100001000 '_pvars'
+[ 35] 00000158 0e ( SECT ) 0a 0000 000000010000104c '___b_global'
+[ 36] 00000164 0f ( SECT EXT) 0b 0000 0000000100001050 '_NXArgc'
+[ 37] 0000016c 0f ( SECT EXT) 0b 0000 0000000100001058 '_NXArgv'
+[ 38] 00000174 0f ( SECT EXT) 0a 0000 0000000100001048 '___a_global'
+[ 39] 00000180 0f ( SECT EXT) 0b 0000 0000000100001068 '___progname'
+[ 40] 0000018c 03 ( ABS EXT) 01 0010 0000000100000000 '__mh_execute_header'
+[ 41] 000001a0 0f ( SECT EXT) 01 0000 0000000100000dd0 '_a'
+[ 42] 000001a3 0f ( SECT EXT) 01 0000 0000000100000df0 '_aa'
+[ 43] 000001a7 0f ( SECT EXT) 01 0000 0000000100000e10 '_b'
+[ 44] 000001aa 0f ( SECT EXT) 01 0000 0000000100000e30 '_bb'
+[ 45] 000001ae 0f ( SECT EXT) 0b 0000 0000000100001060 '_environ'
+[ 46] 000001b7 0f ( SECT EXT) 01 0000 0000000100000d70 '_main'
+[ 47] 000001bd 0f ( SECT EXT) 01 0000 0000000100000d30 'start'
+[ 48] 000001c3 01 ( UNDF EXT) 00 0100 0000000000000000 '_exit'
+[ 49] 000001c9 01 ( UNDF EXT) 00 0100 0000000000000000 '_printf'
+[ 50] 000001d1 01 ( UNDF EXT) 00 0100 0000000000000000 'dyld_stub_binder'
+
+
diff --git a/packages/Python/lldbsuite/test/functionalities/archives/TestBSDArchives.py b/packages/Python/lldbsuite/test/functionalities/archives/TestBSDArchives.py
new file mode 100644
index 000000000000..02e1b9551853
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/archives/TestBSDArchives.py
@@ -0,0 +1,57 @@
+"""Test breaking inside functions defined within a BSD archive file libfoo.a."""
+
+from __future__ import print_function
+
+
+
+import os, time
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+class BSDArchivesTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # Find the line number in a(int) to break at.
+ self.line = line_number('a.c', '// Set file and line breakpoint inside a().')
+
+ @expectedFailureWindows("llvm.org/pr24527") # Makefile.rules doesn't know how to build static libs on Windows.
+ def test(self):
+ """Break inside a() and b() defined within libfoo.a."""
+ self.build()
+
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ # Break inside a() by file and line first.
+ lldbutil.run_break_set_by_file_and_line (self, "a.c", self.line, num_expected_locations=1, loc_exact=True)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+
+ # Break at a(int) first.
+ self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs = ['(int) arg = 1'])
+ self.expect("frame variable __a_global", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs = ['(int) __a_global = 1'])
+
+ # Set breakpoint for b() next.
+ lldbutil.run_break_set_by_symbol (self, "b", num_expected_locations=1, sym_exact=True)
+
+ # Continue the program, we should break at b(int) next.
+ self.runCmd("continue")
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+ self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs = ['(int) arg = 2'])
+ self.expect("frame variable __b_global", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs = ['(int) __b_global = 2'])
diff --git a/packages/Python/lldbsuite/test/functionalities/archives/a.c b/packages/Python/lldbsuite/test/functionalities/archives/a.c
new file mode 100644
index 000000000000..2b6ebbe47a76
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/archives/a.c
@@ -0,0 +1,19 @@
+//===-- a.c -----------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+int __a_global = 1;
+
+int a(int arg) {
+ int result = arg + __a_global;
+ return result; // Set file and line breakpoint inside a().
+}
+
+int aa(int arg1) {
+ int result1 = arg1 - __a_global;
+ return result1;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/archives/b.c b/packages/Python/lldbsuite/test/functionalities/archives/b.c
new file mode 100644
index 000000000000..51d77dd4bcdc
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/archives/b.c
@@ -0,0 +1,19 @@
+//===-- b.c -----------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+static int __b_global = 2;
+
+int b(int arg) {
+ int result = arg + __b_global;
+ return result;
+}
+
+int bb(int arg1) {
+ int result2 = arg1 - __b_global;
+ return result2;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/archives/main.c b/packages/Python/lldbsuite/test/functionalities/archives/main.c
new file mode 100644
index 000000000000..c5b1cc2f0d1c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/archives/main.c
@@ -0,0 +1,17 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#include <stdio.h>
+
+extern int a(int);
+extern int b(int);
+int main (int argc, char const *argv[])
+{
+ printf ("a(1) returns %d\n", a(1));
+ printf ("b(2) returns %d\n", b(2));
+}