blob: c0c26f7617c98249b6462b709fb6dc0491b92373 [file] [log] [blame]
Zachary Turnerb3130b42019-01-02 18:32:50 +00001// clang-format off
2// REQUIRES: lld
3
4// Test that we can set simple breakpoints using PDB on any platform.
5// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s
6// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
7// RUN: %p/Inputs/break-by-function.lldbinit | FileCheck %s
8
9// Use different indentation style for each overload so that the starting
10// line is in a different place.
11
12int OvlGlobalFn(int X) {
13 return X + 42;
14}
15
16int OvlGlobalFn(int X, int Y) { return X + Y + 42; }
17
18int OvlGlobalFn(int X, int Y, int Z)
19{
20 return X + Y + Z + 42;
21}
22
23static int StaticFn(int X) {
24 return X + 42;
25}
26
27int main(int argc, char **argv) {
28 // Make sure they don't get optimized out.
29 // Note the comments here, we want to make sure the line number reported
30 // for the breakpoint is the first actual line of code.
31 int Result = OvlGlobalFn(argc) + OvlGlobalFn(argc, argc)
32 + OvlGlobalFn(argc, argc, argc) + StaticFn(argc);
33 return Result;
34}
35
36
37// CHECK: (lldb) target create "{{.*}}break-by-function.cpp.tmp.exe"
38// CHECK: Current executable set to '{{.*}}break-by-function.cpp.tmp.exe'
39// CHECK: (lldb) break set -n main
40// CHECK: Breakpoint 1: where = break-by-function.cpp.tmp.exe`main + {{[0-9]+}}
41// CHECK: (lldb) break set -n OvlGlobalFn
42// CHECK: Breakpoint 2: 3 locations.
43// CHECK: (lldb) break set -n StaticFn
44// CHECK: Breakpoint 3: where = break-by-function.cpp.tmp.exe`StaticFn + {{[0-9]+}}
45// CHECK: (lldb) break set -n DoesntExist
46// CHECK: Breakpoint 4: no locations (pending).
47// CHECK: (lldb) break list
48// CHECK: Current breakpoints:
49// CHECK: 1: name = 'main', locations = 1
50// CHECK: 1.1: where = break-by-function.cpp.tmp.exe`main + {{[0-9]+}}
51// CHECK: 2: name = 'OvlGlobalFn', locations = 3
52// CHECK: 2.1: where = break-by-function.cpp.tmp.exe`OvlGlobalFn + {{[0-9]+}}
53// CHECK: 2.2: where = break-by-function.cpp.tmp.exe`OvlGlobalFn
54// CHECK: 2.3: where = break-by-function.cpp.tmp.exe`OvlGlobalFn + {{[0-9]+}}
55// CHECK: 3: name = 'StaticFn', locations = 1
56// CHECK: 3.1: where = break-by-function.cpp.tmp.exe`StaticFn + {{[0-9]+}}
57// CHECK: 4: name = 'DoesntExist', locations = 0 (pending)