> >-----Original Message----- >From: Steven Rostedt <rostedt@xxxxxxxxxxx> >Sent: Friday, January 14, 2022 3:10 AM >To: Chen, Hongzhan <hongzhan.chen@xxxxxxxxx> >Cc: linux-trace-devel@xxxxxxxxxxxxxxx" <linux-trace-devel@xxxxxxxxxxxxxxx>, Kiszka; Jan <jan.kiszka@xxxxxxxxxxx> >Subject: Re: [Questions][trace-cmd/libtraceevent] how to correctly parse info out from specifial format of event? > >On Thu, 13 Jan 2022 08:20:16 +0000 >"Chen, Hongzhan" <hongzhan.chen@xxxxxxxxx> wrote: > >> When I tried to analysis trace log that captured from xenomai system with kernelshark, I found >> that it report "FAILED TO PARSE" for some events. These events have format like [1]. >> In trace, these events would be printed like [2]. >> At first, I was trying to develop new libtraceevent plugin to parse this event correctly. >> When I refer to code plugins/plugin_mac80211.c of libtraceevent to parse field param_ex >> out for this __data_loc type of data, I always get value 0x380018 and It is supposed to trace_seq_printf >> 0x38 size of string got from offset 0x18 of tep_record->data but it fail. After debug, I found >> that the data start from offset 0x18 is not what we expect and first few bytes of data is like [3]. >> > >Could show me a full binary dump of the data for the record in your plugin? > >That is, something like this: > >tep_register_event_handler(tep, -1, "cobalt_posix", > "cobalt_pthread_create", > dump_event, NULL); > > >static int dump_event(struct trace_seq *s, > struct tep_record *record, > struct tep_event *event, void *context) >{ > unsigned char c; > int i; > > for (i = 0; i < record->size; i++) { > c = *(unsigned char *)(record->data + i); > trace_seq_printf(s, "%02x", c); > if (i < record->size - 1) { > if ((i & 0x7) == 7) > trace_seq_puts(s, " "); > else > trace_seq_putc(s, ' '); > } > } > return 0; >} > Following is two dumps, please check: smokey-447 [000] 320.193156: cobalt_pthread_create: 74 02 00 00 bf 01 00 00 40 37 4b aa ab 7f 00 00 00 00 00 00 18 00 38 00 00 00 00 00 fe 7f 00 00 60 c3 24 90 ff ff ff ff 5c 81 21 90 ff ff ff ff d8 bd 8c 80 90 c1 ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 smokey-449 [000] 320.196623: cobalt_pthread_create: 74 02 00 00 c1 01 00 00 00 e7 6e a9 ab 7f 00 00 01 00 00 00 18 00 38 00 01 00 00 00 30 00 00 00 20 7c 82 77 fe 7f 00 00 60 7b 82 77 fe 7f 00 00 00 2b 89 18 55 a6 fa ba 40 37 4b aa ab 7f 00 00 3e 3d e2 00 7f 55 00 00 d0 7b 82 77 fe 7f 00 00 Regards Hongzhan Chen > >Thanks, > >-- Steve