<div dir="ltr">Oh, I printed the variable value too early. Thanks for your help.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Aug 15, 2020 at 7:24 PM Gedare Bloom <<a href="mailto:gedare@rtems.org">gedare@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sat, Aug 15, 2020 at 3:15 AM Richi Dubey <<a href="mailto:richidubey@gmail.com" target="_blank">richidubey@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> With reference to the code (github link), it aims to check if the Affinty of a node is set to 0 by calling the function _Processor_mask_Is_zero.<br>
><br>
> 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?<br>
><br>
> Gdb trace:<br>
> ----------------------------------------------------------------------<br>
> (gdb)<br>
> 0x00118af4 187 _Processor_mask_Is_set(&node->Affinity, _Per_CPU_Get_index(curr_CPU) ||<br>
> (gdb)<br>
> 0x00118af6 187 _Processor_mask_Is_set(&node->Affinity, _Per_CPU_Get_index(curr_CPU) ||<br>
> (gdb) p &node->Affinity<br>
> $8 = (Processor_mask *) 0x200efc <_Thread_Objects+2172><br>
address 0x200efc<br>
<br>
> (gdb) p node->Affinity<br>
> $9 = {<br>
> __bits = {0}<br>
> }<br>
> (gdb) si<br>
> 0x00118af8 187 _Processor_mask_Is_set(&node->Affinity, _Per_CPU_Get_index(curr_CPU) ||<br>
> (gdb)<br>
> 190 _Processor_mask_Is_zero( &node->Affinity ) )<br>
> (gdb)<br>
> 0x00118afc 190 _Processor_mask_Is_zero( &node->Affinity ) )<br>
> (gdb)<br>
> 0x00118afe 190 _Processor_mask_Is_zero( &node->Affinity ) )<br>
> (gdb)<br>
> 0x00118b00 190 _Processor_mask_Is_zero( &node->Affinity ) )<br>
> (gdb)<br>
> _Processor_mask_Is_zero (mask=0x203580 <_Per_CPU_Information>) at /home/richi/quick-start/src/rtems/cpukit/include/rtems/score/processormask.h:75<br>
> 75 {<br>
> (gdb)<br>
> 0x0011726a 75 {<br>
> (gdb)<br>
> 0x0011726c 75 {<br>
> (gdb) p mask<br>
> $10 = (const Processor_mask *) 0x203580 <_Per_CPU_Information><br>
address 0x203580<br>
<br>
You're not looking at the same memory location<br>
<br>
> (gdb) p *mask<br>
> $11 = {<br>
> __bits = {2126656}<br>
> }<br>
> ------------------------------------------------------------<br>
><br>
> Please provide your views on this.<br>
> Thanks,<br>
> Richi,<br>
> _______________________________________________<br>
> devel mailing list<br>
> <a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div>