Adrian Prantl | f88c554 | 2013-09-06 18:10:42 | [diff] [blame] | 1 | -*- rst -*- |
Devang Patel | 59c97b5 | 2010-09-13 22:47:46 | [diff] [blame] | 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 |
Jeremy Morse | 984fad2 | 2019-10-31 16:51:53 | [diff] [blame] | 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. |
Devang Patel | 59c97b5 | 2010-09-13 22:47:46 | [diff] [blame] | 9 | |
Adrian Prantl | f88c554 | 2013-09-06 18:10:42 | [diff] [blame] | 10 | For example:: |
Devang Patel | 59c97b5 | 2010-09-13 22:47:46 | [diff] [blame] | 11 | |
Adrian Prantl | f88c554 | 2013-09-06 18:10:42 | [diff] [blame] | 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 | } |
Devang Patel | 59c97b5 | 2010-09-13 22:47:46 | [diff] [blame] | 19 | |
Adrian Prantl | f88c554 | 2013-09-06 18:10:42 | [diff] [blame] | 20 | is a testcase where the debugger is asked to break at function 'f1' and |
Devang Patel | 59c97b5 | 2010-09-13 22:47:46 | [diff] [blame] | 21 | print value of argument 'i'. The expected value of 'i' is 42 in this case. |
Jeremy Morse | 984fad2 | 2019-10-31 16:51:53 | [diff] [blame] | 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. |