Skip to content

Commit 2c8679a

Browse files
committed
[lldb][test] Replace use of p with expression (NFC)
In API tests, replace use of the `p` alias with the `expression` command. To avoid conflating tests of the alias with tests of the expression command, this patch canonicalizes to the use `expression`. Differential Revision: https://reviews.llvm.org/D141539 (cherry picked from commit 4076664) (cherry picked from commit a7bf4d6)
1 parent 0bb434c commit 2c8679a

File tree

45 files changed

+144
-120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+144
-120
lines changed

lldb/test/API/commands/expression/call-function/TestCallStdStringFunction.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_with(self):
1919
self.build()
2020
lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.cpp"))
2121

22-
self.expect("print str",
22+
self.expect("expression str",
2323
substrs=['Hello world'])
2424

2525
# Calling this function now succeeds, but we follow the typedef return type through to
@@ -32,5 +32,5 @@ def test_with(self):
3232
if triple in ["arm64-apple-ios", "arm64e-apple-ios", "arm64-apple-tvos", "armv7k-apple-watchos", "arm64-apple-bridgeos", "arm64_32-apple-watchos"]:
3333
do_cstr_test = False
3434
if do_cstr_test:
35-
self.expect("print str.c_str()",
35+
self.expect("expression str.c_str()",
3636
substrs=['Hello world'])

lldb/test/API/commands/expression/codegen-crash-typedefdecl-not-in_declcontext/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct E {
2323
E(B &b) : b_ref(b) {}
2424
NS::DW f() { return {}; };
2525
void g() {
26-
return; //%self.expect("p b_ref", substrs=['(B) $0 =', '(spd = NS::DW', 'a = 0)'])
26+
return; //%self.expect("expression b_ref", substrs=['(B) $0 =', '(spd = NS::DW', 'a = 0)'])
2727
}
2828

2929
B &b_ref;

lldb/test/API/commands/expression/persist_objc_pointeetype/TestPersistObjCPointeeType.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,16 @@ def cleanup():
3838

3939
self.runCmd("run", RUN_SUCCEEDED)
4040

41-
self.expect("p *self", substrs=['_sc_name = nil',
42-
'_sc_name2 = nil',
43-
'_sc_name3 = nil',
44-
'_sc_name4 = nil',
45-
'_sc_name5 = nil',
46-
'_sc_name6 = nil',
47-
'_sc_name7 = nil',
48-
'_sc_name8 = nil'])
41+
self.expect(
42+
"expression *self",
43+
substrs=[
44+
"_sc_name = nil",
45+
"_sc_name2 = nil",
46+
"_sc_name3 = nil",
47+
"_sc_name4 = nil",
48+
"_sc_name5 = nil",
49+
"_sc_name6 = nil",
50+
"_sc_name7 = nil",
51+
"_sc_name8 = nil",
52+
],
53+
)

lldb/test/API/commands/expression/rdar44436068/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ int main(void)
22
{
33
__int128_t n = 1;
44
n = n + n;
5-
return n; //%self.expect("p n", substrs=['(__int128_t) $0 = 2'])
6-
//%self.expect("p n + 6", substrs=['(__int128_t) $1 = 8'])
7-
//%self.expect("p n + n", substrs=['(__int128_t) $2 = 4'])
5+
return n; //%self.expect("expression n", substrs=['(__int128_t) $0 = 2'])
6+
//%self.expect("expression n + 6", substrs=['(__int128_t) $1 = 8'])
7+
//%self.expect("expression n + n", substrs=['(__int128_t) $2 = 4'])
88
}

lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def test_sve_registers_read_write(self):
163163
self.check_sve_regs_read(z_reg_size)
164164

165165
# Evaluate simple expression and print function expr_eval_func address.
166-
self.expect("p expr_eval_func", substrs=["= 0x"])
166+
self.expect("expression expr_eval_func", substrs=["= 0x"])
167167

168168
# Evaluate expression call function expr_eval_func.
169169
self.expect_expr("expr_eval_func()",

lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test(self):
3030
self.runCmd(f"settings set symbols.clang-modules-cache-path '{mod_cache}'")
3131

3232
# Cause lldb to generate a Darwin-*.pcm
33-
self.runCmd("p @import Darwin")
33+
self.runCmd("expression @import Darwin")
3434

3535
# root/<config-hash>/<module-name>-<modulemap-path-hash>.pcm
3636
pcm_paths = glob.glob(os.path.join(mod_cache, '*', 'Darwin-*.pcm'))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
C_SOURCES := main.c
2+
CFLAGS_EXTRAS := -std=c99
3+
4+
include Makefile.rules
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import lldb
2+
from lldbsuite.test.lldbtest import TestBase
3+
from lldbsuite.test import lldbutil
4+
5+
6+
class TestCase(TestBase):
7+
def test(self):
8+
self.build()
9+
lldbutil.run_to_source_breakpoint(self, "return", lldb.SBFileSpec("main.c"))
10+
self.expect("p -g", substrs=["$0 = -"])
11+
self.expect("p -i0 -g", error=True)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
int main() {
2+
int g = 41;
3+
return 0;
4+
}

lldb/test/API/functionalities/backticks/TestBackticksWithoutATarget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ class BackticksWithNoTargetTestCase(TestBase):
1515
@no_debug_info_test
1616
def test_backticks_no_target(self):
1717
"""A simple test of backticks without a target."""
18-
self.expect("print `1+2-3`",
18+
self.expect("expression `1+2-3`",
1919
substrs=[' = 0'])

0 commit comments

Comments
 (0)