author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 07 Feb 2019 15:18:41 +0000 | |
changeset 175 | a04e1a36e888 |
parent 120 | 73877848ea7f |
permissions | -rw-r--r-- |
120
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
1 |
/* |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
2 |
* CFLAGS=-ggdb3 -O2 -W -Wall -Wno-unused-parameter -I. |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
3 |
*/ |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
4 |
#include <stdio.h> |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
5 |
#include <stdlib.h> |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
6 |
|
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
7 |
static inline int |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
8 |
add(int a, int b) { |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
9 |
return a + b; |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
10 |
} |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
11 |
|
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
12 |
int my_rand_1(void) { |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
13 |
return add(rand(), rand()); |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
14 |
} |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
15 |
|
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
16 |
int my_rand_2(void) { |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
17 |
int r = my_rand_1(); |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
18 |
return add(r, r); |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
19 |
} |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
20 |
|
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
21 |
int main (int argc, char **argv) |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
22 |
{ |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
23 |
int i = my_rand_1(); |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
24 |
printf("%d\n", i); |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
25 |
return 1; /* next-line */ |
73877848ea7f
Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
26 |
} |