Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Knowledge about the size of pointer types in DWARF
authorGabriel Corona <gabriel.corona@loria.fr>
Tue, 5 May 2015 13:47:57 +0000 (15:47 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Tue, 5 May 2015 13:47:57 +0000 (15:47 +0200)
Some compilers do not emit DW_AT_byte_size for DW_TAG_pointer_type, so
we fill this. We currently assume that the model-checked process is in
the same architecture.

This fixes the model-checker in clang.

src/mc/mc_dwarf.cpp

index c68e14b..1133efa 100644 (file)
@@ -678,6 +678,12 @@ static dw_type_t MC_dwarf_die_to_type(mc_object_info_t info, Dwarf_Die * die,
 
   type->dw_type_id = MC_dwarf_at_type(die);
 
+  // Some compiler do not emit DW_AT_byte_size for pointer_type,
+  // so we fill this. We currently assume that the model-checked process is in
+  // the same architecture..
+  if (type->type == DW_TAG_pointer_type)
+    type->byte_size = sizeof(void*);
+
   // Computation of the byte_size;
   if (dwarf_hasattr_integrate(die, DW_AT_byte_size))
     type->byte_size = MC_dwarf_attr_integrate_uint(die, DW_AT_byte_size, 0);