blob: 56489529d2ef254742ca961eb8b79c1c5b6e00cf [file] [log] [blame]
Todd Fialab91de782014-06-27 16:52:49 +00001"""
2Test lldb 'image list' on object files across multiple architectures.
3This exercises classes like ObjectFileELF and their support for opening
4foreign-architecture object files.
5"""
6
Zachary Turner35d017f2015-10-23 17:04:29 +00007from __future__ import print_function
8
Zachary Turner0a0490b2015-10-27 20:12:05 +00009import use_lldb_suite
Zachary Turner77db4a82015-10-22 20:06:20 +000010
Todd Fialab91de782014-06-27 16:52:49 +000011import os.path
Todd Fialab91de782014-06-27 16:52:49 +000012import lldb
13from lldbtest import *
14import lldbutil
15import re
16
17class TestImageListMultiArchitecture(TestBase):
18
19 mydir = TestBase.compute_mydir(__file__)
20
Tamas Berghammerc8fd1302015-09-30 10:12:40 +000021 @no_debug_info_test
Todd Fialab91de782014-06-27 16:52:49 +000022 def test_image_list_shows_multiple_architectures(self):
23 """Test that image list properly shows the correct architecture for a set of different architecture object files."""
24 images = {
Todd Fiala7df337f2015-10-13 23:41:19 +000025 "hello-freebsd-10.0-x86_64-clang-3.3": re.compile(r"x86_64-(\*)?-freebsd10.0(-unknown)? x86_64"),
26 "hello-freebsd-10.0-x86_64-gcc-4.7.3": re.compile(r"x86_64-(\*)?-freebsd10.0(-unknown)? x86_64"),
27 "hello-netbsd-6.1-x86_64-gcc-4.5.3": re.compile(r"x86_64-(\*)?-netbsd(-unknown)? x86_64"),
28 "hello-ubuntu-14.04-x86_64-gcc-4.8.2": re.compile(r"x86_64-(\*)?-linux(-unknown)? x86_64"),
29 "hello-ubuntu-14.04-x86_64-clang-3.5pre": re.compile(r"x86_64-(\*)?-linux(-unknown)? x86_64"),
30 "hello-unknown-kalimba_arch4-kcc-36": re.compile(r"kalimba4-csr-(unknown|\*)(-unknown)? kalimba"),
31 "hello-unknown-kalimba_arch5-kcc-39": re.compile(r"kalimba5-csr-(unknown|\*)(-unknown)? kalimba"),
Todd Fialab91de782014-06-27 16:52:49 +000032 }
33
34 for image_name in images:
Todd Fiala6ce5b632014-06-27 20:07:03 +000035 file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "bin", image_name))
Todd Fialab91de782014-06-27 16:52:49 +000036 expected_triple_and_arch_regex = images[image_name]
37
38 self.runCmd("file {}".format(file_name))
39 self.match("image list -t -A", [expected_triple_and_arch_regex])
Greg Clayton615eb7e2014-09-19 20:11:50 +000040 # Revert to the host platform after all of this is done
41 self.runCmd("platform select host")