debug: thread monitor allow to access more thread information

The thread monitor allows to iterate over the thread context
structures for each existing thread (fiber/task) in the system.

Thread context structures do not expose thread entry information
directly. Although all the information can be scavenged from memory
stacks. Besides, accessing the information depends on the stack
implementation for each architecture.

By extending the tcs we allow a direct access to the thread
entry point and its parameters, only when thread monitor is
enabled.

It also allows a task to access its kernel task structure
through the first parameter of the thread.

This allows a debugger application to access the information directly
from the thread context structures list.

Change-Id: I0a435942b80eddffdf405016ac4056eb7aa1239c
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
This commit is contained in:
Juan Manuel Cruz 2016-03-02 17:31:26 -06:00 committed by Anas Nashif
commit d151776e59
7 changed files with 63 additions and 1 deletions

View file

@ -181,6 +181,7 @@ void _k_state_bit_set(struct k_task *task_ptr, uint32_t bits)
static void start_task(struct k_task *X, void (*func)(void))
{
unsigned int task_options;
void *parameter1;
/* Note: the field X->worksize now represents the task size in bytes */
@ -196,10 +197,16 @@ static void start_task(struct k_task *X, void (*func)(void))
* the thread is a task, rather than a fiber.
*/
#ifdef CONFIG_THREAD_MONITOR
parameter1 = (void *)X;
#else
parameter1 = (void *)0;
#endif
_new_thread((char *)X->workspace, /* pStackMem */
X->worksize, /* stackSize */
(_thread_entry_t)func, /* pEntry */
(void *)0, /* parameter1 */
parameter1, /* parameter1 */
(void *)0, /* parameter2 */
(void *)0, /* parameter3 */
-1, /* priority */