Closed paulfloyd closed 4 years ago
Just before the assert the value of 'stackmax' is obtained from a call to 'VG(thread_get_stack_max)(vg_created)'
This just returns
return VG_(threads)[tid].client_stack_highest_byte;
'client_stack_highest_byte' gets set from
Both of these rely on 'VG_(am_find_nsegment)(address)'
What address do they use, for 'guess_and_register_stack' its an argument to the function. Doesn't look like this is called for FreeBSD. That takes us back to 'valgrind_main'. That uses 'the_iifii.initial_client_SP'
I had to bodge 'clstack_end' in 'setup_client_stack()' / initimg-freebsd.c. This gets called with 'iicii.clstack_end'. Which is set from
the_iicii.clstackend = VG(am_startup)( the_iicii.sp_at_startup );
Not sure whether my bodge hasn't been applied for valgrind_main and it should apply, or if it has been applied but it shouldn't.
Fixed. VG_(sys_new_thr) wasn't setting stack params.
Looks like many such failures.