kernel: Bring back object tracking

When CONFIG_TRACING_OBJECT_TRACKING is enabled, the kernel will keep
lists of some objects (detailed below), so that debuggers or other tools
can keep track of them.

The lists of objects are:

struct k_timer *_track_list_k_timer;
struct k_mem_slab *_track_list_k_mem_slab;
struct k_sem *_track_list_k_sem;
struct k_mutex *_track_list_k_mutex;
struct k_stack *_track_list_k_stack;
struct k_msgq *_track_list_k_msgq;
struct k_mbox *_track_list_k_mbox;
struct k_pipe *_track_list_k_pipe;
struct k_queue *_track_list_k_queue;

Note that while CONFIG_TRACING is needed, one can always use
CONFIG_TRACE_NONE=y. Also, tracking will only be done for objects that
are also being traced (so, to prevent tracking of some type of object,
such as k_timer, just make CONFIG_TRACING_TIMER=n).

Some simple "sanity checking" tests are also added in this patch.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
This commit is contained in:
Ederson de Souza 2021-11-22 14:46:19 -08:00 committed by Anas Nashif
commit bdaac354f4
12 changed files with 544 additions and 0 deletions

View file

@ -202,6 +202,12 @@ config TRACING_CMD_BUFFER_SIZE
help
Size of tracing command buffer.
config TRACING_OBJECT_TRACKING
bool "Enable object tracking"
default n
help
Keep lists to track kernel objects.
menu "Tracing Configuration"
config TRACING_SYSCALL