]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/expression_command/test/TestExprs2.py
Vendor import of lldb trunk r351319 (just before the release_80 branch
[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     def test_more_expr_commands(self):
28         """Test some more expression commands."""
29         self.build()
30
31         self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
32
33         lldbutil.run_break_set_by_file_and_line(
34             self, "main.cpp", self.line, num_expected_locations=1, loc_exact=False)
35
36         self.runCmd("run", RUN_SUCCEEDED)
37
38         # Does static casting work?
39         self.expect("expression (int*)argv",
40                     startstr="(int *) $0 = 0x")
41         # (int *) $0 = 0x00007fff5fbff258
42
43         # Do return values containing the contents of expression locals work?
44         self.expect("expression int i = 5; i",
45                     startstr="(int) $1 = 5")
46         # (int) $2 = 5
47         self.expect("expression $1 + 1",
48                     startstr="(int) $2 = 6")
49         # (int) $3 = 6
50
51         # Do return values containing the results of static expressions work?
52         self.expect("expression 20 + 3",
53                     startstr="(int) $3 = 23")
54         # (int) $4 = 5
55         self.expect("expression $3 + 1",
56                     startstr="(int) $4 = 24")
57         # (int) $5 = 6
58
59     @skipIfLinux
60     @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489")
61     def test_expr_symbols(self):
62         """Test symbols."""
63         self.build()
64
65         self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
66
67         lldbutil.run_break_set_by_file_and_line(
68                 self, "main.cpp", self.line, num_expected_locations=1, loc_exact=False)
69
70         self.runCmd("run", RUN_SUCCEEDED)
71
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"