mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 18:10:52 +07:00
tracing: probeevent: Add symbol type
Add "symbol" type to probeevent, which is an alias of u32 or u64 (depends on BITS_PER_LONG). This shows the result value in symbol+offset style. This type is only available with kprobe events. Link: http://lkml.kernel.org/r/152465882860.26224.14779072294412467338.stgit@devbox Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
parent
9b960a3883
commit
60c2e0cebf
@ -72,6 +72,8 @@ offset, and container-size (usually 32). The syntax is::
|
|||||||
|
|
||||||
b<bit-width>@<bit-offset>/<container-size>
|
b<bit-width>@<bit-offset>/<container-size>
|
||||||
|
|
||||||
|
Symbol type('symbol') is an alias of u32 or u64 type (depends on BITS_PER_LONG)
|
||||||
|
which shows given pointer in "symbol+offset" style.
|
||||||
For $comm, the default type is "string"; any other type is invalid.
|
For $comm, the default type is "string"; any other type is invalid.
|
||||||
|
|
||||||
|
|
||||||
|
@ -4626,7 +4626,7 @@ static const char readme_msg[] =
|
|||||||
"\t args: <name>=fetcharg[:type]\n"
|
"\t args: <name>=fetcharg[:type]\n"
|
||||||
"\t fetcharg: %<register>, @<address>, @<symbol>[+|-<offset>],\n"
|
"\t fetcharg: %<register>, @<address>, @<symbol>[+|-<offset>],\n"
|
||||||
"\t $stack<index>, $stack, $retval, $comm\n"
|
"\t $stack<index>, $stack, $retval, $comm\n"
|
||||||
"\t type: s8/16/32/64, u8/16/32/64, x8/16/32/64, string,\n"
|
"\t type: s8/16/32/64, u8/16/32/64, x8/16/32/64, string, symbol,\n"
|
||||||
"\t b<bit-width>@<bit-offset>/<container-size>\n"
|
"\t b<bit-width>@<bit-offset>/<container-size>\n"
|
||||||
#endif
|
#endif
|
||||||
" events/\t\t- Directory containing all trace event subsystems:\n"
|
" events/\t\t- Directory containing all trace event subsystems:\n"
|
||||||
|
@ -46,6 +46,13 @@ DEFINE_BASIC_PRINT_TYPE_FUNC(x16, u16, "0x%x")
|
|||||||
DEFINE_BASIC_PRINT_TYPE_FUNC(x32, u32, "0x%x")
|
DEFINE_BASIC_PRINT_TYPE_FUNC(x32, u32, "0x%x")
|
||||||
DEFINE_BASIC_PRINT_TYPE_FUNC(x64, u64, "0x%Lx")
|
DEFINE_BASIC_PRINT_TYPE_FUNC(x64, u64, "0x%Lx")
|
||||||
|
|
||||||
|
int PRINT_TYPE_FUNC_NAME(symbol)(struct trace_seq *s, void *data, void *ent)
|
||||||
|
{
|
||||||
|
trace_seq_printf(s, "%pS", (void *)*(unsigned long *)data);
|
||||||
|
return !trace_seq_has_overflowed(s);
|
||||||
|
}
|
||||||
|
const char PRINT_TYPE_FMT_NAME(symbol)[] = "%pS";
|
||||||
|
|
||||||
/* Print type function for string type */
|
/* Print type function for string type */
|
||||||
int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s, void *data, void *ent)
|
int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s, void *data, void *ent)
|
||||||
{
|
{
|
||||||
@ -79,6 +86,7 @@ static const struct fetch_type probe_fetch_types[] = {
|
|||||||
ASSIGN_FETCH_TYPE_ALIAS(x16, u16, u16, 0),
|
ASSIGN_FETCH_TYPE_ALIAS(x16, u16, u16, 0),
|
||||||
ASSIGN_FETCH_TYPE_ALIAS(x32, u32, u32, 0),
|
ASSIGN_FETCH_TYPE_ALIAS(x32, u32, u32, 0),
|
||||||
ASSIGN_FETCH_TYPE_ALIAS(x64, u64, u64, 0),
|
ASSIGN_FETCH_TYPE_ALIAS(x64, u64, u64, 0),
|
||||||
|
ASSIGN_FETCH_TYPE_ALIAS(symbol, ADDR_FETCH_TYPE, ADDR_FETCH_TYPE, 0),
|
||||||
|
|
||||||
ASSIGN_FETCH_TYPE_END
|
ASSIGN_FETCH_TYPE_END
|
||||||
};
|
};
|
||||||
|
@ -145,6 +145,7 @@ DECLARE_BASIC_PRINT_TYPE_FUNC(x32);
|
|||||||
DECLARE_BASIC_PRINT_TYPE_FUNC(x64);
|
DECLARE_BASIC_PRINT_TYPE_FUNC(x64);
|
||||||
|
|
||||||
DECLARE_BASIC_PRINT_TYPE_FUNC(string);
|
DECLARE_BASIC_PRINT_TYPE_FUNC(string);
|
||||||
|
DECLARE_BASIC_PRINT_TYPE_FUNC(symbol);
|
||||||
|
|
||||||
/* Default (unsigned long) fetch type */
|
/* Default (unsigned long) fetch type */
|
||||||
#define __DEFAULT_FETCH_TYPE(t) x##t
|
#define __DEFAULT_FETCH_TYPE(t) x##t
|
||||||
@ -152,6 +153,10 @@ DECLARE_BASIC_PRINT_TYPE_FUNC(string);
|
|||||||
#define DEFAULT_FETCH_TYPE _DEFAULT_FETCH_TYPE(BITS_PER_LONG)
|
#define DEFAULT_FETCH_TYPE _DEFAULT_FETCH_TYPE(BITS_PER_LONG)
|
||||||
#define DEFAULT_FETCH_TYPE_STR __stringify(DEFAULT_FETCH_TYPE)
|
#define DEFAULT_FETCH_TYPE_STR __stringify(DEFAULT_FETCH_TYPE)
|
||||||
|
|
||||||
|
#define __ADDR_FETCH_TYPE(t) u##t
|
||||||
|
#define _ADDR_FETCH_TYPE(t) __ADDR_FETCH_TYPE(t)
|
||||||
|
#define ADDR_FETCH_TYPE _ADDR_FETCH_TYPE(BITS_PER_LONG)
|
||||||
|
|
||||||
#define __ASSIGN_FETCH_TYPE(_name, ptype, ftype, _size, sign, _fmttype) \
|
#define __ASSIGN_FETCH_TYPE(_name, ptype, ftype, _size, sign, _fmttype) \
|
||||||
{.name = _name, \
|
{.name = _name, \
|
||||||
.size = _size, \
|
.size = _size, \
|
||||||
@ -160,13 +165,14 @@ DECLARE_BASIC_PRINT_TYPE_FUNC(string);
|
|||||||
.fmt = PRINT_TYPE_FMT_NAME(ptype), \
|
.fmt = PRINT_TYPE_FMT_NAME(ptype), \
|
||||||
.fmttype = _fmttype, \
|
.fmttype = _fmttype, \
|
||||||
}
|
}
|
||||||
|
#define _ASSIGN_FETCH_TYPE(_name, ptype, ftype, _size, sign, _fmttype) \
|
||||||
|
__ASSIGN_FETCH_TYPE(_name, ptype, ftype, _size, sign, #_fmttype)
|
||||||
#define ASSIGN_FETCH_TYPE(ptype, ftype, sign) \
|
#define ASSIGN_FETCH_TYPE(ptype, ftype, sign) \
|
||||||
__ASSIGN_FETCH_TYPE(#ptype, ptype, ftype, sizeof(ftype), sign, #ptype)
|
_ASSIGN_FETCH_TYPE(#ptype, ptype, ftype, sizeof(ftype), sign, ptype)
|
||||||
|
|
||||||
/* If ptype is an alias of atype, use this macro (show atype in format) */
|
/* If ptype is an alias of atype, use this macro (show atype in format) */
|
||||||
#define ASSIGN_FETCH_TYPE_ALIAS(ptype, atype, ftype, sign) \
|
#define ASSIGN_FETCH_TYPE_ALIAS(ptype, atype, ftype, sign) \
|
||||||
__ASSIGN_FETCH_TYPE(#ptype, ptype, ftype, sizeof(ftype), sign, #atype)
|
_ASSIGN_FETCH_TYPE(#ptype, ptype, ftype, sizeof(ftype), sign, atype)
|
||||||
|
|
||||||
#define ASSIGN_FETCH_TYPE_END {}
|
#define ASSIGN_FETCH_TYPE_END {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user