Merge branch 'bugfix/spinlock_coredump_regressions_v4.2' into 'release/v4.2'

Revert "Merge branch 'feature/gdb_stub_task_state' into 'master'" (backport v4.2)

See merge request espressif/esp-idf!10296
This commit is contained in:
Angus Gratton 2020-09-25 07:33:05 +08:00
commit 6a711671c6
5 changed files with 7 additions and 74 deletions

View File

@ -22,7 +22,6 @@
static void init_task_info(void);
static void find_paniced_task_index(void);
static int handle_task_commands(unsigned char *cmd, int len);
static void esp_gdbstub_send_str_as_hex(const char *str);
#endif
static void send_reason(void);
@ -77,6 +76,7 @@ void esp_gdbstub_panic_handler(esp_gdbstub_frame_t *frame)
}
}
static void send_reason(void)
{
esp_gdbstub_send_start();
@ -90,16 +90,6 @@ static uint32_t gdbstub_hton(uint32_t i)
return __builtin_bswap32(i);
}
#ifdef CONFIG_ESP_GDBSTUB_SUPPORT_TASKS
static void esp_gdbstub_send_str_as_hex(const char *str)
{
while (*str) {
esp_gdbstub_send_hex(*str, 8);
str++;
}
}
#endif
/** Send all registers to gdb */
static void handle_g_command(const unsigned char* cmd, int len)
{
@ -187,16 +177,6 @@ static bool get_task_handle(size_t index, TaskHandle_t *handle)
return true;
}
static eTaskState get_task_state(size_t index)
{
return s_scratch.tasks[index].eState;
}
static int get_task_cpu_id(size_t index)
{
return s_scratch.tasks[index].xCpuId;
}
/** Get the index of the task running on the current CPU, and save the result */
static void find_paniced_task_index(void)
{
@ -308,34 +288,12 @@ static void handle_qThreadExtraInfo_command(const unsigned char* cmd, int len)
return;
}
esp_gdbstub_send_start();
esp_gdbstub_send_str_as_hex("Name: ");
esp_gdbstub_send_str_as_hex(pcTaskGetTaskName(handle));
esp_gdbstub_send_hex(' ', 8);
eTaskState state = get_task_state(task_index);
switch (state) {
case eRunning:
esp_gdbstub_send_str_as_hex("State: Running ");
esp_gdbstub_send_str_as_hex("@CPU");
esp_gdbstub_send_hex(get_task_cpu_id(task_index) + '0', 8);
break;
case eReady:
esp_gdbstub_send_str_as_hex("State: Ready");
break;
case eBlocked:
esp_gdbstub_send_str_as_hex("State: Blocked");
break;
case eSuspended:
esp_gdbstub_send_str_as_hex("State: Suspended");
break;
case eDeleted:
esp_gdbstub_send_str_as_hex("State: Deleted");
break;
default:
esp_gdbstub_send_str_as_hex("State: Invalid");
break;
const char* task_name = pcTaskGetTaskName(handle);
while (*task_name) {
esp_gdbstub_send_hex(*task_name, 8);
task_name++;
}
/** TODO: add "Running" or "Suspended" and "CPU0" or "CPU1" */
esp_gdbstub_send_end();
}

View File

@ -199,8 +199,6 @@ typedef struct xTASK_SNAPSHOT
StackType_t *pxTopOfStack; /*!< Points to the location of the last item placed on the tasks stack. */
StackType_t *pxEndOfStack; /*!< Points to the end of the stack. pxTopOfStack < pxEndOfStack, stack grows hi2lo
pxTopOfStack > pxEndOfStack, stack grows lo2hi*/
eTaskState eState; /*!< Current state of the task. Can be running or suspended */
BaseType_t xCpuId; /*!< CPU where this task was running */
} TaskSnapshot_t;
/**

View File

@ -5058,26 +5058,6 @@ TickType_t uxReturn;
}
pxTaskSnapshotArray[ *uxTask ].pxTCB = pxTCB;
pxTaskSnapshotArray[ *uxTask ].pxTopOfStack = (StackType_t *)pxTCB->pxTopOfStack;
pxTaskSnapshotArray[ *uxTask ].eState = eTaskGetState(pxTCB);
if(pxTaskSnapshotArray[ *uxTask ].eState == eRunning)
{
BaseType_t xCoreId = xPortGetCoreID();
/* task is running, let's find in which core it is located */
if(pxTCB == pxCurrentTCB[xCoreId])
{
pxTaskSnapshotArray[ *uxTask ].xCpuId = xCoreId;
}
else
{
pxTaskSnapshotArray[ *uxTask ].xCpuId = !xCoreId;
}
}
else
{
pxTaskSnapshotArray[ *uxTask ].xCpuId = -1;
}
#if( portSTACK_GROWTH < 0 )
{
pxTaskSnapshotArray[ *uxTask ].pxEndOfStack = pxTCB->pxEndOfStack;

View File

@ -27,9 +27,6 @@ TEST_CASE("Tasks snapshot", "[freertos]")
esp_cpu_stall(other_core_id);
#endif
UBaseType_t task_num = uxTaskGetSnapshotAll(tasks, TEST_MAX_TASKS_NUM, &tcb_sz);
for (uint32_t i = 0; i < task_num; i++) {
TEST_ASSERT_EQUAL(tasks[i].eState, eTaskGetState(tasks[i].pxTCB));
}
#ifndef CONFIG_FREERTOS_UNICORE
esp_cpu_unstall(other_core_id);
#endif

View File

@ -186,7 +186,7 @@ If :doc:`IDF Monitor <tools/idf-monitor>` is used, GDB is started automatically
36 *((int*) 0) = 0;
(gdb)
GDB prompt can be used to inspect CPU registers, local and static variables, state of created tasks by issuing "info thread" command on the GDB prompt, and arbitrary locations in memory. It is not possible to set breakpoints, change PC, or continue execution. To reset the program, exit GDB and perform external reset: Ctrl-T Ctrl-R in IDF Monitor, or using external reset button on the development board.
GDB prompt can be used to inspect CPU registers, local and static variables, and arbitrary locations in memory. It is not possible to set breakpoints, change PC, or continue execution. To reset the program, exit GDB and perform external reset: Ctrl-T Ctrl-R in IDF Monitor, or using external reset button on the development board.
Guru Meditation Errors
----------------------