Defines an object tracing list for each kernel object type that supports object tracing, and ensures that both statically and dynamically defined objects are added to the appropriate list. Ensure that each static kernel object is grouped together with the other static objects of the same type. Revise the initialization function for each kernel type (or create it, if needed) so that each static object is added to the object tracing list for its associated type. Note 1: Threads are handled a bit differently than other kernel object types. A statically-defined thread is added to the thread list when the thread is started, not when the kernel initializes. Also, a thread is removed from the thread list when the thread terminates or aborts, unlike other types of kernel objects which are never removed from an object tracing list. (Such support would require the creation of APIs to "uninitialize" the kernel object.) Note 2: The list head variables for all kernel object types are now explicitly defined. However, the list head variable for the ring buffer type continues to be implicitly defined for the time being, since it isn't considered to be an core kernel object type. Change-Id: Ie24d41023e05b3598dc6b344e6871a9692bba02d Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
129 lines
3.8 KiB
C
129 lines
3.8 KiB
C
/*
|
|
* Copyright (c) 2016 Intel Corporation
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
/**
|
|
* @file
|
|
* @brief APIs used when examining the objects in a debug tracing list.
|
|
*/
|
|
|
|
#ifndef _OBJECT_TRACING_H_
|
|
#define _OBJECT_TRACING_H_
|
|
|
|
#ifdef CONFIG_DEBUG_TRACING_KERNEL_OBJECTS
|
|
|
|
#if !defined(CONFIG_KERNEL_V2)
|
|
|
|
#include <nanokernel.h>
|
|
extern struct nano_fifo *_trace_list_nano_fifo;
|
|
extern struct nano_lifo *_trace_list_nano_lifo;
|
|
extern struct nano_sem *_trace_list_nano_sem;
|
|
extern struct nano_timer *_trace_list_nano_timer;
|
|
extern struct nano_stack *_trace_list_nano_stack;
|
|
extern struct ring_buf *_trace_list_sys_ring_buf;
|
|
|
|
#ifdef CONFIG_MICROKERNEL
|
|
#include <microkernel/base_api.h>
|
|
#include <micro_private_types.h>
|
|
extern struct _k_mbox_struct *_trace_list_micro_mbox;
|
|
extern struct _k_mutex_struct *_trace_list_micro_mutex;
|
|
extern struct _k_sem_struct *_trace_list_micro_sem;
|
|
extern struct _k_fifo_struct *_trace_list_micro_fifo;
|
|
extern struct _k_pipe_struct *_trace_list_micro_pipe;
|
|
extern struct pool_struct *_trace_list_micro_mem_pool;
|
|
extern struct _k_mem_map_struct *_trace_list_micro_mem_map;
|
|
extern struct _k_event_struct *_trace_list_micro_event;
|
|
extern struct k_timer *_trace_list_micro_timer;
|
|
extern struct k_task *_trace_list_micro_task;
|
|
#endif /*CONFIG_MICROKERNEL*/
|
|
|
|
#else
|
|
|
|
#include <kernel.h>
|
|
extern struct k_timer *_trace_list_k_timer;
|
|
extern struct k_mem_slab *_trace_list_k_mem_slab;
|
|
extern struct k_mem_pool *_trace_list_k_mem_pool;
|
|
extern struct k_sem *_trace_list_k_sem;
|
|
extern struct k_mutex *_trace_list_k_mutex;
|
|
extern struct k_alert *_trace_list_k_alert;
|
|
extern struct k_fifo *_trace_list_k_fifo;
|
|
extern struct k_lifo *_trace_list_k_lifo;
|
|
extern struct k_stack *_trace_list_k_stack;
|
|
extern struct k_msgq *_trace_list_k_msgq;
|
|
extern struct k_mbox *_trace_list_k_mbox;
|
|
extern struct k_pipe *_trace_list_k_pipe;
|
|
|
|
extern struct ring_buf *_trace_list_sys_ring_buf;
|
|
|
|
#endif /*CONFIG_KERNEL_V2*/
|
|
|
|
/**
|
|
* @def SYS_TRACING_HEAD
|
|
*
|
|
* @brief Head element of a trace list.
|
|
*
|
|
* @details Access the head element of a given trace list.
|
|
*
|
|
* @param type Data type of the trace list to get the head from.
|
|
* @param name Name of the trace list to get the head from.
|
|
*/
|
|
#define SYS_TRACING_HEAD(type, name) ((type *) _CONCAT(_trace_list_, name))
|
|
|
|
/**
|
|
* @def SYS_TRACING_NEXT
|
|
*
|
|
* @brief Gets a node's next element.
|
|
*
|
|
* @details Given a node in a trace list, gets the next element
|
|
* in the list.
|
|
*
|
|
* @param type Data type of the trace list
|
|
* @param name Name of the trace list to get the head from.
|
|
* @param obj Object to get next element from.
|
|
*/
|
|
#define SYS_TRACING_NEXT(type, name, obj) (((type *)obj)->__next)
|
|
|
|
#endif /*CONFIG_DEBUG_TRACING_KERNEL_OBJECTS*/
|
|
|
|
#ifdef CONFIG_THREAD_MONITOR
|
|
|
|
#include <nano_private.h>
|
|
|
|
/**
|
|
* @def SYS_THREAD_MONITOR_HEAD
|
|
*
|
|
* @brief Head element of the thread monitor list.
|
|
*
|
|
* @details Access the head element of the thread monitor list.
|
|
*
|
|
*/
|
|
#define SYS_THREAD_MONITOR_HEAD ((struct tcs *)(_nanokernel.threads))
|
|
|
|
/**
|
|
* @def SYS_THREAD_MONITOR_NEXT
|
|
*
|
|
* @brief Gets a thread node's next element.
|
|
*
|
|
* @details Given a node in a thread monitor list, gets the next
|
|
* element in the list.
|
|
*
|
|
* @param obj Object to get the next element from.
|
|
*/
|
|
#define SYS_THREAD_MONITOR_NEXT(obj) (((struct tcs *)obj)->next_thread)
|
|
|
|
#endif /*CONFIG_THREAD_MONITOR*/
|
|
|
|
#endif /*_OBJECT_TRACING_H_*/
|