3 Test that the C++11 support for char16_t and char32_t works correctly.
8 from lldbsuite
.test
.decorators
import *
9 from lldbsuite
.test
.lldbtest
import *
10 from lldbsuite
.test
import lldbutil
13 class Char1632TestCase(TestBase
):
15 # Call super's setUp().
17 # Find the line number to break for main.cpp.
18 self
.source
= "main.cpp"
20 line_number(self
.source
, "// breakpoint1"),
21 line_number(self
.source
, "// breakpoint2"),
26 bugnumber
="ICC (13.1) does not emit the DW_TAG_base_type for char16_t and char32_t.",
29 """Test that the C++11 support for char16_t and char32_t works correctly."""
31 exe
= self
.getBuildArtifact("a.out")
33 # Create a target by the debugger.
34 target
= self
.dbg
.CreateTarget(exe
)
35 self
.assertTrue(target
, VALID_TARGET
)
38 for line
in self
.lines
:
39 lldbutil
.run_break_set_by_file_and_line(self
, "main.cpp", line
)
41 # Now launch the process, and do not stop at entry point and stop at
43 process
= target
.LaunchSimple(None, None, self
.get_process_working_directory())
46 self
.fail("SBTarget.Launch() failed")
49 self
.runCmd("frame variable")
51 # Check that we correctly report the const types
53 "frame variable cs16 cs32",
55 "(const char16_t *) cs16 = ",
57 "(const char32_t *) cs32 = ",
62 # Check that we correctly report the non-const types
64 "frame variable s16 s32",
66 "(char16_t *) s16 = ",
68 "(char32_t *) s32 = ",
73 # Check that we correctly report the array types
75 "frame variable as16 as32",
77 "\(char16_t\[[0-9]+\]\) as16 = ",
78 "\(char32_t\[[0-9]+\]\) as32 = ",
80 substrs
=['u"ﺸﺵۻ"', 'U"ЕЙРГЖО"'],
83 self
.runCmd("next") # step to after the string is nullified
85 # check that we don't crash on NULL
86 self
.expect("frame variable s32", substrs
=["(char32_t *) s32 = 0x00000000"])
88 # continue and hit breakpoint2
89 self
.runCmd("continue")
91 # check that the new strings show
93 "frame variable s16 s32",
95 "(char16_t *) s16 = 0x",
97 "(char32_t *) s32 = ",
102 # check the same as above for arrays
104 "frame variable as16 as32",
106 "\(char16_t\[[0-9]+\]\) as16 = ",
107 "\(char32_t\[[0-9]+\]\) as32 = ",
109 substrs
=['"色ハ匂ヘト散リヌルヲ"', '"෴"'],
112 # check that zero values are properly handles
113 self
.expect_expr("cs16_zero", result_summary
="U+0000 u'\\0'")
114 self
.expect_expr("cs32_zero", result_summary
="U+0x00000000 U'\\0'")
116 # Check that we can run expressions that return charN_t
117 self
.expect_expr("u'a'", result_type
="char16_t", result_summary
="U+0061 u'a'")
119 "U'a'", result_type
="char32_t", result_summary
="U+0x00000061 U'a'"