libtracevent: Have kvm_exit/enter be able to show guest function
PATCH 1/1 libtracevent: Have kvm_exit/enter be able to show guest function
From: "Steven Rostedt (Google)" <[email protected]>
Add two weak functions tep_plugin_kvm_get_func() and tep_plugin_kvm_put_func() to allow applications that are processing both the host data as well as the guest data, and knows how to map the exit IP address from the guest to an actual function name of the guest.
Instead of showing:
kvm_exit: reason EPT_VIOLATION rip 0xffffffffc01b1f39 info 181 0
show:
kvm_exit: reason EPT_VIOLATION rip 0xffffffffc01b1f39 ipt_do_table+0xe9 info 181 0
Signed-off-by Steven Rostedt (Google) <[email protected]>
--- include/traceevent/event-parse.h | 29 +++++++++++++ plugins/plugin_kvm.c | 74 +++++++++++++++++++++++++++++--- 2 files changed, 98 insertions(+), 5 deletions(-)
include/traceevent/event-parse.h +29 -0
@@ -778,4 +778,33 @@ void tep_set_loglevel(enum tep_loglevel level);void tep_print_field (struct trace_seq *s,void *data,struct tep_format_field *field); + +/* +* Part of the KVM plugin. Will pass the current @event and @record +* as well as a pointer to the address to a guest kernel function. +* This is currently a weak function defined in the KVM plugin and +* should never be called. But a tool can override it, and this will +* be called when the kvm plugin has an address it needs the function +* name of. +* +* This function should return the function name for the given address +* and optionally, it can update @paddr to include the start of the function +* such that the kvm plugin can include an offset. +* +* For an application to be able to override the weak version in the +* plugin, it must be compiled with the gcc -rdynamic option that will +* allow the dynamic linker to use the application's function to +* override this callback. +*/ +const char *tep_plugin_kvm_get_func (struct tep_event *event, +struct tep_record *record, +unsigned long long *paddr); + +/* +* tep_plugin_kvm_put_func() is another weak function that can be used +* to call back into the application if the function name returned by +* tep_plugin_kvm_get_func() needs to be freed. +*/ +void tep_plugin_kvm_put_func (const char *func); +#endif /* _PARSE_EVENTS_H */
plugins/plugin_kvm.c +69 -5
127 lines not on this page · raw message
Signature · 1 line
2.35.1