kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'bugfix/apptrace_down_buf_init' into 'master'
esp32: Fixes double initialization of apptrace down ring buffer in dual core mode See merge request !1274pull/1098/head
commit
8c4c5ae034
|
@ -864,6 +864,8 @@ esp_err_t esp_apptrace_init()
|
|||
|
||||
if (!s_trace_buf.inited) {
|
||||
memset(&s_trace_buf, 0, sizeof(s_trace_buf));
|
||||
// disabled by default
|
||||
esp_apptrace_rb_init(&s_trace_buf.rb_down, NULL, 0);
|
||||
res = esp_apptrace_lock_initialize(&s_trace_buf.lock);
|
||||
if (res != ESP_OK) {
|
||||
ESP_APPTRACE_LOGE("Failed to init log lock (%d)!", res);
|
||||
|
@ -884,9 +886,6 @@ esp_err_t esp_apptrace_init()
|
|||
esp_apptrace_trax_init();
|
||||
#endif
|
||||
|
||||
// disabled by default
|
||||
esp_apptrace_rb_init(&s_trace_buf.rb_down, NULL, 0);
|
||||
|
||||
s_trace_buf.inited |= 1 << xPortGetCoreID(); // global and this CPU-specific data are inited
|
||||
|
||||
return ESP_OK;
|
||||
|
|
|
@ -49,6 +49,7 @@ void esp_gcov_dump()
|
|||
}
|
||||
|
||||
if (s_gcov_exit) {
|
||||
esp_apptrace_down_buffer_config(s_gcov_down_buf, sizeof(s_gcov_down_buf));
|
||||
s_gcov_exit();
|
||||
}
|
||||
|
||||
|
@ -61,7 +62,6 @@ void esp_gcov_dump()
|
|||
int gcov_rtio_atexit(void (*function)(void))
|
||||
{
|
||||
s_gcov_exit = function;
|
||||
esp_apptrace_down_buffer_config(s_gcov_down_buf, sizeof(s_gcov_down_buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -155,14 +155,14 @@ void *esp_apptrace_fopen(esp_apptrace_dest_t dest, const char *path, const char
|
|||
}
|
||||
|
||||
// now read the answer
|
||||
uint8_t resp[sizeof(void *)];
|
||||
ret = esp_apptrace_file_rsp_recv(dest, resp, sizeof(resp));
|
||||
void *resp;
|
||||
ret = esp_apptrace_file_rsp_recv(dest, (uint8_t *)&resp, sizeof(resp));
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return *((void **)resp);
|
||||
return resp;
|
||||
}
|
||||
|
||||
static void esp_apptrace_fclose_args_prepare(uint8_t *buf, void *priv)
|
||||
|
@ -185,14 +185,14 @@ int esp_apptrace_fclose(esp_apptrace_dest_t dest, void *stream)
|
|||
}
|
||||
|
||||
// now read the answer
|
||||
uint8_t resp[sizeof(int)];
|
||||
ret = esp_apptrace_file_rsp_recv(dest, resp, sizeof(resp));
|
||||
int resp;
|
||||
ret = esp_apptrace_file_rsp_recv(dest, (uint8_t *)&resp, sizeof(resp));
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
||||
return EOF;
|
||||
}
|
||||
|
||||
return *((int *)resp);
|
||||
return resp;
|
||||
}
|
||||
|
||||
static void esp_apptrace_fwrite_args_prepare(uint8_t *buf, void *priv)
|
||||
|
@ -218,14 +218,14 @@ size_t esp_apptrace_fwrite(esp_apptrace_dest_t dest, const void *ptr, size_t siz
|
|||
}
|
||||
|
||||
// now read the answer
|
||||
uint8_t resp[sizeof(size_t)];
|
||||
ret = esp_apptrace_file_rsp_recv(dest, resp, sizeof(resp));
|
||||
size_t resp;
|
||||
ret = esp_apptrace_file_rsp_recv(dest, (uint8_t *)&resp, sizeof(resp));
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return *((size_t *)resp);
|
||||
return resp;
|
||||
}
|
||||
|
||||
static void esp_apptrace_fread_args_prepare(uint8_t *buf, void *priv)
|
||||
|
@ -250,20 +250,20 @@ size_t esp_apptrace_fread(esp_apptrace_dest_t dest, void *ptr, size_t size, size
|
|||
}
|
||||
|
||||
// now read the answer
|
||||
uint8_t resp[sizeof(size_t)];
|
||||
ret = esp_apptrace_file_rsp_recv(dest, resp, sizeof(resp));
|
||||
size_t resp;
|
||||
ret = esp_apptrace_file_rsp_recv(dest, (uint8_t *)&resp, sizeof(resp));
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
||||
return 0;
|
||||
}
|
||||
if (*((size_t *)resp) > 0) {
|
||||
ret = esp_apptrace_file_rsp_recv(dest, ptr, *((size_t *)resp));
|
||||
if (resp > 0) {
|
||||
ret = esp_apptrace_file_rsp_recv(dest, ptr, resp);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to read file data (%d)!", ret);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return *((size_t *)resp);
|
||||
return resp;
|
||||
}
|
||||
|
||||
static void esp_apptrace_fseek_args_prepare(uint8_t *buf, void *priv)
|
||||
|
@ -288,14 +288,14 @@ int esp_apptrace_fseek(esp_apptrace_dest_t dest, void *stream, long offset, int
|
|||
}
|
||||
|
||||
// now read the answer
|
||||
uint8_t resp[sizeof(int)];
|
||||
ret = esp_apptrace_file_rsp_recv(dest, resp, sizeof(resp));
|
||||
int resp;
|
||||
ret = esp_apptrace_file_rsp_recv(dest, (uint8_t *)&resp, sizeof(resp));
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return *((int *)resp);
|
||||
return resp;
|
||||
}
|
||||
|
||||
static void esp_apptrace_ftell_args_prepare(uint8_t *buf, void *priv)
|
||||
|
@ -318,14 +318,14 @@ int esp_apptrace_ftell(esp_apptrace_dest_t dest, void *stream)
|
|||
}
|
||||
|
||||
// now read the answer
|
||||
uint8_t resp[sizeof(int)];
|
||||
ret = esp_apptrace_file_rsp_recv(dest, resp, sizeof(resp));
|
||||
int resp;
|
||||
ret = esp_apptrace_file_rsp_recv(dest, (uint8_t *)&resp, sizeof(resp));
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return *((int *)resp);
|
||||
return resp;
|
||||
}
|
||||
|
||||
int esp_apptrace_fstop(esp_apptrace_dest_t dest)
|
||||
|
|
Ładowanie…
Reference in New Issue