malloc() never returns
Jeff Johnston
jjohnstn@redhat.com
Thu Jun 8 21:37:00 GMT 2006
It appears your static av_ array has been cleared. Perhaps you have
gone too far when clearing the .bss. Track the static av_ array and see
where it ends up after linking as well as what is in it. That array
should be initialized and non-zero by the time you get to main. I don't
have any experience with the v850 platform to give you any other direct
suggestions.
-- Jeff J.
Torsten Mohr wrote:
> Hi,
>
> i use newlib-1.14 for V850E.
>
> In the simulator (insight-weekly-6.5-50) i found out that
> when i do a malloc(1024) as a first step in main() the
> program flow goes to:
>
> malloc(1024)
> _malloc_r(_REENT, 1024)
> ...
> mALLOc(RARG size_t bytes)
>
> In there it hangs in the for() at 2392:
>
> for (victim = last(bin); victim != bin; victim = victim->bk)
> {
> ...
> }
> In the simulator i see that victim is 0x0 and victim->bk is
> also 0x0.
>
> What could i have done wrong to make this fail?
>
> What is strange is that i have set a breakpoint on sbrk(), which
> does not seem to get called before this infinite loop.
>
>
> In my own startup code i do:
> - set up stack, ep, gp, ctbp, r20 and r21
> - clear .bss
> - copy from ROM: .zdata, .sdata and .data
>
> Is there anything missing?
>
>
> Best regards,
> Torsten.
More information about the Newlib
mailing list