Tracing: k_free tracing hook heap reference added

Added heap reference parameter to k_free tracing
hook to allow tracing of the pointer which was
passed as a parameter to a k_free call.
As part of this update the defines
(for this hook) in the various tracing formats
was also updated.

Signed-off-by: Torbjörn Leksell <torbjorn.leksell@percepio.com>
This commit is contained in:
Torbjörn Leksell 2021-11-08 09:09:46 +01:00 committed by Anas Nashif
commit 86d8b36955
7 changed files with 20 additions and 16 deletions

View file

@ -1731,14 +1731,16 @@ void sys_trace_idle(void);
/**
* @brief Trace System Heap free entry
* @param heap Heap object
* @param heap_ref Heap reference
*/
#define sys_port_trace_k_heap_sys_k_free_enter(heap)
#define sys_port_trace_k_heap_sys_k_free_enter(heap, heap_ref)
/**
* @brief Trace System Heap free exit
* @param heap Heap object
* @param heap_ref Heap reference
*/
#define sys_port_trace_k_heap_sys_k_free_exit(heap)
#define sys_port_trace_k_heap_sys_k_free_exit(heap, heap_ref)
/**
* @brief Trace System heap calloc enter

View file

@ -48,11 +48,11 @@ void k_free(void *ptr)
heap_ref = ptr;
ptr = --heap_ref;
SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_heap_sys, k_free, *heap_ref);
SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_heap_sys, k_free, *heap_ref, heap_ref);
k_heap_free(*heap_ref, ptr);
SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_heap_sys, k_free, *heap_ref);
SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_heap_sys, k_free, *heap_ref, heap_ref);
}
}

View file

@ -290,8 +290,8 @@ extern "C" {
#define sys_port_trace_k_heap_sys_k_aligned_alloc_exit(heap, ret)
#define sys_port_trace_k_heap_sys_k_malloc_enter(heap)
#define sys_port_trace_k_heap_sys_k_malloc_exit(heap, ret)
#define sys_port_trace_k_heap_sys_k_free_enter(heap)
#define sys_port_trace_k_heap_sys_k_free_exit(heap)
#define sys_port_trace_k_heap_sys_k_free_enter(heap, heap_ref)
#define sys_port_trace_k_heap_sys_k_free_exit(heap, heap_ref)
#define sys_port_trace_k_heap_sys_k_calloc_enter(heap)
#define sys_port_trace_k_heap_sys_k_calloc_exit(heap, ret)

View file

@ -555,8 +555,8 @@ void sys_trace_thread_info(struct k_thread *thread);
#define sys_port_trace_k_heap_sys_k_aligned_alloc_exit(heap, ret)
#define sys_port_trace_k_heap_sys_k_malloc_enter(heap)
#define sys_port_trace_k_heap_sys_k_malloc_exit(heap, ret)
#define sys_port_trace_k_heap_sys_k_free_enter(heap)
#define sys_port_trace_k_heap_sys_k_free_exit(heap)
#define sys_port_trace_k_heap_sys_k_free_enter(heap, heap_ref)
#define sys_port_trace_k_heap_sys_k_free_exit(heap, heap_ref)
#define sys_port_trace_k_heap_sys_k_calloc_enter(heap)
#define sys_port_trace_k_heap_sys_k_calloc_exit(heap, ret)

View file

@ -376,12 +376,12 @@ void sys_trace_k_heap_aligned_alloc_exit(struct k_heap *h, size_t bytes,
TRACING_STRING("%s: %p\n", __func__, h);
}
void sys_trace_k_heap_sys_k_free_enter(struct k_heap *h)
void sys_trace_k_heap_sys_k_free_enter(struct k_heap *h, struct k_heap **hr)
{
TRACING_STRING("%s: %p\n", __func__, h);
}
void sys_trace_k_heap_sys_k_free_exit(struct k_heap *h)
void sys_trace_k_heap_sys_k_free_exit(struct k_heap *h, struct k_heap **hr)
{
TRACING_STRING("%s: %p\n", __func__, h);
}

View file

@ -382,8 +382,10 @@
sys_trace_k_heap_sys_k_malloc_enter(heap, size)
#define sys_port_trace_k_heap_sys_k_malloc_exit(heap, ret) \
sys_trace_k_heap_sys_k_malloc_exit(heap, size, ret)
#define sys_port_trace_k_heap_sys_k_free_enter(heap) sys_trace_k_heap_sys_k_free_enter(heap)
#define sys_port_trace_k_heap_sys_k_free_exit(heap) sys_trace_k_heap_sys_k_free_exit(heap)
#define sys_port_trace_k_heap_sys_k_free_enter(heap, heap_ref) \
sys_trace_k_heap_sys_k_free_enter(heap, heap_ref)
#define sys_port_trace_k_heap_sys_k_free_exit(heap, heap_ref) \
sys_trace_k_heap_sys_k_free_exit(heap, heap_ref)
#define sys_port_trace_k_heap_sys_k_calloc_enter(heap) \
sys_trace_k_heap_sys_k_calloc_enter(heap, nmemb, size)
#define sys_port_trace_k_heap_sys_k_calloc_exit(heap, ret) \
@ -651,8 +653,8 @@ void sys_trace_k_heap_sys_k_aligned_alloc_exit(struct k_heap *h, size_t align, s
void *ret);
void sys_trace_k_heap_sys_k_malloc_enter(struct k_heap *h, size_t size);
void sys_trace_k_heap_sys_k_malloc_exit(struct k_heap *h, size_t size, void *ret);
void sys_trace_k_heap_sys_k_free_enter(struct k_heap *h);
void sys_trace_k_heap_sys_k_free_exit(struct k_heap *h);
void sys_trace_k_heap_sys_k_free_enter(struct k_heap *h, struct k_heap **heap_ref);
void sys_trace_k_heap_sys_k_free_exit(struct k_heap *h, struct k_heap **heap_ref);
void sys_trace_k_heap_sys_k_calloc_enter(struct k_heap *h, size_t nmemb, size_t size);
void sys_trace_k_heap_sys_k_calloc_exit(struct k_heap *h, size_t nmemb, size_t size, void *ret);

View file

@ -271,8 +271,8 @@ void sys_trace_idle(void);
#define sys_port_trace_k_heap_sys_k_aligned_alloc_exit(heap, ret)
#define sys_port_trace_k_heap_sys_k_malloc_enter(heap)
#define sys_port_trace_k_heap_sys_k_malloc_exit(heap, ret)
#define sys_port_trace_k_heap_sys_k_free_enter(heap)
#define sys_port_trace_k_heap_sys_k_free_exit(heap)
#define sys_port_trace_k_heap_sys_k_free_enter(heap, heap_ref)
#define sys_port_trace_k_heap_sys_k_free_exit(heap, heap_ref)
#define sys_port_trace_k_heap_sys_k_calloc_enter(heap)
#define sys_port_trace_k_heap_sys_k_calloc_exit(heap, ret)