| 1 |
#include "sys/sdt.h" |
| 2 |
|
| 3 |
extern "C" { |
| 4 |
#include <string.h> |
| 5 |
#include <stdlib.h> |
| 6 |
} |
| 7 |
|
| 8 |
class sClass |
| 9 |
{ |
| 10 |
private: |
| 11 |
const char *_str; |
| 12 |
size_t _l; |
| 13 |
|
| 14 |
public: |
| 15 |
sClass(const char *n) : _str(n) |
| 16 |
{ |
| 17 |
_l = strlen(_str); |
| 18 |
} |
| 19 |
|
| 20 |
const char *name(void) |
| 21 |
{ |
| 22 |
return _str; |
| 23 |
} |
| 24 |
|
| 25 |
size_t len(void) const |
| 26 |
{ |
| 27 |
return _l; |
| 28 |
} |
| 29 |
}; |
| 30 |
|
| 31 |
size_t |
| 32 |
length(const sClass& str) |
| 33 |
{ |
| 34 |
int res, r; |
| 35 |
STAP_PROBE1(cast-scope, length, &str); |
| 36 |
r = str.len() * 2; |
| 37 |
STAP_PROBE(cast-scope, dummy); /* Just here to probe line +5. */ |
| 38 |
res = r / 2; |
| 39 |
STAP_PROBE(cast-scope, dummy2); /* Just here prevent line reordering. */ |
| 40 |
return res; |
| 41 |
} |
| 42 |
|
| 43 |
int |
| 44 |
main(int argc, char **argv) |
| 45 |
{ |
| 46 |
if (argc != 2) exit(1); |
| 47 |
sClass hello = sClass(argv[1]); |
| 48 |
return 12 != length(hello); |
| 49 |
} |