1 | // clang-format off |
2 | // REQUIRES: lld, x86 |
3 | |
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 -- %s |
6 | // RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb |
7 | // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ |
8 | // RUN: %p/Inputs/break-by-function.lldbinit | FileCheck %s |
9 | |
10 | // Use different indentation style for each overload so that the starting |
11 | // line is in a different place. |
12 | |
13 | int OvlGlobalFn(int X) { |
14 | return X + 42; |
15 | } |
16 | |
17 | int OvlGlobalFn(int X, int Y) { return X + Y + 42; } |
18 | |
19 | int OvlGlobalFn(int X, int Y, int Z) |
20 | { |
21 | return X + Y + Z + 42; |
22 | } |
23 | |
24 | static int StaticFn(int X) { |
25 | return X + 42; |
26 | } |
27 | |
28 | int 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 reported |
31 | // for the breakpoint is the first actual line of code. |
32 | int Result = OvlGlobalFn(X: argc) + OvlGlobalFn(X: argc, Y: argc) |
33 | + OvlGlobalFn(X: argc, Y: argc, Z: argc) + StaticFn(X: 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 main |
41 | // CHECK: Breakpoint 1: where = break-by-function.cpp.tmp.exe`main + {{[0-9]+}} |
42 | // CHECK: (lldb) break set -n OvlGlobalFn |
43 | // CHECK: Breakpoint 2: 3 locations. |
44 | // CHECK: (lldb) break set -n StaticFn |
45 | // CHECK: Breakpoint 3: where = break-by-function.cpp.tmp.exe`StaticFn + {{[0-9]+}} |
46 | // CHECK: (lldb) break set -n DoesntExist |
47 | // CHECK: Breakpoint 4: no locations (pending). |
48 | // CHECK: (lldb) break list |
49 | // CHECK: Current breakpoints: |
50 | // CHECK: 1: name = 'main', locations = 1 |
51 | // CHECK: 1.1: where = break-by-function.cpp.tmp.exe`main + {{[0-9]+}} |
52 | // CHECK: 2: name = 'OvlGlobalFn', locations = 3 |
53 | // CHECK: 2.1: where = break-by-function.cpp.tmp.exe`OvlGlobalFn + {{[0-9]+}} |
54 | // CHECK: 2.2: where = break-by-function.cpp.tmp.exe`OvlGlobalFn |
55 | // CHECK: 2.3: where = break-by-function.cpp.tmp.exe`OvlGlobalFn + {{[0-9]+}} |
56 | // CHECK: 3: name = 'StaticFn', locations = 1 |
57 | // CHECK: 3.1: where = break-by-function.cpp.tmp.exe`StaticFn + {{[0-9]+}} |
58 | // CHECK: 4: name = 'DoesntExist', locations = 0 (pending) |
59 | |