static void check_block(const unsigned char* p, unsigned char b, int n)
{
for (int i = 0; i < n; i++)
- if (p[i] != b)
- xbt_die("value mismatch: %p[%d] = %#hhx, expected %#hhx", p, i, p[i], b);
+ xbt_assert(p[i] == b, "value mismatch: %p[%d] = %#hhx, expected %#hhx", p, i, p[i], b);
}
int main(int argc, char**argv)
XBT_INFO("Allocating a new heap");
unsigned long mask = ~((unsigned long)xbt_pagesize - 1);
auto* addr = reinterpret_cast<void*>(((unsigned long)sbrk(0) + BUFFSIZE) & mask);
- heapA = xbt_mheap_new(-1, addr);
+ heapA = xbt_mheap_new(addr, 0);
if (heapA == nullptr) {
perror("attach 1 failed");
fprintf(stderr, "bye\n");
} catch (const simgrid::Exception&) {
gotit = true;
}
- if (not gotit)
- xbt_die("FAIL: A double-free went undetected (for size:%d)",size_of_block(i));
+ xbt_assert(gotit, "FAIL: A double-free went undetected (for size:%d)", size_of_block(i));
}
XBT_INFO("free again all blocks (to really check that double free are correctly caught)");
} catch (const simgrid::Exception&) {
gotit = true;
}
- if (not gotit)
- xbt_die("FAIL: A double-free went undetected (for size:%d)",size_of_block(i));
+ xbt_assert(gotit, "FAIL: A double-free went undetected (for size:%d)", size_of_block(i));
}
XBT_INFO("Let's try different codepaths for mrealloc");