Someone will have to find the bug in gcc-3.2.1->gcc-3.2.3 causingtickerto crash for pc386

Joel Sherrill joel.sherrill at OARcorp.com
Thu Apr 3 18:41:36 UTC 2003



Valette Eric wrote:
> 
> Joel Sherrill wrote:
> >
> > Valette Eric wrote:
> >
> >>Valette Eric wrote:
> >>
> >>
> >>>Putting printk and using bochs, I can say the init thread is running
> >>>doing the task create, the task start but the newly created ticker
> >>>threads are not even started... The crash seems to occur in the middle
> >>>of the context switch. Just to be sure that it is not due to an irq, I
> >>>added a asm volatile ("sti") in the init thread and it continue its
> >>>execution up to the task delete itself...
> >>
> >>OK. I've done my debugging part. I know what is wrong even if I still do
> >>not know why. When the ticker thread are created, 3 minimal context are
> >>created with _Thread_Handler as the entry point. When doing task delete,
> >>the first context is used (correct address, correct esp, ebp) when
> >>calling _Context_Switch but unfortunately, EIP is already corrupted.
> >>Note that I added a lot of printk wihtout making the problem disappear
> >>so it means, is surely not a wrong pointer thing...
> >>
> >>Now, the game is to find what part of the code corrupts it...
> >
> >
> > Thanks for the Bochs screen dump Eric.  I wonder if someone is blowing
> > a stack.  I noticed something that might help but don't know where it
> > would have happened.  Notice the PC is 0x3216.  That is very similar to
> > the flags register.  Here are the initial values:
> >
> > #define CPU_EFLAGS_INTERRUPTS_ON  0x00003202
> > #define CPU_EFLAGS_INTERRUPTS_OFF 0x00003002
> 
> I found the bug :-) The libc task init extension was causing the problem
> because of code I would not even comment...

Comment please. :)  This particular line of code hasn't changed since
the newlib 1.5 or newlib 1.6 timeframe (ages ago).  What broke this 
time?

> --
>     __
>    /  `                         Eric Valette
>   /--   __  o _.                6 rue Paul Le Flem
> (___, / (_(_(__                 35740 Pace
> 
> Tel: +33 (0)2 99 85 26 76       Fax: +33 (0)2 99 85 26 76
> E-mail: eric.valette at free.fr
> 
>   ------------------------------------------------------------------------
> *** rtems-4.6.0pre1/cpukit/libcsupport/src/newlibc.c~   Thu Oct 31 21:16:34 2002
> --- rtems-4.6.0pre1/cpukit/libcsupport/src/newlibc.c    Thu Apr  3 18:10:07 2003
> ***************
> *** 128,134 ****
> 
>   #ifdef __GNUC__
>     /* GCC extension: structure constants */
> !   *ptr = (struct _reent) _REENT_INIT((*ptr));
>   #else
>     /*
>      *  WARNING: THIS IS VERY DEPENDENT ON NEWLIB!!!
> --- 128,134 ----
> 
>   #ifdef __GNUC__
>     /* GCC extension: structure constants */
> !   _REENT_INIT_PTR((ptr));
>   #else
>     /*
>      *  WARNING: THIS IS VERY DEPENDENT ON NEWLIB!!!

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985



More information about the users mailing list