39 lines · plain
1# REQUIRES: lld2# RUN: %clang -target x86_64-pc-linux -g -O0 %S/Inputs/subprogram_ranges.s -o %t.o -c3# RUN: ld.lld %t.o -o %t4# RUN: %lldb -b -s %s %t 2>&1 | FileCheck %s5 6# Test breaking on symbols and printing variables when a DW_TAG_subprogram uses7# DW_AT_ranges instead of DW_AT_low_pc/DW_AT_high_pc. While the assembly here8# is a bit unrealistic - it's a single-entry range using DWARFv4 which isn't9# useful for anything (a single-entry range with DWARFv5 can reduce address10# relocations, and multi-entry ranges can be used for function sections), but11# it's the simplest thing to test. If anyone's updating this test at some12# point, feel free to replace it with another equivalent test if it's13# especially useful, but don't dismiss it as pointless just because it's a bit14# weird.15 16# * Using volatile writes to create instructions the location may be valid over17# * Using two values for the variable so it is described by a location list,18# not a single location description19# * Not using function calls, so that the function has no frame pointer20# initialization/no prologue instructions, so the location of "var" is valid21# at the start of the function, so 'image lookup -v -s main' will include it.22#23# Source:24# __attribute__((nodebug)) volatile int i;25# int main() {26# int var = 3;27# i = 1;28# var = 5;29# i = 2;30# }31 32b main33# CHECK: (lldb) b main34# CHECK-NEXT: Breakpoint 1: where = {{.*}}`main at subprogram_ranges.c:4:535 36image lookup -v -s main37# CHECK: 1 symbols match 'main'38# CHECK: Variable: {{.*}}, name = "var", type = "int", {{.*}}, decl = subprogram_ranges.c:339