libraries/clogger/debugRouter/dobject_compat.cpp
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // dobject_compat.cpp
       
     2 // 
       
     3 // Copyright (c) 2007 - 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "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 // Accenture - Initial contribution
       
    11 //
       
    12 
       
    13 #include "dobject_compat.h"
       
    14 
       
    15 extern TBool gRunningWithOldDefinition = ETrue;
       
    16 
       
    17 NONSHARABLE_CLASS(DObjectWithPaddingOnly) : public DObject
       
    18 	{
       
    19 public:
       
    20 	DOBJECT_PADDING;
       
    21 	};
       
    22 
       
    23 TBool CalculateDObjectSize()
       
    24 	{
       
    25 	DObjectWithPaddingOnly* obj = new DObjectWithPaddingOnly;
       
    26 	if (!obj) return EFalse;
       
    27 	
       
    28 	// objectId points to the mem location where iObjectId will be. So if running on a system with the new size DOBject it will always be non-zero (because objectIds are set in the DObject constructor, and are always non-zero), but if running on earlier systems it will be zero because DBase zero-fills the object
       
    29 	TUint64& objectId = *reinterpret_cast<TUint64*>((TUint8*)&obj->iName + sizeof(HBuf*));
       
    30 	
       
    31 	if (objectId != 0)
       
    32 		{
       
    33 		//Kern::Printf("Detected MemoryAccess is running with new larger DObject");
       
    34 		gRunningWithOldDefinition = EFalse;
       
    35 		}
       
    36 	else
       
    37 		{
       
    38 		//Kern::Printf("Detected MemoryAccess is running with old-format DObject");		
       
    39 		}
       
    40 	obj->Close(NULL);
       
    41 	return ETrue;
       
    42 	}