2 Test some more expression commands.
5 from __future__ import print_function
10 from lldbsuite.test.decorators import *
11 from lldbsuite.test.lldbtest import *
12 from lldbsuite.test import lldbutil
15 class ExprCommands2TestCase(TestBase):
17 mydir = TestBase.compute_mydir(__file__)
20 # Call super's setUp().
22 # Find the line number to break for main.c.
23 self.line = line_number(
25 '// Please test many expressions while stopped at this line:')
27 def test_more_expr_commands(self):
28 """Test some more expression commands."""
31 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
33 lldbutil.run_break_set_by_file_and_line(
34 self, "main.cpp", self.line, num_expected_locations=1, loc_exact=False)
36 self.runCmd("run", RUN_SUCCEEDED)
38 # Does static casting work?
39 self.expect("expression (int*)argv",
40 startstr="(int *) $0 = 0x")
41 # (int *) $0 = 0x00007fff5fbff258
43 # Do return values containing the contents of expression locals work?
44 self.expect("expression int i = 5; i",
45 startstr="(int) $1 = 5")
47 self.expect("expression $1 + 1",
48 startstr="(int) $2 = 6")
51 # Do return values containing the results of static expressions work?
52 self.expect("expression 20 + 3",
53 startstr="(int) $3 = 23")
55 self.expect("expression $3 + 1",
56 startstr="(int) $4 = 24")
60 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489")
61 def test_expr_symbols(self):
65 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
67 lldbutil.run_break_set_by_file_and_line(
68 self, "main.cpp", self.line, num_expected_locations=1, loc_exact=False)
70 self.runCmd("run", RUN_SUCCEEDED)
72 # Do anonymous symbols work?
73 self.expect("expression ((char**)environ)[0]",
74 startstr="(char *) $0 = 0x")
75 # (char *) $1 = 0x00007fff5fbff298 "Apple_PubSub_Socket_Render=/tmp/launch-7AEsUD/Render"