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:')
29 bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
30 def test_more_expr_commands(self):
31 """Test some more expression commands."""
34 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
36 lldbutil.run_break_set_by_file_and_line(
37 self, "main.cpp", self.line, num_expected_locations=1, loc_exact=False)
39 self.runCmd("run", RUN_SUCCEEDED)
41 # Does static casting work?
42 self.expect("expression (int*)argv",
43 startstr="(int *) $0 = 0x")
44 # (int *) $0 = 0x00007fff5fbff258
46 # Do anonymous symbols work?
47 self.expect("expression ((char**)environ)[0]",
48 startstr="(char *) $1 = 0x")
49 # (char *) $1 = 0x00007fff5fbff298 "Apple_PubSub_Socket_Render=/tmp/launch-7AEsUD/Render"
51 # Do return values containing the contents of expression locals work?
52 self.expect("expression int i = 5; i",
53 startstr="(int) $2 = 5")
55 self.expect("expression $2 + 1",
56 startstr="(int) $3 = 6")
59 # Do return values containing the results of static expressions work?
60 self.expect("expression 20 + 3",
61 startstr="(int) $4 = 23")
63 self.expect("expression $4 + 1",
64 startstr="(int) $5 = 24")