Inconsistent datatype in args
p8nut opened this issue · comments
may be link with #5
seem that if there is more than one element in an array int
s are not parsed
(if there is only one int
it is parsed)
here a strace of a program with a select
> ./strace a.out
select(255, [0], [1 2], [0 1 2], {tv_sec=0, tv_usec=962357}) = 2 (out [1 2], left {tv_sec=0, tv_usec=962344})
which will produce
{
"syscall": "select",
"args": [
255,
[
0
],
[
"1",
"2"
],
[
"0",
"1",
"2"
],
{
"tv_sec": 0,
"tv_usec": 962357
}
],
"result": "2 (out [1 2], left {tv_sec=0, tv_usec=962344})",
"timing": null,
"pid": null,
"type": "SYSCALL"
}
if we look at the args array, the second parameter is an array of integer but the third parameter is an array of strings.
Thanks for this module it's really useful.
i might have find a solution but it's not really a nice one ...
in the select when you have an array, elements are not separated by comma.
so in the grammar, i change that:
array_elements
= (
head:data_structure
tail:(',' _ value:data_structure { return value; })*
{ return [head].concat(tail); }
)?
by (replace ',' by ' ') :
array_elements
= (
head:data_structure
tail:(' ' _ value:data_structure { return value; })*
{ return [head].concat(tail); }
)?
and it seem to work, all the int
s are parsed now.
but i think there might have a lot of side effect with this way.