Need help in figuring out why gdb gives different value of a variable in callee vs caller context

Richi Dubey richidubey at gmail.com
Sat Aug 15 09:14:24 UTC 2020


Hi,

With reference to the code (github link
<https://github.com/richidubey/rtems/blob/4d93042539911d855699b7fb62c49f8807b5f2bd/cpukit/score/src/schedulerstrongapa.c#L186>),
it aims to check if the Affinty of a node is set to 0 by calling the
function _Processor_mask_Is_zero.

While debugging with gdb, I can see using 'p' command that the variable is
indeed 0 but after the variable gets passed to the function, the value of
the variable isn't 0 anymore. Why is this happening?

Gdb trace:
----------------------------------------------------------------------
(gdb)
0x00118af4 187         _Processor_mask_Is_set(&node->Affinity,
_Per_CPU_Get_index(curr_CPU) ||
(gdb)
0x00118af6 187         _Processor_mask_Is_set(&node->Affinity,
_Per_CPU_Get_index(curr_CPU) ||
(gdb) p &node->Affinity
$8 = (Processor_mask *) 0x200efc <_Thread_Objects+2172>
(gdb) p node->Affinity
$9 = {
  __bits = {0}
}
(gdb) si
0x00118af8 187         _Processor_mask_Is_set(&node->Affinity,
_Per_CPU_Get_index(curr_CPU) ||
(gdb)
190         _Processor_mask_Is_zero( &node->Affinity ) )
(gdb)
0x00118afc 190         _Processor_mask_Is_zero( &node->Affinity ) )
(gdb)
0x00118afe 190         _Processor_mask_Is_zero( &node->Affinity ) )
(gdb)
0x00118b00 190         _Processor_mask_Is_zero( &node->Affinity ) )
(gdb)
_Processor_mask_Is_zero (mask=0x203580 <_Per_CPU_Information>) at
/home/richi/quick-start/src/rtems/cpukit/include/rtems/score/processormask.h:75
75 {
(gdb)
0x0011726a 75 {
(gdb)
0x0011726c 75 {
(gdb) p mask
$10 = (const Processor_mask *) 0x203580 <_Per_CPU_Information>
(gdb) p *mask
$11 = {
  __bits = {2126656}
}
------------------------------------------------------------

Please provide your views on this.
Thanks,
Richi,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200815/a837bed8/attachment.html>


More information about the devel mailing list