diff options
Diffstat (limited to 'lldb/test/Shell')
10 files changed, 302 insertions, 1 deletions
diff --git a/lldb/test/Shell/Commands/Inputs/dis_filt.py b/lldb/test/Shell/Commands/Inputs/dis_filt.py new file mode 100755 index 000000000000..bac5a36be2f3 --- /dev/null +++ b/lldb/test/Shell/Commands/Inputs/dis_filt.py @@ -0,0 +1,8 @@ +#! /usr/bin/env python3 + +import sys + +for line in sys.stdin: + if "0940003f 00200020" in line and "<unknown>" in line: + line = line.replace("<unknown>", "Fake64") + print(line, end="") diff --git a/lldb/test/Shell/Commands/command-disassemble-riscv32-bytes.s b/lldb/test/Shell/Commands/command-disassemble-riscv32-bytes.s new file mode 100644 index 000000000000..78be614e3af1 --- /dev/null +++ b/lldb/test/Shell/Commands/command-disassemble-riscv32-bytes.s @@ -0,0 +1,37 @@ +# REQUIRES: riscv +# REQUIRES: python + +# This test verifies that disassemble -b prints out the correct bytes and +# format for standard and unknown riscv instructions of various sizes, +# and that unknown instructions show opcodes and disassemble as "<unknown>". +# It also tests that the fdis command from examples/python/filter_disasm.py +# pipes the disassembly output through a simple filter program correctly. + + +# RUN: llvm-mc -filetype=obj -mattr=+c --triple=riscv32-unknown-unknown %s -o %t +# RUN: %lldb -b %t "-o" "disassemble -b -n main" | FileCheck %s +# RUN: %lldb -b %t -o "command script import %S/../../../examples/python/filter_disasm.py" -o "fdis set %python %S/Inputs/dis_filt.py" -o "fdis -n main" | FileCheck --check-prefix=FILTER %s + +main: + addi sp, sp, -0x20 # 16 bit standard instruction + sw a0, -0xc(s0) # 32 bit standard instruction + .insn 8, 0x2000200940003F; # 64 bit custom instruction + .insn 6, 0x021F | 0x00001000 << 32 # 48 bit xqci.e.li rd=8 imm=0x1000 + .insn 4, 0x84F940B # 32 bit xqci.insbi + .insn 2, 0xB8F2 # 16 bit cm.push + +# CHECK: [0x0] <+0>: 1101 addi sp, sp, -0x20 +# CHECK-NEXT: [0x2] <+2>: fea42a23 sw a0, -0xc(s0) +# CHECK-NEXT: [0x6] <+6>: 0940003f 00200020 <unknown> +# CHECK-NEXT: [0xe] <+14>: 021f 0000 1000 <unknown> +# CHECK-NEXT: [0x14] <+20>: 084f940b <unknown> +# CHECK-NEXT: [0x18] <+24>: b8f2 <unknown> + +# FILTER: Disassembly filter command (fdis) loaded +# FILTER: [0x0] <+0>: 1101 addi sp, sp, -0x20 +# FILTER-NEXT: [0x2] <+2>: fea42a23 sw a0, -0xc(s0) +# FILTER-NEXT: [0x6] <+6>: 0940003f 00200020 Fake64 +# FILTER-NEXT: [0xe] <+14>: 021f 0000 1000 <unknown> +# FILTER-NEXT: [0x14] <+20>: 084f940b <unknown> +# FILTER-NEXT: [0x18] <+24>: b8f2 <unknown> + diff --git a/lldb/test/Shell/Commands/command-disassemble-x86-bytes.s b/lldb/test/Shell/Commands/command-disassemble-x86-bytes.s new file mode 100644 index 000000000000..fae08d09a083 --- /dev/null +++ b/lldb/test/Shell/Commands/command-disassemble-x86-bytes.s @@ -0,0 +1,28 @@ +# REQUIRES: x86 + +# This test verifies that disassemble -b prints out the correct bytes and +# format for x86_64 instructions of various sizes, and that an unknown +# instruction shows the opcode and disassembles as "<unknown>" + +# RUN: llvm-mc -filetype=obj --triple=x86_64-unknown-unknown %s -o %t +# RUN: %lldb -b %t -o "disassemble -b -n main" | FileCheck %s + +main: # @main + subq $0x18, %rsp + movl $0x0, 0x14(%rsp) + movq %rdx, 0x8(%rsp) + movl %ecx, 0x4(%rsp) + movl (%rsp), %eax + addq $0x18, %rsp + retq + .byte 0x6 + +# CHECK: [0x0] <+0>: 48 83 ec 18 subq $0x18, %rsp +# CHECK-NEXT: [0x4] <+4>: c7 44 24 14 00 00 00 00 movl $0x0, 0x14(%rsp) +# CHECK-NEXT: [0xc] <+12>: 48 89 54 24 08 movq %rdx, 0x8(%rsp) +# CHECK-NEXT: [0x11] <+17>: 89 4c 24 04 movl %ecx, 0x4(%rsp) +# CHECK-NEXT: [0x15] <+21>: 8b 04 24 movl (%rsp), %eax +# CHECK-NEXT: [0x18] <+24>: 48 83 c4 18 addq $0x18, %rsp +# CHECK-NEXT: [0x1c] <+28>: c3 retq +# CHECK-NEXT: [0x1d] <+29>: 06 <unknown> + diff --git a/lldb/test/Shell/Minidump/missing-memory-region.yaml b/lldb/test/Shell/Minidump/missing-memory-region.yaml new file mode 100644 index 000000000000..1784cacfaf1b --- /dev/null +++ b/lldb/test/Shell/Minidump/missing-memory-region.yaml @@ -0,0 +1,42 @@ +# Check that looking up a memory region not present in the Minidump fails +# even if it's in the /proc/<pid>/maps file. + +# RUN: yaml2obj %s -o %t +# RUN: %lldb -c %t -o "memory read 0x5000" 2>&1 | FileCheck %s + +# CHECK-LABEL: (lldb) memory read 0x5000 +# CHECK-NEXT: error: No memory range found for address (0x5000) + +--- !minidump +Streams: + - Type: SystemInfo + Processor Arch: AMD64 + Processor Level: 6 + Processor Revision: 15876 + Number of Processors: 40 + Platform ID: Linux + CSD Version: 'Linux 3.13.0-91-generic #138-Ubuntu SMP Fri Jun 24 17:00:34 UTC 2016 x86_64' + CPU: + Vendor ID: GenuineIntel + Version Info: 0x00000000 + Feature Info: 0x00000000 + - Type: LinuxProcStatus + Text: | + Name: test-yaml + Umask: 0002 + State: t (tracing stop) + Pid: 8567 + - Type: LinuxMaps + Text: | + 0x1000-0x1100 r-xp 00000000 00:00 0 + 0x2000-0x2200 rw-p 00000000 00:00 0 + 0x4000-0x6000 rw-- 00000000 00:00 0 + - Type: Memory64List + Memory Ranges: + - Start of Memory Range: 0x1000 + Data Size: 0x100 + Content : '' + - Start of Memory Range: 0x2000 + Data Size: 0x200 + Content : '' +... diff --git a/lldb/test/Shell/Settings/TestChildCountTruncation.test b/lldb/test/Shell/Settings/TestChildCountTruncation.test new file mode 100644 index 000000000000..da6436cb5ca2 --- /dev/null +++ b/lldb/test/Shell/Settings/TestChildCountTruncation.test @@ -0,0 +1,68 @@ +# Test that we warn the user about truncated output +# when target.max-children-count wasn't explicitly set. + +# RUN: split-file %s %t +# RUN: %clang_host -g %t/main.cpp -o %t.out +# RUN: %lldb -x -b -s %t/dwim-commands.input %t.out -o exit 2>&1 \ +# RUN: | FileCheck %s --check-prefix=DWIM +# +# RUN: %lldb -x -b -s %t/expr-commands.input %t.out -o exit 2>&1 \ +# RUN: | FileCheck %s --check-prefix=EXPR +# +# RUN: %lldb -x -b -s %t/frame-var-commands.input %t.out -o exit 2>&1 \ +# RUN: | FileCheck %s --check-prefix=VAR +# +# RUN: %lldb -x -b -s %t/with-setting-commands.input %t.out -o exit 2>&1 \ +# RUN: | FileCheck %s --check-prefix=SETTING + +#--- main.cpp + +int main() { + int arr[512] = { 3 }; + __builtin_debugtrap(); +} + +#--- dwim-commands.input + +run +dwim-print arr +frame variable arr + +DWIM: (lldb) dwim-print arr +DWIM: *** Some of the displayed variables have more members +DWIM-SAME: use the --show-all-children option to dwim-print +DWIM: (lldb) frame variable arr +DWIM-NOT: *** Some of the displayed variables have more members + +#--- expr-commands.input + +run +expression arr +frame variable arr + +EXPR: (lldb) expression arr +EXPR: *** Some of the displayed variables have more members +EXPR-SAME: use the --show-all-children option to expression +EXPR: (lldb) frame variable arr +EXPR-NOT: *** Some of the displayed variables have more members + +#--- frame-var-commands.input + +run +frame variable arr +dwim-print arr + +VAR: (lldb) frame variable arr +VAR: *** Some of the displayed variables have more members +VAR-SAME: use the --show-all-children option to frame variable +VAR: (lldb) dwim-print arr +VAR-NOT: *** Some of the displayed variables have more members + +#--- with-setting-commands.input + +run +settings set target.max-children-count 1 +frame variable arr + +SETTING: (lldb) frame variable arr +SETTING-NOT: *** Some of the displayed variables have more members diff --git a/lldb/test/Shell/Settings/TestChildDepthTruncation.test b/lldb/test/Shell/Settings/TestChildDepthTruncation.test new file mode 100644 index 000000000000..12f5661600ae --- /dev/null +++ b/lldb/test/Shell/Settings/TestChildDepthTruncation.test @@ -0,0 +1,84 @@ +# Test that we warn the user about truncated output +# when target.max-children-depth wasn't explicitly set. + +# RUN: split-file %s %t +# RUN: %clang_host -g %t/main.cpp -o %t.out +# RUN: %lldb -x -b -s %t/dwim-commands.input %t.out -o exit 2>&1 \ +# RUN: | FileCheck %s --check-prefix=DWIM +# +# RUN: %lldb -x -b -s %t/expr-commands.input %t.out -o exit 2>&1 \ +# RUN: | FileCheck %s --check-prefix=EXPR +# +# RUN: %lldb -x -b -s %t/frame-var-commands.input %t.out -o exit 2>&1 \ +# RUN: | FileCheck %s --check-prefix=VAR +# +# RUN: %lldb -x -b -s %t/with-setting-commands.input %t.out -o exit 2>&1 \ +# RUN: | FileCheck %s --check-prefix=SETTING + +#--- main.cpp + +struct L1 { + int w; + struct L2 { + int x; + struct L3 { + int y; + struct L4 { + int z; + struct L5 { + int a; + } l5; + } l4; + } l3; + } l2; +}; + +int main() { + L1 nested; + __builtin_debugtrap(); +} + +#--- dwim-commands.input + +run +dwim-print nested +frame variable nested + +DWIM: (lldb) dwim-print nested +DWIM: *** Some of the displayed variables have a greater depth of members +DWIM-SAME: use the --depth option to dwim-print +DWIM: (lldb) frame variable nested +DWIM-NOT: *** Some of the displayed variables have a greater depth of members + +#--- expr-commands.input + +run +expression nested +frame variable nested + +EXPR: (lldb) expression nested +EXPR: *** Some of the displayed variables have a greater depth of members +EXPR-SAME: use the --depth option to expression +EXPR: (lldb) frame variable nested +EXPR-NOT: *** Some of the displayed variables have a greater depth of members + +#--- frame-var-commands.input + +run +frame variable nested +frame variable nested + +VAR: (lldb) frame variable nested +VAR: *** Some of the displayed variables have a greater depth of members +VAR-SAME: use the --depth option to frame variable +VAR: (lldb) frame variable nested +VAR-NOT: *** Some of the displayed variables have a greater depth of members + +#--- with-setting-commands.input + +run +settings set target.max-children-depth 1 +frame variable nested + +SETTING: (lldb) frame variable nested +SETTING-NOT: *** Some of the displayed variables have a greater depth of members diff --git a/lldb/test/Shell/Settings/TestCxxFrameFormatEmpty.test b/lldb/test/Shell/Settings/TestCxxFrameFormatEmpty.test new file mode 100644 index 000000000000..0a6d2723ded3 --- /dev/null +++ b/lldb/test/Shell/Settings/TestCxxFrameFormatEmpty.test @@ -0,0 +1,32 @@ +# XFAIL: target-windows + +# Test that setting plugin.cplusplus.display.function-name-format +# to an empty string disables the "format by language" part of +# ${function.name-with-args}. + +# RUN: split-file %s %t +# RUN: %clang_host -g -gdwarf %t/main.cpp -o %t.out +# RUN: %lldb -x -b -s %t/commands.input %t.out -o exit 2>&1 \ +# RUN: | FileCheck %s + +#--- main.cpp +namespace ns::ns2 { +void custom(int x) {} +void bar() { custom(5); } +} + +int main(int argc, char const *argv[]) { + ns::ns2::bar(); + return 0; +} + +#--- commands.input +settings set plugin.cplusplus.display.function-name-format "" +settings set -f frame-format "custom-frame '${function.name-with-args}'\n" +break set -l 2 -f main.cpp + +run +bt + +# CHECK: custom-frame 'ns::ns2::custom(x=5)' +# CHECK: custom-frame 'ns::ns2::bar()' diff --git a/lldb/test/Shell/SymbolFile/DWARF/TestDedupWarnings.test b/lldb/test/Shell/SymbolFile/DWARF/TestDedupWarnings.test index d4fcf78d01b8..c29b51219d19 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/TestDedupWarnings.test +++ b/lldb/test/Shell/SymbolFile/DWARF/TestDedupWarnings.test @@ -15,7 +15,7 @@ # RUN: %clang_host -fmodules -Xclang -fmodules-cache-path=%t/cache -I%t -g -gmodules %t/b.m -o %t/b.o -c # RUN: %clang_host %t/a.o %t/b.o -o %t/a.out # RUN: rm -rf %t/cache -# RUN: %lldb %t/a.out -o "b main" -o run -o "p a" -o "p b" -o q 2>&1 | FileCheck %s +# RUN: %lldb %t/a.out -o "b main" -o run -o "expr a" -o "expr b" -o q 2>&1 | FileCheck %s # CHECK: {{[ab]}}.o{{.*}}/cache/{{.*}}/C-{{.*}}.pcm' does not exist # CHECK-NOT: /cache/{{.*}}/C-{.*}.pcm' does not exist # CHECK: {{[ab]}}.o{{.*}}/cache/{{.*}}/C-{{.*}}.pcm' does not exist diff --git a/lldb/test/Shell/SymbolFile/NativePDB/Inputs/class_layout.lldbinit b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/class_layout.lldbinit index bbce1e88626e..301488d5810b 100644 --- a/lldb/test/Shell/SymbolFile/NativePDB/Inputs/class_layout.lldbinit +++ b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/class_layout.lldbinit @@ -1,3 +1,4 @@ +settings set target.max-children-depth 10 expr a expr b.c expr b.u.c diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.script b/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.script index 91de55f4ade4..43018eacf709 100644 --- a/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.script +++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.script @@ -1,3 +1,4 @@ +settings set target.max-children-depth 10 breakpoint set --file UdtLayoutTest.cpp --line 60 run target variable |
