Need help in figuring out why gdb gives different value of a variable in callee vs caller context
Richi Dubey
richidubey at gmail.com
Sun Aug 16 17:33:38 UTC 2020
Hi,
The gdb trace above refers to this
<https://github.com/richidubey/rtems/blob/c3162134d3fd7d4d46ec01609d81bdb62bc818af/cpukit/score/src/schedulerstrongapa.c#L187>
code
where the items in all_Nodes chain are checked. The items in the chain are
getting inserted here
<https://github.com/richidubey/rtems/blob/c3162134d3fd7d4d46ec01609d81bdb62bc818af/cpukit/score/src/schedulerstrongapa.c#L772>,
before which on line 763, the Affinity of the items is set to all the
online processors. Why does the gdb show the Affinity of the node as 0
then? How is this possible? Please advise.
On Sun, Aug 16, 2020 at 5:48 PM Richi Dubey <richidubey at gmail.com> wrote:
> Oh, I printed the variable value too early. Thanks for your help.
>
> On Sat, Aug 15, 2020 at 7:24 PM Gedare Bloom <gedare at rtems.org> wrote:
>
>> On Sat, Aug 15, 2020 at 3:15 AM Richi Dubey <richidubey at gmail.com> wrote:
>> >
>> > Hi,
>> >
>> > 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.
>> >
>> > 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>
>> address 0x200efc
>>
>> > (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>
>> address 0x203580
>>
>> You're not looking at the same memory location
>>
>> > (gdb) p *mask
>> > $11 = {
>> > __bits = {2126656}
>> > }
>> > ------------------------------------------------------------
>> >
>> > Please provide your views on this.
>> > Thanks,
>> > Richi,
>> > _______________________________________________
>> > devel mailing list
>> > devel at rtems.org
>> > http://lists.rtems.org/mailman/listinfo/devel
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200816/12acbf0f/attachment-0001.html>
More information about the devel
mailing list