@@ -2113,7 +2113,7 @@ int esp_cmd_apptrace_generic(struct target *target, int mode, const char **argv,
2113
2113
return res ;
2114
2114
}
2115
2115
}
2116
- res = esp_apptrace_connect_targets (& s_at_cmd_ctx , true, true );
2116
+ res = esp_apptrace_connect_targets (& s_at_cmd_ctx , true, old_state == TARGET_RUNNING );
2117
2117
if (res != ERROR_OK ) {
2118
2118
LOG_ERROR ("Failed to connect to targets (%d)!" , res );
2119
2119
s_at_cmd_ctx .running = 0 ;
@@ -2207,7 +2207,7 @@ int esp_cmd_apptrace_generic(struct target *target, int mode, const char **argv,
2207
2207
LOG_ERROR ("SEGGER: Failed to stop tracing!" );
2208
2208
}
2209
2209
}
2210
- res = esp_apptrace_connect_targets (& s_at_cmd_ctx , false, true );
2210
+ res = esp_apptrace_connect_targets (& s_at_cmd_ctx , false, old_state == TARGET_RUNNING );
2211
2211
if (res != ERROR_OK ) {
2212
2212
LOG_ERROR ("Failed to disconnect targets (%d)!" , res );
2213
2213
}
@@ -2246,15 +2246,15 @@ int esp_cmd_apptrace_generic(struct target *target, int mode, const char **argv,
2246
2246
/* let registered timer callbacks to run */
2247
2247
target_call_timer_callbacks ();
2248
2248
}
2249
- if (s_at_cmd_ctx .running ) {
2250
- // data processor is alive, so wait for all received blocks to be processed
2251
- res = esp_apptrace_wait_pended_blocks (& s_at_cmd_ctx );
2252
- if (res != ERROR_OK ) {
2253
- LOG_ERROR ("Failed to wait for pended blocks (%d)!" , res );
2254
- }
2255
- // signal thread to stop
2256
- s_at_cmd_ctx .running = 0 ;
2257
- }
2249
+ if (s_at_cmd_ctx .running ) {
2250
+ // data processor is alive, so wait for all received blocks to be processed
2251
+ res = esp_apptrace_wait_pended_blocks (& s_at_cmd_ctx );
2252
+ if (res != ERROR_OK ) {
2253
+ LOG_ERROR ("Failed to wait for pended blocks (%d)!" , res );
2254
+ }
2255
+ // signal thread to stop
2256
+ s_at_cmd_ctx .running = 0 ;
2257
+ }
2258
2258
esp_apptrace_print_stats (& s_at_cmd_ctx );
2259
2259
res = esp_apptrace_cmd_cleanup (& s_at_cmd_ctx );
2260
2260
if (res != ERROR_OK ) {
0 commit comments