rt: take into account alignment for debug_opaque. Closes #2667
This commit is contained in:
parent
d67e144f68
commit
c22d0af14c
@ -241,10 +241,13 @@ debug_opaque(type_desc *t, uint8_t *front) {
|
|||||||
rust_task *task = rust_get_current_task();
|
rust_task *task = rust_get_current_task();
|
||||||
LOG(task, stdlib, "debug_opaque");
|
LOG(task, stdlib, "debug_opaque");
|
||||||
debug_tydesc_helper(t);
|
debug_tydesc_helper(t);
|
||||||
// FIXME (#2667) may want to actually account for alignment.
|
|
||||||
// `front` may not indeed be the front byte of the passed-in
|
|
||||||
// argument.
|
|
||||||
for (uintptr_t i = 0; i < t->size; ++front, ++i) {
|
for (uintptr_t i = 0; i < t->size; ++front, ++i) {
|
||||||
|
|
||||||
|
// Account for alignment. `front` may not indeed be the
|
||||||
|
// front byte of the passed-in argument
|
||||||
|
if (((uintptr_t)front % t->align) != 0)
|
||||||
|
front = (uint8_t *)align_to((uintptr_t)front, (size_t)t->align);
|
||||||
|
|
||||||
LOG(task, stdlib, " byte %" PRIdPTR ": 0x%" PRIx8, i, *front);
|
LOG(task, stdlib, " byte %" PRIdPTR ": 0x%" PRIx8, i, *front);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user