This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/35284] Branch to 0x0 from Ada run-time



------- Comment #26 from joel at gcc dot gnu dot org  2008-04-01 22:40 -------
(In reply to comment #25)
> The binder will generate a call to Set_Globals

The code is different for the head but the intent is clear. Thanks
for the explanation.

A diff of the generated b~ file for powerpc and i386 only turned up
target path name differences.  So no explanation from this file.

>       Set_Globals
>         (Main_Priority            => -1,
>          Time_Slice_Value         => -1,
>          WC_Encoding              => 'b',
>          Locking_Policy           => ' ',
>          Queuing_Policy           => ' ',
>          Task_Dispatching_Policy  => ' ',

These are the same values for RTEMS.

>          Restrictions             => Restrictions'Address,
>          Interrupt_States         => Interrupt_States'Address,

These are too different to tell.

>          Num_Interrupt_States     => 0,
>          Unreserve_All_Interrupts => 0,
>          Exception_Tracebacks     => 0,
>          Zero_Cost_Exceptions     => 1,
>          Detect_Blocking          => 0);

We have: 

      Num_Interrupt_States := 0;
      Unreserve_All_Interrupts := 0;
      Zero_Cost_Exceptions := 0;
      Detect_Blocking := 0;
      Default_Stack_Size := -1;
      Leap_Seconds_Support := 0;

Which I think is OK.

> That should set the following global in s-taskin.adb:
> 
>    Main_Priority : Integer;
>    pragma Import (C, Main_Priority, "__gl_main_priority");
>    --  Priority for main task. Note that this is of type Integer, not
>    --  Priority, because we use the value -1 to indicate the default
>    --  main priority, and that is of course not in Priority'range.
> 
> Which is checked in System.tasking.initialize
> 
>       --  Initialize Environment Task
> 
>       if Main_Priority = Unspecified_Priority then
>          Base_Priority := Default_Priority;
>       else
>          Base_Priority := Priority (Main_Priority);
>       end if;
> 
> Default_Priority is defined in system-rtems.ads :
> 
>    Default_Priority : constant Priority := 122;

It looks OK.  

What bothers me is this:

#1  0x001007fe in __wrap_pthread_setschedparam (pthread=184614914, policy=0, 
    param=0x177654) at wrap_pthread_setschedparam.c:29
#2  0x0010154b in system.task_primitives.operations.set_priority (t=0x1dbb18, 
    prio=0, loss_of_inheritance=0) at s-taprop.adb:764
#3  0x00104529 in system.tasking.initialize () at s-taskin.adb:188

Notice that the call #2 has priority of 0.  That maps to this call from
s-tasin.adb:188:

      STPO.Set_Priority (T, T.Common.Base_Priority);

Earlier in Initialize_ATCB, the field was set to 122.  I confirmed
it in the subprogram.  But I can't print the T.Common.Base_Priority from gdb 
right before the call to Set_Priority.  So I don't really know if is it
still right.  It 

At this point, I think the global variables are right but somehow the
T.Common.Base_Priority is really not getting set in a way that survives
the return from Initialize_ATCB or it is overwritten in the few lines of 
s-taskin.adb that are between or it is dereferenced wrong.

Any ideas or hints on peeking at the data in gdb would be appreciated.  
Otherwise my next step is probably using the qemu assembly log and see
what I can figure out from that.  Ugly and slow.


> so my advice is breakpoint on the if above and see what happens. double check
> that you compile using the right system.ads.
> 


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]