-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebug.cpp
82 lines (65 loc) · 1.8 KB
/
debug.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/***************************************************************************
The Base Framework
A framework for developing platform independent applications
See COPYRIGHT.txt for details.
This framework is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
For the licensing terms refer to the file 'LICENSE'.
***************************************************************************/
#include <base/Application.h>
#include <base/string/FormatOutputStream.h>
using namespace com::azure::dev::base;
class DebugApplication : public Application {
private:
static const unsigned int MAJOR_VERSION = 1;
static const unsigned int MINOR_VERSION = 0;
public:
DebugApplication()
: Application("debug")
{
}
void level3(unsigned int value)
{
volatile long double floating = 1.0;
if (floating > 100.0) {
return;
}
volatile double zero = 0.0;
double doubleResult = 1.0/zero;
if (doubleResult) {
}
unsigned int* invalid = reinterpret_cast<unsigned int*>(Runtime::getNullPointer());
unsigned int temp = *invalid; // read
if (temp) {
}
*invalid = 0; // write
}
void level2(unsigned int value)
{
if (value) {
level2(--value);
} else {
level3(3);
}
}
void level1(unsigned int value) {
if (value) {
level1(--value);
} else {
level2(3);
}
}
void main()
{
fout << getFormalName() << " version "
<< MAJOR_VERSION << '.' << MINOR_VERSION << EOL
<< "The Base Framework (Test Suite)" << EOL
<< ENDL;
volatile unsigned int value = 3;
level1(value);
}
~DebugApplication() {
}
};
APPLICATION_STUB(DebugApplication);