When generating syscall wrappers, call a tracing macro with the id, name, and all parameters of the syscall as params when entering and leaving the syscall. This can be disabled in certain call sites by defining DISABLE_SYSCALL_TRACING which is useful for certain tracing implementations which require syscalls themselves to work. Notably some syscalls *cannot* be automatically traced this way and headers where exclusions are set are in the gen_syscall.py as notracing. Includes a systemview and test format implementation. Tested with systemview, usb, and uart backends with the string formatter using the tracing sample app. Debugging the trace wrapper can be aided by setting the TRACE_DIAGNOSTIC env var and rebuilding from scratch, a warning is issued for every instance a syscall is traced. Automatically generating a name mapping for SYSVIEW_Zephyr.txt is a future item as is documenting how to capture and use the tracing data generated. Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
21 lines
567 B
C
21 lines
567 B
C
/*
|
|
* Copyright (c) 2021 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef ZEPHYR_TRACING_TEST_SYSCALL_H_
|
|
#define ZEPHYR_TRACING_TEST_SYSCALL_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
void sys_trace_syscall_enter(uint32_t syscall_id, const char *syscall_name);
|
|
void sys_trace_syscall_exit(uint32_t syscall_id, const char *sycall_name);
|
|
|
|
#define sys_port_trace_syscall_enter(id, name, ...) \
|
|
sys_trace_syscall_enter(id, #name)
|
|
|
|
#define sys_port_trace_syscall_exit(id, name, ...) \
|
|
sys_trace_syscall_exit(id, #name)
|
|
|
|
#endif /* ZEPHYR_TRACING_TEST_SYSCALL_H_ */
|