crashanalysercmd/Libraries/Engine/CrashDebuggerLib/Parsers/State/Implementation/Helpers/HelperDObject.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.Process;
       
    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 HelperDObject
       
    32     {
       
    33         #region Constructors
       
    34         public HelperDObject()
       
    35         {
       
    36         }
       
    37         #endregion
       
    38 
       
    39         #region API
       
    40         public ParserParagraph CreateEntryDetector( string aObjectName, ParserElementBase.ElementCompleteHandler aNewEntryHandler )
       
    41         {
       
    42             ParserParagraph para = new ParserParagraph( "MONITOR_ENTRY_DETECTOR" );
       
    43 
       
    44             // If the "new entry handler" object is utilised, the client wishes to detect when a new entry is created.
       
    45             // This detection will act as a transient call-back to the client - and won't be used to gather any specific
       
    46             // information besides that a new entry has been detected. Furthermore, the entry will be non-consuming and
       
    47             // dequeue itself once it "fires" since it's purpose has then been served.
       
    48             if ( aNewEntryHandler == null )
       
    49             {
       
    50                 throw new ArgumentException( "aNewEntryHandler cannot be NULL" );
       
    51             }
       
    52 
       
    53             ParserLine newEntryLine = ParserLine.NewSymFormat( aObjectName.ToUpper() + " at %08x VPTR=%08x AccessCount=%d Owner=%08x\r\n" );
       
    54             newEntryLine.ElementComplete += new ParserElementBase.ElementCompleteHandler( aNewEntryHandler );
       
    55             newEntryLine.DequeueIfComplete = true;
       
    56             newEntryLine.NeverConsumesLine = true;
       
    57             para.Add( newEntryLine );
       
    58             return para;
       
    59         }
       
    60 
       
    61         public ParserParagraph CreateMonitorObjectParagraph( string aName, DObject aObject )
       
    62         {
       
    63             ParserParagraph para = new ParserParagraph( aName );
       
    64 
       
    65             // This is a real line that will gather and save information for the client...
       
    66             ParserLine l1 = ParserLine.NewSymFormat( "%S at %08x VPTR=%08x AccessCount=%d Owner=%08x\r\n" );
       
    67             l1.SetTargetProperties( aObject, "<dummy>", "KernelAddress", "VTable", "AccessCount", "OwnerAddress" );
       
    68             l1[ 0 ].SetTargetObject();
       
    69             //
       
    70             ParserLine l2 = ParserLine.NewSymFormat( "Full name %S\r\n" );
       
    71             l2.SetTargetProperties( aObject, "Name" );
       
    72             //
       
    73             para.Add( l1, l2 );
       
    74             return para;
       
    75         }
       
    76         #endregion
       
    77 
       
    78         #region Call-back methods
       
    79         #endregion
       
    80 
       
    81         #region Internal methods
       
    82         #endregion
       
    83     }
       
    84 }