crashanalysercmd/Libraries/Engine/CrashDebuggerLib/Parsers/State/Implementation/Helpers/HelperDMsgQueue.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 using System;
       
    19 using System.Collections.Generic;
       
    20 using System.Text;
       
    21 using SymbianParserLib.Engine;
       
    22 using CrashDebuggerLib.Structures.KernelObjects;
       
    23 using CrashDebuggerLib.Structures.MessageQueue;
       
    24 using CrashDebuggerLib.Structures.CodeSeg;
       
    25 using SymbianParserLib.Elements;
       
    26 using SymbianParserLib.Enums;
       
    27 using SymbianParserLib.BaseStructures;
       
    28 
       
    29 namespace CrashDebuggerLib.Parsers.State.Implementation.Helpers
       
    30 {
       
    31     internal class HelperDMsgQueue : HelperDObject
       
    32     {
       
    33         #region Constructors
       
    34         public HelperDMsgQueue()
       
    35         {
       
    36         }
       
    37         #endregion
       
    38 
       
    39         #region API
       
    40         public void CreateMonitorMessageQueue( ParserEngine aEngine, string aName, DMsgQueue aQueue )
       
    41         {
       
    42             ParserParagraph para0 = base.CreateMonitorObjectParagraph( aName, aQueue );
       
    43             aEngine.Add( para0 );
       
    44             ParserParagraph para1 = CreateMessageQueueCommon( aName, aQueue );
       
    45             aEngine.Add( para1 );
       
    46         }
       
    47         #endregion
       
    48 
       
    49         #region Call-back methods
       
    50         public void SetMessageQueueState( ParserLine aLine, ParserFieldName aFieldName, string aState )
       
    51         {
       
    52             System.Diagnostics.Debug.Assert( aLine.Tag is DMsgQueue );
       
    53             DMsgQueue queue = (DMsgQueue) aLine.Tag;
       
    54             DMsgQueue.TQueueState state = DMsgQueue.StateByString( aState );
       
    55             queue.State = state;
       
    56         }
       
    57         #endregion
       
    58 
       
    59         #region Internal methods
       
    60         private ParserParagraph CreateMessageQueueCommon( string aName, DMsgQueue aQueue )
       
    61         {
       
    62             ParserParagraph para = new ParserParagraph( aName );
       
    63             //
       
    64             ParserLine l1 = ParserLine.NewSymFormat( "StartOfPool %08x, EndOfPool %08x\r\n" );
       
    65             l1.SetTargetProperties( aQueue.PoolInfo, "Start", "End" );
       
    66             //
       
    67             ParserLine l2 = ParserLine.NewSymFormat( "FirstFullSlot %08x, FirstFreeSlot %08x\r\n" );
       
    68             l2.SetTargetProperties( aQueue.SlotInfo, "FirstFull", "FirstFree" );
       
    69             //
       
    70             ParserLine l3 = ParserLine.NewSymFormat( "MaxMsgLength %d\r\n" );
       
    71             l3.SetTargetProperties( aQueue, "MaxMessageLength" );
       
    72             //
       
    73             ParserLine l4 = ParserLine.NewSymFormat( "MessageQueue state %S" );
       
    74             l4.Tag = aQueue;
       
    75             l4.SetTargetMethod( this, "SetMessageQueueState" );
       
    76             //
       
    77             ParserLine l5 = ParserLine.NewSymFormat( "ThreadWaitingForData %08x, DataAvailStatPtr %08x\r\n" );
       
    78             l5.SetTargetProperties( new object[] { aQueue.WaitData, aQueue.WaitData.RequestStatus }, "WaitingThreadAddress", "Address" );
       
    79             //
       
    80             ParserLine l6 = ParserLine.NewSymFormat( "ThreadWaitingForSpace %08x, SpaceAvailStatPtr %08x\r\n" );
       
    81             l6.SetTargetProperties( new object[] { aQueue.WaitSpace, aQueue.WaitSpace.RequestStatus }, "WaitingThreadAddress", "Address" );
       
    82 
       
    83             para.Add( l1, l2, l3, l4, l5, l6 );
       
    84             return para;
       
    85         }
       
    86         #endregion
       
    87     }
       
    88 }