File: subprogram_ranges.test

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (38 lines) | stat: -rw-r--r-- 1,604 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# REQUIRES: lld
# RUN: %clang -target x86_64-pc-linux -g -O0 %S/Inputs/subprogram_ranges.s -o %t.o -c
# RUN: ld.lld %t.o -o %t
# RUN: %lldb -b -s %s %t 2>&1 | FileCheck %s

# Test breaking on symbols and printing variables when a DW_TAG_subprogram uses
# DW_AT_ranges instead of DW_AT_low_pc/DW_AT_high_pc.  While the assembly here
# is a bit unrealistic - it's a single-entry range using DWARFv4 which isn't
# useful for anything (a single-entry range with DWARFv5 can reduce address
# relocations, and multi-entry ranges can be used for function sections), but
# it's the simplest thing to test. If anyone's updating this test at some
# point, feel free to replace it with another equivalent test if it's
# especially useful, but don't dismiss it as pointless just because it's a bit
# weird.

# * Using volatile writes to create instructions the location may be valid over
# * Using two values for the variable so it is described by a location list,
#   not a single location description
# * Not using function calls, so that the function has no frame pointer
#   initialization/no prologue instructions, so the location of "var" is valid
#   at the start of the function, so 'image lookup -v -s main' will include it.
#
# Source:
# __attribute__((nodebug)) volatile int i;
# int main() {
#   int var = 3;
#   i = 1;
#   var = 5;
#   i = 2;
# }

b main
# CHECK: (lldb) b main
# CHECK-NEXT: Breakpoint 1: where = {{.*}}`main at subprogram_ranges.c:4:5

image lookup -v -s main
# CHECK: 1 symbols match 'main'
# CHECK:  Variable: {{.*}}, name = "var", type = "int", {{.*}}, decl = subprogram_ranges.c:3