mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-04 16:43:40 +01:00
Add a function to decode argument types with the help of BTF. Will be used to display arguments in the function and function graph tracer. It can only handle simply arguments and up to FTRACE_REGS_MAX_ARGS number of arguments. When it hits a max, it will print ", ...": page_to_skb(vi=0xffff8d53842dc980, rq=0xffff8d53843a0800, page=0xfffffc2e04337c00, offset=6160, len=64, truesize=1536, ...) And if it hits an argument that is not recognized, it will print the raw value and the type of argument it is: make_vfsuid(idmap=0xffffffff87f99db8, fs_userns=0xffffffff87e543c0, kuid=0x0 (STRUCT)) __pti_set_user_pgtbl(pgdp=0xffff8d5384ab47f8, pgd=0x110e74067 (STRUCT)) Cc: Mark Rutland <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Albert Ou <[email protected]> Cc: Guo Ren <[email protected]> Cc: Donglin Peng <[email protected]> Cc: Zheng Yejian <[email protected]> Link: https://lore.kernel.org/[email protected] Reviewed-by: Masami Hiramatsu (Google) <[email protected]> Co-developed-by: Steven Rostedt (Google) <[email protected]> Signed-off-by: Sven Schnelle <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
44 lines
1.4 KiB
C
44 lines
1.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LINUX_FTRACE_REGS_H
|
|
#define _LINUX_FTRACE_REGS_H
|
|
|
|
/*
|
|
* For archs that just copy pt_regs in ftrace regs, it can use this default.
|
|
* If an architecture does not use pt_regs, it must define all the below
|
|
* accessor functions.
|
|
*/
|
|
#ifndef HAVE_ARCH_FTRACE_REGS
|
|
struct __arch_ftrace_regs {
|
|
struct pt_regs regs;
|
|
};
|
|
|
|
#define arch_ftrace_regs(fregs) ((struct __arch_ftrace_regs *)(fregs))
|
|
|
|
struct ftrace_regs;
|
|
|
|
#define ftrace_regs_get_instruction_pointer(fregs) \
|
|
instruction_pointer(&arch_ftrace_regs(fregs)->regs)
|
|
#define ftrace_regs_get_argument(fregs, n) \
|
|
regs_get_kernel_argument(&arch_ftrace_regs(fregs)->regs, n)
|
|
#define ftrace_regs_get_stack_pointer(fregs) \
|
|
kernel_stack_pointer(&arch_ftrace_regs(fregs)->regs)
|
|
#define ftrace_regs_get_return_value(fregs) \
|
|
regs_return_value(&arch_ftrace_regs(fregs)->regs)
|
|
#define ftrace_regs_set_return_value(fregs, ret) \
|
|
regs_set_return_value(&arch_ftrace_regs(fregs)->regs, ret)
|
|
#define ftrace_override_function_with_return(fregs) \
|
|
override_function_with_return(&arch_ftrace_regs(fregs)->regs)
|
|
#define ftrace_regs_query_register_offset(name) \
|
|
regs_query_register_offset(name)
|
|
#define ftrace_regs_get_frame_pointer(fregs) \
|
|
frame_pointer(&arch_ftrace_regs(fregs)->regs)
|
|
|
|
#endif /* HAVE_ARCH_FTRACE_REGS */
|
|
|
|
/* This can be overridden by the architectures */
|
|
#ifndef FTRACE_REGS_MAX_ARGS
|
|
# define FTRACE_REGS_MAX_ARGS 6
|
|
#endif
|
|
|
|
#endif /* _LINUX_FTRACE_REGS_H */
|