Skip to content

Commit c1d9ab2

Browse files
committed
Add binary representation to all bitvector values in the xml trace
1 parent 069db73 commit c1d9ab2

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/goto-programs/xml_goto_trace.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ Author: Daniel Kroening
2525
#include "structured_trace_util.h"
2626
#include "xml_expr.h"
2727

28-
bool full_lhs_value_includes_binary(
29-
const goto_trace_stept &step,
30-
const namespacet &ns)
31-
{
32-
return can_cast_type<floatbv_typet>(step.full_lhs_value.type());
33-
}
34-
3528
xmlt full_lhs_value(const goto_trace_stept &step, const namespacet &ns)
3629
{
3730
xmlt full_lhs_value{"full_lhs_value"};
@@ -42,11 +35,16 @@ xmlt full_lhs_value(const goto_trace_stept &step, const namespacet &ns)
4235

4336
if(step.full_lhs_value.is_not_nil())
4437
full_lhs_value.data = from_expr(ns, identifier, step.full_lhs_value);
45-
if(full_lhs_value_includes_binary(step, ns))
38+
39+
if(
40+
const auto &type =
41+
type_try_dynamic_cast<bitvector_typet>(step.full_lhs_value.type()))
4642
{
47-
const auto width = to_floatbv_type(step.full_lhs_value.type()).get_width();
48-
const auto binary_representation = integer2binary(
49-
bvrep2integer(step.full_lhs_value.get(ID_value), width, false), width);
43+
const auto &constant =
44+
expr_try_dynamic_cast<constant_exprt>(step.full_lhs_value);
45+
const auto width = type->get_width();
46+
const auto binary_representation =
47+
integer2binary(bvrep2integer(constant->get_value(), width, false), width);
5048
full_lhs_value.set_attribute("binary", binary_representation);
5149
}
5250
return full_lhs_value;

0 commit comments

Comments
 (0)