@@ -19,10 +19,38 @@ Author: Daniel Kroening
1919#include < util/xml_irep.h>
2020
2121#include < langapi/language_util.h>
22+ #include < util/arith_tools.h>
2223
2324#include " printf_formatter.h"
2425#include " xml_expr.h"
2526
27+ bool full_lhs_value_includes_binary (
28+ const goto_trace_stept &step,
29+ const namespacet &ns)
30+ {
31+ return can_cast_type<floatbv_typet>(step.full_lhs_value .type ());
32+ }
33+
34+ xmlt full_lhs_value (const goto_trace_stept &step, const namespacet &ns)
35+ {
36+ xmlt full_lhs_value{" full_lhs_value" };
37+
38+ const auto &lhs_object = step.get_lhs_object ();
39+ const irep_idt identifier =
40+ lhs_object.has_value () ? lhs_object->get_identifier () : irep_idt ();
41+
42+ if (step.full_lhs_value .is_not_nil ())
43+ full_lhs_value.data = from_expr (ns, identifier, step.full_lhs_value );
44+ if (full_lhs_value_includes_binary (step, ns))
45+ {
46+ const auto width = to_floatbv_type (step.full_lhs_value .type ()).get_width ();
47+ const auto binary_representation = integer2binary (
48+ bvrep2integer (step.full_lhs_value .get (ID_value), width, false ), width);
49+ full_lhs_value.set_attribute (" binary" , binary_representation);
50+ }
51+ return full_lhs_value;
52+ }
53+
2654void convert (
2755 const namespacet &ns,
2856 const goto_tracet &goto_trace,
@@ -88,16 +116,13 @@ void convert(
88116 }
89117 }
90118
91- std::string full_lhs_string, full_lhs_value_string ;
119+ std::string full_lhs_string;
92120
93121 if (step.full_lhs .is_not_nil ())
94122 full_lhs_string = from_expr (ns, identifier, step.full_lhs );
95123
96- if (step.full_lhs_value .is_not_nil ())
97- full_lhs_value_string = from_expr (ns, identifier, step.full_lhs_value );
98-
99124 xml_assignment.new_element (" full_lhs" ).data = full_lhs_string;
100- xml_assignment.new_element (" full_lhs_value" ). data = full_lhs_value_string ;
125+ xml_assignment.new_element (full_lhs_value (step, ns)) ;
101126
102127 xml_assignment.set_attribute_bool (" hidden" , step.hidden );
103128 xml_assignment.set_attribute (" thread" , std::to_string (step.thread_nr ));
0 commit comments