blob: 544e6ff12535c613e758edc874037da0e3b7fae9 [file] [log] [blame]
Adrian Prantlf88c5542013-09-06 18:10:421 -*- rst -*-
Devang Patel59c97b52010-09-13 22:47:462This is a collection of tests to check debugging information generated by
3compiler. This test suite can be checked out inside clang/test folder. This
Jeremy Morse984fad22019-10-31 16:51:534will enable 'make test' for clang to pick up these tests.
5
6Some tests (in the 'llgdb-tests' directory) are written with debugger
7commands and checks for the intended debugger output in the source file,
8using DEBUGGER: and CHECK: as prefixes respectively.
Devang Patel59c97b52010-09-13 22:47:469
Adrian Prantlf88c5542013-09-06 18:10:4210For example::
Devang Patel59c97b52010-09-13 22:47:4611
Adrian Prantlf88c5542013-09-06 18:10:4212 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 }
Devang Patel59c97b52010-09-13 22:47:4619
Adrian Prantlf88c5542013-09-06 18:10:4220is a testcase where the debugger is asked to break at function 'f1' and
Devang Patel59c97b52010-09-13 22:47:4621print value of argument 'i'. The expected value of 'i' is 42 in this case.
Jeremy Morse984fad22019-10-31 16:51:5322
23Other tests are written for use with the 'Dexter' tool (in the 'dexter-tests'
24and 'dexter' directories respectively). These use a domain specific language
25in comments to describe the intended debugger experience in a more abstract
26way than debugger commands. This allows for testing integration across
27multiple debuggers from one input language.
28
29For 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
42Labels two lines with the names 'before_bar' and 'after_bar', and records that
43the 'test' variable is expected to have the value 23 on both of them.