diff options
| author | Zachary Turner <zturner@google.com> | 2015-10-28 17:43:26 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2015-10-28 17:43:26 +0000 |
| commit | c432c8f856e0bd84de980a9d9bb2d31b06fa95b1 (patch) | |
| tree | 4efa528e074a6e2df782345e4cd97f5d85d038c4 /lldb/packages/Python/lldbsuite/test/functionalities/fat_archives | |
| parent | a8a3bd210086b50242903ed95048fe5e53897878 (diff) | |
| download | bcm5719-llvm-c432c8f856e0bd84de980a9d9bb2d31b06fa95b1.tar.gz bcm5719-llvm-c432c8f856e0bd84de980a9d9bb2d31b06fa95b1.zip | |
Move lldb/test to lldb/packages/Python/lldbsuite/test.
This is the conclusion of an effort to get LLDB's Python code
structured into a bona-fide Python package. This has a number
of benefits, but most notably the ability to more easily share
Python code between different but related pieces of LLDB's Python
infrastructure (for example, `scripts` can now share code with
`test`).
llvm-svn: 251532
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/fat_archives')
5 files changed, 83 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile new file mode 100644 index 00000000000..e1832fdefbe --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile @@ -0,0 +1,14 @@ +all: clean + $(CC) -arch i386 -g -c a.c + ar -q liba-i386.a a.o + ranlib liba-i386.a + $(CC) -arch x86_64 -g -c a.c + ar -q liba-x86_64.a a.o + ranlib liba-x86_64.a + lipo -create -output liba.a liba-i386.a liba-x86_64.a + $(CC) -g -c main.c + $(CC) -o a.out main.o -L. -la + +clean: + rm -rf a.o a.out liba-i386.a liba-x86_64.a liba.a $(wildcard *un~ .*un~ main.o *.pyc) + diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py b/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py new file mode 100644 index 00000000000..ca721800b4d --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py @@ -0,0 +1,58 @@ +""" +Test some lldb command abbreviations. +""" +from __future__ import print_function + +import use_lldb_suite + +import commands +import lldb +import os +import time +from lldbtest import * +import lldbutil + +def execute_command (command): + # print('%% %s' % (command)) + (exit_status, output) = commands.getstatusoutput (command) + # if output: + # print(output) + # print('status = %u' % (exit_status)) + return exit_status + +class FatArchiveTestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + @skipUnlessDarwin + def test (self): + if self.getArchitecture() == 'x86_64': + execute_command ("make CC='%s'" % (os.environ["CC"])) + self.main () + else: + self.skipTest("This test requires x86_64 as the architecture for the inferior") + + def main (self): + '''This test compiles a quick example by making a fat file (universal) full of + skinny .o files and makes sure we can use them to resolve breakpoints when doing + DWARF in .o file debugging. The only thing this test needs to do is to compile and + set a breakpoint in the target and verify any breakpoint locations have valid debug + info for the function, and source file and line.''' + exe = os.path.join (os.getcwd(), "a.out") + + # Create the target + target = self.dbg.CreateTarget(exe) + + # Create a breakpoint by name + breakpoint = target.BreakpointCreateByName ('foo', exe) + self.assertTrue(breakpoint, VALID_BREAKPOINT) + + # Make sure the breakpoint resolves to a function, file and line + for bp_loc in breakpoint: + # Get a section offset address (lldb.SBAddress) from the breakpoint location + bp_loc_addr = bp_loc.GetAddress() + line_entry = bp_loc_addr.GetLineEntry() + function = bp_loc_addr.GetFunction() + self.assertTrue(function.IsValid(), "Verify breakpoint in fat BSD archive has valid function debug info") + self.assertTrue(line_entry.GetFileSpec(), "Verify breakpoint in fat BSD archive has source file information") + self.assertTrue(line_entry.GetLine() != 0, "Verify breakpoint in fat BSD archive has source line information") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/a.c b/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/a.c new file mode 100644 index 00000000000..c100f9a2c07 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/a.c @@ -0,0 +1,4 @@ +int foo () +{ + return 5; +} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/a.h b/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/a.h new file mode 100644 index 00000000000..a4536647cfc --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/a.h @@ -0,0 +1 @@ +int foo (); diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/main.c new file mode 100644 index 00000000000..328319d4fb8 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/main.c @@ -0,0 +1,6 @@ +#include "a.h" +#include <stdio.h> +int main() +{ + printf ("%d\n", foo()); +} |

