In Shell 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`.
See also D141539 which made the same change to API tests.
Differential Revision: https://reviews.llvm.org/D146230
# RUN: %lldb -x -b -o 'settings set interpreter.stop-command-source-on-error false' -o "command source %s" 2>&1 | FileCheck %s --check-prefix CONTINUE
bogus
-p 10+1
+expression 10+1
# CONTINUE: $0 = 11
# STOP-NOT: $0 = 11
# RUN: %clang_host -g %S/Inputs/main.c -o %t
-# RUN: %lldb -b -o 'target stop-hook add --name test --shlib test -o "p 95000 + 126"' -o 'file %t' -o 'b main' -o 'r' 2>&1 | FileCheck %s
+# RUN: %lldb -b -o 'target stop-hook add --name test --shlib test -o "expression 95000 + 126"' -o 'file %t' -o 'b main' -o 'r' 2>&1 | FileCheck %s
# CHECK: Stop hook #1 added
# CHECK-NOT: 95126
// XFAIL: system-netbsd || system-freebsd || system-darwin
// RUN: %build %s --nodefaultlib -o %t
-// RUN: %lldb %t -o "b main" -o run -o "p call_me(5, 6)" -o exit \
+// RUN: %lldb %t -o "b main" -o run -o "expression call_me(5, 6)" -o exit \
// RUN: | FileCheck %s
-// CHECK: p call_me(5, 6)
+// CHECK: expression call_me(5, 6)
// CHECK: (int) $0 = 30
int call_me(int x, long y) { return x * y; }
# CHECK: Process {{.*}} stopped
# fdiv (%rbx) gets encoded into 2 bytes, int3 into 1 byte
-print (void*)($pc-3)
+expression (void*)($pc-3)
# CHECK: (void *) $0 = [[FDIV:0x[0-9a-f]*]]
-print &zero
+expression &zero
# CHECK: (uint32_t *) $1 = [[ZERO:0x[0-9a-f]*]]
register read --all
# CHECK-DAG: st{{(mm)?}}7 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
# legacy approach, superseded by fip/fdp registers
-print (void*)($fiseg*0x100000000 + $fioff)
+expression (void*)($fiseg*0x100000000 + $fioff)
# CHECK: (void *) $2 = [[FDIV]]
-print (uint32_t*)($foseg * 0x100000000 + $fooff)
+expression (uint32_t*)($foseg * 0x100000000 + $fooff)
# CHECK: (uint32_t *) $3 = [[ZERO]]
process continue
watchpoint set variable -w read_write g_32rw
# CHECK: Watchpoint created: Watchpoint 4: addr = 0x{{[0-9a-f]*}} size = 4 state = enabled type = rw
-print &g_8w
+expression &g_8w
# CHECK: (uint8_t *) $0 = [[VAR8W:0x[0-9a-f]*]]
-print &g_16rw
+expression &g_16rw
# CHECK: (uint16_t *) $1 = [[VAR16RW:0x[0-9a-f]*]]
-print &g_32w
+expression &g_32w
# CHECK: (uint32_t *) $2 = [[VAR32W:0x[0-9a-f]*]]
-print &g_32rw
+expression &g_32rw
# CHECK: (uint32_t *) $3 = [[VAR64RW:0x[0-9a-f]*]]
register read --all
# CHECK: Process {{.*}} stopped
# fdiv (%rbx) gets encoded into 2 bytes, int3 into 1 byte
-print (void*)($pc-3)
+expression (void*)($pc-3)
# CHECK: (void *) $0 = [[FDIV:0x[0-9a-f]*]]
-print &zero
+expression &zero
# CHECK: (uint32_t *) $1 = [[ZERO:0x[0-9a-f]*]]
register read --all
settings set interpreter.stop-command-source-on-error false
bogus
-print 123400000 + 56789
+expression 123400000 + 56789
settings set interpreter.stop-command-source-on-error true
bogus
-print 123400000 + 56789
+expression 123400000 + 56789
# RUN: %lldb -b -o 'settings set interpreter.stop-command-source-on-error false' -s %S/Inputs/StopCommandSource.in | FileCheck %s --check-prefix CONTINUE
# FIXME: Should continue
-# RUN: not %lldb -b -s %S/Inputs/DontStopCommandSource.in -o 'bogus' -o 'print 111100000 + 11111' | FileCheck %s --check-prefix STOP
+# RUN: not %lldb -b -s %S/Inputs/DontStopCommandSource.in -o 'bogus' -o 'expression 111100000 + 11111' | FileCheck %s --check-prefix STOP
# FIXME: Should continue
-# RUN: not %lldb -b -o 'settings set interpreter.stop-command-source-on-error false' -o 'bogus' -o 'print 123400000 + 56789' | FileCheck %s --check-prefix STOP
+# RUN: not %lldb -b -o 'settings set interpreter.stop-command-source-on-error false' -o 'bogus' -o 'expression 123400000 + 56789' | FileCheck %s --check-prefix STOP
# FIXME: Should continue
# RUN: not %lldb -b -s %S/Inputs/DontStopCommandSource.in | FileCheck %s --check-prefix STOP
# CHECK-NEXT: j = 42
# CHECK-NEXT: }
-print a->f()
-# CHECK-LABEL: print a->f()
+expression a->f()
+# CHECK-LABEL: expression a->f()
# CHECK: (int) $0 = 47
-print ns::A()
-# CHECK-LABEL: print ns::A()
+expression ns::A()
+# CHECK-LABEL: expression ns::A()
# CHECK: (ns::A) $1 = (i = 147)
-print ns::A().i + a->i
-# CHECK-LABEL: print ns::A().i + a->i
+expression ns::A().i + a->i
+# CHECK-LABEL: expression ns::A().i + a->i
# CHECK: (int) $2 = 194
-print ns::A().getA()
+expression ns::A().getA()
# CHECK-LABEL: ns::A().getA()
# CHECK: (A) $3 = (i = 146)
// RUN: %clang_host -c -gsplit-dwarf -g %s -o %t2.o -DTWO
// RUN: %clang_host -c -gsplit-dwarf -g %s -o %t3.o -DTHREE
// RUN: %clang_host %t1.o %t2.o %t3.o -o %t
-// RUN: %lldb %t -o "br set -n foo" -o run -o "p bool_in_first_cu" -o exit \
+// RUN: %lldb %t -o "br set -n foo" -o run -o "expression bool_in_first_cu" -o exit \
// RUN: | FileCheck %s
-// CHECK: (lldb) p bool_in_first_cu
+// CHECK: (lldb) expression bool_in_first_cu
// CHECK: (bool) $0 = true
# REQUIRES: target-x86_64, system-linux, lld
# RUN: %clang_host -o %t %s
-# RUN: %lldb %t -o r -o 'p p' -o exit | FileCheck %s
+# RUN: %lldb %t -o r -o 'expression p' -o exit | FileCheck %s
# CHECK: (int) $0 = 1
# This tests that lldb is able to print DW_TAG_variable using DW_AT_const_value.
# RUN: llvm-mc -triple x86_64-unknown-linux-gnu %s -filetype=obj > %t.o
-# RUN: %lldb %t.o -o "p/x magic64" -o exit | FileCheck %s
+# RUN: %lldb %t.o -o "expression/x magic64" -o exit | FileCheck %s
# CHECK: (const long) $0 = 0xed9a924c00011151
# CHECK-NEXT: e3
# CHECK-NEXT: }
-print (E) 1
-# CHECK-LABEL: print (E) 1
+expression (E) 1
+# CHECK-LABEL: expression (E) 1
# CHECK: (E) $0 = e2
-print (EC) 1
-# CHECK-LABEL: print (EC) 1
+expression (EC) 1
+# CHECK-LABEL: expression (EC) 1
# CHECK: (EC) $1 = e2
target variable a e ec
RUN: %lldb %t -b -o "type lookup EC" | FileCheck --check-prefix=LOOKUPEC %s
LOOKUPEC: no type was found matching 'EC'
-RUN: not %lldb %t -b -o "print (E) 1" 2>&1 | FileCheck --check-prefix=PRINTE %s
+RUN: not %lldb %t -b -o "expression (E) 1" 2>&1 | FileCheck --check-prefix=PRINTE %s
PRINTE: use of undeclared identifier 'E'
-RUN: not %lldb %t -b -o "print (EC) 1" 2>&1 | FileCheck --check-prefix=PRINTEC %s
+RUN: not %lldb %t -b -o "expression (EC) 1" 2>&1 | FileCheck --check-prefix=PRINTEC %s
PRINTEC: use of undeclared identifier 'EC'
RUN: %lldb %t -b -o "target variable a e ec" | FileCheck --check-prefix=VARS %s
# UNSUPPORTED: system-darwin, system-windows
# RUN: llvm-mc -filetype=obj -o %t -triple x86_64-pc-linux %s
-# RUN: %lldb %t -o "p main" \
+# RUN: %lldb %t -o "expression main" \
# RUN: -o exit | FileCheck %s
# CHECK: (void (*)()) $0 = 0x0000000000000000
# RUN: llvm-mc --triple=x86_64-pc-windows --filetype=obj --defsym EXE=0 %s >%t.exe.o
# RUN: lld-link /OUT:%t.dll %t.dll.o /SUBSYSTEM:console /dll /noentry /debug
# RUN: lld-link /OUT:%t.exe %t.exe.o /SUBSYSTEM:console /debug /force
-# RUN: %lldb %t.exe -o "target modules add %t.dll" -o "p var" \
+# RUN: %lldb %t.exe -o "target modules add %t.dll" -o "expression var" \
# RUN: -o exit 2>&1 | FileCheck %s
-# CHECK: (lldb) p var
+# CHECK: (lldb) expression var
# CHECK: (A) $0 = (member = 47)
.section .debug_abbrev,"dr"
br set -p BP_bar -f inline_sites_live.cpp\r
br set -p BP_foo -f inline_sites_live.cpp\r
run\r
-p param\r
+expression param\r
continue\r
-p param\r
-p local\r
+expression param\r
+expression local\r
break set -f local-variables.cpp -l 17
run a b c d e f g
-p argc
+expression argc
step
-p SomeLocal
+expression SomeLocal
step
-p Param1
-p Param2
+expression Param1
+expression Param2
step
-p Param1
-p Param2
-p Local1
+expression Param1
+expression Param2
+expression Local1
step
-p Param1
-p Param2
-p Local1
-p Local2
+expression Param1
+expression Param2
+expression Local1
+expression Local2
step
-p Param1
-p Param2
-p Local1
-p Local2
+expression Param1
+expression Param2
+expression Local1
+expression Local2
step
-p Param1
-p Param2
-p Local1
-p Local2
+expression Param1
+expression Param2
+expression Local1
+expression Local2
continue
target modules dump ast
// RUN: lld-link /debug:full /nodefaultlib /entry:main %t1.obj %t2.obj /out:%t.exe /pdb:%t.pdb
// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o \
// RUN: "settings set interpreter.stop-command-source-on-error false" \
-// RUN: -o "p b" -o "p d" -o "p static_e_ref" -o "exit" 2>&1 | FileCheck %s
+// RUN: -o "expression b" -o "expr d" -o "expr static_e_ref" -o "exit" 2>&1 | FileCheck %s
-// CHECK: (lldb) p b
+// CHECK: (lldb) expression b
// CHECK: (B) $0 = {}
-// CHECK: (lldb) p d
+// CHECK: (lldb) expression d
// CHECK: (D) $1 = {}
-// CHECK: (lldb) p static_e_ref
+// CHECK: (lldb) expression static_e_ref
// CHECK: error: expression failed to parse:
// CHECK: error: {{.*}}: incomplete type 'E' where a complete type is required
// CHECK: static_e_ref
\r
// CHECK: * thread #1, stop reason = breakpoint 1\r
// CHECK-NEXT: frame #0: {{.*}}`main [inlined] bar(param=2)\r
-// CHECK: (lldb) p param\r
+// CHECK: (lldb) expression param\r
// CHECK-NEXT: (int) $0 = 2\r
// CHECK: * thread #1, stop reason = breakpoint 2\r
// CHECK-NEXT: frame #0: {{.*}}`main [inlined] foo(param=1)\r
-// CHECK: (lldb) p param\r
+// CHECK: (lldb) expression param\r
// CHECK-NEXT: (int) $1 = 1\r
-// CHECK-NEXT: (lldb) p local\r
+// CHECK-NEXT: (lldb) expression local\r
// CHECK-NEXT: (int) $2 = 2\r
// CHECK-NEXT: 20
// CHECK: Process {{.*}} launched: '{{.*}}local-variables.cpp.tmp.exe'
-// CHECK-NEXT: (lldb) p argc
+// CHECK-NEXT: (lldb) expression argc
// CHECK-NEXT: (int) $0 = 8
// CHECK-NEXT: (lldb) step
// CHECK-NEXT: Process {{.*}} stopped
// CHECK-NEXT: 19 }
// CHECK-NEXT: 20
-// CHECK: (lldb) p SomeLocal
+// CHECK: (lldb) expression SomeLocal
// CHECK-NEXT: (int) $1 = 16
// CHECK-NEXT: (lldb) step
// CHECK-NEXT: Process {{.*}} stopped
// CHECK-NEXT: 11 ++Local1;
// CHECK-NEXT: 12 ++Local2;
-// CHECK: (lldb) p Param1
+// CHECK: (lldb) expression Param1
// CHECK-NEXT: (int) $2 = 16
-// CHECK-NEXT: (lldb) p Param2
+// CHECK-NEXT: (lldb) expression Param2
// CHECK-NEXT: (char) $3 = 'a'
// CHECK-NEXT: (lldb) step
// CHECK-NEXT: Process {{.*}} stopped
// CHECK-NEXT: 12 ++Local2;
// CHECK-NEXT: 13 return Local1;
-// CHECK: (lldb) p Param1
+// CHECK: (lldb) expression Param1
// CHECK-NEXT: (int) $4 = 16
-// CHECK-NEXT: (lldb) p Param2
+// CHECK-NEXT: (lldb) expression Param2
// CHECK-NEXT: (char) $5 = 'a'
-// CHECK-NEXT: (lldb) p Local1
+// CHECK-NEXT: (lldb) expression Local1
// CHECK-NEXT: (unsigned int) $6 = 17
// CHECK-NEXT: (lldb) step
// CHECK-NEXT: Process {{.*}} stopped
// CHECK-NEXT: 13 return Local1;
// CHECK-NEXT: 14 }
-// CHECK: (lldb) p Param1
+// CHECK: (lldb) expression Param1
// CHECK-NEXT: (int) $7 = 16
-// CHECK-NEXT: (lldb) p Param2
+// CHECK-NEXT: (lldb) expression Param2
// CHECK-NEXT: (char) $8 = 'a'
-// CHECK-NEXT: (lldb) p Local1
+// CHECK-NEXT: (lldb) expression Local1
// CHECK-NEXT: (unsigned int) $9 = 17
-// CHECK-NEXT: (lldb) p Local2
+// CHECK-NEXT: (lldb) expression Local2
// CHECK-NEXT: (char) $10 = 'b'
// CHECK-NEXT: (lldb) step
// CHECK-NEXT: Process {{.*}} stopped
// CHECK-NEXT: 14 }
// CHECK-NEXT: 15
-// CHECK: (lldb) p Param1
+// CHECK: (lldb) expression Param1
// CHECK-NEXT: (int) $11 = 16
-// CHECK-NEXT: (lldb) p Param2
+// CHECK-NEXT: (lldb) expression Param2
// CHECK-NEXT: (char) $12 = 'a'
-// CHECK-NEXT: (lldb) p Local1
+// CHECK-NEXT: (lldb) expression Local1
// CHECK-NEXT: (unsigned int) $13 = 18
-// CHECK-NEXT: (lldb) p Local2
+// CHECK-NEXT: (lldb) expression Local2
// CHECK-NEXT: (char) $14 = 'b'
// CHECK-NEXT: (lldb) step
// CHECK-NEXT: Process {{.*}} stopped
// CHECK-NEXT: 15
// CHECK-NEXT: 16 int main(int argc, char **argv) {
-// CHECK: (lldb) p Param1
+// CHECK: (lldb) expression Param1
// CHECK-NEXT: (int) $15 = 16
-// CHECK-NEXT: (lldb) p Param2
+// CHECK-NEXT: (lldb) expression Param2
// CHECK-NEXT: (char) $16 = 'a'
-// CHECK-NEXT: (lldb) p Local1
+// CHECK-NEXT: (lldb) expression Local1
// CHECK-NEXT: (unsigned int) $17 = 18
-// CHECK-NEXT: (lldb) p Local2
+// CHECK-NEXT: (lldb) expression Local2
// CHECK-NEXT: (char) $18 = 'c'
// CHECK-NEXT: (lldb) continue
// CHECK-NEXT: Process {{.*}} resuming
breakpoint set --file ExpressionsTest.cpp --line 19
run
-print result
-print N0::N1::sum(N0::N1::buf1, sizeof(N0::N1::buf1))
-print N1::sum(N1::buf1, sizeof(N1::buf1))
-print sum(buf1, sizeof(buf1))
-print sum(buf1, 1000000000)
+expression result
+expression N0::N1::sum(N0::N1::buf1, sizeof(N0::N1::buf1))
+expression N1::sum(N1::buf1, sizeof(N1::buf1))
+expression sum(buf1, sizeof(buf1))
+expression sum(buf1, 1000000000)
-print sum(buf0, 1)
+expression sum(buf0, 1)
-print sum(buf0, result - 28)
-print sum(buf1 + 3, 3)
+expression sum(buf0, result - 28)
+expression sum(buf1 + 3, 3)
run
-print c
+expression c
-frame variable c
\ No newline at end of file
+frame variable c
RUN: %build --compiler=msvc --nodefaultlib --output=%t.exe %S/Inputs/ExpressionsTest.cpp
RUN: not %lldb -b -s %S/Inputs/ExpressionsTest0.script -s %S/Inputs/ExpressionsTest1.script -s %S/Inputs/ExpressionsTest2.script -- %t.exe 2>&1 | FileCheck %s
-// Check the variable value through `print`
-CHECK: (lldb) print result
+// Check the variable value through `expression`
+CHECK: (lldb) expression result
CHECK: (char) $0 = '\x1c'
// Call the function just like in the code
-CHECK: (lldb) print N0::N1::sum(N0::N1::buf1, sizeof(N0::N1::buf1))
+CHECK: (lldb) expression N0::N1::sum(N0::N1::buf1, sizeof(N0::N1::buf1))
CHECK: (char) $1 = '\x1c'
// Try the relaxed namespaces search
-CHECK: (lldb) print N1::sum(N1::buf1, sizeof(N1::buf1))
+CHECK: (lldb) expression N1::sum(N1::buf1, sizeof(N1::buf1))
CHECK: (char) $2 = '\x1c'
// Try the relaxed variables and functions search
-CHECK: (lldb) print sum(buf1, sizeof(buf1))
+CHECK: (lldb) expression sum(buf1, sizeof(buf1))
CHECK: (char) $3 = '\x1c'
// Make a crash during expression calculation
-CHECK: (lldb) print sum(buf1, 1000000000)
+CHECK: (lldb) expression sum(buf1, 1000000000)
CHECK: The process has been returned to the state before expression evaluation.
// Make one more crash
-CHECK: (lldb) print sum(buf0, 1)
+CHECK: (lldb) expression sum(buf0, 1)
CHECK: The process has been returned to the state before expression evaluation.
// Check if the process state was restored succesfully
-CHECK: (lldb) print sum(buf0, result - 28)
+CHECK: (lldb) expression sum(buf0, result - 28)
CHECK: (char) $4 = '\0'
// Call the function with arbitrary parameters
-CHECK: (lldb) print sum(buf1 + 3, 3)
+CHECK: (lldb) expression sum(buf1 + 3, 3)
CHECK: (char) $5 = '\f'