]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/expression_command/test/TestExprs2.py
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / expression_command / test / TestExprs2.py
1 """
2 Test some more expression commands.
3 """
4
5 from __future__ import print_function
6
7
8 import os
9 import lldb
10 from lldbsuite.test.decorators import *
11 from lldbsuite.test.lldbtest import *
12 from lldbsuite.test import lldbutil
13
14
15 class ExprCommands2TestCase(TestBase):
16
17     mydir = TestBase.compute_mydir(__file__)
18
19     def setUp(self):
20         # Call super's setUp().
21         TestBase.setUp(self)
22         # Find the line number to break for main.c.
23         self.line = line_number(
24             'main.cpp',
25             '// Please test many expressions while stopped at this line:')
26
27     @expectedFailureAll(
28         oslist=["windows"],
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."""
32         self.build()
33
34         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
35
36         lldbutil.run_break_set_by_file_and_line(
37             self, "main.cpp", self.line, num_expected_locations=1, loc_exact=False)
38
39         self.runCmd("run", RUN_SUCCEEDED)
40
41         # Does static casting work?
42         self.expect("expression (int*)argv",
43                     startstr="(int *) $0 = 0x")
44         # (int *) $0 = 0x00007fff5fbff258
45
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"
50
51         # Do return values containing the contents of expression locals work?
52         self.expect("expression int i = 5; i",
53                     startstr="(int) $2 = 5")
54         # (int) $2 = 5
55         self.expect("expression $2 + 1",
56                     startstr="(int) $3 = 6")
57         # (int) $3 = 6
58
59         # Do return values containing the results of static expressions work?
60         self.expect("expression 20 + 3",
61                     startstr="(int) $4 = 23")
62         # (int) $4 = 5
63         self.expect("expression $4 + 1",
64                     startstr="(int) $5 = 24")
65         # (int) $5 = 6