Possible Bug in

Joel Sherrill joel at rtems.org
Wed Dec 16 20:01:14 UTC 2020


Hi

The context switch recorder code -- _Record_Thread_switch in
record-userext.c has this code:

  items[ 0 ].event = RTEMS_RECORD_THREAD_SWITCH_OUT;
  items[ 0 ].data = executing->Object.id;
  items[ 1 ].event = RTEMS_RECORD_THREAD_STACK_CURRENT;
  items[ 1 ].data =
#if defined(__GNUC__)
    (uintptr_t) __builtin_frame_address( 0 )
      - (uintptr_t) executing->Start.Initial_stack.area;

There isn't a comment about what items[1].data is supposed to be but I am
assuming it is intended to be stack used. Unfortunately, it doesn't
conditionalize on stack growing up or down. On the ARM, the stack grows
down This means on the ARM, it is stack memory remaining.

I think this needs a comment as to the intent and then some conditional
logic on CPU_STACK_GROWS_UP like the stack checker has.

Anyone know what the meaning of the value should be? I suppose remaining is
good for quick monitoring if the size is captured on say create.

Thanks.

--joel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20201216/00cadfe6/attachment.html>


More information about the devel mailing list