@@ -106,22 +106,26 @@ enum semihosting_result riscv_semihosting(struct target *target, int *retval)
106
106
assert (semihosting );
107
107
108
108
if (!semihosting -> is_active ) {
109
- LOG_TARGET_DEBUG (target , " -> NONE (! semihosting->is_active )" );
109
+ LOG_TARGET_DEBUG (target , "Semihosting outcome: NONE (semihosting not enabled )" );
110
110
return SEMIHOSTING_NONE ;
111
111
}
112
112
113
113
riscv_reg_t pc ;
114
114
int result = riscv_reg_get (target , & pc , GDB_REGNO_PC );
115
- if (result != ERROR_OK )
115
+ if (result != ERROR_OK ) {
116
+ LOG_TARGET_DEBUG (target , "Semihosting outcome: ERROR (failed to read PC)" );
116
117
return SEMIHOSTING_ERROR ;
118
+ }
117
119
118
120
bool sequence_found ;
119
121
* retval = riscv_semihosting_detect_magic_sequence (target , pc , & sequence_found );
120
- if (* retval != ERROR_OK )
122
+ if (* retval != ERROR_OK ) {
123
+ LOG_TARGET_DEBUG (target , "Semihosting outcome: ERROR (during magic seq. detection)" );
121
124
return SEMIHOSTING_ERROR ;
125
+ }
122
126
123
127
if (!sequence_found ) {
124
- LOG_TARGET_DEBUG (target , " -> NONE (no magic)" );
128
+ LOG_TARGET_DEBUG (target , "Semihosting outcome: NONE (no magic sequence )" );
125
129
return SEMIHOSTING_NONE ;
126
130
}
127
131
@@ -140,12 +144,14 @@ enum semihosting_result riscv_semihosting(struct target *target, int *retval)
140
144
result = riscv_reg_get (target , & r0 , GDB_REGNO_A0 );
141
145
if (result != ERROR_OK ) {
142
146
LOG_TARGET_ERROR (target , "Could not read semihosting operation code (register a0)" );
147
+ LOG_TARGET_DEBUG (target , "Semihosting outcome: ERROR (failed to read a0)" );
143
148
return SEMIHOSTING_ERROR ;
144
149
}
145
150
146
151
result = riscv_reg_get (target , & r1 , GDB_REGNO_A1 );
147
152
if (result != ERROR_OK ) {
148
153
LOG_TARGET_ERROR (target , "Could not read semihosting operation code (register a1)" );
154
+ LOG_TARGET_DEBUG (target , "Semihosting outcome: ERROR (failed to read a1)" );
149
155
return SEMIHOSTING_ERROR ;
150
156
}
151
157
@@ -160,11 +166,13 @@ enum semihosting_result riscv_semihosting(struct target *target, int *retval)
160
166
* retval = semihosting_common (target );
161
167
if (* retval != ERROR_OK ) {
162
168
LOG_TARGET_ERROR (target , "Failed semihosting operation (0x%02X)" , semihosting -> op );
169
+ LOG_TARGET_DEBUG (target , "Semihosting outcome: ERROR (error during semihosting processing)" );
163
170
return SEMIHOSTING_ERROR ;
164
171
}
165
172
} else {
166
173
/* Unknown operation number, not a semihosting call. */
167
174
LOG_TARGET_ERROR (target , "Unknown semihosting operation requested (op = 0x%x)" , semihosting -> op );
175
+ LOG_TARGET_DEBUG (target , "Semihosting outcome: NONE (unknown semihosting opcode)" );
168
176
return SEMIHOSTING_NONE ;
169
177
}
170
178
}
@@ -179,11 +187,11 @@ enum semihosting_result riscv_semihosting(struct target *target, int *retval)
179
187
* operation to complete.
180
188
*/
181
189
if (semihosting -> is_resumable && !semihosting -> hit_fileio ) {
182
- LOG_TARGET_DEBUG (target , " -> HANDLED" );
190
+ LOG_TARGET_DEBUG (target , "Semihosting outcome: HANDLED" );
183
191
return SEMIHOSTING_HANDLED ;
184
192
}
185
193
186
- LOG_TARGET_DEBUG (target , " -> WAITING" );
194
+ LOG_TARGET_DEBUG (target , "Semihosting outcome: WAITING" );
187
195
return SEMIHOSTING_WAITING ;
188
196
}
189
197
0 commit comments