Semaphores macro error

Leon Pollak leonp at plris.com
Wed Apr 11 17:43:17 UTC 2007


On Wednesday 11 April 2007, Joel Sherrill wrote:
> Leon Pollak wrote:
> > On Wednesday 11 April 2007, D. Peter Siddons wrote:
> >> Isn't this message issued by gdb itself? i.e. by the host, not the
> >> target? As a result of the 'printf "%s", "No waiting threads"' command?
> >> Pete.
> >
> > Yes, it looks so. But I do not understand how it can cause such an error.
>
> Does changing it to
> printf "No waiting threads"
> without the formatting string help?
>
> It is very weird.
And it seems to me even more weird, because removing "%s" really helps!

OK, now I can understand how this does not work:

When I stop the target (MPC8247) it really does not stop, I mean the CPM 
continues to work and brings the system into the state when it is waiting at 
the "machine check" exception. When this "%s" is processed and calls some 
malloc in the target, it does not receive a valid answer (the target is 
in "machine check" interrupt) and emits this error message.

The remaining thing is - why do they (Who?) call malloc in the target?


> >> Leon Pollak wrote:
> >>> On Wednesday 11 April 2007, you wrote:
> >>>> You can try the ugly hack of commenting out lines or printing until
> >>>> you figure out what
> >>>> is blowing up.  I have no other idea how to debug these scripts. 
> >>>> That's how I did it when I wrote them.
> >>>
> >>> Joel, I do not see any sense in the results I have. Please, can you
> >>> help to interpreter them?
> >>>
> >>> I added prints as following (mine are with "=X=\n":
> >>>
> >>> define rtems_helper_score_threadq
> >>>   set $tq = $arg0
> >>>   set $THREAD_QUEUE_DISCIPLINE_FIFO     = 0
> >>>   set $THREAD_QUEUE_DISCIPLINE_PRIORITY = 1
> >>>
> >>>   if $tq->discipline == $THREAD_QUEUE_DISCIPLINE_FIFO
> >>>     printf "  FIFO - "
> >>>     set $limit = 1
> >>>   end
> >>>
> >>>   if $tq->discipline == $THREAD_QUEUE_DISCIPLINE_PRIORITY
> >>>     printf "  PRIO - "
> >>>     set $limit = 3
> >>>   end
> >>>
> >>>   # now walk them
> >>>   set $count = 0
> >>>   set $pri_index = 0
> >>>   set $queues = &$tq->Queues
> >>> printf "=2=\n"
> >>>   while $pri_index < $limit
> >>>     set $chain = &$queues.Priority[$pri_index]
> >>>     set $ptail = &$chain->permanent_null
> >>> printf "=3=\n"
> >>>     set $next = $chain->first
> >>>     while $next != $ptail
> >>> printf "=4=\n"
> >>>       set $t = (Thread_Control_struct *)$next
> >>>       printf "0x%08x@%d ", $t->Object.id, $t->current_priority
> >>>       set $next = $next->next
> >>>       set $count = $count + 1
> >>>     end
> >>> printf "=5=\n"
> >>>     set $pri_index = $pri_index + 1
> >>>   end
> >>> printf "=6=\n"
> >>>   if $count == 0
> >>> printf "=7=\n"
> >>>     printf "%s", "No waiting threads"
> >>>   end
> >>> printf "=8=\n"
> >>> end
> >>> # Internal Helper Do Not Document
> >>>
> >>> =======================================================================
> >>>=
> >>>
> >>>
> >>> And the result was:
> >>> =====================================================================
> >>>  # | Name |    ID    | Information
> >>> ---+------+----------+-----------------------------------------------
> >>>  1 | LBIO | 1a010001 |   Mutex ###
> >>> INHT UNL=1=
> >>>   PRIO - =2=
> >>> =3=
> >>> =5=
> >>> =3=
> >>> =5=
> >>> =3=
> >>> =5=
> >>> =6=
> >>> =7=
> >>> No memory available to program: call to malloc failed
> >>>
> >>>
> >>> I do not understand this.



-- 
Dr.Leon M.Pollak
    Director
PLR Information Systems Ltd.
Tel.:+972-98657670
Fax.:+972-98657621
Mob.:+972-544739246



More information about the users mailing list