------- Comment #15 from joel at gcc dot gnu dot org  2008-02-22 21:56 -------
(In reply to comment #14)
> Default values come from ada/s-parame-rtems.adb, for the stack it ends up in
> RTEMS ada_pthread_minimum_stack_size:
> 
> package body System.Parameters is
> 
>    function ada_pthread_minimum_stack_size return Interfaces.C.size_t;
>    pragma Import (C, ada_pthread_minimum_stack_size,
>      "_ada_pthread_minimum_stack_size");

This is called twice on powerpc and i386 and both appear to be from the 
same backtrace.  The first is where the rtems_init.c creates the ada_main
thread.  The second back traces to here:

#0  _ada_pthread_minimum_stack_size ()
    at ../../../../../../../423/rtems/c/src/../../cpukit/libgnat/adasupp.c:24
#1  0x001040a7 in system.tasking.initialize_atcb (self_id=0x1dda08, 
    task_entry_point=0x1752ce, task_arg=1528516, parent=0x1dda08, 
    elaborated=0x1752cd, base_priority=0, task_info=2, stack_size=-2147483648, 
    t=0x1de1f4) at s-taskin.adb:136
#2  0x0010577e in system.tasking.stages.create_task (priority=-1, 
    size=-2147483648, task_info=2, num_entries=0, master=4, state=0x1752ce, 
    discriminants=1528516, elaborated=0x1752cd, [EMAIL PROTECTED], task_image=
      {P_ARRAY = 0x138948, P_BOUNDS = 0x138954}, created_task=0x0)
    at s-tassta.adb:605
#3  0x001005d7 in t () at t.adb:3

> 
>    ------------------------
>    -- Default_Stack_Size --
>    ------------------------
> 
>    function Default_Stack_Size return Size_Type is
>    begin
>       return Size_Type (ada_pthread_minimum_stack_size);
>    end Default_Stack_Size;
> ...
> 
> In ada/s-tassta.adb above line 333 you should be able to trace where Priority
> and Stack_Size come from, compare between the two targets:
> 
>       --  Activate all the tasks in the chain. Creation of the thread of
>       --  control was deferred until activation. So create it now.
> 
>       C := Chain_Access.T_ID;
>       while C /= null loop
>          if C.Common.State /= Terminated then
>             pragma Assert (C.Common.State = Unactivated);
> 
>             P := C.Common.Parent;
>             Write_Lock (P);
>             Write_Lock (C);
> 
>             if C.Common.Base_Priority < Get_Priority (Self_ID) then
>                Activate_Prio := Get_Priority (Self_ID);
>             else
>                Activate_Prio := C.Common.Base_Priority;
>             end if;

Both powerpc and i386 take the else path.

Breakpoint 1, system.tasking.stages.activate_tasks (chain_access=0x1752c8)
    at s-tassta.adb:332
332                 if C.Common.Base_Priority < Get_Priority (Self_ID) then
(gdb) n
335                    Activate_Prio := C.Common.Base_Priority;
(gdb) 
338                 System.Task_Primitives.Operations.Create_Task


>             System.Task_Primitives.Operations.Create_Task
>               (C, Task_Wrapper'Address,
>                Parameters.Size_Type
>                  (C.Common.Compiler_Data.Pri_Stack_Info.Size),
>                Activate_Prio, Success);
> ...
> 

I haven't had much luck dereferencing the C.Common stuff or figuring out where
it is. 

FWIW this is pretty easy to debug with qemu, a 1.44 MB floppy file, and the
executable.  I double checked and you can even use the native Fedora 8 gdb.
qemu speaks gdb remote protocol.  

Sorry for not having more information.  I checked and at the end of the
run, each RTEMS thread control block shows an RTEMS native priority of
253 (255 being lowest natively).  On the PowerPC the threads have a native
priority of 133 which is in the middle of the 1-254 range.  I have no idea
why it is pulling a 0 out of the air. :(


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35284

Reply via email to