Fixed incorrect thread arena output ##debug

When issuing dmha, often times the output
would include thousands of lines saying the
thread arena is 0xffffffffffffff.
This commit introduces a simple check of
GHT_MAX that aborts printing if the thread
arena is equal to that number. I assume
those pointers are incorrect anyway.
This commit is contained in:
Ernest Deák (Tino) 2022-11-20 12:55:12 +01:00 committed by GitHub
parent 6c28822d73
commit f81c7dee37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1413,6 +1413,14 @@ void GH(print_malloc_states)( RCore *core, GHT m_arena, MallocState *main_arena)
while (GH(is_arena) (core, m_arena, ta->GH(next)) && ta->GH(next) != m_arena) {
PRINT_YA ("thread arena @ ");
PRINTF_BA ("0x%"PFMT64x, (ut64)ta->GH(next));
// if the next pointer is equal to unsigned -1 we assume its invalid
// and return. otherwise we get undefined behavior and weird output offten
// times with thousands of lines in the output
// saying thread arenas are at 0xffff... which is obviously incorrect
// related to issue #20767
if (ta->GH(next) == GHT_MAX) {
break;
}
if (!GH(update_main_arena) (core, ta->GH(next), ta)) {
free (ta);
return;