59 lines · cpp
1// clang-format off2// REQUIRES: lld, x863 4// Test that we can set simple breakpoints using PDB on any platform.5// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s6// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb7// RUN: %lldb -f %t.exe -s \8// RUN: %p/Inputs/break-by-function.lldbinit | FileCheck %s9 10// Use different indentation style for each overload so that the starting11// line is in a different place.12 13int OvlGlobalFn(int X) {14 return X + 42;15}16 17int OvlGlobalFn(int X, int Y) { return X + Y + 42; }18 19int OvlGlobalFn(int X, int Y, int Z)20{21 return X + Y + Z + 42;22}23 24static int StaticFn(int X) {25 return X + 42;26}27 28int main(int argc, char **argv) {29 // Make sure they don't get optimized out.30 // Note the comments here, we want to make sure the line number reported31 // for the breakpoint is the first actual line of code.32 int Result = OvlGlobalFn(argc) + OvlGlobalFn(argc, argc)33 + OvlGlobalFn(argc, argc, argc) + StaticFn(argc);34 return Result;35}36 37 38// CHECK: (lldb) target create "{{.*}}break-by-function.cpp.tmp.exe"39// CHECK: Current executable set to '{{.*}}break-by-function.cpp.tmp.exe'40// CHECK: (lldb) break set -n main41// CHECK: Breakpoint 1: where = break-by-function.cpp.tmp.exe`main + {{[0-9]+}}42// CHECK: (lldb) break set -n OvlGlobalFn43// CHECK: Breakpoint 2: 3 locations.44// CHECK: (lldb) break set -n StaticFn45// CHECK: Breakpoint 3: where = break-by-function.cpp.tmp.exe`StaticFn + {{[0-9]+}}46// CHECK: (lldb) break set -n DoesntExist47// CHECK: Breakpoint 4: no locations (pending).48// CHECK: (lldb) break list49// CHECK: Current breakpoints:50// CHECK: 1: name = 'main', locations = 151// CHECK: 1.1: where = break-by-function.cpp.tmp.exe`main + {{[0-9]+}}52// CHECK: 2: name = 'OvlGlobalFn', locations = 353// CHECK: 2.1: where = break-by-function.cpp.tmp.exe`int OvlGlobalFn(int) + {{[0-9]+}}54// CHECK: 2.2: where = break-by-function.cpp.tmp.exe`int OvlGlobalFn(int, int)55// CHECK: 2.3: where = break-by-function.cpp.tmp.exe`int OvlGlobalFn(int, int, int) + {{[0-9]+}}56// CHECK: 3: name = 'StaticFn', locations = 157// CHECK: 3.1: where = break-by-function.cpp.tmp.exe`StaticFn + {{[0-9]+}}58// CHECK: 4: name = 'DoesntExist', locations = 0 (pending)59