and adj = data.$lid:struct_name^"_"^name^"_adjustment"$ in
let offset = Int64.of_int offset
and adj = Int64.of_int adj in
- (* 'addr' is base of the virtual struct *)
- let addr = Int64.sub (Int64.add addr offset) adj in
+
+ (* 'addr' is base of the virtual struct, but when
+ * adding it to the map make sure we don't splat
+ * the real structure (can happen if offset=adj).
+ *)
let map =
- AddrMap.add addr ($str:dest_struct_name$, None) map in
+ if offset <> adj then (
+ let addr = Int64.sub (Int64.add addr offset) adj in
+ AddrMap.add addr ($str:dest_struct_name$, None) map
+ ) else map in
+
+ (* 'dest_addr' is the destination address of
+ * this pointer. It needs the usual list_head
+ * adjustment applied.
+ *)
let dest_addr = Int64.sub dest_addr adj in
let map =
$lid:dest_struct_name^"_follower"$