[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 4/4] tests/tcg: add HeapInfo checking to semihosting test
From: |
Keith Packard |
Subject: |
Re: [PATCH v2 4/4] tests/tcg: add HeapInfo checking to semihosting test |
Date: |
Tue, 09 Mar 2021 09:08:57 -0800 |
Alex Bennée <alex.bennee@linaro.org> writes:
> + asprintf(&heap_info, "heap: %p -> %p\n", info.heap_base,
> info.heap_limit);
> + __semi_call(SYS_WRITE0, (uintptr_t) heap_info);
> + if (info.heap_base != brk) {
That requires qemu to know a lot about the run-time environment, which
it rarely does in my experience of embedded systems...
All I've been able to check is whether the heap base is not below the
heap limit and the stack base is not above the stack limit. Not exactly
great validation, but at least it caught the case where I set the stack
limit to the top of the stack?
if (block.heap_base != NULL && block.heap_limit != NULL) {
/* Error if heap base is above limit */
if ((uintptr_t) block.heap_base >= (uintptr_t)
block.heap_limit) {
printf("heap base %p >= heap_limit %p\n",
block.heap_base, block.heap_limit);
exit(1);
}
}
if (block.stack_base != NULL && block.stack_limit != NULL) {
/* Error if stack base is below limit */
if ((uintptr_t) block.stack_base < (uintptr_t)
block.stack_limit) {
printf("stack base %p < stack_limit %p\n",
block.stack_base, block.stack_limit);
exit(2);
}
}
exit(0);
--
-keith
signature.asc
Description: PGP signature