pahole: Fix --skip for variable sized records
We were not honouring 'sizeof=size' with --skip. Before: $ pahole --seek_bytes=0x130 'perf_event_header(sizeof=size,type=type,type_enum=perf_event_type)' --count 5 < perf.data { .type = 0x4f, .misc = 0, .size = 0x20, }, { .type = 0x49, .misc = 0, .size = 0x28, }, { .type = 0x4a, .misc = 0, .size = 0x20, }, { .type = PERF_RECORD_CGROUP, .misc = 0, .size = 0x28, }, { .type = PERF_RECORD_CGROUP, .misc = 0, .size = 0x30, }, $ pahole --seek_bytes=0x130 'perf_event_header(sizeof=size,type=type,type_enum=perf_event_type)' --count 2 --skip 3 < perf.data { .type = 0xcf8532e, .misc = 0xffffffffffff8c52, .size = 0x1, }, { .type = 0x49, .misc = 0, .size = 0x28, }, After: $ pahole --seek_bytes=0x130 'perf_event_header(sizeof=size,type=type,type_enum=perf_event_type)' --count 2 --skip 3 < perf.data { .type = PERF_RECORD_CGROUP, .misc = 0, .size = 0x28, }, { .type = PERF_RECORD_CGROUP, .misc = 0, .size = 0x30, }, $ Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
f4df384d77
commit
a5bb31b86f
4
pahole.c
4
pahole.c
|
@ -1432,7 +1432,7 @@ static int tag__stdio_fprintf_value(struct tag *type, struct cu *cu, FILE *fp)
|
|||
|
||||
if (skip) {
|
||||
--skip;
|
||||
continue;
|
||||
goto next_instance;
|
||||
}
|
||||
|
||||
printed += tag__fprintf_value(type, cu, instance, _sizeof, fp);
|
||||
|
@ -1487,7 +1487,7 @@ static int tag__stdio_fprintf_value(struct tag *type, struct cu *cu, FILE *fp)
|
|||
$
|
||||
|
||||
*/
|
||||
|
||||
next_instance:
|
||||
if (real_sizeof > _sizeof)
|
||||
if (pipe_seek(stdin, real_sizeof - _sizeof))
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue