-/* Copyright (c) 2008-2021. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2008-2022. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
const Region* heap_region2 = MC_get_heap_region(snapshot2);
// This is the address of std_heap->heapinfo in the application process:
- void* heapinfo_address = &((xbt_mheap_t)process.heap_address)->heapinfo;
+ uint64_t heapinfo_address = process.heap_address.address() + offsetof(s_xbt_mheap_t, heapinfo);
// This is in snapshot do not use them directly:
- const malloc_info* heapinfos1 =
- snapshot1.read<malloc_info*>(RemotePtr<malloc_info*>((std::uint64_t)heapinfo_address));
- const malloc_info* heapinfos2 =
- snapshot2.read<malloc_info*>(RemotePtr<malloc_info*>((std::uint64_t)heapinfo_address));
+ const malloc_info* heapinfos1 = snapshot1.read(remote<malloc_info*>(heapinfo_address));
+ const malloc_info* heapinfos2 = snapshot2.read(remote<malloc_info*>(heapinfo_address));
while (i1 < state.heaplimit) {
const auto* heapinfo1 =
xbt_assert(heapinfo1->type >= 0, "Unknown mmalloc block type: %d", heapinfo1->type);
- void* addr_block1 = ((void*)(((ADDR2UINT(i1)) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase));
+ void* addr_block1 = (ADDR2UINT(i1) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase;
if (heapinfo1->type == MMALLOC_TYPE_UNFRAGMENTED) { /* Large block */
if (is_stack(process, addr_block1)) {
bool match_pairs = false;
// This is the address of std_heap->heapinfo in the application process:
- void* heapinfo_address = &((xbt_mheap_t)process.heap_address)->heapinfo;
+ uint64_t heapinfo_address = process.heap_address.address() + offsetof(s_xbt_mheap_t, heapinfo);
- const malloc_info* heapinfos1 = snapshot1.read(remote((const malloc_info**)heapinfo_address));
- const malloc_info* heapinfos2 = snapshot2.read(remote((const malloc_info**)heapinfo_address));
+ const malloc_info* heapinfos1 = snapshot1.read(remote<malloc_info*>(heapinfo_address));
+ const malloc_info* heapinfos2 = snapshot2.read(remote<malloc_info*>(heapinfo_address));
malloc_info heapinfo_temp1;
malloc_info heapinfo_temp2;
}
// Check if the blocks are already matched together:
- if (state.equals_to_<1>(block1, frag1).valid_ && state.equals_to_<2>(block2, frag2).valid_ && offset1 == offset2 &&
+ if (state.equals_to_<1>(block1, frag1).valid_ && state.equals_to_<2>(block2, frag2).valid_ &&
state.fragmentsEqual(block1, frag1, block2, frag2)) {
if (match_pairs)
state.match_equals(previous);
}
/* Init heap information used in heap comparison algorithm */
- const s_xbt_mheap_t* heap1 = static_cast<xbt_mheap_t>(s1->read_bytes(
- alloca(sizeof(s_xbt_mheap_t)), sizeof(s_xbt_mheap_t), remote(process.heap_address), ReadOptions::lazy()));
- const s_xbt_mheap_t* heap2 = static_cast<xbt_mheap_t>(s2->read_bytes(
- alloca(sizeof(s_xbt_mheap_t)), sizeof(s_xbt_mheap_t), remote(process.heap_address), ReadOptions::lazy()));
+ const s_xbt_mheap_t* heap1 = static_cast<xbt_mheap_t>(
+ s1->read_bytes(alloca(sizeof(s_xbt_mheap_t)), sizeof(s_xbt_mheap_t), process.heap_address, ReadOptions::lazy()));
+ const s_xbt_mheap_t* heap2 = static_cast<xbt_mheap_t>(
+ s2->read_bytes(alloca(sizeof(s_xbt_mheap_t)), sizeof(s_xbt_mheap_t), process.heap_address, ReadOptions::lazy()));
if (state_comparator.initHeapInformation(heap1, heap2, s1->to_ignore_, s2->to_ignore_) == -1) {
XBT_VERB("(%d - %d) Different heap information", s1->num_state_, s2->num_state_);
return false;