in cbmc_viewer/tracet.py [0:0]
def parse_json_assignment(step, root=None):
"""Parse an assignment step of a json trace."""
akind = step.get('assignmentType')
kind = ('variable-assignment' if akind == 'variable' else
'parameter-assignment' if akind == 'actual-parameter' else None)
if kind is None:
raise UserWarning("Unknown json assignment type: {}".format(akind))
# &v is represented as {name: pointer, data: v}
# NULL is represented as {name: pointer, data: {((basetype *)NULL)}}
data = step['value'].get('data')
if step['value'].get('name') == 'pointer' and data and 'NULL' not in data:
data = '&{}'.format(data)
return {
'kind': kind,
'location': srcloct.json_srcloc(
step.get('sourceLocation'), root
),
'detail': {
'lhs': step['lhs'],
'lhs-lexical-scope': None,
# jason data could be the boolean value true or false -> string
'rhs-value': str(data if data is not None else json.dumps(step['value'])),
'rhs-binary': binary_as_bytes(step['value'].get('binary'))
}
}