Skip to content

Commit 68dc422

Browse files
committed
Merge branch 'bugfix/apptrace_down_buf_handling' into 'master'
esp32: Fixes apptrace down buffer management See merge request idf/esp-idf!1953
2 parents 3ede9f0 + 4e544f8 commit 68dc422

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

components/app_trace/app_trace.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156
// ALSO SEE example usage of application tracing module in 'components/app_trace/README.rst'
157157

158158
#include <string.h>
159+
#include <sys/param.h>
159160
#include "soc/soc.h"
160161
#include "soc/dport_reg.h"
161162
#include "eri.h"
@@ -583,11 +584,11 @@ static uint8_t *esp_apptrace_trax_down_buffer_get(uint32_t *size, esp_apptrace_t
583584
while (1) {
584585
uint32_t sz = esp_apptrace_rb_read_size_get(&s_trace_buf.rb_down);
585586
if (sz != 0) {
586-
ptr = esp_apptrace_rb_consume(&s_trace_buf.rb_down, sz > *size ? *size : sz);
587+
*size = MIN(*size, sz);
588+
ptr = esp_apptrace_rb_consume(&s_trace_buf.rb_down, *size);
587589
if (!ptr) {
588590
assert(false && "Failed to consume bytes from down buffer!");
589591
}
590-
*size = sz;
591592
break;
592593
}
593594
// may need to flush

0 commit comments

Comments
 (0)