Re: kernelshark plugins and ftrace array fields

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2010-09-02 at 17:34 +0300, Avi Kivity wrote:
> On 09/02/2010 05:25 PM, Steven Rostedt wrote:
> > On Thu, 2010-09-02 at 15:19 +0300, Avi Kivity wrote:
> >> I'd like to add enhance kvm_emulate_insn display in kernelshark to
> >> show the disassembly of the instruction being emulated.  However,
> >> pevent_get_field_val() doesn't support arrays (the instruction is
> >> provided in a 15-byte array).
> >>
> >> Can you add support for arrays in the kernelshark API?  With that, it
> >> looks like adding disassembly output to the kvm plugin should be quite
> >> simple.
> >>
> > Sure, I could add a pevent_get_field_array() or something. Could you
> > tell me the event and give me an example of what you want to do.
> 
> plugin_kvm.c:
> 
> kvm_emulate_insn_handler()
> {
>     fetch insn array and len field
>     feed into disassembler
>     trace_seq_printf() the disassembled instruction
> }
> 

OK, with no modification of what I have already, I just created this
handler:

static int
kvm_emulate_insn_handler(struct trace_seq *s, struct record *record,
                         struct event_format *event, void *context)
{
        struct format_field *field;
        unsigned char *data = record->data;
        int i;

        field = pevent_find_field(event, "insn");
        if (!field) {
                trace_seq_puts(s, "Can't find inst field");
                return 0;
        }

        trace_seq_puts(s, "insn: ");
        for (i = 0; i < field->size; i++) {
                trace_seq_printf(s, "%s%02x",
                                 i ? "," : "",
                                 data[field->offset + i]);
        }

        return 0;
}


I think this is what you would want, right?

-- Steve



--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux