23
23
24
24
void compile_test_file ()
25
25
{
26
- std::string test_file (" memory-analyzer/test.c" );
26
+ std::string test_file (" memory-analyzer/test.c" ); std::cout << " Here 0 " << std::endl;
27
27
28
- std::string cmd (" gcc -g -o test " );
29
- cmd += test_file;
28
+ std::string cmd (" gcc -g -o test " ); std::cout << " Here 1 " << std::endl;
29
+ cmd += test_file; std::cout << " Here 2 " << std::endl;
30
30
31
- const int r = system (cmd.c_str ());
32
- REQUIRE (!r);
31
+ const int r = system (cmd.c_str ()); std::cout << " Here 3 " << std::endl;
32
+ REQUIRE (!r); std::cout << " Here 4 " << std::endl;
33
33
}
34
34
35
35
class gdb_api_testt : public gdb_apit
@@ -43,110 +43,111 @@ class gdb_api_testt : public gdb_apit
43
43
44
44
void gdb_api_internals_test ()
45
45
{
46
- compile_test_file ();
46
+ compile_test_file (); std::cout << " Here 7 " << std::endl;
47
47
48
48
SECTION (" parse gdb output record" )
49
49
{
50
- gdb_api_testt gdb_api (" test" );
50
+ gdb_api_testt gdb_api (" test" ); std::cout << " Here 8 " << std::endl;
51
51
52
- gdb_api_testt::gdb_output_recordt gor;
52
+ gdb_api_testt::gdb_output_recordt gor; std::cout << " Here 9 " << std::endl;
53
53
54
54
gor = gdb_api.parse_gdb_output_record (
55
- " a = \" 1\" , b = \" 2\" , c = {1, 2}, d = [3, 4], e=\" 0x0\" " );
55
+ " a = \" 1\" , b = \" 2\" , c = {1, 2}, d = [3, 4], e=\" 0x0\" " ); std::cout << " Here 10 " << std::endl;
56
56
57
- REQUIRE (gor[" a" ] == " 1" );
58
- REQUIRE (gor[" b" ] == " 2" );
59
- REQUIRE (gor[" c" ] == " {1, 2}" );
60
- REQUIRE (gor[" d" ] == " [3, 4]" );
61
- REQUIRE (gor[" e" ] == " 0x0" );
57
+ REQUIRE (gor[" a" ] == " 1" ); std::cout << " Here 11 " << std::endl;
58
+ REQUIRE (gor[" b" ] == " 2" ); std::cout << " Here 12 " << std::endl;
59
+ REQUIRE (gor[" c" ] == " {1, 2}" ); std::cout << " Here 13 " << std::endl;
60
+ REQUIRE (gor[" d" ] == " [3, 4]" ); std::cout << " Here 14 " << std::endl;
61
+ REQUIRE (gor[" e" ] == " 0x0" ); std::cout << " Here 15 " << std::endl;
62
62
}
63
63
64
64
SECTION (" read a line from an input stream" )
65
65
{
66
- gdb_api_testt gdb_api (" test" );
66
+ gdb_api_testt gdb_api (" test" ); std::cout << " Here 16 " << std::endl;
67
67
68
- FILE *f = fopen (" memory-analyzer/input.txt" , " r" );
69
- gdb_api.input_stream = f;
68
+ FILE *f = fopen (" memory-analyzer/input.txt" , " r" ); std::cout << " Here 17 " << std::endl;
69
+ gdb_api.input_stream = f; std::cout << " Here 18 " << std::endl;
70
70
71
- std::string line;
71
+ std::string line; std::cout << " Here 19 " << std::endl;
72
72
73
- line = gdb_api.read_next_line ();
74
- REQUIRE (line == " abc\n " );
73
+ line = gdb_api.read_next_line (); std::cout << " Here 20 " << std::endl;
74
+ REQUIRE (line == " abc\n " ); std::cout << " Here 21 " << std::endl;
75
75
76
- line = gdb_api.read_next_line ();
77
- REQUIRE (line == std::string (1120 , ' a' ) + " \n " );
76
+ line = gdb_api.read_next_line (); std::cout << " Here 22 " << std::endl;
77
+ REQUIRE (line == std::string (1120 , ' a' ) + " \n " ); std::cout << " Here 23 " << std::endl;
78
78
79
- line = gdb_api.read_next_line ();
80
- REQUIRE (line == " xyz" );
79
+ line = gdb_api.read_next_line (); std::cout << " Here 24 " << std::endl;
80
+ REQUIRE (line == " xyz" ); std::cout << " Here 25 " << std::endl;
81
81
}
82
82
83
83
SECTION (" start and exit gdb" )
84
84
{
85
- gdb_api_testt gdb_api (" test" );
85
+ gdb_api_testt gdb_api (" test" ); std::cout << " Here 26 " << std::endl;
86
86
87
- gdb_api.create_gdb_process ();
87
+ gdb_api.create_gdb_process (); std::cout << " Here 27 " << std::endl;
88
88
89
89
// check input and output streams
90
- REQUIRE (!ferror (gdb_api.input_stream ));
91
- REQUIRE (!ferror (gdb_api.output_stream ));
90
+ REQUIRE (!ferror (gdb_api.input_stream )); std::cout << " Here 28 " << std::endl;
91
+ REQUIRE (!ferror (gdb_api.output_stream )); std::cout << " Here 29 " << std::endl;
92
92
93
- gdb_api.terminate_gdb_process ();
93
+ gdb_api.terminate_gdb_process (); std::cout << " Here 30 " << std::endl;
94
94
}
95
95
}
96
96
97
97
TEST_CASE (" gdb api internals test" , " [core][memory-analyzer]" )
98
98
{
99
- gdb_api_internals_test ();
99
+ gdb_api_internals_test (); std::cout << " Here 31 " << std::endl;
100
100
}
101
101
102
102
TEST_CASE (" gdb api test" , " [core][memory-analyzer]" )
103
103
{
104
- compile_test_file ();
104
+ compile_test_file (); std::cout << " Here 32 " << std::endl;
105
105
106
- gdb_apit gdb_api (" test" );
106
+ gdb_apit gdb_api (" test" ); std::cout << " Here 33 " << std::endl;
107
107
108
- gdb_api.create_gdb_process ();
108
+ gdb_api.create_gdb_process (); std::cout << " Here 34 " << std::endl;
109
109
110
110
SECTION (" breakpoint is hit" )
111
111
{
112
- const bool r = gdb_api.run_gdb_to_breakpoint (" checkpoint" );
113
- REQUIRE (r);
112
+ const bool r = gdb_api.run_gdb_to_breakpoint (" checkpoint" ); std::cout << " Here 35 " << std::endl;
113
+ REQUIRE (r); std::cout << " Here 36 " << std::endl;
114
114
}
115
115
116
116
SECTION (" breakpoint is not hit" )
117
117
{
118
- const bool r = gdb_api.run_gdb_to_breakpoint (" checkpoint2" );
119
- REQUIRE (!r);
118
+ const bool r = gdb_api.run_gdb_to_breakpoint (" checkpoint2" ); std::cout << " Here 37 " << std::endl;
119
+ REQUIRE (!r); std::cout << " Here 38 " << std::endl;
120
120
}
121
121
122
122
SECTION (" breakpoint does not exist" )
123
123
{
124
124
REQUIRE_THROWS_AS (
125
- gdb_api.run_gdb_to_breakpoint (" checkpoint3" ), gdb_interaction_exceptiont);
125
+ gdb_api.run_gdb_to_breakpoint (" checkpoint3" ), gdb_interaction_exceptiont); std::cout << " Here 39 " << std::endl;
126
126
}
127
127
128
128
SECTION (" query memory" )
129
129
{
130
- const bool r = gdb_api.run_gdb_to_breakpoint (" checkpoint" );
131
- REQUIRE (r);
130
+ const bool r = gdb_api.run_gdb_to_breakpoint (" checkpoint" ); std::cout << " Here 40 " << std::endl;
131
+ REQUIRE (r); std::cout << " Here 41 " << std::endl;
132
132
133
- REQUIRE (gdb_api.get_value (" x" ) == " 8" );
134
- REQUIRE (gdb_api.get_value (" s" ) == " abc" );
133
+ REQUIRE (gdb_api.get_value (" x" ) == " 8" ); std::cout << " Here 42 " << std::endl;
134
+ REQUIRE (gdb_api.get_value (" s" ) == " abc" ); std::cout << " Here 43 " << std::endl;
135
135
136
- const std::regex regex (R"( 0x[1-9a-f][0-9a-f]*)" );
136
+ const std::regex regex (R"( 0x[1-9a-f][0-9a-f]*)" ); std::cout << " Here 44 " << std::endl;
137
137
138
138
{
139
- std::string address = gdb_api.get_memory (" p" );
140
- REQUIRE (std::regex_match (address, regex));
139
+ std::string address = gdb_api.get_memory (" p" ); std::cout << " Here 45 " << std::endl;
140
+ REQUIRE (std::regex_match (address, regex)); std::cout << " Here 46 " << std::endl;
141
141
}
142
142
143
143
{
144
- std::string address = gdb_api.get_memory (" vp" );
145
- REQUIRE (std::regex_match (address, regex));
144
+ std::string address = gdb_api.get_memory (" vp" ); std::cout << " Here 47 " << std::endl;
145
+ REQUIRE (std::regex_match (address, regex)); std::cout << " Here 48 " << std::endl;
146
146
}
147
147
}
148
148
149
- gdb_api.terminate_gdb_process ();
149
+ gdb_api.terminate_gdb_process (); std::cout << " Here 49 " << std::endl;
150
150
}
151
151
152
152
#endif
153
+
0 commit comments