150
|
1 -*- rst -*-
|
|
2 This is a collection of tests to check debugging information generated by
|
|
3 compiler. This test suite can be checked out inside clang/test folder. This
|
|
4 will enable 'make test' for clang to pick up these tests.
|
|
5
|
|
6 Some tests (in the 'llgdb-tests' directory) are written with debugger
|
|
7 commands and checks for the intended debugger output in the source file,
|
|
8 using DEBUGGER: and CHECK: as prefixes respectively.
|
|
9
|
|
10 For example::
|
|
11
|
|
12 define i32 @f1(i32 %i) nounwind ssp {
|
|
13 ; DEBUGGER: break f1
|
|
14 ; DEBUGGER: r
|
|
15 ; DEBUGGER: p i
|
|
16 ; CHECK: $1 = 42
|
|
17 entry:
|
|
18 }
|
|
19
|
|
20 is a testcase where the debugger is asked to break at function 'f1' and
|
|
21 print value of argument 'i'. The expected value of 'i' is 42 in this case.
|
|
22
|
|
23 Other tests are written for use with the 'Dexter' tool (in the 'dexter-tests'
|
|
24 and 'dexter' directories respectively). These use a domain specific language
|
|
25 in comments to describe the intended debugger experience in a more abstract
|
|
26 way than debugger commands. This allows for testing integration across
|
|
27 multiple debuggers from one input language.
|
|
28
|
|
29 For example::
|
|
30
|
|
31 void __attribute__((noinline, optnone)) bar(int *test) {}
|
|
32 int main() {
|
|
33 int test;
|
|
34 test = 23;
|
|
35 bar(&test); // DexLabel('before_bar')
|
|
36 return test; // DexLabel('after_bar')
|
|
37 }
|
|
38
|
|
39 // DexExpectWatchValue('test', '23', on_line='before_bar')
|
|
40 // DexExpectWatchValue('test', '23', on_line='after_bar')
|
|
41
|
|
42 Labels two lines with the names 'before_bar' and 'after_bar', and records that
|
|
43 the 'test' variable is expected to have the value 23 on both of them.
|