I use babeltrace2 python bindings to parse some traces that were written by LTTNG. I have a simple code, like this:
import bt2
path = argv[1]
for msg in bt2.TraceCollectionMessageIterator(path):
if type(msg) is not bt2._EventMessageConst:
continue
event = msg.event
payload = event.payload_field
for arg_name in payload:
print("{} = {}".format(arg_name, payload[arg_name]))
I have a trace line that when I print with babeltrace cli I get:
[16:31:48.244238766] prov1:event1: { cpu_id = 31 }, { ptr_value = 0x444 }
But the result of my code is:
ptr_value = 1092
I understand that this of course is happening because the value is an integer and is not presented as hex. But the format I set in LTTNG is hex and I want to present it as such in my script as well.
Is there a way to understand the correct format the value was defined with in the LTTNG trace? I assume this info must be available, because the babeltrace cli tool is able to understand that, but I don’t see it anywhere in the python binding API.