Thanks Andrew, the problem is I am not able to see what is inside the “Ptr” 
(do/while loop), using the debugger. I dumped the registers to see the content 
of the local variables I see only the “count” getting changed but not the “Ptr” 
value.

Anyways will check the List head pointer where it is getting corrupted?

Sai


From: Andrew Fish [mailto:af...@apple.com]
Sent: Tuesday, June 23, 2015 1:41 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] Assertion in Linked list - help


On Jun 23, 2015, at 1:11 PM, Saiprasad Chavali 
<s...@marvell.com<mailto:s...@marvell.com>> wrote:

Hi Andrew,

On the same lines of linked list, what I observed is the assignment of the List 
head pointer (function parameter) to the local variable/temporary is not 
working .
So the do/while loop goes on until the “count” exceed the maximum PCD set 
value. Not sure what is happening, any idea, what could be the cause.


List is the head of the list.

    do {
      Ptr = Ptr->ForwardLink;
      Count++;
    } while ((Ptr != List) && (Count < PcdGet32 (PcdMaximumLinkedListLength)));

The head is a special case. It just contains a pointer to the 1st element in 
the list, ForwardLink, and the last element in the list, BackLink. When you 
initialize the head the ForwareLink, and BackLink both point to the head. The 
head never contains data, only the nodes store data.

Head->ForwardLink --> Node1->ForwardLink --> Node2->ForwardLink --> Head
Head->BackLink --> Node2->BackLink --> Node1->BackLink —> Head.

Since each node has a forward and a back link you can insert and delete without 
traversing the list (assuming the debugging code is turned off).

This is just a basic circularly doubly linked list: 
https://en.wikipedia.org/wiki/Doubly_linked_list

If is stuck in the do/while loop one of the ForwardLink pointers must be bad. 
It should be easy enough to walk the list by hand in the debugger and see what 
operation corrupts it. The Obvious answer would be the list operation before 
the one that ASSERTs is the bad one. Or if the corruption is in your program it 
is likely between the last working call and the failing call.

Thanks,

Andrew Fish


For my debugging I have removed the global optimization flags (Gy, Gl)?

Thanks
Sai



------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to