perf data: Fix signedness of value
perf data: Fix signedness of value

When converting int values, perf first extractes it to a ulonglong, then
feeds it to babeltrace as a signed value.

For negative 32 bit values (for example, return values of failed
syscalls), the extracted data should be something like 0xfffffffe (-2).
It becomes a large int64 value.

Babeltrace denies to insert it with bt_ctf_field_signed_integer_set_value()
because it is larger than 0x7fffffff, the largest positive value a
 32 bit int can be.

This patch introduces adjust_signedness(), which fills high bits of
ulonglong with 1 if the value is negative.

Signed-off-by: Wang Nan <7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com>
Cc: David Ahern <b80c1600f604d3b0d768f26f90a76757e76005dd@gmail.com>
Cc: Frederic Weisbecker <e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com>
Cc: He Kuang <01189f839f5c53a9f0c5f5c6cb807be9767d9e1e@huawei.com>
Cc: Jeremie Galarneau <b52cfad7f056705b7c5dd5aa2ede3349d79369db@efficios.com>
Cc: Namhyung Kim <5c915a589b3ddf58cebf14bec41bcc143b37ac3c@kernel.org>
Cc: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>
Cc: Peter Zijlstra <645ca7d3a8d3d4f60557176cd361ea8351edc32b@chello.nl>
Cc: Sebastian Andrzej Siewior <265264fed90bdf8e813a354375ec16f47ebdb1c5@linutronix.de>
Cc: Tom Zanussi <ca42f6846873622f2a6dc51a5106ba83ffbdaf95@gmail.com>
Link: 012869591e5d66064947d2aa2891b54ab22ade4b@kernel.org
Signed-off-by: Jiri Olsa <2c6594f608aa3d41e98d48846a6328831f7084ad@kernel.org>
[ s/signess/signedness/g ]
Signed-off-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs