Write a GDB backtrace macro for other tasks
Here is how to do it manually:
(gdb) p *ble_task_id
$7 = {pxTopOfStack = 0x20027cf4, xStateListItem = {xItemValue = 128508, pxNext = 0x20020c8c, pxPrevious = 0x200214f4,
pvOwner = 0x20027db8, pvContainer = 0x2000b9e0 <xDelayedTaskList1>}, xEventListItem = {xItemValue = 4,
pxNext = 0x2000ba18 <xPendingReadyList+8>, pxPrevious = 0x2000ba18 <xPendingReadyList+8>, pvOwner = 0x20027db8,
pvContainer = 0x0}, uxPriority = 1, pxStack = 0x200255b0, pcTaskName = "BLE\000", '\245' <repeats 11 times>,
uxBasePriority = 1, uxMutexesHeld = 0, ulNotifiedValue = 0, ucNotifyState = 1 '\001',
ucStaticallyAllocated = 0 '\000'}
(gdb) x/128wx (0x20027cf4 - 4*4)
0x20027ce4: 0x10021889 0x10023908 0x6100f000 0x2000bb18
(gdb) set $pc = 0x10023908
(gdb) set $lr = 0x10021889
(gdb) set $sp = 0x20027cf4 - 4 * 5
(gdb) bt
#0 0x10023908 in vPortExitCritical () at ../lib/./FreeRTOS/./Source/portable/GCC/ARM_CM4F/portmacro.h:229
#1 0x10021888 in xQueueGenericSend (xQueue=0x0, pvItemToQueue=0xa5a5a5a5, xTicksToWait=<optimized out>,
xCopyPosition=-1515870811) at ../lib/FreeRTOS/Source/queue.c:874
#2 <signal handler called>
#3 0x10023908 in vPortExitCritical () at ../lib/./FreeRTOS/./Source/portable/GCC/ARM_CM4F/portmacro.h:229
#4 0x10022f26 in ulTaskNotifyTake (xClearCountOnExit=268734258, xClearCountOnExit@entry=1, xTicksToWait=1,
xTicksToWait@entry=1000) at ../lib/FreeRTOS/Source/tasks.c:4599
#5 0x10014e10 in vBleTask (pvParameters=<optimized out>) at ../epicardium/ble/ble.c:281
#6 0x10023814 in ?? () at ../lib/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c:703
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
I guess this only works in some cases, but at least it did in this. Register states might be moved back to their original value afterwards. Correctness of the handling of the LR register is not guaranteed.