diff options
author | 2020-08-03 14:33:06 +0000 | |
---|---|---|
committer | 2020-08-03 14:33:06 +0000 | |
commit | 061da546b983eb767bad15e67af1174fb0bcf31c (patch) | |
tree | 83c78b820819d70aa40c36d90447978b300078c5 /gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions | |
parent | Import LLVM 10.0.0 release including clang, lld and lldb. (diff) | |
download | wireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.tar.xz wireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.zip |
Import LLVM 10.0.0 release including clang, lld and lldb.
ok hackroom
tested by plenty
Diffstat (limited to 'gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions')
3 files changed, 60 insertions, 0 deletions
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/Makefile b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/Makefile new file mode 100644 index 00000000000..99998b20bcb --- /dev/null +++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py new file mode 100644 index 00000000000..6352b68e7d7 --- /dev/null +++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py @@ -0,0 +1,35 @@ +""" +Tests that frame variable looks into anonymous unions +""" +import lldb +from lldbsuite.test.lldbtest import * +import lldbsuite.test.lldbutil as lldbutil + + +class FrameVariableAnonymousUnionsTestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + def test_with_run_command(self): + """Tests that frame variable looks into anonymous unions""" + self.build() + self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) + + line = line_number('main.cpp', '// break here') + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", line, num_expected_locations=-1, loc_exact=False) + + self.runCmd("process launch", RUN_SUCCEEDED) + + process = self.dbg.GetSelectedTarget().GetProcess() + + if process.GetByteOrder() == lldb.eByteOrderLittle: + self.expect('frame variable -f x i', substrs=['ffffff41']) + else: + self.expect('frame variable -f x i', substrs=['41ffff00']) + + self.expect('frame variable c', substrs=["'A"]) + + self.expect('frame variable x', matching=False, substrs=['3']) + self.expect('frame variable y', matching=False, substrs=["'B'"]) + self.expect('frame variable z', matching=False, substrs=['14']) diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/main.cpp b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/main.cpp new file mode 100644 index 00000000000..2489506b280 --- /dev/null +++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/main.cpp @@ -0,0 +1,22 @@ +//===-- main.cpp ------------------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +int main() { + union { + int i; + char c; + }; + struct { + int x; + char y; + short z; + } s{3,'B',14}; + i = 0xFFFFFF00; + c = 'A'; + return c; // break here +} |